From 45bebed787fc6c575c482640cd321755e2afd177 Mon Sep 17 00:00:00 2001 From: thiago Date: Thu, 29 Jun 2017 20:06:17 +0000 Subject: [PATCH] =?UTF-8?q?fixed=20bug=20#9233=20-=20Altera=C3=A7=C3=A3o?= =?UTF-8?q?=20para=20permitir=20que=20relat=C3=B3rio=20de=20cancelamento?= =?UTF-8?q?=20J3=20mostre=20cancelamentos=20feitos=20por=20pontos=20de=20v?= =?UTF-8?q?enda=20configurados=20para=20OCD.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/BD/FlyWay/trunk@70869 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../migration/V20170628_1636__mantis9233.sql | 7 ++++ .../migration/V20170629_1501__mantis9233.sql | 39 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 src/db/migration/V20170628_1636__mantis9233.sql create mode 100644 src/db/migration/V20170629_1501__mantis9233.sql 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;