In Browse with DBF work fine:
PRIVATE bColor := { || If ( Articulos->Stock < Articulos->Stk_Min , { 255,80,80 } , { 255,255,255 } ) }
Now i need some but in Grid control, add data from array
i need: if col number 3 (Stock) < col number 4 (Stock Min) show row in red... othercase normal white
Any can help me please.
Code: Select all
#include "hmg.ch"
Declare Window Stock
Function Stock_button_suc10_action
LOCAL aTable := {}
LOCAL aTotal := {}
LOCAL cQuery := ""
LOCAL tQuery := ""
PRIVATE bColor := {|| If ((This.CellColIndex,3) < (This.CellColIndex,4) , { 255,80,80 } , { 255,255,255 } ) } // Don't work
Load Window Stock_Sucursales
SetProperty ("Stock_Sucursales" , "Title" , "Stock Sucursal 10")
Stock_Sucursales. Center
cQuery := " SELECT * FROM Stock_10;"
tQuery := " SELECT COALESCE(SUM(Stock_Kg),0) AS T1, COALESCE(SUM(Stock_Un),0) AS T2 FROM Stock_10;"
If MySQL_Connect ()
If MySQL_Database_Connect ()
aTable := MySQL_ExecQuery (oServer,cQuery)
aTotal := MySQL_ExecQuery (oServer,tQuery)
DoMethod ("Stock_Sucursales" , "Grid_Stock" , "DeleteAllItems")
If Len (aTable) > 0
For n := 1 TO Len (aTable)
DoMethod("Stock_Sucursales","Grid_Stock","AddItem", aTable[n] )
Next
EndIf
DoMethod (Stock_Sucursales.StatusBar.Item (1) := " Stock de Sucursal: 10 ")
DoMethod (Stock_Sucursales.StatusBar.Item (2) := " Total Peso: " + AllTrim (Str (aTotal[1,1])))
DoMethod (Stock_Sucursales.StatusBar.Item (3) := " Total Cantidades: " + AllTrim (Str (aTotal[1,2])))
EndIf
EndIf
Stock_Sucursales. Activate
Return Nil