#include <fivewin.ch>
#include <xbrowse.ch>
#include <Splitter.ch>
#include <ribbon.ch>
#include "ttitle.ch"
#include <taskpanel.ch>
#include "dtpicker.ch"
#DEFINE C_SIMPLE CHR( 39 )
#DEFINE c_simple CHR( 39 )
#DEFINE CCODIGO SPACE(15)
#DEFINE NCANTIDAD 0.00
#DEFINE CUNIDAD SPACE(20)
#DEFINE CDESCRIPCION SPACE(60)
#DEFINE NPRECIO 0
#DEFINE NIMPORTE 0
#DEFINE CEXENTO SPACE(1)
#DEFINE NRECNO 0
#DEFINE NDEC 5
#DEFINE AMONEDAS {"PESOS","DLS", "MXN"}
#DEFINE AMEDIDAS { FWString("PIECES") ,;
FWString("SERVICE") ,;
FWString("LITER") ,;
FWString("KILOGRAM") ,;
FWString("KGS") ,;
FWString("DOES NOT APPLY") }
STATIC oGet
STATIC oBrw
STATIC aData
STATIC n15
STATIC oSay
STATIC cUnidad_medida
STATIC nAmount := 0
STATIC nTot1 := 0
STATIC nTot2 := 0
STATIC nPorc_ret_isr := 0
STATIC nPorc_ret_iva := 0
STATIC nFactura := 0
STATIC cSerieX := ""
STATIC cTimbrado := ""
STATIC aItemsDel := {}
CLASS AbcCompras
DATA oMain AS Object
DATA oBrw AS Object
DATA oBox AS Object
DATA lEdit
DATA cCia
DATA nCod_cte INIT 0
DATA cRfc INIT SPACE(15)
DATA cNombre INIT SPACE(100)
DATA cNumero_escuela
DATA cCalle INIT SPACE(100)
DATA cNo_exterior INIT SPACE(20)
DATA cNo_Interior INIT SPACE(20)
DATA cColonia INIT SPACE(60)
DATA cLocalidad INIT SPACE(60)
DATA cMunicipio INIT SPACE(60)
DATA cEstado INIT SPACE(60)
DATA cCodigo_postal INIT space( 5 )
DATA cPais INIT space( 30 )
DATA cMoneda INIT "PESOS "
DATA nFolio INIT 0
DATA dFecha INIT date()
DATA cCalcula_ret_isr INIT SPACE(1)
DATA cCalcula_ret_iva INIT SPACE(1)
DATA nCod_alumno INIT 0
DATA cNombre_alumno INIT SPACE(100)
DATA cCurp INIT SPACE(30)
DATA cNivel_educativo INIT SPACE(30)
DATA cGrupo INIT SPACE(20)
DATA dFecha_alta INIT DATE()
DATA cTelefono INIT SPACE(30)
DATA nVenta_inicial INIT 0
DATA nVenta_final INIT 0
DATA nImpuesto INIT 0.00
DATA nExento INIT 0.00
DATA nVenta_total INIT 0.00
DATA nDescuento INIT 0.00
DATA nSubtotal INIT 0.00
DATA nIva INIT 0.00
DATA nRedondeo INIT 0.00
DATA nIsr INIT 0.00
DATA nRetencion INIT 0.00
DATA nTotal INIT 0.00
DATA nSemana INIT 0
DATA cCodigo INIT SPACE(15)
DATA cDescripcion INIT SPACE(100)
DATA nPrecio INIT 0.00
DATA nCantidad INIT 1.00
DATA nImporte INIT 0.00
DATA cUnidad_medida INIT PADR( FWString( "PIECES" ) )
DATA cExento INIT "N"
DATA nTipo INIT 0
DATA nPorc_dscto INIT 0.00
DATA nCosto_soporte INIT 0.00
data nFormato INIT val( LeeIniFile("VENTAS_CONTADO", "CUAL_FORMATO", ".\COMPRAS.INI" ) )
METHOD New()
METHOD MakeDialogo()
METHOD MakeGets()
METHOD MakeBrwData()
METHOD MakeSays()
METHOD MakeGets2()
METHOD ChkCod_cte()
METHOD RefreshCliente()
METHOD Funget1()
METHOD Funget17()
METHOD ChkRfc()
METHOD Siguiente()
METHOD PideUnidad_medida()
METHOD ChkCodigo()
METHOD AddItem()
METHOD SumaCols()
METHOD PideCantidad()
METHOD ChkDescuento()
METHOD GuardaDatos()
METHOD AddDetalle()
METHOD ShowFactura()
METHOD Teclas()
METHOD AddProveedor()
ENDCLASS
METHOD New( lEdit , oMain, nFolio,cSerie,cTimbre ) CLASS AbcCompras
local cQry, oQry
::lEdit := lEdit
::oMain := oMain
::cCia := UPPER( LeeIniFile("DATOS_EMPRESA", "NOMBRE1", ".\SYSCTRL.INI" ) )
::cNumero_escuela := UPPER( LeeIniFile("ESCUELA", "NO_ESCUELA", ".\sysctrl.INI" ) )
nFactura := nFolio
cSerieX := cSerie
cTimbrado := cTimbre
cGet_unidad_medida := UPPER( LeeIniFile("CONFIG", "GET_UNIDAD_MEDIDA", ".\SYSCTRL.INI" ) )
nPorc_ret_isr := val( LeeIniFile("DATOS_EMPRESA", "PORC_RET_ISR", ".\SYSCTRL.INI" ) )
nPorc_ret_iva := val( LeeIniFile("DATOS_EMPRESA", "PORC_RET_IVA", ".\SYSCTRL.INI" ) )
cTomar_costo_soporte := LeeIniFile("CONFIG", "TOMAR_COSTO_SOPORTE", ".\SYSCTRL.INI" )
n15 := val( LeeIniFile("DATOS_EMPRESA", "PORC_IVA", ".\SYSCTRL.INI" ) )
Remaes():CreaArtics( ::oMain:oCon )
::MakeDialogo()
RETURN NIL
METHOD MakeDialogo() CLASS AbcCompras
LOCAL oBrush
local oFont
local oBtn := array( 3 )
local oSelf := Self
if ::lEdit //nuevo cfdi
::nFolio := ::Siguiente()
else
::nFolio := nFactura
endif
DEFINE FONT oFont NAME "TAHOMA" SIZE 5,-15
DEFINE BRUSH oBrush Color nRGB( 219, 255, 119) //FILE ".\BMPS\five.bmp"
DEFINE DIALOG ::oBox BRUSH oBrush size 970, 650 FONT oFont //STYLE WS_POPUP
::oBox:lTransparent := .t.
::MakeGets()
@ 15, 30 BUTTON oBtn[1] PROMPT "&" + FWString("Save Data") SIZE 80, 24 OF ::oBox ;
ACTION ( iif( ::GuardaDatos(), ::oBox:End(), ::oBox:setfocus() ) ) //WHEN ::lEdit
@ 15, 45 BUTTON oBtn[2] PROMPT "&" + FWString("Not Save/Exit") SIZE 80, 24 OF ::oBox;
ACTION ( ::oBox:end() ) CANCEL
::oBox:cTitle := FWString("Purchase Invoices")
::oBox:lHelpIcon := .f.
if cTimbrado="S" //solo consulta
oBtn[1]:disable()
endif
ACTIVATE DIALOG ::oBox CENTERED on init ( iif( oSelf:lEdit ,oSelf:oBox:SetFocus(),oSelf:ShowFactura() ) )
RETURN Nil
METHOD GuardaDatos() CLASS AbcCompras
local cQry, oFac, nSeek, oArt
local i
local lExit := .f.
local cSerie := cstr2( UPPER( LeeIniFile("DATOS_EMPRESA", "SERIE_FACTURA", ".\SYSCTRL.INI" ) ) )
if MsgYesNo( FWString("Save data") +" ..?", ::oMain:cUser )
lExit := .t.
::oMain:oCon:BeginTransaction()
if ::lEdit //nuevo cfdi
::nFolio := ::Siguiente()
else
::nFolio := nFactura
endif
* ---------------------- *
* quitamos los eliminados *
for i := 1 to len( aItemsDel )
cQry := "DELETE FROM compras_detalle"
cQry += " WHERE folio=" + C_SIMPLE + cStr2( aItemsDel[i][1] ) + C_SIMPLE
cQry += " AND serie=" + C_SIMPLE + cStr2( aItemsDel[i][2] ) + C_SIMPLE
cQry += " AND item =" + C_SIMPLE + cStr2( aItemsDel[i][3] ) + C_SIMPLE
cQry += " ORDER BY serie,folio,item"
::oMain:oCon:Execute( cQry )
sysrefresh()
NEXT
for i:= 1 to len( oBrw:aArrayData )
cQry := "SELECT catalogo,linea,planta"
cQry += " FROM artics"
cQry += " WHERE catalogo=" + C_SIMPLE + cstr2( oBrw:aArrayData[i][1] ) + C_SIMPLE
cQry += " ORDER BY catalogo"
oArt := ::oMain:oCon:Query( cQry )
cQry := "SELECT serie,folio,item"
cQry += " FROM compras_detalle"
cQry += " WHERE folio=" + C_SIMPLE + cstr2( ::nFolio ) + C_SIMPLE
cQry += " AND serie=" + C_SIMPLE + cStr2( cSerie ) + C_SIMPLE
cQry += " AND item =" + C_SIMPLE + cStr2( i ) + C_SIMPLE
cQry += " ORDER BY serie,folio,item"
oQry := ::oMain:oCon:Query( cQry )
nSeek := oQry:nRecCount
if nSeek = 0
cQry := "INSERT INTO compras_detalle SET "
else
cQry := "UPDATE compras_detalle SET "
endif
cQry += "folio=" + ClipValue2SQL( ::nFolio ) + ","
cQry += "serie=" + ClipValue2SQL( cSerie ) + ","
cQry += "item=" + ClipValue2SQL( i ) + ","
cQry += "codigo=" + ClipValue2SQL( oBrw:aArrayData[i][1] ) + ","
cQry += "cantidad=" + ClipValue2SQL( oBrw:aArrayData[i][2] ) + ","
cQry += "unidad=" + ClipValue2SQL( oBrw:aArrayData[i][3] ) + ","
cQry += "nombre=" + ClipValue2SQL( oBrw:aArrayData[i][4] ) + ","
cQry += "precio_unit=" + ClipValue2SQL( oBrw:aArrayData[i][5] ) + ","
cQry += "importe=" + ClipValue2SQL( oBrw:aArrayData[i][6] ) + ","
cQry += "fecha=" + ClipValue2SQL( ::dFecha ) + ","
cQry += "exento=" + ClipValue2SQL( oBrw:aArrayData[i][7] ) + ","
cQry += "linea=" + ClipValue2SQL( oArt:linea )
if nSeek > 0
cQry += " WHERE folio=" + C_SIMPLE + cstr2( ::nFolio ) + C_SIMPLE
cQry += " AND serie=" + C_SIMPLE + cStr2( cSerie ) + C_SIMPLE
cQry += " AND item =" + C_SIMPLE + cStr2( i ) + C_SIMPLE
cQry += " ORDER by serie,folio,item"
endif
::oMain:oCon:Execute( cQry )
cQry := "INSERT INTO movtos_inventario SET "
cQry += "folio=" + ClipValue2SQL( ::nFolio ) + ","
cQry += "anio=" + ClipValue2SQL( year( date() ) ) + ","
cQry += "codigo=" + ClipValue2SQL( oBrw:aArrayData[i][1] ) + ","
cCodigo := oBrw:aArrayData[i][1]
cQry += "clave_fabrica=" + ClipValue2SQL( oArt:planta ) + ","
cQry += "linea=" + ClipValue2SQL( oArt:linea ) + ","
cQry += "descripcion=" + ClipValue2SQL( oBrw:aArrayData[i][4] ) + ","
cQry += "tipo=" + ClipValue2SQL( 1 ) + "," //1=entradas, 2=salidas
cQry += "cantidad=" + ClipValue2SQL( oBrw:aArrayData[i][2] ) + ","
cQry += "costo=" + ClipValue2SQL( oBrw:aArrayData[i][5] ) + ","
cQry += "concepto=" + ClipValue2SQL( "ENTRADAS" ) + ","
cQry += "concepto2=" + ClipValue2SQL( "COMPRAS" ) + ","
cQry += "referencia=" + ClipValue2SQL( cstr2(::nFolio) ) + ","
cQry += "fecha=" + ClipValue2SQL( date() ) + ","
cQry += "usuario=" + ClipValue2SQL( ::oMain:cUser ) + ","
// cQry += "tipo_mov=" + ClipValue2SQL( ::cTipo_mov ) + ","
cQry += "cierre=" + ClipValue2SQL( "N" ) + ","
cQry += "item=" + ClipValue2SQL( i )
::oMain:oCon:Execute( cQry )
//Servidor2013
*Afectamos existencia*
cQry := "UPDATE artics SET "
cQry += "existencia=existencia+" + ClipValue2SQL( oBrw:aArrayData[i][2] ) + ","
cQry += "compras=compras+" + ClipValue2SQL( oBrw:aArrayData[i][2] )
cQry += " WHERE catalogo=" + C_SIMPLE + alltrim( oBrw:aArrayData[i][1] ) + C_SIMPLE
cQry += " ORDER BY catalogo"
::oMain:oCon:Execute( cQry )
oArt:end()
sysrefresh()
next
cQry := "SELECT serie,folio"
cQry += " FROM compras"
cQry += " WHERE folio=" + C_SIMPLE + cstr2( ::nFolio ) + C_SIMPLE
cQry += " AND serie=" + C_SIMPLE + cStr2( cSerie ) + C_SIMPLE
cQry += " ORDER by serie,folio"
oQry := ::oMain:oCon:Query( cQry )
nSeek := oQry:nRecCount
if nSeek = 0
cQry := "INSERT INTO compras SET "
else
cQry := "UPDATE compras SET "
endif
cQry += "folio=" + ClipValue2SQL( ::nFolio ) + ","
cQry += "serie=" + ClipValue2SQL( cSerie ) + ","
cQry += "fecha=" + ClipValue2SQL( ::dFecha ) + ","
cQry += "hora=" + ClipValue2SQL( time() ) + ","
cQry += "forma_pago=" + ClipValue2SQL( "PAGO EN UNA SOLA EXHIBICIÓN" ) + ","
cQry += "cliente=" + ClipValue2SQL( ::cRfc ) + ","
cQry += "nombre=" + ClipValue2SQL( ::cNombre ) + ","
cQry += "calle=" + ClipValue2SQL( ::cCalle ) + ","
cQry += "no_exterior=" + ClipValue2SQL( ::cNo_exterior ) + ","
cQry += "no_interior=" + ClipValue2SQL( ::cNo_Interior ) + ","
cQry += "colonia=" + ClipValue2SQL( ::cColonia ) + ","
cQry += "localidad=" + ClipValue2SQL( ::cLocalidad ) + ","
cQry += "municipio=" + ClipValue2SQL( ::cMunicipio ) + ","
cQry += "estado=" + ClipValue2SQL( ::cEstado ) + ","
cQry += "codigo_postal=" + ClipValue2SQL( ::cCodigo_postal ) + ","
cQry += "pais=" + ClipValue2SQL( ::cPais ) + ","
cQry += "subtotal=" + ClipValue2SQL( ::nSubtotal ) + ","
cQry += "descuento=" + ClipValue2SQL( ::nDescuento ) + ","
cQry += "porc_iva=" + ClipValue2SQL( n15 ) + ","
cQry += "iva=" + ClipValue2SQL( ::nIva ) + ","
cQry += "total=" + ClipValue2SQL( ::nTotal ) + ","
cQry += "moneda=" + ClipValue2SQL( ::cMoneda ) + ","
cQry += "semana=" + ClipValue2SQL( ::nSemana ) + ","
cQry += "venta_inicial=" + ClipValue2SQL( ::nVenta_inicial ) + ","
cQry += "venta_final=" + ClipValue2SQL( ::nVenta_final ) + ","
cQry += "nom_usuario=" + ClipValue2SQL( ::oMain:cUserName ) + ","
cQry += "exento=" + ClipValue2SQL( ::nExento ) + ","
cQry += "redondeo=" + ClipValue2SQL( ::nRedondeo ) + ","
cQry += "impuesto=" + ClipValue2SQL( ::nImpuesto ) + ","
cQry += "usuario=" + ClipValue2SQL( ::oMain:cUser ) + ","
cQry += "cod_cte=" + ClipValue2SQL( ::nCod_cte ) + ","
cQry += "importe_isr=" + ClipValue2SQL( ::nIsr ) + ","
cQry += "importe_ret=" + ClipValue2SQL( ::nRetencion ) + ","
cQry += "timbrado=" + ClipValue2SQL( "N" ) + ","
cQry += "venta_total=" + ClipValue2SQL( ::nVenta_total ) + ","
cQry += "cantidad_descuento=" + ClipValue2SQL( ::nDescuento ) + ","
cQry += "porc_descuento=" + ClipValue2SQL( ::nPorc_dscto )
if nSeek > 0
cQry += " WHERE folio=" + C_SIMPLE + cstr2( ::nFolio ) + C_SIMPLE
cQry += " AND serie=" + C_SIMPLE + cStr2( cSerie ) + C_SIMPLE
cQry += " ORDER by serie,folio"
endif
::oMain:oCon:Execute( cQry )
::AddProveedor()
::oMain:oCon:CommitTransaction()
IF lExit
if ::nFormato=0
//esto es para version spanish
//RemisionCompras():New( ::oCon, ::nFolio )
elseif ::nFormato=2
InvoicePurchase():New( ::oMain:oCon, ::nFolio )
else //tickets
//Ventas1():New( ::oCon, ::nFolio )
endif
endif
endif
RETURN lExit
METHOD AddProveedor() CLASS AbcCompras
local cQry, oQry
cQry := "SELECT cod_cte"
cQry += " FROM proveedores"
cQry += " WHERE cod_cte=" + C_SIMPLE + cstr2( ::nCod_cte ) + C_SIMPLE
cQry += " ORDER BY cod_cte"
oQry := ::oMain:oCon:Query( cQry )
nSeek := oQry:nRecCount
oQry:end()
if nSeek = 0
cQry := "INSERT INTO proveedores SET "
else
cQry := "UPDATE proveedores SET "
endif
cQry += "cod_cte=" + ClipValue2SQL( ::nCod_cte ) + ","
cQry += "cliente=" + ClipValue2SQL( ::cRfc ) + ","
cQry += "nombre=" + ClipValue2SQL( ::cNombre ) + ","
cQry += "calle=" + ClipValue2SQL( ::cCalle ) + ","
cQry += "no_exterior=" + ClipValue2SQL( ::cNo_exterior ) + ","
cQry += "no_interior=" + ClipValue2SQL( ::cNo_Interior ) + ","
cQry += "colonia=" + ClipValue2SQL( ::cColonia ) + ","
cQry += "localidad=" + ClipValue2SQL( ::cLocalidad ) + ","
cQry += "municipio=" + ClipValue2SQL( ::cMunicipio ) + ","
cQry += "estado=" + ClipValue2SQL( ::cEstado ) + ","
cQry += "codigo_postal=" + ClipValue2SQL( ::cCodigo_postal ) + ","
cQry += "pais=" + ClipValue2SQL( ::cPais ) + ","
if nSeek = 0
cQry += "fecha_alta=" + ClipValue2SQL( ::dFecha ) + ","
endif
cQry += "borrado=" + ClipValue2SQL( "N" )
IF nSeek > 0
cQry += " WHERE cod_cte=" + C_SIMPLE + cstr2( ::nCod_cte ) + C_SIMPLE
endif
::oMain:oCon:Execute( cQry )
RETURN NIL
METHOD Siguiente() CLASS AbcCompras
local nFolio
local oQry := ::oMain:oCon:Query( "SELECT folio FROM compras ORDER BY folio")
oQry:Gobottom()
nFolio := oQry:folio+1
RETURN nFolio
METHOD MakeGets() CLASS AbcCompras
local nRow := 10
local nCol := 10
local nSt := 15
local nSalto := 12
oGet := array(20)
oSay := array(10)
@ nRow, nCol SAY "* [ F2.sel. ]"+ FWString("Provider Code") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 1 ] VAR ::nCod_cte of ::oBox ;
SIZE 60, 10 PICTURE "9999999" PIXEL ;
valid ::ChkCod_cte()
oGet[1]:bKeyDown := { | nKey | ::FunGet1( nKey ) }
nCol += nSt*5
@ nRow, nCol SAY "* " + FWString("TAX ID") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 2 ] VAR ::cRfc of ::oBox ;
SIZE 60, 10 PICTURE "@!K" PIXEL valid ::ChkRfc()
nCol += nSt*5
@ nRow, nCol SAY "*" + FWString("Company/Name") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 3 ] VAR ::cNombre of ::oBox ;
SIZE 194, 10 PICTURE "@K!" PIXEL valid !Empty( ::cNombre )
nCol += nSt*5
nRow += nSalto*1.7
nCol := 10
@ nRow, nCol SAY "* " + FWString("Street address") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 4 ] VAR ::cCalle of ::oBox ;
SIZE 200, 10 PICTURE "@!K" PIXEL valid !Empty( ::cCalle)
nCol += nSt*14
@ nRow, nCol SAY "* " + FWString("Number Outside") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 5 ] VAR ::cNo_exterior of ::oBox ;
SIZE 60, 10 PICTURE "@!K" PIXEL
nCol += nSt*5
@ nRow, nCol SAY "* " + FWString("Interior number") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 6 ] VAR ::cNo_Interior of ::oBox ;
SIZE 60, 10 PICTURE "@!K" PIXEL
nCol += nSt*5
nRow += nSalto*1.7
nCol := 10
@ nRow, nCol SAY "* " + FWString("Address") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 7 ] VAR ::cColonia of ::oBox ;
SIZE 120, 10 PICTURE "@!K" PIXEL valid !Empty( ::cColonia )
nCol += nSt*8.1
@ nRow, nCol SAY "* " + FWString("City") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 8 ] VAR ::cLocalidad of ::oBox ;
SIZE 120, 10 PICTURE "@!K" PIXEL
nCol += nSt*8.1
@ nRow, nCol SAY "* " + FWString("Municipality") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 9 ] VAR ::cMunicipio of ::oBox ;
SIZE 102, 10 PICTURE "@!K" PIXEL
nCol += nSt*8.1
nRow += nSalto*1.7
nCol := 10
@ nRow, nCol SAY "* " + FWString("State") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 10 ] VAR ::cEstado of ::oBox ;
SIZE 120, 10 PICTURE "@!K" PIXEL
nCol += nSt*8.1
@ nRow, nCol SAY "* " + FWString("ZIP") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 11 ] VAR ::cCodigo_postal of ::oBox ;
SIZE 60, 10 PICTURE "@!K" PIXEL
nCol += nSt*5
/*@ nRow, nCol SAY "* Venta Inicial" OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 12 ] VAR ::nVenta_inicial of ::oBox ;
SIZE 60, 10 PICTURE "9999999" PIXEL
nCol += nSt*5
@ nRow, nCol SAY "* Venta Final" OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 13 ] VAR ::nVenta_final of ::oBox ;
SIZE 60, 10 PICTURE "9999999" PIXEL VALID ::AddDetalle() // WHEN ::lEdit
nCol += nSt*5*/
nRow += nSalto*1.7
nCol := 10
@ nRow, 10 SAY FWString( "Type of Currency" ) OF ::oBox pixel
@ nRow+10, 10 COMBOBOX oGet[14] VAR ::cMoneda ITEMS AMONEDAS OF ::oBox ;
PIXEL SIZE 60, 200 UPDATE STYLE CBS_DROPDOWNLIST
nCol += nSt*5
@ nRow, nCol SAY "* " + FWString("Order No") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 15 ] VAR ::nFolio of ::oBox ;
SIZE 60, 10 PICTURE "9999999" PIXEL
nCol += nSt*5
//@ nRow, nCol SAY "Semana" OF ::oBox pixel
// @ nRow+10, nCol GET oGet[ 16 ] VAR ::nSemana of ::oBox ;
// SIZE 60, 10 PICTURE "99" PIXEL
// nCol += nSt*5
@ nRow, nCol SAY "* " + FWString("Date") OF ::oBox pixel
@ nRow+10, nCol DTPICKER oGet[17] VAR ::dFecha OF ::oBox SIZE 60, 12 PIXEL
/*@ nRow+10, nCol GET oGet[ 16 ] VAR ::dFecha of ::oBox ;
SIZE 50, 10 PICTURE "d" PIXEL*/
nCol += nSt*5
::MakeGets2()
nRow += nSalto*1.7
nCol := 10
::MakeBrwData( nRow )
::MakeSays()
RETURN NIL
//204652 to 204752, 201045 to 204651
METHOD AddDetalle() CLASS AbcCompras
local cQry,oQry
local oWait
local nAt,i
local nUno15 := 1+ (n15/100)
if ::nVenta_final=0
return .t.
endif
if ! ::lEdit
return .t.
endif
if ! GETASYNCKEY( VK_RETURN)
RETURN .t.
endif
cQry := "SELECT folio,semana"
cQry += " FROM notas"
cQry += " WHERE folio>=" + C_SIMPLE + cStr2( ::nVenta_inicial ) + C_SIMPLE
cQry += " AND folio<=" + C_SIMPLE + cStr2( ::nVenta_final ) + C_SIMPLE
cQry += " ORDER BY folio LIMIT 1"
oQry := ::oMain:oCon:Query( cQry )
IF oQry:nRecCount > 0
::nSemana := oQry:semana
endif
oQry:end()
WAITON( space( 40 ), @oWait )
ASize( oBrw:aArrayData, 0 )
oBrw:refresh()
oBrw:SetFocus()
cQry := "SELECT folio, codigo,cantidad,descripcion,"
cQry += "prec_unit,importe,linea,exento_iva"
cQry += " FROM notas_detalle"
cQry += " WHERE folio>=" + C_SIMPLE + cStr2( ::nVenta_inicial ) + C_SIMPLE
cQry += " AND folio<=" + C_SIMPLE + cStr2( ::nVenta_final ) + C_SIMPLE
cQry += " ORDER BY folio"
oQry := ::oMain:oCon:Query( cQry )
oQry:GoTop()
while ! oQry:Eof()
oWait:say( 1, 1, "Agregando partidas a la factura: " + cStr2( oQry:folio ) )
if !empty( oQry:descripcion )
nAt := ascan( oBrw:aArrayData, {|aT | aT[1]=oQry:codigo } )
if nAt = 0
AADD( oBrw:aArrayData, { oQry:codigo ,;
oQry:cantidad ,;
"PIEZAS" ,;
oQry:descripcion ,;
oQry:prec_unit ,;
oQry:importe ,;
oQry:exento_iva } )
oBrw:refresh()
else
oBrw:aArrayData[nAt][2] += oQry:cantidad
oBrw:aArrayData[nAt][6] += ROUND( oQry:importe, NDEC )
endif
ENDIF
sysrefresh()
oQry:skip()
end
oQry:end()
//if ! "TORMENTA" $ ::cCia
for i := 1 to len( oBrw:aArrayData )
oWait:say( 2, 1, "Reg: " + cStr2( i ) )
if oBrw:aArrayData[i][7]<>"S"
oBrw:aArrayData[i][6] := ROUND( oBrw:aArrayData[i][6]/nUno15, NDEC )
oBrw:aArrayData[i][5] := ROUND( oBrw:aArrayData[i][6]/oBrw:aArrayData[i][2], NDEC )
else
oBrw:aArrayData[i][5] := ROUND( oBrw:aArrayData[i][6]/oBrw:aArrayData[i][2], NDEC )
endif
sysrefresh()
next
//endif
cQry := "SELECT sum(redondeo) FROM notas"
cQry += " WHERE folio>=" + C_SIMPLE + cStr2( ::nVenta_inicial ) + C_SIMPLE
cQry += " AND folio<=" + C_SIMPLE + cStr2( ::nVenta_final ) + C_SIMPLE
cQry += " ORDER BY folio"
oQry := ::oMain:oCon:Query( cQry )
IF oQry:fieldget(1) <> 0
::nRedondeo := oQry:fieldget(1)
AADD( oBrw:aArrayData, { "AJUSTE" ,;
1 ,;
"PIEZAS" ,;
"AJUSTE POR REDONDEO" ,;
oQry:fieldget(1) ,;
oQry:fieldget(1) ,;
"S" } )
endif
oQry:end()
WAITOFF( @oWait )
IF LEN( oBrw:aArrayData ) = 0
AADD( oBrw:aArrayData, { CCODIGO ,;
NCANTIDAD ,;
CUNIDAD ,;
CDESCRIPCION ,;
NPRECIO ,;
NIMPORTE ,;
CEXENTO } )
ENDIF
::SumaCols()
for i := 1 to len( oGet )
if oGet[i] != nil
oGet[i]:refresh()
endif
next
oBrw:refresh()
oBrw:SetFocus()
RETURN .t.
METHOD ShowFactura() CLASS AbcCompras
local cQry,oQry
local oWait
local nAt,i
local nUno15 := 1+ (n15/100)
cQry := "SELECT serie,folio,fecha,semana,cliente,nombre,calle,"
cQry += "no_exterior,no_interior,colonia,localidad,municipio,"
cQry += "estado,codigo_postal,venta_inicial,venta_final,cod_cte,moneda,"
cQry += "cod_alumno,nombre_alumno,curp,nivel_educativo,numero_escuela"
cQry += " FROM compras"
cQry += " WHERE folio=" + C_SIMPLE + cStr2( nFactura ) + C_SIMPLE
cQry += " AND serie=" + C_SIMPLE + cStr2( cSerieX ) + C_SIMPLE
cQry += " ORDER BY folio LIMIT 1"
oQry := ::oMain:oCon:Query( cQry )
::nSemana := oQry:semana
::nCod_cte := oQry:cod_cte
::cRfc := oQry:cliente
::cNombre := oQry:nombre
::cCalle := oQry:calle
::cNo_exterior := oQry:no_exterior
::cNo_interior := oQry:no_interior
::cColonia := oQry:colonia
::cLocalidad := oQry:localidad
::cMunicipio := oQry:municipio
::cEstado := oQry:estado
::cCodigo_postal := oQry:codigo_postal
::nVenta_inicial := oQry:venta_inicial
::nVenta_final := oQry:venta_final
::cMoneda := oQry:moneda
::dFecha := oQry:fecha
::nCod_alumno := oQry:cod_alumno
::cNombre_alumno := oQry:nombre_alumno
::cCurp := oQry:curp
::cNivel_educativo := oQry:nivel_educativo
::cNumero_escuela := oQry:numero_escuela
oQry:end()
for i := 1 to len( oGet )
if oGet[i] != NIL
oGet[i]:Refresh()
endif
next
WAITON( space( 40 ), @oWait )
ASize( oBrw:aArrayData, 0 )
oBrw:refresh()
cQry := "SELECT folio, codigo,cantidad,nombre,"
cQry += "precio_unit,importe,linea,exento,unidad,item"
cQry += " FROM compras_detalle"
cQry += " WHERE folio=" + C_SIMPLE + cStr2( nFactura ) + C_SIMPLE
cQry += " AND serie=" + C_SIMPLE + cStr2( cSeriex ) + C_SIMPLE
cQry += " ORDER BY folio"
oQry := ::oMain:oCon:Query( cQry )
oQry:GoTop()
while ! oQry:Eof()
oWait:say( 1, 1, "Agregando partidas a la factura: " + cStr2( oQry:folio ) )
AADD( oBrw:aArrayData, { oQry:codigo ,;
oQry:cantidad ,;
oQry:unidad ,;
oQry:nombre ,;
oQry:precio_unit ,;
oQry:importe ,;
oQry:exento ,;
oQry:item } )
if "AJUSTE POR REDONDEO" $ oQry:nombre
::nRedondeo := oQry:importe
endif
sysrefresh()
oQry:skip()
end
oQry:end()
WAITOFF( @oWait )
IF LEN( oBrw:aArrayData ) = 0
AADD( oBrw:aArrayData, { CCODIGO ,;
NCANTIDAD ,;
CUNIDAD ,;
CDESCRIPCION ,;
NPRECIO ,;
NIMPORTE ,;
CEXENTO ,;
NRECNO } )
ENDIF
::SumaCols()
for i := 1 to len( oGet )
if oGet[i] != nil
oGet[i]:refresh()
endif
next
oBrw:refresh()
RETURN .t.
method Funget1( nKey, oBox ) class AbcCompras
local cQry, oQry,nSeek,i
if nKey = VK_F2
::nCod_cte := CatalogoProveedores():New( ::oMain:oCon )
cQry := "SELECT cod_cte,cliente,nombre,calle,colonia,localidad,municipio,"
cQry += "estado,pais,codigo_postal,telefono,no_exterior,no_interior,"
cQry += "retencion_isr,retencion_iva,costo_soporte"
cQry += " FROM proveedores"
cQry += " WHERE cod_cte=" + C_SIMPLE + cstr2( ::nCod_cte ) + C_SIMPLE
cQry += " ORDER BY cod_cte"
oQry := ::oMain:oCon:Query( cQry )
nSeek := oQry:nRecCount
if nSeek > 0
::RefreshCliente( oQry )
endif
oQry:end()
ENDIF
RETURN NIL
METHOD ChkCod_cte() CLASS AbcCompras
local cQry, oQry,nSeek,i
cQry := "SELECT cod_cte,cliente,nombre,calle,colonia,localidad,municipio,"
cQry += "estado,pais,codigo_postal,telefono,no_exterior,no_interior,"
cQry += "retencion_isr,retencion_iva,costo_soporte"
cQry += " FROM proveedores"
cQry += " WHERE cod_cte=" + C_SIMPLE + cstr2( ::nCod_cte ) + C_SIMPLE
cQry += " ORDER BY cod_cte"
oQry := ::oMain:oCon:Query( cQry )
nSeek := oQry:nRecCount
if nSeek > 0
::RefreshCliente( oQry )
endif
oQry:end()
RETURN .t.
METHOD ChkRfc() CLASS AbcCompras
local cQry, oQry,nSeek,i
cQry := "SELECT cod_cte,cliente,nombre,calle,colonia,localidad,municipio,"
cQry += "estado,pais,codigo_postal,telefono,no_exterior,no_interior,"
cQry += "retencion_isr,retencion_iva,costo_soporte"
cQry += " FROM proveedores"
cQry += " WHERE cod_cte=" + C_SIMPLE + cstr2( ::nCod_cte ) + C_SIMPLE
cQry += " AND cliente=" + C_SIMPLE + cstr2( ::cRfc ) + C_SIMPLE
cQry += " ORDER BY cliente"
oQry := ::oMain:oCon:Query( cQry )
nSeek := oQry:nRecCount
if nSeek > 0
::nCod_cte := oQry:cod_cte
::RefreshCliente( oQry )
endif
oQry:end()
RETURN .t.
METHOD RefreshCliente( oQry ) CLASS AbcCompras
::cRfc := oQry:cliente
::cNombre := oQry:nombre
::cCalle := oQry:calle
::cNo_exterior := oQry:no_exterior
::cNo_Interior := oQry:no_interior
::cColonia := oQry:colonia
::cLocalidad := oQry:localidad
::cMunicipio := oQry:municipio
::cEstado := oQry:estado
::cCodigo_postal := oQry:codigo_postal
::cPais := "MÉXICO"
::cCalcula_ret_isr := oQry:retencion_isr
::cCalcula_ret_iva := oQry:retencion_iva
::nCosto_soporte := oQry:costo_soporte
for i := 1 to len( oGet )
if oGet[i] != Nil
oGet[i]:Refresh()
endif
next
RETURN NIL
METHOD MakeGets2() CLASS AbcCompras
LOCAL nRow := 230
LOCAL nST := 15
LOCAL nCol := 10
local oBtn
@ nRow, nCol SAY "[F2] " + FWString("Code") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 17 ] VAR ::cCodigo of ::oBox ;
SIZE 60, 12 PICTURE "@!k" PIXEL ;
VALID ::ChkCodigo()
nCol += nSt*4.1
oGet[17]:bKeyDown := { | nKey | ::FunGet17( nKey ) }
@ nRow, nCol SAY FWString("Description") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 18 ] VAR ::cDescripcion of ::oBox ;
SIZE 150, 12 PICTURE "@!k" PIXEL
nCol += nSt*10.3
@ nRow, nCol SAY FWString("Price Unit") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 19 ] VAR ::nPrecio PICTURE "999,999.99999" of ::oBox ;
SIZE 50, 12 PIXEL
nCol += nSt*3.5
@ nRow, nCol SAY FWString("Quantity") OF ::oBox pixel
@ nRow+10, nCol GET oGet[ 20 ] VAR ::nCantidad PICTURE "999,999.999" of ::oBox ;
SIZE 30, 12 PIXEL
nCol += nSt*2.5
@ nRow, nCol BUTTONBMP oBtn OF ::oBox ACTION ::AddItem() ;
BITMAP ".\bmps\yes.bmp" PROMPT "O.K." TEXTRIGHT PIXEL SIZE 40, 20
RETURN NIL
method Funget17( nKey ) class AbcCompras
local cQry, oQry,nSeek,i
if nKey = VK_F2
::cCodigo := BuscaProductos():New( ::oMain:oCon )
cQry := "SELECT catalogo, nombre"
cQry += " FROM artics"
cQry += " WHERE catalogo=" + C_SIMPLE + cstr2( ::cCodigo ) + C_SIMPLE
cQry += " ORDER BY catalogo"
oQry := ::oMain:oCon:Query( cQry )
nSeek := oQry:nRecCount
if nSeek > 0
::cDescripcion := oQry:nombre
endif
oQry:end()
oGet[17]:refresh()
oGet[18]:refresh()
ENDIF
RETURN NIL
METHOD AddItem() CLASS AbcCompras
local i
LOCAL nIva := 0
try
if EMPTY( ATail( aData )[4] )
ASize( aData, Len( oBrw:aArrayData ) - 1 )
endif
CATCH
* ...
end
oBrw:refresh()
::nImporte := Round( ::nPrecio * ::nCantidad , NDEC)
if ::nImporte = 0
::nCantidad := 0
endif
aadd( oBrw:aArrayData, { ::cCodigo,;
::nCantidad ,;
::cUnidad_medida,;
::cDescripcion ,;
::nPrecio ,;
::nImporte,;
::cExento, 0 } )
//oBrw:MakeTotals()
oBrw:GoDown()
oBrw:refresh()
::cCodigo := space( 15 )
::cDescripcion := space( 60 )
::nCantidad := 1
::nPrecio := 0
::nImporte := 0
::cExento := ""
for i := 1 to len( oGet )
if oGet[i] != nil
oGet[i]:refresh()
endif
next
::SumaCols()
oGet[17]:SetFocus()
RETURN .t.
METHOD SumaCols() CLASS AbcCompras
local i
nTot1 := 0
nTot2 := 0
for i:= 1 to len( oBrw:aArrayData )
if oBrw:aArrayData[i][7] = "S"
nTot1 += Round( oBrw:aArrayData[i][6] ,NDEC)
ELSE
nTot2 += Round( (oBrw:aArrayData[i][6]) ,NDEC)
ENDIF
next
::nExento := nTot1
::nImpuesto := nTot2
::nVenta_total := ROUND( ::nExento + ::nImpuesto, NDEC )
if ::nTipo > 0
::PideCantidad()
::ChkDescuento()
endif
::nSubtotal := ROUND( ::nVenta_total-::nDescuento, NDEC )
::nIva := ROUND( (::nSubtotal-::nExento) * ( N15/100 ), NDEC )
if ::cCalcula_ret_isr = "S"
::nIsr := ROUND( ::nSubtotal * ( nPorc_ret_isr /100 ), NDEC )
ENDIF
if ::cCalcula_ret_iva = "S"
::nRetencion := ROUND( ::nSubtotal * ( nPorc_ret_iva /100 ), 6 )
ENDIF
::nTotal := ROUND( ::nSubtotal+::nIva-::nIsr-::nRetencion, NDEC )
for i := 1 to len( oSay )
if oSay[i] != nil
oSay[i]:Refresh()
endif
next
::nTipo := 0
return nil
METHOD ChkDescuento() CLASS AbcCompras
IF ::nTipo = 1 //por importe
::nDescuento := ROUND( nAmount, NDEC )
::nPorc_dscto := 0
ELSEIF ::nTipo = 2 //por porcentaje
::nDescuento := ROUND( ::nVenta_total*( nAmount/100 ), NDEC )
::nPorc_dscto := nAmount
endif
RETURN NIL
METHOD PideCantidad() CLASS AbcCompras
local cPass := ""
local cSay := iif( ::nTipo=1, "Importe a descontar:", "%Porcentaje a aplicar" )
local nVar := 0
local cPic := iif( ::nTipo=1, "999,999.99", "99.99%")
if _MsgGet( "APLICAR DESCUENTO ?", cSay, @nVar, "hand", cPic, .f. , cPass )
nAmount := nVar
endif
RETURN NIL
METHOD ChkCodigo() CLASS AbcCompras
local cQry, oQry, nSeek
local i
if empty( ::cCodigo )
return .t.
endif
cQry := "SELECT catalogo,nombre,precio_chica,exento_iva,unidad_medida"
cQry += " FROM artics"
cQry += " WHERE catalogo=" + C_SIMPLE + cstr2( ::cCodigo ) + C_SIMPLE
cQry += " ORDER BY catalogo"
oQry := ::oMain:oCon:Query( cQry )
nSeek := oQry:nRecCount
if nSeek > 0
::cDescripcion := oQry:nombre
::nCantidad := 1
::nPrecio := oQry:precio_chica
::cExento := oQry:exento_iva
::cUnidad_medida := oQry:unidad_medida
endif
oQry:end()
if cGet_unidad_medida = "S"
::PideUnidad_medida()
endif
if ! empty( ::cUnidad_medida ) .and. "SERVICIO" $ ::cUnidad_medida ;
.and. UPPER( cTomar_costo_soporte ) = "S"
if ::nCosto_soporte > 0
::nPrecio := ::nCosto_soporte
endif
endif
for i := 17 to 20
oGet[i]:Refresh()
next
if empty( ::cUnidad_medida )
::cUnidad_medida := PADR(FWString( "PIECES" ))
//? "::: NO PROCEDE EL PROD. DEBE DE TENER UNIDAD DE MEDIDA ::: "
ENDIF
RETURN .T.
METHOD PideUnidad_medida() CLASS AbcCompras
local oBtn, oGet, oFont
DEFINE FONT oFont NAME "TAHOMA" SIZE 10,-20
DEFINE DIALOG oDlg font oFont
@ 10, 10 SAY "Unidad de medida: " OF oDlg pixel
@ 20, 10 COMBOBOX oGet VAR ::cUnidad_medida ITEMS AMEDIDAS OF oDlg ;
PIXEL SIZE 120, 200 UPDATE STYLE (CBS_DROPDOWN )
oGet:oGet:bValid = { || MsgBeep(), .T. }
@ 50, 30 BUTTON oBtn PROMPT "Aceptar" SIZE 60, 24 OF oDlg ;
ACTION ( oDlg:end() ) PIXEL
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
METHOD MakeSays() CLASS AbcCompras
local nRow := 5
local nSt := 15
local nCol := nST*24.5
local oFont2,oFont3
local nSalto := 12
local cPic := "$999,999.99"
DEFINE FONT oFont2 NAME "TAHOMA" SIZE 10,-20 bold
DEFINE FONT oFont3 NAME "TAHOMA" SIZE 15,-25 bold
@ nRow, nCol SAY FWString("Tax Of")+": " + transform(n15,"99.99%") ;
OF ::oBox pixel font oFont2
nRow += nSalto
@ nRow,nCol SAY oSay[1] PROMPT transform( ::nImpuesto,cPic) ;
OF ::oBox SIZE 100,14 FONT oFont2 PIXEL COLOR CLR_HRED,CLR_YELLOW BORDER
nRow += nSalto*1.5
@ nRow, nCol SAY "+ " + FWString("No Tax") OF ::oBox pixel font oFont2
nRow += nSalto
@ nRow,nCol SAY oSay[2] PROMPT transform( ::nExento,cPic) ;
OF ::oBox SIZE 100,14 FONT oFont2 PIXEL COLOR CLR_HRED,CLR_YELLOW BORDER
nRow += nSalto*1.5
@ nRow, nCol SAY "=Sub. Total 1" OF ::oBox pixel font oFont2
nRow += nSalto
@ nRow,nCol SAY oSay[3] PROMPT transform( ::nVenta_total,cPic) ;
OF ::oBox SIZE 100,14 FONT oFont2 PIXEL COLOR CLR_HBLUE,CLR_YELLOW BORDER
nRow += nSalto*1.5
@ nRow, nCol SAY "- " + FWString("Discount") OF ::oBox pixel font oFont2
nRow += nSalto
@ nRow,nCol SAY oSay[4] PROMPT transform( ::nDescuento,cPic) ;
OF ::oBox SIZE 100,14 FONT oFont2 PIXEL COLOR CLR_HBLUE,CLR_YELLOW BORDER
nRow += nSalto*1.5
@ nRow, nCol SAY "=Subtotal 2" OF ::oBox pixel font oFont2
nRow += nSalto
@ nRow,nCol SAY oSay[5] PROMPT transform( ::nSubtotal,cPic) ;
OF ::oBox SIZE 100,14 FONT oFont2 PIXEL COLOR CLR_HBLUE,CLR_YELLOW BORDER
nRow += nSalto*1.5
@ nRow, nCol SAY "+ " + FWString("Tax") OF ::oBox pixel font oFont2
nRow += nSalto
@ nRow,nCol SAY oSay[6] PROMPT transform( ::nIva,cPic) ;
OF ::oBox SIZE 100,14 FONT oFont2 PIXEL COLOR CLR_GREEN,CLR_YELLOW BORDER
nRow += nSalto*1.5
@ nRow, nCol SAY FWString("Total to pay") OF ::oBox pixel font oFont2 COLOR CLR_HMAGENTA
nRow += nSalto
@ nRow,nCol-10 SAY oSay[10] PROMPT transform( ::nTotal,"$9,999,999.99") ;
OF ::oBox SIZE 150,20 FONT oFont3 PIXEL COLOR CLR_HMAGENTA,CLR_YELLOW BORDER
nRow += nSalto*1.5
RETURN NIL
Method MakeBrwData( nRow ) class AbcCompras
aData := { { CCODIGO,;
NCANTIDAD,;
CUNIDAD,;
CDESCRIPCION ,;
NPRECIO,;
NIMPORTE,;
CEXENTO ,;
NRECNO } }
//if ! ::lEdit
// ::ShowFactura()
//endif
@ nRow+10,10 XBROWSE oBrw SIZE -140,-100 PIXEL OF ::oBox ;
DATASOURCE aData ;
COLUMNS 1, 2, 3, 4,5,6,7,8 ;
HEADERS FWString("Code"),;
FWString("Quantity"),;
FWString("Unit"),;
FWString("Description"),;
FWString("Price"),;
FWString( "Amount" ),;
FWString("Tax"),"Reg." ;
PICTURES "@!k", "999999", "@!k", "@!k","999,999.99999",;
"999,999.99999","@!k","999999" ;
COLSIZES 90, 60, 80,175,90,90,60,60;
CELL LINES FOOTERS NOBORDER //FASTEDIT
// oBrw:bLDblClick := {|| ::PideCantidad(), oBrw:refresh(), oBrw:setfocus() }
oBrw:nStretchCol := STRETCHCOL_LAST
oBrw:lFooter := .t.
// oBrw:aCols[ 3 ]:cFooter := "Cant. PIEZAS ...:"
oBrw:bClrHeader := {|| { nRGB(140, 0, 0), nRGB( 231, 242, 255 ), } }
oBrw:bClrFooter := oBrw:bClrHeader
oBrw:nMarqueeStyle = MARQSTYLE_HIGHLWIN7
oBrw:nDataLines := 2
oBrw:bKeyDown := {|nKey| ::Teclas(nKey) }
oBrw:CreateFromCode()
RETURN NIL
METHOD Teclas( nKey ) CLASS AbcCompras
if nKey = VK_DELETE
MsgBeep()
if oBrw:aArrayData[oBrw:nArrayAt][8] > 0
aadd( aItemsDel, { nFactura,cSeriex, oBrw:aArrayData[oBrw:nArrayAt][8] })
endif
ADel( oBrw:aArrayData, oBrw:nArrayAt )
ASize( oBrw:aArrayData, Len( oBrw:aArrayData ) - 1 )
oBrw:Refresh()
::SumaCols()
ENDIF
RETURN NIL