by José Camilo » Sun Feb 12, 2023 4:38 pm
Cristobal.
Disculpa mi bruteza pero cambiando lo que indicas me muestra un numero que no se de donde sale.
lo estare aplicando mal.
esta es la funcion completa. necesito poder editar los valores de la columna PEDIR y al hacerlo en la columna TOTAL se muestre el resultado
de multiplicar PEDIR*COSTO y se muestre la suma de de la columna TOTAL al pie.
hasta aca puedo editar el campo PEDIR y se actualiza el mismo, el resto no lo logro realizar.
Si puedes darle una ojeada te agradezco. Seguro es algo muy simple que no se hacer.
//------------------------------------------------------------------------------------------------------------------------------------------------------------*/
function AbmOC()
local napu
local aBotones := {}
local oDlg, oBrw, cAlias := cGetNewAlias( "_ARTFOR" )
local oBr, oFont
local titgral := 'Stock'
local atitcol := ''
local acampos := {}
local lcampos
Private oBar
acampos := {|| {str(ArtFor->Articulo,4)+' '+ArtFor->Detalle+' '+ArtFor->Abrevia } }
lcampos := {|| str(ArtFor->Articulo,4)+' '+ArtFor->Detalle+' '+ArtFor->Abrevia }
atitcol := "Cód. Detalle Abrevia"
aBotones := { {"Impre1.bmp" ,"Edito" , "Edito" , {||/*EditCS(_ArtFor->Pedir),*/oBrw:MakeTotals(),oBrw:SetFocus(),oBrw:Refresh() },VK_RETURN,"<RETURN>",.f.},;
{"Impre1.bmp" ,"Imprime OC" , "Imprime OC " , {|| lstOC(),oBrw:SetFocus(),oBrw:Refresh() },VK_R ,"<V>" ,.t.},;
{"Exit.bmp" ,"Sale de Browse" , "Salir" , {|| oDlg:end() },VK_ESCAPE,"<Escape>",.t.} ;
}
SET DATE ITALIAN
SET CENTURY ON
XBrNumFormat( 'E', .t. )
SetBalloon( .t. )
dbcloseall()
use colorfw new
use tecnico new
use corregir index corregi1 new
use acciones index accione1 new
use RamFor index RamFor1, RamFor2 new
use RubFor index RubFor1, RubFor2 new
use ProvFor index ProvFor1, ProvFor2 new
use ArtFor index ArtFor1, ArtFor2, ArtFor3, ArtFor4, ArtFor5 new
use _ArtFor index _ArtFor1, _ArtFor2 new
zap
select ArtFor
ArtFor->(DbGoTop())
While !ArtFor->(Eof())
select _ArtFor
_ArtFor->(DbAppend())
_ArtFor->Articulo := ArtFor->Articulo
_ArtFor->Detalle := ArtFor->Detalle
_ArtFor->Abrevia := ArtFor->Abrevia
_ArtFor->Costo := ArtFor->Costo
_ArtFor->StockMin := ArtFor->StockMin
_ArtFor->StockAct := ArtFor->StockAct
_ArtFor->Pedir := ArtFor->StockMin-ArtFor->StockAct
_ArtFor->Total := _ArtFor->Pedir*_ArtFor->Costo
select ArtFor
ArtFor->(DbSkip())
end
select _ArtFor
_ArtFor->(DbGoTop())
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-15
DEFINE BRUSH oBr RESOURCE "beige2"
DEFINE DIALOG oDlg FROM 1, 30 TO 650, 1050 FONT oFont TITLE 'Generador de Orden de Compra' PIXEL
@ 4,5 XBROWSE oBrw ;
COLUMNS "Articulo", "left(Detalle,35)", "Abrevia", "Costo", "StockAct", "StockMin", "Pedir","Total" ;
HEADERS "Cód.", "Detalle", "Abr.", "Costo", "Stock Act", "Stock Min", "Pedir","Total";
COLSIZES -10,150,-10,-10,-10,-10,-10,-10 OF oDlg ;
SIZE 500,283 PIXEL ;
JUSTIFY .T.,.f.,.f.,.t.,.t.,.t.,.t.,.t. ;
ALIAS cAlias AUTOSORT FOOTERS LINES CELL NOBORDER ;
BACKGROUND aGrad VERTICAL
oBrw:nStretchCol := 2
oBrw:nRowHeight := 30
oBrw:nMarqueeStyle := 4
// anulo el doble color d los registros
oBrw:lContrastClr := .f.
// quitar barra horizontal
oBrw:lHScroll := .f.
oBrw:bKeyDown:={|nKey,nFlag|iif(veo(@nApu,@oBrw,aBotones,nKey),eval(aBotones[nApu,4]),NIL)}
oBrw:aCols[ 7 ]:nEditType := EDIT_GET
oBrw:aCols[ 7 ]:bEditValid := {|| if(1=1,(_ArtFor->Total := _ArtFor->Pedir*_ArtFor->Costo,msginfo('jjjj'),refXbrw(_ArtFor->(Recno())),_ArtFor->(Eof()),.t.),.f.) }
oBrw:aCols[ 7 ]:lAutoSave := .T.
oBrw:aCols[ 8 ]:nFooterType:= AGGR_TOTAL
oBrw:MakeTotals()
oBrw:CreateFromCode()
cGrad := PadR( GradStr( BrwGrad( oBrw ) ), 128 )
ACTIVATE DIALOG oDlg CENTERED on INIT (BtnBarNew( oBrw, @oDlg, aBotones))
RELEASE BRUSH oBr
RELEASE FONT oFont
dbcloseall()
return nil
//-------------------------------------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------//
function RefXBrw(regi)
select _ArtFor
_ArtFor->(DbGoTop())
While !_ArtFor->(Eof())
_ArtFor->Total := _ArtFor->Costo*_ArtFor->Pedir
_ArtFor->(DbSkip())
end
_ArtFor->(DbGoTo(regi))
return NIL
//-------------------------------------------------------------------------------------------------------------------------------------------------------------//