RetPerARCIBA
unknown
vbscript
a year ago
26 kB
13
Indexable
' *** Interface Impositiva ARCIBA - Agentes de Recaudación Ciudad de Buenos Aires ***
' *** Informa Retenciones y Percepciones de IIBB de CABA ***
' *** Procesa Facturas de Venta y Egresos de Valor ***
' *** Atención: Utiliza los códigos de transacción en lugar de los IDs ***
public path,xcotizacion
set uImpuestosDict = Nothing
sub main
stop
stop
stop
xCamino = GetParametroEjecucion("ArchivosAFIP",self.workspace)
if ShowVisualVarEditor (xFechaDesde, xFechaHasta, "ARCIBA") then
xMonth = Cstr (Month (xFechaHasta))
xAnio = Cstr (Year (xFechaHasta))
if Len (xMonth) = 1 then xMonth = "0" & xMonth
xAnio = mid (xAnio, 3, 2)
xHora = cstr(time)
xHora = replace(xHora,":","")
xHora = replace(xHora,".","")
xHora = replace(xHora,"_","")
xHora = replace(xHora,"-","")
xArchivo = "ARCIBA" & xMonth & xAnio & " - " & xHora & ".Txt"
Path = xCamino & xArchivo
senddebug path
call GenerarRegistros ( xFechaDesde, xFechaHasta )
end if
msgbox "Proceso finalizado"
end sub
function GetImpuestosDict
if uImpuestosDict is nothing then
set uImpuestosDict = NewDic ()
FillImpuestosDict (uImpuestosDict)
end if
set GetImpuestosDict = uImpuestosDict
end function
sub FillImpuestosDict (aDictionary)
call RegistrarObjetoBucket( aDictionary, "200", "")
call RegistrarObjetoBucket( aDictionary, "400", "")
end sub
sub GenerarRegistros(aFechaDesde, aFechaHasta)
set xView = GetView (aFechaDesde, aFechaHasta)
for each xItem in xView.ViewItems
stop
'showview xview
'senddebug "Transaccion a procesar: " & xitem.bo.name
senddebug "Codigo unidad operativa: " & xitem.bo.unidadoperativa.codigo
If xitem.bo.unidadoperativa.codigo ="A.VENTAS" then aTipo="P"
If xitem.bo.unidadoperativa.codigo ="G.PAGOS" then aTipo="R"
call GenerarValoresImpuestos (xItem.BO, aFechaDesde, aFechaHasta,aTipo )
next
end sub
sub GenerarValoresImpuestos (aTransaccion, aFechaDesde, aFechaHasta, aTipo )
for each xImpuesto in aTransaccion.ImpuestosTransaccion
call GenerarValores ( xImpuesto, aFechaDesde, aFechaHasta, aTipo )
next
end sub
sub GenerarValores ( anImpuesto, aFechaDesde, aFechaHasta, aTipo )
if IncluyeClave (GetImpuestosDict, anImpuesto.DefinicionImpuesto.Impuesto.Codigo) Then
call GenerarRegistro ( anImpuesto, aFechaDesde, aFechaHasta, aTipo )
end if
end sub
sub GenerarRegistro ( anImpuesto, aFechaDesde, aFechaHasta, aTipo )
xRegistroStr = ""
if NOT anImpuesto.valor.importe = 0 then
set aImpuesto = anImpuesto.DefinicionImpuesto.Impuesto
set xTransaccion = anImpuesto.Place.Owner
xcotizacion = xTransaccion.cotizacion
Senddebug ("Transaccion - " & xTransaccion.Nombre & " Impuesto: " & aImpuesto.Nombre )
call obtenerTipoOperacion ( xRegistroStr, aTipo)
call obtenerCodigoNorma (xRegistroStr,anImpuesto,aImpuesto,xTransaccion,aTipo)
call obtenerFecha ( xRegistroStr, xTransaccion.FechaActual)
call obtenerTipoComp ( xRegistroStr, classname(xTransaccion))
call obtenerLetra ( xRegistroStr, xTransaccion)
call obtenerNumero ( xRegistroStr, xTransaccion, anImpuesto) 'modif
call obtenerFecha ( xRegistroStr, xTransaccion.FechaActual)
call obtenerBaseImponible ( xRegistroStr, xTransaccion, anImpuesto, aTipo)'call obtenerImporte ( xRegistroStr, xTransaccion, anImpuesto, aTipo) 'modif
call obtenerNroCertPropio ( xRegistroStr, xTransaccion, anImpuesto, aTipo)
'Datos del retenido/percibido
call obtenerDocumento ( xRegistroStr, xTransaccion) ''Estan 2 en uno
call obtenerPosIIBB ( xRegistroStr, xTransaccion) ''Estan 2 en uno
call obtenerPosIVA ( xRegistroStr, xTransaccion)
call obtenerRazonSocial ( xRegistroStr, xTransaccion)
xRegistroStr = xRegistroStr & "0000000000000,00"'call obtenerOtrosCon ( xRegistroStr, xTransaccion) 'modif
xRegistroStr = xRegistroStr & "0000000000000,00"'call obtenerIVA ( xRegistroStr, xTransaccion) 'modif
'Calculo de la Retencion/Percepcion
call obtenerBaseImponible ( xRegistroStr, xTransaccion, anImpuesto, aTipo)
base=obtenerBaseImponible2 ( xRegistroStr, xTransaccion, anImpuesto, aTipo)
'senddebug "base: " & base
call obtenerAlicuota ( xRegistroStr, xTransaccion, anImpuesto)
alicuota=obtenerAlicuota2 ( xRegistroStr, xTransaccion, anImpuesto)
' senddebug "alicuota: " & alicuota
call obtenerRetPerc ( xRegistroStr,anImpuesto,base,alicuota)
call obtenerRetPerc ( xRegistroStr,anImpuesto,base,alicuota)
xRegistroStr = xRegistroStr & " "
' SENDDEBUG (LEN(xRegistroStr))
call EscribirTXT( path, xRegistroStr, 1 )
end if
end sub
sub obtenerDocumento ( xRegistroStr, xTransaccion)
set aPersona = xTransaccion.Destinatario.EnteAsociado
xCUITEntero = ""
cuit = aPersona.CUIT
for xI = 1 to Len (cuit)
if ( mid (cuit, xI, 1) <> "-" ) then
xCUITEntero = xCUITEntero & mid (cuit, xI, 1)
end if
next
call LlenarStrConCharIzq ( xCUITEntero, " ", 11)
xRegistroStr = xRegistroStr & "3" & xCUITEntero
end sub
'Hacer
sub obtenerPosIIBB ( xRegistroStr, xTransaccion)
valor = "4"
set xCliente = xTransaccion.Destinatario
if not GetPosicionImpuesto(xCliente, "Ret. IIBB Capital Federal") is nothing then
codigo = GetPosicionImpuesto( xCliente, "Ret. IIBB Capital Federal").PosicionImpuesto.CODIGO
if codigo = "CL" then valor = "4"
if codigo = "CM" then valor = "4"
end if
'call LlenarStrConCharIzq ( valor, " ", 12)
xRegistroStr = xRegistroStr & valor
set aPersona = xTransaccion.Destinatario.EnteAsociado
xCUITEntero = ""
cuit = aPersona.CUIT
for xI = 1 to Len (cuit)
if ( mid (cuit, xI, 1) <> "-" ) then
xCUITEntero = xCUITEntero & mid (cuit, xI, 1)
end if
next
call LlenarStrConCharIzq ( xCUITEntero, " ", 11)
'nroiibb = xCliente.IngresosBrutos
'for xI = 1 to Len (nroiibb)
' if ( mid (nroiibb, xI, 1) <> "-" and ISNUMERIC(mid(nroiibb, xI, 1))) then
' nroiibb2 = nroiibb2 & mid (nroiibb, xI, 1)
' end if
' next
'call LlenarStrConCharIzq ( nroiibb2, "0", 11)
'do while len(nroiibb2) > 11
' nroiibb2 = left(nroiibb2,len(nroiibb2)-1)
'loop
if valor = 4 then
xRegistroStr = xRegistroStr & "00000000000"
else
xRegistroStr = xRegistroStr & xCUITEntero'nroiibb2
end if
end sub
sub obtenerPosIVA ( xRegistroStr, xTransaccion)
valor = "0"
set xCliente = xTransaccion.Destinatario
if not GetPosicionImpuesto(xCliente, "IVA TASA").PosicionImpuesto is nothing then
codigo = GetPosicionImpuesto( xCliente, "IVA TASA").PosicionImpuesto.CODIGO
if codigo = "RI" then valor = "1"
if codigo = "RN" then valor = "2"
if codigo = "MT" then valor = "4"
if codigo = "CF" then valor = "1"
if codigo = "EX" then valor = "3"
end if
'call LlenarStrConCharIzq ( valor, " ", 12)
xRegistroStr = xRegistroStr & valor
end sub
sub obtenerRazonSocial ( xRegistroStr, xTransaccion)
valor = ""
set aPersona = xTransaccion.Destinatario.EnteAsociado
'aPersona.Nombre=replace(aPersona.Nombre,"Ñ","N")
'aPersona.Nombre=replace(aPersona.Nombre,"ñ","N")
valor = LEFT(replace(aPersona.Nombre,"ñ","n"), 30)
valor = LEFT(replace(valor,"á","a"), 30)
valor = LEFT(replace(valor,"é","e"), 30)
valor = LEFT(replace(valor,"í","i"), 30)
valor = LEFT(replace(valor,"ó","o"), 30)
valor = LEFT(replace(valor,"ú","u"), 30)
call LlenarStrConCharDer ( valor, " ", 30)
xRegistroStr = xRegistroStr & valor
end sub
sub obtenerOtrosCon ( xRegistroStr, xTransaccion)
stop
valor = ""
importe = 0
'valor = Cstr (Importe)
If classname(xTransaccion)= "TRFACTURAVENTA" or classname(xTransaccion)= "TRDEBITOVENTA" then
if xTransaccion.nota="A" then
For each xItem in xTransaccion.totales
'si es A el iva se informa en funcion obtenerIva
if xitem.nombre <> "IVA TASA" then
' SENDDEBUG "DISTINTO A IVA TASA"
importe=importe+xitem.valor2_importe
end if
Next
else
'Si no es A , se informa todo aca y en funcion obtenerIva se informa 0.
For each xItem in xTransaccion.totales
importe=importe+xitem.valor2_importe
Next
end if
else
'Para egresos de valores
For each xItem in xTransaccion.totales
importe=importe+xitem.valor2_importe
Next
end if
valor = Cstr (Importe)
xEntero = GetEnteroFromStr ( valor )
xDecimal = GetDecimalFromStr (valor)
valor = xEntero & "," & xDecimal
call LlenarStrConCharIzq ( valor, "0", 16)
xRegistroStr = xRegistroStr & valor
'senddebug "otros conceptos: " & valor
end sub
sub obtenerIVA ( xRegistroStr, xTransaccion)
importe=0
if classname(xTransaccion) = "TRFACTURAVENTA" or classname(xTransaccion)= "TRDEBITOVENTA" then
if xTransaccion.nota <> "B" then
valor = ""
For each xItem in xTransaccion.totales
if xitem.nombre="IVA TASA" then
importe=importe+xitem.valor2_importe
end if
Next
valor = Cstr (Importe)
xEntero = GetEnteroFromStr ( valor )
xDecimal = GetDecimalFromStr (valor)
valor = xEntero & "," & xDecimal
end if
else
importe=0
end if
valor = Cstr (Importe)
xEntero = GetEnteroFromStr ( valor )
xDecimal = GetDecimalFromStr (valor)
valor = xEntero & "," & xDecimal
'senddebug "IVA: " & valor
call LlenarStrConCharIzq ( valor, "0", 16)
xRegistroStr = xRegistroStr & valor
end sub
sub obtenerBaseImponible ( xRegistroStr, xTransaccion, anImpuesto, aTipo)
valor = ""
if aTipo = "P" then
' senddebug aTipo
Importe = round(xTransaccion.subtotal.Importe,2)
' senddebug "tipo P"
else
Importe = obtenerBaseRetencion(xTransaccion, anImpuesto)
end if
valor = Cstr (Importe)
xEntero = GetEnteroFromStr ( valor )
xDecimal = GetDecimalFromStr (valor)
valor = xEntero & "," & xDecimal
call LlenarStrConCharIzq ( valor, "0", 16)
xRegistroStr = xRegistroStr & valor
end sub
private function obtenerBaseImponible2 ( xRegistroStr, xTransaccion, anImpuesto, aTipo)
valor = ""
importe=0
if aTipo = "P" then
' senddebug aTipo
Importe = xTransaccion.subtotal.Importe
' senddebug "tipo P"
else
Importe = obtenerBaseRetencion(xTransaccion, anImpuesto)
end if
obtenerBaseImponible2=importe
end function
function obtenerBaseRetencion(xTransaccion, anImpuesto)
valor = 0
set xView = NewCompoundView( Self, "IMPUESTORETENCION", Self.Workspace, nothing, False )
xView.AddFilter (NewFilterSpec( xView.ColumnFromPath ("TRANSACCION"), "=",xTransaccion ))
xView.AddFilter (NewFilterSpec( xView.ColumnFromPath ("CODIGO_IMPUESTO"), "=", anImpuesto.DefinicionImpuesto.Impuesto.Codigo ))
for each xItem in xView.ViewItems
valor = xItem.BO.neto_gravado
exit for
next
obtenerBaseRetencion = valor
end function
sub obtenerAlicuota ( xRegistroStr, xTransaccion, anImpuesto)
valor = ""
Importe =ROUND( anImpuesto.Coeficiente,2)
if Importe = 0 then
Importe = buscarCoeficiente(xTransaccion, anImpuesto)
end if
valor = Cstr (Importe)
'senddebug "ALICUOTA " & valor
xEntero = GetEnteroFromStr ( valor )
xDecimal = GetDecimalFromStr (valor)
valor = xEntero & "," & xDecimal
call LlenarStrConCharIzq ( valor, "0", 5)
xRegistroStr = xRegistroStr & valor
end sub
private function obtenerAlicuota2 ( xRegistroStr, xTransaccion, anImpuesto)
valor = ""
Importe =ROUND( anImpuesto.Coeficiente,2)
if Importe = 0 then
Importe = buscarCoeficiente(xTransaccion, anImpuesto)
end if
'senddebug "ALICUOTA " & valor
obtenerAlicuota2=importe
end function
REM ''''''''''''''
'senddebug "entro a obtenerRetPerc"
sub obtenerRetPerc ( xRegistroStr,anImpuesto,base,alicuota)
senddebug "obtenerRetPerc"
valor = ""
senddebug "base: " & base & "*" & "alicuota: " & alicuota
importe = round(anImpuesto.Valor.Importe,2)
importe = importe * xcotizacion
xNro=base * alicuota/100
xDecimales=2
xRound = round(xNro,xDecimales)
if round((xRound + 0.005),4) = round(xNro,4) then
senddebug "funcion de redondear"
xRound = xRound + 0.01
importe=round(xround,2)
end if
valor = Cstr (Importe)
xEntero = GetEnteroFromStr ( valor )
xDecimal = GetDecimalFromStr (valor)
senddebug "decimal retencion: " & xdecimal
valor = xEntero & "," & xDecimal
call LlenarStrConCharIzq ( valor, "0", 16)
xRegistroStr = xRegistroStr & valor
end sub
sub obtenerNroCertPropio ( xRegistroStr, xTransaccion, anImpuesto, aTipo)
aNumero = ""
if aTipo = "R" then aNumero = anImpuesto.NumeroImpuesto
call LlenarStrConCharDer ( aNumero, " ", 16)
xRegistroStr = xRegistroStr & aNumero
end sub
sub obtenerImporte ( xRegistroStr, xTransaccion, anImpuesto, aTipo)
Importe = 0
impuesto=0
if classname(xTransaccion)="TRFACTURAVENTA" or classname(xTransaccion)="TRDEBITOVENTA" then
Importe = ROUND(xTransaccion.Total.Importe,2)
xImporteStr = Cstr (Importe)
xEntero = GetEnteroFromStr ( xImporteStr )
xDecimal = GetDecimalFromStr (xImporteStr)
xImporteStr = xEntero & "," & xDecimal
call LlenarStrConCharIzq ( xImporteStr, "0", 16)
else
valor = 0
xtotal=0
sumaimpuestos=0
set xView = NewCompoundView( Self, "IMPUESTORETENCION", Self.Workspace, nothing, False )
xView.AddFilter (NewFilterSpec( xView.ColumnFromPath ("TRANSACCION"), "=",xTransaccion ))
xView.AddFilter (NewFilterSpec( xView.ColumnFromPath ("CODIGO_IMPUESTO"), "=", anImpuesto.DefinicionImpuesto.Impuesto.Codigo ))
for each xItem in xView.ViewItems
valor = xItem.BO.neto_gravado
senddebug "valor neto: " & valor
exit for
next
For each xItem in xTransaccion.totales
sumaimpuestos=sumaimpuestos+xitem.valor2_importe
Next
' senddebug "impuestos: " & sumaimpuestos
importe=round(valor,2)+ round(sumaimpuestos,2)
importe=round(importe,2)
xImporteStr = Cstr (Importe)
xEntero = GetEnteroFromStr ( xImporteStr )
xDecimal = GetDecimalFromStr (xImporteStr)
xImporteStr = xEntero & "," & xDecimal
call LlenarStrConCharIzq ( xImporteStr, "0", 16)
end if
xRegistroStr = xRegistroStr & xImporteStr
end sub
function GetEnteroFromStr ( aNroStr )
xEntero = ""
for xI = 1 to Len (aNroStr)
if ( mid (aNroStr, xI, 1) <> "." ) and ( mid (aNroStr, xI, 1) <> "," ) then
xEntero = xEntero & mid (aNroStr, xI, 1)
else
exit for
end if
next
GetEnteroFromStr = xEntero
end function
function GetDecimalFromStr (aNroStr)
xDecimal = ""
xI2 = 0
for xI = 1 to Len ( aNroStr )
if (mid (aNroStr, xI, 1) = ".") or (mid (aNroStr, xI, 1) = ",") then
xDecimal = mid ( aNroStr, xI +1)
end if
next
if Len ( xDecimal ) > 2 then
xDecimal = Round ( cDbl (xDecimal), 2)
else
do while Len ( xDecimal ) < 2
xDecimal = xDecimal & "0"
loop
end if
GetDecimalFromStr = xDecimal
end function
sub obtenerNumero ( xRegistroStr, xTransaccion, anImpuesto)
''15 espacios
aNumero = ""
aNumero2=""
aNumero = xTransaccion.NumeroDocumento
call LlenarStrConCharIzq ( aNumero, "0", 16)
xRegistroStr = xRegistroStr & aNumero
end sub
sub LlenarStrConCharDer ( aString, aChar, MaxSize)
xString = ""
for xI = 1 to MaxSize - Len ( aString )
xString = aChar & xString
next
aString = aString & xString
end sub
sub LlenarStrConCharIzq ( aString, aChar, MaxSize)
xString = ""
for xI = 1 to MaxSize - Len ( aString )
xString = xString & aChar
next
aString = xString & aString
end sub
sub obtenerLetra ( xRegistroStr, xTransaccion)
''1 espacio
aLetra = " "
if classname(xTransaccion) = "TRFACTURAVENTA" then aLetra = xTransaccion.nota
xRegistroStr = xRegistroStr & aLetra
end sub
sub obtenerTipoComp ( xRegistroStr, aTipo)
aCod = " "
if aTipo = "TRFACTURAVENTA" then aCod = "01"
if aTipo = "TRDEBITOVENTA" then aCod = "09"
if aTipo = "TREGRESOVALORES" then aCod = "09"
xRegistroStr = xRegistroStr & aCod
end sub
sub obtenerFecha( xRegistroStr, aFecha)
''10 espacios
dia = day(aFecha)
if len(dia) = 1 then dia = "0" & dia
mes = month(aFecha)
if len(mes) = 1 then mes = "0" & mes
xRegistroStr = xRegistroStr & dia & "/" & mes & "/" & year(aFecha)
end sub
sub obtenerTipoOperacion(xRegistroStr, aTipo)
aOp = " "
if aTipo = "R" then aOP = "1"
if aTipo = "P" then aOP = "2"
xRegistroStr = xRegistroStr & aOp
end sub
sub obtenerCodigoNorma (xRegistroStr,anImpuesto,aImpuesto,xTransaccion,aTipo) 'si alicuota es 4,5% o 6% es alto riesgo (codigo norma 016)
valor = ""
Importe =ROUND( anImpuesto.Coeficiente,2)
if Importe = 0 then
Importe = buscarCoeficiente(xTransaccion, anImpuesto)
end if
valor = Cstr (Importe)
'senddebug "ALICUOTA " & valor
xEntero = GetEnteroFromStr ( valor )
xDecimal = GetDecimalFromStr (valor)
valor = xEntero & "," & xDecimal
senddebug valor
'existe=false
'xPadronSQL = "SELECT FECHAPUBLICACION AS FECHAPUBLICACION, FECHAVIGENCIADESDE AS FECHAVIGENCIADESDE, " & _
'"FECHAVIGENCIAHASTA AS FECHAVIGENCIAHASTA, CUIT AS CUIT, TIPOCONTRINSC AS TIPOCONTRINSC, MARCAALTABAJA AS MARCAALTABAJA, " & _
'"MARCACAMBIOALICUITA AS MARCACAMBIOALICUITA, ALICUOTAPERCEPCION AS ALICUOTAPERCEPCION, ALICUOTARETENCION AS ALICUOTARETENCION, " & _
'"NROGRUPOPERCEPCION AS NROGRUPOPERCEPCION, NROGRUPORETENCION AS NROGRUPORETENCION " & _
'"FROM PADRON_REGIMENES_GENERALES WHERE CUIT = '" & replace(xtransaccion.destinatario.cuit,"-","") & "' " & _
'"ORDER BY FECHAPUBLICACION DESC "
'Set RS_Padron = SelectSQL( xPadronSQL, xtransaccion.WorkSpace )
'For each xRS_Padron in RS_Padron
' senddebug "Está en el padrón"
'existe = true
' 'xRegistroStr = xRegistroStr & "029"
' next
' if atipo="P" then
' xRegistroStr = xRegistroStr & "029"
' end if
' if existe=false and atipo="R" then
' xRegistroStr = xRegistroStr & "008"
' end if
'if existe=true and atipo="R" then
xRegistroStr = xRegistroStr & "029"
'end if
end sub
function obtenerTabla(aTipo)
senddebug "Obteniendo tabla: " & aTipo
if aTipo = "R" then obtenerTabla = "TREGRESOVALORES"
if aTipo = "P" then obtenerTabla = "TRFACTURAVENTA"
'if aTipo = "PND" then obtenerTabla = "TRDEBITOVENTA"
end function
function GetView (aFechaDesde, aFechaHasta)
' senddebug "Obteniendo vista "
set xView = NewCompoundView( self, "TRFACTURAVENTA", Self.Workspace, nil, False )
if xView.ViewItems.IsEmpty then senddebug "La vista está vacía"
xView.AddFilter (NewFilterSpec( xView.ColumnFromPath ("UNIDADOPERATIVA.CODIGO"), "=", "A.VENTAS" ))
if xView.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por código de UO: " &"A.VENTAS"
xView.AddFilter (NewFilterSpec( xView.ColumnFromPath ("TIPOTRANSACCION.CODIGO"), "=","VT03;VENTAS+;RES+;" ))
if xView.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por código de transacción: " & "FDV"
xView.AddFilter (NewFilterSpec( xView.ColumnFromPath ("FECHAACTUAL"), ">=", aFechaDesde ))
if xView.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por fecha desde: " & cstr(aFechaDesde)
xView.AddFilter (NewFilterSpec( xView.ColumnFromPath ("FECHAACTUAL"), "<", aFechaHasta + 1 ))
if xView.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por fecha hasta: " & cstr(aFechaHasta + 1)
xView.AddFilter (NewFilterSpec( xView.ColumnFromPath ("ESTADO"), "=", "C"))
if xView.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por estado cerrado"
xView.AddFilter (NewFilterSpec( xView.ColumnFromPath ("EXTERNAL_ID"), "<>", "ANULADA"))
if xView.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por external id anulado"
set xView2 = NewCompoundView( self, "TRDEBITOVENTA", Self.Workspace, nil, False )
if xView2.ViewItems.IsEmpty then senddebug "La vista está vacía"
xView2.AddFilter (NewFilterSpec( xView2.ColumnFromPath ("UNIDADOPERATIVA.CODIGO"), "=", "A.VENTAS" ))
if xView2.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por código de UO: " &"A.VENTAS"
xView2.AddFilter (NewFilterSpec( xView2.ColumnFromPath ("TIPOTRANSACCION.CODIGO"), "=","VT04;RES+;" ))
if xView2.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por código de transacción: " & "VT04;RES+;"
xView2.AddFilter (NewFilterSpec( xView2.ColumnFromPath ("FECHAACTUAL"), ">=", aFechaDesde ))
if xView2.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por fecha desde: " & cstr(aFechaDesde)
xView2.AddFilter (NewFilterSpec( xView2.ColumnFromPath ("FECHAACTUAL"), "<", aFechaHasta + 1 ))
if xView2.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por fecha hasta: " & cstr(aFechaHasta + 1)
xView2.AddFilter (NewFilterSpec( xView2.ColumnFromPath ("ESTADO"), "=", "C"))
if xView2.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por estado cerrado"
xView2.AddFilter (NewFilterSpec( xView2.ColumnFromPath ("EXTERNAL_ID"), "<>", "ANULADA"))
if xView2.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por external id anulado"
set xView3 = NewCompoundView( self, "TREGRESOVALORES", Self.Workspace, nil, False )
if xView3.ViewItems.IsEmpty then senddebug "La vista está vacía"
xView3.AddFilter (NewFilterSpec( xView3.ColumnFromPath ("UNIDADOPERATIVA.CODIGO"), "=", "G.PAGOS" ))
if xView3.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por código de UO: " &"G.PAGOS"
xView3.AddFilter (NewFilterSpec( xView3.ColumnFromPath ("TIPOTRANSACCION.CODIGO"), "=","TS03" ))
if xView3.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por código de transacción: " & "TS03"
xView3.AddFilter (NewFilterSpec( xView3.ColumnFromPath ("FECHAACTUAL"), ">=", aFechaDesde ))
if xView3.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por fecha desde: " & cstr(aFechaDesde)
xView3.AddFilter (NewFilterSpec( xView3.ColumnFromPath ("FECHAACTUAL"), "<", aFechaHasta + 1 ))
if xView3.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por fecha hasta: " & cstr(aFechaHasta + 1)
xView3.AddFilter (NewFilterSpec( xView3.ColumnFromPath ("ESTADO"), "=", "C"))
if xView3.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por estado cerrado"
xView3.AddFilter (NewFilterSpec( xView3.ColumnFromPath ("EXTERNAL_ID"), "<>", "ANULADA"))
if xView3.ViewItems.IsEmpty then senddebug "La vista está vacía después de filtrar por external id anulado"
set xView.union = xView2
set xView2.union = xView3
'showview xview3 muestra solo edv
' showview xview2 mustra ndv y edv
xView.AddOrderColumn (NewOrderSpec( xView.ColumnFromPath ("FECHAACTUAL"), False ))
set GetView = xview
'showview xview ' muestra todo
End Function
function GetUO ( aCodUO )
'senddebug "Obteniendo unidad operativa: " & aCodUO
set GetUO = ExisteBO( self, "UNIDADOPERATIVA", "CODIGO", aCodUO, nothing, True, False, "=" )
End Function
private function obtenerPath(aFecha, aNombre)
Set ShellApp = CreateObject("Shell.Application")
Set Ret = ShellApp.BrowseForFolder(0, "SELECCIONE UNA CARPETA DESTINO PARA EL ARCHIVO LOG", 16384)
if not ret is nothing then
xMonth = Cstr (month (aFecha))
xAnio = Cstr (Year (aFecha))
if Len (xMonth) = 1 then xMonth = "0" & xMonth
xAnio = mid (xAnio, 3, 2)
aArchivo = aNombre & xMonth & xAnio & ".Txt"
obtenerPath = Ret.Self.Path & chr(92) & aArchivo
end if
end function
private function ShowVisualVarEditor (aFechaDesde, aFechaHasta, aNombre)
set xVisualvar = VisualVarEditor( aNombre )
call AddVarDate( xVisualVar, "FECHADESDE", "Fecha desde", aNombre, now )
call AddVarDate( xVisualVar, "FECHAHASTA", "Fecha Hasta", aNombre, now )
ShowVisualVarEditor = ShowVisualVar( xVisualVar )
aFechaDesde = GetValueVisualVar( xVisualVar, "FECHADESDE", aNombre )
aFechaHasta = GetValueVisualVar( xVisualVar, "FECHAHASTA", aNombre )
aFechaDesde = int(aFechaDesde)
aFechaHasta = int(aFechaHasta)
end function
function buscarCoeficiente(xTransaccion,xImpuesto)
adevolver = 0
set xVista = NewCompoundView( self, "IMPUESTORETENCION", self.Workspace, nothing, false )
xVista.addfilter(NewFilterSpec( xVista.columnfrompath("TRANSACCION"), "=", xTransaccion.id ))
xVista.addfilter(NewFilterSpec( xVista.columnfrompath("NOMBRE_IMPUESTO"), "=", xImpuesto.name ))
for each xitemv in xvista.viewitems
set xitem = xitemv.bo
adevolver = xitem.coeficiente
exit for
next
buscarCoeficiente = adevolver
end functionEditor is loading...
Leave a Comment