/*==============================================================*/
/* Database name:  Planilla LLOBET                              */
/* DBMS name:      ORACLE Version 7                             */
/* Created on:     08/FEB/2000 7:10:26 AM - CANDY RIVERA        */
/* Ultima modificacion : 12/MAR/2001                             */
/*             ARCHIVO DE REFERENCIAS EXTERNAS                  */
/*==============================================================*/


----------------------------------
---   Referencias a General    ---
----------------------------------

alter table PlaParametro
   add constraint GenCompania_PlaParam_FK foreign key (cia)
      references Gen_Compania (cod_cia)
/

alter table PlaDepartamento
   add constraint GenSucursal_PlaDepart_FK foreign key (cia, sucursal)
      references Gen_Sucursal (cod_cia, sucursal)
/

alter table PlaParMoneda
   add constraint GenMoneda_PlaParMon_FK foreign key (moneda)
      references Gen_Moneda (cod_moneda)
/

---alter table PlaPlanilla
---   add constraint GenMoneda_PlaPlanilla_FK foreign key (moneda)
---      references Gen_Moneda (cod_moneda)
---/


----------------------------------
--- Referencias a Contabilidad ---
----------------------------------

alter table PlaAsiento
   add constraint ConCtaContable_PlaAsie_FK foreign key (cia, cta)
      references con_cuenta (cod_cia, cod_cta)
/

alter table PlaMovDev
   add constraint ConCtaContable_PlaMovDev_FK foreign key (cia, cta)
      references con_cuenta (cod_cia, cod_cta)
/

alter table PlaMovDed
   add constraint ConCtaContable_PlaMovDed_FK foreign key (cia, cta)
      references con_cuenta (cod_cia, cod_cta)
/

alter table PlaMovDed
   add constraint ConCtaContable_PlaMovDedAlt_FK foreign key (cia, ctaalterna)
      references con_cuenta (cod_cia, cod_cta)
/

alter table PlaCtaPlanilla
   add constraint ConCtaContable_PlaCtaPla_FK foreign key (cia, cta)
      references con_cuenta (cod_cia, cod_cta)
/

alter table PlaParMoneda
   add constraint ConCtaContable_PlaParMo_Pla_FK foreign key (cia, ctaPlanilla)
      references con_cuenta (cod_cia, cod_cta)
/

alter table PlaParMoneda
   add constraint ConCtaContable_PlaParMo_Fon_FK foreign key (cia, ctaFondo)
      references con_cuenta (cod_cia, cod_cta)
/



----------------------------------
---    Referencias a Bancos    ---
----------------------------------

alter table PlaParametro
   add constraint BanTip_PlaParam_MovChe_FK foreign key (cia, movBanChe)
      references BanTip (cod_cia, tipo_Mov)
/

alter table PlaParametro
   add constraint BanTip_PlaParam_MovDep_FK foreign key (cia, movBanDep)
      references BanTip (cod_cia, tipo_Mov)
/

alter table PlaPlanilla
   add constraint BanMae_Planilla_FK foreign key (cia, cuenta)
      references BanMae (cod_cia, cuenta)
/

alter table PlaTEF
   add constraint BanBan_TEF_FK foreign key (banco)
      references BanBan(cod_banco)
/

ALTER TABLE PLATEF
 ADD CONSTRAINT BANMAE_PLATEF_FK 
 FOREIGN KEY (CIA, CUENTAEMPRESA) 
 REFERENCES BANMAE (COD_CIA,CUENTA);

----------------------------------
---    Referencias a Rhumanos  ---
----------------------------------
alter table PlaVacacionEmp
   add constraint RhAccionEmp_PlaVacEmp_FK foreign key (cia, accion, numero)
      references RhAccionEmp (cia, accion, numero)
/

alter table PlaIncapEmp
   add constraint RhAccionEmp_PlaIncEmp_FK foreign key (cia, accion, numero)
      references RhAccionEmp (cia, accion, numero)
/

alter table PlaSalario
   add constraint RhAccionEmp_PlaSalario_FK foreign key (cia, accion, numero)
      references RhAccionEmp (cia, accion, numero)
/

alter table PlaLiquidacion
   add constraint RhAccionEmp_PlaLiqui_FK foreign key (cia, accion, numero)
      references RhAccionEmp (cia, accion, numero)
/

ALTER TABLE PLAIDIOMAEMP
 ADD CONSTRAINT RHIDIOMA_IDIOMAEMP_FK FOREIGN KEY (IDIOMA) 
 REFERENCES RHIDIOMA (IDIOMA);

