- Code: Select all Expand view
- static function bajalote( oGeto, nboton, odlgrem )
local odLote
local aLotes := Array(0)
local oDlg1, obrw1
local oGet
LOCAL oBoton
LOCAL aLoteback := Array(0)
LOCAL oTotal
LOCAL lacepto := .f.
local z := 1
//"Código", "Cantidad", "Producto", "Despacho"
if !pasaje("lotedep"); return nil; endif
DATABASE odLote
odLote:setorder(2)
FOR z = 1 to Len(oDeposito:aDetalle)
if odLote:seek(oDeposito:aDetalle[ z, 1 ])
do
if !Empty(odLote:stock)
AAdd( aLotes,{.f.,odLote:codigo, odLote:lote, odLote:vto, odLote:stock,odLote:recno()} )
endif
odLote:skip()
until odLote:codigo != oDeposito:aDetalle[ z, 1 ]
endif
NEXT
aLoteback := AClone( aLotes )
IF Len(aLotes) = 0
MsgStop("No hay datos de lotes sobres este producto","Aviso del sistema")
return nil
endif
DEFINE DIALOG oDlg1 RESOURCE "DIA_XBRVARIOS1"
oDlg1:cCaption := "Dirección origen"
REDEFINE XBrowse obrw1 id 101 oDlg1 update;
columns 1, 2, 3, 4;
COLSIZES 10, 75, 90, 80, 100;
HEADERS "", "Código", "Lote", "Vto", "Stock";
ARRAY aLotes
// obrw1:setarray(aLotes)
// AEval( obrw1:aCols, { |oCol| oCol:nEditType := EDIT_GET })
WITH OBJECT obrw1
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:bClrSelFocus := { || { CLR_BLACK, CLR_HGRAY } }
:nStretchCol := 3
:aCols[ 1 ]:bClrSelFocus := { ||{ CLR_BLACK, CLR_WHITE } }
:lmultiselect := .f.
(1) :bLClicked := { |r,c,f,obrw1| If( obrw1:MouseColPos( c ) == 1 , ;
If( ( f := AScan( obrw1:aSelected, obrw1:BookMark ) ) == 0, ;
AAdd( obrw1:aSelected, obrw1:BookMark ), ;
ADel( obrw1:aSelected, f, .t. ) ), nil ), ftotal(aLotes,aLoteback, oTotal,F,obrw1) ,;
obrw1:RefreshCurrent() }
END
WITH OBJECT obrw1:aCols[ 1 ]
/* :bEditValue := { || aLotes[obrw1:nArrayAt,1] }
:setcheck() */
:bEditValue := { || AScan( obrw1:aSelected, obrw1:BookMark ) > 0 }
:SetCheck()
:nHeadBmpNo := { || If( Len( obrw1:aSelected ) == obrw1:nLen, 1, 2 ) }
END WITH
WITH OBJECT obrw1:aCols[ 2 ]
:bEditValue := {|| transform( aLotes[obrw1:nArrayAt,2], "9999") }
:nDataStrAlign := AL_CENTER
END WITH
WITH OBJECT obrw1:aCols[ 3 ]
:bEditValue := {|| aLotes[obrw1:nArrayAt,3] }
:nDataStrAlign := AL_CENTER
END WITH
WITH OBJECT obrw1:aCols[ 4 ]
:bEditValue := {|| transform( aLotes[obrw1:nArrayAt,4], "@d" )}
:nDataStrAlign := AL_CENTER
END WITH
WITH OBJECT obrw1:aCols[ 5 ]
:bEditValue := {|| Transform( aLotes[obrw1:nArrayAt,5],"@e 9,999,999.99") }
:nDataStrAlign := AL_RIGHT
:nEditType := EDIT_GET
END WITH
redefine GET oTotal VAR ntotal id 103 picture "@e 999,999.99" of oDlg1
REDEFINE BUTTON nboton id 102 ACTION ( lacepto := .t., oDlg1:end())
ACTIVATE DIALOG oDlg1
// @180,245 say "Faltante" BORDER SIZE 195,10 OF oDlg1
if lacepto
for each z in aLotes
if z[ 1 ]
odLote:goto( z[ 6 ] )
if reviso(odLote)
odLote:stock := z[ 5 ]
salvo(odLote)
endif
endif
next
endif
CIERROALIAS(odLote:calias, odLote)
return nil
////////////////////////////////////////////////////////////////////////////////
static function ftotal(aLotes,aLoteback, oTotal,F,oBrw1)
local nAt := oBrw1:nArrayAt
if F = 0
if ntotal > aLotes[nAt,5]
ntotal -= aLotes[nAt,5]
aLotes[nAt,5] := 0
else
aLotes[nAt,5] -= ntotal
ntotal := 0
endif
aLotes[nAt,1] := .t.
elseif F = 1
ntotal += aLoteback[nAt,5]
aLotes[nAt,5] := aLoteback[nAt,5]
aLotes[nAt,1] := .F.
endif
oBrw1:refresh()
oTotal:refresh()
return nil
////////////////////////////////////////////////////////////////////////////////
Si no pòngo (1) al hacer click en el checbox no hace nada
Al estar (1) si se hace un clik en el checbox hace lo que se espera, pero si lo hago en otra celda cambia y dispara la función ftotal
No me deja editar la quinta columna
si pongo
/* :bEditValue := { || aLotes[obrw1:nArrayAt,1] }
:setcheck() */
no hace nada .
Lo que pretendo es que al hacer click en el checbox me cambie la condición y poder disparar la función ftotal, con un bposedit, y siquiero cambiar algo del array poder hacerlo.
Gracias por su atención
Luis