Carlos.
El siguiente es codigo parcial que utilizo en uno de mis sistemas de facturacion.
Code: Select all
local bTotales := ;
{|| oBrw:Total:Value := oBrw:Cantidad:Value * oBrw:Precio:Value ,;
if(oBrw:PDesc:Value > 0, oBrw:VDesc:Value := Round( (oBrw:Total:Value * oBrw:PDesc:Value)/100,2 ), ) ,;
oBrw:Gravable:Value := oBrw:Total:Value - oBrw:VDesc:Value ,;
oBrw:IVA:Value := if( oBrw:PagaIVA:Value = "S", Round( (oBrw:Gravable:Value * nImpuesto)/100, 2 ), 0 ) ,;
if(oBrw:Exone:Value=="S", oBrw:IVA:Value := 0, ) ,; // if( lCkBxExone, oBrw:IVA:Value := 0, ) ,;
oBrw:GTot:Value := oBrw:Gravable:Value + oBrw:IVA:Value ,;
oBrw:Refresh() }
local bTotFact := ;
{|| nGrav:=oBrw:Gravable:nTotal, nIva:=oBrw:Iva:nTotal, nTot:=oBrw:Gtot:nTotal ,;
oGrav:Refresh(), oIva:Refresh(), oTot:Refresh() }
local bTotalize := ;
{|| Eval(bTotales),;
oBrw:MakeTotals( oBrw:oCol( "Total,VDesc,Gravable,Iva,GTot" ) ),;
oBrw:RefreshFooters(),;
Eval(bTotFact) }
local lLectorCB:=.t., bLectorCB
@ 100,10 XBROWSE oBrw SIZE -10,-50 PIXEL OF oDlg ;
DATASOURCE aInvoice ;
COLUMNS 1,2,3,4, 5,6,7,8,9,10,11,12 ;
HEADERS "CODIGO", "DESCRIP", "CANTIDAD", "PRECIO", "TOTAL", "PDESC", "VDESC", "GRAVABLE", "PAGAIVA", "IVA", "GTOT","EXONE";
PICTURES Repli("9", nLenCode) , nil, "999,999.99", "9,999,999.99", "9,999,999,999.99", nil, "9,999,999,999.99", "9,999,999,999.99", nil,"999,999,999.99", "9,999,999,999.99", NIL ;
COLSIZES 90, 410, 80, 100, 140, 70, 140, 140, 60, 90, 140, 65 ;
CELL LINES FOOTERS NOBORDER FASTEDIT
oBrw:nEditTypes := { EDIT_GET, EDIT_NONE, EDIT_GET, EDIT_GET, EDIT_NONE, EDIT_GET, EDIT_GET, EDIT_NONE, EDIT_NONE, EDIT_NONE, EDIT_NONE, EDIT_NONE }
bLectorCB := {|| oBrw:Cantidad:Value:=1, Eval(bTotalize), oBrw:GoDown() }
WITH OBJECT oBrw:Codigo //es oBrw:aRow[1]
:bEditValid := { |oGet| oGet:VarGet() >= 0 }
:bOnChange := { |oCol|aProd:=GetProductInfo(oCol:Value,aProdu,nLenCode,nLenFld,oBrw),;
oBrw:Codigo:Value := aProd[1] ,;
oBrw:Descrip:Value := aProd[2] ,;
oBrw:Precio:Value := aProd[3] ,;
oBrw:PagaIva:Value := aProd[5] ,;
if(lLectorCB, EVal(bLectorCB),) ,;
EVal(bTotalize) }
END
Saludos.