lunes, 29 de abril de 2019

Vencimiento caf

fuente1
fuente2

Los caf de factura exenta no tienen vencimiento

forma de de pago Sin Pago cod 21

Resultado de Validacion de Envio de DTE
=======================================

Rut de Empresa Emisora   : xxxxxxxx-7
Rut que Realizo el Envio : xxxxxxxx-9
Identificador de Envio   :   xxxxxxxx
Fecha de Recepcion       : 29/04/2019 13:02:33
Estado del Envio         : EPR - Envio Procesado

Estadisticas del Envio
======================
Tipo DTE  Informados  Rechazos  Reparos  Aceptados
--------------------------------------------------
   110              1         0        1          0
   111              1         0        1          0
   112              1         0        1          0

Detalle de Rechazos y Reparos de DTE
====================================

 Folio       Tipo  Estado
 ------------------------------------------------------------------------------
 11           110   RLV - DTE Aceptado con Reparos Leves
     (HED-1-803) Forma de pago es Sin Pago.Mnt.Tot.en Otra Mon.debe ser cero

 11           111   RLV - DTE Aceptado con Reparos Leves
     (HED-1-803) Forma de pago es Sin Pago.Mnt.Tot.en Otra Mon.debe ser cero

 11           112   RLV - DTE Aceptado con Reparos Leves
     (HED-1-803) Forma de pago es Sin Pago.Mnt.Tot.en Otra Mon.debe ser cero


Solución: Si la Forma de pago exportacion = SIN PAGO; el nodo MntTotOtrMnda es igual a cero(0)


dbcc freeproccache


exec sp_updatestats
aplicar también
dbcc freeproccache


fuente

viernes, 26 de abril de 2019

cantidad folios anulados

--select * from estadistica_caf
 
 
  declare @idcafMin int
  declare @idcafMax int
  declare @inicial bigint
  declare @final bigint
 
  set @idcafMin = 0
  set @idcafMax = 0
  select @idcafMin = MIN(idcaf_activo) from estadistica_caf --group by idcaf_activo order by idcaf_activo desc
  select @idcafMax = MAX(idcaf_activo) from estadistica_caf
  --print @idcafMin
  --print @idcafMAX
 
  declare @idcafExist int
  set @idcafExist = 0
 
  while @idcafMin <= @idcafMax
  begin -- inicio while
 
  set @idcafExist = 0
 
 
  select @idcafExist = idcaf_activo from estadistica_caf where idcaf_activo=@idcafMin
  print @idcafExist
 
  if @idcafExist = 0
  begin
  set @idcafMin = @idcafMin + 1
  print 'continue'
  continue
  end
  else
  begin
 
  select @inicial = inicial  from estadistica_caf where idcaf_activo=@idcafMin
  print @inicial
  select @final = final  from estadistica_caf where idcaf_activo=@idcafMin
  print @final
  --print 'procesar caf'
  end
 
  --end
 
 
 
  --print 'x'
 
  set @idcafMin = @idcafMin + 1
  end -- fin while
 
 
 
 
 
  --while (select COUNT(*) from estadistica_caf) > 0
  --begin
  --continue
  --end

sentencia if-else sql


if @idcafExist = 0
  begin
  set @idcafMin = @idcafMin + 1
  print 'continue'
  continue
  end
  else
  begin
  print 'procesar caf'
  end





fuente

debug sql error

Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.


Tool
Options
Query Execution
Execution time-out: 0

rechazo RA 7 días

SELECT * FROM hist_DTE t1
LEFT JOIN(SELECT MIN(id_aceptacion) AS id,id_DTE FROM aceptaciones_IN WHERE estado='2' GROUP BY id_DTE)t2 ON t1.id_DTE=t2.id_DTE
INNER JOIN comprob_aceptacion_IN t3 ON t2.id=t3.id_comp_acep
WHERE t1.borrado='NO' AND t1.fecha_emision >='2000-01-01'

jueves, 25 de abril de 2019

rcv reclamado

SELECT t1.folio AS [hist_DTE],t2.folio AS [rvc]
FROM hist_DTE t1
LEFT JOIN registro_compra_venta t2 ON t1.tipo_DTE=t2.tipo_dte AND t1.RUT_cliente=t2.rut AND t1.folio=t2.folio
WHERE t1.fecha_emision >= DATEADD(DAY,-x,CAST(GETDATE() AS DATE)) AND t1.fecha_emision <=CAST(GETDATE() AS DATE)
AND t1.estado_SII='Aceptado' AND t1.borrado = 'NO' AND t2.tipo_libro='V'
AND NOT (t2.vta_fecha_reclamo IS NULL OR t2.vta_fecha_reclamo='')

inicializar columna con valor cero sql

ALTER TABLE estadistica_caf ADD anulados INT NOT NULL DEFAULT 0

miércoles, 24 de abril de 2019

folios no empleados query

SELECT t1.folio,t2.id_DTE_anulados
  FROM hist_DTE t1 LEFT JOIN dte_anulados t2 ON t1.id_DTE = t2.id_tabla_hist_DTE
  WHERE t1.tipo_DTE=33 AND t1.borrado = 'NO' AND t2.id_DTE_anulados IS NULL
  and t1.folio between 10329 and 10333
  ORDER BY t1.folio ASC

'Contains' is not a member of 'System.Array'

'Contains' is not a member of 'System.Array'

error
solución:

agregar  Imports System.Linq

lunes, 15 de abril de 2019

deshabilitar adobe acrobat update service

services.msc


seleccionar Adobe Acrobat Update Service
detener servicio
startup type: Disabled



fuente

miércoles, 10 de abril de 2019

obtener dos valor en un mismo registro, sql



SELECT x.valor , y.valor FROM (SELECT valor from configuracion t1 where elem='vcto_folios') as x, (SELECT valor from configuracion t2 where elem='vcto_caf') as y


SELECT T1.valor AS [RUT],T2.valor AS [RS]
FROM configuracion T1 LEFT JOIN configuracion T2 ON T2.elem = 'razon_social'
WHERE T1.elem='rut_empresa'



fuente