Tengo el siguiente problema, tengo un array con un item l贸gico, prob茅 de varias formas pero no funciona correctamente. Alguien me podr铆a facilitar un peque帽o ejemplo de como hacerlo. Yo hice esto
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
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