SET FEEDBACK OFF

--ACTIVOS
DELETE FROM ACT_DETMOV;

DELETE FROM ACT_ETIQ;

DELETE FROM ACT_DETTR;

DELETE FROM ACT_MEJORA;

DELETE FROM ACT_ACTIVO;

DELETE FROM ACT_HISDETMOV;

DELETE FROM ACT_HISMOV;

delete from act_indice;

delete from act_movact;

update act_movconse
  set consecutivo=1;

-------------------------------------------
DELETE FROM ASIENTOCAJA;
-------------------------------------------

--BANCOS

DELETE FROM BANCOBROS;

DELETE FROM BANCON;

DELETE FROM BANESTDET;

DELETE FROM BANEST;

DELETE FROM BANFAC;

DELETE FROM BANHIS;

DELETE FROM BANMOVCHK;

DELETE FROM BANMOVTRS;

DELETE FROM BANMOV;

UPDATE BANMAE 
   SET CONSECUTIVO=1;

--comisiones

DELETE FROM CMSACUAFIL;

delete from cmsacuklm;

delete from cmsadelanto;

delete from cmsaumento;

delete from CMSCLAVESEMP;

delete from cmsjefesdeptos;

delete from cmsklmmes;

delete from cmslabores;

delete from cmsmontos;

delete from cmspreafil;

delete from cmspremes;

delete from cmsrecom;

delete from cmsrecompre;

commit;


--COMPRAS

delete from comdetdistribucion;

delete from comdistribucion;

delete from comlogcxp;

delete from COM_CAMBIOS_ADUANa;

delete from COM_CARGOS_FACTURa;

delete from COM_CARGOS_nacionalizacion;

update com_consecutivo
   set consec_orden=1, 
       consec_solicitud=1, 
       consec_reclamo=1,
       consec_recnac=1,
       consec_nacio=1;

delete from COM_DET_FAC_ORDEN;

delete from COM_DET_FACTURA;

delete from COM_DET_NACIONALIzacion;

delete from COM_DET_ORDEN;

delete from COM_DET_RECIBO;

delete from COM_DET_RECLAMO;

delete from COM_DET_SOLICITUD;

delete from COM_ENC_FAC_ORDEN;

delete from COM_ENC_NACIONALIzacion;


delete from COM_MONTOPROV;

delete from com_enc_factura;

delete from COM_ENC_ORDEN;

delete from COM_ENC_RECLAMO;

delete from COM_ENC_SOLICITUD;

delete from COM_EST_ORDEN;

delete from COM_HIST_DETFAC;

delete from COM_HIST_DETORD;

delete from COM_HIST_DETREC;

delete from COM_HIST_ENCFAC;

delete from COM_HIST_ENCORD;

delete from COM_HIST_ENCREC;

delete from COM_HIST_NACARA;

delete from COM_HIST_DETNAC;

delete from COM_HIST_ENCNAC;

delete from COM_NAC_ARANCEL;

delete from COM_PRORECIBO;

delete from COM_ENC_RECIBO;

--Cxp

DELETE FROM CXP_ASIENTO;

DELETE FROM CXP_CHEQUES;

UPDATE CXP_CON_DOCUMENTO
   SET CONSECUTIVO=1;

DELETE FROM CXP_CREDITO;

DELETE FROM CXP_CREDITO_TMP;

DELETE FROM CXP_DET_DESCU;

DELETE FROM CXP_DET_GEN_PAGO;

DELETE FROM CXP_DET_MOVIMIENTO;

DELETE FROM CXP_DET_MOVIMIENTO_HIST;

DELETE FROM CXP_DET_PAGO_NOTA;

DELETE FROM CXP_DET_PAGO_NOTA_HIST;

DELETE FROM CXP_ENC_GEN_PAGO;

DELETE FROM CXP_ENC_MOVIMIENTO_CON;

DELETE FROM CXP_ENC_MOVIMIENTO_HIST;

DELETE FROM CXP_ENC_PAGO_NOTA_HIST;

DELETE FROM CXP_MOVIMIENTOTMP;

DELETE FROM CXP_OBLIGACION;

DELETE FROM CXP_PAGO_NOTA_CON;

DELETE FROM CXP_ENC_PAGO_NOTA;

DELETE FROM CXP_ENC_MOVIMIENTO;


--Conta

update conconsecdist
set consecutivo=1, 
    temporal=1;

delete from condetdistribucion;

delete from CONDISTRIBUCION;

delete from conresdistribucion;

delete from CON_CONSEC_ASIE;

delete from CON_CONSOLIDA_SALDOS;

delete from CON_DET_ASIENTO;

delete from CON_ENC_ASIENTO;

delete from CON_HIS_DET_ASIENTO;

delete from CON_HIS_ENC_ASIENTO;

delete from CON_HIS_SALDO_CONTA;

delete from CON_PRE;

delete from CON_SALDO_VMONEDA;

delete from CON_TMP_SALDODIST;

--Cobros

delete from CXCDETDISTRIBUCION;

delete from CXCDISTRIBUCION;

delete from CXC_AGE_COBRO;

delete from CXC_ASIENTO;

delete from CXC_AUTORIZACION;

delete from CXC_CHEQUES;

delete from CXC_CLICOMISION;

delete from CXC_CLICOM_COBRO;

delete from CXC_CLIENTE_PERSONA;

update CXC_CON_DOCUMENTO
   set consecutivo=1;

delete from CXC_CREDITO_TMP;

delete from CXC_DEPOSITOS;

delete from CXC_DETAGECXCTMP;

delete from CXC_DET_COMISION;

delete from CXC_DET_PAGO_NOTA;

delete from CXC_DET_PAGO_NOTATMP;

delete from CXC_DET_PAGO_NOTA_HIST;

delete from CXC_DIF_RECIBOS;

delete from CXC_DOCUMENTO_CLIENTE;

delete from CXC_ENCAGECXCTMP;

delete from CXC_ENC_MOVIMIENTO_CON;

delete from CXC_ENC_MOVIMIENTO_HIST;

delete from CXC_ENC_PAGO_NOTATMP;

delete from CXC_ENC_PAGO_NOTA_HIST;

delete from CXC_OBLIGACION;

delete from CXC_ENC_MOVIMIENTO;

delete from CXC_CREDITO;

delete from CXC_OBLIGACIONTMP;

delete from CXC_PAGO_CCSS;

delete from CXC_PAGO_NOTA_CON;

delete from CXC_RECAGENTE;

delete from CXC_ENC_PAGO_NOTA;

delete from CXC_RECAGTMP;

delete from CXC_RECIBOS_AGENTES;

delete from CXC_TRAMITES;

delete from CXC_TRAMITES_PROCESOS;

--estadisticas

delete from estdet;

delete from EST_COMAGENTE;

delete from EST_LINEA_TMP;

delete from EST_PROVEEDOR_TMP;

--precios

DELETE FROM PREC_AUTORIZA;

DELETE FROM PREC_PROVEEDOR;

DELETE FROM PREC_AUTORIZA;

DELETE FROM PREDETCAMBIO;

DELETE FROM PREINCONSCAMBIO;

DELETE FROM PREENCCAMBIO;

DELETE FROM PREESPECIALES;

DELETE FROM PREDETLISTA_HIST;

DELETE FROM PREDETPROMOCION;

DELETE FROM PREPRECIOPRO;

DELETE FROM PREPROMOCION;

DELETE FROM PREDETLISTA;

DELETE FROM PRELISTA;

--FRECUENTE

DELETE FROM FREDESCCOMPRAS;

DELETE FROM FREFACTORES;

DELETE FROM FREMONTOMAXIMO;

DELETE FROM FREPORCENTAJE;

DELETE FROM FREPUNTOS;

--ventas

delete from VENARQUEODET;

delete from VENARQUEO;

delete from VENBLOQUES;

delete from VENCAMION;

delete from VENCARGO;

delete VENZONACATALOGO;

delete VENCLAVECATALOGO;

delete VENADIPROMOCION;

delete VENREQPROMOCION;

delete from VENPROMOCION;

delete VENPREPROMOCION;


delete from VENDETCATALOGO;

delete from VENCATALOGO;

delete from VENCATALOGO;

delete from VENCLASECLI;

delete from VENCLITMP;

update VENCONSECUTIVO
   set documento=1;

delete from VENCONSIGNATARIO
where consignatario!='001';

commit;

DELETE VENBITPEDIDO;

DELETE VENRETPEDIDO;

delete from VENDESCUENTOVOL;

delete from VENDESPACHO;

delete from VENDETALISTO;

delete from VENDETCIERRE;

delete from VENCIERRE;

delete from VENDETDEPOSITO;

delete from VENDETDEVOLUCION;

delete from VENDETFACTURA;

delete from VENDETGUIA;

delete from VENDETNOTA;

delete from VENDETPRESUPUESTO;

delete from VENDETRESERVA;

delete from VENDETPEDIDO;

delete from VENDEVOLUCION;

delete from VENENVIO;

delete from VENEVENTOALISTO;

delete from VENALISTO;

delete from VENEMPLEADO;

delete from VENDEPOSITO;

delete from VENFACTMP;

delete from VENFACTURA;

delete from VENFONDODET;

delete from VENGUIA;

delete from VENLIQVALE;

delete from VENLISTANEGRA;

delete from VENNOTA;

delete from VENPAGODOCUMENTOS;

delete from VENPAGOVALORES;

delete from VENPEDIDO;

delete from VENPREMIOS;

delete from VENPRESUPUESTO;

delete from VENSALSERVICIO;

delete from VENSERVICIO;

delete from VENPAGO;

delete from VENTRANSACCION;

delete from VENVALE;

delete from VENVERALISTO;

commit;


--INVENTAR

DELETE FROM INVTMP;

DELETE FROM INV_ACUM_PERIODO;

DELETE FROM INV_ARTABC_TMP;

DELETE FROM INV_ARTICULOBOD;

DELETE FROM INV_ARTICULO_CON_LOTE;

DELETE FROM INV_ARTIC_CODBAR;

DELETE FROM INV_ARTIC_LOCBOD;

DELETE FROM INV_ARTIC_MEDIDA;

DELETE FROM INV_ARTIC_PROV;

DELETE FROM INV_BODEGA
WHERE COD_BODEGA!='001';

UPDATE INV_CONSEC_MOVTOS
   SET NUM_MOVTO=1;

DELETE FROM INV_DETALLES;

DELETE FROM INV_DETMOVDESP;

DELETE FROM INV_DETMOVIMIENTO;

DELETE FROM INV_DETSOLTRASLADO;

DELETE FROM INV_DETTOMAFIS;

DELETE FROM INV_DIFTOMAFIS;

DELETE FROM INV_DINTOMAFIS;

DELETE FROM INV_ENCABTRASLADO;

DELETE FROM INV_ENCABMOVIMIENTO;

DELETE FROM INV_ENCMOVDESP;

DELETE FROM INV_ENCSOLTRASLADO;

DELETE FROM INV_GRUPODET;

DELETE FROM INV_HIST_DET_MOVTO;

DELETE FROM INV_HIST_ENC_MOVTO;

DELETE FROM INV_HIST_LOTE;

DELETE FROM INV_GRUPO;

DELETE FROM INV_LOC;

DELETE FROM INV_LOTE_ARTIC_BODEGA;

DELETE FROM INV_LOTE;

DELETE FROM INV_MENSUALTMP;

DELETE FROM INV_MOVGRUPODET;

DELETE FROM INV_MOVGRUPO;

DELETE FROM INV_PENMOVIMIENTO;

DELETE FROM INV_SUSTITUTO;

DELETE FROM INV_TABLABONIFIC;

DELETE FROM INV_TABLADESC;

DELETE FROM INV_TMP_CRITERIOS;

DELETE FROM INV_TOMAFIS;

DELETE FROM INV_GRUPO;

DELETE FROM INV_ARTICULO;

commit;


DELETE PLAABOPRE ;

DELETE PLAAGUINALDO ;

DELETE PLAASIENTO ;

DELETE PLAAUSENCIA ;

DELETE PLACATEGORIA ;

DELETE PLACCOSTOEMP ;

DELETE PLACESANTIA ;

DELETE PLACONTROLVAC ;

DELETE PLACTAPLANILLA ;

DELETE PLADEDUCEMP ;

DELETE PLADEDUCCIONES ;

DELETE PLADEFINEVAC ;

DELETE PLADEPARTAMENTO ;

DELETE PLADETDEVEN ;

DELETE PLADETINCAP ;

DELETE PLADETPASIVO ;

DELETE PLADETRENTA ;

DELETE PLADETTURNO ;

DELETE PLADEVENEMP ;

DELETE PLAEMPLEADO ;

DELETE PLAESTADISTICAS ;

DELETE PLAFACTORHORA ;

DELETE PLAFESTIVOS ;

DELETE PLAHISTDEDUCEMP ;

DELETE PLAHISTDETDEVEN ;

DELETE PLAHISTDEVENEMP ;

DELETE PLAHISTPAGO ;

DELETE PLAHISTPAGOEMP ;

DELETE PLAHORARIO ;

DELETE PLAHORASTRAB ;

DELETE PLAINCAPEMP ;

DELETE PLAINCAPACIDAD ;

DELETE PLALABOR ;

DELETE PLALABORESTRAB ;

DELETE PLALIQUIDACION ;

DELETE PLAMARCA ;

DELETE PLAMOVDED ;

DELETE PLAMOVDEV ;

DELETE PLAMOVESTAD ;

DELETE PLAMOVPRO ;

DELETE PLAMOVPROEMP ;

DELETE PLAPAGO ;

DELETE PLAPAGOEMP ;

DELETE PLAPARMONEDA ;

DELETE PLAPARAMETRO ;

DELETE PLAPENSIONEMP ;

DELETE PLAPENSIONES ;

DELETE PLAPERINC ;

DELETE PLAPERVAC ;

DELETE PLAPERIODO ;

DELETE PLAPLANILLA ;

DELETE PLAPOLIZA ;

DELETE PLAPREAVISO ;

DELETE PLAPRESTAMO ;

DELETE PLAPROVEMP ;

DELETE PLAPUESTO ;

DELETE PLARENTA ;

DELETE PLARESUMENSALTMP ;

DELETE PLASALARIO ;

DELETE PLATEF ;

DELETE PLATARIFALABOR ;

DELETE PLATURNO ;

DELETE PLAVACACIONEMP ;

DELETE PLAIDIOMAEMP ;

COMMIT;

--GENERAL

DELETE FROM GENHISTIMP;
DELETE FROM GENIMPBARRAS;
DELETE FROM GEN_AGENTEAUT;
DELETE FROM PREDETCAMBIO;
DELETE FROM GEN_CLIENTE_ACCION;
DELETE FROM GEN_CLIENTE_BITACORA;
DELETE FROM GEN_CLIENTE_CLASIF;
DELETE FROM GEN_CLIENTE_REFERENCIA;
DELETE FROM GEN_CLIE_AGENTE;
DELETE FROM GEN_COM_AGENTE;
DELETE FROM GEN_CONTCLIE;
DELETE FROM GEN_CONTPROV;
DELETE FROM GEN_FUNCIONES;
DELETE FROM GEN_IMP_BARRAS;
DELETE FROM PREINCONSCAMBIO;
DELETE FROM PREENCCAMBIO;
DELETE FROM GEN_PROV_COMISION;
DELETE FROM GEN_SOBREG_CLIENTE;
DELETE FROM GEN_SOBREG_PROVEEDOR;
DELETE FROM GEN_TIPO_CAMBIO;
DELETE FROM GEN_AGENTE;
DELETE FROM GEN_OFICINA
WHERE SUCURSAL !='001';
DELETE FROM GEN_SUCURSAL
WHERE SUCURSAL !='001';

commit;


DELETE FROM GEN_CLIENTE
WHERE COD_CLIENTE NOT IN ('001', '002');
DELETE FROM GEN_PERSONA;
DELETE FROM GEN_PROVEEDOR;

DELETE FROM movimientocaja;
DELETE FROM movimientoVENTA;

DELETE FROM OPERACIONCAJA
where dia not between  to_date('1/11/2005', 'dd/mm/yyyy')
                     and to_date('30/11/2005', 'dd/mm/yyyy');

delete from caja
where cajero!='001';

DELETE FROM BALANCECAJA;

DELETE FROM CAJERO
WHERE CAJERO!='001';

update cajero set usuario=user;

select table_name from user_constraints
where constraint_name='GEN_COMPANIA_INVPARAM_FK';

DELETE FROM VENCONCEPTOVAL WHERE CIA='002';

DELETE FROM CONCEPTOVENTA WHERE CIA='002';
DELETE VENTIPODOC WHERE CIA='002';
DELETE VENPARAMETROS WHERE CIA='002';
DELETE FROM CONCEPTO WHERE CIA='002';

DELETE FROM CON_CUENTA
WHERE COD_CIA='002';

DELETE FROM GEN_PERIODO_RANGO
WHERE COD_CIA='002';

DELETE FROM SEG_GRANT
WHERE COD_CIA='002';

DELETE FROM GEN_PERIODO
WHERE COD_CIA='002';

DELETE FROM GEN_PARAMETRO
WHERE COD_CIA='002';

DELETE FROM CON_PARAMETRO
WHERE COD_CIA='002';

DELETE FROM GEN_SUCURSAL
WHERE COD_CIA='002';

DELETE FROM INV_PARAMETRO
WHERE COD_CIA='002';

DELETE FROM GEN_COMPANIA
WHERE COD_CIA='002';

commit;
