Se cuelga la app con array
-
- Posts: 31
- Joined: Fri Mar 17, 2006 2:04 pm
Se cuelga la app con array
Hola amigos,
tengo un modulo donde cargo un array con datos de ventas, luego al imprimir los guardo en la base (.dbf), posterior limpio el array y vuelvo al principio a cargar el mismo array con la siguiente venta.
mi problema es que cuando cargo muchas veces el array aumenta el uso en memoria de la app(.exe) y llega a un punto en que se cuelga y debo sacarla de memoria con el administrador de tareas e iniciar la app nuevamente.
alguien me puede ayudar con este problema.. o como libero el uso de la memoria utilizando array's.
Win xp 256, fwh 2.7 xharbour
tengo un modulo donde cargo un array con datos de ventas, luego al imprimir los guardo en la base (.dbf), posterior limpio el array y vuelvo al principio a cargar el mismo array con la siguiente venta.
mi problema es que cuando cargo muchas veces el array aumenta el uso en memoria de la app(.exe) y llega a un punto en que se cuelga y debo sacarla de memoria con el administrador de tareas e iniciar la app nuevamente.
alguien me puede ayudar con este problema.. o como libero el uso de la memoria utilizando array's.
Win xp 256, fwh 2.7 xharbour
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 31
- Joined: Fri Mar 17, 2006 2:04 pm
Como
Gracias Antonio, yo por aqui volviendo ... sabes igual cada vez que cargo el modulo aumenta el uso en memoria de la app.(.exe), esto me ocurre con el uso del array, yo cargo la informacion de venta en un array y luego al imprimir lo guardo en la Dbf, y vuelvo con una nueva venta, pero llega una momento en que la app(.exe) se cuelga y debo iniciarla nuevamente...
ayuda por favor..
salu2
mauro
ayuda por favor..
salu2
mauro
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Mauro,
Has probado lo que te he comentado de hb_gcAll() ?
Que versión de Harbour ó xharbour estás usando ? Debes usar la más reciente posible, puedes descargarlas desde:
www.fivetechsoft.com/files/harbour.exe
www.fivetechsoft.com/files/xharbour.exe
Has probado lo que te he comentado de hb_gcAll() ?
Que versión de Harbour ó xharbour estás usando ? Debes usar la más reciente posible, puedes descargarlas desde:
www.fivetechsoft.com/files/harbour.exe
www.fivetechsoft.com/files/xharbour.exe
-
- Posts: 31
- Joined: Fri Mar 17, 2006 2:04 pm
-
- Posts: 845
- Joined: Sun Oct 09, 2005 5:36 pm
- Location: la laguna, mexico.
-
- Posts: 31
- Joined: Fri Mar 17, 2006 2:04 pm
Hola Francisco, aqui a el código de ese modulo quisas sea un poco largo..
en terminos generales, el prg cuenta con 2 clases la primera para realizar una apertuta de caja y recuperar unos valores para pasarselos a la segunda clase y la segunda es la que acumula ventas en el method guardar esta el array que cargo con ventas, una vez concluida la venta primero la imprimo y luego la paso a la dbf desde el array.
**VENTA POR BOLETAS DESDE POS
#include "FIVEWIN.CH"
#include "DTPICKER.CH"
#include "DOSPRINT.CH"
#include "COLORS.CH"
#include "xbrowse.ch"
#include "GETS.CH"
#DEFINE CLR_GRID1 RGB( 239, 239, 224 )
#define Brw_nAt ::oBrw:nArrayAt
#define DB_TABLAS ::aDbf[01]
#define DB_LOCAL ::aDbf[02]
#define DB_CAJAS ::aDbf[03]
/*-----------------------------------------------------------------------------------------------*/
CLASS FT604AbreCaja
DATA oDlg1
DATA oBrw, oWnd, oBtb, oSay, oMsg
DATA oMa
DATA oGet, vGet
DATA oCmb, vCmb, aCmb
DATA oDpk, vDpk
DATA oCkb, vCkb
DATA oRbt, vRbt
DATA oBtn
DATA aDbf, bLoc
DATA cScope
DATA aDatos, aLocal, aMeses, aAnos, aCmb, aTurnos
DATA cMes, cAno, cLocal, cTurnos, cMesano
DATA lBrw, lRbt
METHOD Open()
METHOD Init()
METHOD New() Constructor
METHOD Close() INLINE AEval( ::aDbf, { |oDbf| oDbf:Close) } ), .T.
METHOD Agregar()
METHOD Pos()
METHOD Valid()
METHOD Datos()
ENDCLASS
METHOD Open CLASS FT604AbreCaja
::aDbf := Array( 03 )
DB_TABLAS := TRed():Use( GetApp():cRuta + "COTABLAS.DBF" )
DB_LOCAL := TRed():Use( GetApp():cRuta + "MALOCCOM.DBF" )
DB_CAJAS := TRed():Use( GetApp():cRuta + "MOCAJERO.DBF" )
RETURN lTredOpen( ::aDbf )
/*-----------------------------------------------------------------------------------------------*/
METHOD Init() CLASS FT604AbreCaja
::oBtn := Array( 02 )
::vGet := Array( 05 )
::oGet := Array( 05 )
::oCmb := Array( 04 )
::aCmb := Array( 02 )
::aMeses := { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto",;
"Septiembre", "Octubre", "Noviembre", "Diciembre" }
::aAnos := {}
FOR nFor = 2004 TO Year( Date() )
AAdd( ::aAnos, StrZero( nFor, 04 ) )
NEXT
::cMes := Array( 02 )
::cAno := Array( 02 )
AFill( ::cMes, ::aMeses[ Month( Date() ) ] )
AFill( ::cAno, ::aAnos[ Len( ::aAnos ) ] )
DB_LOCAL:dbSetOrder( 1 )
::aLocal := Array( 02 )
::aLocal[01] := {}; ::aLocal[02] := {}
AAdd( ::aLocal[01], "0000" ); AAdd( ::aLocal[02], "Todos" )
DB_LOCAL:Eval( { || AAdd( ::aLocal[01], DB_LOCAL:CODLOC ),;
AAdd( ::aLocal[02], DB_LOCAL:DESLOC ) } )
::cLocal := ::aLocal[02][01]
::aTurnos := Array( 02 )
::aTurnos[01] := { "01","02","03"}
::aTurnos[02] := { "Mañana", "Tarde", "Noche" }
DB_CAJAS :DBSetOrder( 03 )
DB_TABLAS:DBSetOrder( 01 )
DB_TABLAS:Scope( "VEN", "VEN", 01 )
::vRbt := ::lRbt
::vDpk := Date()
::vGet[01] := 0
::vGet[02] := 0
::vGet[03] := Space( 08 )
::vGet[04] := Space( 08 )
RETURN .T.
METHOD New( lBrw, lRbt) CLASS FT604AbreCaja
::lBrw := lBrw
::lRbt := lRbt
IF !::Open(); RETURN NIL; ENDIF
IF !::INIT()
::Close()
RETURN NIL
ENDIF
DEFINE Dialog ::oDlg1 Resource "DL_APERTURA"
REDEFINE DTPICKER ::oDpk VAR ::vDpk id 101 OF ::oDlg1
REDEFINE RADIO ::oRbt VAR ::vRbt id 102, 103 OF ::oDlg1; ::oRbt:Disable()
REDEFINE COMBOBOX ::oCmb[01] VAR ::cMes[01] ID 105 OF ::oDlg1 ITEMS ::aMeses
REDEFINE COMBOBOX ::oCmb[02] VAR ::cAno[01] ID 106 OF ::oDlg1 ITEMS ::aAnos
REDEFINE COMBOBOX ::oCmb[03] VAR ::cLocal ID 107 OF ::oDlg1 ITEMS ::aLocal[02]
Redefine Combobox ::oCmb[04] VAR ::cTurnos ID 109 OF ::oDlg1 Items ::aTurnos[02]
REDEFINE GET ::oGet[01] VAR ::vGet[01] id 108 OF ::oDlg1 Update when ::vRbt = 1
REDEFINE GET ::oGet[02] VAR ::vGet[02] ID 115 OF ::oDlg1 Update When ::vRbt = 2
redefine GET ::oGet[03] VAR ::vGet[03] id 110 of ::oDlg1 Update when ::vRbt = 1
Redefine Get ::oGet[04] VAR ::vGet[04] id 111 of ::oDlg1 Update When ::vRbt = 2
Redefine Get ::oGet[05] VAR ::vGet[05] ID 112 of ::oDlg1 Update
Redefine Button ::oBtn[01] id 113 of ::oDlg1 Action ::Valid( ::lBrw, ::lRbt )
Redefine Button ::oBtn[02] ID 114 of ::oDlg1 Action ::oDlg1:END()
WITH OBJECT ( ::oBrw := TXBrowse():New( ::oDlg1 ) )
:cAlias := DB_TABLAS:cAlias
:SetRdd()
:aCols[01]:cHeader := "Código"
:aCols[01]:bStrData := { || DB_TABLAS:CODTAB }
:aCols[02]:cHeader := "Nombre Cajero"
:aCols[02]:bStrData := { || DB_TABLAS:DESTAB }
:aCols[02]:nWidth := 220
:nFreeze := 02
:lColDividerComplete := .T.
:nColDividerStyle := 002
:lHScroll := .F.
:lAllowColSwapping := .F.
:lAllowColHiding := .F.
:nMarqueeStyle := 006
:CreateFromResource(104)
END
WITH OBJECT ::oDlg1
:bValid := { || ::Close() }
END
::oCmb[04]:nAt := 02
::oBrw:bChange := { || ::Datos() }
::oCmb[03]:nAt := 01
::oGet[05]:Disable()
::oBtn[01]:Disable()
Activate Dialog ::oDlg1 Center
RETURN Self
METHOD Datos() CLASS FT604AbreCaja
DB_CAJAS:DBSetOrder( 01 )
::cMesano := Strzero( ::oCmb[01]:nAt, 02 ) + SubStr( ::aAnos[ ::oCmb[02]:nAt], 3, 2 )
IF ( DB_CAJAS:SEEK( ::cMesano + DToS( ::vDPk ) + DB_TABLAS:CODTAB + "T" ) )
MsgWait( "Caja abierta por " + Trim( DB_TABLAS:DESTAB ) + " a las "+ DB_CAJAS:HORAPE , "Atención Cajeros...!!!", 1 )
::vGet[01] := DB_CAJAS:SALAPE
::vGet[03] := DB_CAJAS:BOLINI
::vGet[05] := DB_CAJAS:BOLACT
IF ::vRbt == 1
::oGet[01]:Disable()
::oGet[02]:Disable()
::oGet[03]:Disable()
::oGet[04]:Disable()
ELSE
::oGet[02]:Enable()
::oGet[04]:Enable()
ENDIF
ENDIF
::oBtn[01]:Enable()
::oDlg1:update()
RETURN NIL
METHOD Valid( lBrw, lRbt ) CLASS FT604AbreCaja //este metodo valid para que control es ?
LOCAL oApp, nLoc, nBol, cLoc
::cMesano := Strzero( ::oCmb[01]:nAt, 02 ) + SubStr( ::aAnos[ ::oCmb[02]:nAt], 3, 2 )
nLoc := ::aLocal[01][ ::oCmb[03]:nAt ]
cLoc := ::aLocal[02][ ::oCmb[03]:nAt ]
IF lBrw
DB_CAJAS:DBSetOrder( 01 )
IF ( DB_CAJAS:SEEK( ::cMesano + DToS( ::vDPk ) + DB_TABLAS:CODTAB + "T" ) )
::vGet[05] := DB_CAJAS:BOLACT
nBol := DB_CAJAS:BOLACT
nLoc := DB_CAJAS:LOCCOM
IF (DB_LOCAL:SEEK( DB_CAJAS:LOCCOM ), cLoc := DB_LOCAL:DESLOC , cLoc := "Nuevo " )
::oDlg1:END()
::Pos( nBol, nLoc, cLoc )
ELSE
::Agregar()
ENDIF
ELSE
IF lRbt = 2
::oDlg1:END()
ELSE
::Agregar()
ENDIF
ENDIF
RETURN nil
METHOD Agregar() CLASS FT604abreCaja
LOCAL lBrw := .T., oApp, cLoc, nBol , nLoc
IF ::aLocal[01][ ::oCmb[03]:nAt ] == '0000'
MsgInfo( "Falta Selección de Sucursal", "Atención Cajeros" )
RETURN (.F.)
ENDIF
DB_CAJAS:DBSetOrder( 01 )
::cMesano := Strzero( ::oCmb[01]:nAt, 02 ) + SubStr( ::aAnos[ ::oCmb[02]:nAt], 3, 2 )
IF ::vRbt == 1
IF ::vGet[01] == 0
MsgInfo( "Ingrese Monto Apertura de Caja","Atención Cajeros" )
RETURN .F.
ENDIF
IF Empty ( ::vGet[03] )
MsgInfo( "Ingrese Boleta Inicial Asignada","Atención Cajeros" )
RETURN .F.
ENDIF
IF ( DB_CAJAS:SEEK( ::cMesano + DToS( ::vDPk ) + DB_TABLAS:CODTAB + "T" /*+ StrZero( ::oCmb[04]:nAt, 02 )*/ ) )
IF DB_CAJAS:TIPMOV == .T.
MsgInfo( "Caja abierta por " + Trim( DB_TABLAS:DESTAB ) + " a las "+ DB_CAJAS:HORAPE , "Atención Cajeros, Debe Cerrar Caja" )
::vGet[03] := DB_CAJAS:BOLACT
::oGet[01]:Disable()
::oGet[02]:Disable()
::oGet[03]:Disable()
::oGet[04]:Disable()
ELSE
IF MsgYesNo( "Nueva Apertura de Caja para este día","Atención Cajeros")
DB_CAJAS:Append()
DB_CAJAS:MESPRO := ::cMesano
DB_CAJAS:FECMOV := ::vDpk
DB_CAJAS:TIPMOV := .T.
DB_CAJAS:LOCCOM := ::aLocal[01][ ::oCmb[03]:nAt ]
DB_CAJAS:SALAPE := ::vGet[01]
DB_CAJAS:TURAPE := StrZero( ::oCmb[04]:nAt, 2 )
DB_CAJAS:BOLINI := ::vGet[03]
DB_CAJAS:BOLFIN := ::vGet[04]
DB_CAJAS:BOLACT := ::vGet[03]
DB_CAJAS:CODCAJ := DB_TABLAS:CODTAB
DB_CAJAS:HORAPE := Time()
DB_CAJAS:UNLOCK()
ELSE
lBrw := .F.
ENDIF
ENDIF
ELSE
? "Apertura Nueva caja "
DB_CAJAS:Append()
DB_CAJAS:MESPRO := ::cMesano
DB_CAJAS:FECMOV := ::vDpk
DB_CAJAS:TIPMOV := .T.
DB_CAJAS:LOCCOM := ::aLocal[01][ ::oCmb[03]:nAt ]
DB_CAJAS:SALAPE := ::vGet[01]
DB_CAJAS:TURAPE := StrZero( ::oCmb[04]:nAt, 2 )
DB_CAJAS:BOLINI := ::vGet[03]
DB_CAJAS:BOLFIN := ::vGet[04]
DB_CAJAS:BOLACT := ::vGet[03]
DB_CAJAS:CODCAJ := DB_TABLAS:CODTAB
DB_CAJAS:HORAPE := Time()
DB_CAJAS:COMMIT()
DB_CAJAS:UNLOCK()
ENDIF
ELSE
IF ::vGet[02] == 0
MsgInfo( "Ingrese Monto Cierre de Caja","Atención Cajeros" )
RETURN .F.
ENDIF
IF Empty ( ::vGet[04] )
MsgInfo( "Ingrese Boleta Final Asignada","Atención Cajeros" )
RETURN .F.
ENDIF
IF ( DB_CAJAS:SEEK( ::cMesano+DToS( ::vDPk ) + DB_TABLAS:CODTAB + "T" /* StrZero( ::oCmb[04]:nAt, 2 ) */ ) )
::vGet[01] := DB_CAJAS:SALAPE
::vGet[03] := DB_CAJAS:BOLINI
::vGet[05] := DB_CAJAS:BOLACT
::oDlg1:update()
IF DB_CAJAS:TIPMOV == .T.
DB_CAJAS:RLock()
DB_CAJAS:SALCIE := ::vGet[02]
DB_CAJAS:BOLFIN := ::vGet[04]
DB_CAJAS:TURCIE := StrZero( ::oCmb[04]:nAt, 2 )
DB_CAJAS:HORCIE := Time()
DB_CAJAS:TIPMOV := .F.
DB_CAJAS:UNLOCK()
? "Cierre de Caja Efectuado"
lBrw := .F.
ELSE
MsgInfo( "Cierre ya fue realizado ","Atención Cajero" )
lBrw := .F.
ENDIF
ELSE
MsgInfo( "No Existe Apertura", "Atención Cajeros" )
lBrw := .F.
ENDIF
ENDIF
::oDlg1:Update()
IF lBrw
nLoc := ::aLocal[01][ ::oCmb[03]:nAt ]
cLoc := ::aLocal[02][ ::oCmb[03]:nAt ]
nBol := ::vGet[03]
::Pos( nBol, nLoc, cLoc ) //aqui
::oDlg1:END()
ELSE
::oDlg1:END()
ENDIF
RETURN Self
METHOD Pos( nBol, nLoc, cLoc ) CLASS FT604abreCaja //este de donde lo llmas ?
LOCAL oApp
::oDlg1:END()
oApp := FT604()
oApp:New( Self, nBol, DB_TABLAS:CODTAB, ::cMesano, nLoc, DB_TABLAS:DESTAB, cLoc )
Return NIL
/*-----------------------------------------------------------------------------------------------*/
***FT604 POS
/* Bases de Datos */
#define DB_PRODUC ::aDbf[01]
#define DB_FORPAG ::aDbf[02]
#define DB_VTAPDT ::aDbf[03]
#define DB_PARAM ::aDbf[04]
#define DB_LIBVTA ::aDbf[05]
#define DB_ANALIS ::aDbf[06]
#define DB_DOCPEN ::aDbf[07]
#define DB_DETPRO ::aDbf[08]
#define DB_BANCO ::aDbf[09]
#define DB_CAJAS ::aDbf[10]
/*-----------------------------------------------------------------------------------------------*/
#define AR_DATOS ::aDatos
#define BA_nAt ::oBrw:nArrayAt
#define BA_MESPRO 01
#define BA_LOCCOM 02
#define BA_NUMBOL 03
#define BA_DESPRO 04
#define BA_CODPRO 05
#define BA_UNIPRO 06
#define BA_KILPRO 07
#define BA_PREVTA 08
#define BA_SUBTOT 09
#define BA_FECMOV 10
#define BA_ESTADO 11
#define BA_TIPMOV 12
#define BA_PRECOS 13
/*-----------------------------------------------------------------------------------------------*/
CLASS FT604 //segundo dialogo
DATA oDlg, oDlg2, oDlg3
DATA oBrw, oBtn, oCat
DATA oMa, cMes, nAno
DATA oGet, vGet
DATA oCmb, vCmb, aCmb
DATA oDpk, vDpk, oDpkVc, vDpkVc
DATA oCkb, vCkb
DATA oRbt, vRbt
DATA aDbf, aDatos
DATA oSay, vSay, vUnimed
DATA cScope, Monpal, nRec, nLocal, vMespro, Numbol, vCajero, cNomcaj, cLocal
METHOD Open()
METHOD Init()
METHOD New() Constructor
METHOD Close() INLINE AEval( ::aDbf, { |oDbf| oDbf:Close() } ), .T.
METHOD Agrega()
METHOD Elimina()
METHOD Imprimir()
METHOD Guardar()
METHOD SetBrw()
METHOD PrePro()
METHOD Totales()
METHOD Pago()
METHOD Valida()
METHOD Descomprime()
METHOD Pago()
METHOD Vuelto()
METHOD Tecla()
ENDCLASS
/*-----------------------------------------------------------------------------------------------*/
METHOD Open() CLASS FT604
::aDbf := Array( 10 )
DB_PRODUC := Tred():Use( GetApp():cRuta + "COPRODUC.DBF" )
DB_FORPAG := TRed():Use( GetApp():cRuta + "COFORPAG.DBF" )
DB_VTAPDT := TRed():Use( GetApp():cRuta + "VTASPDTE.DBF" )
DB_PARAM := TRed():Use( GetApp():cRuta + "MAPARSIS.DBF" )
DB_LIBVTA := TRed():Use( GetApp():cRuta + "LIVTABOL.DBF" )
DB_ANALIS := TRed():Use( GetApp():cRuta + "MAANALIS.DBF" )
DB_DOCPEN := TRed():Use( GetApp():cRuta + "CCDOCPEN.DBF" )
DB_DETPRO := TRed():Use( GetApp():cRuta + "DEVTABOL.DBF" )
DB_BANCO := TRed():Use( GetApp():cRuta + "COBANCOS.DBF" )
DB_CAJAS := TRed():Use( GetApp():cRuta + "MOCAJERO.DBF" )
RETURN lTredOpen( ::aDbf )
/*-----------------------------------------------------------------------------------------------*/
METHOD Init() CLASS FT604
DB_PRODUC:DbSetOrder( 02 )
DB_ANALIS:DbSetOrder( 01 )
DB_LOCAL :DBSetOrder( 01 )
DB_DETPRO:DBSetOrder( 01 )
DB_FORPAG:DBSetOrder( 01 )
DB_LIBVTA:DBSetOrder( 01 )
DB_DOCPEN:DBSetOrder( 03 )
DB_BANCO :DBSetOrder( 01 )
DB_CAJAS :DBSetOrder( 01 )
::oCmb := Array( 03 )
::vCmb := Array( 03 )
::aCmb := Array( 03 )
::oGet := Array( 16 )
::vGet := Array( 16 )
::oBtn := Array( 15 )
::oDpk := Array( 02 )
::vDpk := Array( 02 )
::oSay := Array( 05 )
::vSay := Array( 05 )
::oCkb := Array( 01 )
::vCkb := Array( 01 )
::aCmb[01] := { {}, {} }
::aCmb[02] := { {}, {} }
DB_BANCO:Eval( { || AAdd( ::aCmb[01][01], DB_BANCO:CodBco ),;
AAdd( ::aCmb[02][02], DB_BANCO:DesBco) })
::vCmb[02] := ::aCmb[02][02][01]
::aCmb[03] := { {}, {}, {} }
DB_FORPAG:Eval( { || AAdd( ::aCmb[03][01], DB_FORPAG:DEFOPA ),;
AAdd( ::aCmb[03][02], DB_FORPAG:COFOPA ),;
AAdd( ::aCmb[03][03], DB_FORPAG:ACTPAG ) } )
::vCmb[03] := ::aCmb[03][01][01]
::vDpk := Date()
::vDpkVc := Date()
::vGet[04] := "Food Market"
::aDatos := {}
::vGet[05] := Space( 10 )
::vGet[06] := ""
::vGet[07] := 0
::vGet[08] := 0
::vGet[09] := 0
::vGet[10] := 0
::vSay[02] := 0
::vSay[01] := 0
::vSay[05] := 0
::vCkb[01] := .T.
::vGet[13] := Space(13)
::vGet[14] := 0
::vGet[03] := ::Numbol
::vSay[04] := 0
RETURN .T.
/*-----------------------------------------------------------------------------------------------*/
METHOD New( oCat, Numbol, Codcaj, mespro, nLoc, cNomcaj, cLoc ) CLASS FT604
LOCAL oFont, vMsg, oMsg, vCaj, oCaj
::oCat := oCat
::Numbol := Numbol
::vCajero := Codcaj
::vMespro := mespro
::nLocal := nLoc
::cNomcaj := cNomcaj
::cLocal := cLoc
vMsg := Array ( 06 )
oMsg := Array ( 06 )
vMsg[01] := "Esta Venta $"
vMsg[02] := "Cajer(o/a)"
vMsg[03] := "Sucursal"
vMsg[05] := "Nro.Boleta"
vMsg[06] := cNomcaj
IF !::Open(); RETURN NIL; ENDIF
IF !::Init(); ::Close(); RETURN NIL; ENDIF
vMsg[04] := ::cLocal
DB_ANALIS:DBSetOrder( 01 )
DB_DETPRO:SCOPE( ::cScope, ::cScope , 01 )
DEFINE FONT oFont NAME "Times New Roman" SIZE 0, -20 BOLD ITALIC
DB_DETPRO:Relation( DB_PRODUC, { || DB_DETPRO:CODPRO }, "DETPRO" )
DEFINE Dialog ::oDlg Resource "DL_604_VTAPOS"
Redefine DTPICKER ::oDpk VAR ::vDpk Id 106 Of ::oDlg
Redefine Get ::oGet[02] VAR ::vGet[02] Id 102 Of ::oDlg picture "@R 99.999.999-!" Update; ::oGet[02]:Disable() */
Redefine Say oMsg[05] VAR vMsg[05] id 108 of ::oDlg Font oFont
Redefine Say ::oGet[03] VAR ::vGet[03] Id 103 Of ::oDlg Font oFont //picture "9999999999999"
Redefine Say ::oGet[04] VAR ::vGet[04] Id 100 Of ::oDlg Update COLORS CLR_RED Font oFont
Redefine Say oMsg[01] VAR vMsg[01] id 116 of ::oDlg Update Font oFont
Redefine Say oMsg[02] VAR vMsg[02] id 065 of ::oDlg Font oFont
Redefine Say oMsg[03] VAR vMsg[03] id 050 of ::oDlg Font oFont
Redefine Say oMsg[04] VAR vMsg[04] id 051 of ::oDlg Font oFont Colors CLR_RED
Redefine Say oCaj VAR vMsg[06] id 104 of ::oDlg Update font oFont
Redefine CheckBox ::oCkb[01] VAR ::vCkb[01] id 130 of ::oDlg
Redefine Get ::oGet[14] VAR ::vGet[14] id 132 of ::oDlg when ::vCkb[01] = .T. update
Redefine Get ::oGet[15] VAR ::vGet[15] id 134 of ::oDlg when ::vCkb[01] = .T. ; ::oGet[15]:Disable()
Redefine Get ::oGet[13] VAR ::vGet[13] id 131 of ::oDlg when ::vCkb[01] = .T. Update valid { || ::Descomprime() }//para lector de barras
::oGet[15]:bGotFocus := { || ::oGet[13]:SetFocus() }
Redefine Get ::oGet[05] VAR ::vGet[05] id 110 of ::oDlg when ::vCkb[01] = .F. Update
Redefine Get ::oGet[07] VAR ::vGet[07] id 111 of ::oDlg Update When ::vCkb[01] = .F. Valid { || ::PrePro() } picture "9999" //Update
Redefine Get ::oGet[08] VAR ::vGet[08] id 112 of ::oDlg update when ::vCkb[01] = .F. Picture "99999.999"
Redefine Get ::oGet[09] VAR ::vGet[09] id 113 of ::oDlg update when ::vCkb[01] = .F. Picture "999,999,999"
Redefine Say ::oSay[05] VAR ::vSay[05] id 135 of ::oDlg Update Picture "9999" Font oFont //Valid { || ::Pago() }
Redefine Say ::oSay[01] VAR ::vSay[01] id 115 of ::oDlg Update Picture "999,999,999" Font oFont
Redefine Say ::oSay[03] VAR ::vSay[03] id 117 of ::oDlg update Font oFont
Redefine Button ::oBtn[02] Id 122 Of ::oDlg Action ::Agrega(), ::Totales()
Redefine Button ::oBtn[03] Id 126 Of ::oDlg //Action ::Modifica()
Redefine Button ::oBtn[04] Id 128 Of ::oDlg Action ::Elimina(), ::Totales()
Redefine Button ::oBtn[05] ID 123 of ::oDlg Action ( ::oDlg:bValid := { || .T. }, ::Valida() ) //Salida
REDEFINE BTNBMP ::oBtn[06] ID 124 OF ::oDlg ;
RESOURCE "EFECTIVO" Tooltip "Cancela con Efectivo..."
::oBtn[06]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 1 ), NIL ) }
REDEFINE BTNBMP ::oBtn[07] ID 125 OF ::oDlg ;
RESOURCE "CHEQDIA" Tooltip "Cancela con Cheque al Día..."
::oBtn[07]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 2 ), NIL ) }
REDEFINE BTNBMP ::oBtn[08] ID 129 OF ::oDlg ;
RESOURCE "CREDITO" Tooltip "Venta a Crédito..."
::oBtn[08]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 2 ), NIL ) }
REDEFINE BTNBMP ::oBtn[11] ID 127 OF ::oDlg ;
RESOURCE "DEBITO" TOOLTIP "Cancela con Tarjeta Debito ( Red Compra ) ..."
::oBtn[11]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 5 ), NIL ) }
REDEFINE BTNBMP ::oBtn[12] ID 136 OF ::oDlg ;
RESOURCE "VISA" ToolTip "Cancela con Tarjeta de Crédito..."
::oBtn[12]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 6 ), NIL ) }
REDEFINE BTNBMP ::oBtn[13] ID 137 OF ::oDlg ;
RESOURCE "PCVTA" Tooltip "Venta en Espera...."
::oBtn[13]:bAction := { || FT604AbreCaja():New(.T. , 1 ) }
REDEFINE BTNBMP ::oBtn[14] ID 138 OF ::oDlg ;
RESOURCE "CALC" Tooltip "Utilizar Calculadora..."
::oBtn[14]:bAction := { || WinExec( "Calc" ) }
WITH OBJECT ( oComp := TAyuda():Init( ::oGet[05] ) )
:oAdd := SELF
:oSource := DB_PRODUC
:nOrder := 03
:bSeek := { |cBuf| cBuf }
:bReplace := { |oANA| DB_PRODUC:DESPRO }
:bAdd := { |oANA,oAdd| oAdd:vGet[06] := DB_PRODUC:CODPLU, oAdd:vGet[13] := DB_PRODUC:CODBAR, oAdd:oDlg:Update() }
:aCols := { { "Rut ", { |oANA| DB_PRODUC:CODPLU }, 080 },;
{ "Nombre ", { |oANA| DB_PRODUC:DESPRO }, 200 } }
END
::oGet[05]:bValid := { || IF( Empty( ::vGet[06] ), ( DB_PRODUC:DBSetOrder(02),;
IF( DB_PRODUC:Seek( ::vGet[05] ), ( ,;
::vGet[06] := DB_PRODUC:CODPLU ,;
::vGet[05] := DB_PRODUC:DESPRO ,;
::vGet[13] := DB_PRODUC:CODBAR ,;
::Prepro(), ::oDlg:Update(), .T. ), .T. ) ), .T. ) }
DB_ANALIS:DBSetOrder( 01 )
WITH OBJECT ( ::oBrw := TXBrowse():New( ::oDlg ) )
::SetBrw()
:CreateFromResource(107)
END
::oDlg:bKeyDown := { |nKey| ::Tecla( nKey ) }
Activate Dialog ::oDlg center Valid .F.
RETURN Self
/*-----------------------------------------------------------------------------------------------*/
METHOD Tecla( nKey ) CLASS FT604
DO CASE
CASE nKey == VK_F2 .AND. ::vSay[01] > 0 ; ::Pago( 1 )
CASE nKey == VK_F3 .AND. ::vSay[01] > 0 ; ::Pago( 2 )
CASE nKey == VK_F4 .AND. ::vSay[01] > 0 ; ::Pago( 3 )
CASE nKey == VK_F5 .AND. ::vSay[01] > 0 ; ::Pago( 5 )
CASE nKey == VK_F6 .AND. ::vSay[01] > 0 ; ::Pago( 6 )
ENDCASE
RETURN NIL
/*-----------------------------------------------------------------------------------------------*/
METHOD Valida() CLASS FT604
IF Len( AR_DATOS ) > 0
MsgInfo( "Antes de Salir debe anular los datos...??","Atención Ventas...!" )
ELSE
::oDlg:END(.T.)
ENDIF
RETURN Self
*------------------------------------------------------------------------------------------------*/
METHOD Elimina() CLASS FT604
AR_DATOS := ADEL_( AR_DATOS, BA_nAt )
::oBrw:Gotop()
::SetBrw()
::oBrw:Refresh()
RETURN NIL
/*-----------------------------------------------------------------------------------------------*/
METHOD Descomprime() CLASS FT604
LOCAL nKilos, nGramos
DB_PRODUC:DBSetOrder( 04 )
IF !DB_PRODUC:SEEK( ::vGet[13] )
DB_PRODUC:DBSetOrder( 05 )
::vGet[06] := SubStr( ::vGet[13], 3 ,5 )
nKilos := SubStr( ::vGet[13], 8 ,2 )
nGramos := SubStr( ::vGet[13],10 ,3 )
::vGet[08] := Val( nKilos + "." + nGramos )
IF ::vGet[13] != " "
::PrePro()
::vGet[13] := Space(13)
ENDIF
ELSE
IF ::vGet[13] != " "
IF DB_PRODUC:ACTOFT = .T.
::vGet[09] := DB_PRODUC:PREOFT
? "Producto con PRECIO Oferta"
ELSE
::vGet[09] := DB_PRODUC:PRELST
ENDIF
::vGet[05] := DB_PRODUC:DESPRO
::vSay[03] := DB_PRODUC:DESPRO
::vUnimed := DB_PRODUC:UNIMED
::vGet[06] := DB_PRODUC:CODPLU
::vGet[16] := DB_PRODUC:PRULCO
::Agrega()
ENDIF
ENDIF
RETURN .T.
METHOD Agrega() CLASS FT604
IF ::vCkb[01] = .T.
DO CASE
CASE ::vUnimed == "002"
IF ::vGet[14] > 0
::vGet[08] := ::vGet[14]
ELSE
::vGet[08] := 1
ENDIF
::vGet[07] := ::vGet[08]
::vGet[08] := 0
::vGet[10] := Round( ::vGet[07] * ::vGet[09], 0 )
OTHERWISE
::vGet[10] := Round( ::vGet[08] * ::vGet[09] , 0 )
ENDCASE
ELSE
DO CASE
CASE ::vUnimed == "002"
::vGet[08] := 0
::vGet[10] := Round( ::vGet[07] * ::vGet[09], 0 )
OTHERWISE
::vGet[10] := Round( ::vGet[08] * ::vGet[09] , 0 )
ENDCASE
ENDIF
IF ::vGet[10] > 0
AAdd( AR_DATOS, { ::vMespro, ::nLocal, ::vGet[03], ::vGet[05], ::vGet[06], ::vGet[07],;
::vGet[08], ::vGet[09], ::vGet[10], ::vDpk, ::vUnimed, "002", ::vGet[16] } )
::SetBrw()
::vGet[05] := Space( 10 )
::vGet[13] := Space( 13 )
::vGet[07] := 0
::vGet[08] := 0
::vGet[09] := 0
::vGet[10] := 0
::vGet[14] := 0
::vSay[05] := ::vSay[05] + 1
::oBrw:Refresh()
::oDlg:Update()
::Totales()
ENDIF
RETURN NIL
/*-----------------------------------------------------------------------------------------------*/
METHOD PrePro() CLASS FT604
DB_PRODUC:DBSetOrder( 05 )
IF ::vCkb[01] = .T.
IF DB_PRODUC:SEEK( ::vGet[06] )
IF DB_PRODUC:ACTOFT = .T.
::vGet[09] := DB_PRODUC:PREOFT
? "Producto con PRECIO Oferta"
ELSE
::vGet[09] := DB_PRODUC:PRELST
ENDIF
::vGet[05] := DB_PRODUC:DESPRO
::vSay[03] := DB_PRODUC:DESPRO
::vUnimed := DB_PRODUC:UNIMED
::vGet[06] := DB_PRODUC:CODPLU
::vGet[16] := DB_PRODUC:PRULCO
::Agrega()
ELSE
? "no Encontro Producto Asociado"
IF ::vCkb[01] = .T.
::vGet[13] := Space(13)
::oGet[13]:SetFocus( ::oDlg )
ENDIF
ENDIF
ELSE
DB_PRODUC:DBSetOrder( 04 )
IF !DB_PRODUC:SEEK( ::vGet[13] )
? ::vGet[13], ::vGet[06], SubStr( ::vGet[06], 4, 5 )
DB_PRODUC:DBSetOrder( 05 )
IF DB_PRODUC:SEEK( SubStr( ::vGet[06], 4, 5 ) )
IF DB_PRODUC:ACTOFT = .T.
::vGet[09] := DB_PRODUC:PREOFT
? "Producto con PRECIO Oferta"
ELSE
::vGet[09] := DB_PRODUC:PRELST
ENDIF
::vGet[05] := DB_PRODUC:DESPRO
::vSay[03] := DB_PRODUC:DESPRO
::vUnimed := DB_PRODUC:UNIMED
::vGet[16] := DB_PRODUC:PRULCO
ELSE
? "no Encontro Producto Asociado"
::oGet[05]:SetFocus( ::oDlg )
ENDIF
ELSE
IF DB_PRODUC:ACTOFT = .T.
::vGet[09] := DB_PRODUC:PREOFT
? "Producto con PRECIO Oferta"
ELSE
::vGet[09] := DB_PRODUC:PRELST
ENDIF
::vGet[05] := DB_PRODUC:DESPRO
::vSay[03] := DB_PRODUC:DESPRO
::vUnimed := DB_PRODUC:UNIMED
::vGet[16] := DB_PRODUC:PRULCO
ENDIF
ENDIF
::oDlg:Update()
RETURN .T.
*------------------------------------------------------------------------------------------------*/
METHOD Totales() CLASS FT604
::vSay[01] := 0
::vSay[04] ++
AEval( AR_DATOS, { |aDat| IF( aDat[09] > 0, ::vSay[01] += aDat[09], NIL ) } )
IF ::vCkb[01] = .T.
::oGet[13]:SetFocus( ::oDlg )
ELSE
::oGet[05]:SetFocus()
ENDIF
::oDlg:Update()
RETURN .T.
*------------------------------------------------------------------------------------------------*/
METHOD Pago( nPos ) CLASS FT604
LOCAL oDlg, oBtn, vSay, oSay, vPag, oPag, oFont, oRbt, vRbt, oCmb, vCmb, oGet, vGet, vCkb, oCkb
LOCAL oApp
oBtn := Array( 02 )
vSay := Array( 04 )
oSay := Array( 04 )
vGet := Array( 03 )
oGet := Array( 03 )
vPag := 0
vSay[01] := ::vGet[03]
vSay[02] := ::vSay[01]
vSay[04] := "Valor Pagado"
vSay[03] := 0
DO CASE
CASE nPos == 1 .OR. nPos == 5 .or. nPos == 6
DEFINE FONT oFont NAME "Times New Roman" SIZE 0, -20 BOLD ITALIC
DEFINE Dialog oDlg Resource "DL_EFEC_POS"
Redefine Button oBtn[01] Id 106 Of oDlg Action (::oDlg:bValid := {||.T.}, oDlg:END(), ::Imprimir(), ::Guardar(nPos) )
Redefine Button oBtn[02] Id 107 Of oDlg Action oDlg:END()
Redefine SAY oSay[01] VAR vSay[01] Id 101 of oDlg Font oFont
Redefine SAY oSay[02] VAR vSay[02] id 102 of oDlg Font oFont picture "999,999,999" //monto total
Redefine SAY oSay[03] VAR vSay[03] id 103 of oDlg Update Font oFont //cambio
Redefine Say oSay[04] VAR vSay[04] id 104 of oDlg Font oFont
Redefine Get oPag VAR vPag id 105 of oDlg valid { || ::vuelto( oDlg, vPag, vSay, oBtn ) } Font oFont COLORS CLR_BLACK ,CLR_HCYAN
IF nPos == 5
MsgInfo( "Deslice tarjeta Debito", "Atención Cajeros" )
ENDIF
IF nPos == 6
MsgInfo( "Deslice tarjeta Crédito", "Atención Cajeros" )
ENDIF
ACTIVATE DIALOG oDlg Center
CASE nPos == 2
vRbt := 1
DEFINE FONT oFont NAME "Times New Roman" SIZE 0, -20 BOLD ITALIC
DEFINE Dialog oDlg Resource "DL_CHEQ_POS"
Redefine Button oBtn[01] Id 109 Of oDlg Action (::oDlg:bValid := {||.T.}, oDlg:END(), ::Imprimir(), ::Guardar( nPos ) )
Redefine Button oBtn[02] Id 110 Of oDlg Action oDlg:END()
Redefine SAY oSay[01] VAR vSay[01] Id 101 of oDlg Font oFont
Redefine SAY oSay[02] VAR vSay[02] id 102 of oDlg Font oFont picture "999,999,999"
Redefine SAY oSay[03] VAR vSay[03] id 103 of oDlg Update Font oFont
Redefine Radio oRbt VAR vRbt id 104,108 of oDlg
oRbt:bChange := { || IF ( vRbt = 2, ( oApp := MantFT208():New( Self, 0, ::nLocal, ::vMespro ),;
::oDlg:bValid := {||.T.}, oDlg:END(), ::Imprimir(), ::Guardar( 3 ) ) , NIL ) }
Redefine ComboBox ::oCmb[02] VAR ::vCmb[02] id 105 of oDlg items ::aCmb[02][02] when vRbt = 1
Redefine Get oGet[01] VAR vGet[01] id 106 of oDlg when vRbt = 1
Redefine Get oGet[02] VAR vGet[02] id 107 of oDlg When vRbt = 1
Redefine Get oGet[03] VAR vGet[03] id 113 of oDlg when vRbt = 1
Redefine CheckBox oCkb VAR vCkb id 114 of oDlg when vRbt = 1
Redefine Say oSay[04] VAR vSay[04] id 112 of oDlg Font oFont
Redefine Get oPag VAR vPag id 111 of oDlg valid { || ::vuelto( oDlg, vPag, vSay, oBtn ) } Font oFont COLORS CLR_BLACK ,CLR_HCYAN when vRbt = 1 .and. vCkb = .T.
ACTIVATE DIALOG oDlg Center
CASE nPos == 3
? "No Disponible"
ENDCASE
RETURN .T.
METHOD Vuelto( oDlg, vPag, vSay, oBtn ) CLASS FT604 //aqui pasamos estoos parametros oDlg, vPag, vSay
vSay[03] := Transform( vPag - vSay[02], "999,999,999" )
IF Val( vSay[03] ) < 0
MsgInfo( "Monto Pagado es incorrecto....!!","Atención Cajeros..." )
vPag := 0
oBtn[01]:Disable()
ELSE
oBtn[01]:Enable()
ENDIF
oDlg:Update()
RETURN .T.
/*-----------------------------------------------------------------------------------------------*/
METHOD SetBrw() CLASS FT604
LOCAL vTemp
WITH OBJECT ::oBrw
DEFINE FONT oFont NAME "Times New Roman" SIZE 0, -15 BOLD ITALIC
IF Len( AR_DATOS ) > 0
:SetArray( AR_DATOS, .T. )
ELSE
:SetArray( {{ "","","","","",0,0,0,0,0,"","",{} } }, .T. )
Endif
:lColDividerComplete := .T.
:nColDividerStyle := 02
:lFooter := .T.
:nFooterLines := 01
:nMarqueeStyle := 005
:lFastEdit := .T.
:nHeaderLines := 02
:nFreeze := 1
WITH OBJECT :aCols[ BA_MESPRO ]
:Hide()
END
WITH OBJECT :aCols[ BA_LOCCOM ]
:Hide()
END
WITH OBJECT :aCols[ BA_NUMBOL ]
:Hide()
END
WITH OBJECT :aCols[ BA_PRECOS ]
:Hide()
END
WITH OBJECT :aCols[ BA_DESPRO ]
:cHeader := "Detalle " + CRLF + "del Producto"
:nWidth := 350
:bLDClickData := { || ::FichaPro( DB_PRODUC:RecNo() ) }
:oDataFont := oFont
END
WITH OBJECT :aCols[ BA_CODPRO ]
:Hide()
END
WITH OBJECT :aCols[ BA_UNIPRO ]
:cHeader := " Unidades"
:nEditType := 1
:bonpostEdit := { |o| AR_DATOS[ BD_nAt ][03] := ( o:oEditGet:cText ) }
:bEditValue := { || AR_DATOS[ BD_nAt ][03] }
:nWidth := 90
:oDataFont := oFont
END
WITH OBJECT :aCols[ BA_KILPRO ]
:cHeader := " Kilo" + CRLF + " Gramos"
:nWidth := 100
:nEditType := 1
:bonpostEdit := { |o| AR_DATOS[ BD_nAt ][04] := ( o:oEditGet:cText ) }
:bEditValue := { || AR_DATOS[ BD_nAt ][04] }
:oDataFont := oFont
END
WITH OBJECT :aCols[ BA_PREVTA ]
:cHeader := " Precio" + CRLF + " Venta"
:nWidth := 100
:oDataFont := oFont
END
WITH OBJECT :aCols[ BA_SUBTOT ]
:cHeader := "Sub-Total "
:nWidth := 100
:oDataFont := oFont
END
WITH OBJECT :aCols[ BA_FECMOV ]
:hide()
END
WITH OBJECT :aCols[ BA_TIPMOV ]
:cHeader := "Tipo"
:nWidth := 90
END
WITH OBJECT :aCols[ BA_ESTADO ]
:Hide()
END
END
RETURN NIL
/*-----------------------------------------------------------------------------------------------*/
METHOD Guardar( nPos ) CLASS FT604
LOCAL nFor, nBol
DB_PRODUC:DBSetOrder( 02 )
FOR nFor = 1 TO Len( AR_DATOS )
DB_DETPRO:APPEND()
DB_DETPRO:MESPRO := AR_DATOS[nFor][BA_MESPRO]
DB_DETPRO:LOCCOM := AR_DATOS[nFor][BA_LOCCOM]
DB_DETPRO:NUMBOL := strzero( Val( AR_DATOS[nFor][BA_NUMBOL] ) , 8 )
DB_DETPRO:CODPRO := AR_DATOS[nFor][BA_CODPRO]
DB_DETPRO:UNIPRO := AR_DATOS[nFor][BA_UNIPRO]
DB_DETPRO:KILPRO := AR_DATOS[nFor][BA_KILPRO]
DB_DETPRO:PREVTA := AR_DATOS[nFor][BA_PREVTA]
DB_DETPRO:FECMOV := AR_DATOS[nFor][BA_FECMOV]
DB_DETPRO:TIPMOV := '002' //AR_DATOS[nFor][BA_TIPMOV] corregir segun array de tablas
DB_DETPRO:PRECOS := AR_DATOS[nFor][BA_PRECOS]
DB_DETPRO:UNLOCK()
IF ( DB_PRODUC:SEEK( AR_DATOS[nFor][ BA_CODPRO ] ) )
DB_PRODUC:RLock()
DB_PRODUC:PRULVT := AR_DATOS[nFor][ BA_PREVTA ]
DB_PRODUC:ULTVTA := AR_DATOS[nFor][ BA_FECMOV ]
DB_PRODUC:ACTPRO := .T.
DB_PRODUC:UNLOCK()
ENDIF
NEXT
DB_LIBVTA:APPEND()
DB_LIBVTA:MESPRO := ::vMespro
DB_LIBVTA:LOCCOM := ::nLocal
DB_LIBVTA:FECEMI := ::vDpk
DB_LIBVTA:NUMBOL := StrZero( Val( ::vGet[03] ), 8 )
DB_LIBVTA:MONBOL := ::vSay[01]
DO CASE
CASE nPos == 1 ; DB_LIBVTA:FORPAG := '01'
CASE nPos == 2 ; DB_LIBVTA:FORPAG := '02'
CASE nPos == 3 ; DB_LIBVTA:FORPAG := '03'
CASE nPos == 5 ; DB_LIBVTA:FORPAG := '05'
CASE nPos == 5 ; DB_LIBVTA:FORPAG := '06'
ENDCASE
DB_LIBVTA:CODCAJ := ::vCajero
DB_LIBVTA:HORMOV := Time()
DB_LIBVTA:UNLOCK()
IF ( DB_CAJAS:SEEK( ::vMespro + DToS( ::vDPk ) + ::vCajero + "T" ) )
DB_CAJAS:RLock()
nBol := STRZERO( Val( ::vGet[03] ) + 1 , 8 )
DB_CAJAS:BOLACT := nBol
DB_CAJAS:UNLOCK()
ENDIF
AR_DATOS := {}
hb_gcAll()
::oDlg:END(.T.)
::Close()
FT604():New( Self, nBol, ::vCajero, ::vMespro, ::nLocal, ::cNomcaj, ::cLocal )
RETURN .T.
/*-----------------------------------------------------------------------------------------------*/
METHOD Imprimir() CLASS FT604
Local cPuerto:="LPT1"
LOCAL nLin, nFor, cTemp := "", nSubtot := 0, nTotal := 0, nProd, lFor
DB_LIBVTA:DBSetOrder( 01 )
IF DB_LIBVTA:SEEK( ::vMespro + ::nLocal + StrZero( Val( ::vGet[03] ), 8 ) )
DB_CAJAS:SEEK( ::vMespro + DToS( ::vDPk ) + ::vCajero + "T" )
::vGet[03] := DB_CAJAS:BOLACT
FOR nFor := 1 TO Len( AR_DATOS )
AR_DATOS[nFor][BA_NUMBOL] := ::vGet[03]
NEXT
ENDIF
oPrn:=TDosPrn():New(cPuerto)
oPrn:SayCmp( 01,00, "Caja:" )
oPrn:SayCmp( 01,04, "001" )
oPrn:SayCmp( 01,24, "No.:" + ::vGet[03] )
oPrn:SayCmp( 02,00, SUBSTR(DTOS(::vDpk),7,2) )
oPrn:SayCmp( 02,03, CMonth( ::vDpk ) )
oPrn:SayCmp( 02,10, SubStr(DToS(::vDpk),1,4 ) )
oPrn:SayCmp( 02,15, Time()+ Space( 12 ) )
nLin := 00
FOR nFor = 1 TO Len( AR_DATOS )
nSubTot := 0
IF AR_DATOS[nFor][BA_ESTADO] = "002"
nSubTot := Str( Round( AR_DATOS[nFor][BA_UNIPRO] * AR_DATOS[nFor][BA_PREVTA],0 ) )
cTemp = SubStr( AR_DATOS[nFor][BA_DESPRO], 1,18 ) + " "+ Trans ( AR_DATOS[nFor][BA_UNIPRO], "999" ) + ;
Trans ( AR_DATOS[nFor][BA_PREVTA], "99999" ) + nSubTot
ELSE
nSubTot := Str( Round( AR_DATOS[nFor][BA_KILPRO] * AR_DATOS[nFor][BA_PREVTA],0 ) )
cTemp = SubStr( AR_DATOS[nFor][BA_DESPRO], 1,18 ) + Trans ( AR_DATOS[nFor][BA_KILPRO], "999.999" ) +;
Trans ( AR_DATOS[nFor][BA_PREVTA], "99999" ) + nSubTot
ENDIF
nTotal := nTotal + Val( nSubtot )
oPrn:SayCmp( 00,00, cTemp )
nLin++
IF nLin == 20
oPrn:SayCmp( 00,00,"----------------------------------------" ) //40
oPrn:SayCmp( 00,00,"Nro. Productos Total-> " + Trans( nTotal, "999,999,999" ) )
oPrn:SayCmp( 00,10, Str( nLin ) )
FOR lFor := nLin TO 27
oPrn:SayCmp( 00,00, Space( 40 ) )
NEXT
oPrn:SayCmp( 00,00, " " )
oPrn:SayCmp( 01,00, "Caja:" )
oPrn:SayCmp( 01,04, "001" )
oPrn:SayCmp( 01,24, "No.:" + Strzero( Val( ::vGet[03] ) + 1 ,8 ) )
oPrn:SayCmp( 02,00, SUBSTR(DTOS(::vDpk),7,2) )
oPrn:SayCmp( 02,03, CMonth( ::vDpk ) )
oPrn:SayCmp( 02,10, SubStr(DToS(::vDpk),1,4 ) )
oPrn:SayCmp( 02,15, Time()+ Space( 12 ) )
nLin := 00
ENDIF
NEXT
oPrn:SayCmp( 00,00,"----------------------------------------" ) //40
oPrn:SayCmp( 00,00,"Nro. Productos Total-> " + Trans( nTotal, "999,999,999" ) )
oPrn:SayCmp( 00,10, Str( nLin ) )
IF Len( AR_DATOS ) <= 20
FOR nFor := nLin TO 27
oPrn:SayCmp( 00,00, Space( 40 ) )
NEXT
ENDIF
oPrn:SayCmp( 00,00, " " )
oPrn:end(.T.)
::oDlg:END(.T.)
RETURN .T.
/*-----------------------------------------------------------------------------------------------*/
[/code]
en terminos generales, el prg cuenta con 2 clases la primera para realizar una apertuta de caja y recuperar unos valores para pasarselos a la segunda clase y la segunda es la que acumula ventas en el method guardar esta el array que cargo con ventas, una vez concluida la venta primero la imprimo y luego la paso a la dbf desde el array.
**VENTA POR BOLETAS DESDE POS
#include "FIVEWIN.CH"
#include "DTPICKER.CH"
#include "DOSPRINT.CH"
#include "COLORS.CH"
#include "xbrowse.ch"
#include "GETS.CH"
#DEFINE CLR_GRID1 RGB( 239, 239, 224 )
#define Brw_nAt ::oBrw:nArrayAt
#define DB_TABLAS ::aDbf[01]
#define DB_LOCAL ::aDbf[02]
#define DB_CAJAS ::aDbf[03]
/*-----------------------------------------------------------------------------------------------*/
CLASS FT604AbreCaja
DATA oDlg1
DATA oBrw, oWnd, oBtb, oSay, oMsg
DATA oMa
DATA oGet, vGet
DATA oCmb, vCmb, aCmb
DATA oDpk, vDpk
DATA oCkb, vCkb
DATA oRbt, vRbt
DATA oBtn
DATA aDbf, bLoc
DATA cScope
DATA aDatos, aLocal, aMeses, aAnos, aCmb, aTurnos
DATA cMes, cAno, cLocal, cTurnos, cMesano
DATA lBrw, lRbt
METHOD Open()
METHOD Init()
METHOD New() Constructor
METHOD Close() INLINE AEval( ::aDbf, { |oDbf| oDbf:Close) } ), .T.
METHOD Agregar()
METHOD Pos()
METHOD Valid()
METHOD Datos()
ENDCLASS
METHOD Open CLASS FT604AbreCaja
::aDbf := Array( 03 )
DB_TABLAS := TRed():Use( GetApp():cRuta + "COTABLAS.DBF" )
DB_LOCAL := TRed():Use( GetApp():cRuta + "MALOCCOM.DBF" )
DB_CAJAS := TRed():Use( GetApp():cRuta + "MOCAJERO.DBF" )
RETURN lTredOpen( ::aDbf )
/*-----------------------------------------------------------------------------------------------*/
METHOD Init() CLASS FT604AbreCaja
::oBtn := Array( 02 )
::vGet := Array( 05 )
::oGet := Array( 05 )
::oCmb := Array( 04 )
::aCmb := Array( 02 )
::aMeses := { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto",;
"Septiembre", "Octubre", "Noviembre", "Diciembre" }
::aAnos := {}
FOR nFor = 2004 TO Year( Date() )
AAdd( ::aAnos, StrZero( nFor, 04 ) )
NEXT
::cMes := Array( 02 )
::cAno := Array( 02 )
AFill( ::cMes, ::aMeses[ Month( Date() ) ] )
AFill( ::cAno, ::aAnos[ Len( ::aAnos ) ] )
DB_LOCAL:dbSetOrder( 1 )
::aLocal := Array( 02 )
::aLocal[01] := {}; ::aLocal[02] := {}
AAdd( ::aLocal[01], "0000" ); AAdd( ::aLocal[02], "Todos" )
DB_LOCAL:Eval( { || AAdd( ::aLocal[01], DB_LOCAL:CODLOC ),;
AAdd( ::aLocal[02], DB_LOCAL:DESLOC ) } )
::cLocal := ::aLocal[02][01]
::aTurnos := Array( 02 )
::aTurnos[01] := { "01","02","03"}
::aTurnos[02] := { "Mañana", "Tarde", "Noche" }
DB_CAJAS :DBSetOrder( 03 )
DB_TABLAS:DBSetOrder( 01 )
DB_TABLAS:Scope( "VEN", "VEN", 01 )
::vRbt := ::lRbt
::vDpk := Date()
::vGet[01] := 0
::vGet[02] := 0
::vGet[03] := Space( 08 )
::vGet[04] := Space( 08 )
RETURN .T.
METHOD New( lBrw, lRbt) CLASS FT604AbreCaja
::lBrw := lBrw
::lRbt := lRbt
IF !::Open(); RETURN NIL; ENDIF
IF !::INIT()
::Close()
RETURN NIL
ENDIF
DEFINE Dialog ::oDlg1 Resource "DL_APERTURA"
REDEFINE DTPICKER ::oDpk VAR ::vDpk id 101 OF ::oDlg1
REDEFINE RADIO ::oRbt VAR ::vRbt id 102, 103 OF ::oDlg1; ::oRbt:Disable()
REDEFINE COMBOBOX ::oCmb[01] VAR ::cMes[01] ID 105 OF ::oDlg1 ITEMS ::aMeses
REDEFINE COMBOBOX ::oCmb[02] VAR ::cAno[01] ID 106 OF ::oDlg1 ITEMS ::aAnos
REDEFINE COMBOBOX ::oCmb[03] VAR ::cLocal ID 107 OF ::oDlg1 ITEMS ::aLocal[02]
Redefine Combobox ::oCmb[04] VAR ::cTurnos ID 109 OF ::oDlg1 Items ::aTurnos[02]
REDEFINE GET ::oGet[01] VAR ::vGet[01] id 108 OF ::oDlg1 Update when ::vRbt = 1
REDEFINE GET ::oGet[02] VAR ::vGet[02] ID 115 OF ::oDlg1 Update When ::vRbt = 2
redefine GET ::oGet[03] VAR ::vGet[03] id 110 of ::oDlg1 Update when ::vRbt = 1
Redefine Get ::oGet[04] VAR ::vGet[04] id 111 of ::oDlg1 Update When ::vRbt = 2
Redefine Get ::oGet[05] VAR ::vGet[05] ID 112 of ::oDlg1 Update
Redefine Button ::oBtn[01] id 113 of ::oDlg1 Action ::Valid( ::lBrw, ::lRbt )
Redefine Button ::oBtn[02] ID 114 of ::oDlg1 Action ::oDlg1:END()
WITH OBJECT ( ::oBrw := TXBrowse():New( ::oDlg1 ) )
:cAlias := DB_TABLAS:cAlias
:SetRdd()
:aCols[01]:cHeader := "Código"
:aCols[01]:bStrData := { || DB_TABLAS:CODTAB }
:aCols[02]:cHeader := "Nombre Cajero"
:aCols[02]:bStrData := { || DB_TABLAS:DESTAB }
:aCols[02]:nWidth := 220
:nFreeze := 02
:lColDividerComplete := .T.
:nColDividerStyle := 002
:lHScroll := .F.
:lAllowColSwapping := .F.
:lAllowColHiding := .F.
:nMarqueeStyle := 006
:CreateFromResource(104)
END
WITH OBJECT ::oDlg1
:bValid := { || ::Close() }
END
::oCmb[04]:nAt := 02
::oBrw:bChange := { || ::Datos() }
::oCmb[03]:nAt := 01
::oGet[05]:Disable()
::oBtn[01]:Disable()
Activate Dialog ::oDlg1 Center
RETURN Self
METHOD Datos() CLASS FT604AbreCaja
DB_CAJAS:DBSetOrder( 01 )
::cMesano := Strzero( ::oCmb[01]:nAt, 02 ) + SubStr( ::aAnos[ ::oCmb[02]:nAt], 3, 2 )
IF ( DB_CAJAS:SEEK( ::cMesano + DToS( ::vDPk ) + DB_TABLAS:CODTAB + "T" ) )
MsgWait( "Caja abierta por " + Trim( DB_TABLAS:DESTAB ) + " a las "+ DB_CAJAS:HORAPE , "Atención Cajeros...!!!", 1 )
::vGet[01] := DB_CAJAS:SALAPE
::vGet[03] := DB_CAJAS:BOLINI
::vGet[05] := DB_CAJAS:BOLACT
IF ::vRbt == 1
::oGet[01]:Disable()
::oGet[02]:Disable()
::oGet[03]:Disable()
::oGet[04]:Disable()
ELSE
::oGet[02]:Enable()
::oGet[04]:Enable()
ENDIF
ENDIF
::oBtn[01]:Enable()
::oDlg1:update()
RETURN NIL
METHOD Valid( lBrw, lRbt ) CLASS FT604AbreCaja //este metodo valid para que control es ?
LOCAL oApp, nLoc, nBol, cLoc
::cMesano := Strzero( ::oCmb[01]:nAt, 02 ) + SubStr( ::aAnos[ ::oCmb[02]:nAt], 3, 2 )
nLoc := ::aLocal[01][ ::oCmb[03]:nAt ]
cLoc := ::aLocal[02][ ::oCmb[03]:nAt ]
IF lBrw
DB_CAJAS:DBSetOrder( 01 )
IF ( DB_CAJAS:SEEK( ::cMesano + DToS( ::vDPk ) + DB_TABLAS:CODTAB + "T" ) )
::vGet[05] := DB_CAJAS:BOLACT
nBol := DB_CAJAS:BOLACT
nLoc := DB_CAJAS:LOCCOM
IF (DB_LOCAL:SEEK( DB_CAJAS:LOCCOM ), cLoc := DB_LOCAL:DESLOC , cLoc := "Nuevo " )
::oDlg1:END()
::Pos( nBol, nLoc, cLoc )
ELSE
::Agregar()
ENDIF
ELSE
IF lRbt = 2
::oDlg1:END()
ELSE
::Agregar()
ENDIF
ENDIF
RETURN nil
METHOD Agregar() CLASS FT604abreCaja
LOCAL lBrw := .T., oApp, cLoc, nBol , nLoc
IF ::aLocal[01][ ::oCmb[03]:nAt ] == '0000'
MsgInfo( "Falta Selección de Sucursal", "Atención Cajeros" )
RETURN (.F.)
ENDIF
DB_CAJAS:DBSetOrder( 01 )
::cMesano := Strzero( ::oCmb[01]:nAt, 02 ) + SubStr( ::aAnos[ ::oCmb[02]:nAt], 3, 2 )
IF ::vRbt == 1
IF ::vGet[01] == 0
MsgInfo( "Ingrese Monto Apertura de Caja","Atención Cajeros" )
RETURN .F.
ENDIF
IF Empty ( ::vGet[03] )
MsgInfo( "Ingrese Boleta Inicial Asignada","Atención Cajeros" )
RETURN .F.
ENDIF
IF ( DB_CAJAS:SEEK( ::cMesano + DToS( ::vDPk ) + DB_TABLAS:CODTAB + "T" /*+ StrZero( ::oCmb[04]:nAt, 02 )*/ ) )
IF DB_CAJAS:TIPMOV == .T.
MsgInfo( "Caja abierta por " + Trim( DB_TABLAS:DESTAB ) + " a las "+ DB_CAJAS:HORAPE , "Atención Cajeros, Debe Cerrar Caja" )
::vGet[03] := DB_CAJAS:BOLACT
::oGet[01]:Disable()
::oGet[02]:Disable()
::oGet[03]:Disable()
::oGet[04]:Disable()
ELSE
IF MsgYesNo( "Nueva Apertura de Caja para este día","Atención Cajeros")
DB_CAJAS:Append()
DB_CAJAS:MESPRO := ::cMesano
DB_CAJAS:FECMOV := ::vDpk
DB_CAJAS:TIPMOV := .T.
DB_CAJAS:LOCCOM := ::aLocal[01][ ::oCmb[03]:nAt ]
DB_CAJAS:SALAPE := ::vGet[01]
DB_CAJAS:TURAPE := StrZero( ::oCmb[04]:nAt, 2 )
DB_CAJAS:BOLINI := ::vGet[03]
DB_CAJAS:BOLFIN := ::vGet[04]
DB_CAJAS:BOLACT := ::vGet[03]
DB_CAJAS:CODCAJ := DB_TABLAS:CODTAB
DB_CAJAS:HORAPE := Time()
DB_CAJAS:UNLOCK()
ELSE
lBrw := .F.
ENDIF
ENDIF
ELSE
? "Apertura Nueva caja "
DB_CAJAS:Append()
DB_CAJAS:MESPRO := ::cMesano
DB_CAJAS:FECMOV := ::vDpk
DB_CAJAS:TIPMOV := .T.
DB_CAJAS:LOCCOM := ::aLocal[01][ ::oCmb[03]:nAt ]
DB_CAJAS:SALAPE := ::vGet[01]
DB_CAJAS:TURAPE := StrZero( ::oCmb[04]:nAt, 2 )
DB_CAJAS:BOLINI := ::vGet[03]
DB_CAJAS:BOLFIN := ::vGet[04]
DB_CAJAS:BOLACT := ::vGet[03]
DB_CAJAS:CODCAJ := DB_TABLAS:CODTAB
DB_CAJAS:HORAPE := Time()
DB_CAJAS:COMMIT()
DB_CAJAS:UNLOCK()
ENDIF
ELSE
IF ::vGet[02] == 0
MsgInfo( "Ingrese Monto Cierre de Caja","Atención Cajeros" )
RETURN .F.
ENDIF
IF Empty ( ::vGet[04] )
MsgInfo( "Ingrese Boleta Final Asignada","Atención Cajeros" )
RETURN .F.
ENDIF
IF ( DB_CAJAS:SEEK( ::cMesano+DToS( ::vDPk ) + DB_TABLAS:CODTAB + "T" /* StrZero( ::oCmb[04]:nAt, 2 ) */ ) )
::vGet[01] := DB_CAJAS:SALAPE
::vGet[03] := DB_CAJAS:BOLINI
::vGet[05] := DB_CAJAS:BOLACT
::oDlg1:update()
IF DB_CAJAS:TIPMOV == .T.
DB_CAJAS:RLock()
DB_CAJAS:SALCIE := ::vGet[02]
DB_CAJAS:BOLFIN := ::vGet[04]
DB_CAJAS:TURCIE := StrZero( ::oCmb[04]:nAt, 2 )
DB_CAJAS:HORCIE := Time()
DB_CAJAS:TIPMOV := .F.
DB_CAJAS:UNLOCK()
? "Cierre de Caja Efectuado"
lBrw := .F.
ELSE
MsgInfo( "Cierre ya fue realizado ","Atención Cajero" )
lBrw := .F.
ENDIF
ELSE
MsgInfo( "No Existe Apertura", "Atención Cajeros" )
lBrw := .F.
ENDIF
ENDIF
::oDlg1:Update()
IF lBrw
nLoc := ::aLocal[01][ ::oCmb[03]:nAt ]
cLoc := ::aLocal[02][ ::oCmb[03]:nAt ]
nBol := ::vGet[03]
::Pos( nBol, nLoc, cLoc ) //aqui
::oDlg1:END()
ELSE
::oDlg1:END()
ENDIF
RETURN Self
METHOD Pos( nBol, nLoc, cLoc ) CLASS FT604abreCaja //este de donde lo llmas ?
LOCAL oApp
::oDlg1:END()
oApp := FT604()
oApp:New( Self, nBol, DB_TABLAS:CODTAB, ::cMesano, nLoc, DB_TABLAS:DESTAB, cLoc )
Return NIL
/*-----------------------------------------------------------------------------------------------*/
***FT604 POS
/* Bases de Datos */
#define DB_PRODUC ::aDbf[01]
#define DB_FORPAG ::aDbf[02]
#define DB_VTAPDT ::aDbf[03]
#define DB_PARAM ::aDbf[04]
#define DB_LIBVTA ::aDbf[05]
#define DB_ANALIS ::aDbf[06]
#define DB_DOCPEN ::aDbf[07]
#define DB_DETPRO ::aDbf[08]
#define DB_BANCO ::aDbf[09]
#define DB_CAJAS ::aDbf[10]
/*-----------------------------------------------------------------------------------------------*/
#define AR_DATOS ::aDatos
#define BA_nAt ::oBrw:nArrayAt
#define BA_MESPRO 01
#define BA_LOCCOM 02
#define BA_NUMBOL 03
#define BA_DESPRO 04
#define BA_CODPRO 05
#define BA_UNIPRO 06
#define BA_KILPRO 07
#define BA_PREVTA 08
#define BA_SUBTOT 09
#define BA_FECMOV 10
#define BA_ESTADO 11
#define BA_TIPMOV 12
#define BA_PRECOS 13
/*-----------------------------------------------------------------------------------------------*/
CLASS FT604 //segundo dialogo
DATA oDlg, oDlg2, oDlg3
DATA oBrw, oBtn, oCat
DATA oMa, cMes, nAno
DATA oGet, vGet
DATA oCmb, vCmb, aCmb
DATA oDpk, vDpk, oDpkVc, vDpkVc
DATA oCkb, vCkb
DATA oRbt, vRbt
DATA aDbf, aDatos
DATA oSay, vSay, vUnimed
DATA cScope, Monpal, nRec, nLocal, vMespro, Numbol, vCajero, cNomcaj, cLocal
METHOD Open()
METHOD Init()
METHOD New() Constructor
METHOD Close() INLINE AEval( ::aDbf, { |oDbf| oDbf:Close() } ), .T.
METHOD Agrega()
METHOD Elimina()
METHOD Imprimir()
METHOD Guardar()
METHOD SetBrw()
METHOD PrePro()
METHOD Totales()
METHOD Pago()
METHOD Valida()
METHOD Descomprime()
METHOD Pago()
METHOD Vuelto()
METHOD Tecla()
ENDCLASS
/*-----------------------------------------------------------------------------------------------*/
METHOD Open() CLASS FT604
::aDbf := Array( 10 )
DB_PRODUC := Tred():Use( GetApp():cRuta + "COPRODUC.DBF" )
DB_FORPAG := TRed():Use( GetApp():cRuta + "COFORPAG.DBF" )
DB_VTAPDT := TRed():Use( GetApp():cRuta + "VTASPDTE.DBF" )
DB_PARAM := TRed():Use( GetApp():cRuta + "MAPARSIS.DBF" )
DB_LIBVTA := TRed():Use( GetApp():cRuta + "LIVTABOL.DBF" )
DB_ANALIS := TRed():Use( GetApp():cRuta + "MAANALIS.DBF" )
DB_DOCPEN := TRed():Use( GetApp():cRuta + "CCDOCPEN.DBF" )
DB_DETPRO := TRed():Use( GetApp():cRuta + "DEVTABOL.DBF" )
DB_BANCO := TRed():Use( GetApp():cRuta + "COBANCOS.DBF" )
DB_CAJAS := TRed():Use( GetApp():cRuta + "MOCAJERO.DBF" )
RETURN lTredOpen( ::aDbf )
/*-----------------------------------------------------------------------------------------------*/
METHOD Init() CLASS FT604
DB_PRODUC:DbSetOrder( 02 )
DB_ANALIS:DbSetOrder( 01 )
DB_LOCAL :DBSetOrder( 01 )
DB_DETPRO:DBSetOrder( 01 )
DB_FORPAG:DBSetOrder( 01 )
DB_LIBVTA:DBSetOrder( 01 )
DB_DOCPEN:DBSetOrder( 03 )
DB_BANCO :DBSetOrder( 01 )
DB_CAJAS :DBSetOrder( 01 )
::oCmb := Array( 03 )
::vCmb := Array( 03 )
::aCmb := Array( 03 )
::oGet := Array( 16 )
::vGet := Array( 16 )
::oBtn := Array( 15 )
::oDpk := Array( 02 )
::vDpk := Array( 02 )
::oSay := Array( 05 )
::vSay := Array( 05 )
::oCkb := Array( 01 )
::vCkb := Array( 01 )
::aCmb[01] := { {}, {} }
::aCmb[02] := { {}, {} }
DB_BANCO:Eval( { || AAdd( ::aCmb[01][01], DB_BANCO:CodBco ),;
AAdd( ::aCmb[02][02], DB_BANCO:DesBco) })
::vCmb[02] := ::aCmb[02][02][01]
::aCmb[03] := { {}, {}, {} }
DB_FORPAG:Eval( { || AAdd( ::aCmb[03][01], DB_FORPAG:DEFOPA ),;
AAdd( ::aCmb[03][02], DB_FORPAG:COFOPA ),;
AAdd( ::aCmb[03][03], DB_FORPAG:ACTPAG ) } )
::vCmb[03] := ::aCmb[03][01][01]
::vDpk := Date()
::vDpkVc := Date()
::vGet[04] := "Food Market"
::aDatos := {}
::vGet[05] := Space( 10 )
::vGet[06] := ""
::vGet[07] := 0
::vGet[08] := 0
::vGet[09] := 0
::vGet[10] := 0
::vSay[02] := 0
::vSay[01] := 0
::vSay[05] := 0
::vCkb[01] := .T.
::vGet[13] := Space(13)
::vGet[14] := 0
::vGet[03] := ::Numbol
::vSay[04] := 0
RETURN .T.
/*-----------------------------------------------------------------------------------------------*/
METHOD New( oCat, Numbol, Codcaj, mespro, nLoc, cNomcaj, cLoc ) CLASS FT604
LOCAL oFont, vMsg, oMsg, vCaj, oCaj
::oCat := oCat
::Numbol := Numbol
::vCajero := Codcaj
::vMespro := mespro
::nLocal := nLoc
::cNomcaj := cNomcaj
::cLocal := cLoc
vMsg := Array ( 06 )
oMsg := Array ( 06 )
vMsg[01] := "Esta Venta $"
vMsg[02] := "Cajer(o/a)"
vMsg[03] := "Sucursal"
vMsg[05] := "Nro.Boleta"
vMsg[06] := cNomcaj
IF !::Open(); RETURN NIL; ENDIF
IF !::Init(); ::Close(); RETURN NIL; ENDIF
vMsg[04] := ::cLocal
DB_ANALIS:DBSetOrder( 01 )
DB_DETPRO:SCOPE( ::cScope, ::cScope , 01 )
DEFINE FONT oFont NAME "Times New Roman" SIZE 0, -20 BOLD ITALIC
DB_DETPRO:Relation( DB_PRODUC, { || DB_DETPRO:CODPRO }, "DETPRO" )
DEFINE Dialog ::oDlg Resource "DL_604_VTAPOS"
Redefine DTPICKER ::oDpk VAR ::vDpk Id 106 Of ::oDlg
Redefine Get ::oGet[02] VAR ::vGet[02] Id 102 Of ::oDlg picture "@R 99.999.999-!" Update; ::oGet[02]:Disable() */
Redefine Say oMsg[05] VAR vMsg[05] id 108 of ::oDlg Font oFont
Redefine Say ::oGet[03] VAR ::vGet[03] Id 103 Of ::oDlg Font oFont //picture "9999999999999"
Redefine Say ::oGet[04] VAR ::vGet[04] Id 100 Of ::oDlg Update COLORS CLR_RED Font oFont
Redefine Say oMsg[01] VAR vMsg[01] id 116 of ::oDlg Update Font oFont
Redefine Say oMsg[02] VAR vMsg[02] id 065 of ::oDlg Font oFont
Redefine Say oMsg[03] VAR vMsg[03] id 050 of ::oDlg Font oFont
Redefine Say oMsg[04] VAR vMsg[04] id 051 of ::oDlg Font oFont Colors CLR_RED
Redefine Say oCaj VAR vMsg[06] id 104 of ::oDlg Update font oFont
Redefine CheckBox ::oCkb[01] VAR ::vCkb[01] id 130 of ::oDlg
Redefine Get ::oGet[14] VAR ::vGet[14] id 132 of ::oDlg when ::vCkb[01] = .T. update
Redefine Get ::oGet[15] VAR ::vGet[15] id 134 of ::oDlg when ::vCkb[01] = .T. ; ::oGet[15]:Disable()
Redefine Get ::oGet[13] VAR ::vGet[13] id 131 of ::oDlg when ::vCkb[01] = .T. Update valid { || ::Descomprime() }//para lector de barras
::oGet[15]:bGotFocus := { || ::oGet[13]:SetFocus() }
Redefine Get ::oGet[05] VAR ::vGet[05] id 110 of ::oDlg when ::vCkb[01] = .F. Update
Redefine Get ::oGet[07] VAR ::vGet[07] id 111 of ::oDlg Update When ::vCkb[01] = .F. Valid { || ::PrePro() } picture "9999" //Update
Redefine Get ::oGet[08] VAR ::vGet[08] id 112 of ::oDlg update when ::vCkb[01] = .F. Picture "99999.999"
Redefine Get ::oGet[09] VAR ::vGet[09] id 113 of ::oDlg update when ::vCkb[01] = .F. Picture "999,999,999"
Redefine Say ::oSay[05] VAR ::vSay[05] id 135 of ::oDlg Update Picture "9999" Font oFont //Valid { || ::Pago() }
Redefine Say ::oSay[01] VAR ::vSay[01] id 115 of ::oDlg Update Picture "999,999,999" Font oFont
Redefine Say ::oSay[03] VAR ::vSay[03] id 117 of ::oDlg update Font oFont
Redefine Button ::oBtn[02] Id 122 Of ::oDlg Action ::Agrega(), ::Totales()
Redefine Button ::oBtn[03] Id 126 Of ::oDlg //Action ::Modifica()
Redefine Button ::oBtn[04] Id 128 Of ::oDlg Action ::Elimina(), ::Totales()
Redefine Button ::oBtn[05] ID 123 of ::oDlg Action ( ::oDlg:bValid := { || .T. }, ::Valida() ) //Salida
REDEFINE BTNBMP ::oBtn[06] ID 124 OF ::oDlg ;
RESOURCE "EFECTIVO" Tooltip "Cancela con Efectivo..."
::oBtn[06]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 1 ), NIL ) }
REDEFINE BTNBMP ::oBtn[07] ID 125 OF ::oDlg ;
RESOURCE "CHEQDIA" Tooltip "Cancela con Cheque al Día..."
::oBtn[07]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 2 ), NIL ) }
REDEFINE BTNBMP ::oBtn[08] ID 129 OF ::oDlg ;
RESOURCE "CREDITO" Tooltip "Venta a Crédito..."
::oBtn[08]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 2 ), NIL ) }
REDEFINE BTNBMP ::oBtn[11] ID 127 OF ::oDlg ;
RESOURCE "DEBITO" TOOLTIP "Cancela con Tarjeta Debito ( Red Compra ) ..."
::oBtn[11]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 5 ), NIL ) }
REDEFINE BTNBMP ::oBtn[12] ID 136 OF ::oDlg ;
RESOURCE "VISA" ToolTip "Cancela con Tarjeta de Crédito..."
::oBtn[12]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 6 ), NIL ) }
REDEFINE BTNBMP ::oBtn[13] ID 137 OF ::oDlg ;
RESOURCE "PCVTA" Tooltip "Venta en Espera...."
::oBtn[13]:bAction := { || FT604AbreCaja():New(.T. , 1 ) }
REDEFINE BTNBMP ::oBtn[14] ID 138 OF ::oDlg ;
RESOURCE "CALC" Tooltip "Utilizar Calculadora..."
::oBtn[14]:bAction := { || WinExec( "Calc" ) }
WITH OBJECT ( oComp := TAyuda():Init( ::oGet[05] ) )
:oAdd := SELF
:oSource := DB_PRODUC
:nOrder := 03
:bSeek := { |cBuf| cBuf }
:bReplace := { |oANA| DB_PRODUC:DESPRO }
:bAdd := { |oANA,oAdd| oAdd:vGet[06] := DB_PRODUC:CODPLU, oAdd:vGet[13] := DB_PRODUC:CODBAR, oAdd:oDlg:Update() }
:aCols := { { "Rut ", { |oANA| DB_PRODUC:CODPLU }, 080 },;
{ "Nombre ", { |oANA| DB_PRODUC:DESPRO }, 200 } }
END
::oGet[05]:bValid := { || IF( Empty( ::vGet[06] ), ( DB_PRODUC:DBSetOrder(02),;
IF( DB_PRODUC:Seek( ::vGet[05] ), ( ,;
::vGet[06] := DB_PRODUC:CODPLU ,;
::vGet[05] := DB_PRODUC:DESPRO ,;
::vGet[13] := DB_PRODUC:CODBAR ,;
::Prepro(), ::oDlg:Update(), .T. ), .T. ) ), .T. ) }
DB_ANALIS:DBSetOrder( 01 )
WITH OBJECT ( ::oBrw := TXBrowse():New( ::oDlg ) )
::SetBrw()
:CreateFromResource(107)
END
::oDlg:bKeyDown := { |nKey| ::Tecla( nKey ) }
Activate Dialog ::oDlg center Valid .F.
RETURN Self
/*-----------------------------------------------------------------------------------------------*/
METHOD Tecla( nKey ) CLASS FT604
DO CASE
CASE nKey == VK_F2 .AND. ::vSay[01] > 0 ; ::Pago( 1 )
CASE nKey == VK_F3 .AND. ::vSay[01] > 0 ; ::Pago( 2 )
CASE nKey == VK_F4 .AND. ::vSay[01] > 0 ; ::Pago( 3 )
CASE nKey == VK_F5 .AND. ::vSay[01] > 0 ; ::Pago( 5 )
CASE nKey == VK_F6 .AND. ::vSay[01] > 0 ; ::Pago( 6 )
ENDCASE
RETURN NIL
/*-----------------------------------------------------------------------------------------------*/
METHOD Valida() CLASS FT604
IF Len( AR_DATOS ) > 0
MsgInfo( "Antes de Salir debe anular los datos...??","Atención Ventas...!" )
ELSE
::oDlg:END(.T.)
ENDIF
RETURN Self
*------------------------------------------------------------------------------------------------*/
METHOD Elimina() CLASS FT604
AR_DATOS := ADEL_( AR_DATOS, BA_nAt )
::oBrw:Gotop()
::SetBrw()
::oBrw:Refresh()
RETURN NIL
/*-----------------------------------------------------------------------------------------------*/
METHOD Descomprime() CLASS FT604
LOCAL nKilos, nGramos
DB_PRODUC:DBSetOrder( 04 )
IF !DB_PRODUC:SEEK( ::vGet[13] )
DB_PRODUC:DBSetOrder( 05 )
::vGet[06] := SubStr( ::vGet[13], 3 ,5 )
nKilos := SubStr( ::vGet[13], 8 ,2 )
nGramos := SubStr( ::vGet[13],10 ,3 )
::vGet[08] := Val( nKilos + "." + nGramos )
IF ::vGet[13] != " "
::PrePro()
::vGet[13] := Space(13)
ENDIF
ELSE
IF ::vGet[13] != " "
IF DB_PRODUC:ACTOFT = .T.
::vGet[09] := DB_PRODUC:PREOFT
? "Producto con PRECIO Oferta"
ELSE
::vGet[09] := DB_PRODUC:PRELST
ENDIF
::vGet[05] := DB_PRODUC:DESPRO
::vSay[03] := DB_PRODUC:DESPRO
::vUnimed := DB_PRODUC:UNIMED
::vGet[06] := DB_PRODUC:CODPLU
::vGet[16] := DB_PRODUC:PRULCO
::Agrega()
ENDIF
ENDIF
RETURN .T.
METHOD Agrega() CLASS FT604
IF ::vCkb[01] = .T.
DO CASE
CASE ::vUnimed == "002"
IF ::vGet[14] > 0
::vGet[08] := ::vGet[14]
ELSE
::vGet[08] := 1
ENDIF
::vGet[07] := ::vGet[08]
::vGet[08] := 0
::vGet[10] := Round( ::vGet[07] * ::vGet[09], 0 )
OTHERWISE
::vGet[10] := Round( ::vGet[08] * ::vGet[09] , 0 )
ENDCASE
ELSE
DO CASE
CASE ::vUnimed == "002"
::vGet[08] := 0
::vGet[10] := Round( ::vGet[07] * ::vGet[09], 0 )
OTHERWISE
::vGet[10] := Round( ::vGet[08] * ::vGet[09] , 0 )
ENDCASE
ENDIF
IF ::vGet[10] > 0
AAdd( AR_DATOS, { ::vMespro, ::nLocal, ::vGet[03], ::vGet[05], ::vGet[06], ::vGet[07],;
::vGet[08], ::vGet[09], ::vGet[10], ::vDpk, ::vUnimed, "002", ::vGet[16] } )
::SetBrw()
::vGet[05] := Space( 10 )
::vGet[13] := Space( 13 )
::vGet[07] := 0
::vGet[08] := 0
::vGet[09] := 0
::vGet[10] := 0
::vGet[14] := 0
::vSay[05] := ::vSay[05] + 1
::oBrw:Refresh()
::oDlg:Update()
::Totales()
ENDIF
RETURN NIL
/*-----------------------------------------------------------------------------------------------*/
METHOD PrePro() CLASS FT604
DB_PRODUC:DBSetOrder( 05 )
IF ::vCkb[01] = .T.
IF DB_PRODUC:SEEK( ::vGet[06] )
IF DB_PRODUC:ACTOFT = .T.
::vGet[09] := DB_PRODUC:PREOFT
? "Producto con PRECIO Oferta"
ELSE
::vGet[09] := DB_PRODUC:PRELST
ENDIF
::vGet[05] := DB_PRODUC:DESPRO
::vSay[03] := DB_PRODUC:DESPRO
::vUnimed := DB_PRODUC:UNIMED
::vGet[06] := DB_PRODUC:CODPLU
::vGet[16] := DB_PRODUC:PRULCO
::Agrega()
ELSE
? "no Encontro Producto Asociado"
IF ::vCkb[01] = .T.
::vGet[13] := Space(13)
::oGet[13]:SetFocus( ::oDlg )
ENDIF
ENDIF
ELSE
DB_PRODUC:DBSetOrder( 04 )
IF !DB_PRODUC:SEEK( ::vGet[13] )
? ::vGet[13], ::vGet[06], SubStr( ::vGet[06], 4, 5 )
DB_PRODUC:DBSetOrder( 05 )
IF DB_PRODUC:SEEK( SubStr( ::vGet[06], 4, 5 ) )
IF DB_PRODUC:ACTOFT = .T.
::vGet[09] := DB_PRODUC:PREOFT
? "Producto con PRECIO Oferta"
ELSE
::vGet[09] := DB_PRODUC:PRELST
ENDIF
::vGet[05] := DB_PRODUC:DESPRO
::vSay[03] := DB_PRODUC:DESPRO
::vUnimed := DB_PRODUC:UNIMED
::vGet[16] := DB_PRODUC:PRULCO
ELSE
? "no Encontro Producto Asociado"
::oGet[05]:SetFocus( ::oDlg )
ENDIF
ELSE
IF DB_PRODUC:ACTOFT = .T.
::vGet[09] := DB_PRODUC:PREOFT
? "Producto con PRECIO Oferta"
ELSE
::vGet[09] := DB_PRODUC:PRELST
ENDIF
::vGet[05] := DB_PRODUC:DESPRO
::vSay[03] := DB_PRODUC:DESPRO
::vUnimed := DB_PRODUC:UNIMED
::vGet[16] := DB_PRODUC:PRULCO
ENDIF
ENDIF
::oDlg:Update()
RETURN .T.
*------------------------------------------------------------------------------------------------*/
METHOD Totales() CLASS FT604
::vSay[01] := 0
::vSay[04] ++
AEval( AR_DATOS, { |aDat| IF( aDat[09] > 0, ::vSay[01] += aDat[09], NIL ) } )
IF ::vCkb[01] = .T.
::oGet[13]:SetFocus( ::oDlg )
ELSE
::oGet[05]:SetFocus()
ENDIF
::oDlg:Update()
RETURN .T.
*------------------------------------------------------------------------------------------------*/
METHOD Pago( nPos ) CLASS FT604
LOCAL oDlg, oBtn, vSay, oSay, vPag, oPag, oFont, oRbt, vRbt, oCmb, vCmb, oGet, vGet, vCkb, oCkb
LOCAL oApp
oBtn := Array( 02 )
vSay := Array( 04 )
oSay := Array( 04 )
vGet := Array( 03 )
oGet := Array( 03 )
vPag := 0
vSay[01] := ::vGet[03]
vSay[02] := ::vSay[01]
vSay[04] := "Valor Pagado"
vSay[03] := 0
DO CASE
CASE nPos == 1 .OR. nPos == 5 .or. nPos == 6
DEFINE FONT oFont NAME "Times New Roman" SIZE 0, -20 BOLD ITALIC
DEFINE Dialog oDlg Resource "DL_EFEC_POS"
Redefine Button oBtn[01] Id 106 Of oDlg Action (::oDlg:bValid := {||.T.}, oDlg:END(), ::Imprimir(), ::Guardar(nPos) )
Redefine Button oBtn[02] Id 107 Of oDlg Action oDlg:END()
Redefine SAY oSay[01] VAR vSay[01] Id 101 of oDlg Font oFont
Redefine SAY oSay[02] VAR vSay[02] id 102 of oDlg Font oFont picture "999,999,999" //monto total
Redefine SAY oSay[03] VAR vSay[03] id 103 of oDlg Update Font oFont //cambio
Redefine Say oSay[04] VAR vSay[04] id 104 of oDlg Font oFont
Redefine Get oPag VAR vPag id 105 of oDlg valid { || ::vuelto( oDlg, vPag, vSay, oBtn ) } Font oFont COLORS CLR_BLACK ,CLR_HCYAN
IF nPos == 5
MsgInfo( "Deslice tarjeta Debito", "Atención Cajeros" )
ENDIF
IF nPos == 6
MsgInfo( "Deslice tarjeta Crédito", "Atención Cajeros" )
ENDIF
ACTIVATE DIALOG oDlg Center
CASE nPos == 2
vRbt := 1
DEFINE FONT oFont NAME "Times New Roman" SIZE 0, -20 BOLD ITALIC
DEFINE Dialog oDlg Resource "DL_CHEQ_POS"
Redefine Button oBtn[01] Id 109 Of oDlg Action (::oDlg:bValid := {||.T.}, oDlg:END(), ::Imprimir(), ::Guardar( nPos ) )
Redefine Button oBtn[02] Id 110 Of oDlg Action oDlg:END()
Redefine SAY oSay[01] VAR vSay[01] Id 101 of oDlg Font oFont
Redefine SAY oSay[02] VAR vSay[02] id 102 of oDlg Font oFont picture "999,999,999"
Redefine SAY oSay[03] VAR vSay[03] id 103 of oDlg Update Font oFont
Redefine Radio oRbt VAR vRbt id 104,108 of oDlg
oRbt:bChange := { || IF ( vRbt = 2, ( oApp := MantFT208():New( Self, 0, ::nLocal, ::vMespro ),;
::oDlg:bValid := {||.T.}, oDlg:END(), ::Imprimir(), ::Guardar( 3 ) ) , NIL ) }
Redefine ComboBox ::oCmb[02] VAR ::vCmb[02] id 105 of oDlg items ::aCmb[02][02] when vRbt = 1
Redefine Get oGet[01] VAR vGet[01] id 106 of oDlg when vRbt = 1
Redefine Get oGet[02] VAR vGet[02] id 107 of oDlg When vRbt = 1
Redefine Get oGet[03] VAR vGet[03] id 113 of oDlg when vRbt = 1
Redefine CheckBox oCkb VAR vCkb id 114 of oDlg when vRbt = 1
Redefine Say oSay[04] VAR vSay[04] id 112 of oDlg Font oFont
Redefine Get oPag VAR vPag id 111 of oDlg valid { || ::vuelto( oDlg, vPag, vSay, oBtn ) } Font oFont COLORS CLR_BLACK ,CLR_HCYAN when vRbt = 1 .and. vCkb = .T.
ACTIVATE DIALOG oDlg Center
CASE nPos == 3
? "No Disponible"
ENDCASE
RETURN .T.
METHOD Vuelto( oDlg, vPag, vSay, oBtn ) CLASS FT604 //aqui pasamos estoos parametros oDlg, vPag, vSay
vSay[03] := Transform( vPag - vSay[02], "999,999,999" )
IF Val( vSay[03] ) < 0
MsgInfo( "Monto Pagado es incorrecto....!!","Atención Cajeros..." )
vPag := 0
oBtn[01]:Disable()
ELSE
oBtn[01]:Enable()
ENDIF
oDlg:Update()
RETURN .T.
/*-----------------------------------------------------------------------------------------------*/
METHOD SetBrw() CLASS FT604
LOCAL vTemp
WITH OBJECT ::oBrw
DEFINE FONT oFont NAME "Times New Roman" SIZE 0, -15 BOLD ITALIC
IF Len( AR_DATOS ) > 0
:SetArray( AR_DATOS, .T. )
ELSE
:SetArray( {{ "","","","","",0,0,0,0,0,"","",{} } }, .T. )
Endif
:lColDividerComplete := .T.
:nColDividerStyle := 02
:lFooter := .T.
:nFooterLines := 01
:nMarqueeStyle := 005
:lFastEdit := .T.
:nHeaderLines := 02
:nFreeze := 1
WITH OBJECT :aCols[ BA_MESPRO ]
:Hide()
END
WITH OBJECT :aCols[ BA_LOCCOM ]
:Hide()
END
WITH OBJECT :aCols[ BA_NUMBOL ]
:Hide()
END
WITH OBJECT :aCols[ BA_PRECOS ]
:Hide()
END
WITH OBJECT :aCols[ BA_DESPRO ]
:cHeader := "Detalle " + CRLF + "del Producto"
:nWidth := 350
:bLDClickData := { || ::FichaPro( DB_PRODUC:RecNo() ) }
:oDataFont := oFont
END
WITH OBJECT :aCols[ BA_CODPRO ]
:Hide()
END
WITH OBJECT :aCols[ BA_UNIPRO ]
:cHeader := " Unidades"
:nEditType := 1
:bonpostEdit := { |o| AR_DATOS[ BD_nAt ][03] := ( o:oEditGet:cText ) }
:bEditValue := { || AR_DATOS[ BD_nAt ][03] }
:nWidth := 90
:oDataFont := oFont
END
WITH OBJECT :aCols[ BA_KILPRO ]
:cHeader := " Kilo" + CRLF + " Gramos"
:nWidth := 100
:nEditType := 1
:bonpostEdit := { |o| AR_DATOS[ BD_nAt ][04] := ( o:oEditGet:cText ) }
:bEditValue := { || AR_DATOS[ BD_nAt ][04] }
:oDataFont := oFont
END
WITH OBJECT :aCols[ BA_PREVTA ]
:cHeader := " Precio" + CRLF + " Venta"
:nWidth := 100
:oDataFont := oFont
END
WITH OBJECT :aCols[ BA_SUBTOT ]
:cHeader := "Sub-Total "
:nWidth := 100
:oDataFont := oFont
END
WITH OBJECT :aCols[ BA_FECMOV ]
:hide()
END
WITH OBJECT :aCols[ BA_TIPMOV ]
:cHeader := "Tipo"
:nWidth := 90
END
WITH OBJECT :aCols[ BA_ESTADO ]
:Hide()
END
END
RETURN NIL
/*-----------------------------------------------------------------------------------------------*/
METHOD Guardar( nPos ) CLASS FT604
LOCAL nFor, nBol
DB_PRODUC:DBSetOrder( 02 )
FOR nFor = 1 TO Len( AR_DATOS )
DB_DETPRO:APPEND()
DB_DETPRO:MESPRO := AR_DATOS[nFor][BA_MESPRO]
DB_DETPRO:LOCCOM := AR_DATOS[nFor][BA_LOCCOM]
DB_DETPRO:NUMBOL := strzero( Val( AR_DATOS[nFor][BA_NUMBOL] ) , 8 )
DB_DETPRO:CODPRO := AR_DATOS[nFor][BA_CODPRO]
DB_DETPRO:UNIPRO := AR_DATOS[nFor][BA_UNIPRO]
DB_DETPRO:KILPRO := AR_DATOS[nFor][BA_KILPRO]
DB_DETPRO:PREVTA := AR_DATOS[nFor][BA_PREVTA]
DB_DETPRO:FECMOV := AR_DATOS[nFor][BA_FECMOV]
DB_DETPRO:TIPMOV := '002' //AR_DATOS[nFor][BA_TIPMOV] corregir segun array de tablas
DB_DETPRO:PRECOS := AR_DATOS[nFor][BA_PRECOS]
DB_DETPRO:UNLOCK()
IF ( DB_PRODUC:SEEK( AR_DATOS[nFor][ BA_CODPRO ] ) )
DB_PRODUC:RLock()
DB_PRODUC:PRULVT := AR_DATOS[nFor][ BA_PREVTA ]
DB_PRODUC:ULTVTA := AR_DATOS[nFor][ BA_FECMOV ]
DB_PRODUC:ACTPRO := .T.
DB_PRODUC:UNLOCK()
ENDIF
NEXT
DB_LIBVTA:APPEND()
DB_LIBVTA:MESPRO := ::vMespro
DB_LIBVTA:LOCCOM := ::nLocal
DB_LIBVTA:FECEMI := ::vDpk
DB_LIBVTA:NUMBOL := StrZero( Val( ::vGet[03] ), 8 )
DB_LIBVTA:MONBOL := ::vSay[01]
DO CASE
CASE nPos == 1 ; DB_LIBVTA:FORPAG := '01'
CASE nPos == 2 ; DB_LIBVTA:FORPAG := '02'
CASE nPos == 3 ; DB_LIBVTA:FORPAG := '03'
CASE nPos == 5 ; DB_LIBVTA:FORPAG := '05'
CASE nPos == 5 ; DB_LIBVTA:FORPAG := '06'
ENDCASE
DB_LIBVTA:CODCAJ := ::vCajero
DB_LIBVTA:HORMOV := Time()
DB_LIBVTA:UNLOCK()
IF ( DB_CAJAS:SEEK( ::vMespro + DToS( ::vDPk ) + ::vCajero + "T" ) )
DB_CAJAS:RLock()
nBol := STRZERO( Val( ::vGet[03] ) + 1 , 8 )
DB_CAJAS:BOLACT := nBol
DB_CAJAS:UNLOCK()
ENDIF
AR_DATOS := {}
hb_gcAll()
::oDlg:END(.T.)
::Close()
FT604():New( Self, nBol, ::vCajero, ::vMespro, ::nLocal, ::cNomcaj, ::cLocal )
RETURN .T.
/*-----------------------------------------------------------------------------------------------*/
METHOD Imprimir() CLASS FT604
Local cPuerto:="LPT1"
LOCAL nLin, nFor, cTemp := "", nSubtot := 0, nTotal := 0, nProd, lFor
DB_LIBVTA:DBSetOrder( 01 )
IF DB_LIBVTA:SEEK( ::vMespro + ::nLocal + StrZero( Val( ::vGet[03] ), 8 ) )
DB_CAJAS:SEEK( ::vMespro + DToS( ::vDPk ) + ::vCajero + "T" )
::vGet[03] := DB_CAJAS:BOLACT
FOR nFor := 1 TO Len( AR_DATOS )
AR_DATOS[nFor][BA_NUMBOL] := ::vGet[03]
NEXT
ENDIF
oPrn:=TDosPrn():New(cPuerto)
oPrn:SayCmp( 01,00, "Caja:" )
oPrn:SayCmp( 01,04, "001" )
oPrn:SayCmp( 01,24, "No.:" + ::vGet[03] )
oPrn:SayCmp( 02,00, SUBSTR(DTOS(::vDpk),7,2) )
oPrn:SayCmp( 02,03, CMonth( ::vDpk ) )
oPrn:SayCmp( 02,10, SubStr(DToS(::vDpk),1,4 ) )
oPrn:SayCmp( 02,15, Time()+ Space( 12 ) )
nLin := 00
FOR nFor = 1 TO Len( AR_DATOS )
nSubTot := 0
IF AR_DATOS[nFor][BA_ESTADO] = "002"
nSubTot := Str( Round( AR_DATOS[nFor][BA_UNIPRO] * AR_DATOS[nFor][BA_PREVTA],0 ) )
cTemp = SubStr( AR_DATOS[nFor][BA_DESPRO], 1,18 ) + " "+ Trans ( AR_DATOS[nFor][BA_UNIPRO], "999" ) + ;
Trans ( AR_DATOS[nFor][BA_PREVTA], "99999" ) + nSubTot
ELSE
nSubTot := Str( Round( AR_DATOS[nFor][BA_KILPRO] * AR_DATOS[nFor][BA_PREVTA],0 ) )
cTemp = SubStr( AR_DATOS[nFor][BA_DESPRO], 1,18 ) + Trans ( AR_DATOS[nFor][BA_KILPRO], "999.999" ) +;
Trans ( AR_DATOS[nFor][BA_PREVTA], "99999" ) + nSubTot
ENDIF
nTotal := nTotal + Val( nSubtot )
oPrn:SayCmp( 00,00, cTemp )
nLin++
IF nLin == 20
oPrn:SayCmp( 00,00,"----------------------------------------" ) //40
oPrn:SayCmp( 00,00,"Nro. Productos Total-> " + Trans( nTotal, "999,999,999" ) )
oPrn:SayCmp( 00,10, Str( nLin ) )
FOR lFor := nLin TO 27
oPrn:SayCmp( 00,00, Space( 40 ) )
NEXT
oPrn:SayCmp( 00,00, " " )
oPrn:SayCmp( 01,00, "Caja:" )
oPrn:SayCmp( 01,04, "001" )
oPrn:SayCmp( 01,24, "No.:" + Strzero( Val( ::vGet[03] ) + 1 ,8 ) )
oPrn:SayCmp( 02,00, SUBSTR(DTOS(::vDpk),7,2) )
oPrn:SayCmp( 02,03, CMonth( ::vDpk ) )
oPrn:SayCmp( 02,10, SubStr(DToS(::vDpk),1,4 ) )
oPrn:SayCmp( 02,15, Time()+ Space( 12 ) )
nLin := 00
ENDIF
NEXT
oPrn:SayCmp( 00,00,"----------------------------------------" ) //40
oPrn:SayCmp( 00,00,"Nro. Productos Total-> " + Trans( nTotal, "999,999,999" ) )
oPrn:SayCmp( 00,10, Str( nLin ) )
IF Len( AR_DATOS ) <= 20
FOR nFor := nLin TO 27
oPrn:SayCmp( 00,00, Space( 40 ) )
NEXT
ENDIF
oPrn:SayCmp( 00,00, " " )
oPrn:end(.T.)
::oDlg:END(.T.)
RETURN .T.
/*-----------------------------------------------------------------------------------------------*/
[/code]
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Mauro,
Cuando dices que tu aplicación se cuelga, a que te refieres exactamente ? Da algún mensaje de error ? El ordenador se vuelve muy lento ? Las imágenes dejan de aparecer ?
Quizá lo que te ocurre es un problema de recursos no liberados, y no tiene nada que ver con la memoria que consume tu aplicación.
Cuando dices que tu aplicación se cuelga, a que te refieres exactamente ? Da algún mensaje de error ? El ordenador se vuelve muy lento ? Las imágenes dejan de aparecer ?
Quizá lo que te ocurre es un problema de recursos no liberados, y no tiene nada que ver con la memoria que consume tu aplicación.
-
- Posts: 31
- Joined: Fri Mar 17, 2006 2:04 pm
Hola Antonio, me refiero a que la app de queda pegada, no responde y no puedo hacer nada sobre ella, solo abrir el adm de tareas y "Terminar Proceso" para cerrar la app y volverla a cargar. a veces me sale un dialogo de windows que dice "Insuficiente memoria, cierre otras apliacaciones y vuelva a intentarlo" y en la app solo muestra algunas partes de ese prg. guarde una imagen pero no se como ponerla aqui para que la veas..
muchas gracias.
Mauro
muchas gracias.
Mauro
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 31
- Joined: Fri Mar 17, 2006 2:04 pm
Hola Antonio, si utilizo Bitmaps en ese prg, en el method New los llamo desde mi RC asi :
REDEFINE BTNBMP ::oBtn[06] ID 124 OF ::oDlg ;
RESOURCE "EFECTIVO" Tooltip "Cancela con Efectivo..."
::oBtn[06]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 1 ), NIL ) }
REDEFINE BTNBMP ::oBtn[07] ID 125 OF ::oDlg ;
RESOURCE "CHEQDIA" Tooltip "Cancela con Cheque al Día..."
::oBtn[07]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 2 ), NIL ) }
REDEFINE BTNBMP ::oBtn[08] ID 129 OF ::oDlg ;
RESOURCE "CREDITO" Tooltip "Venta a Crédito..."
::oBtn[08]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 2 ), NIL ) }
REDEFINE BTNBMP ::oBtn[11] ID 127 OF ::oDlg ;
RESOURCE "DEBITO" TOOLTIP "Cancela con Tarjeta Debito ( Red Compra ) ..."
::oBtn[11]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 5 ), NIL ) }
REDEFINE BTNBMP ::oBtn[12] ID 136 OF ::oDlg ;
RESOURCE "VISA" ToolTip "Cancela con Tarjeta de Crédito..."
::oBtn[12]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 6 ), NIL ) }
crees que mejor le saco los bitmaps a esos bottones, o como le hago para liberar esos recursos??
Muchas gracias por tu preocupación
Salu2
Mauro
REDEFINE BTNBMP ::oBtn[06] ID 124 OF ::oDlg ;
RESOURCE "EFECTIVO" Tooltip "Cancela con Efectivo..."
::oBtn[06]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 1 ), NIL ) }
REDEFINE BTNBMP ::oBtn[07] ID 125 OF ::oDlg ;
RESOURCE "CHEQDIA" Tooltip "Cancela con Cheque al Día..."
::oBtn[07]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 2 ), NIL ) }
REDEFINE BTNBMP ::oBtn[08] ID 129 OF ::oDlg ;
RESOURCE "CREDITO" Tooltip "Venta a Crédito..."
::oBtn[08]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 2 ), NIL ) }
REDEFINE BTNBMP ::oBtn[11] ID 127 OF ::oDlg ;
RESOURCE "DEBITO" TOOLTIP "Cancela con Tarjeta Debito ( Red Compra ) ..."
::oBtn[11]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 5 ), NIL ) }
REDEFINE BTNBMP ::oBtn[12] ID 136 OF ::oDlg ;
RESOURCE "VISA" ToolTip "Cancela con Tarjeta de Crédito..."
::oBtn[12]:bAction := { || IF ( ::vSay[01] > 0, ::Pago( 6 ), NIL ) }
crees que mejor le saco los bitmaps a esos bottones, o como le hago para liberar esos recursos??
Muchas gracias por tu preocupación
Salu2
Mauro
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 31
- Joined: Fri Mar 17, 2006 2:04 pm
Antonio, compile solo ese prg de ventas, saque todos los bitmaps e igual ocurre, el problema creo no son los array's pues cambie ese array por una dbf temporal y el problema es el mismo... a medida que realizo ventas aumenta el uso de la app en memoria y llega un momento en que me dice "insuficiente memoria" y la app se bloquea.. ¿como hago para liberar esa memoria que se acumula y bloquea la app..?
Muchas Gracias
Mauro
Muchas Gracias
Mauro
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: