#include "FiveWin.ch"
#include "Report.ch"
#include "xBrowse.ch"
REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO
// first mode OK
/*
Function Main()
Local oDlg,oBrw
RddSetDefault( "DBFCDX" )
Crea_dbf() //create and popolate dbf
DEFINE DIALOG oDlg TITLE "Testing xBrowse" ;
SIZE 600,400
@ 82.3, 4 FOLDEREX oFld PIXEL ADJUST ;
ITEMS "&Richiedente","Guasto &segnalato","&Guasto riscontrato","Soluzione","Parti di ricambio";
SIZE 280,80 ANIMATE SPEED 10
oFld:nOption:=2
@0,0 XBROWSE oBrw SIZE 0,0 PIXEL OF oFld:aDialogs[5] ALIAS "RB";
COLUMNS 'RB->CodArt','RB->Articolo','RB->Misura','RB->Quantita','RB->Iva','RB->Unitario','RB->Totale' ;
COLSIZES 40,140,50,30,40,80,90 ;
HEADERS i18n("Codice"),i18n("Articolo"), i18n("Unità"),i18n("Qt."),i18n("Iva"),i18n("Unitario"),i18n("Totale") ;
PICTURES ,,,'@ 9999',,'@ €99,999.99','@ €99,999.99' ;
CELL LINES FOOTERS NOBORDER FASTEDIT
WITH OBJECT oBrw:aCols[ 1 ]
:cFooter:="Total"
END
WITH OBJECT oBrw:aCols[ 4 ]
:nEditType := EDIT_GET
:lTotal:=.T.
:nTotal:=000
END
WITH OBJECT oBrw:aCols[ 6 ]
:nEditType := EDIT_GET
:lTotal:=.T.
:nTotal:=0.00
END
WITH OBJECT oBrw:aCols[ 7 ]
:nEditType := EDIT_GET
:lTotal:=.T.
:nTotal:=0.00
END
oBrw:MakeTotals()
oBrw:nStretchCol := STRETCHCOL_WIDEST
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
Close All
Return
*/
// Second mode K.O.
//------------------//
Function Main()
Local oDlg,oBrw,aBrowseRb
RddSetDefault( "DBFCDX" )
Crea_dbf() //create and popolate dbf
DEFINE DIALOG oDlg TITLE "Testing xBrowse"
@0,0 XBROWSE oBrw SIZE 0,0 PIXEL OF oDlg ; //ALIAS "RB";
CELL LINES FOOTERS NOBORDER FASTEDIT
aBrowseRb := { { { || RB->CodArt }, i18n("Codice"), 40 },;
{ { || RB->Articolo}, i18n("Articolo"),140 },;
{ { || RB->Misura}, i18n("Unità"), 50 },;
{ { || TRANSFORM( RB->Quantita,'@99999')}, i18n("Qt."), 30 },;
{ { || RB->Iva}, i18n("Iva"), 30 },;
{ { || TRANSFORM( RB->Unitario,'@€ 999,999.99')}, i18n("Unitario"), 80 },;
{ { || TRANSFORM( RB->Totale,'@€ 999,999.99')}, i18n("Totale"), 90 } }
FOR i := 1 TO Len(aBrowseRb)
oCol := oBrw:AddCol()
oCol:bEditValue := aBrowseRb[ i, 1 ] // Changed to bEditValue from bStrData
oCol:cHeader := aBrowseRb[ i, 2 ]
oCol:nWidth := aBrowseRb[ i, 3 ]
NEXT
WITH OBJECT oBrw:aCols[ 1 ]
:cFooter:="Total"
END
WITH OBJECT oBrw:aCols[ 4 ]
:nEditType := EDIT_GET
:lTotal:=.T.
:nTotal:=0.00
END
WITH OBJECT oBrw:aCols[ 6 ]
:nEditType := EDIT_GET
:lTotal:=.T.
:nTotal:=0.00
END
WITH OBJECT oBrw:aCols[ 7 ]
:nEditType := EDIT_GET
:lTotal:=.T.
:nTotal:=0.00
END
oBrw:nStretchCol := STRETCHCOL_WIDEST
//oBrw:MakeTotals()
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED ON INIT oBrw:MakeTotals()
Close All
Return
//----------------------------
Function Crea_dbf()
DbCreate('RB', {{'Documento' , 'C', 10, 0} ,;
{'CodArt' , 'C', 4, 0} ,;
{'Articolo' , 'C', 30, 0} ,;
{'Misura' , 'C', 8, 0} ,;
{'Quantita' , 'N', 4, 0} ,;
{'Iva' , 'N', 5, 2} ,;
{'Unitario' , 'N', 10, 2} ,;
{'Totale' , 'N', 10, 2}}, 'DBFCDX')
close all
use &('RB') alias RB new
select RB
if FILE('RICAMBI.DBF')
delete file &('RICAMBI.cdx')
append from &('RICAMBI')
dbcommitall()
close all
delete file &('RICAMBI.dbf')
endif
close all
rename &('RB.dbf') to &('RICAMBI.dbf')
close all
use ricambi alias RB new
For n=1 to 3
RB->(DbAppend())
Replace RB->Documento with "0010"
Replace RB->CodArt with strzero(n,4)
Replace RB->Articolo with str(n)
Replace RB->Misura with "SC"
Replace RB->Quantita with n+1
Replace RB->Iva with 20
Replace RB->Unitario with n
Replace RB->Totale with (n*n)
next
Go Top
return ni