I have some VERY simple code that I can not get to work . For one .. the Headers are incorrect .. and I want to use FASTEDIT and SetCHeck on the first column and I just can't make it work ..
I would appreciate a second set of eyes for some advice .. as you can see from the pic below .. the Headers are not using the HEADERS defines ( lower case ) .
- Code: Select all Expand view
// gasdupet.prg delete routine for gas ticket dupe
#Include "FiveWin.Ch"
#Include "xBrowse.Ch"
//---------------------
FUNC _GasDupe()
LOCAL SAYING
LOCAL cSQL, oERR,oDlg,oSay,cSay,oRsGas
Local lOk
Local SiteDbf,SiteIdx
Local xGrad,oLbx,oCol
Local Dbf_Stru
Local cType,xAgency
Local cFile,aDir,nStart,dExe
REQUEST DBFCDX
rddsetdefault ( "DBFCDX" )
cFILE := GetModuleFileName( GetInstance() )
aDIR := DIRECTORY( cFILE )
dEXE := aDIR[1] [3]
// where .exe started from is default directory //
cFILE := GetModuleFileName( GetInstance() )
nSTART := RAT( "\", cFILE )
cDEFA := SUBSTR(cFILE,1,nSTART-1)
SET DEFA to ( cDEFA )
cType := "MANSFIELD"
xAgency := "J12"
lOk := .f.
Do Case
Case cType = "MANSFIELD"
If xAgency = "J04" .or. xAgency = "J12" .or. xAgency = "1945"
Else
Saying := "Sorry .. You are not authorized to use the Mansfield Option"
Msginfo( saying )
Return(.f.)
Endif
Case cType = "FUELMASTER"
If xAgency = "1750"
Else
Saying := "Sorry .. You are not authorized to use the FUELMASTER Option"
Msginfo( saying )
Return(.f.)
Endif
EndCase
// cTYPE is either
// MANSFIELD
// FUELMASTER
IF EMPTY( cTYPE )
cTYPE := "MANSFIELD"
ENDIF
*oWndChild:END()
*SysReFresh()
DO WHILE .T.
SITEDBF := "TEMP"+(SUBSTR(TIME(),7,2)+SUBSTR(TIME(),4,2))+".DBF"
IF .not. FILE( cDefa+"\"+SITEDBF )
EXIT
ENDIF
ENDDO
*cLINE := "Opening Temp Table "+xVOL+"\DBTMP\"+SITEDBF
*oLINE:ReFresh()
*SysReFresh()
DBF_STRU := { }
AADD( DBF_STRU, { "ChkDel", "L", 1, 0 } )
AADD( DBF_STRU, { "Date", "D", 8, 0 } )
AADD( DBF_STRU, { "Vnumber", "C", 6, 0 } )
AADD( DBF_STRU, { "License", "C", 8, 0 } )
AADD( DBF_STRU, { "MotorPool", "C", 10, 0 } )
AADD( DBF_STRU, { "Deputy", "C", 10, 0 } )
AADD( DBF_STRU, { "Vendor", "C", 30, 0 } )
AADD( DBF_STRU, { "Fuel_Type", "C", 15, 0 } )
AADD( DBF_STRU, { "Gal_Pump", "N", 7, 2 } )
AADD( DBF_STRU, { "Trans_Amt", "N", 10, 2 } )
AADD( DBF_STRU, { "GasEid", "C", 18, 0 } )
Try
DBCREATE( cDefa+"\"+SITEDBF, DBF_STRU )
Catch
Saying := "Sorry .. you do not have Sufficient Network Rights to "+chr(10)
Saying += cDefa+"\"+chr(10)
Saying += "Please seek your Network Administrator"+chr(10)
MsgInfo( Saying )
CLOSE DATABASES
FERASE( cDefa+"\"+SITEDBF)
FERASE( cDefa+"\"+SITEiDX)
RETURN(NIL)
End Try
DO WHILE .T.
SITEiDX := "TEMP"+(SUBSTR(TIME(),7,2)+SUBSTR(TIME(),4,2))+".IDX"
IF .not. FILE( cDefa+"\"+SITEiDX )
EXIT
ENDIF
ENDDO
Select 4
Use( cDefa+"\"+SITEDBF) VIA "DBFCDX" EXCL
Index on Dtos(Date)+Vnumber to ( cDefa+"\"+SITEiDX )
Select 4
append blank
d->ChkDel := .f.
d->Date := Date()
d->Vnumber := "00655"
d->License := "SG71666"
d->Motorpool := "2440"
d->Deputy := "DIV 1"
d->Fuel_Type := "DIESEL"
d->Vendor := "MANSFIELD"
d->Gal_Pump := 32.59
d->Trans_Amt := 67.39
d->GasEid := "123457778"
Select 4
Append Blank
d->ChkDel := .f.
d->Date := Date()
d->Vnumber := "00655"
d->License := "SG71666"
d->Motorpool := "2440"
d->Deputy := "DIV 1"
d->Fuel_Type := "DIESEL"
d->Vendor := "MANSFIELD"
d->Gal_Pump := 32.59
d->Trans_Amt := 67.39
d->GasEid := "77888777666"
Select 4
GoTo Recno()
Select 4
Go Top
*xbrowse()
xGrad := { { .50, nRGB( 216, 216, 216 ), nRGB( 255, 255, 255 ) } } // lightgreygrad
*SysReFresh()
DEFINE DIALOG oDlg RESOURCE "GASDUPE" ;
TITLE cTYPE+" Gas Duplication Routine" ;
REDEFINE xBROWSE oLBX ;
ALIAS @SiteDbf ;
COLUMNS "CHKDEL", ;
"DATE", ;
"VNUMBER", ;
"LICENSE", ;
"MOTORPOOL", ;
"DEPUTY", ;
"VENDOR", ;
"FUEL_TYPE", ;
"GAL_PUMP", ;
"TRANS_AMT", ;
"GASEID" ;
COLSIZES 70,70,70,70,70,70,150,70,70,70,70;
HEADERS "ChkDel", ;
"Date", ;
"VehNumb", ;
"License", ;
"MotorPool", ;
"Deputy", ;
"Vendor", ;
"FuelType", ;
"GalPumped", ;
"TransAmt", ;
"GasEid" ;
ID 172 of oDlg ;
AUTOCOLS LINES AUTOSORT CELL
*AUTOCOLS LINES CELL
*AUTOCOLS LINES CELL FASTEDIT
* if ! empty(oCol := oLbx:oCol( "CHKDEL" ))
* oCol:SetCheck( { "ON", "OFF" }, EDIT_GET )
* endif
* AEval( oLbx:aCols, { |o| o:nEditType := EDIT_GET } )
REDEFINE BTNBMP oBTN6 ID 122 of oDlg ;
RESOURCE "CANCEL","DCANCEL","DCANCEL" ;
PROMPT "&Quit" LEFT 2007;
ACTION ( lOK := .F., oDlg:End() )
oDlg:bResized = { | nSizeType, nWidth, nHeight | _ResizeControls( nSizeType, nWidth, nHeight, oDlg )}
ACTIVATE DIALOG oDlg ;
ON PAINT ( GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, xGrad, .T. )); // note GradientFill
VALID(!GETKEYSTATE( 27 ))
Close Databases
FERASE( cDefa+"\"+SITEDBF)
FERASE( cDefa+"\"+SITEiDX)
RETURN( NIL )
//--------------------------------------------------------------------
Static Func _ResizeControls( nSizeType, nWidth, nHeight, oDlg )
*xbrowse(oDLg1:aControls)
if nSizeType = 0 //SIZE_MAXIMIZED //60 //10
oDlg:aControls[ 1 ]:SetSize( nWidth - 98, nHeight - 10 ) //txbrowse
endif
Return(nil)
// end
GasDupe.RC
- Code: Select all Expand view
// Generated by ResEdit 1.6.6
// Copyright (C) 2006-2015
// http://www.resedit.net
#include <windows.h>
#include <commctrl.h>
//
// Dialog resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
GASDUPE DIALOG 6, 13, 613, 355
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_THICKFRAME | WS_SYSMENU
FONT 8, "Arial"
{
CONTROL "Inventory Detail", 172, "TXBrowse", 0x50B10000, 4, 42, 605, 310, 0x00000000
CONTROL "Quit", 122, "TBtnBmp", 0x50010020, 567, 6, 41, 25, 0x00000000
}