This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO finanzas_ordencompra | |
SELECT | |
orco_pk_id, orco_fk_cuclapre, orco_fk_prov, orco_fk_fo, | |
(CASE orco_fk_usu | |
WHEN "Alvaro Torres" THEN "15287582" | |
WHEN "Eleinne Ortíz" THEN "12566824" | |
WHEN "Vanessa Viza" THEN "10736574" | |
WHEN "Mónica Salinas" THEN "15090763" | |
WHEN "Mario Cares" THEN "17432116" | |
WHEN "Marcela Valenzuela" THEN "10534153" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO finanzas_detalle_ordencompra | |
SELECT deor_pk_id, deor_fk_orco, deor_fk_prod, deor_cantidad, deor_preciounitario FROM saludcor_adquisiciones.detalleorden; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into finanzas_producto | |
select prod_pk_id, prod_nombre, prod_unidad, "SALUD" from saludcor_adquisiciones.producto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into finanzas_otro_documento_egreso | |
select pag_pk_id, pag_fk_cuclapre, pag_fk_fo, '10534153' as usuario_id, pag_fk_espa, pag_fk_memo, pag_fecha, | |
prov_nombre, pag_total, pag_fecha, pag_detalle, "SALUD", tieg_descripcion | |
from saludcor_adquisiciones.pago | |
inner join saludcor_adquisiciones.tipoegreso on tipoegreso.tieg_pk_id = pago.pag_fk_tieg | |
inner join saludcor_adquisiciones.proveedor on proveedor.prov_pk_id = pago.pag_fk_prov | |
where pag_fk_tieg in (10, 9, 8, 7, 6, 5, 4) and year(pag_fecha) = 2014 and month(pag_fecha) != 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into finanzas_documento_egreso | |
select pag_pk_id, pag_fk_cuclapre, pag_fk_fo, | |
(CASE pag_fk_usuario | |
WHEN "Mónica Salinas" THEN "15090763" | |
WHEN "Marcela Valenzuela" THEN "10534153" | |
WHEN "Tomás Ahumada" THEN "8769776" | |
WHEN "Vaneza Viza" THEN "10736574" | |
ELSE pag_fk_usuario | |
END) as pag_fk_usuario, | |
pag_fk_espa, pag_fk_prov, pagord_fk_orco, pag_fk_memo, pag_numero, pag_fecha, 0, pag_total, pag_detalle, "SALUD", tieg_descripcion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into finanzas_documento_egreso | |
select pag_pk_id, pag_fk_cuclapre, pag_fk_fo, | |
(CASE pag_fk_usuario | |
WHEN "Mónica Salinas" THEN "15090763" | |
WHEN "Marcela Valenzuela" THEN "10534153" | |
WHEN "Tomás Ahumada" THEN "8769776" | |
WHEN "Vaneza Viza" THEN "10736574" | |
WHEN "Vanessa Viza" THEN "10736574" | |
WHEN "Mario Cares" THEN "17432116" | |
END) as pag_fk_usuario, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into finanzas_notacredito | |
SELECT nocre_pk_id, nocre_fk_pag, nocre_numero, nocre_fecha, "" as detalle FROM saludcor_adquisiciones.notacredito |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete from finanzas_detalle_ordencompra; | |
delete from finanzas_documento_tributario; | |
update finanzas_numeros_ordencompra set estado = 0; | |
delete from finanzas_ordencompra; | |
delete from finanzas_otro_documento_tributario; | |
delete from finanzas_producto; | |
delete from finanzas_proveedor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into finanzas_proveedor | |
select *, "SALUD" from saludcor_adquisiciones.proveedor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1) ELIMINAR TODO | |
delete from finanzas_detalle_ordencompra; | |
delete from finanzas_notacredito; | |
delete from finanzas_egreso; | |
delete from finanzas_documento_tributario_detalles; | |
delete from finanzas_documento_tributario; | |
update finanzas_numeros_ordencompra set estado = 0; | |
delete from finanzas_ordencompra; | |
delete from finanzas_otro_documento_tributario; | |
delete from finanzas_producto; |