GO
DROP TRIGGER trig_BANK
GO
CREATE TRIGGER trig_BANK
ON BANK
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE BANK SET STKMODIFY=1
			from bank,deleted 
			where bank.BANKID=deleted.BANKID and bank.stkreceive=0
	END

GO

--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_CITY
GO
CREATE TRIGGER trig_CITY
ON CITY
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE CITY SET STKMODIFY=1
			from CITY,deleted 
			where CITY.CITYID=deleted.CITYID and CITY.stkreceive=0
	END

GO

--------------------------------------------------------------------------------------------------------------------
DROP TRIGGER trig_COMPETITION
GO
CREATE TRIGGER trig_COMPETITION
ON COMPETITION
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE COMPETITION SET STKMODIFY=1
			from COMPETITION,deleted 
			where COMPETITION.COMPETITIONID=deleted.COMPETITIONID and COMPETITION.stkreceive=0
	END

GO

--select * from COMPETITION

--------------------------------------------------------------------------------------------------------------------
DROP TRIGGER trig_COUNTRY
GO
CREATE TRIGGER trig_COUNTRY
ON COUNTRY
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE COUNTRY SET STKMODIFY=1
			from COUNTRY,deleted 
			where COUNTRY.COUNTRYID=deleted.COUNTRYID and COUNTRY.stkreceive=0
	END

GO

--select * from COUNTRY
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_CURRENCY
GO
CREATE TRIGGER trig_CURRENCY
ON CURRENCY
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE CURRENCY SET STKMODIFY=1
			from CURRENCY,deleted 
			where CURRENCY.CURYID=deleted.CURYID and CURRENCY.stkreceive=0
	END

GO
--select * from CURRENCY

--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_CURYRATETYPE
GO
CREATE TRIGGER trig_CURYRATETYPE
ON CURYRATETYPE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE CURYRATETYPE SET STKMODIFY=1
			from CURYRATETYPE,deleted 
			where CURYRATETYPE.CURYTYPEID=deleted.CURYTYPEID and CURYRATETYPE.stkreceive=0
	END

GO
--select * from CURYRATETYPE
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_CUSTOMER
GO
CREATE TRIGGER trig_CUSTOMER
ON CUSTOMER
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE CUSTOMER SET STKMODIFY=1
			from CUSTOMER,deleted 
			where CUSTOMER.CUSTIDSS=deleted.CUSTIDSS and CUSTOMER.stkreceive=0
	END

GO
--select * from CUSTOMER
--------------------------------------------------------------------------------------------------------------------


DROP TRIGGER trig_CUSTSTATUS
GO
CREATE TRIGGER trig_CUSTSTATUS
ON CUSTSTATUS
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE CUSTSTATUS SET STKMODIFY=1
			from CUSTSTATUS,deleted 
			where CUSTSTATUS.CUSTSTATUSID=deleted.CUSTSTATUSID and CUSTSTATUS.stkreceive=0
	END

GO
--select * from CUSTSTATUS
--------------------------------------------------------------------------------------------------------------------
DROP TRIGGER trig_CUSTWARRANTY
GO
CREATE TRIGGER trig_CUSTWARRANTY
ON CUSTWARRANTY
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE CUSTWARRANTY SET STKMODIFY=1
			from CUSTWARRANTY,deleted 
			where CUSTWARRANTY.CUSTWARRANTYTYPEID= deleted.CUSTWARRANTYTYPEID AND CUSTWARRANTY.CUSTIDSS=deleted.CUSTIDSS
			and CUSTWARRANTY.stkreceive=0
	END

GO
--select * from CUSTWARRANTY

--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_CUSTWARRANTYTYPE
GO
CREATE TRIGGER trig_CUSTWARRANTYTYPE
ON CUSTWARRANTYTYPE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE CUSTWARRANTYTYPE SET STKMODIFY=1
			from CUSTWARRANTYTYPE,deleted 
			where CUSTWARRANTYTYPE.CUSTWARRANTYTYPEID= deleted.CUSTWARRANTYTYPEID and CUSTWARRANTYTYPE.stkreceive=0
	END		                       

GO
--select * from CUSTWARRANTYTYPE

--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_DOCTYPE
GO
CREATE TRIGGER trig_DOCTYPE
ON DOCTYPE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE DOCTYPE SET STKMODIFY=1
			from DOCTYPE,deleted 
			where DOCTYPE.DOCTYPEID= deleted.DOCTYPEID and DOCTYPE.stkreceive=0
	END		                       

GO
--select * from DOCTYPE

--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_CATEGORY
GO
CREATE TRIGGER trig_IN_CATEGORY
ON IN_CATEGORY
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_CATEGORY SET STKMODIFY=1
			from IN_CATEGORY,deleted 
			where IN_CATEGORY.CLASSID= deleted.CLASSID and IN_CATEGORY.stkreceive=0
	END		                       

GO
--select * from IN_CATEGORY
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_in_classvendor
GO
CREATE TRIGGER trig_in_classvendor
ON in_classvendor
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE in_classvendor SET STKMODIFY=1
			from in_classvendor,deleted 
			where in_classvendor.CLASSVENDORID= deleted.CLASSVENDORID and in_classvendor.stkreceive=0
	END		                       

GO
--select * from in_classvendor
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_DOCSTATUS
GO
CREATE TRIGGER trig_IN_DOCSTATUS
ON IN_DOCSTATUS
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_DOCSTATUS SET STKMODIFY=1
			from IN_DOCSTATUS,deleted 
			where IN_DOCSTATUS.DOCSTATUSID= deleted.DOCSTATUSID and IN_DOCSTATUS.stkreceive=0
	END		                       

GO
--select * from IN_DOCSTATUS
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_INVENTORY
GO
CREATE TRIGGER trig_IN_INVENTORY
ON IN_INVENTORY
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_INVENTORY SET STKMODIFY=1
			from IN_INVENTORY,deleted 
			where IN_INVENTORY.INVTIDSKU= deleted.INVTIDSKU and IN_INVENTORY.stkreceive=0
	END		                       

GO

--select * from IN_INVENTORY
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_INVENTORYALTER
GO
CREATE TRIGGER trig_IN_INVENTORYALTER
ON IN_INVENTORYALTER
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_INVENTORYALTER SET STKMODIFY=1
			from IN_INVENTORYALTER,deleted 
			where IN_INVENTORYALTER.INVTIDSKU= deleted.INVTIDSKU AND IN_INVENTORYALTER.INVTIDBARR= deleted.INVTIDBARR
			and IN_INVENTORYALTER.stkreceive=0
	END		                       

GO
--select * from IN_INVENTORYALTER
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_INVENTORYDAT
GO
CREATE TRIGGER trig_IN_INVENTORYDAT
ON IN_INVENTORYDAT
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_INVENTORYDAT SET STKMODIFY=1
			from IN_INVENTORYDAT,deleted 
			where IN_INVENTORYDAT.INVTIDSKU= deleted.INVTIDSKU AND IN_INVENTORYDAT.SITEID= deleted.SITEID
			and IN_INVENTORYDAT.stkreceive=0
	END		                       

GO
--select * from IN_INVENTORYDAT
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_INVENTORYDES
GO
CREATE TRIGGER trig_IN_INVENTORYDES
ON IN_INVENTORYDES
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_INVENTORYDES SET STKMODIFY=1
			from IN_INVENTORYDES,deleted 
			where IN_INVENTORYDES.INVTIDSKU= deleted.INVTIDSKU and IN_INVENTORYDES.stkreceive=0
	END		                       
GO

--select * from IN_INVENTORYDES
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_INVENTORYTYPE
GO

CREATE TRIGGER trig_IN_INVENTORYTYPE
ON IN_INVENTORYTYPE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_INVENTORYTYPE SET STKMODIFY=1
			from IN_INVENTORYTYPE,deleted 
			where IN_INVENTORYTYPE.INVTYPEID= deleted.INVTYPEID and IN_INVENTORYTYPE.stkreceive=0
	END		                       
GO

--select * from IN_INVENTORYTYPE
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_INVENTORYUNITMED
GO

CREATE TRIGGER trig_IN_INVENTORYUNITMED
ON IN_INVENTORYUNITMED
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_INVENTORYUNITMED SET STKMODIFY=1
			from IN_INVENTORYUNITMED,deleted 
			where IN_INVENTORYUNITMED.STKUNITID= deleted.STKUNITID and IN_INVENTORYUNITMED.stkreceive=0
	END		      
GO
                 
--select * from IN_INVENTORYUNITMED
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_KDXHIST
GO

CREATE TRIGGER trig_IN_KDXHIST
ON IN_KDXHIST
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
	UPDATE IN_KDXHIST SET STKMODIFY=1
	from IN_KDXHIST,deleted 
	where IN_KDXHIST.YEARHIST= deleted.YEARHIST AND IN_KDXHIST.SITEID= deleted.SITEID AND IN_KDXHIST.INVTIDSKU= deleted.INVTIDSKU
	      and (IN_KDXHIST.stkreceive=0 or IN_KDXHIST.stkreceive=1) 
	
END		                       
GO

--select * from trig_IN_KDXHIST
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_KIT
GO

CREATE TRIGGER trig_IN_KIT
ON IN_KIT
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_KIT SET STKMODIFY=1
			from IN_KIT,deleted 
			where IN_KIT.KITID= deleted.KITID and IN_KIT.stkreceive=0
	END		                       

GO

--select * from IN_KIT
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_in_kitcomponent
GO

CREATE TRIGGER trig_in_kitcomponent
ON in_kitcomponent
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE in_kitcomponent SET STKMODIFY=1
			from in_kitcomponent,deleted 
			where in_kitcomponent.KITID= deleted.KITID AND in_kitcomponent.INVTIDSKU= deleted.INVTIDSKU
			and in_kitcomponent.stkreceive=0
	END		                       

GO

--select * from in_kitcomponent
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_PRICELEVELTEM
GO

CREATE TRIGGER trig_IN_PRICELEVELTEM
ON IN_PRICELEVELTEM
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_PRICELEVELTEM SET STKMODIFY=1
		from IN_PRICELEVELTEM,deleted 
		where IN_PRICELEVELTEM.BATNBRPRICELEVELTEM= deleted.BATNBRPRICELEVELTEM AND IN_PRICELEVELTEM.SITEID= deleted.SITEID
			and IN_PRICELEVELTEM.stkreceive=0
	END		                       

GO

--select * from IN_PRICELEVELTEM
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_PRICELEVELTEMDET
GO

CREATE TRIGGER trig_IN_PRICELEVELTEMDET
ON IN_PRICELEVELTEMDET
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_PRICELEVELTEMDET SET STKMODIFY=1
			from IN_PRICELEVELTEMDET,deleted 
			where 	IN_PRICELEVELTEMDET.BATNBRPRICELEVELTEM= deleted.BATNBRPRICELEVELTEM AND 
				IN_PRICELEVELTEMDET.SITEID= deleted.SITEID AND IN_PRICELEVELTEMDET.SEQUENCE= deleted.SEQUENCE
				and IN_PRICELEVELTEMDET.stkreceive=0

	END		                       

GO

--select * from IN_PRICELEVELTEMDET
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_PRICELEVELTYPE
GO

CREATE TRIGGER trig_IN_PRICELEVELTYPE
ON IN_PRICELEVELTYPE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_PRICELEVELTYPE SET STKMODIFY=1
			from IN_PRICELEVELTYPE,deleted 
			where 	IN_PRICELEVELTYPE.PRECLVID= deleted.PRECLVID and IN_PRICELEVELTYPE.stkreceive=0

	END		                       

GO

--select * from IN_PRICELEVELTYPE
--------------------------------------------------------------------------------------------------------------------
DROP TRIGGER trig_IN_SUBCATEGORY
GO
CREATE TRIGGER trig_IN_SUBCATEGORY
ON IN_SUBCATEGORY
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_SUBCATEGORY SET STKMODIFY=1
			from IN_SUBCATEGORY,deleted 
			where IN_SUBCATEGORY.CLASSUBID= deleted.CLASSUBID and IN_SUBCATEGORY.CLASSID= deleted.CLASSID and 
			IN_SUBCATEGORY.stkreceive=0

	END		                       

GO

--select * from IN_SUBCATEGORY
--------------------------------------------------------------------------------------------------------------------
DROP TRIGGER trig_IN_TYPEDOC
GO
CREATE TRIGGER trig_IN_TYPEDOC
ON IN_TYPEDOC
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_TYPEDOC SET STKMODIFY=1
			from IN_TYPEDOC,deleted 
			where IN_TYPEDOC.TYPEDOCID= deleted.TYPEDOCID AND IN_TYPEDOC.stkreceive=0

	END		                       

GO
--select * from IN_TYPEDOC
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_IN_VENDOR
GO

CREATE TRIGGER trig_IN_VENDOR
ON IN_VENDOR
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_VENDOR SET STKMODIFY=1
			from IN_VENDOR,deleted 
			where IN_VENDOR.VENDIDSS= deleted.VENDIDSS AND IN_VENDOR.stkreceive=0

	END		                       

GO

--select * from IN_VENDOR
--------------------------------------------------------------------------------------------------------------------


DROP TRIGGER trig_IN_VENDORINVT
GO

CREATE TRIGGER trig_IN_VENDORINVT
ON IN_VENDORINVT
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE IN_VENDORINVT SET STKMODIFY=1
			from 	IN_VENDORINVT,deleted 
			where 	IN_VENDORINVT.VENDIDSS= deleted.VENDIDSS AND IN_VENDORINVT.INVTIDSKU= deleted.INVTIDSKU AND 
				IN_VENDORINVT.SITEID= deleted.SITEID AND
				IN_VENDORINVT.stkreceive=0 

	END		                       

GO

--select * from IN_VENDORINVT
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_OP_BONUS
GO

CREATE TRIGGER trig_OP_BONUS
ON OP_BONUS
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_BONUS SET STKMODIFY=1
			from 	OP_BONUS,deleted 
			where 	OP_BONUS.DOCTYPEID= deleted.DOCTYPEID AND OP_BONUS.NBRDOCUMENT= deleted.NBRDOCUMENT AND 
				 OP_BONUS.CUSTIDSS= deleted.CUSTIDSS AND OP_BONUS.SITEID= deleted.SITEID AND
				OP_BONUS.NBRBONUS= deleted.NBRBONUS AND	OP_BONUS.stkreceive=0 

	END		                       


GO

--select * from OP_BONUS
--------------------------------------------------------------------------------------------------------------------
DROP TRIGGER trig_OP_BUSINESSTYPE
GO

CREATE TRIGGER trig_OP_BUSINESSTYPE
ON OP_BUSINESSTYPE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_BUSINESSTYPE SET STKMODIFY=1
			from 	OP_BUSINESSTYPE,deleted 
			where 	OP_BUSINESSTYPE.BUSINESSTYPE= deleted.BUSINESSTYPE AND OP_BUSINESSTYPE.stkreceive=0 

	END		                       

GO

--select * from OP_BUSINESSTYPE
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_OP_CARD
GO

CREATE TRIGGER trig_OP_CARD
ON OP_CARD
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_CARD SET STKMODIFY=1
			from 	OP_CARD,deleted 
			where 	OP_CARD.CARDID= deleted.CARDID AND OP_CARD.stkreceive=0 

	END		                       

GO

--select * from OP_CARD
--------------------------------------------------------------------------------------------------------------------


DROP TRIGGER trig_OP_CCSALESPERSONTYPE
GO

CREATE TRIGGER trig_OP_CCSALESPERSONTYPE
ON OP_CCSALESPERSONTYPE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_CCSALESPERSONTYPE SET STKMODIFY=1
			from 	OP_CCSALESPERSONTYPE,deleted 
			where 	OP_CCSALESPERSONTYPE.CCSALESPERSONTYPEID= deleted.CCSALESPERSONTYPEID 
				AND OP_CCSALESPERSONTYPE.stkreceive=0 

	END		                       

GO

--select * from OP_CCSALESPERSONTYPE
--------------------------------------------------------------------------------------------------------------------


DROP TRIGGER trig_OP_CUST_LIMIT
GO

CREATE TRIGGER trig_OP_CUST_LIMIT
ON OP_CUST_LIMIT
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_CUST_LIMIT SET STKMODIFY=1
			from 	OP_CUST_LIMIT,deleted 
			where 	OP_CUST_LIMIT.CUSTIDSS= deleted.CUSTIDSS AND OP_CUST_LIMIT.SITEID= deleted.SITEID
				AND OP_CUST_LIMIT.stkreceive=0 

	END		                       

GO

--select * from OP_CUST_LIMIT
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_OP_CUSTBADGE
GO

CREATE TRIGGER trig_OP_CUSTBADGE
ON OP_CUSTBADGE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_CUSTBADGE SET STKMODIFY=1
			from 	OP_CUSTBADGE,deleted 
			where 	OP_CUSTBADGE.CUSTIDSS= deleted.CUSTIDSS AND OP_CUSTBADGE.BADGE= deleted.BADGE
				AND OP_CUSTBADGE.stkreceive=0 

	END		                       

GO

--select * from OP_CUSTBADGE
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_OP_CUSTCARD
GO

CREATE TRIGGER trig_OP_CUSTCARD
ON OP_CUSTCARD
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_CUSTCARD SET STKMODIFY=1
			from 	OP_CUSTCARD,deleted 
			where 	OP_CUSTCARD.CUSTIDSS= deleted.CUSTIDSS AND OP_CUSTCARD.CARDPASSWORD= deleted.CARDPASSWORD
				AND OP_CUSTCARD.stkreceive=0 

	END		                       

GO

--select * from OP_CUSTCARD
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_OP_CUSTCLASS
GO

CREATE TRIGGER trig_OP_CUSTCLASS
ON OP_CUSTCLASS
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_CUSTCLASS SET STKMODIFY=1
			from 	OP_CUSTCLASS,deleted 
			where 	OP_CUSTCLASS.CUSTCLASSID= deleted.CUSTCLASSID AND OP_CUSTCLASS.stkreceive=0 

	END		                       

GO

--select * from OP_CUSTCLASS
--------------------------------------------------------------------------------------------------------------------


DROP TRIGGER trig_OP_CUSTOMER_PRCLVL
GO

CREATE TRIGGER trig_OP_CUSTOMER_PRCLVL
ON OP_CUSTOMER_PRCLVL
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_CUSTOMER_PRCLVL SET STKMODIFY=1
			from 	OP_CUSTOMER_PRCLVL,deleted 
			where 	OP_CUSTOMER_PRCLVL.CUSTIDSS= deleted.CUSTIDSS 
				AND OP_CUSTOMER_PRCLVL.PRCLVLCUSTID= deleted.PRCLVLCUSTID
				AND OP_CUSTOMER_PRCLVL.stkreceive=0 

	END		                       

GO

--select * from OP_CUSTOMER_PRCLVL
--------------------------------------------------------------------------------------------------------------------
DROP TRIGGER trig_OP_CUSTZONE
GO

CREATE TRIGGER trig_OP_CUSTZONE
ON OP_CUSTZONE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_CUSTZONE SET STKMODIFY=1
			from 	OP_CUSTZONE,deleted 
			where 	OP_CUSTZONE.CUSTZONEID= deleted.CUSTZONEID AND OP_CUSTZONE.stkreceive=0 

	END		                       

GO

--select * from OP_CUSTZONE
--------------------------------------------------------------------------------------------------------------------


DROP TRIGGER trig_OP_DEPOSITTYPE
GO

CREATE TRIGGER trig_OP_DEPOSITTYPE
ON OP_DEPOSITTYPE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_DEPOSITTYPE SET STKMODIFY=1
			from 	OP_DEPOSITTYPE,deleted 
			where 	OP_DEPOSITTYPE.DEPOSITTYPEID= deleted.DEPOSITTYPEID AND OP_DEPOSITTYPE.stkreceive=0 

	END		                       

GO

--select * from OP_DEPOSITTYPE
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_OP_DOCREFERENCE
GO

CREATE TRIGGER trig_OP_DOCREFERENCE
ON OP_DOCREFERENCE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_DOCREFERENCE SET STKMODIFY=1
			from 	OP_DOCREFERENCE,deleted 
			where 	OP_DOCREFERENCE.DOCTYPEID= deleted.DOCTYPEID 
				AND OP_DOCREFERENCE.NBRDOCUMENT= deleted.NBRDOCUMENT
				AND OP_DOCREFERENCE.SITEID= deleted.SITEID
				AND OP_DOCREFERENCE.DOCTYPEIDREF= deleted.DOCTYPEIDREF
				AND OP_DOCREFERENCE.NBRDOCUMENTREF= deleted.NBRDOCUMENTREF
				AND OP_DOCREFERENCE.stkreceive=0 

	END		                       
GO

--select * from OP_DOCREFERENCE
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_OP_DOCSUMMARYTYPE
GO

CREATE TRIGGER trig_OP_DOCSUMMARYTYPE
ON OP_DOCSUMMARYTYPE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_DOCSUMMARYTYPE SET STKMODIFY=1
			from 	OP_DOCSUMMARYTYPE,deleted 
			where 	OP_DOCSUMMARYTYPE.DOCSUMMARYTYPEID= deleted.DOCSUMMARYTYPEID
				and OP_DOCSUMMARYTYPE.SITEID= deleted.SITEID
				AND OP_DOCSUMMARYTYPE.stkreceive=0 

	END		                       
GO

--select * from OP_DOCSUMMARYTYPE
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_OP_PRCLVLCUST
GO

CREATE TRIGGER trig_OP_PRCLVLCUST
ON OP_PRCLVLCUST
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_PRCLVLCUST SET STKMODIFY=1
			from 	OP_PRCLVLCUST,deleted 
			where 	OP_PRCLVLCUST.PRCLVLCUSTID= deleted.PRCLVLCUSTID
				and OP_PRCLVLCUST.SITEID= deleted.SITEID
				AND OP_PRCLVLCUST.stkreceive=0 

	END		                       
GO

--select * from OP_PRCLVLCUST
--------------------------------------------------------------------------------------------------------------------


DROP TRIGGER trig_OP_PRCLVLCUSTDET
GO

CREATE TRIGGER trig_OP_PRCLVLCUSTDET
ON OP_PRCLVLCUSTDET
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_PRCLVLCUSTDET SET STKMODIFY=1
			from 	OP_PRCLVLCUSTDET,deleted 
			where 	OP_PRCLVLCUSTDET.PRCLVLCUSTID= deleted.PRCLVLCUSTID
				and OP_PRCLVLCUSTDET.SITEID= deleted.SITEID
				and OP_PRCLVLCUSTDET.INVTIDSKU= deleted.INVTIDSKU
				AND OP_PRCLVLCUSTDET.stkreceive=0 

	END		                       
GO

--select * from OP_PRCLVLCUSTDET
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_OP_PRINTERTYPE
GO

CREATE TRIGGER trig_OP_PRINTERTYPE
ON OP_PRINTERTYPE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_PRINTERTYPE SET STKMODIFY=1
			from 	OP_PRINTERTYPE,deleted 
			where 	OP_PRINTERTYPE.PRINTERTYPEID= deleted.PRINTERTYPEID
				AND OP_PRINTERTYPE.stkreceive=0 

	END		                       
GO

--select * from OP_PRINTERTYPE
--------------------------------------------------------------------------------------------------------------------

DROP TRIGGER trig_OP_PROMOTIONCARD
GO

CREATE TRIGGER trig_OP_PROMOTIONCARD
ON OP_PROMOTIONCARD
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_PROMOTIONCARD SET STKMODIFY=1
			from 	OP_PROMOTIONCARD,deleted 
			where 	OP_PROMOTIONCARD.PROMOTIONCARDID= deleted.PROMOTIONCARDID
				AND OP_PROMOTIONCARD.stkreceive=0 

	END		                       
GO

--select * from OP_PROMOTIONCARD
----------------------------

DROP TRIGGER trig_OP_PROMOTIONCARDTYPE
GO

CREATE TRIGGER trig_OP_PROMOTIONCARDTYPE
ON OP_PROMOTIONCARDTYPE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_PROMOTIONCARDTYPE SET STKMODIFY=1
			from 	OP_PROMOTIONCARDTYPE,deleted 
			where 	OP_PROMOTIONCARDTYPE.PROMOTIONCARDTYPE= deleted.PROMOTIONCARDTYPE
				AND OP_PROMOTIONCARDTYPE.stkreceive=0 

	END		                       
GO

--select * from OP_PROMOTIONCARDTYPE
----------------------------

DROP TRIGGER trig_OP_SALESPERSON
GO

CREATE TRIGGER trig_OP_SALESPERSON
ON OP_SALESPERSON
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_SALESPERSON SET STKMODIFY=1
			from 	OP_SALESPERSON,deleted 
			where 	OP_SALESPERSON.SALESPERID= deleted.SALESPERID
				AND OP_SALESPERSON.stkreceive=0 

	END		                       
GO

--select * from OP_SALESPERSON
----------------------------

DROP TRIGGER trig_OP_STATUSPERSON
GO

CREATE TRIGGER trig_OP_STATUSPERSON
ON OP_STATUSPERSON
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE OP_STATUSPERSON SET STKMODIFY=1
			from 	OP_STATUSPERSON,deleted 
			where 	OP_STATUSPERSON.STATUSPERSONID= deleted.STATUSPERSONID
				AND OP_STATUSPERSON.stkreceive=0 

	END		                       
GO

--select * from OP_STATUSPERSON
----------------------------

DROP TRIGGER trig_SE_ACCESSDETRIGHTS
GO

CREATE TRIGGER trig_SE_ACCESSDETRIGHTS
ON SE_ACCESSDETRIGHTS
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE SE_ACCESSDETRIGHTS SET STKMODIFY=1
			from 	SE_ACCESSDETRIGHTS,deleted 
			where 	SE_ACCESSDETRIGHTS.USERID= deleted.USERID
				AND SE_ACCESSDETRIGHTS.stkreceive=0 

	END		                       
GO

--select * from SE_ACCESSDETRIGHTS
----------------------------

DROP TRIGGER trig_SE_GROUPREC
GO

CREATE TRIGGER trig_SE_GROUPREC
ON SE_GROUPREC
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE SE_GROUPREC SET STKMODIFY=1
			from 	SE_GROUPREC,deleted 
			where 	SE_GROUPREC.GROUPID= deleted.GROUPID
				AND SE_GROUPREC.stkreceive=0 

	END		                       
GO

--select * from SE_GROUPREC
----------------------------

DROP TRIGGER trig_SE_MODULE
GO

CREATE TRIGGER trig_SE_MODULE
ON SE_MODULE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE SE_MODULE SET STKMODIFY=1
			from 	SE_MODULE,deleted 
			where 	SE_MODULE.MODULEID= deleted.MODULEID
				AND SE_MODULE.stkreceive=0 

	END		                       
GO

--select * from SE_MODULE
----------------------------


DROP TRIGGER trig_SE_SCREEN
GO

CREATE TRIGGER trig_SE_SCREEN
ON SE_SCREEN
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE SE_SCREEN SET STKMODIFY=1
			from 	SE_SCREEN,deleted 
			where 	SE_SCREEN.SCREENID= deleted.SCREENID
				AND SE_SCREEN.stkreceive=0 

	END		                       
GO

--select * from SE_SCREEN
----------------------------------------------------------------------------------------------------

DROP TRIGGER trig_SE_USERGROUP
GO

CREATE TRIGGER trig_SE_USERGROUP
ON SE_USERGROUP
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE SE_USERGROUP SET STKMODIFY=1
			from 	SE_USERGROUP,deleted 
			where 	SE_USERGROUP.USERID= deleted.USERID AND SE_USERGROUP.GROUPID= deleted.GROUPID
				AND SE_USERGROUP.stkreceive=0 

	END		                       
GO

--select * from SE_USERGROUP
----------------------------------------------------------------------------------------------------

DROP TRIGGER trig_SE_USERREC
GO

CREATE TRIGGER trig_SE_USERREC
ON SE_USERREC
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE SE_USERREC SET STKMODIFY=1
			from 	SE_USERREC,deleted 
			where 	SE_USERREC.USERID= deleted.USERID AND SE_USERREC.stkreceive=0 

	END		                       
GO

--select * from SE_USERREC
----------------------------------------------------------------------------------------------------

DROP TRIGGER trig_SH_SHIPPINGTABLES
GO

CREATE TRIGGER trig_SH_SHIPPINGTABLES
ON SH_SHIPPINGTABLES
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE SH_SHIPPINGTABLES SET STKMODIFY=1
			from 	SH_SHIPPINGTABLES,deleted 
			where 	SH_SHIPPINGTABLES.TABLEID= deleted.TABLEID AND SH_SHIPPINGTABLES.stkreceive=0 

	END		                       
GO

--select * from SH_SHIPPINGTABLES
----------------------------------------------------------------------------------------------------

DROP TRIGGER trig_SITE
GO

CREATE TRIGGER trig_SITE
ON SITE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE SITE SET STKMODIFY=1
			from 	SITE,deleted 
			where 	SITE.SITEID= deleted.SITEID AND SITE.stkreceive=0 

	END		                       
GO

--select * from SITE
----------------------------------------------------------------------------------------------------

DROP TRIGGER trig_STATE
GO

CREATE TRIGGER trig_STATE
ON STATE
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE STATE SET STKMODIFY=1
			from 	STATE,deleted 
			where 	STATE.STATEID= deleted.STATEID AND STATE.stkreceive=0 

	END		                       
GO

--select * from STATE
----------------------------------------------------------------------------------------------------

DROP TRIGGER trig_TAXS
GO

CREATE TRIGGER trig_TAXS
ON TAXS
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE TAXS SET STKMODIFY=1
			from 	TAXS,deleted 
			where 	TAXS.TAXID= deleted.TAXID AND TAXS.stkreceive=0 

	END		                       
GO

--select * from TAXS
----------------------------------------------------------------------------------------------------

DROP TRIGGER trig_TERMS
GO

CREATE TRIGGER trig_TERMS
ON TERMS
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
           IF UPDATE (STKMODIFY)
              BEGIN
                  RETURN
              END  
           ELSE
              BEGIN
		UPDATE TERMS SET STKMODIFY=1
			from 	TERMS,deleted 
			where 	TERMS.TERMID= deleted.TERMID AND TERMS.stkreceive=0 
              END 
	END		                       
GO

--select * from TERMS
----------------------------------------------------------------------------------------------------

DROP TRIGGER trig_TYPEPAYMENT
GO

CREATE TRIGGER trig_TYPEPAYMENT
ON TYPEPAYMENT
FOR UPDATE

AS 

--IF( >0 )	--SI SE HA MODIFICADO ALGUNA FILA
	BEGIN	
		
		UPDATE TYPEPAYMENT SET STKMODIFY=1
			from 	TYPEPAYMENT,deleted 
			where 	TYPEPAYMENT.TYPEPAYMENTID= deleted.TYPEPAYMENTID AND TYPEPAYMENT.stkreceive=0 

	END		                       
GO

----------------------------------------------------------------------------------------------------
