Estimados
El mismo programa para la MC3000 funciona para la MC1000
Se que no es gran cosa, pero anexo el programa de como quedo.
Saludos
include "fwce.ch"
include "hbclass.ch"
include "Directry.ch"
define crlf chr(13)+chr(10)
define CRLF chr(13)+chr(10)
define CR chr(13)
pragma comment (lib,"scnapi32")
FUNCTION Main()
* begin
PRIVATE oWnd
PRIVATE nCant := 1 , oCant
PRIVATE nCantUltimo := 1 , oCantUltimo
PRIVATE oMsg , oMsgUltimo
PRIVATE cBarCode := space(13) , oBarCode
PRIVATE nContador := 0 , oContador
PRIVATE nContador2 := 0 , oContador2
PRIVATE cCurDir := curdir()
PRIVATE aTemp_file := {}
IF StillRun("Toma-Facil++ V1.0")
Quit
ENDIF
if ! file( cCurDir+"INVENTA.DBF")
aadd( aTemp_file , { "BARCODE","C",13,0} )
aadd( aTemp_file , { "INVENTARIO" ,"N",08,0} )
aadd( aTemp_file , { "FECHA" ,"D",08,0} )
aadd( aTemp_file , { "HORA" ,"C",08,0} )
create_tmp_file( aTemp_file , cCurDir , "inventa.dbf" )
endif
if ! file( cCurDir+"INVENTA.DBF")
msginfo("Base de datos no pudo se creada.")
close all
return
endif
use ( cCurDir +"INVENTA.DBF" ) alias INVENTA
index on upper( barcode ) to ( cCurDir+"INVENTA.NTX" )
set order to 1
go top
DEFINE WINDOW oWnd TITLE "Toma-Facil++ V1.0"
@ 1.0,02 SAY "Cantidad :" SIZE 70, 20
@ 1.0,12 GET oCant VAR nCant picture "99999" VALID CheckCant() SIZE 40, 20
@ 2.3,02 SAY "Codigo :" SIZE 70, 20
@ 2.5,12 GET oBarCode VAR cBarcode picture "@!" VALID CheckBarCode() SIZE 120, 20
@ 04.0,02 SAY oMsgUltimo VAR "Ultimo : Cant:" SIZE 400, 20
@ 06.5,02 SAY oContador VAR "Piezas:" SIZE 200, 20
@ 08.0,02 SAY oContador2 VAR "Codigos:" SIZE 200, 20
- @ 08.5,02 SAY oMsg VAR "Msg :" SIZE 400, 20
@ 08.5,22 BUTTON "Terminar" SIZE 80, 30 ACTION oWnd:END()
ACTIVATE WINDOW oWnd on Init BuildTimer( oWnd )
RETURN NIL
procedure BuildTimer( oWnd )
* Begin
Define Timer oTimer Interval 1000 Action CheckBattery() OF oWnd
Activate Timer oTimer
return
function CheckBattery()
If BatteryLife () < 10
oMsg:VarPut( "!! Bateria Baja, Grabe su informacion.!!")
oMsg:refresh()
endif
return .t.
FUNCTION CheckCant()
* begin
LOCAL cFile , cRet , nActual := 0 , lReturn := .F.
IF oCant:nLastKey = 13
cBarCode := ""
cRet := SCAN_OPEN()
IF valtype( cRet ) = "C"
cRet := strtran( cRet , chr(0),"" )
FOR i := 1 TO len( cRet )
IF substr(cRet,i,1) $"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890+-/"
cBarCode += substr(cRet,i,1)
ENDIF
NEXT
ENDIF
cBarCode := alltrim(cBarcode)+space(13-len(alltrim(cBarcode)))
IF ! empty( cBarCode )
if INVENTA->(DbSeek( cBarcode))
replace INVENTA->inventario with INVENTA->inventario + nCant
else
INVENTA->(DbAppend())
replace INVENTA->barcode with cBarcode
replace INVENTA->inventario with nCant
endif
replace INVENTA->fecha with date()
replace INVENTA->hora with time()
nContador += nCant
oContador:VarPut("Piezas:"+transform(nContador,"999"))
oContador:refresh()
nContador2 += 1
oContador2:VarPut("Codigos:"+transform(nContador2,"999"))
oContador2:refresh()
oCant:VarPut(1)
oCant:refresh()
oBarCode:VarPut( space(15))
oBarCode:refresh()
oMsgUltimo:VarPut("Ultimo:"+alltrim(cBarCode)+" Cant:"+transform(nCant,"999"))
oMsgUltimo:refresh()
ENDIF
ELSE
lReturn := .T.
ENDIF
RETURN lReturn
FUNCTION CheckBarCode()
* begin
LOCAL cFile , cRet , nActual := 0 , lReturn := .F. , nHandle , cTxt
IF oBarCode:nLastKey = 38
oBarCode:oJump := oCant
RETURN .T.
ENDIF
if oBarCode:nLastKey = 13
cBarCode := alltrim(cBarcode)+space(13-len(alltrim(cBarcode)))
if INVENTA->(DbSeek( cBarcode))
replace INVENTA->inventario with INVENTA->inventario + nCant
else
INVENTA->(DbAppend())
replace INVENTA->barcode with cBarcode
replace INVENTA->inventario with nCant
endif
replace INVENTA->fecha with date()
replace INVENTA->hora with time()
nContador += nCant
oContador:VarPut("Piezas:"+transform(nContador,"999"))
oContador:refresh()
nContador2 += 1
oContador2:VarPut("Codigos:"+transform(nContador2,"999"))
oContador2:refresh()
oCant:VarPut(1)
oCant:refresh()
oBarCode:VarPut( space(15))
oBarCode:refresh()
oMsgUltimo:VarPut("Ultimo:"+cBarCode+" Cant:"+transform(nCant,"999"))
oMsgUltimo:refresh()
oCant:VarPut(1)
lReturn := .T.
endif
IF lReturn
oBarCode:oJump := oCant
ENDIF
RETURN lReturn
- Funciones que no corren en Symbol MC3000
FUNCTION cesetmenu() ; RETURN NIL
FUNCTION getmenu() ; RETURN NIL
FUNCTION readbitmap() ; RETURN NIL
FUNCTION palbmpread() ; RETURN NIL
pragma BEGINDUMP
include <hbapi.h>
include <windows.h>
include <Scancapi.h>
include <mmsystem.h>
include <uniqueid.h>
LPWSTR AnsiToWide( LPSTR );
define BUFFER_SIZE 7095
define DEFAULT_TIMEOUT 10000
LPSCAN_BUFFER lpScanBuffer = NULL;
BOOL bUseText = TRUE;
DWORD dwScanSize = 7095;
DWORD dwScanTimeout = 0;
HANDLE hScanner = NULL;
TCHAR szScannerName[MAX_PATH] = TEXT("SCN1:");
DWORD dwResult ;
CHAR Buffer ;
UINT uMsg ;
DWORD dwTimeout ;
HB_FUNC( SCAN_OPEN )
{
dwResult = SCAN_Open( szScannerName, &hScanner );
if ( dwResult == E_SCN_SUCCESS )
{
dwResult = SCAN_Enable( hScanner );
if ( dwResult == E_SCN_SUCCESS )
{
BOOL state = TRUE;
dwResult = SCAN_SetSoftTrigger(hScanner, &state);
if (dwResult == E_SCN_SUCCESS)
{
// allocate a new scan buffer
lpScanBuffer = SCAN_AllocateBuffer(TRUE / data as chars /, BUFFER_SIZE);
if (lpScanBuffer)
{
dwResult = SCAN_ReadLabelWait(hScanner, lpScanBuffer, DEFAULT_TIMEOUT);
if (dwResult == E_SCN_SUCCESS)
{
hb_retclen( (char *)SCNBUF_GETDATA(lpScanBuffer),28);
}
}
SCAN_DeallocateBuffer(lpScanBuffer);
}
state = FALSE;
SCAN_SetSoftTrigger(hScanner, &state);
}
else
{
MessageBox( GetActiveWindow(), L"Error en SCAN_Enable", L"Ok", 0 );
}
}
else
{
MessageBox( GetActiveWindow(), L"Error en SCAN_Open", L"Ok", 0 );
}
}
HB_FUNC (STILLRUN)
{
HWND hWnd;
BOOL lRet = FALSE;
LPWSTR pW = AnsiToWide( hb_parc( 1 ) );
hWnd = FindWindow ( NULL,pW);
if (hWnd)
{
SetForegroundWindow ((HWND) ((ULONG) hWnd |0x01));
lRet = TRUE;
}
hb_retl( lRet );
}
HB_FUNC (BATTERYLIFE)
{
BOOL iRet;
SYSTEM_POWER_STATUS_EX status;
iRet = GetSystemPowerStatusEx (&status, TRUE);
hb_retnl ((INT) status.BatteryLifePercent);
}
HB_FUNC (BATTERYINFO)
{
BOOL iRet;
SYSTEM_POWER_STATUS_EX status;
iRet = GetSystemPowerStatusEx (&status, TRUE);
hb_reta (9);
hb_stornl ((INT) status.ACLineStatus, -1, 1);
hb_stornl ((INT) status.BatteryFlag, -1, 2);
hb_stornl ((INT) status.BatteryLifePercent, -1, 3);
hb_stornl ((ULONG) status.BatteryLifeTime, -1, 4);
hb_stornl ((ULONG) status.BatteryFullLifeTime, -1, 5);
hb_stornl ((INT) status.BackupBatteryFlag, -1, 6);
hb_stornl ((INT) status.BackupBatteryLifePercent, -1, 7);
hb_stornl ((ULONG) status.BackupBatteryLifeTime, -1,
;
hb_stornl ((ULONG) status.BackupBatteryFullLifeTime, -1, 9);
}
pragma ENDDUMP
FUNCTION create_tmp_file( aFields , cPath , cName )
* Begin
LOCAL temp
temp := cPath
temp := temp+cName
DbCreate( temp , aFields , "DBFNTX" )
RETURN temp