diff --git a/src/db/migration/V20170628_1636__mantis9233.sql b/src/db/migration/V20170628_1636__mantis9233.sql new file mode 100644 index 000000000..5ee4471d3 --- /dev/null +++ b/src/db/migration/V20170628_1636__mantis9233.sql @@ -0,0 +1,7 @@ +declare + column_exists exception; + pragma exception_init (column_exists , -01430); +begin + execute immediate 'ALTER TABLE OCD ADD(INDPUNTOVENTAESTORNO NUMBER(1,0) DEFAULT 0)'; + exception when column_exists then null; +end; \ No newline at end of file diff --git a/src/db/migration/V20170629_1501__mantis9233.sql b/src/db/migration/V20170629_1501__mantis9233.sql new file mode 100644 index 000000000..0d12156da --- /dev/null +++ b/src/db/migration/V20170629_1501__mantis9233.sql @@ -0,0 +1,39 @@ + + +declare + dup_val_on_index exception; + pragma exception_init (dup_val_on_index , -00001); +begin + execute immediate 'update ocd set INDPUNTOVENTAESTORNO = 1 where ocd_id in(select OCD.OCD_ID FROM + BOLETO B +INNER JOIN OCD OCD +ON + OCD.BOLETO_ID = B.BOLETO_ID +INNER JOIN MARCA M +ON + M.MARCA_ID = B.MARCA_ID +INNER JOIN EMPRESA E +ON + E.EMPRESA_ID = M.EMPRESA_ID +LEFT JOIN OCD_PARAM op +ON + op.EMPRESA_ID = E.EMPRESA_ID +AND op.ACTIVO = 1 +LEFT JOIN OCD_PTOVTA_PARAM opp +ON + opp.OCDPARAM_ID = op.OCDPARAM_ID +AND opp.ACTIVO = 1 +WHERE + OCD.FECINC >= to_date(''01/06/2017'',''dd/MM/yyyy'') +AND + ( + B.PTOVTAVENTA_ID = (select VALORCONSTANTE from CONSTANTE where NOMBCONSTANTE = ''PUNTO_VENTA_J3'') + OR B.PUNTOVENTA_ID = (select VALORCONSTANTE from CONSTANTE where NOMBCONSTANTE = ''PUNTO_VENTA_J3'') + OR + ( + B.PTOVTAVENTA_ID = opp.PUNTOVENTA_ID + OR B.PUNTOVENTA_ID = opp.PUNTOVENTA_ID + ) + ))'; + exception when dup_val_on_index then null; +end;