Sei sulla pagina 1di 657

FUNCTION NuevoExpediente

*-- Averiguar si existen variables gcAno_eje,gcSec_ejec


IF TYPE('gcAno_eje')<>'C' OR EMPTY(gcAno_eje)
RETURN ''
ENDIF
IF TYPE('gcSec_ejec')<>'C' OR EMPTY(gcSec_ejec)
RETURN ''
ENDIF
LOCAL lcAlias, lcID, lcOldReprocess, lnOldArea
lnOldArea = SELECT()
lcAlias = 'EXPEDIENTE'
lcID = ""
lcOldReprocess = SET('REPROCESS')
*-- Lock hasta que el usuario presione Escape
SET REPROCESS TO AUTOMATIC
IF !USED("EJECUTORA")
USE siaf!ejecutora IN 0
ENDIF
SELECT ejecutora
IF SEEK(gcAno_eje+gcSec_ejec, "ejecutora", "sec_ejec")
IF RLOCK()
REPLACE ejecutora.expediente WITH PADL(INT(VAL(ejecutora.expediente)
+1),10,'0')
lcID = ejecutora.expediente
UNLOCK
ENDIF
ENDIF
SELECT (lnOldArea)
SET REPROCESS TO lcOldReprocess
RETURN lcID
ENDFUNC

**__RI_HEADER!@ Do NOT REMOVE or MODIFY this line!!!! @!__RI_HEADER**


procedure RIDELETE
local llRetVal
llRetVal=.t.
IF (ISRLOCKED() and !deleted()) OR !RLOCK()
llRetVal=.F.
ELSE
IF !deleted()
DELETE
IF CURSORGETPROP('BUFFERING') > 1
=TABLEUPDATE()
ENDIF
ENDIF not already deleted
ENDIF
UNLOCK RECORD (RECNO())
llRetVal=pnerror=0
RETURN llRetVal

procedure RIUPDATE
lparameters tcFieldName,tcNewValue,tcCascadeParent
local llRetVal
llRetVal=.t.
IF ISRLOCKED() OR !RLOCK()
llRetVal=.F.
ELSE
IF EVAL(tcFieldName)<>tcNewValue
PRIVATE pcCascadeParent
pcCascadeParent=upper(iif(type("tcCascadeParent")<>"C","",tcCascadeParent))
REPLACE (tcFieldName) WITH tcNewValue
IF CURSORGETPROP('BUFFERING') > 1
=TABLEUPDATE()
ENDIF
ENDIF values don't already match
ENDIF it's locked already, or I was able to lock it
UNLOCK RECORD (RECNO())
llRetVal=pnerror=0
return llRetVal

procedure rierror
parameters tnErrNo,tcMessage,tcCode,tcProgram
local lnErrorRows,lnXX
lnErrorRows=alen(gaErrors,1)
if type('gaErrors[lnErrorRows,1]')<>"L"
dimension gaErrors[lnErrorRows+1,alen(gaErrors,2)]
lnErrorRows=lnErrorRows+1
endif
gaErrors[lnErrorRows,1]=tnErrNo
gaErrors[lnErrorRows,2]=tcMessage
gaErrors[lnErrorRows,3]=tcCode
gaErrors[lnErrorRows,4]=""
lnXX=1
do while !empty(program(lnXX))
gaErrors[lnErrorRows,4]=gaErrors[lnErrorRows,4]+","+;
program(lnXX)
lnXX=lnXX+1
enddo
gaErrors[lnErrorRows,5]=pcParentDBF
gaErrors[lnErrorRows,6]=pnParentRec
gaErrors[lnErrorRows,7]=pcParentID
gaErrors[lnErrorRows,8]=pcParentExpr
gaErrors[lnErrorRows,9]=pcChildDBF
gaErrors[lnErrorRows,10]=pnChildRec
gaErrors[lnErrorRows,11]=pcChildID
gaErrors[lnErrorRows,12]=pcChildExpr
return tnErrNo

PROCEDURE riopen
PARAMETERS tcTable,tcOrder

LOCAL lcCurWkArea,lcNewWkArea,lnInUseSpot,lnOccurs,lnOccurance
lnInUseSpot=0
lnOccurs = OCCURS(UPPER(tcTable)+"*",UPPER(pcRIcursors))
FOR lnOccurance = 1 TO lnOccurs
lnInUseSpot=ATC(tcTable+"*",pcRIcursors,lnOccurance)
IF ISDIGIT(SUBSTR(pcRIcursors,lnInUseSpot-1,1)) OR;
EMPTY(SUBSTR(pcRIcursors,lnInUseSpot-1,1))
EXIT
ENDIF
lnInUseSpot=0
ENDFOR

IF lnInUseSpot=0
lcCurWkArea=select()
SELECT 0
lcNewWkArea=select()
IF NOT EMPTY(tcOrder)
USE (tcTable) AGAIN ORDER (tcOrder) ;
ALIAS ("__ri"+LTRIM(STR(SELECT()))) share
ELSE
USE (tcTable) AGAIN ALIAS ("__ri"+LTRIM(STR(SELECT()))) share
ENDIF
if pnerror=0
pcRIcursors=pcRIcursors+upper(tcTable)+"?"+STR(SELECT(),5)
else
lcNewWkArea=0
endif something bad happened while attempting to open the file
ELSE
lcNewWkArea=val(substr(pcRIcursors,lnInUseSpot+len(tcTable)+1,5))
pcRIcursors = strtran(pcRIcursors,upper(tcTable)+"*"+str(lcNewWkArea,5),;
upper(tcTable)+"?"+str(lcNewWkArea,5))
IF NOT EMPTY(tcOrder)
SET ORDER TO (tcOrder) IN (lcNewWkArea)
ENDIF sent an order
if pnerror<>0
lcNewWkArea=0
endif something bad happened while setting order
ENDIF
RETURN (lcNewWkArea)

PROCEDURE riend
PARAMETERS tlSuccess
local lnXX,lnSpot,lcWorkArea
IF tlSuccess
END TRANSACTION
ELSE
SET DELETED OFF
ROLLBACK
SET DELETED ON
ENDIF
IF EMPTY(pcRIolderror)
ON ERROR
ELSE
ON ERROR &pcRIolderror.
ENDIF
FOR lnXX=1 TO occurs("*",pcRIcursors)
lnSpot=atc("*",pcRIcursors,lnXX)+1
USE IN (VAL(substr(pcRIcursors,lnSpot,5)))
ENDFOR
IF pcOldCompat = "ON"
SET COMPATIBLE ON
ENDIF
IF pcOldDele="OFF"
SET DELETED OFF
ENDIF
IF pcOldExact="ON"
SET EXACT ON
ENDIF
IF pcOldTalk="ON"
SET TALK ON
ENDIF
do case
case empty(pcOldDBC)
set data to
case pcOldDBC<>DBC()
set data to (pcOldDBC)
endcase
RETURN .T.

PROCEDURE rireuse
* rireuse.prg
PARAMETERS tcTableName,tcWkArea
pcRIcursors = strtran(pcRIcursors,upper(tcTableName)+"?"+str(tcWkArea,5),;
upper(tcTableName)+"*"+str(tcWkArea,5))
RETURN .t.

********************************************************************************
** "Referential integrity delete trigger for" act_proy
PROCEDURE __RI_DELETE_act_proy
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY"
lcChildWkArea=riopen("componente","act_proy")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY
pcChildExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("componente",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" act_proy
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_act_proy
** "Referential integrity update trigger for" act_proy
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="ACT_PROY_NOMBRE")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+ACT_PROY
lcOldChildID=oldval("ANO_EJE+ACT_PROY")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+ACT_PROY"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("act_proy_nombre","act_proy")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("act_proy_nombre",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "act_proy_nombre"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="SUB_PROGRAMA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA
lcOldChildID=oldval("ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("sub_programa","sub_prog")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("sub_programa",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "sub_programa"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY"
lcParentID=ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("componente")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO act_proy IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY
pcChildExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("componente",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" act_proy
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" act_proy
PROCEDURE __RI_INSERT_act_proy
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+ACT_PROY
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+ACT_PROY"
lcParentWkArea=riopen("act_proy_nombre","act_proy")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("act_proy_nombre",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA"
lcParentWkArea=riopen("sub_programa","sub_prog")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("sub_programa",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" act_proy
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" act_proy_nombre
PROCEDURE __RI_DELETE_act_proy_nombre
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+ACT_PROY TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+ACT_PROY"
lcChildWkArea=riopen("act_proy","nombre")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+ACT_PROY
pcChildExpr="ANO_EJE+ACT_PROY"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("act_proy",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" act_proy_nombre
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_act_proy_nombre
** "Referential integrity update trigger for" act_proy_nombre
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+ACT_PROY")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+ACT_PROY"
lcParentID=ANO_EJE+ACT_PROY
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("act_proy")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO nombre IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+ACT_PROY
pcChildExpr="ANO_EJE+ACT_PROY"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("act_proy",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" act_proy_nombre
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_area
** "Referential integrity update trigger for" area
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="CENTRO_GASTO")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+CENTRO_GASTO
lcOldChildID=oldval("ANO_EJE+SEC_EJEC+CENTRO_GASTO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+CENTRO_GASTO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("centro_gasto","centro_gas")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("centro_gasto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "centro_gasto"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="DEPENDENCIA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+DEPENDENCIA
lcOldChildID=oldval("ANO_EJE+SEC_EJEC+DEPENDENCIA")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+DEPENDENCIA"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("dependencia","depen")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("dependencia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "dependencia"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="SUB_UNIDAD")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+SUB_UNIDAD
lcOldChildID=oldval("ANO_EJE+SEC_EJEC+SUB_UNIDAD")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+SUB_UNIDAD"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("sub_unidad","sub_unidad")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("sub_unidad",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "sub_unidad"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" area
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" area
PROCEDURE __RI_INSERT_area
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+CENTRO_GASTO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+CENTRO_GASTO"
lcParentWkArea=riopen("centro_gasto","centro_gas")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("centro_gasto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+DEPENDENCIA
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+DEPENDENCIA"
lcParentWkArea=riopen("dependencia","depen")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("dependencia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+SUB_UNIDAD
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+SUB_UNIDAD"
lcParentWkArea=riopen("sub_unidad","sub_unidad")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("sub_unidad",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" area
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" asiento
PROCEDURE __RI_DELETE_asiento
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO"
lcChildWkArea=riopen("asiento_cuenta","asiento")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO
pcChildExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("asiento_cuenta",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" asiento
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_asiento
** "Referential integrity update trigger for" asiento
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="OPERACION_CONTABLE_EJECUTORA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER
lcOldChildID=oldval("ANO_EJE+SEC_EJEC+SECUENCIA_OPER")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("operacion_contable_ejecutora","oper_ctb")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("operacion_contable_ejecutora",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "operacion_contable_ejecutora"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO"
lcParentID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("asiento_cuenta")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO asiento IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO
pcChildExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("asiento_cuenta",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" asiento
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" asiento
PROCEDURE __RI_INSERT_asiento
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER"
lcParentWkArea=riopen("operacion_contable_ejecutora","oper_ctb")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("operacion_contable_ejecutora",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" asiento
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" asiento_cuenta
PROCEDURE __RI_DELETE_asiento_cuenta
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+MAYOR+SUB_CTA
TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+MAYOR+S
UB_CTA"
lcChildWkArea=riopen("asiento_cuenta_banco","asto_cta")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+MAYOR+SUB_C
TA
pcChildExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+MAYOR+SU
B_CTA"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("asiento_cuenta_banco",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" asiento_cuenta
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_asiento_cuenta
** "Referential integrity update trigger for" asiento_cuenta
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="ASIENTO")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO
lcOldChildID=oldval("ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("asiento","asiento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("asiento",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "asiento"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H
+MAYOR+SUB_CTA")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+MAYOR+S
UB_CTA"
lcParentID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+MAYOR+SUB_
CTA
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("asiento_cuenta_banco")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO asto_cta IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()

pcChildID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+MAYOR+SUB_C
TA

pcChildExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+MAYOR+SU
B_CTA"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("asiento_cuenta_banco",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" asiento_cuenta
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" asiento_cuenta
PROCEDURE __RI_INSERT_asiento_cuenta
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO"
lcParentWkArea=riopen("asiento","asiento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("asiento",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" asiento_cuenta
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_asiento_cuenta_banco
** "Referential integrity update trigger for" asiento_cuenta_banco
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="ASIENTO_CUENTA")
SELECT (lcChildWkArea)

lcChildID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+MAYOR+SUB_C
TA

lcOldChildID=oldval("ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+
MAYOR+SUB_CTA")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID

pcChildExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+MAYOR+SU
B_CTA"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("asiento_cuenta","asto_cta")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("asiento_cuenta",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "asiento_cuenta"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" asiento_cuenta_banco
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" asiento_cuenta_banco
PROCEDURE __RI_INSERT_asiento_cuenta_banco
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+MAYOR+SUB_C
TA
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER+TIPO_CTB+NRO_ASIENTO+TIPO_D_H+MAYOR+SU
B_CTA"
lcParentWkArea=riopen("asiento_cuenta","asto_cta")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("asiento_cuenta",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" asiento_cuenta_banco
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" banco
PROCEDURE __RI_DELETE_banco
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE BANCO TO lcParentID,pcParentID
pcParentExpr="BANCO"
lcChildWkArea=riopen("cta_cte","banco")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=BANCO
pcChildExpr="BANCO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("cta_cte",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" banco
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_banco
** "Referential integrity update trigger for" banco
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("BANCO")
pcParentID=lcOldParentID
pcParentExpr="BANCO"
lcParentID=BANCO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("cta_cte")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO banco IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=BANCO
pcChildExpr="BANCO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("cta_cte",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" banco
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_cadena_laboral
** "Referential integrity update trigger for" cadena_laboral
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="CONDICION_LABORAL")
SELECT (lcChildWkArea)
lcChildID=CONDICION_LABORAL
lcOldChildID=oldval("CONDICION_LABORAL")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="CONDICION_LABORAL"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("condicion_laboral","cond_labor")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("condicion_laboral",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "condicion_laboral"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="REGIMEN_LABORAL")
SELECT (lcChildWkArea)
lcChildID=REGIMEN_LABORAL
lcOldChildID=oldval("REGIMEN_LABORAL")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="REGIMEN_LABORAL"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("regimen_laboral","reg_labor")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("regimen_laboral",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "regimen_laboral"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="SITUACION_LABORAL")
SELECT (lcChildWkArea)
lcChildID=SITUACION_LABORAL
lcOldChildID=oldval("SITUACION_LABORAL")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="SITUACION_LABORAL"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("situacion_laboral","sit_labor")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("situacion_laboral",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "situacion_laboral"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" cadena_laboral
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" cadena_laboral
PROCEDURE __RI_INSERT_cadena_laboral
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=CONDICION_LABORAL
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="CONDICION_LABORAL"
lcParentWkArea=riopen("condicion_laboral","cond_labor")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("condicion_laboral",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=REGIMEN_LABORAL
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="REGIMEN_LABORAL"
lcParentWkArea=riopen("regimen_laboral","reg_labor")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("regimen_laboral",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=SITUACION_LABORAL
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="SITUACION_LABORAL"
lcParentWkArea=riopen("situacion_laboral","sit_labor")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("situacion_laboral",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" cadena_laboral
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_calendario_distribuido
** "Referential integrity update trigger for" calendario_distribuido
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="CALENDARIO_X_DISTRIBUIR")
SELECT (lcChildWkArea)

lcChildID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GASTO+GRUPO_G
ASTO+TIPO_PAGO+TIPO_RECURSO

lcOldChildID=oldval("ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GA
STO+GRUPO_GASTO+TIPO_PAGO+TIPO_RECURSO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID

pcChildExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GASTO+GRUP
O_GASTO+TIPO_PAGO+TIPO_RECURSO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("calendario_x_distribuir","dmp_ori")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("calendario_x_distribuir",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "calendario_x_distribuir"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" calendario_distribuido
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" calendario_distribuido
PROCEDURE __RI_INSERT_calendario_distribuido
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GASTO+GRUPO_G
ASTO+TIPO_PAGO+TIPO_RECURSO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GASTO+GRUP
O_GASTO+TIPO_PAGO+TIPO_RECURSO"
lcParentWkArea=riopen("calendario_x_distribuir","dmp_ori")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("calendario_x_distribuir",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" calendario_distribuido
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" calendario_distribuido_cab
PROCEDURE __RI_DELETE_calendario_distribuido_cab
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA"
lcChildWkArea=riopen("calendario_x_distribuir","dmp_cab")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA
pcChildExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("calendario_x_distribuir",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" calendario_distribuido_cab
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_calendario_distribuido_cab
** "Referential integrity update trigger for" calendario_distribuido_cab
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA"
lcParentID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("calendario_x_distribuir")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO dmp_cab IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA
pcChildExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("calendario_x_distribuir",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" calendario_distribuido_cab
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" calendario_x_distribuir
PROCEDURE __RI_DELETE_calendario_x_distribuir
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE
ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GASTO+GRUPO_GASTO+TIPO_
PAGO+TIPO_RECURSO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GASTO+GRU
PO_GASTO+TIPO_PAGO+TIPO_RECURSO"
lcChildWkArea=riopen("calendario_distribuido","dmp_ori")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GASTO+GRUPO_G
ASTO+TIPO_PAGO+TIPO_RECURSO
pcChildExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GASTO+GRUP
O_GASTO+TIPO_PAGO+TIPO_RECURSO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("calendario_distribuido",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" calendario_x_distribuir
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_calendario_x_distribuir
** "Referential integrity update trigger for" calendario_x_distribuir
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="CALENDARIO_DISTRIBUIDO_CAB")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA
lcOldChildID=oldval("ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("calendario_distribuido_cab","dmp_cab")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("calendario_distribuido_cab",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "calendario_distribuido_cab"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_G
ASTO+GRUPO_GASTO+TIPO_PAGO+TIPO_RECURSO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GASTO+GRU
PO_GASTO+TIPO_PAGO+TIPO_RECURSO"
lcParentID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GASTO+GRUPO_
GASTO+TIPO_PAGO+TIPO_RECURSO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("calendario_distribuido")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO dmp_ori IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()

pcChildID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GASTO+GRUPO_G
ASTO+TIPO_PAGO+TIPO_RECURSO

pcChildExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA+FUNCION+PROGRAMA+CATEG_GASTO+GRUP
O_GASTO+TIPO_PAGO+TIPO_RECURSO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("calendario_distribuido",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" calendario_x_distribuir
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" calendario_x_distribuir
PROCEDURE __RI_INSERT_calendario_x_distribuir
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SECUENCIA"
lcParentWkArea=riopen("calendario_distribuido_cab","dmp_cab")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("calendario_distribuido_cab",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" calendario_x_distribuir
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" casilla
PROCEDURE __RI_DELETE_casilla
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE CASILLA TO lcParentID,pcParentID
pcParentExpr="CASILLA"
lcChildWkArea=riopen("casilla_ejec","casilla")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=CASILLA
pcChildExpr="CASILLA"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("casilla_ejec",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" casilla
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_casilla
** "Referential integrity update trigger for" casilla
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("CASILLA")
pcParentID=lcOldParentID
pcParentExpr="CASILLA"
lcParentID=CASILLA
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("casilla_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO casilla IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=CASILLA
pcChildExpr="CASILLA"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("casilla_ejec",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" casilla
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_casilla_ejec
** "Referential integrity update trigger for" casilla_ejec
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="CASILLA")
SELECT (lcChildWkArea)
lcChildID=CASILLA
lcOldChildID=oldval("CASILLA")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="CASILLA"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("casilla","casilla")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("casilla",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "casilla"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" casilla_ejec
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" casilla_ejec
PROCEDURE __RI_INSERT_casilla_ejec
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=CASILLA
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="CASILLA"
lcParentWkArea=riopen("casilla","casilla")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("casilla",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" casilla_ejec
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" categoria_bien
PROCEDURE __RI_DELETE_categoria_bien
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE TIPO_BIEN+CATEGORIA_BIEN TO lcParentID,pcParentID
pcParentExpr="TIPO_BIEN+CATEGORIA_BIEN"
lcChildWkArea=riopen("grupo_bien","categoria")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=TIPO_BIEN+CATEGORIA_BIEN
pcChildExpr="TIPO_BIEN+CATEGORIA_BIEN"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("grupo_bien",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" categoria_bien
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_categoria_bien
** "Referential integrity update trigger for" categoria_bien
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("TIPO_BIEN+CATEGORIA_BIEN")
pcParentID=lcOldParentID
pcParentExpr="TIPO_BIEN+CATEGORIA_BIEN"
lcParentID=TIPO_BIEN+CATEGORIA_BIEN
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("grupo_bien")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO categoria IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=TIPO_BIEN+CATEGORIA_BIEN
pcChildExpr="TIPO_BIEN+CATEGORIA_BIEN"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("grupo_bien",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" categoria_bien
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" categoria_ciiu
PROCEDURE __RI_DELETE_categoria_ciiu
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE TIPO_CIIU+CATEGORIA_CIIU TO lcParentID,pcParentID
pcParentExpr="TIPO_CIIU+CATEGORIA_CIIU"
lcChildWkArea=riopen("grupo_ciiu","categoria")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=TIPO_CIIU+CATEGORIA_CIIU
pcChildExpr="TIPO_CIIU+CATEGORIA_CIIU"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("grupo_ciiu",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" categoria_ciiu
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_categoria_ciiu
** "Referential integrity update trigger for" categoria_ciiu
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="SECCION_CIIU")
SELECT (lcChildWkArea)
lcChildID=TIPO_CIIU
lcOldChildID=oldval("TIPO_CIIU")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="TIPO_CIIU"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("seccion_ciiu","tipo_ciiu")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("seccion_ciiu",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "seccion_ciiu"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("TIPO_CIIU+CATEGORIA_CIIU")
pcParentID=lcOldParentID
pcParentExpr="TIPO_CIIU+CATEGORIA_CIIU"
lcParentID=TIPO_CIIU+CATEGORIA_CIIU
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("grupo_ciiu")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO categoria IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=TIPO_CIIU+CATEGORIA_CIIU
pcChildExpr="TIPO_CIIU+CATEGORIA_CIIU"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("grupo_ciiu",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" categoria_ciiu
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" categoria_ciiu
PROCEDURE __RI_INSERT_categoria_ciiu
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=TIPO_CIIU
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="TIPO_CIIU"
lcParentWkArea=riopen("seccion_ciiu","tipo_ciiu")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("seccion_ciiu",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" categoria_ciiu
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" categoria_gasto
PROCEDURE __RI_DELETE_categoria_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+CATEG_GASTO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+CATEG_GASTO"
lcChildWkArea=riopen("grupo_gasto","categoria")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CATEG_GASTO
pcChildExpr="ANO_EJE+CATEG_GASTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("grupo_gasto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" categoria_gasto
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_categoria_gasto
** "Referential integrity update trigger for" categoria_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+CATEG_GASTO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+CATEG_GASTO"
lcParentID=ANO_EJE+CATEG_GASTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("grupo_gasto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO categoria IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CATEG_GASTO
pcChildExpr="ANO_EJE+CATEG_GASTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("grupo_gasto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" categoria_gasto
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" centro_gasto
PROCEDURE __RI_DELETE_centro_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+CENTRO_GASTO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+CENTRO_GASTO"
lcChildWkArea=riopen("area","centro_gas")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+CENTRO_GASTO
pcChildExpr="ANO_EJE+SEC_EJEC+CENTRO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("area",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" centro_gasto
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_centro_gasto
** "Referential integrity update trigger for" centro_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EJECUTORA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC
lcOldChildID=oldval("ANO_EJE+SEC_EJEC")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("ejecutora","sec_ejec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("ejecutora",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "ejecutora"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+CENTRO_GASTO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+CENTRO_GASTO"
lcParentID=ANO_EJE+SEC_EJEC+CENTRO_GASTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("area")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO centro_gas IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+CENTRO_GASTO
pcChildExpr="ANO_EJE+SEC_EJEC+CENTRO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("area",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" centro_gasto
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" centro_gasto
PROCEDURE __RI_INSERT_centro_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC"
lcParentWkArea=riopen("ejecutora","sec_ejec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("ejecutora",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" centro_gasto
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" ciclo
PROCEDURE __RI_DELETE_ciclo
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE CICLO TO lcParentID,pcParentID
pcParentExpr="CICLO"
lcChildWkArea=riopen("fase","ciclo")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=CICLO
pcChildExpr="CICLO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("fase",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" ciclo
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_ciclo
** "Referential integrity update trigger for" ciclo
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("CICLO")
pcParentID=lcOldParentID
pcParentExpr="CICLO"
lcParentID=CICLO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("fase")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO ciclo IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=CICLO
pcChildExpr="CICLO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("fase",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" ciclo
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_clase_bien
** "Referential integrity update trigger for" clase_bien
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="GRUPO_BIEN")
SELECT (lcChildWkArea)
lcChildID=TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN
lcOldChildID=oldval("TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("grupo_bien","grupo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_bien",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "grupo_bien"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" clase_bien
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" clase_bien
PROCEDURE __RI_INSERT_clase_bien
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN"
lcParentWkArea=riopen("grupo_bien","grupo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_bien",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" clase_bien
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" clase_bien_serv
PROCEDURE __RI_DELETE_clase_bien_serv
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN TO lcParentID,pcParentID
pcParentExpr="TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN"
lcChildWkArea=riopen("familia_bien_serv","clase_bien")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN
pcChildExpr="TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("familia_bien_serv",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" clase_bien_serv
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_clase_bien_serv
** "Referential integrity update trigger for" clase_bien_serv
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="GRUPO_BIEN_SERV")
SELECT (lcChildWkArea)
lcChildID=TIPO_BIEN+GRUPO_BIEN
lcOldChildID=oldval("TIPO_BIEN+GRUPO_BIEN")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="TIPO_BIEN+GRUPO_BIEN"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("grupo_bien_serv","grupo_bien")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_bien_serv",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "grupo_bien_serv"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN")
pcParentID=lcOldParentID
pcParentExpr="TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN"
lcParentID=TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("familia_bien_serv")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO clase_bien IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN
pcChildExpr="TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("familia_bien_serv",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" clase_bien_serv
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" clase_bien_serv
PROCEDURE __RI_INSERT_clase_bien_serv
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=TIPO_BIEN+GRUPO_BIEN
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="TIPO_BIEN+GRUPO_BIEN"
lcParentWkArea=riopen("grupo_bien_serv","grupo_bien")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_bien_serv",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" clase_bien_serv
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" clase_ingreso
PROCEDURE __RI_DELETE_clase_ingreso
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+CLASE_INGRESO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+CLASE_INGRESO"
lcChildWkArea=riopen("tipo_ingreso","clase")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CLASE_INGRESO
pcChildExpr="ANO_EJE+CLASE_INGRESO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("tipo_ingreso",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" clase_ingreso
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_clase_ingreso
** "Referential integrity update trigger for" clase_ingreso
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+CLASE_INGRESO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+CLASE_INGRESO"
lcParentID=ANO_EJE+CLASE_INGRESO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("tipo_ingreso")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO clase IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CLASE_INGRESO
pcChildExpr="ANO_EJE+CLASE_INGRESO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("tipo_ingreso",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" clase_ingreso
********************************************************************************
********************************************************************************
** "Referential integrity delete trigger for" codigo_riesgo
PROCEDURE __RI_DELETE_codigo_riesgo
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE CODIGO_RIESGO TO lcParentID,pcParentID
pcParentExpr="CODIGO_RIESGO"
lcChildWkArea=riopen("situacion_x_codigo_riesgo","cod_riesgo")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=CODIGO_RIESGO
pcChildExpr="CODIGO_RIESGO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("situacion_x_codigo_riesgo",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" codigo_riesgo
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_codigo_riesgo
** "Referential integrity update trigger for" codigo_riesgo
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("CODIGO_RIESGO")
pcParentID=lcOldParentID
pcParentExpr="CODIGO_RIESGO"
lcParentID=CODIGO_RIESGO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("situacion_x_codigo_riesgo")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO cod_riesgo IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=CODIGO_RIESGO
pcChildExpr="CODIGO_RIESGO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("situacion_x_codigo_riesgo",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" codigo_riesgo
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" componente
PROCEDURE __RI_DELETE_componente
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE"
lcChildWkArea=riopen("componente_finalidad","componente")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE
pcChildExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("componente_finalidad",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" componente
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_componente
** "Referential integrity update trigger for" componente
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="ACT_PROY")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY
lcOldChildID=oldval("ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("act_proy","act_proy")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("act_proy",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "act_proy"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="COMPONENTE_NOMBRE")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+COMPONENTE
lcOldChildID=oldval("ANO_EJE+COMPONENTE")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+COMPONENTE"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("componente_nombre","componente")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("componente_nombre",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "componente_nombre"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE"
lcParentID=ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("componente_finalidad")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO componente IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE
pcChildExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("componente_finalidad",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" componente
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" componente
PROCEDURE __RI_INSERT_componente
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY"
lcParentWkArea=riopen("act_proy","act_proy")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("act_proy",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+COMPONENTE
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+COMPONENTE"
lcParentWkArea=riopen("componente_nombre","componente")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("componente_nombre",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" componente
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_componente_finalidad
** "Referential integrity update trigger for" componente_finalidad
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="COMPONENTE")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE
lcOldChildID=oldval("ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("componente","componente")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("componente",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "componente"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="FINALIDAD")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+FINALIDAD
lcOldChildID=oldval("ANO_EJE+FINALIDAD")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+FINALIDAD"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("finalidad","finalidad")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("finalidad",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "finalidad"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" componente_finalidad
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" componente_finalidad
PROCEDURE __RI_INSERT_componente_finalidad
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+FUNCION+PROGRAMA+SUB_PROGRAMA+ACT_PROY+COMPONENTE"
lcParentWkArea=riopen("componente","componente")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("componente",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+FINALIDAD
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+FINALIDAD"
lcParentWkArea=riopen("finalidad","finalidad")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("finalidad",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" componente_finalidad
********************************************************************************
********************************************************************************
** "Referential integrity delete trigger for" componente_nombre
PROCEDURE __RI_DELETE_componente_nombre
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+COMPONENTE TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+COMPONENTE"
lcChildWkArea=riopen("componente","nombre")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+COMPONENTE
pcChildExpr="ANO_EJE+COMPONENTE"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("componente",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" componente_nombre
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_componente_nombre
** "Referential integrity update trigger for" componente_nombre
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+COMPONENTE")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+COMPONENTE"
lcParentID=ANO_EJE+COMPONENTE
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("componente")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO nombre IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+COMPONENTE
pcChildExpr="ANO_EJE+COMPONENTE"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("componente",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" componente_nombre
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" condicion_laboral
PROCEDURE __RI_DELETE_condicion_laboral
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE CONDICION_LABORAL TO lcParentID,pcParentID
pcParentExpr="CONDICION_LABORAL"
lcChildWkArea=riopen("cadena_laboral","cond_labor")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=CONDICION_LABORAL
pcChildExpr="CONDICION_LABORAL"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("cadena_laboral",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" condicion_laboral
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_condicion_laboral
** "Referential integrity update trigger for" condicion_laboral
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="GRUPO_PEA")
SELECT (lcChildWkArea)
lcChildID=GRUPO_PEA
lcOldChildID=oldval("GRUPO_PEA")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="GRUPO_PEA"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("grupo_pea","grupo_pea")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_pea",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "grupo_pea"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("CONDICION_LABORAL")
pcParentID=lcOldParentID
pcParentExpr="CONDICION_LABORAL"
lcParentID=CONDICION_LABORAL
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("cadena_laboral")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO cond_labor IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=CONDICION_LABORAL
pcChildExpr="CONDICION_LABORAL"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("cadena_laboral",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" condicion_laboral
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" condicion_laboral
PROCEDURE __RI_INSERT_condicion_laboral
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=GRUPO_PEA
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="GRUPO_PEA"
lcParentWkArea=riopen("grupo_pea","grupo_pea")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_pea",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" condicion_laboral
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_control_presupuesto
** "Referential integrity update trigger for" control_presupuesto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EJECUTORA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC
lcOldChildID=oldval("ANO_EJE+SEC_EJEC")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("ejecutora","sec_ejec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("ejecutora",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "ejecutora"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" control_presupuesto
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" control_presupuesto
PROCEDURE __RI_INSERT_control_presupuesto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC"
lcParentWkArea=riopen("ejecutora","sec_ejec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("ejecutora",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" control_presupuesto
********************************************************************************
********************************************************************************
** "Referential integrity delete trigger for" convenio_organismo
PROCEDURE __RI_DELETE_convenio_organismo
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ORGANISMO TO lcParentID,pcParentID
pcParentExpr="ORGANISMO"
lcChildWkArea=riopen("convenio_proyecto","organismo")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ORGANISMO
pcChildExpr="ORGANISMO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("convenio_proyecto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" convenio_organismo
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_convenio_organismo
** "Referential integrity update trigger for" convenio_organismo
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ORGANISMO")
pcParentID=lcOldParentID
pcParentExpr="ORGANISMO"
lcParentID=ORGANISMO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("convenio_proyecto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO organismo IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ORGANISMO
pcChildExpr="ORGANISMO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("convenio_proyecto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" convenio_organismo
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" convenio_proyecto
PROCEDURE __RI_DELETE_convenio_proyecto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE PROYECTO TO lcParentID,pcParentID
pcParentExpr="PROYECTO"
lcChildWkArea=riopen("expediente_fase","proyecto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_fase",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE PROYECTO TO lcParentID,pcParentID
pcParentExpr="PROYECTO"
lcChildWkArea=riopen("justificacion","proyecto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("justificacion",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE PROYECTO TO lcParentID,pcParentID
pcParentExpr="PROYECTO"
lcChildWkArea=riopen("proyecto_componente","proyecto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("proyecto_componente",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE PROYECTO TO lcParentID,pcParentID
pcParentExpr="PROYECTO"
lcChildWkArea=riopen("proyecto_grupo_gasto","proyecto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("proyecto_grupo_gasto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE PROYECTO TO lcParentID,pcParentID
pcParentExpr="PROYECTO"
lcChildWkArea=riopen("proyecto_interfase","proyecto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("proyecto_interfase",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE PROYECTO TO lcParentID,pcParentID
pcParentExpr="PROYECTO"
lcChildWkArea=riopen("proyecto_nota","proyecto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("proyecto_nota",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE PROYECTO TO lcParentID,pcParentID
pcParentExpr="PROYECTO"
lcChildWkArea=riopen("proyecto_presupuesto","proyecto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("proyecto_presupuesto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE PROYECTO TO lcParentID,pcParentID
pcParentExpr="PROYECTO"
lcChildWkArea=riopen("proyecto_presupuesto_pad","proyecto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("proyecto_presupuesto_pad",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE PROYECTO TO lcParentID,pcParentID
pcParentExpr="PROYECTO"
lcChildWkArea=riopen("pry_ht_convenio_cab","proyecto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("pry_ht_convenio_cab",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE PROYECTO TO lcParentID,pcParentID
pcParentExpr="PROYECTO"
lcChildWkArea=riopen("pry_ht_informe_cab","proyecto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("pry_ht_informe_cab",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" convenio_proyecto
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_convenio_proyecto
** "Referential integrity update trigger for" convenio_proyecto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="CONVENIO_ORGANISMO")
SELECT (lcChildWkArea)
lcChildID=ORGANISMO
lcOldChildID=oldval("ORGANISMO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ORGANISMO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("convenio_organismo","organismo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("convenio_organismo",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "convenio_organismo"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("PROYECTO")
pcParentID=lcOldParentID
pcParentExpr="PROYECTO"
lcParentID=PROYECTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_fase")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO proyecto IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_fase",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("PROYECTO")
pcParentID=lcOldParentID
pcParentExpr="PROYECTO"
lcParentID=PROYECTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("justificacion")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO proyecto IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("justificacion",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("PROYECTO")
pcParentID=lcOldParentID
pcParentExpr="PROYECTO"
lcParentID=PROYECTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("proyecto_componente")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO proyecto IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("proyecto_componente",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("PROYECTO")
pcParentID=lcOldParentID
pcParentExpr="PROYECTO"
lcParentID=PROYECTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("proyecto_grupo_gasto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO proyecto IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("proyecto_grupo_gasto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("PROYECTO")
pcParentID=lcOldParentID
pcParentExpr="PROYECTO"
lcParentID=PROYECTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("proyecto_interfase")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO proyecto IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("proyecto_interfase",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("PROYECTO")
pcParentID=lcOldParentID
pcParentExpr="PROYECTO"
lcParentID=PROYECTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("proyecto_nota")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO proyecto IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("proyecto_nota",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("PROYECTO")
pcParentID=lcOldParentID
pcParentExpr="PROYECTO"
lcParentID=PROYECTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("proyecto_presupuesto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO proyecto IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("proyecto_presupuesto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("PROYECTO")
pcParentID=lcOldParentID
pcParentExpr="PROYECTO"
lcParentID=PROYECTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("proyecto_presupuesto_pad")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO proyecto IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("proyecto_presupuesto_pad",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("PROYECTO")
pcParentID=lcOldParentID
pcParentExpr="PROYECTO"
lcParentID=PROYECTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("pry_ht_convenio_cab")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO proyecto IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("pry_ht_convenio_cab",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("PROYECTO")
pcParentID=lcOldParentID
pcParentExpr="PROYECTO"
lcParentID=PROYECTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("pry_ht_informe_cab")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO proyecto IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=PROYECTO
pcChildExpr="PROYECTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("pry_ht_informe_cab",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" convenio_proyecto
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" convenio_proyecto
PROCEDURE __RI_INSERT_convenio_proyecto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ORGANISMO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ORGANISMO"
lcParentWkArea=riopen("convenio_organismo","organismo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("convenio_organismo",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" convenio_proyecto
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_cta_cte
** "Referential integrity update trigger for" cta_cte
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT pccascadeparent=="BANCO")
SELECT (lcChildWkArea)
lcChildID=BANCO
lcOldChildID=oldval("BANCO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="BANCO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("banco","banco")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("banco",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "banco"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" cta_cte
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" cta_cte
PROCEDURE __RI_INSERT_cta_cte
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=BANCO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="BANCO"
lcParentWkArea=riopen("banco","banco")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("banco",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" cta_cte
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" departamento
PROCEDURE __RI_DELETE_departamento
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE DEPARTAMENTO TO lcParentID,pcParentID
pcParentExpr="DEPARTAMENTO"
lcChildWkArea=riopen("provincia","departamen")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=DEPARTAMENTO
pcChildExpr="DEPARTAMENTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("provincia",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" departamento
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_departamento
** "Referential integrity update trigger for" departamento
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("DEPARTAMENTO")
pcParentID=lcOldParentID
pcParentExpr="DEPARTAMENTO"
lcParentID=DEPARTAMENTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("provincia")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO departamen IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=DEPARTAMENTO
pcChildExpr="DEPARTAMENTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("provincia",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" departamento
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" dependencia
PROCEDURE __RI_DELETE_dependencia
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+DEPENDENCIA TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+DEPENDENCIA"
lcChildWkArea=riopen("area","depen")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+DEPENDENCIA
pcChildExpr="ANO_EJE+SEC_EJEC+DEPENDENCIA"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("area",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" dependencia
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_dependencia
** "Referential integrity update trigger for" dependencia
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EJECUTORA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC
lcOldChildID=oldval("ANO_EJE+SEC_EJEC")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("ejecutora","sec_ejec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("ejecutora",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "ejecutora"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+DEPENDENCIA")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+DEPENDENCIA"
lcParentID=ANO_EJE+SEC_EJEC+DEPENDENCIA
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("area")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO depen IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+DEPENDENCIA
pcChildExpr="ANO_EJE+SEC_EJEC+DEPENDENCIA"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("area",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" dependencia
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" dependencia
PROCEDURE __RI_INSERT_dependencia
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC"
lcParentWkArea=riopen("ejecutora","sec_ejec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("ejecutora",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" dependencia
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_distrito
** "Referential integrity update trigger for" distrito
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="PROVINCIA")
SELECT (lcChildWkArea)
lcChildID=DEPARTAMENTO+PROVINCIA
lcOldChildID=oldval("DEPARTAMENTO+PROVINCIA")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="DEPARTAMENTO+PROVINCIA"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("provincia","provincia")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("provincia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "provincia"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="REGION")
SELECT (lcChildWkArea)
lcChildID=REGION
lcOldChildID=oldval("REGION")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="REGION"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("region","region")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("region",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "region"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" distrito
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" distrito
PROCEDURE __RI_INSERT_distrito
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=DEPARTAMENTO+PROVINCIA
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="DEPARTAMENTO+PROVINCIA"
lcParentWkArea=riopen("provincia","provincia")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("provincia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=REGION
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="REGION"
lcParentWkArea=riopen("region","region")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("region",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" distrito
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" ejecutora
PROCEDURE __RI_DELETE_ejecutora
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcChildWkArea=riopen("centro_gasto","sec_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("centro_gasto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcChildWkArea=riopen("control_presupuesto","sec_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("control_presupuesto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcChildWkArea=riopen("dependencia","sec_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("dependencia",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcChildWkArea=riopen("expediente","sec_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcChildWkArea=riopen("nota_modificatoria_cab","sec_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("nota_modificatoria_cab",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcChildWkArea=riopen("persona_contrato","sec_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("persona_contrato",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcChildWkArea=riopen("planilla","sec_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("planilla",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcChildWkArea=riopen("pp_formulacion_personal","sec_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("pp_formulacion_personal",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcChildWkArea=riopen("pp_meta","sec_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("pp_meta",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcChildWkArea=riopen("proyecto_nota","sec_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("proyecto_nota",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcChildWkArea=riopen("sub_unidad","sec_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("sub_unidad",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" ejecutora
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_ejecutora
** "Referential integrity update trigger for" ejecutora
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcParentID=ANO_EJE+SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("centro_gasto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO sec_ejec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("centro_gasto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcParentID=ANO_EJE+SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("control_presupuesto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO sec_ejec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("control_presupuesto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcParentID=ANO_EJE+SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("dependencia")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO sec_ejec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("dependencia",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcParentID=ANO_EJE+SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO sec_ejec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcParentID=ANO_EJE+SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("nota_modificatoria_cab")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO sec_ejec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("nota_modificatoria_cab",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcParentID=ANO_EJE+SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("persona_contrato")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO sec_ejec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("persona_contrato",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcParentID=ANO_EJE+SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("planilla")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO sec_ejec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("planilla",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcParentID=ANO_EJE+SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("pp_formulacion_personal")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO sec_ejec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("pp_formulacion_personal",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcParentID=ANO_EJE+SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("pp_meta")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO sec_ejec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("pp_meta",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcParentID=ANO_EJE+SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("proyecto_nota")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO sec_ejec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("proyecto_nota",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC"
lcParentID=ANO_EJE+SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("sub_unidad")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO sec_ejec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC
pcChildExpr="ANO_EJE+SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("sub_unidad",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" ejecutora
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_elemento_ciiu
** "Referential integrity update trigger for" elemento_ciiu
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="GRUPO_CIIU")
SELECT (lcChildWkArea)
lcChildID=TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU
lcOldChildID=oldval("TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("grupo_ciiu","grupo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_ciiu",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "grupo_ciiu"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" elemento_ciiu
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" elemento_ciiu
PROCEDURE __RI_INSERT_elemento_ciiu
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU"
lcParentWkArea=riopen("grupo_ciiu","grupo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_ciiu",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" elemento_ciiu
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_elemento_complementaria
** "Referential integrity update trigger for" elemento_complementaria
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="TIPO_COMPLEMENTARIA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+TIPO_COMPLEMENTARIA
lcOldChildID=oldval("ANO_EJE+TIPO_COMPLEMENTARIA")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+TIPO_COMPLEMENTARIA"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("tipo_complementaria","tipo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("tipo_complementaria",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "tipo_complementaria"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" elemento_complementaria
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" elemento_complementaria
PROCEDURE __RI_INSERT_elemento_complementaria
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+TIPO_COMPLEMENTARIA
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+TIPO_COMPLEMENTARIA"
lcParentWkArea=riopen("tipo_complementaria","tipo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("tipo_complementaria",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" elemento_complementaria
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" elemento_gasto
PROCEDURE __RI_DELETE_elemento_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
lcChildWkArea=riopen("expediente_clasif","elemento")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_clasif",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
lcChildWkArea=riopen("nota_modificatoria_det","elemento")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("nota_modificatoria_det",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" elemento_gasto
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_elemento_gasto
** "Referential integrity update trigger for" elemento_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="MODALIDAD_GASTO")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO
lcOldChildID=oldval("ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("modalidad_gasto","modalidad")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("modalidad_gasto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "modalidad_gasto"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GAST
O")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
lcParentID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_clasif")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO elemento IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_clasif",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GAST
O")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
lcParentID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("nota_modificatoria_det")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO elemento IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("nota_modificatoria_det",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" elemento_gasto
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" elemento_gasto
PROCEDURE __RI_INSERT_elemento_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO"
lcParentWkArea=riopen("modalidad_gasto","modalidad")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("modalidad_gasto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" elemento_gasto
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" elemento_gasto_nombre
PROCEDURE __RI_DELETE_elemento_gasto_nombre
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+ELEMENTO_GASTO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+ELEMENTO_GASTO"
lcChildWkArea=riopen("elemento_grupo_gasto","elemento")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+ELEMENTO_GASTO
pcChildExpr="ANO_EJE+ELEMENTO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("elemento_grupo_gasto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+ELEMENTO_GASTO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+ELEMENTO_GASTO"
lcChildWkArea=riopen("pp_formulacion_gastos","elemento")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+ELEMENTO_GASTO
pcChildExpr="ANO_EJE+ELEMENTO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("pp_formulacion_gastos",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" elemento_gasto_nombre
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_elemento_gasto_nombre
** "Referential integrity update trigger for" elemento_gasto_nombre
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+ELEMENTO_GASTO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+ELEMENTO_GASTO"
lcParentID=ANO_EJE+ELEMENTO_GASTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("elemento_grupo_gasto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO elemento IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+ELEMENTO_GASTO
pcChildExpr="ANO_EJE+ELEMENTO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("elemento_grupo_gasto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+ELEMENTO_GASTO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+ELEMENTO_GASTO"
lcParentID=ANO_EJE+ELEMENTO_GASTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("pp_formulacion_gastos")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO elemento IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+ELEMENTO_GASTO
pcChildExpr="ANO_EJE+ELEMENTO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("pp_formulacion_gastos",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" elemento_gasto_nombre
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_elemento_grupo_gasto
** "Referential integrity update trigger for" elemento_grupo_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="ELEMENTO_GASTO_NOMBRE")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+ELEMENTO_GASTO
lcOldChildID=oldval("ANO_EJE+ELEMENTO_GASTO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+ELEMENTO_GASTO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("elemento_gasto_nombre","elemento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("elemento_gasto_nombre",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "elemento_gasto_nombre"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" elemento_grupo_gasto
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" elemento_grupo_gasto
PROCEDURE __RI_INSERT_elemento_grupo_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+ELEMENTO_GASTO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+ELEMENTO_GASTO"
lcParentWkArea=riopen("elemento_gasto_nombre","elemento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("elemento_gasto_nombre",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" elemento_grupo_gasto
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" elemento_ingreso
PROCEDURE __RI_DELETE_elemento_ingreso
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
lcChildWkArea=riopen("expediente_ingreso","elemento")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO
pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_ingreso",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
lcChildWkArea=riopen("fuente_financ_elemento_ing","elemento")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO
pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("fuente_financ_elemento_ing",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
lcChildWkArea=riopen("nota_modificatoria_ing","elemento")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO
pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("nota_modificatoria_ing",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
lcChildWkArea=riopen("pp_formulacion_ingresos","elemento")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO
pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("pp_formulacion_ingresos",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" elemento_ingreso
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_elemento_ingreso
** "Referential integrity update trigger for" elemento_ingreso
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="SUB_TIPO_INGRESO")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO
lcOldChildID=oldval("ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("sub_tipo_ingreso","sub_tipo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("sub_tipo_ingreso",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "sub_tipo_ingreso"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_
INGRESO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
lcParentID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_ingreso")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO elemento IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO

pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_ingreso",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_
INGRESO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
lcParentID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("fuente_financ_elemento_ing")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO elemento IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO

pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("fuente_financ_elemento_ing",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_
INGRESO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
lcParentID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("nota_modificatoria_ing")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO elemento IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO

pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("nota_modificatoria_ing",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_
INGRESO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
lcParentID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("pp_formulacion_ingresos")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO elemento IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO
pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("pp_formulacion_ingresos",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" elemento_ingreso
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" elemento_ingreso
PROCEDURE __RI_INSERT_elemento_ingreso
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO"
lcParentWkArea=riopen("sub_tipo_ingreso","sub_tipo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("sub_tipo_ingreso",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" elemento_ingreso
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" entidad_estado
PROCEDURE __RI_DELETE_entidad_estado
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="SEC_EJEC"
lcChildWkArea=riopen("grupo_x_categoria_ocupacional_728","entidad")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=SEC_EJEC
pcChildExpr="SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("grupo_x_categoria_ocupacional_728",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="SEC_EJEC"
lcChildWkArea=riopen("personal_titular","entidad")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=SEC_EJEC
pcChildExpr="SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("personal_titular",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE SEC_EJEC TO lcParentID,pcParentID
pcParentExpr="SEC_EJEC"
lcChildWkArea=riopen("tipo_monto_ejec","entidad")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=SEC_EJEC
pcChildExpr="SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("tipo_monto_ejec",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" entidad_estado
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_entidad_estado
** "Referential integrity update trigger for" entidad_estado
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="SEC_EJEC"
lcParentID=SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("grupo_x_categoria_ocupacional_728")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO entidad IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=SEC_EJEC
pcChildExpr="SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("grupo_x_categoria_ocupacional_728",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="SEC_EJEC"
lcParentID=SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("personal_titular")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO entidad IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=SEC_EJEC
pcChildExpr="SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("personal_titular",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("SEC_EJEC")
pcParentID=lcOldParentID
pcParentExpr="SEC_EJEC"
lcParentID=SEC_EJEC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("tipo_monto_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO entidad IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=SEC_EJEC
pcChildExpr="SEC_EJEC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("tipo_monto_ejec",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" entidad_estado
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" expediente
PROCEDURE __RI_DELETE_expediente
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+EXPEDIENTE TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE"
lcChildWkArea=riopen("expediente_fase","expediente")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_fase",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" expediente
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente
** "Referential integrity update trigger for" expediente
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EJECUTORA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC
lcOldChildID=oldval("ANO_EJE+SEC_EJEC")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("ejecutora","sec_ejec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("ejecutora",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "ejecutora"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+EXPEDIENTE")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE"
lcParentID=ANO_EJE+SEC_EJEC+EXPEDIENTE
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_fase")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO expediente IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_fase",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" expediente
PROCEDURE __RI_INSERT_expediente
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC"
lcParentWkArea=riopen("ejecutora","sec_ejec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("ejecutora",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_adjunto
** "Referential integrity update trigger for" expediente_adjunto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EXPEDIENTE_SECUENCIA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO

lcOldChildID=oldval("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("expediente_secuencia","exp_sec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_secuencia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "expediente_secuencia"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_adjunto
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" expediente_adjunto
PROCEDURE __RI_INSERT_expediente_adjunto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcParentWkArea=riopen("expediente_secuencia","exp_sec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_secuencia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente_adjunto
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" expediente_clasif
PROCEDURE __RI_DELETE_expediente_clasif
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE
ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+CATEG_GASTO+GRUPO_GAST
O+MODALIDAD_GASTO+ELEMENTO_GASTO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+CATEG_GA
STO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
lcChildWkArea=riopen("expediente_meta","exp_clasif")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+CATEG_GASTO+
GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+CATEG_GAS
TO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_meta",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" expediente_clasif
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_clasif
** "Referential integrity update trigger for" expediente_clasif
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="ELEMENTO_GASTO")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
lcOldChildID=oldval("ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("elemento_gasto","elemento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("elemento_gasto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "elemento_gasto"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EXPEDIENTE_SECUENCIA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO

lcOldChildID=oldval("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("expediente_secuencia","exp_sec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_secuencia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "expediente_secuencia"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+
CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+CATEG_GA
STO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
lcParentID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+CATEG_GASTO
+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_meta")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO exp_clasif IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()

pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+CATEG_GASTO+
GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO

pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+CATEG_GAS
TO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_meta",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_clasif
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" expediente_clasif
PROCEDURE __RI_INSERT_expediente_clasif
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
lcParentWkArea=riopen("elemento_gasto","elemento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("elemento_gasto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcParentWkArea=riopen("expediente_secuencia","exp_sec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_secuencia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente_clasif
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" expediente_coa
PROCEDURE __RI_DELETE_expediente_coa
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA_DOC TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCI
A_DOC"
lcChildWkArea=riopen("expediente_coa_aux","exp_doc")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA_DO
C
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA
_DOC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_coa_aux",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA_DOC TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCI
A_DOC"
lcChildWkArea=riopen("expediente_coa_nc_det","exp_doc")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA_DO
C
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA
_DOC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_coa_nc_det",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" expediente_coa
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_coa
** "Referential integrity update trigger for" expediente_coa
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EXPEDIENTE_SECUENCIA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO

lcOldChildID=oldval("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("expediente_secuencia","exp_sec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_secuencia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "expediente_secuencia"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="MAESTRO_DOCUMENTO")
SELECT (lcChildWkArea)
lcChildID=COD_DOC
lcOldChildID=oldval("COD_DOC")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="COD_DOC"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("maestro_documento","cod_doc")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("maestro_documento",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "maestro_documento"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="PERSONA")
SELECT (lcChildWkArea)
lcChildID="1"+SUBSTR(NUM_DOC_ID,1,11)
lcOldChildID=oldval('"1"+SUBSTR(NUM_DOC_ID,1,11)')
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr='"1"+SUBSTR(NUM_DOC_ID,1,11)'
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen('persona',"ruc")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("persona",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "persona"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="PERSONA_COA")
SELECT (lcChildWkArea)
lcChildID=TIPO_DOC_ID+NUM_DOC_ID
lcOldChildID=oldval("TIPO_DOC_ID+NUM_DOC_ID")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="TIPO_DOC_ID+NUM_DOC_ID"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("persona_coa","num_doc")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("persona_coa",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "persona_coa"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+
SECUENCIA_DOC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCI
A_DOC"
lcParentID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA_D
OC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_coa_aux")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO exp_doc IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()

pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA_DO
C

pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA
_DOC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_coa_aux",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+
SECUENCIA_DOC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCI
A_DOC"
lcParentID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA_D
OC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_coa_nc_det")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO exp_doc IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()

pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA_DO
C

pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA
_DOC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_coa_nc_det",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_coa
********************************************************************************
********************************************************************************
** "Referential integrity insert trigger for" expediente_coa
PROCEDURE __RI_INSERT_expediente_coa
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcParentWkArea=riopen("expediente_secuencia","exp_sec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_secuencia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=COD_DOC
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="COD_DOC"
lcParentWkArea=riopen("maestro_documento","cod_doc")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("maestro_documento",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID="1"+SUBSTR(NUM_DOC_ID,1,11)
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr='"1"+SUBSTR(NUM_DOC_ID,1,11)'
lcParentWkArea=riopen("persona","ruc")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("persona",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=TIPO_DOC_ID+NUM_DOC_ID
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="TIPO_DOC_ID+NUM_DOC_ID"
lcParentWkArea=riopen("persona_coa","num_doc")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("persona_coa",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente_coa
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_coa_aux
** "Referential integrity update trigger for" expediente_coa_aux
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EXPEDIENTE_COA")
SELECT (lcChildWkArea)

lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA_DO
C

lcOldChildID=oldval("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+S
ECUENCIA_DOC")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID

pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA
_DOC"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("expediente_coa","exp_doc")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_coa",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "expediente_coa"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_coa_aux
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" expediente_coa_aux
PROCEDURE __RI_INSERT_expediente_coa_aux
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA_DO
C
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA
_DOC"
lcParentWkArea=riopen("expediente_coa","exp_doc")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_coa",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente_coa_aux
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_coa_nc_det
** "Referential integrity update trigger for" expediente_coa_nc_det
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EXPEDIENTE_COA")
SELECT (lcChildWkArea)

lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA_DO
C

lcOldChildID=oldval("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+S
ECUENCIA_DOC")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID

pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA
_DOC"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("expediente_coa","exp_doc")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_coa",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "expediente_coa"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="MAESTRO_DOCUMENTO")
SELECT (lcChildWkArea)
lcChildID=COD_DOC_ORI
lcOldChildID=oldval("COD_DOC_ORI")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="COD_DOC_ORI"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("maestro_documento","cod_doc")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("maestro_documento",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "maestro_documento"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_coa_nc_det
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" expediente_coa_nc_det
PROCEDURE __RI_INSERT_expediente_coa_nc_det
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA_DO
C
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+SECUENCIA
_DOC"
lcParentWkArea=riopen("expediente_coa","exp_doc")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_coa",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=COD_DOC_ORI
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="COD_DOC_ORI"
lcParentWkArea=riopen("maestro_documento","cod_doc")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("maestro_documento",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente_coa_nc_det
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_documento
** "Referential integrity update trigger for" expediente_documento
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EXPEDIENTE_SECUENCIA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
lcOldChildID=oldval("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("expediente_secuencia","exp_sec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_secuencia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "expediente_secuencia"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_documento
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" expediente_documento
PROCEDURE __RI_INSERT_expediente_documento
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcParentWkArea=riopen("expediente_secuencia","exp_sec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_secuencia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente_documento
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" expediente_fase
PROCEDURE __RI_DELETE_expediente_fase
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA"
lcChildWkArea=riopen("expediente_nota","exp_fase")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_nota",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA"
lcChildWkArea=riopen("expediente_secuencia","exp_fase")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_secuencia",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" expediente_fase
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_fase
** "Referential integrity update trigger for" expediente_fase
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="CONVENIO_PROYECTO")
SELECT (lcChildWkArea)
lcChildID=PROYECTO
lcOldChildID=oldval("PROYECTO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="PROYECTO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("convenio_proyecto","proyecto")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("convenio_proyecto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "convenio_proyecto"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EXPEDIENTE")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE
lcOldChildID=oldval("ANO_EJE+SEC_EJEC+EXPEDIENTE")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("expediente","expediente")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "expediente"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT pccascadeparent=="FASE")
SELECT (lcChildWkArea)
lcChildID=CICLO+FASE
lcOldChildID=oldval("CICLO+FASE")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="CICLO+FASE"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("fase","fase")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("fase",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "fase"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA"
lcParentID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_nota")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO exp_fase IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_nota",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA"
lcParentID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_secuencia")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO exp_fase IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_secuencia",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_fase
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" expediente_fase
PROCEDURE __RI_INSERT_expediente_fase
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=PROYECTO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="PROYECTO"
lcParentWkArea=riopen("convenio_proyecto","proyecto")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("convenio_proyecto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE"
lcParentWkArea=riopen("expediente","expediente")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=CICLO+FASE
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="CICLO+FASE"
lcParentWkArea=riopen("fase","fase")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("fase",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente_fase
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" expediente_grupo
PROCEDURE __RI_DELETE_expediente_grupo
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+GRUPO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+GRUPO"
lcChildWkArea=riopen("expediente_grupo_clasif","grupo")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+GRUPO
pcChildExpr="ANO_EJE+SEC_EJEC+GRUPO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_grupo_clasif",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" expediente_grupo
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_grupo
** "Referential integrity update trigger for" expediente_grupo
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+GRUPO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+GRUPO"
lcParentID=ANO_EJE+SEC_EJEC+GRUPO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_grupo_clasif")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO grupo IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+GRUPO
pcChildExpr="ANO_EJE+SEC_EJEC+GRUPO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_grupo_clasif",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_grupo
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_grupo_clasif
** "Referential integrity update trigger for" expediente_grupo_clasif
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EXPEDIENTE_GRUPO")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+GRUPO
lcOldChildID=oldval("ANO_EJE+SEC_EJEC+GRUPO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+GRUPO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("expediente_grupo","grupo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_grupo",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "expediente_grupo"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_grupo_clasif
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" expediente_grupo_clasif
PROCEDURE __RI_INSERT_expediente_grupo_clasif
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+GRUPO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+GRUPO"
lcParentWkArea=riopen("expediente_grupo","grupo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_grupo",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente_grupo_clasif
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_ingreso
** "Referential integrity update trigger for" expediente_ingreso
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="ELEMENTO_INGRESO")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO

lcOldChildID=oldval("ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_I
NGRESO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID

pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("elemento_ingreso","elemento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("elemento_ingreso",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "elemento_ingreso"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EXPEDIENTE_SECUENCIA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO

lcOldChildID=oldval("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("expediente_secuencia","exp_sec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_secuencia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "expediente_secuencia"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_ingreso
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" expediente_ingreso
PROCEDURE __RI_INSERT_expediente_ingreso
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
lcParentWkArea=riopen("elemento_ingreso","elemento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("elemento_ingreso",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcParentWkArea=riopen("expediente_secuencia","exp_sec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_secuencia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente_ingreso
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_meta
** "Referential integrity update trigger for" expediente_meta
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EXPEDIENTE_CLASIF")
SELECT (lcChildWkArea)

lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+CATEG_GASTO+
GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO

lcOldChildID=oldval("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+C
ATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID

pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+CATEG_GAS
TO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("expediente_clasif","exp_clasif")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_clasif",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "expediente_clasif"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_meta
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" expediente_meta
PROCEDURE __RI_INSERT_expediente_meta
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+CATEG_GASTO+
GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO+CATEG_GAS
TO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
lcParentWkArea=riopen("expediente_clasif","exp_clasif")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_clasif",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente_meta
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_nota
** "Referential integrity update trigger for" expediente_nota
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EXPEDIENTE_FASE")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA
lcOldChildID=oldval("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("expediente_fase","exp_fase")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_fase",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "expediente_fase"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_nota
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" expediente_nota
PROCEDURE __RI_INSERT_expediente_nota
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA"
lcParentWkArea=riopen("expediente_fase","exp_fase")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_fase",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente_nota
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" expediente_secuencia
PROCEDURE __RI_DELETE_expediente_secuencia
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcChildWkArea=riopen("expediente_adjunto","exp_sec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_adjunto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcChildWkArea=riopen("expediente_clasif","exp_sec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_clasif",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcChildWkArea=riopen("expediente_coa","exp_sec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_coa",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcChildWkArea=riopen("expediente_documento","exp_sec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_documento",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcChildWkArea=riopen("expediente_ingreso","exp_sec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_ingreso",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO TO
lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcChildWkArea=riopen("proyecto_detalle","exp_sec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("proyecto_detalle",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
*!* Codigo adicional al Trigger de Eliminacion ( ri_delete_expediente_secuencia )
***************************************************
*--Actualiza Mef_Estado en INTF_CAB
IF FILE('interfase\intf_cab.dbf')
TRY
SELECT (lcstartarea)
STORE "" TO pcexprintf
pcexprintf=ano_eje+sec_ejec+expediente+secuencia+correlativo
USE interfase\intf_cab IN 0 ORDER TAG siaf_intf ALIAS cab AGAIN SHARED
xexclusive = SET('exclusive')
SET EXCLUSIVE OFF
IF SEEK(pcexprintf,'cab','siaf_intf')
REPLACE cab.mef_estado WITH 'X'
ENDIF
USE IN cab
SET EXCLUSIVE &xexclusive
CATCH

ENDTRY
ENDIF
*--Fin del C�digo adicional para Interfase
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" expediente_secuencia
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_expediente_secuencia
** "Referential integrity update trigger for" expediente_secuencia
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EXPEDIENTE_FASE")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA
lcOldChildID=oldval("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("expediente_fase","exp_fase")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_fase",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "expediente_fase"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
)
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcParentID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_adjunto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO exp_sec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_adjunto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
)
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcParentID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_clasif")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO exp_sec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_clasif",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
)
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcParentID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_coa")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO exp_sec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_coa",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
)
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcParentID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_documento")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO exp_sec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_documento",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
)
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcParentID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_ingreso")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO exp_sec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_ingreso",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
)
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
lcParentID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("proyecto_detalle")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO exp_sec IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA+CORRELATIVO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("proyecto_detalle",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
*!* Codigo adicional al Trigger de Actualizacion ( ri_update_expediente_secuencia )
***************************************************
*--Actualiza estado_envio en INTF_CAB
IF FILE('interfase\intf_cab.dbf')
TRY
SELECT (lcstartarea)
STORE "" TO pcexprintf
pcexprintf=ano_eje+sec_ejec+expediente+secuencia+correlativo
USE interfase\intf_cab IN 0 ORDER TAG siaf_intf ALIAS cab AGAIN SHARED
xexclusive = SET('exclusive')
SET EXCLUSIVE OFF
IF SEEK(pcexprintf,'cab','siaf_intf')
REPLACE cab.mef_estado WITH estado_envio
ENDIF
USE IN cab
SET EXCLUSIVE &xexclusive
CATCH

ENDTRY
ENDIF
*--Fin del C�digo adicional para Interfase
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" expediente_secuencia
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" expediente_secuencia
PROCEDURE __RI_INSERT_expediente_secuencia
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+EXPEDIENTE+CICLO+FASE+SECUENCIA"
lcParentWkArea=riopen("expediente_fase","exp_fase")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("expediente_fase",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" expediente_secuencia
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_familia_bien_serv
** "Referential integrity update trigger for" familia_bien_serv
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="CLASE_BIEN_SERV")
SELECT (lcChildWkArea)
lcChildID=TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN
lcOldChildID=oldval("TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("clase_bien_serv","clase_bien")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("clase_bien_serv",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "clase_bien_serv"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" familia_bien_serv
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" familia_bien_serv
PROCEDURE __RI_INSERT_familia_bien_serv
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="TIPO_BIEN+GRUPO_BIEN+CLASE_BIEN"
lcParentWkArea=riopen("clase_bien_serv","clase_bien")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("clase_bien_serv",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" familia_bien_serv
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" fase
PROCEDURE __RI_DELETE_fase
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE CICLO+FASE TO lcParentID,pcParentID
pcParentExpr="CICLO+FASE"
lcChildWkArea=riopen("expediente_fase","fase")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=CICLO+FASE
pcChildExpr="CICLO+FASE"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_fase",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" fase
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_fase
** "Referential integrity update trigger for" fase
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT pccascadeparent=="CICLO")
SELECT (lcChildWkArea)
lcChildID=CICLO
lcOldChildID=oldval("CICLO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="CICLO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("ciclo","ciclo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("ciclo",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "ciclo"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("CICLO+FASE")
pcParentID=lcOldParentID
pcParentExpr="CICLO+FASE"
lcParentID=CICLO+FASE
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_fase")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO fase IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=CICLO+FASE
pcChildExpr="CICLO+FASE"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_fase",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" fase
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" fase
PROCEDURE __RI_INSERT_fase
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=CICLO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="CICLO"
lcParentWkArea=riopen("ciclo","ciclo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("ciclo",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" fase
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" finalidad
PROCEDURE __RI_DELETE_finalidad
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+FINALIDAD TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+FINALIDAD"
lcChildWkArea=riopen("componente_finalidad","finalidad")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FINALIDAD
pcChildExpr="ANO_EJE+FINALIDAD"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("componente_finalidad",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+FINALIDAD TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+FINALIDAD"
lcChildWkArea=riopen("meta","finalidad")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FINALIDAD
pcChildExpr="ANO_EJE+FINALIDAD"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("meta",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" finalidad
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_finalidad
** "Referential integrity update trigger for" finalidad
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+FINALIDAD")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+FINALIDAD"
lcParentID=ANO_EJE+FINALIDAD
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("componente_finalidad")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO finalidad IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FINALIDAD
pcChildExpr="ANO_EJE+FINALIDAD"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("componente_finalidad",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+FINALIDAD")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+FINALIDAD"
lcParentID=ANO_EJE+FINALIDAD
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("meta")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO finalidad IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FINALIDAD
pcChildExpr="ANO_EJE+FINALIDAD"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("meta",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" finalidad
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" fuente_financ
PROCEDURE __RI_DELETE_fuente_financ
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+ORIGEN+FUENTE_FINANC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+ORIGEN+FUENTE_FINANC"
lcChildWkArea=riopen("fuente_financ_ejec","fuente_fin")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+ORIGEN+FUENTE_FINANC
pcChildExpr="ANO_EJE+ORIGEN+FUENTE_FINANC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("fuente_financ_ejec",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+ORIGEN+FUENTE_FINANC TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+ORIGEN+FUENTE_FINANC"
lcChildWkArea=riopen("fuente_financ_elemento_ing","fuente_fin")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+ORIGEN+FUENTE_FINANC
pcChildExpr="ANO_EJE+ORIGEN+FUENTE_FINANC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("fuente_financ_elemento_ing",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" fuente_financ
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_fuente_financ
** "Referential integrity update trigger for" fuente_financ
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="ORIGEN")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+ORIGEN
lcOldChildID=oldval("ANO_EJE+ORIGEN")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+ORIGEN"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("origen","origen")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("origen",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "origen"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+ORIGEN+FUENTE_FINANC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+ORIGEN+FUENTE_FINANC"
lcParentID=ANO_EJE+ORIGEN+FUENTE_FINANC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("fuente_financ_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO fuente_fin IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+ORIGEN+FUENTE_FINANC
pcChildExpr="ANO_EJE+ORIGEN+FUENTE_FINANC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("fuente_financ_ejec",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+ORIGEN+FUENTE_FINANC")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+ORIGEN+FUENTE_FINANC"
lcParentID=ANO_EJE+ORIGEN+FUENTE_FINANC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("fuente_financ_elemento_ing")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO fuente_fin IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+ORIGEN+FUENTE_FINANC
pcChildExpr="ANO_EJE+ORIGEN+FUENTE_FINANC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("fuente_financ_elemento_ing",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" fuente_financ
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" fuente_financ
PROCEDURE __RI_INSERT_fuente_financ
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+ORIGEN
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+ORIGEN"
lcParentWkArea=riopen("origen","origen")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("origen",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" fuente_financ
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_fuente_financ_ejec
** "Referential integrity update trigger for" fuente_financ_ejec
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="FUENTE_FINANC")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+ORIGEN+FUENTE_FINANC
lcOldChildID=oldval("ANO_EJE+ORIGEN+FUENTE_FINANC")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+ORIGEN+FUENTE_FINANC"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("fuente_financ","fuente_fin")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("fuente_financ",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "fuente_financ"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" fuente_financ_ejec
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" fuente_financ_ejec
PROCEDURE __RI_INSERT_fuente_financ_ejec
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+ORIGEN+FUENTE_FINANC
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+ORIGEN+FUENTE_FINANC"
lcParentWkArea=riopen("fuente_financ","fuente_fin")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("fuente_financ",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" fuente_financ_ejec
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_fuente_financ_elemento_ing
** "Referential integrity update trigger for" fuente_financ_elemento_ing
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="ELEMENTO_INGRESO")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO

lcOldChildID=oldval("ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_I
NGRESO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID

pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("elemento_ingreso","elemento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("elemento_ingreso",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "elemento_ingreso"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="FUENTE_FINANC")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+ORIGEN+FUENTE_FINANC
lcOldChildID=oldval("ANO_EJE+ORIGEN+FUENTE_FINANC")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+ORIGEN+FUENTE_FINANC"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("fuente_financ","fuente_fin")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("fuente_financ",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "fuente_financ"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" fuente_financ_elemento_ing
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" fuente_financ_elemento_ing
PROCEDURE __RI_INSERT_fuente_financ_elemento_ing
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
lcParentWkArea=riopen("elemento_ingreso","elemento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("elemento_ingreso",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+ORIGEN+FUENTE_FINANC
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+ORIGEN+FUENTE_FINANC"
lcParentWkArea=riopen("fuente_financ","fuente_fin")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("fuente_financ",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" fuente_financ_elemento_ing
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" funcion
PROCEDURE __RI_DELETE_funcion
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+FUNCION TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+FUNCION"
lcChildWkArea=riopen("pp_meta","funcion")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FUNCION
pcChildExpr="ANO_EJE+FUNCION"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("pp_meta",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+FUNCION TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+FUNCION"
lcChildWkArea=riopen("programa","funcion")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FUNCION
pcChildExpr="ANO_EJE+FUNCION"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("programa",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+FUNCION TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+FUNCION"
lcChildWkArea=riopen("tmp_componente_ejec","funcion")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FUNCION
pcChildExpr="ANO_EJE+FUNCION"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("tmp_componente_ejec",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" funcion
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_funcion
** "Referential integrity update trigger for" funcion
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+FUNCION")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+FUNCION"
lcParentID=ANO_EJE+FUNCION
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("pp_meta")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO funcion IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FUNCION
pcChildExpr="ANO_EJE+FUNCION"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("pp_meta",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+FUNCION")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+FUNCION"
lcParentID=ANO_EJE+FUNCION
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("programa")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO funcion IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FUNCION
pcChildExpr="ANO_EJE+FUNCION"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("programa",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+FUNCION")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+FUNCION"
lcParentID=ANO_EJE+FUNCION
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("tmp_componente_ejec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO funcion IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+FUNCION
pcChildExpr="ANO_EJE+FUNCION"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("tmp_componente_ejec",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" funcion
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" grupo_bien
PROCEDURE __RI_DELETE_grupo_bien
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN TO lcParentID,pcParentID
pcParentExpr="TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN"
lcChildWkArea=riopen("clase_bien","grupo")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN
pcChildExpr="TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("clase_bien",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" grupo_bien
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_grupo_bien
** "Referential integrity update trigger for" grupo_bien
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="CATEGORIA_BIEN")
SELECT (lcChildWkArea)
lcChildID=TIPO_BIEN+CATEGORIA_BIEN
lcOldChildID=oldval("TIPO_BIEN+CATEGORIA_BIEN")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="TIPO_BIEN+CATEGORIA_BIEN"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("categoria_bien","categoria")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("categoria_bien",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "categoria_bien"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN")
pcParentID=lcOldParentID
pcParentExpr="TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN"
lcParentID=TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("clase_bien")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO grupo IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN
pcChildExpr="TIPO_BIEN+CATEGORIA_BIEN+GRUPO_BIEN"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("clase_bien",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" grupo_bien
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" grupo_bien
PROCEDURE __RI_INSERT_grupo_bien
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=TIPO_BIEN+CATEGORIA_BIEN
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="TIPO_BIEN+CATEGORIA_BIEN"
lcParentWkArea=riopen("categoria_bien","categoria")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("categoria_bien",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" grupo_bien
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" grupo_bien_serv
PROCEDURE __RI_DELETE_grupo_bien_serv
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE TIPO_BIEN+GRUPO_BIEN TO lcParentID,pcParentID
pcParentExpr="TIPO_BIEN+GRUPO_BIEN"
lcChildWkArea=riopen("clase_bien_serv","grupo_bien")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=TIPO_BIEN+GRUPO_BIEN
pcChildExpr="TIPO_BIEN+GRUPO_BIEN"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("clase_bien_serv",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" grupo_bien_serv
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_grupo_bien_serv
** "Referential integrity update trigger for" grupo_bien_serv
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("TIPO_BIEN+GRUPO_BIEN")
pcParentID=lcOldParentID
pcParentExpr="TIPO_BIEN+GRUPO_BIEN"
lcParentID=TIPO_BIEN+GRUPO_BIEN
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("clase_bien_serv")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO grupo_bien IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=TIPO_BIEN+GRUPO_BIEN
pcChildExpr="TIPO_BIEN+GRUPO_BIEN"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("clase_bien_serv",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" grupo_bien_serv
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" grupo_ciiu
PROCEDURE __RI_DELETE_grupo_ciiu
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU TO lcParentID,pcParentID
pcParentExpr="TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU"
lcChildWkArea=riopen("elemento_ciiu","grupo")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU
pcChildExpr="TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("elemento_ciiu",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" grupo_ciiu
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_grupo_ciiu
** "Referential integrity update trigger for" grupo_ciiu
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="CATEGORIA_CIIU")
SELECT (lcChildWkArea)
lcChildID=TIPO_CIIU+CATEGORIA_CIIU
lcOldChildID=oldval("TIPO_CIIU+CATEGORIA_CIIU")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="TIPO_CIIU+CATEGORIA_CIIU"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("categoria_ciiu","categoria")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("categoria_ciiu",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "categoria_ciiu"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU")
pcParentID=lcOldParentID
pcParentExpr="TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU"
lcParentID=TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("elemento_ciiu")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO grupo IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU
pcChildExpr="TIPO_CIIU+CATEGORIA_CIIU+GRUPO_CIIU"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("elemento_ciiu",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" grupo_ciiu
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" grupo_ciiu
PROCEDURE __RI_INSERT_grupo_ciiu
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=TIPO_CIIU+CATEGORIA_CIIU
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="TIPO_CIIU+CATEGORIA_CIIU"
lcParentWkArea=riopen("categoria_ciiu","categoria")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("categoria_ciiu",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" grupo_ciiu
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" grupo_gasto
PROCEDURE __RI_DELETE_grupo_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+CATEG_GASTO+GRUPO_GASTO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO"
lcChildWkArea=riopen("modalidad_gasto","grupo")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("modalidad_gasto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+CATEG_GASTO+GRUPO_GASTO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO"
lcChildWkArea=riopen("pp_formulacion_gastos","grupo")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("pp_formulacion_gastos",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" grupo_gasto
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_grupo_gasto
** "Referential integrity update trigger for" grupo_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="CATEGORIA_GASTO")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CATEG_GASTO
lcOldChildID=oldval("ANO_EJE+CATEG_GASTO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+CATEG_GASTO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("categoria_gasto","categoria")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("categoria_gasto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "categoria_gasto"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+CATEG_GASTO+GRUPO_GASTO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO"
lcParentID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("modalidad_gasto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO grupo IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("modalidad_gasto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+CATEG_GASTO+GRUPO_GASTO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO"
lcParentID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("pp_formulacion_gastos")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO grupo IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("pp_formulacion_gastos",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" grupo_gasto
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" grupo_gasto
PROCEDURE __RI_INSERT_grupo_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CATEG_GASTO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+CATEG_GASTO"
lcParentWkArea=riopen("categoria_gasto","categoria")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("categoria_gasto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" grupo_gasto
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" grupo_ocupacional_nombre
PROCEDURE __RI_DELETE_grupo_ocupacional_nombre
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE GRUPO_OCUPACIONAL TO lcParentID,pcParentID
pcParentExpr="GRUPO_OCUPACIONAL"
lcChildWkArea=riopen("grupo_x_categoria_ocupacional","grp_ocup")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=GRUPO_OCUPACIONAL
pcChildExpr="GRUPO_OCUPACIONAL"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("grupo_x_categoria_ocupacional",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE GRUPO_OCUPACIONAL TO lcParentID,pcParentID
pcParentExpr="GRUPO_OCUPACIONAL"
lcChildWkArea=riopen("grupo_x_categoria_ocupacional_728","grp_ocup")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=GRUPO_OCUPACIONAL
pcChildExpr="GRUPO_OCUPACIONAL"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("grupo_x_categoria_ocupacional_728",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE GRUPO_OCUPACIONAL TO lcParentID,pcParentID
pcParentExpr="GRUPO_OCUPACIONAL"
lcChildWkArea=riopen("regimen_x_grupo_ocupacional","grp_ocup")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=GRUPO_OCUPACIONAL
pcChildExpr="GRUPO_OCUPACIONAL"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("regimen_x_grupo_ocupacional",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE GRUPO_OCUPACIONAL TO lcParentID,pcParentID
pcParentExpr="GRUPO_OCUPACIONAL"
lcChildWkArea=riopen("situacion_x_grupo_ocupacional","grp_ocup")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=GRUPO_OCUPACIONAL
pcChildExpr="GRUPO_OCUPACIONAL"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("situacion_x_grupo_ocupacional",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" grupo_ocupacional_nombre
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_grupo_ocupacional_nombre
** "Referential integrity update trigger for" grupo_ocupacional_nombre
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("GRUPO_OCUPACIONAL")
pcParentID=lcOldParentID
pcParentExpr="GRUPO_OCUPACIONAL"
lcParentID=GRUPO_OCUPACIONAL
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("grupo_x_categoria_ocupacional")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO grp_ocup IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=GRUPO_OCUPACIONAL
pcChildExpr="GRUPO_OCUPACIONAL"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("grupo_x_categoria_ocupacional",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("GRUPO_OCUPACIONAL")
pcParentID=lcOldParentID
pcParentExpr="GRUPO_OCUPACIONAL"
lcParentID=GRUPO_OCUPACIONAL
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("grupo_x_categoria_ocupacional_728")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO grp_ocup IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=GRUPO_OCUPACIONAL
pcChildExpr="GRUPO_OCUPACIONAL"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("grupo_x_categoria_ocupacional_728",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("GRUPO_OCUPACIONAL")
pcParentID=lcOldParentID
pcParentExpr="GRUPO_OCUPACIONAL"
lcParentID=GRUPO_OCUPACIONAL
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("regimen_x_grupo_ocupacional")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO grp_ocup IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=GRUPO_OCUPACIONAL
pcChildExpr="GRUPO_OCUPACIONAL"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("regimen_x_grupo_ocupacional",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("GRUPO_OCUPACIONAL")
pcParentID=lcOldParentID
pcParentExpr="GRUPO_OCUPACIONAL"
lcParentID=GRUPO_OCUPACIONAL
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("situacion_x_grupo_ocupacional")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO grp_ocup IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=GRUPO_OCUPACIONAL
pcChildExpr="GRUPO_OCUPACIONAL"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("situacion_x_grupo_ocupacional",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" grupo_ocupacional_nombre
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" grupo_pea
PROCEDURE __RI_DELETE_grupo_pea
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE GRUPO_PEA TO lcParentID,pcParentID
pcParentExpr="GRUPO_PEA"
lcChildWkArea=riopen("condicion_laboral","grupo_pea")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=GRUPO_PEA
pcChildExpr="GRUPO_PEA"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("condicion_laboral",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" grupo_pea
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_grupo_pea
** "Referential integrity update trigger for" grupo_pea
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("GRUPO_PEA")
pcParentID=lcOldParentID
pcParentExpr="GRUPO_PEA"
lcParentID=GRUPO_PEA
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("condicion_laboral")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO grupo_pea IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=GRUPO_PEA
pcChildExpr="GRUPO_PEA"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("condicion_laboral",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" grupo_pea
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_grupo_x_categoria_ocupacional
** "Referential integrity update trigger for" grupo_x_categoria_ocupacional
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="GRUPO_OCUPACIONAL_NOMBRE")
SELECT (lcChildWkArea)
lcChildID=GRUPO_OCUPACIONAL
lcOldChildID=oldval("GRUPO_OCUPACIONAL")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="GRUPO_OCUPACIONAL"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("grupo_ocupacional_nombre","grp_ocup")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_ocupacional_nombre",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "grupo_ocupacional_nombre"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" grupo_x_categoria_ocupacional
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" grupo_x_categoria_ocupacional
PROCEDURE __RI_INSERT_grupo_x_categoria_ocupacional
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=GRUPO_OCUPACIONAL
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="GRUPO_OCUPACIONAL"
lcParentWkArea=riopen("grupo_ocupacional_nombre","grp_ocup")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_ocupacional_nombre",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" grupo_x_categoria_ocupacional
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_grupo_x_categoria_ocupacional_728
** "Referential integrity update trigger for" grupo_x_categoria_ocupacional_728
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="ENTIDAD_ESTADO")
SELECT (lcChildWkArea)
lcChildID=SEC_EJEC
lcOldChildID=oldval("SEC_EJEC")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="SEC_EJEC"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("entidad_estado","entidad")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("entidad_estado",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "entidad_estado"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="GRUPO_OCUPACIONAL_NOMBRE")
SELECT (lcChildWkArea)
lcChildID=GRUPO_OCUPACIONAL
lcOldChildID=oldval("GRUPO_OCUPACIONAL")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="GRUPO_OCUPACIONAL"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("grupo_ocupacional_nombre","grp_ocup")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_ocupacional_nombre",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "grupo_ocupacional_nombre"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for"
grupo_x_categoria_ocupacional_728
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" grupo_x_categoria_ocupacional_728
PROCEDURE __RI_INSERT_grupo_x_categoria_ocupacional_728
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=SEC_EJEC
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="SEC_EJEC"
lcParentWkArea=riopen("entidad_estado","entidad")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("entidad_estado",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=GRUPO_OCUPACIONAL
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="GRUPO_OCUPACIONAL"
lcParentWkArea=riopen("grupo_ocupacional_nombre","grp_ocup")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_ocupacional_nombre",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for"
grupo_x_categoria_ocupacional_728
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" justificacion
PROCEDURE __RI_DELETE_justificacion
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE SEC_EJEC+PROYECTO+JUSTIFICACION TO lcParentID,pcParentID
pcParentExpr="SEC_EJEC+PROYECTO+JUSTIFICACION"
lcChildWkArea=riopen("justificacion_detalle","justifica")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=SEC_EJEC+PROYECTO+JUSTIFICACION
pcChildExpr="SEC_EJEC+PROYECTO+JUSTIFICACION"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("justificacion_detalle",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" justificacion
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_justificacion
** "Referential integrity update trigger for" justificacion
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="CONVENIO_PROYECTO")
SELECT (lcChildWkArea)
lcChildID=PROYECTO
lcOldChildID=oldval("PROYECTO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="PROYECTO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("convenio_proyecto","proyecto")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("convenio_proyecto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "convenio_proyecto"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("SEC_EJEC+PROYECTO+JUSTIFICACION")
pcParentID=lcOldParentID
pcParentExpr="SEC_EJEC+PROYECTO+JUSTIFICACION"
lcParentID=SEC_EJEC+PROYECTO+JUSTIFICACION
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("justificacion_detalle")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO justifica IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=SEC_EJEC+PROYECTO+JUSTIFICACION
pcChildExpr="SEC_EJEC+PROYECTO+JUSTIFICACION"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("justificacion_detalle",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" justificacion
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" justificacion
PROCEDURE __RI_INSERT_justificacion
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=PROYECTO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="PROYECTO"
lcParentWkArea=riopen("convenio_proyecto","proyecto")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("convenio_proyecto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" justificacion
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_justificacion_detalle
** "Referential integrity update trigger for" justificacion_detalle
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="JUSTIFICACION")
SELECT (lcChildWkArea)
lcChildID=SEC_EJEC+PROYECTO+JUSTIFICACION
lcOldChildID=oldval("SEC_EJEC+PROYECTO+JUSTIFICACION")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="SEC_EJEC+PROYECTO+JUSTIFICACION"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("justificacion","justifica")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("justificacion",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "justificacion"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" justificacion_detalle
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" justificacion_detalle
PROCEDURE __RI_INSERT_justificacion_detalle
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=SEC_EJEC+PROYECTO+JUSTIFICACION
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="SEC_EJEC+PROYECTO+JUSTIFICACION"
lcParentWkArea=riopen("justificacion","justifica")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("justificacion",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" justificacion_detalle
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" maestro
PROCEDURE __RI_DELETE_maestro
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE COD_MAESTRO TO lcParentID,pcParentID
pcParentExpr="COD_MAESTRO"
lcChildWkArea=riopen("maestro_detalle","cod_mae")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=COD_MAESTRO
pcChildExpr="COD_MAESTRO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("maestro_detalle",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" maestro
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_maestro
** "Referential integrity update trigger for" maestro
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("COD_MAESTRO")
pcParentID=lcOldParentID
pcParentExpr="COD_MAESTRO"
lcParentID=COD_MAESTRO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("maestro_detalle")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO cod_mae IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=COD_MAESTRO
pcChildExpr="COD_MAESTRO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("maestro_detalle",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" maestro
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_maestro_detalle
** "Referential integrity update trigger for" maestro_detalle
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="MAESTRO")
SELECT (lcChildWkArea)
lcChildID=COD_MAESTRO
lcOldChildID=oldval("COD_MAESTRO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="COD_MAESTRO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("maestro","cod_mae")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("maestro",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "maestro"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" maestro_detalle
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" maestro_detalle
PROCEDURE __RI_INSERT_maestro_detalle
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=COD_MAESTRO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="COD_MAESTRO"
lcParentWkArea=riopen("maestro","cod_mae")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("maestro",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" maestro_detalle
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" maestro_documento
PROCEDURE __RI_DELETE_maestro_documento
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE COD_DOC TO lcParentID,pcParentID
pcParentExpr="COD_DOC"
lcChildWkArea=riopen("expediente_coa","cod_doc")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=COD_DOC
pcChildExpr="COD_DOC"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_coa",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE COD_DOC TO lcParentID,pcParentID
pcParentExpr="COD_DOC"
lcChildWkArea=riopen("expediente_coa_nc_det","cod_doc")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=COD_DOC_ORI
pcChildExpr="COD_DOC_ORI"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("expediente_coa_nc_det",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" maestro_documento
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_maestro_documento
** "Referential integrity update trigger for" maestro_documento
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("COD_DOC")
pcParentID=lcOldParentID
pcParentExpr="COD_DOC"
lcParentID=COD_DOC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_coa")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO cod_doc IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=COD_DOC
pcChildExpr="COD_DOC"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_coa",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("COD_DOC")
pcParentID=lcOldParentID
pcParentExpr="COD_DOC"
lcParentID=COD_DOC
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("expediente_coa_nc_det")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO cod_doc IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=COD_DOC_ORI
pcChildExpr="COD_DOC_ORI"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("expediente_coa_nc_det",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" maestro_documento
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_meta
** "Referential integrity update trigger for" meta
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="FINALIDAD")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+FINALIDAD
lcOldChildID=oldval("ANO_EJE+FINALIDAD")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+FINALIDAD"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("finalidad","finalidad")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("finalidad",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "finalidad"
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="PROVINCIA")
SELECT (lcChildWkArea)
lcChildID=DEPARTAMENTO+PROVINCIA
lcOldChildID=oldval("DEPARTAMENTO+PROVINCIA")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="DEPARTAMENTO+PROVINCIA"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("provincia","provincia")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("provincia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "provincia"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" meta
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" meta
PROCEDURE __RI_INSERT_meta
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+FINALIDAD
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+FINALIDAD"
lcParentWkArea=riopen("finalidad","finalidad")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("finalidad",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
SELECT (lcChildWkArea)
lcChildID=DEPARTAMENTO+PROVINCIA
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="DEPARTAMENTO+PROVINCIA"
lcParentWkArea=riopen("provincia","provincia")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("provincia",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" meta
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" modalidad_gasto
PROCEDURE __RI_DELETE_modalidad_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO"
lcChildWkArea=riopen("elemento_gasto","modalidad")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("elemento_gasto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" modalidad_gasto
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_modalidad_gasto
** "Referential integrity update trigger for" modalidad_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="GRUPO_GASTO")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO
lcOldChildID=oldval("ANO_EJE+CATEG_GASTO+GRUPO_GASTO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("grupo_gasto","grupo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_gasto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "grupo_gasto"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO"
lcParentID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("elemento_gasto")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO modalidad IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("elemento_gasto",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" modalidad_gasto
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" modalidad_gasto
PROCEDURE __RI_INSERT_modalidad_gasto
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO"
lcParentWkArea=riopen("grupo_gasto","grupo")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("grupo_gasto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" modalidad_gasto
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" modalidad_gasto_nombre
PROCEDURE __RI_DELETE_modalidad_gasto_nombre
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+MODALIDAD_GASTO TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+MODALIDAD_GASTO"
lcChildWkArea=riopen("pp_formulacion_gastos","modalidad")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+MODALIDAD_GASTO
pcChildExpr="ANO_EJE+MODALIDAD_GASTO"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("pp_formulacion_gastos",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" modalidad_gasto_nombre
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_modalidad_gasto_nombre
** "Referential integrity update trigger for" modalidad_gasto_nombre
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+MODALIDAD_GASTO")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+MODALIDAD_GASTO"
lcParentID=ANO_EJE+MODALIDAD_GASTO
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("pp_formulacion_gastos")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO modalidad IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+MODALIDAD_GASTO
pcChildExpr="ANO_EJE+MODALIDAD_GASTO"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("pp_formulacion_gastos",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" modalidad_gasto_nombre
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" nota_modificatoria_cab
PROCEDURE __RI_DELETE_nota_modificatoria_cab
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA"
lcChildWkArea=riopen("nota_modificatoria_sec","mp_notacab")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA
pcChildExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("nota_modificatoria_sec",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" nota_modificatoria_cab
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_nota_modificatoria_cab
** "Referential integrity update trigger for" nota_modificatoria_cab
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="EJECUTORA")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC
lcOldChildID=oldval("ANO_EJE+SEC_EJEC")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("ejecutora","sec_ejec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("ejecutora",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "ejecutora"
lcParentWkArea=lcChildWkArea
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA"
lcParentID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("nota_modificatoria_sec")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO mp_notacab IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA
pcChildExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("nota_modificatoria_sec",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" nota_modificatoria_cab
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" nota_modificatoria_cab
PROCEDURE __RI_INSERT_nota_modificatoria_cab
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC"
lcParentWkArea=riopen("ejecutora","sec_ejec")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("ejecutora",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" nota_modificatoria_cab
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_nota_modificatoria_det
** "Referential integrity update trigger for" nota_modificatoria_det
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="ELEMENTO_GASTO")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO

lcOldChildID=oldval("ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("elemento_gasto","elemento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("elemento_gasto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "elemento_gasto"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" nota_modificatoria_det
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" nota_modificatoria_det
PROCEDURE __RI_INSERT_nota_modificatoria_det
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+CATEG_GASTO+GRUPO_GASTO+MODALIDAD_GASTO+ELEMENTO_GASTO"
lcParentWkArea=riopen("elemento_gasto","elemento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("elemento_gasto",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" nota_modificatoria_det
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_nota_modificatoria_ing
** "Referential integrity update trigger for" nota_modificatoria_ing
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="ELEMENTO_INGRESO")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO

lcOldChildID=oldval("ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_I
NGRESO")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID

pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("elemento_ingreso","elemento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("elemento_ingreso",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "elemento_ingreso"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" nota_modificatoria_ing
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" nota_modificatoria_ing
PROCEDURE __RI_INSERT_nota_modificatoria_ing
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+CLASE_INGRESO+TIPO_INGRESO+SUB_TIPO_INGRESO+ELEMENTO_INGRESO"
lcParentWkArea=riopen("elemento_ingreso","elemento")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("elemento_ingreso",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" nota_modificatoria_ing
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_nota_modificatoria_sec
** "Referential integrity update trigger for" nota_modificatoria_sec
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=select()
IF _triggerlevel=1 or type("pccascadeparent")#"C" or (NOT
pccascadeparent=="NOTA_MODIFICATORIA_CAB")
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA
lcOldChildID=oldval("ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA")
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcOldChildID
pcChildExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA"
IF lcChildID<>lcOldChildID
lcParentWkArea=riopen("nota_modificatoria_cab","mp_notacab")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("nota_modificatoria_cab",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF no parent
ENDIF this value was changed
ENDIF not part of a cascade from "nota_modificatoria_cab"
lcParentWkArea=lcChildWkArea
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" nota_modificatoria_sec
********************************************************************************

********************************************************************************
** "Referential integrity insert trigger for" nota_modificatoria_sec
PROCEDURE __RI_INSERT_nota_modificatoria_sec
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcChildWkArea && child's work area
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcChildWkArea=SELECT()
SELECT (lcChildWkArea)
lcChildID=ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA
pcChildDBF=dbf(lcChildWkArea)
pnChildRec=recno(lcChildWkArea)
pcChildID=lcChildID
pcChildExpr="ANO_EJE+SEC_EJEC+SEC_EJEC2+SEC_NOTA"
lcParentWkArea=riopen("nota_modificatoria_cab","mp_notacab")
IF lcParentWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcParentDBF=dbf(lcParentWkArea)
llRetVal=SEEK(lcChildID,lcParentWkArea)
pnParentRec=recno(lcParentWkArea)
=rireuse("nota_modificatoria_cab",lcParentWkArea)
IF NOT llRetVal
pnError = rierror(-1,"Insert restrict rule violated.","","")
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity insert trigger for" nota_modificatoria_sec
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" operacion_contable_ejecutora
PROCEDURE __RI_DELETE_operacion_contable_ejecutora
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+SEC_EJEC+SECUENCIA_OPER TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER"
lcChildWkArea=riopen("asiento","oper_ctb")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER
pcChildExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("asiento",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" operacion_contable_ejecutora
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_operacion_contable_ejecutora
** "Referential integrity update trigger for" operacion_contable_ejecutora
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+SEC_EJEC+SECUENCIA_OPER")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER"
lcParentID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("asiento")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO oper_ctb IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+SEC_EJEC+SECUENCIA_OPER
pcChildExpr="ANO_EJE+SEC_EJEC+SECUENCIA_OPER"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("asiento",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" operacion_contable_ejecutora
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" origen
PROCEDURE __RI_DELETE_origen
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE ANO_EJE+ORIGEN TO lcParentID,pcParentID
pcParentExpr="ANO_EJE+ORIGEN"
lcChildWkArea=riopen("fuente_financ","origen")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+ORIGEN
pcChildExpr="ANO_EJE+ORIGEN"
IF !llRetVal
pnError = rierror(-1,"Delete restrict rule violated.","","")
ENDIF
=rireuse("fuente_financ",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Delete trigger for" origen
********************************************************************************

********************************************************************************
procedure __RI_UPDATE_origen
** "Referential integrity update trigger for" origen
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcOldParentID && previous parent id value
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcChildID && child's value to be sought in parent
LOCAL lcOldChildID && old child id value
LOCAL lcParentWkArea && parentwork area handle returned by riopen
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
lcOldParentID=OLDVAL("ANO_EJE+ORIGEN")
pcParentID=lcOldParentID
pcParentExpr="ANO_EJE+ORIGEN"
lcParentID=ANO_EJE+ORIGEN
IF lcParentID<>lcOldParentID
lcChildWkArea=riopen("fuente_financ")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
SET ORDER TO origen IN (lcChildWkArea)
llRetVal=!SEEK(lcOldParentID,lcChildWkArea)
pnChildRec=recno()
pcChildID=ANO_EJE+ORIGEN
pcChildExpr="ANO_EJE+ORIGEN"
IF !llRetVal
pnError = rierror(-1,"Update restrict rule violated.","","")
ENDIF
=rireuse("fuente_financ",lcChildWkArea)
IF NOT llRetVal
IF _triggerlevel=1
DO riend WITH llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
ENDIF
ENDIF this parent id changed
IF _triggerlevel=1
do riend with llRetVal
ENDIF at the end of the highest trigger level
SELECT (lcStartArea)
RETURN llRetVal
** "End of Referential integrity Update trigger for" origen
********************************************************************************

********************************************************************************
** "Referential integrity delete trigger for" padron_persona
PROCEDURE __RI_DELETE_padron_persona
LOCAL llRetVal
llRetVal = .t.
PRIVATE pcParentDBF,pnParentRec,pcChildDBF,pnChildRec,pcParentID,pcChildID
PRIVATE pcParentExpr,pcChildExpr
STORE "" TO pcParentDBF,pcChildDBF,pcParentID,pcChildID,pcParentExpr,pcChildExpr
STORE 0 TO pnParentRec,pnChildRec
IF _triggerlevel=1
BEGIN TRANSACTION
PRIVATE pcRIcursors,pcRIwkareas,pcRIolderror,pnerror,;
pcOldDele,pcOldExact,pcOldTalk,pcOldCompat,PcOldDBC
pcOldTalk=SET("TALK")
SET TALK OFF
pcOldDele=SET("DELETED")
pcOldExact=SET("EXACT")
pcOldCompat=SET("COMPATIBLE")
SET COMPATIBLE OFF
SET DELETED ON
SET EXACT OFF
pcRIcursors=""
pcRIwkareas=""
pcRIolderror=ON("error")
pnerror=0
ON ERROR pnerror=rierror(ERROR(),message(),message(1),program())
IF TYPE('gaErrors(1)')<>"U"
release gaErrors
ENDIF
PUBLIC gaErrors(1,12)
pcOldDBC=DBC()
SET DATA TO ("SIAF")
ENDIF first trigger
LOCAL lcParentID && parent's value to be sought in child
LOCAL lcChildWkArea && child work area handle returned by riopen
LOCAL lcParentWkArea
LOCAL llDelHeaderarea
LOCAL lcStartArea
lcStartArea=select()
llRetVal=.t.
lcParentWkArea=select()
SELECT (lcParentWkArea)
pcParentDBF=dbf()
pnParentRec=recno()
STORE TIPO_DOCUMENTO+NUMERO_DOCUMENTO TO lcParentID,pcParentID
pcParentExpr="TIPO_DOCUMENTO+NUMERO_DOCUMENTO"
lcChildWkArea=riopen("padron_persona_log","padron")
IF lcChildWkArea<=0
IF _triggerlevel=1
DO riend WITH .F.
ENDIF at the end of the highest trigger level
RETURN .F.
ENDIF not able to open the child work area
pcChildDBF=dbf(lcChildWkArea)
llRetVal=!SEEK(lcParentID,lcChildWkArea)
SELECT (lcChildWkArea)
pnChildRec=