create trigger NoteBook_NoteBook on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete NoteBook from deleted where NoteBook=Obj
end
go
create view NoteBookObj as
select Obj,Cls,WriteDate,Content,NoteDate,Done,Owner
from Obj join NoteBook on NoteBook=Obj
go
create trigger NoteBookObj_Ins on NoteBookObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'NoteBook'
from inserted
insert NoteBook(NoteBook,WriteDate,Content,NoteDate,Done,Owner)
select Obj,WriteDate,Content,NoteDate,Done,Owner
from inserted
go
create trigger NoteBookObj_Upd on NoteBookObj instead of update as
set nocount on
if update(WriteDate) or update(Content) or update(NoteDate) or update(Done) or update(Owner)
update NoteBook set WriteDate=inserted.WriteDate,Content=inserted.Content,NoteDate=inserted.NoteDate,Done=inserted.Done,Owner=inserted.Owner
from inserted where NoteBook=Obj
go
create trigger NoteBookObj_Del on NoteBookObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Our_Our on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Our from deleted where Our=Obj
end
go
create view OurObj as
select Obj,Cls,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee
from Obj join Our on Our=Obj
go
create trigger OurObj_Ins on OurObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Our'
from inserted
insert Our(Our,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee)
select Obj,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee
from inserted
go
create trigger OurObj_Upd on OurObj instead of update as
set nocount on
if update(OurOrgan) or update(Name) or update(Namee) or update(Tel) or update(Fax) or update(Email) or update(Web) or update(Address) or update(Addresse)
or update(PostCode) or update(Resume) or update(Resumee)
update Our set OurOrgan=inserted.OurOrgan,Name=inserted.Name,Namee=inserted.Namee,Tel=inserted.Tel,Fax=inserted.Fax,Email=inserted.Email,Web=inserted.Web,Address=inserted.Address,Addresse=inserted.Addresse,
PostCode=inserted.PostCode,Resume=inserted.Resume,Resumee=inserted.Resumee
from inserted where Our=Obj
go
create trigger OurObj_Del on OurObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Doc_Doc on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Doc from deleted where Doc=Obj
end
go
create view DocObj as
select Obj,Cls,DocTime,Owner,State
from Obj join Doc on Doc=Obj
go
create trigger DocObj_Ins on DocObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Doc'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
go
create trigger DocObj_Upd on DocObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
go
create trigger DocObj_Del on DocObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Organ_Organ on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Organ from deleted where Organ=Obj
end
go
create view OrganObj as
select Obj,Cls,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee,FullName,FullNamee
from Obj join Our on Our=Obj join Organ on Organ=Obj
go
create trigger OrganObj_Ins on OrganObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Organ'
from inserted
insert Our(Our,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee)
select Obj,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee
from inserted
insert Organ(Organ,FullName,FullNamee)
select Obj,FullName,FullNamee
from inserted
go
create trigger OrganObj_Upd on OrganObj instead of update as
set nocount on
if update(OurOrgan) or update(Name) or update(Namee) or update(Tel) or update(Fax) or update(Email) or update(Web) or update(Address) or update(Addresse)
or update(PostCode) or update(Resume) or update(Resumee)
update Our set OurOrgan=inserted.OurOrgan,Name=inserted.Name,Namee=inserted.Namee,Tel=inserted.Tel,Fax=inserted.Fax,Email=inserted.Email,Web=inserted.Web,Address=inserted.Address,Addresse=inserted.Addresse,
PostCode=inserted.PostCode,Resume=inserted.Resume,Resumee=inserted.Resumee
from inserted where Our=Obj
if update(FullName) or update(FullNamee)
update Organ set FullName=inserted.FullName,FullNamee=inserted.FullNamee
from inserted where Organ=Obj
go
create trigger OrganObj_Del on OrganObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Staffer_Staffer on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Staffer from deleted where Staffer=Obj
end
go
create view StafferObj as
select Obj,Cls,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee,StafferNo,IdentityNo,Sex,Birthday,Nation,NativePlace,EduLevel,Duty,BloodType
,Photo,Signature,StafferRem
from Obj join Our on Our=Obj join Staffer on Staffer=Obj
go
create trigger StafferObj_Ins on StafferObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Staffer'
from inserted
insert Our(Our,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee)
select Obj,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee
from inserted
insert Staffer(Staffer,StafferNo,IdentityNo,Sex,Birthday,Nation,NativePlace,EduLevel,Duty,BloodType
,Photo,Signature,StafferRem)
select Obj,StafferNo,IdentityNo,Sex,Birthday,Nation,NativePlace,EduLevel,Duty,BloodType
,Photo,Signature,StafferRem
from inserted
go
create trigger StafferObj_Upd on StafferObj instead of update as
set nocount on
if update(OurOrgan) or update(Name) or update(Namee) or update(Tel) or update(Fax) or update(Email) or update(Web) or update(Address) or update(Addresse)
or update(PostCode) or update(Resume) or update(Resumee)
update Our set OurOrgan=inserted.OurOrgan,Name=inserted.Name,Namee=inserted.Namee,Tel=inserted.Tel,Fax=inserted.Fax,Email=inserted.Email,Web=inserted.Web,Address=inserted.Address,Addresse=inserted.Addresse,
PostCode=inserted.PostCode,Resume=inserted.Resume,Resumee=inserted.Resumee
from inserted where Our=Obj
if update(StafferNo) or update(IdentityNo) or update(Sex) or update(Birthday) or update(Nation) or update(NativePlace) or update(EduLevel) or update(Duty) or update(BloodType)
or update(Photo) or update(Signature) or update(StafferRem)
update Staffer set StafferNo=inserted.StafferNo,IdentityNo=inserted.IdentityNo,Sex=inserted.Sex,Birthday=inserted.Birthday,Nation=inserted.Nation,NativePlace=inserted.NativePlace,EduLevel=inserted.EduLevel,Duty=inserted.Duty,BloodType=inserted.BloodType,
Photo=inserted.Photo,Signature=inserted.Signature,StafferRem=inserted.StafferRem
from inserted where Staffer=Obj
go
create trigger StafferObj_Del on StafferObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Catalog_Catalog on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Catalog from deleted where Catalog=Obj
end
go
create view CatalogObj as
select Obj,Cls,DocTime,Owner,State,CatalogNo,CatalogName,CatalogNamee,Cux
from Obj join Doc on Doc=Obj join Catalog on Catalog=Obj
go
create trigger CatalogObj_Ins on CatalogObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Catalog'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Catalog(Catalog,CatalogNo,CatalogName,CatalogNamee,Cux)
select Obj,CatalogNo,CatalogName,CatalogNamee,Cux
from inserted
go
create trigger CatalogObj_Upd on CatalogObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(CatalogNo) or update(CatalogName) or update(CatalogNamee) or update(Cux)
update Catalog set CatalogNo=inserted.CatalogNo,CatalogName=inserted.CatalogName,CatalogNamee=inserted.CatalogNamee,Cux=inserted.Cux
from inserted where Catalog=Obj
go
create trigger CatalogObj_Del on CatalogObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Company_Company on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Company from deleted where Company=Obj
end
go
create view CompanyObj as
select Obj,Cls,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee,FullName,FullNamee,CompanyNo,Corporater,President,Country,OrganCode,ImpExpCode,EnterpriseCode,TaxpayerCode,CustomsRegCode
,ForeignRegCode,ManufactureID,EdiLink,CompanyLogo,BankName,BankAccount
from Obj join Our on Our=Obj join Organ on Organ=Obj join Company on Company=Obj
go
create trigger CompanyObj_Ins on CompanyObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Company'
from inserted
insert Our(Our,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee)
select Obj,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee
from inserted
insert Organ(Organ,FullName,FullNamee)
select Obj,FullName,FullNamee
from inserted
insert Company(Company,CompanyNo,Corporater,President,Country,OrganCode,ImpExpCode,EnterpriseCode,TaxpayerCode,CustomsRegCode
,ForeignRegCode,ManufactureID,EdiLink,CompanyLogo,BankName,BankAccount)
select Obj,CompanyNo,Corporater,President,Country,OrganCode,ImpExpCode,EnterpriseCode,TaxpayerCode,CustomsRegCode
,ForeignRegCode,ManufactureID,EdiLink,CompanyLogo,BankName,BankAccount
from inserted
go
create trigger CompanyObj_Upd on CompanyObj instead of update as
set nocount on
if update(OurOrgan) or update(Name) or update(Namee) or update(Tel) or update(Fax) or update(Email) or update(Web) or update(Address) or update(Addresse)
or update(PostCode) or update(Resume) or update(Resumee)
update Our set OurOrgan=inserted.OurOrgan,Name=inserted.Name,Namee=inserted.Namee,Tel=inserted.Tel,Fax=inserted.Fax,Email=inserted.Email,Web=inserted.Web,Address=inserted.Address,Addresse=inserted.Addresse,
PostCode=inserted.PostCode,Resume=inserted.Resume,Resumee=inserted.Resumee
from inserted where Our=Obj
if update(FullName) or update(FullNamee)
update Organ set FullName=inserted.FullName,FullNamee=inserted.FullNamee
from inserted where Organ=Obj
if update(CompanyNo) or update(Corporater) or update(President) or update(Country) or update(OrganCode) or update(ImpExpCode) or update(EnterpriseCode) or update(TaxpayerCode) or update(CustomsRegCode)
or update(ForeignRegCode) or update(ManufactureID) or update(EdiLink) or update(CompanyLogo) or update(BankName) or update(BankAccount)
update Company set CompanyNo=inserted.CompanyNo,Corporater=inserted.Corporater,President=inserted.President,Country=inserted.Country,OrganCode=inserted.OrganCode,ImpExpCode=inserted.ImpExpCode,EnterpriseCode=inserted.EnterpriseCode,TaxpayerCode=inserted.TaxpayerCode,CustomsRegCode=inserted.CustomsRegCode,
ForeignRegCode=inserted.ForeignRegCode,ManufactureID=inserted.ManufactureID,EdiLink=inserted.EdiLink,CompanyLogo=inserted.CompanyLogo,BankName=inserted.BankName,BankAccount=inserted.BankAccount
from inserted where Company=Obj
go
create trigger CompanyObj_Del on CompanyObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Consign_Consign on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Consign from deleted where Consign=Obj
end
go
create view ConsignObj as
select Obj,Cls,DocTime,Owner,State,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText
from Obj join Doc on Doc=Obj join Consign on Consign=Obj
go
create trigger ConsignObj_Ins on ConsignObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Consign'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Consign(Consign,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText)
select Obj,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText
from inserted
go
create trigger ConsignObj_Upd on ConsignObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(ConsignNo) or update(Invoice) or update(ConsignDate) or update(Carrier) or update(Consigner) or update(ConsignerName) or update(ConsignerAddress) or update(ConsignerContact) or update(ConsignerTel)
or update(Consignee) or update(ConsigneeName) or update(ConsigneeAddress) or update(ConsigneeContact) or update(ConsigneeTel) or update(Notifier) or update(NotifierName) or update(NotifierAddress) or update(NotifierContact) or update(NotifierTel)
or update(TransMode) or update(Tranship) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(DischargePort) or update(LoadPlace) or update(DestPlace) or update(LoadLimit) or update(BlNo)
or update(BlDate) or update(BlOrg) or update(BlCpy) or update(VesselFst) or update(Vessel) or update(SailDate) or update(ArrivalDate) or update(FreightPayment) or update(BlSignPlace) or update(PackCount)
or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackGV) or update(PackWunit) or update(PackVunit) or update(ConsignText)
update Consign set ConsignNo=inserted.ConsignNo,Invoice=inserted.Invoice,ConsignDate=inserted.ConsignDate,Carrier=inserted.Carrier,Consigner=inserted.Consigner,ConsignerName=inserted.ConsignerName,ConsignerAddress=inserted.ConsignerAddress,ConsignerContact=inserted.ConsignerContact,ConsignerTel=inserted.ConsignerTel,
Consignee=inserted.Consignee,ConsigneeName=inserted.ConsigneeName,ConsigneeAddress=inserted.ConsigneeAddress,ConsigneeContact=inserted.ConsigneeContact,ConsigneeTel=inserted.ConsigneeTel,Notifier=inserted.Notifier,NotifierName=inserted.NotifierName,NotifierAddress=inserted.NotifierAddress,NotifierContact=inserted.NotifierContact,NotifierTel=inserted.NotifierTel,
TransMode=inserted.TransMode,Tranship=inserted.Tranship,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,DischargePort=inserted.DischargePort,LoadPlace=inserted.LoadPlace,DestPlace=inserted.DestPlace,LoadLimit=inserted.LoadLimit,BlNo=inserted.BlNo,
BlDate=inserted.BlDate,BlOrg=inserted.BlOrg,BlCpy=inserted.BlCpy,VesselFst=inserted.VesselFst,Vessel=inserted.Vessel,SailDate=inserted.SailDate,ArrivalDate=inserted.ArrivalDate,FreightPayment=inserted.FreightPayment,BlSignPlace=inserted.BlSignPlace,PackCount=inserted.PackCount,
PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackGV=inserted.PackGV,PackWunit=inserted.PackWunit,PackVunit=inserted.PackVunit,ConsignText=inserted.ConsignText
from inserted where Consign=Obj
go
create trigger ConsignObj_Del on ConsignObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Declar_Declar on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Declar from deleted where Declar=Obj
end
go
create view DeclarObj as
select Obj,Cls,DocTime,Owner,State,DeclarKey,DeclareNo,Invoice,Company,Nativer,Customs,RecordNo,DeclareDate,Broker
,Consign,TradeMode,TransMode,BlNo,Conveyance,LicenceNo,HexiaoNo,Term,Country,Port
,NativePlace,LevyType,PayMode,Freights,Insufees,Otherfees,OrderNos,PackCount,PackKinds,PackGW
,PackNW,Wunit,WunitCh,ContainerNos,DeclareDocs,Typer,Declarer,FillInDate,Comment
from Obj join Doc on Doc=Obj join Declar on Declar=Obj
go
create trigger DeclarObj_Ins on DeclarObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Declar'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Declar(Declar,DeclarKey,DeclareNo,Invoice,Company,Nativer,Customs,RecordNo,DeclareDate,Broker
,Consign,TradeMode,TransMode,BlNo,Conveyance,LicenceNo,HexiaoNo,Term,Country,Port
,NativePlace,LevyType,PayMode,Freights,Insufees,Otherfees,OrderNos,PackCount,PackKinds,PackGW
,PackNW,Wunit,WunitCh,ContainerNos,DeclareDocs,Typer,Declarer,FillInDate,Comment)
select Obj,DeclarKey,DeclareNo,Invoice,Company,Nativer,Customs,RecordNo,DeclareDate,Broker
,Consign,TradeMode,TransMode,BlNo,Conveyance,LicenceNo,HexiaoNo,Term,Country,Port
,NativePlace,LevyType,PayMode,Freights,Insufees,Otherfees,OrderNos,PackCount,PackKinds,PackGW
,PackNW,Wunit,WunitCh,ContainerNos,DeclareDocs,Typer,Declarer,FillInDate,Comment
from inserted
go
create trigger DeclarObj_Upd on DeclarObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(DeclarKey) or update(DeclareNo) or update(Invoice) or update(Company) or update(Nativer) or update(Customs) or update(RecordNo) or update(DeclareDate) or update(Broker)
or update(Consign) or update(TradeMode) or update(TransMode) or update(BlNo) or update(Conveyance) or update(LicenceNo) or update(HexiaoNo) or update(Term) or update(Country) or update(Port)
or update(NativePlace) or update(LevyType) or update(PayMode) or update(Freights) or update(Insufees) or update(Otherfees) or update(OrderNos) or update(PackCount) or update(PackKinds) or update(PackGW)
or update(PackNW) or update(Wunit) or update(WunitCh) or update(ContainerNos) or update(DeclareDocs) or update(Typer) or update(Declarer) or update(FillInDate) or update(Comment)
update Declar set DeclarKey=inserted.DeclarKey,DeclareNo=inserted.DeclareNo,Invoice=inserted.Invoice,Company=inserted.Company,Nativer=inserted.Nativer,Customs=inserted.Customs,RecordNo=inserted.RecordNo,DeclareDate=inserted.DeclareDate,Broker=inserted.Broker,
Consign=inserted.Consign,TradeMode=inserted.TradeMode,TransMode=inserted.TransMode,BlNo=inserted.BlNo,Conveyance=inserted.Conveyance,LicenceNo=inserted.LicenceNo,HexiaoNo=inserted.HexiaoNo,Term=inserted.Term,Country=inserted.Country,Port=inserted.Port,
NativePlace=inserted.NativePlace,LevyType=inserted.LevyType,PayMode=inserted.PayMode,Freights=inserted.Freights,Insufees=inserted.Insufees,Otherfees=inserted.Otherfees,OrderNos=inserted.OrderNos,PackCount=inserted.PackCount,PackKinds=inserted.PackKinds,PackGW=inserted.PackGW,
PackNW=inserted.PackNW,Wunit=inserted.Wunit,WunitCh=inserted.WunitCh,ContainerNos=inserted.ContainerNos,DeclareDocs=inserted.DeclareDocs,Typer=inserted.Typer,Declarer=inserted.Declarer,FillInDate=inserted.FillInDate,Comment=inserted.Comment
from inserted where Declar=Obj
go
create trigger DeclarObj_Del on DeclarObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Dept_Dept on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Dept from deleted where Dept=Obj
end
go
create view DeptObj as
select Obj,Cls,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee,FullName,FullNamee,DeptNo,Manager
from Obj join Our on Our=Obj join Organ on Organ=Obj join Dept on Dept=Obj
go
create trigger DeptObj_Ins on DeptObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Dept'
from inserted
insert Our(Our,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee)
select Obj,OurOrgan,Name,Namee,Tel,Fax,Email,Web,Address,Addresse
,PostCode,Resume,Resumee
from inserted
insert Organ(Organ,FullName,FullNamee)
select Obj,FullName,FullNamee
from inserted
insert Dept(Dept,DeptNo,Manager)
select Obj,DeptNo,Manager
from inserted
go
create trigger DeptObj_Upd on DeptObj instead of update as
set nocount on
if update(OurOrgan) or update(Name) or update(Namee) or update(Tel) or update(Fax) or update(Email) or update(Web) or update(Address) or update(Addresse)
or update(PostCode) or update(Resume) or update(Resumee)
update Our set OurOrgan=inserted.OurOrgan,Name=inserted.Name,Namee=inserted.Namee,Tel=inserted.Tel,Fax=inserted.Fax,Email=inserted.Email,Web=inserted.Web,Address=inserted.Address,Addresse=inserted.Addresse,
PostCode=inserted.PostCode,Resume=inserted.Resume,Resumee=inserted.Resumee
from inserted where Our=Obj
if update(FullName) or update(FullNamee)
update Organ set FullName=inserted.FullName,FullNamee=inserted.FullNamee
from inserted where Organ=Obj
if update(DeptNo) or update(Manager)
update Dept set DeptNo=inserted.DeptNo,Manager=inserted.Manager
from inserted where Dept=Obj
go
create trigger DeptObj_Del on DeptObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Ecertify_Ecertify on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Ecertify from deleted where Ecertify=Obj
end
go
create view EcertifyObj as
select Obj,Cls,DocTime,Owner,State,CertifyNo,Invoice,Consigner,ConsignerName,ConsignerAddress,Consignee,ConsigneeName,ConsigneeAddress,TransMeans
,DestPlace,OfficalOnly,DeclareText,ApplyName,ApplyDate,ApplyPlace,CertifyText,CertifyName,CertifyDate,CertifyPlace
,GoodsQtty,GoodsUnit,PackCount,PackUnit,PackNW,PackGW,PackWunit,PackGV,PackVunit
from Obj join Doc on Doc=Obj join Ecertify on Ecertify=Obj
go
create trigger EcertifyObj_Ins on EcertifyObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Ecertify'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Ecertify(Ecertify,CertifyNo,Invoice,Consigner,ConsignerName,ConsignerAddress,Consignee,ConsigneeName,ConsigneeAddress,TransMeans
,DestPlace,OfficalOnly,DeclareText,ApplyName,ApplyDate,ApplyPlace,CertifyText,CertifyName,CertifyDate,CertifyPlace
,GoodsQtty,GoodsUnit,PackCount,PackUnit,PackNW,PackGW,PackWunit,PackGV,PackVunit)
select Obj,CertifyNo,Invoice,Consigner,ConsignerName,ConsignerAddress,Consignee,ConsigneeName,ConsigneeAddress,TransMeans
,DestPlace,OfficalOnly,DeclareText,ApplyName,ApplyDate,ApplyPlace,CertifyText,CertifyName,CertifyDate,CertifyPlace
,GoodsQtty,GoodsUnit,PackCount,PackUnit,PackNW,PackGW,PackWunit,PackGV,PackVunit
from inserted
go
create trigger EcertifyObj_Upd on EcertifyObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(CertifyNo) or update(Invoice) or update(Consigner) or update(ConsignerName) or update(ConsignerAddress) or update(Consignee) or update(ConsigneeName) or update(ConsigneeAddress) or update(TransMeans)
or update(DestPlace) or update(OfficalOnly) or update(DeclareText) or update(ApplyName) or update(ApplyDate) or update(ApplyPlace) or update(CertifyText) or update(CertifyName) or update(CertifyDate) or update(CertifyPlace)
or update(GoodsQtty) or update(GoodsUnit) or update(PackCount) or update(PackUnit) or update(PackNW) or update(PackGW) or update(PackWunit) or update(PackGV) or update(PackVunit)
update Ecertify set CertifyNo=inserted.CertifyNo,Invoice=inserted.Invoice,Consigner=inserted.Consigner,ConsignerName=inserted.ConsignerName,ConsignerAddress=inserted.ConsignerAddress,Consignee=inserted.Consignee,ConsigneeName=inserted.ConsigneeName,ConsigneeAddress=inserted.ConsigneeAddress,TransMeans=inserted.TransMeans,
DestPlace=inserted.DestPlace,OfficalOnly=inserted.OfficalOnly,DeclareText=inserted.DeclareText,ApplyName=inserted.ApplyName,ApplyDate=inserted.ApplyDate,ApplyPlace=inserted.ApplyPlace,CertifyText=inserted.CertifyText,CertifyName=inserted.CertifyName,CertifyDate=inserted.CertifyDate,CertifyPlace=inserted.CertifyPlace,
GoodsQtty=inserted.GoodsQtty,GoodsUnit=inserted.GoodsUnit,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackNW=inserted.PackNW,PackGW=inserted.PackGW,PackWunit=inserted.PackWunit,PackGV=inserted.PackGV,PackVunit=inserted.PackVunit
from inserted where Ecertify=Obj
go
create trigger EcertifyObj_Del on EcertifyObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Epacking_Epacking on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Epacking from deleted where Epacking=Obj
end
go
create view EpackingObj as
select Obj,Cls,DocTime,Owner,State,PackingNo,PackingDate,Subject,EInvoice,InvoiceNo,Company,Trader,PkPreface,PkText
,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,ConsignDate,ConsignerName
,ConsignerAddress,ConsignerContact,ConsignerTel,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,NotifierName,NotifierAddress,NotifierContact
,NotifierTel,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit
,BlNo,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace
,ConsignText
from Obj join Doc on Doc=Obj join Epacking on Epacking=Obj
go
create trigger EpackingObj_Ins on EpackingObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Epacking'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Epacking(Epacking,PackingNo,PackingDate,Subject,EInvoice,InvoiceNo,Company,Trader,PkPreface,PkText
,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,ConsignDate,ConsignerName
,ConsignerAddress,ConsignerContact,ConsignerTel,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,NotifierName,NotifierAddress,NotifierContact
,NotifierTel,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit
,BlNo,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace
,ConsignText)
select Obj,PackingNo,PackingDate,Subject,EInvoice,InvoiceNo,Company,Trader,PkPreface,PkText
,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,ConsignDate,ConsignerName
,ConsignerAddress,ConsignerContact,ConsignerTel,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,NotifierName,NotifierAddress,NotifierContact
,NotifierTel,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit
,BlNo,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace
,ConsignText
from inserted
go
create trigger EpackingObj_Upd on EpackingObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(PackingNo) or update(PackingDate) or update(Subject) or update(EInvoice) or update(InvoiceNo) or update(Company) or update(Trader) or update(PkPreface) or update(PkText)
or update(Remark) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit) or update(PackGV) or update(PackVunit) or update(ConsignDate) or update(ConsignerName)
or update(ConsignerAddress) or update(ConsignerContact) or update(ConsignerTel) or update(ConsigneeName) or update(ConsigneeAddress) or update(ConsigneeContact) or update(ConsigneeTel) or update(NotifierName) or update(NotifierAddress) or update(NotifierContact)
or update(NotifierTel) or update(TransMode) or update(Tranship) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(DischargePort) or update(LoadPlace) or update(DestPlace) or update(LoadLimit)
or update(BlNo) or update(BlDate) or update(BlOrg) or update(BlCpy) or update(VesselFst) or update(Vessel) or update(SailDate) or update(ArrivalDate) or update(FreightPayment) or update(BlSignPlace)
or update(ConsignText)
update Epacking set PackingNo=inserted.PackingNo,PackingDate=inserted.PackingDate,Subject=inserted.Subject,EInvoice=inserted.EInvoice,InvoiceNo=inserted.InvoiceNo,Company=inserted.Company,Trader=inserted.Trader,PkPreface=inserted.PkPreface,PkText=inserted.PkText,
Remark=inserted.Remark,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,ConsignDate=inserted.ConsignDate,ConsignerName=inserted.ConsignerName,
ConsignerAddress=inserted.ConsignerAddress,ConsignerContact=inserted.ConsignerContact,ConsignerTel=inserted.ConsignerTel,ConsigneeName=inserted.ConsigneeName,ConsigneeAddress=inserted.ConsigneeAddress,ConsigneeContact=inserted.ConsigneeContact,ConsigneeTel=inserted.ConsigneeTel,NotifierName=inserted.NotifierName,NotifierAddress=inserted.NotifierAddress,NotifierContact=inserted.NotifierContact,
NotifierTel=inserted.NotifierTel,TransMode=inserted.TransMode,Tranship=inserted.Tranship,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,DischargePort=inserted.DischargePort,LoadPlace=inserted.LoadPlace,DestPlace=inserted.DestPlace,LoadLimit=inserted.LoadLimit,
BlNo=inserted.BlNo,BlDate=inserted.BlDate,BlOrg=inserted.BlOrg,BlCpy=inserted.BlCpy,VesselFst=inserted.VesselFst,Vessel=inserted.Vessel,SailDate=inserted.SailDate,ArrivalDate=inserted.ArrivalDate,FreightPayment=inserted.FreightPayment,BlSignPlace=inserted.BlSignPlace,
ConsignText=inserted.ConsignText
from inserted where Epacking=Obj
go
create trigger EpackingObj_Del on EpackingObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Goods_Goods on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Goods from deleted where Goods=Obj
end
go
create view GoodsObj as
select Obj,Cls,DocTime,Owner,State,GoodsNo,Genus,GenusName,GenusNamee,GoodsName,GoodsNamee,GoodsPlu,HsCode,Unit
,GoodsMeasure,GoodsNW,GoodsGW,GoodsWunit,GoodsGV,GoodsVunit,PackName,PackNamee,PackPlu,GoodsPacking
,PackGoods,PackMeasure,PackNW,PackGW,PackWunit,PackGV,PackVunit,BoxName,BoxNamee,BoxPlu
,BoxGoods,GoodsBoxing,BoxMeasure,BoxNW,BoxGW,BoxWunit,BoxGV,BoxVunit,Picture,Icon
,GoodsDesc,GoodsDesce,GoodsRem,Supplier,Grade,GoodsL,GoodsW,GoodsH,GoodsLunit,BoxL
,BoxW,BoxH,BoxLunit,PackL,PackW,PackH,PackLunit,Color,Containing,Sprice
,Scux,Pprice,Pcux
from Obj join Doc on Doc=Obj join Goods on Goods=Obj
go
create trigger GoodsObj_Ins on GoodsObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Goods'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Goods(Goods,GoodsNo,Genus,GenusName,GenusNamee,GoodsName,GoodsNamee,GoodsPlu,HsCode,Unit
,GoodsMeasure,GoodsNW,GoodsGW,GoodsWunit,GoodsGV,GoodsVunit,PackName,PackNamee,PackPlu,GoodsPacking
,PackGoods,PackMeasure,PackNW,PackGW,PackWunit,PackGV,PackVunit,BoxName,BoxNamee,BoxPlu
,BoxGoods,GoodsBoxing,BoxMeasure,BoxNW,BoxGW,BoxWunit,BoxGV,BoxVunit,Picture,Icon
,GoodsDesc,GoodsDesce,GoodsRem,Supplier,Grade,GoodsL,GoodsW,GoodsH,GoodsLunit,BoxL
,BoxW,BoxH,BoxLunit,PackL,PackW,PackH,PackLunit,Color,Containing,Sprice
,Scux,Pprice,Pcux)
select Obj,GoodsNo,Genus,GenusName,GenusNamee,GoodsName,GoodsNamee,GoodsPlu,HsCode,Unit
,GoodsMeasure,GoodsNW,GoodsGW,GoodsWunit,GoodsGV,GoodsVunit,PackName,PackNamee,PackPlu,GoodsPacking
,PackGoods,PackMeasure,PackNW,PackGW,PackWunit,PackGV,PackVunit,BoxName,BoxNamee,BoxPlu
,BoxGoods,GoodsBoxing,BoxMeasure,BoxNW,BoxGW,BoxWunit,BoxGV,BoxVunit,Picture,Icon
,GoodsDesc,GoodsDesce,GoodsRem,Supplier,Grade,GoodsL,GoodsW,GoodsH,GoodsLunit,BoxL
,BoxW,BoxH,BoxLunit,PackL,PackW,PackH,PackLunit,Color,Containing,Sprice
,Scux,Pprice,Pcux
from inserted
go
create trigger GoodsObj_Upd on GoodsObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(GoodsNo) or update(Genus) or update(GenusName) or update(GenusNamee) or update(GoodsName) or update(GoodsNamee) or update(GoodsPlu) or update(HsCode) or update(Unit)
or update(GoodsMeasure) or update(GoodsNW) or update(GoodsGW) or update(GoodsWunit) or update(GoodsGV) or update(GoodsVunit) or update(PackName) or update(PackNamee) or update(PackPlu) or update(GoodsPacking)
or update(PackGoods) or update(PackMeasure) or update(PackNW) or update(PackGW) or update(PackWunit) or update(PackGV) or update(PackVunit) or update(BoxName) or update(BoxNamee) or update(BoxPlu)
or update(BoxGoods) or update(GoodsBoxing) or update(BoxMeasure) or update(BoxNW) or update(BoxGW) or update(BoxWunit) or update(BoxGV) or update(BoxVunit) or update(Picture) or update(Icon)
or update(GoodsDesc) or update(GoodsDesce) or update(GoodsRem) or update(Supplier) or update(Grade) or update(GoodsL) or update(GoodsW) or update(GoodsH) or update(GoodsLunit) or update(BoxL)
or update(BoxW) or update(BoxH) or update(BoxLunit) or update(PackL) or update(PackW) or update(PackH) or update(PackLunit) or update(Color) or update(Containing) or update(Sprice)
or update(Scux) or update(Pprice) or update(Pcux)
update Goods set GoodsNo=inserted.GoodsNo,Genus=inserted.Genus,GenusName=inserted.GenusName,GenusNamee=inserted.GenusNamee,GoodsName=inserted.GoodsName,GoodsNamee=inserted.GoodsNamee,GoodsPlu=inserted.GoodsPlu,HsCode=inserted.HsCode,Unit=inserted.Unit,
GoodsMeasure=inserted.GoodsMeasure,GoodsNW=inserted.GoodsNW,GoodsGW=inserted.GoodsGW,GoodsWunit=inserted.GoodsWunit,GoodsGV=inserted.GoodsGV,GoodsVunit=inserted.GoodsVunit,PackName=inserted.PackName,PackNamee=inserted.PackNamee,PackPlu=inserted.PackPlu,GoodsPacking=inserted.GoodsPacking,
PackGoods=inserted.PackGoods,PackMeasure=inserted.PackMeasure,PackNW=inserted.PackNW,PackGW=inserted.PackGW,PackWunit=inserted.PackWunit,PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,BoxName=inserted.BoxName,BoxNamee=inserted.BoxNamee,BoxPlu=inserted.BoxPlu,
BoxGoods=inserted.BoxGoods,GoodsBoxing=inserted.GoodsBoxing,BoxMeasure=inserted.BoxMeasure,BoxNW=inserted.BoxNW,BoxGW=inserted.BoxGW,BoxWunit=inserted.BoxWunit,BoxGV=inserted.BoxGV,BoxVunit=inserted.BoxVunit,Picture=inserted.Picture,Icon=inserted.Icon,
GoodsDesc=inserted.GoodsDesc,GoodsDesce=inserted.GoodsDesce,GoodsRem=inserted.GoodsRem,Supplier=inserted.Supplier,Grade=inserted.Grade,GoodsL=inserted.GoodsL,GoodsW=inserted.GoodsW,GoodsH=inserted.GoodsH,GoodsLunit=inserted.GoodsLunit,BoxL=inserted.BoxL,
BoxW=inserted.BoxW,BoxH=inserted.BoxH,BoxLunit=inserted.BoxLunit,PackL=inserted.PackL,PackW=inserted.PackW,PackH=inserted.PackH,PackLunit=inserted.PackLunit,Color=inserted.Color,Containing=inserted.Containing,Sprice=inserted.Sprice,
Scux=inserted.Scux,Pprice=inserted.Pprice,Pcux=inserted.Pcux
from inserted where Goods=Obj
go
create trigger GoodsObj_Del on GoodsObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Invoice_Invoice on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Invoice from deleted where Invoice=Obj
end
go
create view InvoiceObj as
select Obj,Cls,DocTime,Owner,State,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText
from Obj join Doc on Doc=Obj join Invoice on Invoice=Obj
go
create trigger InvoiceObj_Ins on InvoiceObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Invoice'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Invoice(Invoice,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText)
select Obj,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText
from inserted
go
create trigger InvoiceObj_Upd on InvoiceObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(InvoiceNo) or update(Subject) or update(InvoiceDate) or update(Amount) or update(AmountX) or update(Company) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit) or update(PackGV) or update(PackVunit) or update(CuxStdRate)
or update(CuxIntRate) or update(PkPreface) or update(PkText)
update Invoice set InvoiceNo=inserted.InvoiceNo,Subject=inserted.Subject,InvoiceDate=inserted.InvoiceDate,Amount=inserted.Amount,AmountX=inserted.AmountX,Company=inserted.Company,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,CuxStdRate=inserted.CuxStdRate,
CuxIntRate=inserted.CuxIntRate,PkPreface=inserted.PkPreface,PkText=inserted.PkText
from inserted where Invoice=Obj
go
create trigger InvoiceObj_Del on InvoiceObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Orders_Orders on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Orders from deleted where Orders=Obj
end
go
create view OrdersObj as
select Obj,Cls,DocTime,Owner,State,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit
from Obj join Doc on Doc=Obj join Orders on Orders=Obj
go
create trigger OrdersObj_Ins on OrdersObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Orders'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Orders(Orders,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit)
select Obj,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit
from inserted
go
create trigger OrdersObj_Upd on OrdersObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(OrderNo) or update(Subject) or update(Company) or update(OrderDate) or update(Amount) or update(AmountX) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit)
or update(PackGV) or update(PackVunit) or update(DeliverLimit)
update Orders set OrderNo=inserted.OrderNo,Subject=inserted.Subject,Company=inserted.Company,OrderDate=inserted.OrderDate,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,
PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,DeliverLimit=inserted.DeliverLimit
from inserted where Orders=Obj
go
create trigger OrdersObj_Del on OrdersObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Quote_Quote on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Quote from deleted where Quote=Obj
end
go
create view QuoteObj as
select Obj,Cls,DocTime,Owner,State,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate
from Obj join Doc on Doc=Obj join Quote on Quote=Obj
go
create trigger QuoteObj_Ins on QuoteObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Quote'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Quote(Quote,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate)
select Obj,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate
from inserted
go
create trigger QuoteObj_Upd on QuoteObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(QuoteNo) or update(Subject) or update(QuoteDate) or update(ValidLimit) or update(Trader) or update(Company) or update(QuoteNoo) or update(Preface) or update(Contacter)
or update(Treaty) or update(Cux) or update(Amount) or update(AmountX) or update(AmountY) or update(PackCount) or update(Remark) or update(PackUnit) or update(PackGW) or update(LoadPort)
or update(PackNW) or update(DestPort) or update(PackWunit) or update(TrshPort) or update(PackGV) or update(Partial) or update(Tranship) or update(PackVunit) or update(CommiRate) or update(CommiHide)
or update(PayMode) or update(TransMode) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate)
update Quote set QuoteNo=inserted.QuoteNo,Subject=inserted.Subject,QuoteDate=inserted.QuoteDate,ValidLimit=inserted.ValidLimit,Trader=inserted.Trader,Company=inserted.Company,QuoteNoo=inserted.QuoteNoo,Preface=inserted.Preface,Contacter=inserted.Contacter,
Treaty=inserted.Treaty,Cux=inserted.Cux,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,PackCount=inserted.PackCount,Remark=inserted.Remark,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,LoadPort=inserted.LoadPort,
PackNW=inserted.PackNW,DestPort=inserted.DestPort,PackWunit=inserted.PackWunit,TrshPort=inserted.TrshPort,PackGV=inserted.PackGV,Partial=inserted.Partial,Tranship=inserted.Tranship,PackVunit=inserted.PackVunit,CommiRate=inserted.CommiRate,CommiHide=inserted.CommiHide,
PayMode=inserted.PayMode,TransMode=inserted.TransMode,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate
from inserted where Quote=Obj
go
create trigger QuoteObj_Del on QuoteObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Sociar_Sociar on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Sociar from deleted where Sociar=Obj
end
go
create view SociarObj as
select Obj,Cls,DocTime,Owner,State,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary
from Obj join Doc on Doc=Obj join Sociar on Sociar=Obj
go
create trigger SociarObj_Ins on SociarObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Sociar'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Sociar(Sociar,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary)
select Obj,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary
from inserted
go
create trigger SociarObj_Upd on SociarObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(Name) or update(Namee) or update(Tel) or update(Fax) or update(Email) or update(Web) or update(Address) or update(Addresse) or update(PostCode)
or update(Country) or update(Districts) or update(Citys) or update(Resume) or update(Resumee) or update(Mobile) or update(Summary)
update Sociar set Name=inserted.Name,Namee=inserted.Namee,Tel=inserted.Tel,Fax=inserted.Fax,Email=inserted.Email,Web=inserted.Web,Address=inserted.Address,Addresse=inserted.Addresse,PostCode=inserted.PostCode,
Country=inserted.Country,Districts=inserted.Districts,Citys=inserted.Citys,Resume=inserted.Resume,Resumee=inserted.Resumee,Mobile=inserted.Mobile,Summary=inserted.Summary
from inserted where Sociar=Obj
go
create trigger SociarObj_Del on SociarObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Bquote_Bquote on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Bquote from deleted where Bquote=Obj
end
go
create view BquoteObj as
select Obj,Cls,DocTime,Owner,State,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate
from Obj join Doc on Doc=Obj join Quote on Quote=Obj join Bquote on Bquote=Obj
go
create trigger BquoteObj_Ins on BquoteObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Bquote'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Quote(Quote,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate)
select Obj,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate
from inserted
insert Bquote(Bquote)
select Obj
from inserted
go
create trigger BquoteObj_Upd on BquoteObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(QuoteNo) or update(Subject) or update(QuoteDate) or update(ValidLimit) or update(Trader) or update(Company) or update(QuoteNoo) or update(Preface) or update(Contacter)
or update(Treaty) or update(Cux) or update(Amount) or update(AmountX) or update(AmountY) or update(PackCount) or update(Remark) or update(PackUnit) or update(PackGW) or update(LoadPort)
or update(PackNW) or update(DestPort) or update(PackWunit) or update(TrshPort) or update(PackGV) or update(Partial) or update(Tranship) or update(PackVunit) or update(CommiRate) or update(CommiHide)
or update(PayMode) or update(TransMode) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate)
update Quote set QuoteNo=inserted.QuoteNo,Subject=inserted.Subject,QuoteDate=inserted.QuoteDate,ValidLimit=inserted.ValidLimit,Trader=inserted.Trader,Company=inserted.Company,QuoteNoo=inserted.QuoteNoo,Preface=inserted.Preface,Contacter=inserted.Contacter,
Treaty=inserted.Treaty,Cux=inserted.Cux,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,PackCount=inserted.PackCount,Remark=inserted.Remark,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,LoadPort=inserted.LoadPort,
PackNW=inserted.PackNW,DestPort=inserted.DestPort,PackWunit=inserted.PackWunit,TrshPort=inserted.TrshPort,PackGV=inserted.PackGV,Partial=inserted.Partial,Tranship=inserted.Tranship,PackVunit=inserted.PackVunit,CommiRate=inserted.CommiRate,CommiHide=inserted.CommiHide,
PayMode=inserted.PayMode,TransMode=inserted.TransMode,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate
from inserted where Quote=Obj
go
create trigger BquoteObj_Del on BquoteObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Econsign_Econsign on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Econsign from deleted where Econsign=Obj
end
go
create view EconsignObj as
select Obj,Cls,DocTime,Owner,State,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText
from Obj join Doc on Doc=Obj join Consign on Consign=Obj join Econsign on Econsign=Obj
go
create trigger EconsignObj_Ins on EconsignObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Econsign'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Consign(Consign,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText)
select Obj,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText
from inserted
insert Econsign(Econsign)
select Obj
from inserted
go
create trigger EconsignObj_Upd on EconsignObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(ConsignNo) or update(Invoice) or update(ConsignDate) or update(Carrier) or update(Consigner) or update(ConsignerName) or update(ConsignerAddress) or update(ConsignerContact) or update(ConsignerTel)
or update(Consignee) or update(ConsigneeName) or update(ConsigneeAddress) or update(ConsigneeContact) or update(ConsigneeTel) or update(Notifier) or update(NotifierName) or update(NotifierAddress) or update(NotifierContact) or update(NotifierTel)
or update(TransMode) or update(Tranship) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(DischargePort) or update(LoadPlace) or update(DestPlace) or update(LoadLimit) or update(BlNo)
or update(BlDate) or update(BlOrg) or update(BlCpy) or update(VesselFst) or update(Vessel) or update(SailDate) or update(ArrivalDate) or update(FreightPayment) or update(BlSignPlace) or update(PackCount)
or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackGV) or update(PackWunit) or update(PackVunit) or update(ConsignText)
update Consign set ConsignNo=inserted.ConsignNo,Invoice=inserted.Invoice,ConsignDate=inserted.ConsignDate,Carrier=inserted.Carrier,Consigner=inserted.Consigner,ConsignerName=inserted.ConsignerName,ConsignerAddress=inserted.ConsignerAddress,ConsignerContact=inserted.ConsignerContact,ConsignerTel=inserted.ConsignerTel,
Consignee=inserted.Consignee,ConsigneeName=inserted.ConsigneeName,ConsigneeAddress=inserted.ConsigneeAddress,ConsigneeContact=inserted.ConsigneeContact,ConsigneeTel=inserted.ConsigneeTel,Notifier=inserted.Notifier,NotifierName=inserted.NotifierName,NotifierAddress=inserted.NotifierAddress,NotifierContact=inserted.NotifierContact,NotifierTel=inserted.NotifierTel,
TransMode=inserted.TransMode,Tranship=inserted.Tranship,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,DischargePort=inserted.DischargePort,LoadPlace=inserted.LoadPlace,DestPlace=inserted.DestPlace,LoadLimit=inserted.LoadLimit,BlNo=inserted.BlNo,
BlDate=inserted.BlDate,BlOrg=inserted.BlOrg,BlCpy=inserted.BlCpy,VesselFst=inserted.VesselFst,Vessel=inserted.Vessel,SailDate=inserted.SailDate,ArrivalDate=inserted.ArrivalDate,FreightPayment=inserted.FreightPayment,BlSignPlace=inserted.BlSignPlace,PackCount=inserted.PackCount,
PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackGV=inserted.PackGV,PackWunit=inserted.PackWunit,PackVunit=inserted.PackVunit,ConsignText=inserted.ConsignText
from inserted where Consign=Obj
go
create trigger EconsignObj_Del on EconsignObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Edeclar_Edeclar on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Edeclar from deleted where Edeclar=Obj
end
go
create view EdeclarObj as
select Obj,Cls,DocTime,Owner,State,DeclarKey,DeclareNo,Invoice,Company,Nativer,Customs,RecordNo,DeclareDate,Broker
,Consign,TradeMode,TransMode,BlNo,Conveyance,LicenceNo,HexiaoNo,Term,Country,Port
,NativePlace,LevyType,PayMode,Freights,Insufees,Otherfees,OrderNos,PackCount,PackKinds,PackGW
,PackNW,Wunit,WunitCh,ContainerNos,DeclareDocs,Typer,Declarer,FillInDate,Comment,ExportDate
from Obj join Doc on Doc=Obj join Declar on Declar=Obj join Edeclar on Edeclar=Obj
go
create trigger EdeclarObj_Ins on EdeclarObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Edeclar'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Declar(Declar,DeclarKey,DeclareNo,Invoice,Company,Nativer,Customs,RecordNo,DeclareDate,Broker
,Consign,TradeMode,TransMode,BlNo,Conveyance,LicenceNo,HexiaoNo,Term,Country,Port
,NativePlace,LevyType,PayMode,Freights,Insufees,Otherfees,OrderNos,PackCount,PackKinds,PackGW
,PackNW,Wunit,WunitCh,ContainerNos,DeclareDocs,Typer,Declarer,FillInDate,Comment)
select Obj,DeclarKey,DeclareNo,Invoice,Company,Nativer,Customs,RecordNo,DeclareDate,Broker
,Consign,TradeMode,TransMode,BlNo,Conveyance,LicenceNo,HexiaoNo,Term,Country,Port
,NativePlace,LevyType,PayMode,Freights,Insufees,Otherfees,OrderNos,PackCount,PackKinds,PackGW
,PackNW,Wunit,WunitCh,ContainerNos,DeclareDocs,Typer,Declarer,FillInDate,Comment
from inserted
insert Edeclar(Edeclar,ExportDate)
select Obj,ExportDate
from inserted
go
create trigger EdeclarObj_Upd on EdeclarObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(DeclarKey) or update(DeclareNo) or update(Invoice) or update(Company) or update(Nativer) or update(Customs) or update(RecordNo) or update(DeclareDate) or update(Broker)
or update(Consign) or update(TradeMode) or update(TransMode) or update(BlNo) or update(Conveyance) or update(LicenceNo) or update(HexiaoNo) or update(Term) or update(Country) or update(Port)
or update(NativePlace) or update(LevyType) or update(PayMode) or update(Freights) or update(Insufees) or update(Otherfees) or update(OrderNos) or update(PackCount) or update(PackKinds) or update(PackGW)
or update(PackNW) or update(Wunit) or update(WunitCh) or update(ContainerNos) or update(DeclareDocs) or update(Typer) or update(Declarer) or update(FillInDate) or update(Comment)
update Declar set DeclarKey=inserted.DeclarKey,DeclareNo=inserted.DeclareNo,Invoice=inserted.Invoice,Company=inserted.Company,Nativer=inserted.Nativer,Customs=inserted.Customs,RecordNo=inserted.RecordNo,DeclareDate=inserted.DeclareDate,Broker=inserted.Broker,
Consign=inserted.Consign,TradeMode=inserted.TradeMode,TransMode=inserted.TransMode,BlNo=inserted.BlNo,Conveyance=inserted.Conveyance,LicenceNo=inserted.LicenceNo,HexiaoNo=inserted.HexiaoNo,Term=inserted.Term,Country=inserted.Country,Port=inserted.Port,
NativePlace=inserted.NativePlace,LevyType=inserted.LevyType,PayMode=inserted.PayMode,Freights=inserted.Freights,Insufees=inserted.Insufees,Otherfees=inserted.Otherfees,OrderNos=inserted.OrderNos,PackCount=inserted.PackCount,PackKinds=inserted.PackKinds,PackGW=inserted.PackGW,
PackNW=inserted.PackNW,Wunit=inserted.Wunit,WunitCh=inserted.WunitCh,ContainerNos=inserted.ContainerNos,DeclareDocs=inserted.DeclareDocs,Typer=inserted.Typer,Declarer=inserted.Declarer,FillInDate=inserted.FillInDate,Comment=inserted.Comment
from inserted where Declar=Obj
if update(ExportDate)
update Edeclar set ExportDate=inserted.ExportDate
from inserted where Edeclar=Obj
go
create trigger EdeclarObj_Del on EdeclarObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Entity_Entity on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Entity from deleted where Entity=Obj
end
go
create view EntityObj as
select Obj,Cls,DocTime,Owner,State,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount
from Obj join Doc on Doc=Obj join Sociar on Sociar=Obj join Entity on Entity=Obj
go
create trigger EntityObj_Ins on EntityObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Entity'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Sociar(Sociar,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary)
select Obj,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary
from inserted
insert Entity(Entity,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount)
select Obj,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount
from inserted
go
create trigger EntityObj_Upd on EntityObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(Name) or update(Namee) or update(Tel) or update(Fax) or update(Email) or update(Web) or update(Address) or update(Addresse) or update(PostCode)
or update(Country) or update(Districts) or update(Citys) or update(Resume) or update(Resumee) or update(Mobile) or update(Summary)
update Sociar set Name=inserted.Name,Namee=inserted.Namee,Tel=inserted.Tel,Fax=inserted.Fax,Email=inserted.Email,Web=inserted.Web,Address=inserted.Address,Addresse=inserted.Addresse,PostCode=inserted.PostCode,
Country=inserted.Country,Districts=inserted.Districts,Citys=inserted.Citys,Resume=inserted.Resume,Resumee=inserted.Resumee,Mobile=inserted.Mobile,Summary=inserted.Summary
from inserted where Sociar=Obj
if update(FullName) or update(FullNamee) or update(EdiLink) or update(Contacter) or update(BankName) or update(BankAccount)
update Entity set FullName=inserted.FullName,FullNamee=inserted.FullNamee,EdiLink=inserted.EdiLink,Contacter=inserted.Contacter,BankName=inserted.BankName,BankAccount=inserted.BankAccount
from inserted where Entity=Obj
go
create trigger EntityObj_Del on EntityObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Friend_Friend on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Friend from deleted where Friend=Obj
end
go
create view FriendObj as
select Obj,Cls,DocTime,Owner,State,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary,Entity,Sex,Birthday,Duty
from Obj join Doc on Doc=Obj join Sociar on Sociar=Obj join Friend on Friend=Obj
go
create trigger FriendObj_Ins on FriendObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Friend'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Sociar(Sociar,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary)
select Obj,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary
from inserted
insert Friend(Friend,Entity,Sex,Birthday,Duty)
select Obj,Entity,Sex,Birthday,Duty
from inserted
go
create trigger FriendObj_Upd on FriendObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(Name) or update(Namee) or update(Tel) or update(Fax) or update(Email) or update(Web) or update(Address) or update(Addresse) or update(PostCode)
or update(Country) or update(Districts) or update(Citys) or update(Resume) or update(Resumee) or update(Mobile) or update(Summary)
update Sociar set Name=inserted.Name,Namee=inserted.Namee,Tel=inserted.Tel,Fax=inserted.Fax,Email=inserted.Email,Web=inserted.Web,Address=inserted.Address,Addresse=inserted.Addresse,PostCode=inserted.PostCode,
Country=inserted.Country,Districts=inserted.Districts,Citys=inserted.Citys,Resume=inserted.Resume,Resumee=inserted.Resumee,Mobile=inserted.Mobile,Summary=inserted.Summary
from inserted where Sociar=Obj
if update(Entity) or update(Sex) or update(Birthday) or update(Duty)
update Friend set Entity=inserted.Entity,Sex=inserted.Sex,Birthday=inserted.Birthday,Duty=inserted.Duty
from inserted where Friend=Obj
go
create trigger FriendObj_Del on FriendObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Iconsign_Iconsign on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Iconsign from deleted where Iconsign=Obj
end
go
create view IconsignObj as
select Obj,Cls,DocTime,Owner,State,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText
from Obj join Doc on Doc=Obj join Consign on Consign=Obj join Iconsign on Iconsign=Obj
go
create trigger IconsignObj_Ins on IconsignObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Iconsign'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Consign(Consign,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText)
select Obj,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText
from inserted
insert Iconsign(Iconsign)
select Obj
from inserted
go
create trigger IconsignObj_Upd on IconsignObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(ConsignNo) or update(Invoice) or update(ConsignDate) or update(Carrier) or update(Consigner) or update(ConsignerName) or update(ConsignerAddress) or update(ConsignerContact) or update(ConsignerTel)
or update(Consignee) or update(ConsigneeName) or update(ConsigneeAddress) or update(ConsigneeContact) or update(ConsigneeTel) or update(Notifier) or update(NotifierName) or update(NotifierAddress) or update(NotifierContact) or update(NotifierTel)
or update(TransMode) or update(Tranship) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(DischargePort) or update(LoadPlace) or update(DestPlace) or update(LoadLimit) or update(BlNo)
or update(BlDate) or update(BlOrg) or update(BlCpy) or update(VesselFst) or update(Vessel) or update(SailDate) or update(ArrivalDate) or update(FreightPayment) or update(BlSignPlace) or update(PackCount)
or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackGV) or update(PackWunit) or update(PackVunit) or update(ConsignText)
update Consign set ConsignNo=inserted.ConsignNo,Invoice=inserted.Invoice,ConsignDate=inserted.ConsignDate,Carrier=inserted.Carrier,Consigner=inserted.Consigner,ConsignerName=inserted.ConsignerName,ConsignerAddress=inserted.ConsignerAddress,ConsignerContact=inserted.ConsignerContact,ConsignerTel=inserted.ConsignerTel,
Consignee=inserted.Consignee,ConsigneeName=inserted.ConsigneeName,ConsigneeAddress=inserted.ConsigneeAddress,ConsigneeContact=inserted.ConsigneeContact,ConsigneeTel=inserted.ConsigneeTel,Notifier=inserted.Notifier,NotifierName=inserted.NotifierName,NotifierAddress=inserted.NotifierAddress,NotifierContact=inserted.NotifierContact,NotifierTel=inserted.NotifierTel,
TransMode=inserted.TransMode,Tranship=inserted.Tranship,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,DischargePort=inserted.DischargePort,LoadPlace=inserted.LoadPlace,DestPlace=inserted.DestPlace,LoadLimit=inserted.LoadLimit,BlNo=inserted.BlNo,
BlDate=inserted.BlDate,BlOrg=inserted.BlOrg,BlCpy=inserted.BlCpy,VesselFst=inserted.VesselFst,Vessel=inserted.Vessel,SailDate=inserted.SailDate,ArrivalDate=inserted.ArrivalDate,FreightPayment=inserted.FreightPayment,BlSignPlace=inserted.BlSignPlace,PackCount=inserted.PackCount,
PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackGV=inserted.PackGV,PackWunit=inserted.PackWunit,PackVunit=inserted.PackVunit,ConsignText=inserted.ConsignText
from inserted where Consign=Obj
go
create trigger IconsignObj_Del on IconsignObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Ideclar_Ideclar on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Ideclar from deleted where Ideclar=Obj
end
go
create view IdeclarObj as
select Obj,Cls,DocTime,Owner,State,DeclarKey,DeclareNo,Invoice,Company,Nativer,Customs,RecordNo,DeclareDate,Broker
,Consign,TradeMode,TransMode,BlNo,Conveyance,LicenceNo,HexiaoNo,Term,Country,Port
,NativePlace,LevyType,PayMode,Freights,Insufees,Otherfees,OrderNos,PackCount,PackKinds,PackGW
,PackNW,Wunit,WunitCh,ContainerNos,DeclareDocs,Typer,Declarer,FillInDate,Comment,ImportDate,Usages
from Obj join Doc on Doc=Obj join Declar on Declar=Obj join Ideclar on Ideclar=Obj
go
create trigger IdeclarObj_Ins on IdeclarObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Ideclar'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Declar(Declar,DeclarKey,DeclareNo,Invoice,Company,Nativer,Customs,RecordNo,DeclareDate,Broker
,Consign,TradeMode,TransMode,BlNo,Conveyance,LicenceNo,HexiaoNo,Term,Country,Port
,NativePlace,LevyType,PayMode,Freights,Insufees,Otherfees,OrderNos,PackCount,PackKinds,PackGW
,PackNW,Wunit,WunitCh,ContainerNos,DeclareDocs,Typer,Declarer,FillInDate,Comment)
select Obj,DeclarKey,DeclareNo,Invoice,Company,Nativer,Customs,RecordNo,DeclareDate,Broker
,Consign,TradeMode,TransMode,BlNo,Conveyance,LicenceNo,HexiaoNo,Term,Country,Port
,NativePlace,LevyType,PayMode,Freights,Insufees,Otherfees,OrderNos,PackCount,PackKinds,PackGW
,PackNW,Wunit,WunitCh,ContainerNos,DeclareDocs,Typer,Declarer,FillInDate,Comment
from inserted
insert Ideclar(Ideclar,ImportDate,Usages)
select Obj,ImportDate,Usages
from inserted
go
create trigger IdeclarObj_Upd on IdeclarObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(DeclarKey) or update(DeclareNo) or update(Invoice) or update(Company) or update(Nativer) or update(Customs) or update(RecordNo) or update(DeclareDate) or update(Broker)
or update(Consign) or update(TradeMode) or update(TransMode) or update(BlNo) or update(Conveyance) or update(LicenceNo) or update(HexiaoNo) or update(Term) or update(Country) or update(Port)
or update(NativePlace) or update(LevyType) or update(PayMode) or update(Freights) or update(Insufees) or update(Otherfees) or update(OrderNos) or update(PackCount) or update(PackKinds) or update(PackGW)
or update(PackNW) or update(Wunit) or update(WunitCh) or update(ContainerNos) or update(DeclareDocs) or update(Typer) or update(Declarer) or update(FillInDate) or update(Comment)
update Declar set DeclarKey=inserted.DeclarKey,DeclareNo=inserted.DeclareNo,Invoice=inserted.Invoice,Company=inserted.Company,Nativer=inserted.Nativer,Customs=inserted.Customs,RecordNo=inserted.RecordNo,DeclareDate=inserted.DeclareDate,Broker=inserted.Broker,
Consign=inserted.Consign,TradeMode=inserted.TradeMode,TransMode=inserted.TransMode,BlNo=inserted.BlNo,Conveyance=inserted.Conveyance,LicenceNo=inserted.LicenceNo,HexiaoNo=inserted.HexiaoNo,Term=inserted.Term,Country=inserted.Country,Port=inserted.Port,
NativePlace=inserted.NativePlace,LevyType=inserted.LevyType,PayMode=inserted.PayMode,Freights=inserted.Freights,Insufees=inserted.Insufees,Otherfees=inserted.Otherfees,OrderNos=inserted.OrderNos,PackCount=inserted.PackCount,PackKinds=inserted.PackKinds,PackGW=inserted.PackGW,
PackNW=inserted.PackNW,Wunit=inserted.Wunit,WunitCh=inserted.WunitCh,ContainerNos=inserted.ContainerNos,DeclareDocs=inserted.DeclareDocs,Typer=inserted.Typer,Declarer=inserted.Declarer,FillInDate=inserted.FillInDate,Comment=inserted.Comment
from inserted where Declar=Obj
if update(ImportDate) or update(Usages)
update Ideclar set ImportDate=inserted.ImportDate,Usages=inserted.Usages
from inserted where Ideclar=Obj
go
create trigger IdeclarObj_Del on IdeclarObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Minvoice_Minvoice on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Minvoice from deleted where Minvoice=Obj
end
go
create view MinvoiceObj as
select Obj,Cls,DocTime,Owner,State,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText
from Obj join Doc on Doc=Obj join Invoice on Invoice=Obj join Minvoice on Minvoice=Obj
go
create trigger MinvoiceObj_Ins on MinvoiceObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Minvoice'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Invoice(Invoice,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText)
select Obj,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText
from inserted
insert Minvoice(Minvoice)
select Obj
from inserted
go
create trigger MinvoiceObj_Upd on MinvoiceObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(InvoiceNo) or update(Subject) or update(InvoiceDate) or update(Amount) or update(AmountX) or update(Company) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit) or update(PackGV) or update(PackVunit) or update(CuxStdRate)
or update(CuxIntRate) or update(PkPreface) or update(PkText)
update Invoice set InvoiceNo=inserted.InvoiceNo,Subject=inserted.Subject,InvoiceDate=inserted.InvoiceDate,Amount=inserted.Amount,AmountX=inserted.AmountX,Company=inserted.Company,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,CuxStdRate=inserted.CuxStdRate,
CuxIntRate=inserted.CuxIntRate,PkPreface=inserted.PkPreface,PkText=inserted.PkText
from inserted where Invoice=Obj
go
create trigger MinvoiceObj_Del on MinvoiceObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Morder_Morder on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Morder from deleted where Morder=Obj
end
go
create view MorderObj as
select Obj,Cls,DocTime,Owner,State,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit,OrderNoo,Makedate,FinishDate
from Obj join Doc on Doc=Obj join Orders on Orders=Obj join Morder on Morder=Obj
go
create trigger MorderObj_Ins on MorderObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Morder'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Orders(Orders,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit)
select Obj,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit
from inserted
insert Morder(Morder,OrderNoo,Makedate,FinishDate)
select Obj,OrderNoo,Makedate,FinishDate
from inserted
go
create trigger MorderObj_Upd on MorderObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(OrderNo) or update(Subject) or update(Company) or update(OrderDate) or update(Amount) or update(AmountX) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit)
or update(PackGV) or update(PackVunit) or update(DeliverLimit)
update Orders set OrderNo=inserted.OrderNo,Subject=inserted.Subject,Company=inserted.Company,OrderDate=inserted.OrderDate,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,
PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,DeliverLimit=inserted.DeliverLimit
from inserted where Orders=Obj
if update(OrderNoo) or update(Makedate) or update(FinishDate)
update Morder set OrderNoo=inserted.OrderNoo,Makedate=inserted.Makedate,FinishDate=inserted.FinishDate
from inserted where Morder=Obj
go
create trigger MorderObj_Del on MorderObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Pconsign_Pconsign on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Pconsign from deleted where Pconsign=Obj
end
go
create view PconsignObj as
select Obj,Cls,DocTime,Owner,State,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText
from Obj join Doc on Doc=Obj join Consign on Consign=Obj join Pconsign on Pconsign=Obj
go
create trigger PconsignObj_Ins on PconsignObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Pconsign'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Consign(Consign,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText)
select Obj,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText
from inserted
insert Pconsign(Pconsign)
select Obj
from inserted
go
create trigger PconsignObj_Upd on PconsignObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(ConsignNo) or update(Invoice) or update(ConsignDate) or update(Carrier) or update(Consigner) or update(ConsignerName) or update(ConsignerAddress) or update(ConsignerContact) or update(ConsignerTel)
or update(Consignee) or update(ConsigneeName) or update(ConsigneeAddress) or update(ConsigneeContact) or update(ConsigneeTel) or update(Notifier) or update(NotifierName) or update(NotifierAddress) or update(NotifierContact) or update(NotifierTel)
or update(TransMode) or update(Tranship) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(DischargePort) or update(LoadPlace) or update(DestPlace) or update(LoadLimit) or update(BlNo)
or update(BlDate) or update(BlOrg) or update(BlCpy) or update(VesselFst) or update(Vessel) or update(SailDate) or update(ArrivalDate) or update(FreightPayment) or update(BlSignPlace) or update(PackCount)
or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackGV) or update(PackWunit) or update(PackVunit) or update(ConsignText)
update Consign set ConsignNo=inserted.ConsignNo,Invoice=inserted.Invoice,ConsignDate=inserted.ConsignDate,Carrier=inserted.Carrier,Consigner=inserted.Consigner,ConsignerName=inserted.ConsignerName,ConsignerAddress=inserted.ConsignerAddress,ConsignerContact=inserted.ConsignerContact,ConsignerTel=inserted.ConsignerTel,
Consignee=inserted.Consignee,ConsigneeName=inserted.ConsigneeName,ConsigneeAddress=inserted.ConsigneeAddress,ConsigneeContact=inserted.ConsigneeContact,ConsigneeTel=inserted.ConsigneeTel,Notifier=inserted.Notifier,NotifierName=inserted.NotifierName,NotifierAddress=inserted.NotifierAddress,NotifierContact=inserted.NotifierContact,NotifierTel=inserted.NotifierTel,
TransMode=inserted.TransMode,Tranship=inserted.Tranship,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,DischargePort=inserted.DischargePort,LoadPlace=inserted.LoadPlace,DestPlace=inserted.DestPlace,LoadLimit=inserted.LoadLimit,BlNo=inserted.BlNo,
BlDate=inserted.BlDate,BlOrg=inserted.BlOrg,BlCpy=inserted.BlCpy,VesselFst=inserted.VesselFst,Vessel=inserted.Vessel,SailDate=inserted.SailDate,ArrivalDate=inserted.ArrivalDate,FreightPayment=inserted.FreightPayment,BlSignPlace=inserted.BlSignPlace,PackCount=inserted.PackCount,
PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackGV=inserted.PackGV,PackWunit=inserted.PackWunit,PackVunit=inserted.PackVunit,ConsignText=inserted.ConsignText
from inserted where Consign=Obj
go
create trigger PconsignObj_Del on PconsignObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Sconsign_Sconsign on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Sconsign from deleted where Sconsign=Obj
end
go
create view SconsignObj as
select Obj,Cls,DocTime,Owner,State,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText
from Obj join Doc on Doc=Obj join Consign on Consign=Obj join Sconsign on Sconsign=Obj
go
create trigger SconsignObj_Ins on SconsignObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Sconsign'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Consign(Consign,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText)
select Obj,ConsignNo,Invoice,ConsignDate,Carrier,Consigner,ConsignerName,ConsignerAddress,ConsignerContact,ConsignerTel
,Consignee,ConsigneeName,ConsigneeAddress,ConsigneeContact,ConsigneeTel,Notifier,NotifierName,NotifierAddress,NotifierContact,NotifierTel
,TransMode,Tranship,LoadPort,DestPort,TrshPort,DischargePort,LoadPlace,DestPlace,LoadLimit,BlNo
,BlDate,BlOrg,BlCpy,VesselFst,Vessel,SailDate,ArrivalDate,FreightPayment,BlSignPlace,PackCount
,PackUnit,PackGW,PackNW,PackGV,PackWunit,PackVunit,ConsignText
from inserted
insert Sconsign(Sconsign)
select Obj
from inserted
go
create trigger SconsignObj_Upd on SconsignObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(ConsignNo) or update(Invoice) or update(ConsignDate) or update(Carrier) or update(Consigner) or update(ConsignerName) or update(ConsignerAddress) or update(ConsignerContact) or update(ConsignerTel)
or update(Consignee) or update(ConsigneeName) or update(ConsigneeAddress) or update(ConsigneeContact) or update(ConsigneeTel) or update(Notifier) or update(NotifierName) or update(NotifierAddress) or update(NotifierContact) or update(NotifierTel)
or update(TransMode) or update(Tranship) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(DischargePort) or update(LoadPlace) or update(DestPlace) or update(LoadLimit) or update(BlNo)
or update(BlDate) or update(BlOrg) or update(BlCpy) or update(VesselFst) or update(Vessel) or update(SailDate) or update(ArrivalDate) or update(FreightPayment) or update(BlSignPlace) or update(PackCount)
or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackGV) or update(PackWunit) or update(PackVunit) or update(ConsignText)
update Consign set ConsignNo=inserted.ConsignNo,Invoice=inserted.Invoice,ConsignDate=inserted.ConsignDate,Carrier=inserted.Carrier,Consigner=inserted.Consigner,ConsignerName=inserted.ConsignerName,ConsignerAddress=inserted.ConsignerAddress,ConsignerContact=inserted.ConsignerContact,ConsignerTel=inserted.ConsignerTel,
Consignee=inserted.Consignee,ConsigneeName=inserted.ConsigneeName,ConsigneeAddress=inserted.ConsigneeAddress,ConsigneeContact=inserted.ConsigneeContact,ConsigneeTel=inserted.ConsigneeTel,Notifier=inserted.Notifier,NotifierName=inserted.NotifierName,NotifierAddress=inserted.NotifierAddress,NotifierContact=inserted.NotifierContact,NotifierTel=inserted.NotifierTel,
TransMode=inserted.TransMode,Tranship=inserted.Tranship,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,DischargePort=inserted.DischargePort,LoadPlace=inserted.LoadPlace,DestPlace=inserted.DestPlace,LoadLimit=inserted.LoadLimit,BlNo=inserted.BlNo,
BlDate=inserted.BlDate,BlOrg=inserted.BlOrg,BlCpy=inserted.BlCpy,VesselFst=inserted.VesselFst,Vessel=inserted.Vessel,SailDate=inserted.SailDate,ArrivalDate=inserted.ArrivalDate,FreightPayment=inserted.FreightPayment,BlSignPlace=inserted.BlSignPlace,PackCount=inserted.PackCount,
PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackGV=inserted.PackGV,PackWunit=inserted.PackWunit,PackVunit=inserted.PackVunit,ConsignText=inserted.ConsignText
from inserted where Consign=Obj
go
create trigger SconsignObj_Del on SconsignObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Tinvoice_Tinvoice on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Tinvoice from deleted where Tinvoice=Obj
end
go
create view TinvoiceObj as
select Obj,Cls,DocTime,Owner,State,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi
from Obj join Doc on Doc=Obj join Invoice on Invoice=Obj join Tinvoice on Tinvoice=Obj
go
create trigger TinvoiceObj_Ins on TinvoiceObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Tinvoice'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Invoice(Invoice,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText)
select Obj,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText
from inserted
insert Tinvoice(Tinvoice,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi)
select Obj,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi
from inserted
go
create trigger TinvoiceObj_Upd on TinvoiceObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(InvoiceNo) or update(Subject) or update(InvoiceDate) or update(Amount) or update(AmountX) or update(Company) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit) or update(PackGV) or update(PackVunit) or update(CuxStdRate)
or update(CuxIntRate) or update(PkPreface) or update(PkText)
update Invoice set InvoiceNo=inserted.InvoiceNo,Subject=inserted.Subject,InvoiceDate=inserted.InvoiceDate,Amount=inserted.Amount,AmountX=inserted.AmountX,Company=inserted.Company,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,CuxStdRate=inserted.CuxStdRate,
CuxIntRate=inserted.CuxIntRate,PkPreface=inserted.PkPreface,PkText=inserted.PkText
from inserted where Invoice=Obj
if update(InvoiceNoo) or update(OrderNos) or update(Trader) or update(TraderName) or update(TraderAddress) or update(CompanyName) or update(CompanyAddress) or update(LoadPort) or update(DestPort)
or update(TrshPort) or update(TransMode) or update(Tranship) or update(PayMode) or update(CommiRate) or update(CommiHide) or update(LoadLimit) or update(ExpiryLimit) or update(SignPlace) or update(Commi)
update Tinvoice set InvoiceNoo=inserted.InvoiceNoo,OrderNos=inserted.OrderNos,Trader=inserted.Trader,TraderName=inserted.TraderName,TraderAddress=inserted.TraderAddress,CompanyName=inserted.CompanyName,CompanyAddress=inserted.CompanyAddress,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,
TrshPort=inserted.TrshPort,TransMode=inserted.TransMode,Tranship=inserted.Tranship,PayMode=inserted.PayMode,CommiRate=inserted.CommiRate,CommiHide=inserted.CommiHide,LoadLimit=inserted.LoadLimit,ExpiryLimit=inserted.ExpiryLimit,SignPlace=inserted.SignPlace,Commi=inserted.Commi
from inserted where Tinvoice=Obj
go
create trigger TinvoiceObj_Del on TinvoiceObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Torder_Torder on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Torder from deleted where Torder=Obj
end
go
create view TorderObj as
select Obj,Cls,DocTime,Owner,State,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace
from Obj join Doc on Doc=Obj join Orders on Orders=Obj join Torder on Torder=Obj
go
create trigger TorderObj_Ins on TorderObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Torder'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Orders(Orders,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit)
select Obj,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit
from inserted
insert Torder(Torder,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace)
select Obj,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace
from inserted
go
create trigger TorderObj_Upd on TorderObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(OrderNo) or update(Subject) or update(Company) or update(OrderDate) or update(Amount) or update(AmountX) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit)
or update(PackGV) or update(PackVunit) or update(DeliverLimit)
update Orders set OrderNo=inserted.OrderNo,Subject=inserted.Subject,Company=inserted.Company,OrderDate=inserted.OrderDate,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,
PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,DeliverLimit=inserted.DeliverLimit
from inserted where Orders=Obj
if update(OrderNoo) or update(Trader) or update(Contacter) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(Partial) or update(Tranship) or update(CommiRate)
or update(CommiHide) or update(PayMode) or update(TransMode) or update(SignPlace)
update Torder set OrderNoo=inserted.OrderNoo,Trader=inserted.Trader,Contacter=inserted.Contacter,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,Partial=inserted.Partial,Tranship=inserted.Tranship,CommiRate=inserted.CommiRate,
CommiHide=inserted.CommiHide,PayMode=inserted.PayMode,TransMode=inserted.TransMode,SignPlace=inserted.SignPlace
from inserted where Torder=Obj
go
create trigger TorderObj_Del on TorderObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Vquote_Vquote on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Vquote from deleted where Vquote=Obj
end
go
create view VquoteObj as
select Obj,Cls,DocTime,Owner,State,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate,Saltax,Purtax,Revenue,RevenueX,RevenueY,Income,IncomeX,IncomeY,Commi
,Cost,Excise,GoodsCost,SalFee,OtherFee,Profit,ProfrateS,ProfrateC,SalFeeRate,OtherFeeRate
,Profactor,Calc
from Obj join Doc on Doc=Obj join Quote on Quote=Obj join Vquote on Vquote=Obj
go
create trigger VquoteObj_Ins on VquoteObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Vquote'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Quote(Quote,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate)
select Obj,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate
from inserted
insert Vquote(Vquote,Saltax,Purtax,Revenue,RevenueX,RevenueY,Income,IncomeX,IncomeY,Commi
,Cost,Excise,GoodsCost,SalFee,OtherFee,Profit,ProfrateS,ProfrateC,SalFeeRate,OtherFeeRate
,Profactor,Calc)
select Obj,Saltax,Purtax,Revenue,RevenueX,RevenueY,Income,IncomeX,IncomeY,Commi
,Cost,Excise,GoodsCost,SalFee,OtherFee,Profit,ProfrateS,ProfrateC,SalFeeRate,OtherFeeRate
,Profactor,Calc
from inserted
go
create trigger VquoteObj_Upd on VquoteObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(QuoteNo) or update(Subject) or update(QuoteDate) or update(ValidLimit) or update(Trader) or update(Company) or update(QuoteNoo) or update(Preface) or update(Contacter)
or update(Treaty) or update(Cux) or update(Amount) or update(AmountX) or update(AmountY) or update(PackCount) or update(Remark) or update(PackUnit) or update(PackGW) or update(LoadPort)
or update(PackNW) or update(DestPort) or update(PackWunit) or update(TrshPort) or update(PackGV) or update(Partial) or update(Tranship) or update(PackVunit) or update(CommiRate) or update(CommiHide)
or update(PayMode) or update(TransMode) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate)
update Quote set QuoteNo=inserted.QuoteNo,Subject=inserted.Subject,QuoteDate=inserted.QuoteDate,ValidLimit=inserted.ValidLimit,Trader=inserted.Trader,Company=inserted.Company,QuoteNoo=inserted.QuoteNoo,Preface=inserted.Preface,Contacter=inserted.Contacter,
Treaty=inserted.Treaty,Cux=inserted.Cux,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,PackCount=inserted.PackCount,Remark=inserted.Remark,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,LoadPort=inserted.LoadPort,
PackNW=inserted.PackNW,DestPort=inserted.DestPort,PackWunit=inserted.PackWunit,TrshPort=inserted.TrshPort,PackGV=inserted.PackGV,Partial=inserted.Partial,Tranship=inserted.Tranship,PackVunit=inserted.PackVunit,CommiRate=inserted.CommiRate,CommiHide=inserted.CommiHide,
PayMode=inserted.PayMode,TransMode=inserted.TransMode,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate
from inserted where Quote=Obj
if update(Saltax) or update(Purtax) or update(Revenue) or update(RevenueX) or update(RevenueY) or update(Income) or update(IncomeX) or update(IncomeY) or update(Commi)
or update(Cost) or update(Excise) or update(GoodsCost) or update(SalFee) or update(OtherFee) or update(Profit) or update(ProfrateS) or update(ProfrateC) or update(SalFeeRate) or update(OtherFeeRate)
or update(Profactor) or update(Calc)
update Vquote set Saltax=inserted.Saltax,Purtax=inserted.Purtax,Revenue=inserted.Revenue,RevenueX=inserted.RevenueX,RevenueY=inserted.RevenueY,Income=inserted.Income,IncomeX=inserted.IncomeX,IncomeY=inserted.IncomeY,Commi=inserted.Commi,
Cost=inserted.Cost,Excise=inserted.Excise,GoodsCost=inserted.GoodsCost,SalFee=inserted.SalFee,OtherFee=inserted.OtherFee,Profit=inserted.Profit,ProfrateS=inserted.ProfrateS,ProfrateC=inserted.ProfrateC,SalFeeRate=inserted.SalFeeRate,OtherFeeRate=inserted.OtherFeeRate,
Profactor=inserted.Profactor,Calc=inserted.Calc
from inserted where Vquote=Obj
go
create trigger VquoteObj_Del on VquoteObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Border_Border on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Border from deleted where Border=Obj
end
go
create view BorderObj as
select Obj,Cls,DocTime,Owner,State,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace,GoodsCost,GoodsCost_,GoodsCostX,GoodsCostX_,GoodsCostY,GoodsCostY_,Purtax,Purtax_
from Obj join Doc on Doc=Obj join Orders on Orders=Obj join Torder on Torder=Obj join Border on Border=Obj
go
create trigger BorderObj_Ins on BorderObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Border'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Orders(Orders,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit)
select Obj,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit
from inserted
insert Torder(Torder,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace)
select Obj,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace
from inserted
insert Border(Border,GoodsCost,GoodsCost_,GoodsCostX,GoodsCostX_,GoodsCostY,GoodsCostY_,Purtax,Purtax_)
select Obj,GoodsCost,GoodsCost_,GoodsCostX,GoodsCostX_,GoodsCostY,GoodsCostY_,Purtax,Purtax_
from inserted
go
create trigger BorderObj_Upd on BorderObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(OrderNo) or update(Subject) or update(Company) or update(OrderDate) or update(Amount) or update(AmountX) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit)
or update(PackGV) or update(PackVunit) or update(DeliverLimit)
update Orders set OrderNo=inserted.OrderNo,Subject=inserted.Subject,Company=inserted.Company,OrderDate=inserted.OrderDate,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,
PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,DeliverLimit=inserted.DeliverLimit
from inserted where Orders=Obj
if update(OrderNoo) or update(Trader) or update(Contacter) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(Partial) or update(Tranship) or update(CommiRate)
or update(CommiHide) or update(PayMode) or update(TransMode) or update(SignPlace)
update Torder set OrderNoo=inserted.OrderNoo,Trader=inserted.Trader,Contacter=inserted.Contacter,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,Partial=inserted.Partial,Tranship=inserted.Tranship,CommiRate=inserted.CommiRate,
CommiHide=inserted.CommiHide,PayMode=inserted.PayMode,TransMode=inserted.TransMode,SignPlace=inserted.SignPlace
from inserted where Torder=Obj
if update(GoodsCost) or update(GoodsCost_) or update(GoodsCostX) or update(GoodsCostX_) or update(GoodsCostY) or update(GoodsCostY_) or update(Purtax) or update(Purtax_)
update Border set GoodsCost=inserted.GoodsCost,GoodsCost_=inserted.GoodsCost_,GoodsCostX=inserted.GoodsCostX,GoodsCostX_=inserted.GoodsCostX_,GoodsCostY=inserted.GoodsCostY,GoodsCostY_=inserted.GoodsCostY_,Purtax=inserted.Purtax,Purtax_=inserted.Purtax_
from inserted where Border=Obj
go
create trigger BorderObj_Del on BorderObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Einvoice_Einvoice on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Einvoice from deleted where Einvoice=Obj
end
go
create view EinvoiceObj as
select Obj,Cls,DocTime,Owner,State,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi,Term,Terms,LcNo,LcBank,Vessel,InvoiceAmt
from Obj join Doc on Doc=Obj join Invoice on Invoice=Obj join Tinvoice on Tinvoice=Obj join Einvoice on Einvoice=Obj
go
create trigger EinvoiceObj_Ins on EinvoiceObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Einvoice'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Invoice(Invoice,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText)
select Obj,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText
from inserted
insert Tinvoice(Tinvoice,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi)
select Obj,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi
from inserted
insert Einvoice(Einvoice,Term,Terms,LcNo,LcBank,Vessel,InvoiceAmt)
select Obj,Term,Terms,LcNo,LcBank,Vessel,InvoiceAmt
from inserted
go
create trigger EinvoiceObj_Upd on EinvoiceObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(InvoiceNo) or update(Subject) or update(InvoiceDate) or update(Amount) or update(AmountX) or update(Company) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit) or update(PackGV) or update(PackVunit) or update(CuxStdRate)
or update(CuxIntRate) or update(PkPreface) or update(PkText)
update Invoice set InvoiceNo=inserted.InvoiceNo,Subject=inserted.Subject,InvoiceDate=inserted.InvoiceDate,Amount=inserted.Amount,AmountX=inserted.AmountX,Company=inserted.Company,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,CuxStdRate=inserted.CuxStdRate,
CuxIntRate=inserted.CuxIntRate,PkPreface=inserted.PkPreface,PkText=inserted.PkText
from inserted where Invoice=Obj
if update(InvoiceNoo) or update(OrderNos) or update(Trader) or update(TraderName) or update(TraderAddress) or update(CompanyName) or update(CompanyAddress) or update(LoadPort) or update(DestPort)
or update(TrshPort) or update(TransMode) or update(Tranship) or update(PayMode) or update(CommiRate) or update(CommiHide) or update(LoadLimit) or update(ExpiryLimit) or update(SignPlace) or update(Commi)
update Tinvoice set InvoiceNoo=inserted.InvoiceNoo,OrderNos=inserted.OrderNos,Trader=inserted.Trader,TraderName=inserted.TraderName,TraderAddress=inserted.TraderAddress,CompanyName=inserted.CompanyName,CompanyAddress=inserted.CompanyAddress,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,
TrshPort=inserted.TrshPort,TransMode=inserted.TransMode,Tranship=inserted.Tranship,PayMode=inserted.PayMode,CommiRate=inserted.CommiRate,CommiHide=inserted.CommiHide,LoadLimit=inserted.LoadLimit,ExpiryLimit=inserted.ExpiryLimit,SignPlace=inserted.SignPlace,Commi=inserted.Commi
from inserted where Tinvoice=Obj
if update(Term) or update(Terms) or update(LcNo) or update(LcBank) or update(Vessel) or update(InvoiceAmt)
update Einvoice set Term=inserted.Term,Terms=inserted.Terms,LcNo=inserted.LcNo,LcBank=inserted.LcBank,Vessel=inserted.Vessel,InvoiceAmt=inserted.InvoiceAmt
from inserted where Einvoice=Obj
go
create trigger EinvoiceObj_Del on EinvoiceObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Equote_Equote on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Equote from deleted where Equote=Obj
end
go
create view EquoteObj as
select Obj,Cls,DocTime,Owner,State,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate,Saltax,Purtax,Revenue,RevenueX,RevenueY,Income,IncomeX,IncomeY,Commi
,Cost,Excise,GoodsCost,SalFee,OtherFee,Profit,ProfrateS,ProfrateC,SalFeeRate,OtherFeeRate
,Profactor,Calc,Term,Terms,Drawback,EfrgtPrice,EfrgtCux,EfrgtType,EfrgtVol,EfrgtVunit,EfrgtWgt
,EfrgtWunit,ExpFrgt,ExpInsu,ExpFee,ExpCost,Xchg,XchgY,ExpInsuAdd,ExpInsuRate,ExpFeeRate
,ExpFrghted,ExpInsued
from Obj join Doc on Doc=Obj join Quote on Quote=Obj join Vquote on Vquote=Obj join Equote on Equote=Obj
go
create trigger EquoteObj_Ins on EquoteObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Equote'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Quote(Quote,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate)
select Obj,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate
from inserted
insert Vquote(Vquote,Saltax,Purtax,Revenue,RevenueX,RevenueY,Income,IncomeX,IncomeY,Commi
,Cost,Excise,GoodsCost,SalFee,OtherFee,Profit,ProfrateS,ProfrateC,SalFeeRate,OtherFeeRate
,Profactor,Calc)
select Obj,Saltax,Purtax,Revenue,RevenueX,RevenueY,Income,IncomeX,IncomeY,Commi
,Cost,Excise,GoodsCost,SalFee,OtherFee,Profit,ProfrateS,ProfrateC,SalFeeRate,OtherFeeRate
,Profactor,Calc
from inserted
insert Equote(Equote,Term,Terms,Drawback,EfrgtPrice,EfrgtCux,EfrgtType,EfrgtVol,EfrgtVunit,EfrgtWgt
,EfrgtWunit,ExpFrgt,ExpInsu,ExpFee,ExpCost,Xchg,XchgY,ExpInsuAdd,ExpInsuRate,ExpFeeRate
,ExpFrghted,ExpInsued)
select Obj,Term,Terms,Drawback,EfrgtPrice,EfrgtCux,EfrgtType,EfrgtVol,EfrgtVunit,EfrgtWgt
,EfrgtWunit,ExpFrgt,ExpInsu,ExpFee,ExpCost,Xchg,XchgY,ExpInsuAdd,ExpInsuRate,ExpFeeRate
,ExpFrghted,ExpInsued
from inserted
go
create trigger EquoteObj_Upd on EquoteObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(QuoteNo) or update(Subject) or update(QuoteDate) or update(ValidLimit) or update(Trader) or update(Company) or update(QuoteNoo) or update(Preface) or update(Contacter)
or update(Treaty) or update(Cux) or update(Amount) or update(AmountX) or update(AmountY) or update(PackCount) or update(Remark) or update(PackUnit) or update(PackGW) or update(LoadPort)
or update(PackNW) or update(DestPort) or update(PackWunit) or update(TrshPort) or update(PackGV) or update(Partial) or update(Tranship) or update(PackVunit) or update(CommiRate) or update(CommiHide)
or update(PayMode) or update(TransMode) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate)
update Quote set QuoteNo=inserted.QuoteNo,Subject=inserted.Subject,QuoteDate=inserted.QuoteDate,ValidLimit=inserted.ValidLimit,Trader=inserted.Trader,Company=inserted.Company,QuoteNoo=inserted.QuoteNoo,Preface=inserted.Preface,Contacter=inserted.Contacter,
Treaty=inserted.Treaty,Cux=inserted.Cux,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,PackCount=inserted.PackCount,Remark=inserted.Remark,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,LoadPort=inserted.LoadPort,
PackNW=inserted.PackNW,DestPort=inserted.DestPort,PackWunit=inserted.PackWunit,TrshPort=inserted.TrshPort,PackGV=inserted.PackGV,Partial=inserted.Partial,Tranship=inserted.Tranship,PackVunit=inserted.PackVunit,CommiRate=inserted.CommiRate,CommiHide=inserted.CommiHide,
PayMode=inserted.PayMode,TransMode=inserted.TransMode,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate
from inserted where Quote=Obj
if update(Saltax) or update(Purtax) or update(Revenue) or update(RevenueX) or update(RevenueY) or update(Income) or update(IncomeX) or update(IncomeY) or update(Commi)
or update(Cost) or update(Excise) or update(GoodsCost) or update(SalFee) or update(OtherFee) or update(Profit) or update(ProfrateS) or update(ProfrateC) or update(SalFeeRate) or update(OtherFeeRate)
or update(Profactor) or update(Calc)
update Vquote set Saltax=inserted.Saltax,Purtax=inserted.Purtax,Revenue=inserted.Revenue,RevenueX=inserted.RevenueX,RevenueY=inserted.RevenueY,Income=inserted.Income,IncomeX=inserted.IncomeX,IncomeY=inserted.IncomeY,Commi=inserted.Commi,
Cost=inserted.Cost,Excise=inserted.Excise,GoodsCost=inserted.GoodsCost,SalFee=inserted.SalFee,OtherFee=inserted.OtherFee,Profit=inserted.Profit,ProfrateS=inserted.ProfrateS,ProfrateC=inserted.ProfrateC,SalFeeRate=inserted.SalFeeRate,OtherFeeRate=inserted.OtherFeeRate,
Profactor=inserted.Profactor,Calc=inserted.Calc
from inserted where Vquote=Obj
if update(Term) or update(Terms) or update(Drawback) or update(EfrgtPrice) or update(EfrgtCux) or update(EfrgtType) or update(EfrgtVol) or update(EfrgtVunit) or update(EfrgtWgt)
or update(EfrgtWunit) or update(ExpFrgt) or update(ExpInsu) or update(ExpFee) or update(ExpCost) or update(Xchg) or update(XchgY) or update(ExpInsuAdd) or update(ExpInsuRate) or update(ExpFeeRate)
or update(ExpFrghted) or update(ExpInsued)
update Equote set Term=inserted.Term,Terms=inserted.Terms,Drawback=inserted.Drawback,EfrgtPrice=inserted.EfrgtPrice,EfrgtCux=inserted.EfrgtCux,EfrgtType=inserted.EfrgtType,EfrgtVol=inserted.EfrgtVol,EfrgtVunit=inserted.EfrgtVunit,EfrgtWgt=inserted.EfrgtWgt,
EfrgtWunit=inserted.EfrgtWunit,ExpFrgt=inserted.ExpFrgt,ExpInsu=inserted.ExpInsu,ExpFee=inserted.ExpFee,ExpCost=inserted.ExpCost,Xchg=inserted.Xchg,XchgY=inserted.XchgY,ExpInsuAdd=inserted.ExpInsuAdd,ExpInsuRate=inserted.ExpInsuRate,ExpFeeRate=inserted.ExpFeeRate,
ExpFrghted=inserted.ExpFrghted,ExpInsued=inserted.ExpInsued
from inserted where Equote=Obj
go
create trigger EquoteObj_Del on EquoteObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Firm_Firm on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Firm from deleted where Firm=Obj
end
go
create view FirmObj as
select Obj,Cls,DocTime,Owner,State,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount,Corporater,President,OrganCode,EnterpriseCode,TaxpayerCode,ManufactureID
from Obj join Doc on Doc=Obj join Sociar on Sociar=Obj join Entity on Entity=Obj join Firm on Firm=Obj
go
create trigger FirmObj_Ins on FirmObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Firm'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Sociar(Sociar,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary)
select Obj,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary
from inserted
insert Entity(Entity,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount)
select Obj,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount
from inserted
insert Firm(Firm,Corporater,President,OrganCode,EnterpriseCode,TaxpayerCode,ManufactureID)
select Obj,Corporater,President,OrganCode,EnterpriseCode,TaxpayerCode,ManufactureID
from inserted
go
create trigger FirmObj_Upd on FirmObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(Name) or update(Namee) or update(Tel) or update(Fax) or update(Email) or update(Web) or update(Address) or update(Addresse) or update(PostCode)
or update(Country) or update(Districts) or update(Citys) or update(Resume) or update(Resumee) or update(Mobile) or update(Summary)
update Sociar set Name=inserted.Name,Namee=inserted.Namee,Tel=inserted.Tel,Fax=inserted.Fax,Email=inserted.Email,Web=inserted.Web,Address=inserted.Address,Addresse=inserted.Addresse,PostCode=inserted.PostCode,
Country=inserted.Country,Districts=inserted.Districts,Citys=inserted.Citys,Resume=inserted.Resume,Resumee=inserted.Resumee,Mobile=inserted.Mobile,Summary=inserted.Summary
from inserted where Sociar=Obj
if update(FullName) or update(FullNamee) or update(EdiLink) or update(Contacter) or update(BankName) or update(BankAccount)
update Entity set FullName=inserted.FullName,FullNamee=inserted.FullNamee,EdiLink=inserted.EdiLink,Contacter=inserted.Contacter,BankName=inserted.BankName,BankAccount=inserted.BankAccount
from inserted where Entity=Obj
if update(Corporater) or update(President) or update(OrganCode) or update(EnterpriseCode) or update(TaxpayerCode) or update(ManufactureID)
update Firm set Corporater=inserted.Corporater,President=inserted.President,OrganCode=inserted.OrganCode,EnterpriseCode=inserted.EnterpriseCode,TaxpayerCode=inserted.TaxpayerCode,ManufactureID=inserted.ManufactureID
from inserted where Firm=Obj
go
create trigger FirmObj_Del on FirmObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Iinvoice_Iinvoice on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Iinvoice from deleted where Iinvoice=Obj
end
go
create view IinvoiceObj as
select Obj,Cls,DocTime,Owner,State,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi,Term,Terms,LcNo
from Obj join Doc on Doc=Obj join Invoice on Invoice=Obj join Tinvoice on Tinvoice=Obj join Iinvoice on Iinvoice=Obj
go
create trigger IinvoiceObj_Ins on IinvoiceObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Iinvoice'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Invoice(Invoice,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText)
select Obj,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText
from inserted
insert Tinvoice(Tinvoice,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi)
select Obj,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi
from inserted
insert Iinvoice(Iinvoice,Term,Terms,LcNo)
select Obj,Term,Terms,LcNo
from inserted
go
create trigger IinvoiceObj_Upd on IinvoiceObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(InvoiceNo) or update(Subject) or update(InvoiceDate) or update(Amount) or update(AmountX) or update(Company) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit) or update(PackGV) or update(PackVunit) or update(CuxStdRate)
or update(CuxIntRate) or update(PkPreface) or update(PkText)
update Invoice set InvoiceNo=inserted.InvoiceNo,Subject=inserted.Subject,InvoiceDate=inserted.InvoiceDate,Amount=inserted.Amount,AmountX=inserted.AmountX,Company=inserted.Company,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,CuxStdRate=inserted.CuxStdRate,
CuxIntRate=inserted.CuxIntRate,PkPreface=inserted.PkPreface,PkText=inserted.PkText
from inserted where Invoice=Obj
if update(InvoiceNoo) or update(OrderNos) or update(Trader) or update(TraderName) or update(TraderAddress) or update(CompanyName) or update(CompanyAddress) or update(LoadPort) or update(DestPort)
or update(TrshPort) or update(TransMode) or update(Tranship) or update(PayMode) or update(CommiRate) or update(CommiHide) or update(LoadLimit) or update(ExpiryLimit) or update(SignPlace) or update(Commi)
update Tinvoice set InvoiceNoo=inserted.InvoiceNoo,OrderNos=inserted.OrderNos,Trader=inserted.Trader,TraderName=inserted.TraderName,TraderAddress=inserted.TraderAddress,CompanyName=inserted.CompanyName,CompanyAddress=inserted.CompanyAddress,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,
TrshPort=inserted.TrshPort,TransMode=inserted.TransMode,Tranship=inserted.Tranship,PayMode=inserted.PayMode,CommiRate=inserted.CommiRate,CommiHide=inserted.CommiHide,LoadLimit=inserted.LoadLimit,ExpiryLimit=inserted.ExpiryLimit,SignPlace=inserted.SignPlace,Commi=inserted.Commi
from inserted where Tinvoice=Obj
if update(Term) or update(Terms) or update(LcNo)
update Iinvoice set Term=inserted.Term,Terms=inserted.Terms,LcNo=inserted.LcNo
from inserted where Iinvoice=Obj
go
create trigger IinvoiceObj_Del on IinvoiceObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Iquote_Iquote on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Iquote from deleted where Iquote=Obj
end
go
create view IquoteObj as
select Obj,Cls,DocTime,Owner,State,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate,Term,Terms
from Obj join Doc on Doc=Obj join Quote on Quote=Obj join Bquote on Bquote=Obj join Iquote on Iquote=Obj
go
create trigger IquoteObj_Ins on IquoteObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Iquote'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Quote(Quote,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate)
select Obj,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate
from inserted
insert Bquote(Bquote)
select Obj
from inserted
insert Iquote(Iquote,Term,Terms)
select Obj,Term,Terms
from inserted
go
create trigger IquoteObj_Upd on IquoteObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(QuoteNo) or update(Subject) or update(QuoteDate) or update(ValidLimit) or update(Trader) or update(Company) or update(QuoteNoo) or update(Preface) or update(Contacter)
or update(Treaty) or update(Cux) or update(Amount) or update(AmountX) or update(AmountY) or update(PackCount) or update(Remark) or update(PackUnit) or update(PackGW) or update(LoadPort)
or update(PackNW) or update(DestPort) or update(PackWunit) or update(TrshPort) or update(PackGV) or update(Partial) or update(Tranship) or update(PackVunit) or update(CommiRate) or update(CommiHide)
or update(PayMode) or update(TransMode) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate)
update Quote set QuoteNo=inserted.QuoteNo,Subject=inserted.Subject,QuoteDate=inserted.QuoteDate,ValidLimit=inserted.ValidLimit,Trader=inserted.Trader,Company=inserted.Company,QuoteNoo=inserted.QuoteNoo,Preface=inserted.Preface,Contacter=inserted.Contacter,
Treaty=inserted.Treaty,Cux=inserted.Cux,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,PackCount=inserted.PackCount,Remark=inserted.Remark,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,LoadPort=inserted.LoadPort,
PackNW=inserted.PackNW,DestPort=inserted.DestPort,PackWunit=inserted.PackWunit,TrshPort=inserted.TrshPort,PackGV=inserted.PackGV,Partial=inserted.Partial,Tranship=inserted.Tranship,PackVunit=inserted.PackVunit,CommiRate=inserted.CommiRate,CommiHide=inserted.CommiHide,
PayMode=inserted.PayMode,TransMode=inserted.TransMode,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate
from inserted where Quote=Obj
if update(Term) or update(Terms)
update Iquote set Term=inserted.Term,Terms=inserted.Terms
from inserted where Iquote=Obj
go
create trigger IquoteObj_Del on IquoteObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Pinvoice_Pinvoice on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Pinvoice from deleted where Pinvoice=Obj
end
go
create view PinvoiceObj as
select Obj,Cls,DocTime,Owner,State,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi,GoodsCost,GoodsCostX,GoodsCostY,Purtax
from Obj join Doc on Doc=Obj join Invoice on Invoice=Obj join Tinvoice on Tinvoice=Obj join Pinvoice on Pinvoice=Obj
go
create trigger PinvoiceObj_Ins on PinvoiceObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Pinvoice'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Invoice(Invoice,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText)
select Obj,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText
from inserted
insert Tinvoice(Tinvoice,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi)
select Obj,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi
from inserted
insert Pinvoice(Pinvoice,GoodsCost,GoodsCostX,GoodsCostY,Purtax)
select Obj,GoodsCost,GoodsCostX,GoodsCostY,Purtax
from inserted
go
create trigger PinvoiceObj_Upd on PinvoiceObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(InvoiceNo) or update(Subject) or update(InvoiceDate) or update(Amount) or update(AmountX) or update(Company) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit) or update(PackGV) or update(PackVunit) or update(CuxStdRate)
or update(CuxIntRate) or update(PkPreface) or update(PkText)
update Invoice set InvoiceNo=inserted.InvoiceNo,Subject=inserted.Subject,InvoiceDate=inserted.InvoiceDate,Amount=inserted.Amount,AmountX=inserted.AmountX,Company=inserted.Company,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,CuxStdRate=inserted.CuxStdRate,
CuxIntRate=inserted.CuxIntRate,PkPreface=inserted.PkPreface,PkText=inserted.PkText
from inserted where Invoice=Obj
if update(InvoiceNoo) or update(OrderNos) or update(Trader) or update(TraderName) or update(TraderAddress) or update(CompanyName) or update(CompanyAddress) or update(LoadPort) or update(DestPort)
or update(TrshPort) or update(TransMode) or update(Tranship) or update(PayMode) or update(CommiRate) or update(CommiHide) or update(LoadLimit) or update(ExpiryLimit) or update(SignPlace) or update(Commi)
update Tinvoice set InvoiceNoo=inserted.InvoiceNoo,OrderNos=inserted.OrderNos,Trader=inserted.Trader,TraderName=inserted.TraderName,TraderAddress=inserted.TraderAddress,CompanyName=inserted.CompanyName,CompanyAddress=inserted.CompanyAddress,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,
TrshPort=inserted.TrshPort,TransMode=inserted.TransMode,Tranship=inserted.Tranship,PayMode=inserted.PayMode,CommiRate=inserted.CommiRate,CommiHide=inserted.CommiHide,LoadLimit=inserted.LoadLimit,ExpiryLimit=inserted.ExpiryLimit,SignPlace=inserted.SignPlace,Commi=inserted.Commi
from inserted where Tinvoice=Obj
if update(GoodsCost) or update(GoodsCostX) or update(GoodsCostY) or update(Purtax)
update Pinvoice set GoodsCost=inserted.GoodsCost,GoodsCostX=inserted.GoodsCostX,GoodsCostY=inserted.GoodsCostY,Purtax=inserted.Purtax
from inserted where Pinvoice=Obj
go
create trigger PinvoiceObj_Del on PinvoiceObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Pquote_Pquote on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Pquote from deleted where Pquote=Obj
end
go
create view PquoteObj as
select Obj,Cls,DocTime,Owner,State,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate
from Obj join Doc on Doc=Obj join Quote on Quote=Obj join Bquote on Bquote=Obj join Pquote on Pquote=Obj
go
create trigger PquoteObj_Ins on PquoteObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Pquote'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Quote(Quote,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate)
select Obj,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate
from inserted
insert Bquote(Bquote)
select Obj
from inserted
insert Pquote(Pquote)
select Obj
from inserted
go
create trigger PquoteObj_Upd on PquoteObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(QuoteNo) or update(Subject) or update(QuoteDate) or update(ValidLimit) or update(Trader) or update(Company) or update(QuoteNoo) or update(Preface) or update(Contacter)
or update(Treaty) or update(Cux) or update(Amount) or update(AmountX) or update(AmountY) or update(PackCount) or update(Remark) or update(PackUnit) or update(PackGW) or update(LoadPort)
or update(PackNW) or update(DestPort) or update(PackWunit) or update(TrshPort) or update(PackGV) or update(Partial) or update(Tranship) or update(PackVunit) or update(CommiRate) or update(CommiHide)
or update(PayMode) or update(TransMode) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate)
update Quote set QuoteNo=inserted.QuoteNo,Subject=inserted.Subject,QuoteDate=inserted.QuoteDate,ValidLimit=inserted.ValidLimit,Trader=inserted.Trader,Company=inserted.Company,QuoteNoo=inserted.QuoteNoo,Preface=inserted.Preface,Contacter=inserted.Contacter,
Treaty=inserted.Treaty,Cux=inserted.Cux,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,PackCount=inserted.PackCount,Remark=inserted.Remark,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,LoadPort=inserted.LoadPort,
PackNW=inserted.PackNW,DestPort=inserted.DestPort,PackWunit=inserted.PackWunit,TrshPort=inserted.TrshPort,PackGV=inserted.PackGV,Partial=inserted.Partial,Tranship=inserted.Tranship,PackVunit=inserted.PackVunit,CommiRate=inserted.CommiRate,CommiHide=inserted.CommiHide,
PayMode=inserted.PayMode,TransMode=inserted.TransMode,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate
from inserted where Quote=Obj
go
create trigger PquoteObj_Del on PquoteObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Sinvoice_Sinvoice on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Sinvoice from deleted where Sinvoice=Obj
end
go
create view SinvoiceObj as
select Obj,Cls,DocTime,Owner,State,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi,GoodsCost,GoodsCostX,GoodsCostY,Saltax
from Obj join Doc on Doc=Obj join Invoice on Invoice=Obj join Tinvoice on Tinvoice=Obj join Sinvoice on Sinvoice=Obj
go
create trigger SinvoiceObj_Ins on SinvoiceObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Sinvoice'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Invoice(Invoice,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText)
select Obj,InvoiceNo,Subject,InvoiceDate,Amount,AmountX,Company,AmountY,Cux,Preface
,Treaty,Remark,PackCount,PackUnit,PackGW,PackNW,PackWunit,PackGV,PackVunit,CuxStdRate
,CuxIntRate,PkPreface,PkText
from inserted
insert Tinvoice(Tinvoice,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi)
select Obj,InvoiceNoo,OrderNos,Trader,TraderName,TraderAddress,CompanyName,CompanyAddress,LoadPort,DestPort
,TrshPort,TransMode,Tranship,PayMode,CommiRate,CommiHide,LoadLimit,ExpiryLimit,SignPlace,Commi
from inserted
insert Sinvoice(Sinvoice,GoodsCost,GoodsCostX,GoodsCostY,Saltax)
select Obj,GoodsCost,GoodsCostX,GoodsCostY,Saltax
from inserted
go
create trigger SinvoiceObj_Upd on SinvoiceObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(InvoiceNo) or update(Subject) or update(InvoiceDate) or update(Amount) or update(AmountX) or update(Company) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit) or update(PackGV) or update(PackVunit) or update(CuxStdRate)
or update(CuxIntRate) or update(PkPreface) or update(PkText)
update Invoice set InvoiceNo=inserted.InvoiceNo,Subject=inserted.Subject,InvoiceDate=inserted.InvoiceDate,Amount=inserted.Amount,AmountX=inserted.AmountX,Company=inserted.Company,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,CuxStdRate=inserted.CuxStdRate,
CuxIntRate=inserted.CuxIntRate,PkPreface=inserted.PkPreface,PkText=inserted.PkText
from inserted where Invoice=Obj
if update(InvoiceNoo) or update(OrderNos) or update(Trader) or update(TraderName) or update(TraderAddress) or update(CompanyName) or update(CompanyAddress) or update(LoadPort) or update(DestPort)
or update(TrshPort) or update(TransMode) or update(Tranship) or update(PayMode) or update(CommiRate) or update(CommiHide) or update(LoadLimit) or update(ExpiryLimit) or update(SignPlace) or update(Commi)
update Tinvoice set InvoiceNoo=inserted.InvoiceNoo,OrderNos=inserted.OrderNos,Trader=inserted.Trader,TraderName=inserted.TraderName,TraderAddress=inserted.TraderAddress,CompanyName=inserted.CompanyName,CompanyAddress=inserted.CompanyAddress,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,
TrshPort=inserted.TrshPort,TransMode=inserted.TransMode,Tranship=inserted.Tranship,PayMode=inserted.PayMode,CommiRate=inserted.CommiRate,CommiHide=inserted.CommiHide,LoadLimit=inserted.LoadLimit,ExpiryLimit=inserted.ExpiryLimit,SignPlace=inserted.SignPlace,Commi=inserted.Commi
from inserted where Tinvoice=Obj
if update(GoodsCost) or update(GoodsCostX) or update(GoodsCostY) or update(Saltax)
update Sinvoice set GoodsCost=inserted.GoodsCost,GoodsCostX=inserted.GoodsCostX,GoodsCostY=inserted.GoodsCostY,Saltax=inserted.Saltax
from inserted where Sinvoice=Obj
go
create trigger SinvoiceObj_Del on SinvoiceObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Squote_Squote on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Squote from deleted where Squote=Obj
end
go
create view SquoteObj as
select Obj,Cls,DocTime,Owner,State,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate,Saltax,Purtax,Revenue,RevenueX,RevenueY,Income,IncomeX,IncomeY,Commi
,Cost,Excise,GoodsCost,SalFee,OtherFee,Profit,ProfrateS,ProfrateC,SalFeeRate,OtherFeeRate
,Profactor,Calc,ImpFrghted,ImpInsued,IfrgtPrice,IfrgtCux,IfrgtType,IfrgtVol,IfrgtVunit,IfrgtWgt,IfrgtWunit
,Imptax,ImpFrgt,ImpInsu,ImpFee,ImpInsuAdd,ImpInsuRate,ImpFeeRate
from Obj join Doc on Doc=Obj join Quote on Quote=Obj join Vquote on Vquote=Obj join Squote on Squote=Obj
go
create trigger SquoteObj_Ins on SquoteObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Squote'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Quote(Quote,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate)
select Obj,QuoteNo,Subject,QuoteDate,ValidLimit,Trader,Company,QuoteNoo,Preface,Contacter
,Treaty,Cux,Amount,AmountX,AmountY,PackCount,Remark,PackUnit,PackGW,LoadPort
,PackNW,DestPort,PackWunit,TrshPort,PackGV,Partial,Tranship,PackVunit,CommiRate,CommiHide
,PayMode,TransMode,Allowance,CuxStdRate,CuxIntRate
from inserted
insert Vquote(Vquote,Saltax,Purtax,Revenue,RevenueX,RevenueY,Income,IncomeX,IncomeY,Commi
,Cost,Excise,GoodsCost,SalFee,OtherFee,Profit,ProfrateS,ProfrateC,SalFeeRate,OtherFeeRate
,Profactor,Calc)
select Obj,Saltax,Purtax,Revenue,RevenueX,RevenueY,Income,IncomeX,IncomeY,Commi
,Cost,Excise,GoodsCost,SalFee,OtherFee,Profit,ProfrateS,ProfrateC,SalFeeRate,OtherFeeRate
,Profactor,Calc
from inserted
insert Squote(Squote,ImpFrghted,ImpInsued,IfrgtPrice,IfrgtCux,IfrgtType,IfrgtVol,IfrgtVunit,IfrgtWgt,IfrgtWunit
,Imptax,ImpFrgt,ImpInsu,ImpFee,ImpInsuAdd,ImpInsuRate,ImpFeeRate)
select Obj,ImpFrghted,ImpInsued,IfrgtPrice,IfrgtCux,IfrgtType,IfrgtVol,IfrgtVunit,IfrgtWgt,IfrgtWunit
,Imptax,ImpFrgt,ImpInsu,ImpFee,ImpInsuAdd,ImpInsuRate,ImpFeeRate
from inserted
go
create trigger SquoteObj_Upd on SquoteObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(QuoteNo) or update(Subject) or update(QuoteDate) or update(ValidLimit) or update(Trader) or update(Company) or update(QuoteNoo) or update(Preface) or update(Contacter)
or update(Treaty) or update(Cux) or update(Amount) or update(AmountX) or update(AmountY) or update(PackCount) or update(Remark) or update(PackUnit) or update(PackGW) or update(LoadPort)
or update(PackNW) or update(DestPort) or update(PackWunit) or update(TrshPort) or update(PackGV) or update(Partial) or update(Tranship) or update(PackVunit) or update(CommiRate) or update(CommiHide)
or update(PayMode) or update(TransMode) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate)
update Quote set QuoteNo=inserted.QuoteNo,Subject=inserted.Subject,QuoteDate=inserted.QuoteDate,ValidLimit=inserted.ValidLimit,Trader=inserted.Trader,Company=inserted.Company,QuoteNoo=inserted.QuoteNoo,Preface=inserted.Preface,Contacter=inserted.Contacter,
Treaty=inserted.Treaty,Cux=inserted.Cux,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,PackCount=inserted.PackCount,Remark=inserted.Remark,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,LoadPort=inserted.LoadPort,
PackNW=inserted.PackNW,DestPort=inserted.DestPort,PackWunit=inserted.PackWunit,TrshPort=inserted.TrshPort,PackGV=inserted.PackGV,Partial=inserted.Partial,Tranship=inserted.Tranship,PackVunit=inserted.PackVunit,CommiRate=inserted.CommiRate,CommiHide=inserted.CommiHide,
PayMode=inserted.PayMode,TransMode=inserted.TransMode,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate
from inserted where Quote=Obj
if update(Saltax) or update(Purtax) or update(Revenue) or update(RevenueX) or update(RevenueY) or update(Income) or update(IncomeX) or update(IncomeY) or update(Commi)
or update(Cost) or update(Excise) or update(GoodsCost) or update(SalFee) or update(OtherFee) or update(Profit) or update(ProfrateS) or update(ProfrateC) or update(SalFeeRate) or update(OtherFeeRate)
or update(Profactor) or update(Calc)
update Vquote set Saltax=inserted.Saltax,Purtax=inserted.Purtax,Revenue=inserted.Revenue,RevenueX=inserted.RevenueX,RevenueY=inserted.RevenueY,Income=inserted.Income,IncomeX=inserted.IncomeX,IncomeY=inserted.IncomeY,Commi=inserted.Commi,
Cost=inserted.Cost,Excise=inserted.Excise,GoodsCost=inserted.GoodsCost,SalFee=inserted.SalFee,OtherFee=inserted.OtherFee,Profit=inserted.Profit,ProfrateS=inserted.ProfrateS,ProfrateC=inserted.ProfrateC,SalFeeRate=inserted.SalFeeRate,OtherFeeRate=inserted.OtherFeeRate,
Profactor=inserted.Profactor,Calc=inserted.Calc
from inserted where Vquote=Obj
if update(ImpFrghted) or update(ImpInsued) or update(IfrgtPrice) or update(IfrgtCux) or update(IfrgtType) or update(IfrgtVol) or update(IfrgtVunit) or update(IfrgtWgt) or update(IfrgtWunit)
or update(Imptax) or update(ImpFrgt) or update(ImpInsu) or update(ImpFee) or update(ImpInsuAdd) or update(ImpInsuRate) or update(ImpFeeRate)
update Squote set ImpFrghted=inserted.ImpFrghted,ImpInsued=inserted.ImpInsued,IfrgtPrice=inserted.IfrgtPrice,IfrgtCux=inserted.IfrgtCux,IfrgtType=inserted.IfrgtType,IfrgtVol=inserted.IfrgtVol,IfrgtVunit=inserted.IfrgtVunit,IfrgtWgt=inserted.IfrgtWgt,IfrgtWunit=inserted.IfrgtWunit,
Imptax=inserted.Imptax,ImpFrgt=inserted.ImpFrgt,ImpInsu=inserted.ImpInsu,ImpFee=inserted.ImpFee,ImpInsuAdd=inserted.ImpInsuAdd,ImpInsuRate=inserted.ImpInsuRate,ImpFeeRate=inserted.ImpFeeRate
from inserted where Squote=Obj
go
create trigger SquoteObj_Del on SquoteObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Vorder_Vorder on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Vorder from deleted where Vorder=Obj
end
go
create view VorderObj as
select Obj,Cls,DocTime,Owner,State,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace,Saltax,Saltax_,Purtax,Purtax_,Revenue,Revenue_,RevenueX,RevenueX_,RevenueY
,RevenueY_,Income,Income_,IncomeX,IncomeX_,IncomeY,IncomeY_,Commi,Commi_,Cost
,Cost_,Excise,Excise_,GoodsCost,GoodsCost_,SalFee,SalFee_,OtherFee,OtherFee_,Profit
,Profit_,ProfrateS,ProfrateS_,ProfrateC,ProfrateC_,SalFeeRate,SalFeeRate_,OtherFeeRate,Profactor,Calc
,PreReceive,PreReceiveX,PreReceiveY,Receivable,ReceivableX,ReceivableY,Receiveok,ReceiveokX,ReceiveokY,Prepay
,PrepayX,PrepayY,Payok,PayokX,PayokY,Collect,CollectX,CollectY,PiDate,PiPreface
,PiText
from Obj join Doc on Doc=Obj join Orders on Orders=Obj join Torder on Torder=Obj join Vorder on Vorder=Obj
go
create trigger VorderObj_Ins on VorderObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Vorder'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Orders(Orders,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit)
select Obj,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit
from inserted
insert Torder(Torder,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace)
select Obj,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace
from inserted
insert Vorder(Vorder,Saltax,Saltax_,Purtax,Purtax_,Revenue,Revenue_,RevenueX,RevenueX_,RevenueY
,RevenueY_,Income,Income_,IncomeX,IncomeX_,IncomeY,IncomeY_,Commi,Commi_,Cost
,Cost_,Excise,Excise_,GoodsCost,GoodsCost_,SalFee,SalFee_,OtherFee,OtherFee_,Profit
,Profit_,ProfrateS,ProfrateS_,ProfrateC,ProfrateC_,SalFeeRate,SalFeeRate_,OtherFeeRate,Profactor,Calc
,PreReceive,PreReceiveX,PreReceiveY,Receivable,ReceivableX,ReceivableY,Receiveok,ReceiveokX,ReceiveokY,Prepay
,PrepayX,PrepayY,Payok,PayokX,PayokY,Collect,CollectX,CollectY,PiDate,PiPreface
,PiText)
select Obj,Saltax,Saltax_,Purtax,Purtax_,Revenue,Revenue_,RevenueX,RevenueX_,RevenueY
,RevenueY_,Income,Income_,IncomeX,IncomeX_,IncomeY,IncomeY_,Commi,Commi_,Cost
,Cost_,Excise,Excise_,GoodsCost,GoodsCost_,SalFee,SalFee_,OtherFee,OtherFee_,Profit
,Profit_,ProfrateS,ProfrateS_,ProfrateC,ProfrateC_,SalFeeRate,SalFeeRate_,OtherFeeRate,Profactor,Calc
,PreReceive,PreReceiveX,PreReceiveY,Receivable,ReceivableX,ReceivableY,Receiveok,ReceiveokX,ReceiveokY,Prepay
,PrepayX,PrepayY,Payok,PayokX,PayokY,Collect,CollectX,CollectY,PiDate,PiPreface
,PiText
from inserted
go
create trigger VorderObj_Upd on VorderObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(OrderNo) or update(Subject) or update(Company) or update(OrderDate) or update(Amount) or update(AmountX) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit)
or update(PackGV) or update(PackVunit) or update(DeliverLimit)
update Orders set OrderNo=inserted.OrderNo,Subject=inserted.Subject,Company=inserted.Company,OrderDate=inserted.OrderDate,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,
PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,DeliverLimit=inserted.DeliverLimit
from inserted where Orders=Obj
if update(OrderNoo) or update(Trader) or update(Contacter) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(Partial) or update(Tranship) or update(CommiRate)
or update(CommiHide) or update(PayMode) or update(TransMode) or update(SignPlace)
update Torder set OrderNoo=inserted.OrderNoo,Trader=inserted.Trader,Contacter=inserted.Contacter,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,Partial=inserted.Partial,Tranship=inserted.Tranship,CommiRate=inserted.CommiRate,
CommiHide=inserted.CommiHide,PayMode=inserted.PayMode,TransMode=inserted.TransMode,SignPlace=inserted.SignPlace
from inserted where Torder=Obj
if update(Saltax) or update(Saltax_) or update(Purtax) or update(Purtax_) or update(Revenue) or update(Revenue_) or update(RevenueX) or update(RevenueX_) or update(RevenueY)
or update(RevenueY_) or update(Income) or update(Income_) or update(IncomeX) or update(IncomeX_) or update(IncomeY) or update(IncomeY_) or update(Commi) or update(Commi_) or update(Cost)
or update(Cost_) or update(Excise) or update(Excise_) or update(GoodsCost) or update(GoodsCost_) or update(SalFee) or update(SalFee_) or update(OtherFee) or update(OtherFee_) or update(Profit)
or update(Profit_) or update(ProfrateS) or update(ProfrateS_) or update(ProfrateC) or update(ProfrateC_) or update(SalFeeRate) or update(SalFeeRate_) or update(OtherFeeRate) or update(Profactor) or update(Calc)
or update(PreReceive) or update(PreReceiveX) or update(PreReceiveY) or update(Receivable) or update(ReceivableX) or update(ReceivableY) or update(Receiveok) or update(ReceiveokX) or update(ReceiveokY) or update(Prepay)
or update(PrepayX) or update(PrepayY) or update(Payok) or update(PayokX) or update(PayokY) or update(Collect) or update(CollectX) or update(CollectY) or update(PiDate) or update(PiPreface)
or update(PiText)
update Vorder set Saltax=inserted.Saltax,Saltax_=inserted.Saltax_,Purtax=inserted.Purtax,Purtax_=inserted.Purtax_,Revenue=inserted.Revenue,Revenue_=inserted.Revenue_,RevenueX=inserted.RevenueX,RevenueX_=inserted.RevenueX_,RevenueY=inserted.RevenueY,
RevenueY_=inserted.RevenueY_,Income=inserted.Income,Income_=inserted.Income_,IncomeX=inserted.IncomeX,IncomeX_=inserted.IncomeX_,IncomeY=inserted.IncomeY,IncomeY_=inserted.IncomeY_,Commi=inserted.Commi,Commi_=inserted.Commi_,Cost=inserted.Cost,
Cost_=inserted.Cost_,Excise=inserted.Excise,Excise_=inserted.Excise_,GoodsCost=inserted.GoodsCost,GoodsCost_=inserted.GoodsCost_,SalFee=inserted.SalFee,SalFee_=inserted.SalFee_,OtherFee=inserted.OtherFee,OtherFee_=inserted.OtherFee_,Profit=inserted.Profit,
Profit_=inserted.Profit_,ProfrateS=inserted.ProfrateS,ProfrateS_=inserted.ProfrateS_,ProfrateC=inserted.ProfrateC,ProfrateC_=inserted.ProfrateC_,SalFeeRate=inserted.SalFeeRate,SalFeeRate_=inserted.SalFeeRate_,OtherFeeRate=inserted.OtherFeeRate,Profactor=inserted.Profactor,Calc=inserted.Calc,
PreReceive=inserted.PreReceive,PreReceiveX=inserted.PreReceiveX,PreReceiveY=inserted.PreReceiveY,Receivable=inserted.Receivable,ReceivableX=inserted.ReceivableX,ReceivableY=inserted.ReceivableY,Receiveok=inserted.Receiveok,ReceiveokX=inserted.ReceiveokX,ReceiveokY=inserted.ReceiveokY,Prepay=inserted.Prepay,
PrepayX=inserted.PrepayX,PrepayY=inserted.PrepayY,Payok=inserted.Payok,PayokX=inserted.PayokX,PayokY=inserted.PayokY,Collect=inserted.Collect,CollectX=inserted.CollectX,CollectY=inserted.CollectY,PiDate=inserted.PiDate,PiPreface=inserted.PiPreface,
PiText=inserted.PiText
from inserted where Vorder=Obj
go
create trigger VorderObj_Del on VorderObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Eorder_Eorder on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Eorder from deleted where Eorder=Obj
end
go
create view EorderObj as
select Obj,Cls,DocTime,Owner,State,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace,Saltax,Saltax_,Purtax,Purtax_,Revenue,Revenue_,RevenueX,RevenueX_,RevenueY
,RevenueY_,Income,Income_,IncomeX,IncomeX_,IncomeY,IncomeY_,Commi,Commi_,Cost
,Cost_,Excise,Excise_,GoodsCost,GoodsCost_,SalFee,SalFee_,OtherFee,OtherFee_,Profit
,Profit_,ProfrateS,ProfrateS_,ProfrateC,ProfrateC_,SalFeeRate,SalFeeRate_,OtherFeeRate,Profactor,Calc
,PreReceive,PreReceiveX,PreReceiveY,Receivable,ReceivableX,ReceivableY,Receiveok,ReceiveokX,ReceiveokY,Prepay
,PrepayX,PrepayY,Payok,PayokX,PayokY,Collect,CollectX,CollectY,PiDate,PiPreface
,PiText,Term,Terms,Drawback,Drawback_,EfrgtPrice,EfrgtCux,EfrgtType,EfrgtVol,EfrgtVunit
,EfrgtWgt,EfrgtWunit,ExpFrgt,ExpFrgt_,ExpInsu,ExpInsu_,ExpFee,ExpFee_,ExpCost,ExpCost_
,Xchg,Xchg_,XchgY,XchgY_,ExpInsuAdd,ExpInsuRate,ExpFeeRate,ExpFeeRate_,ExpFrghted,ExpInsued
from Obj join Doc on Doc=Obj join Orders on Orders=Obj join Torder on Torder=Obj join Vorder on Vorder=Obj join Eorder on Eorder=Obj
go
create trigger EorderObj_Ins on EorderObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Eorder'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Orders(Orders,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit)
select Obj,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit
from inserted
insert Torder(Torder,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace)
select Obj,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace
from inserted
insert Vorder(Vorder,Saltax,Saltax_,Purtax,Purtax_,Revenue,Revenue_,RevenueX,RevenueX_,RevenueY
,RevenueY_,Income,Income_,IncomeX,IncomeX_,IncomeY,IncomeY_,Commi,Commi_,Cost
,Cost_,Excise,Excise_,GoodsCost,GoodsCost_,SalFee,SalFee_,OtherFee,OtherFee_,Profit
,Profit_,ProfrateS,ProfrateS_,ProfrateC,ProfrateC_,SalFeeRate,SalFeeRate_,OtherFeeRate,Profactor,Calc
,PreReceive,PreReceiveX,PreReceiveY,Receivable,ReceivableX,ReceivableY,Receiveok,ReceiveokX,ReceiveokY,Prepay
,PrepayX,PrepayY,Payok,PayokX,PayokY,Collect,CollectX,CollectY,PiDate,PiPreface
,PiText)
select Obj,Saltax,Saltax_,Purtax,Purtax_,Revenue,Revenue_,RevenueX,RevenueX_,RevenueY
,RevenueY_,Income,Income_,IncomeX,IncomeX_,IncomeY,IncomeY_,Commi,Commi_,Cost
,Cost_,Excise,Excise_,GoodsCost,GoodsCost_,SalFee,SalFee_,OtherFee,OtherFee_,Profit
,Profit_,ProfrateS,ProfrateS_,ProfrateC,ProfrateC_,SalFeeRate,SalFeeRate_,OtherFeeRate,Profactor,Calc
,PreReceive,PreReceiveX,PreReceiveY,Receivable,ReceivableX,ReceivableY,Receiveok,ReceiveokX,ReceiveokY,Prepay
,PrepayX,PrepayY,Payok,PayokX,PayokY,Collect,CollectX,CollectY,PiDate,PiPreface
,PiText
from inserted
insert Eorder(Eorder,Term,Terms,Drawback,Drawback_,EfrgtPrice,EfrgtCux,EfrgtType,EfrgtVol,EfrgtVunit
,EfrgtWgt,EfrgtWunit,ExpFrgt,ExpFrgt_,ExpInsu,ExpInsu_,ExpFee,ExpFee_,ExpCost,ExpCost_
,Xchg,Xchg_,XchgY,XchgY_,ExpInsuAdd,ExpInsuRate,ExpFeeRate,ExpFeeRate_,ExpFrghted,ExpInsued)
select Obj,Term,Terms,Drawback,Drawback_,EfrgtPrice,EfrgtCux,EfrgtType,EfrgtVol,EfrgtVunit
,EfrgtWgt,EfrgtWunit,ExpFrgt,ExpFrgt_,ExpInsu,ExpInsu_,ExpFee,ExpFee_,ExpCost,ExpCost_
,Xchg,Xchg_,XchgY,XchgY_,ExpInsuAdd,ExpInsuRate,ExpFeeRate,ExpFeeRate_,ExpFrghted,ExpInsued
from inserted
go
create trigger EorderObj_Upd on EorderObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(OrderNo) or update(Subject) or update(Company) or update(OrderDate) or update(Amount) or update(AmountX) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit)
or update(PackGV) or update(PackVunit) or update(DeliverLimit)
update Orders set OrderNo=inserted.OrderNo,Subject=inserted.Subject,Company=inserted.Company,OrderDate=inserted.OrderDate,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,
PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,DeliverLimit=inserted.DeliverLimit
from inserted where Orders=Obj
if update(OrderNoo) or update(Trader) or update(Contacter) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(Partial) or update(Tranship) or update(CommiRate)
or update(CommiHide) or update(PayMode) or update(TransMode) or update(SignPlace)
update Torder set OrderNoo=inserted.OrderNoo,Trader=inserted.Trader,Contacter=inserted.Contacter,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,Partial=inserted.Partial,Tranship=inserted.Tranship,CommiRate=inserted.CommiRate,
CommiHide=inserted.CommiHide,PayMode=inserted.PayMode,TransMode=inserted.TransMode,SignPlace=inserted.SignPlace
from inserted where Torder=Obj
if update(Saltax) or update(Saltax_) or update(Purtax) or update(Purtax_) or update(Revenue) or update(Revenue_) or update(RevenueX) or update(RevenueX_) or update(RevenueY)
or update(RevenueY_) or update(Income) or update(Income_) or update(IncomeX) or update(IncomeX_) or update(IncomeY) or update(IncomeY_) or update(Commi) or update(Commi_) or update(Cost)
or update(Cost_) or update(Excise) or update(Excise_) or update(GoodsCost) or update(GoodsCost_) or update(SalFee) or update(SalFee_) or update(OtherFee) or update(OtherFee_) or update(Profit)
or update(Profit_) or update(ProfrateS) or update(ProfrateS_) or update(ProfrateC) or update(ProfrateC_) or update(SalFeeRate) or update(SalFeeRate_) or update(OtherFeeRate) or update(Profactor) or update(Calc)
or update(PreReceive) or update(PreReceiveX) or update(PreReceiveY) or update(Receivable) or update(ReceivableX) or update(ReceivableY) or update(Receiveok) or update(ReceiveokX) or update(ReceiveokY) or update(Prepay)
or update(PrepayX) or update(PrepayY) or update(Payok) or update(PayokX) or update(PayokY) or update(Collect) or update(CollectX) or update(CollectY) or update(PiDate) or update(PiPreface)
or update(PiText)
update Vorder set Saltax=inserted.Saltax,Saltax_=inserted.Saltax_,Purtax=inserted.Purtax,Purtax_=inserted.Purtax_,Revenue=inserted.Revenue,Revenue_=inserted.Revenue_,RevenueX=inserted.RevenueX,RevenueX_=inserted.RevenueX_,RevenueY=inserted.RevenueY,
RevenueY_=inserted.RevenueY_,Income=inserted.Income,Income_=inserted.Income_,IncomeX=inserted.IncomeX,IncomeX_=inserted.IncomeX_,IncomeY=inserted.IncomeY,IncomeY_=inserted.IncomeY_,Commi=inserted.Commi,Commi_=inserted.Commi_,Cost=inserted.Cost,
Cost_=inserted.Cost_,Excise=inserted.Excise,Excise_=inserted.Excise_,GoodsCost=inserted.GoodsCost,GoodsCost_=inserted.GoodsCost_,SalFee=inserted.SalFee,SalFee_=inserted.SalFee_,OtherFee=inserted.OtherFee,OtherFee_=inserted.OtherFee_,Profit=inserted.Profit,
Profit_=inserted.Profit_,ProfrateS=inserted.ProfrateS,ProfrateS_=inserted.ProfrateS_,ProfrateC=inserted.ProfrateC,ProfrateC_=inserted.ProfrateC_,SalFeeRate=inserted.SalFeeRate,SalFeeRate_=inserted.SalFeeRate_,OtherFeeRate=inserted.OtherFeeRate,Profactor=inserted.Profactor,Calc=inserted.Calc,
PreReceive=inserted.PreReceive,PreReceiveX=inserted.PreReceiveX,PreReceiveY=inserted.PreReceiveY,Receivable=inserted.Receivable,ReceivableX=inserted.ReceivableX,ReceivableY=inserted.ReceivableY,Receiveok=inserted.Receiveok,ReceiveokX=inserted.ReceiveokX,ReceiveokY=inserted.ReceiveokY,Prepay=inserted.Prepay,
PrepayX=inserted.PrepayX,PrepayY=inserted.PrepayY,Payok=inserted.Payok,PayokX=inserted.PayokX,PayokY=inserted.PayokY,Collect=inserted.Collect,CollectX=inserted.CollectX,CollectY=inserted.CollectY,PiDate=inserted.PiDate,PiPreface=inserted.PiPreface,
PiText=inserted.PiText
from inserted where Vorder=Obj
if update(Term) or update(Terms) or update(Drawback) or update(Drawback_) or update(EfrgtPrice) or update(EfrgtCux) or update(EfrgtType) or update(EfrgtVol) or update(EfrgtVunit)
or update(EfrgtWgt) or update(EfrgtWunit) or update(ExpFrgt) or update(ExpFrgt_) or update(ExpInsu) or update(ExpInsu_) or update(ExpFee) or update(ExpFee_) or update(ExpCost) or update(ExpCost_)
or update(Xchg) or update(Xchg_) or update(XchgY) or update(XchgY_) or update(ExpInsuAdd) or update(ExpInsuRate) or update(ExpFeeRate) or update(ExpFeeRate_) or update(ExpFrghted) or update(ExpInsued)
update Eorder set Term=inserted.Term,Terms=inserted.Terms,Drawback=inserted.Drawback,Drawback_=inserted.Drawback_,EfrgtPrice=inserted.EfrgtPrice,EfrgtCux=inserted.EfrgtCux,EfrgtType=inserted.EfrgtType,EfrgtVol=inserted.EfrgtVol,EfrgtVunit=inserted.EfrgtVunit,
EfrgtWgt=inserted.EfrgtWgt,EfrgtWunit=inserted.EfrgtWunit,ExpFrgt=inserted.ExpFrgt,ExpFrgt_=inserted.ExpFrgt_,ExpInsu=inserted.ExpInsu,ExpInsu_=inserted.ExpInsu_,ExpFee=inserted.ExpFee,ExpFee_=inserted.ExpFee_,ExpCost=inserted.ExpCost,ExpCost_=inserted.ExpCost_,
Xchg=inserted.Xchg,Xchg_=inserted.Xchg_,XchgY=inserted.XchgY,XchgY_=inserted.XchgY_,ExpInsuAdd=inserted.ExpInsuAdd,ExpInsuRate=inserted.ExpInsuRate,ExpFeeRate=inserted.ExpFeeRate,ExpFeeRate_=inserted.ExpFeeRate_,ExpFrghted=inserted.ExpFrghted,ExpInsued=inserted.ExpInsued
from inserted where Eorder=Obj
go
create trigger EorderObj_Del on EorderObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Iorder_Iorder on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Iorder from deleted where Iorder=Obj
end
go
create view IorderObj as
select Obj,Cls,DocTime,Owner,State,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace,GoodsCost,GoodsCost_,GoodsCostX,GoodsCostX_,GoodsCostY,GoodsCostY_,Purtax,Purtax_,Term,Terms
from Obj join Doc on Doc=Obj join Orders on Orders=Obj join Torder on Torder=Obj join Border on Border=Obj join Iorder on Iorder=Obj
go
create trigger IorderObj_Ins on IorderObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Iorder'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Orders(Orders,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit)
select Obj,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit
from inserted
insert Torder(Torder,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace)
select Obj,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace
from inserted
insert Border(Border,GoodsCost,GoodsCost_,GoodsCostX,GoodsCostX_,GoodsCostY,GoodsCostY_,Purtax,Purtax_)
select Obj,GoodsCost,GoodsCost_,GoodsCostX,GoodsCostX_,GoodsCostY,GoodsCostY_,Purtax,Purtax_
from inserted
insert Iorder(Iorder,Term,Terms)
select Obj,Term,Terms
from inserted
go
create trigger IorderObj_Upd on IorderObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(OrderNo) or update(Subject) or update(Company) or update(OrderDate) or update(Amount) or update(AmountX) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit)
or update(PackGV) or update(PackVunit) or update(DeliverLimit)
update Orders set OrderNo=inserted.OrderNo,Subject=inserted.Subject,Company=inserted.Company,OrderDate=inserted.OrderDate,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,
PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,DeliverLimit=inserted.DeliverLimit
from inserted where Orders=Obj
if update(OrderNoo) or update(Trader) or update(Contacter) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(Partial) or update(Tranship) or update(CommiRate)
or update(CommiHide) or update(PayMode) or update(TransMode) or update(SignPlace)
update Torder set OrderNoo=inserted.OrderNoo,Trader=inserted.Trader,Contacter=inserted.Contacter,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,Partial=inserted.Partial,Tranship=inserted.Tranship,CommiRate=inserted.CommiRate,
CommiHide=inserted.CommiHide,PayMode=inserted.PayMode,TransMode=inserted.TransMode,SignPlace=inserted.SignPlace
from inserted where Torder=Obj
if update(GoodsCost) or update(GoodsCost_) or update(GoodsCostX) or update(GoodsCostX_) or update(GoodsCostY) or update(GoodsCostY_) or update(Purtax) or update(Purtax_)
update Border set GoodsCost=inserted.GoodsCost,GoodsCost_=inserted.GoodsCost_,GoodsCostX=inserted.GoodsCostX,GoodsCostX_=inserted.GoodsCostX_,GoodsCostY=inserted.GoodsCostY,GoodsCostY_=inserted.GoodsCostY_,Purtax=inserted.Purtax,Purtax_=inserted.Purtax_
from inserted where Border=Obj
if update(Term) or update(Terms)
update Iorder set Term=inserted.Term,Terms=inserted.Terms
from inserted where Iorder=Obj
go
create trigger IorderObj_Del on IorderObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Porder_Porder on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Porder from deleted where Porder=Obj
end
go
create view PorderObj as
select Obj,Cls,DocTime,Owner,State,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace,GoodsCost,GoodsCost_,GoodsCostX,GoodsCostX_,GoodsCostY,GoodsCostY_,Purtax,Purtax_
from Obj join Doc on Doc=Obj join Orders on Orders=Obj join Torder on Torder=Obj join Border on Border=Obj join Porder on Porder=Obj
go
create trigger PorderObj_Ins on PorderObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Porder'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Orders(Orders,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit)
select Obj,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit
from inserted
insert Torder(Torder,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace)
select Obj,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace
from inserted
insert Border(Border,GoodsCost,GoodsCost_,GoodsCostX,GoodsCostX_,GoodsCostY,GoodsCostY_,Purtax,Purtax_)
select Obj,GoodsCost,GoodsCost_,GoodsCostX,GoodsCostX_,GoodsCostY,GoodsCostY_,Purtax,Purtax_
from inserted
insert Porder(Porder)
select Obj
from inserted
go
create trigger PorderObj_Upd on PorderObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(OrderNo) or update(Subject) or update(Company) or update(OrderDate) or update(Amount) or update(AmountX) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit)
or update(PackGV) or update(PackVunit) or update(DeliverLimit)
update Orders set OrderNo=inserted.OrderNo,Subject=inserted.Subject,Company=inserted.Company,OrderDate=inserted.OrderDate,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,
PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,DeliverLimit=inserted.DeliverLimit
from inserted where Orders=Obj
if update(OrderNoo) or update(Trader) or update(Contacter) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(Partial) or update(Tranship) or update(CommiRate)
or update(CommiHide) or update(PayMode) or update(TransMode) or update(SignPlace)
update Torder set OrderNoo=inserted.OrderNoo,Trader=inserted.Trader,Contacter=inserted.Contacter,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,Partial=inserted.Partial,Tranship=inserted.Tranship,CommiRate=inserted.CommiRate,
CommiHide=inserted.CommiHide,PayMode=inserted.PayMode,TransMode=inserted.TransMode,SignPlace=inserted.SignPlace
from inserted where Torder=Obj
if update(GoodsCost) or update(GoodsCost_) or update(GoodsCostX) or update(GoodsCostX_) or update(GoodsCostY) or update(GoodsCostY_) or update(Purtax) or update(Purtax_)
update Border set GoodsCost=inserted.GoodsCost,GoodsCost_=inserted.GoodsCost_,GoodsCostX=inserted.GoodsCostX,GoodsCostX_=inserted.GoodsCostX_,GoodsCostY=inserted.GoodsCostY,GoodsCostY_=inserted.GoodsCostY_,Purtax=inserted.Purtax,Purtax_=inserted.Purtax_
from inserted where Border=Obj
go
create trigger PorderObj_Del on PorderObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Sorder_Sorder on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Sorder from deleted where Sorder=Obj
end
go
create view SorderObj as
select Obj,Cls,DocTime,Owner,State,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace,Saltax,Saltax_,Purtax,Purtax_,Revenue,Revenue_,RevenueX,RevenueX_,RevenueY
,RevenueY_,Income,Income_,IncomeX,IncomeX_,IncomeY,IncomeY_,Commi,Commi_,Cost
,Cost_,Excise,Excise_,GoodsCost,GoodsCost_,SalFee,SalFee_,OtherFee,OtherFee_,Profit
,Profit_,ProfrateS,ProfrateS_,ProfrateC,ProfrateC_,SalFeeRate,SalFeeRate_,OtherFeeRate,Profactor,Calc
,PreReceive,PreReceiveX,PreReceiveY,Receivable,ReceivableX,ReceivableY,Receiveok,ReceiveokX,ReceiveokY,Prepay
,PrepayX,PrepayY,Payok,PayokX,PayokY,Collect,CollectX,CollectY,PiDate,PiPreface
,PiText
from Obj join Doc on Doc=Obj join Orders on Orders=Obj join Torder on Torder=Obj join Vorder on Vorder=Obj join Sorder on Sorder=Obj
go
create trigger SorderObj_Ins on SorderObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Sorder'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Orders(Orders,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit)
select Obj,OrderNo,Subject,Company,OrderDate,Amount,AmountX,AmountY,Cux,Preface
,Treaty,Remark,Allowance,CuxStdRate,CuxIntRate,PackCount,PackUnit,PackGW,PackNW,PackWunit
,PackGV,PackVunit,DeliverLimit
from inserted
insert Torder(Torder,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace)
select Obj,OrderNoo,Trader,Contacter,LoadPort,DestPort,TrshPort,Partial,Tranship,CommiRate
,CommiHide,PayMode,TransMode,SignPlace
from inserted
insert Vorder(Vorder,Saltax,Saltax_,Purtax,Purtax_,Revenue,Revenue_,RevenueX,RevenueX_,RevenueY
,RevenueY_,Income,Income_,IncomeX,IncomeX_,IncomeY,IncomeY_,Commi,Commi_,Cost
,Cost_,Excise,Excise_,GoodsCost,GoodsCost_,SalFee,SalFee_,OtherFee,OtherFee_,Profit
,Profit_,ProfrateS,ProfrateS_,ProfrateC,ProfrateC_,SalFeeRate,SalFeeRate_,OtherFeeRate,Profactor,Calc
,PreReceive,PreReceiveX,PreReceiveY,Receivable,ReceivableX,ReceivableY,Receiveok,ReceiveokX,ReceiveokY,Prepay
,PrepayX,PrepayY,Payok,PayokX,PayokY,Collect,CollectX,CollectY,PiDate,PiPreface
,PiText)
select Obj,Saltax,Saltax_,Purtax,Purtax_,Revenue,Revenue_,RevenueX,RevenueX_,RevenueY
,RevenueY_,Income,Income_,IncomeX,IncomeX_,IncomeY,IncomeY_,Commi,Commi_,Cost
,Cost_,Excise,Excise_,GoodsCost,GoodsCost_,SalFee,SalFee_,OtherFee,OtherFee_,Profit
,Profit_,ProfrateS,ProfrateS_,ProfrateC,ProfrateC_,SalFeeRate,SalFeeRate_,OtherFeeRate,Profactor,Calc
,PreReceive,PreReceiveX,PreReceiveY,Receivable,ReceivableX,ReceivableY,Receiveok,ReceiveokX,ReceiveokY,Prepay
,PrepayX,PrepayY,Payok,PayokX,PayokY,Collect,CollectX,CollectY,PiDate,PiPreface
,PiText
from inserted
insert Sorder(Sorder)
select Obj
from inserted
go
create trigger SorderObj_Upd on SorderObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(OrderNo) or update(Subject) or update(Company) or update(OrderDate) or update(Amount) or update(AmountX) or update(AmountY) or update(Cux) or update(Preface)
or update(Treaty) or update(Remark) or update(Allowance) or update(CuxStdRate) or update(CuxIntRate) or update(PackCount) or update(PackUnit) or update(PackGW) or update(PackNW) or update(PackWunit)
or update(PackGV) or update(PackVunit) or update(DeliverLimit)
update Orders set OrderNo=inserted.OrderNo,Subject=inserted.Subject,Company=inserted.Company,OrderDate=inserted.OrderDate,Amount=inserted.Amount,AmountX=inserted.AmountX,AmountY=inserted.AmountY,Cux=inserted.Cux,Preface=inserted.Preface,
Treaty=inserted.Treaty,Remark=inserted.Remark,Allowance=inserted.Allowance,CuxStdRate=inserted.CuxStdRate,CuxIntRate=inserted.CuxIntRate,PackCount=inserted.PackCount,PackUnit=inserted.PackUnit,PackGW=inserted.PackGW,PackNW=inserted.PackNW,PackWunit=inserted.PackWunit,
PackGV=inserted.PackGV,PackVunit=inserted.PackVunit,DeliverLimit=inserted.DeliverLimit
from inserted where Orders=Obj
if update(OrderNoo) or update(Trader) or update(Contacter) or update(LoadPort) or update(DestPort) or update(TrshPort) or update(Partial) or update(Tranship) or update(CommiRate)
or update(CommiHide) or update(PayMode) or update(TransMode) or update(SignPlace)
update Torder set OrderNoo=inserted.OrderNoo,Trader=inserted.Trader,Contacter=inserted.Contacter,LoadPort=inserted.LoadPort,DestPort=inserted.DestPort,TrshPort=inserted.TrshPort,Partial=inserted.Partial,Tranship=inserted.Tranship,CommiRate=inserted.CommiRate,
CommiHide=inserted.CommiHide,PayMode=inserted.PayMode,TransMode=inserted.TransMode,SignPlace=inserted.SignPlace
from inserted where Torder=Obj
if update(Saltax) or update(Saltax_) or update(Purtax) or update(Purtax_) or update(Revenue) or update(Revenue_) or update(RevenueX) or update(RevenueX_) or update(RevenueY)
or update(RevenueY_) or update(Income) or update(Income_) or update(IncomeX) or update(IncomeX_) or update(IncomeY) or update(IncomeY_) or update(Commi) or update(Commi_) or update(Cost)
or update(Cost_) or update(Excise) or update(Excise_) or update(GoodsCost) or update(GoodsCost_) or update(SalFee) or update(SalFee_) or update(OtherFee) or update(OtherFee_) or update(Profit)
or update(Profit_) or update(ProfrateS) or update(ProfrateS_) or update(ProfrateC) or update(ProfrateC_) or update(SalFeeRate) or update(SalFeeRate_) or update(OtherFeeRate) or update(Profactor) or update(Calc)
or update(PreReceive) or update(PreReceiveX) or update(PreReceiveY) or update(Receivable) or update(ReceivableX) or update(ReceivableY) or update(Receiveok) or update(ReceiveokX) or update(ReceiveokY) or update(Prepay)
or update(PrepayX) or update(PrepayY) or update(Payok) or update(PayokX) or update(PayokY) or update(Collect) or update(CollectX) or update(CollectY) or update(PiDate) or update(PiPreface)
or update(PiText)
update Vorder set Saltax=inserted.Saltax,Saltax_=inserted.Saltax_,Purtax=inserted.Purtax,Purtax_=inserted.Purtax_,Revenue=inserted.Revenue,Revenue_=inserted.Revenue_,RevenueX=inserted.RevenueX,RevenueX_=inserted.RevenueX_,RevenueY=inserted.RevenueY,
RevenueY_=inserted.RevenueY_,Income=inserted.Income,Income_=inserted.Income_,IncomeX=inserted.IncomeX,IncomeX_=inserted.IncomeX_,IncomeY=inserted.IncomeY,IncomeY_=inserted.IncomeY_,Commi=inserted.Commi,Commi_=inserted.Commi_,Cost=inserted.Cost,
Cost_=inserted.Cost_,Excise=inserted.Excise,Excise_=inserted.Excise_,GoodsCost=inserted.GoodsCost,GoodsCost_=inserted.GoodsCost_,SalFee=inserted.SalFee,SalFee_=inserted.SalFee_,OtherFee=inserted.OtherFee,OtherFee_=inserted.OtherFee_,Profit=inserted.Profit,
Profit_=inserted.Profit_,ProfrateS=inserted.ProfrateS,ProfrateS_=inserted.ProfrateS_,ProfrateC=inserted.ProfrateC,ProfrateC_=inserted.ProfrateC_,SalFeeRate=inserted.SalFeeRate,SalFeeRate_=inserted.SalFeeRate_,OtherFeeRate=inserted.OtherFeeRate,Profactor=inserted.Profactor,Calc=inserted.Calc,
PreReceive=inserted.PreReceive,PreReceiveX=inserted.PreReceiveX,PreReceiveY=inserted.PreReceiveY,Receivable=inserted.Receivable,ReceivableX=inserted.ReceivableX,ReceivableY=inserted.ReceivableY,Receiveok=inserted.Receiveok,ReceiveokX=inserted.ReceiveokX,ReceiveokY=inserted.ReceiveokY,Prepay=inserted.Prepay,
PrepayX=inserted.PrepayX,PrepayY=inserted.PrepayY,Payok=inserted.Payok,PayokX=inserted.PayokX,PayokY=inserted.PayokY,Collect=inserted.Collect,CollectX=inserted.CollectX,CollectY=inserted.CollectY,PiDate=inserted.PiDate,PiPreface=inserted.PiPreface,
PiText=inserted.PiText
from inserted where Vorder=Obj
go
create trigger SorderObj_Del on SorderObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Trader_Trader on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Trader from deleted where Trader=Obj
end
go
create view TraderObj as
select Obj,Cls,DocTime,Owner,State,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount,Corporater,President,OrganCode,EnterpriseCode,TaxpayerCode,ManufactureID,TraderNo,IsSupplier,IsCustomer,Grade
from Obj join Doc on Doc=Obj join Sociar on Sociar=Obj join Entity on Entity=Obj join Firm on Firm=Obj join Trader on Trader=Obj
go
create trigger TraderObj_Ins on TraderObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Trader'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Sociar(Sociar,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary)
select Obj,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary
from inserted
insert Entity(Entity,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount)
select Obj,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount
from inserted
insert Firm(Firm,Corporater,President,OrganCode,EnterpriseCode,TaxpayerCode,ManufactureID)
select Obj,Corporater,President,OrganCode,EnterpriseCode,TaxpayerCode,ManufactureID
from inserted
insert Trader(Trader,TraderNo,IsSupplier,IsCustomer,Grade)
select Obj,TraderNo,IsSupplier,IsCustomer,Grade
from inserted
go
create trigger TraderObj_Upd on TraderObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(Name) or update(Namee) or update(Tel) or update(Fax) or update(Email) or update(Web) or update(Address) or update(Addresse) or update(PostCode)
or update(Country) or update(Districts) or update(Citys) or update(Resume) or update(Resumee) or update(Mobile) or update(Summary)
update Sociar set Name=inserted.Name,Namee=inserted.Namee,Tel=inserted.Tel,Fax=inserted.Fax,Email=inserted.Email,Web=inserted.Web,Address=inserted.Address,Addresse=inserted.Addresse,PostCode=inserted.PostCode,
Country=inserted.Country,Districts=inserted.Districts,Citys=inserted.Citys,Resume=inserted.Resume,Resumee=inserted.Resumee,Mobile=inserted.Mobile,Summary=inserted.Summary
from inserted where Sociar=Obj
if update(FullName) or update(FullNamee) or update(EdiLink) or update(Contacter) or update(BankName) or update(BankAccount)
update Entity set FullName=inserted.FullName,FullNamee=inserted.FullNamee,EdiLink=inserted.EdiLink,Contacter=inserted.Contacter,BankName=inserted.BankName,BankAccount=inserted.BankAccount
from inserted where Entity=Obj
if update(Corporater) or update(President) or update(OrganCode) or update(EnterpriseCode) or update(TaxpayerCode) or update(ManufactureID)
update Firm set Corporater=inserted.Corporater,President=inserted.President,OrganCode=inserted.OrganCode,EnterpriseCode=inserted.EnterpriseCode,TaxpayerCode=inserted.TaxpayerCode,ManufactureID=inserted.ManufactureID
from inserted where Firm=Obj
if update(TraderNo) or update(IsSupplier) or update(IsCustomer) or update(Grade)
update Trader set TraderNo=inserted.TraderNo,IsSupplier=inserted.IsSupplier,IsCustomer=inserted.IsCustomer,Grade=inserted.Grade
from inserted where Trader=Obj
go
create trigger TraderObj_Del on TraderObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Customer_Customer on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Customer from deleted where Customer=Obj
end
go
create view CustomerObj as
select Obj,Cls,DocTime,Owner,State,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount,Corporater,President,OrganCode,EnterpriseCode,TaxpayerCode,ManufactureID,TraderNo,IsSupplier,IsCustomer,Grade
from Obj join Doc on Doc=Obj join Sociar on Sociar=Obj join Entity on Entity=Obj join Firm on Firm=Obj join Trader on Trader=Obj join Customer on Customer=Obj
go
create trigger CustomerObj_Ins on CustomerObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Customer'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Sociar(Sociar,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary)
select Obj,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary
from inserted
insert Entity(Entity,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount)
select Obj,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount
from inserted
insert Firm(Firm,Corporater,President,OrganCode,EnterpriseCode,TaxpayerCode,ManufactureID)
select Obj,Corporater,President,OrganCode,EnterpriseCode,TaxpayerCode,ManufactureID
from inserted
insert Trader(Trader,TraderNo,IsSupplier,IsCustomer,Grade)
select Obj,TraderNo,IsSupplier,IsCustomer,Grade
from inserted
insert Customer(Customer)
select Obj
from inserted
go
create trigger CustomerObj_Upd on CustomerObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(Name) or update(Namee) or update(Tel) or update(Fax) or update(Email) or update(Web) or update(Address) or update(Addresse) or update(PostCode)
or update(Country) or update(Districts) or update(Citys) or update(Resume) or update(Resumee) or update(Mobile) or update(Summary)
update Sociar set Name=inserted.Name,Namee=inserted.Namee,Tel=inserted.Tel,Fax=inserted.Fax,Email=inserted.Email,Web=inserted.Web,Address=inserted.Address,Addresse=inserted.Addresse,PostCode=inserted.PostCode,
Country=inserted.Country,Districts=inserted.Districts,Citys=inserted.Citys,Resume=inserted.Resume,Resumee=inserted.Resumee,Mobile=inserted.Mobile,Summary=inserted.Summary
from inserted where Sociar=Obj
if update(FullName) or update(FullNamee) or update(EdiLink) or update(Contacter) or update(BankName) or update(BankAccount)
update Entity set FullName=inserted.FullName,FullNamee=inserted.FullNamee,EdiLink=inserted.EdiLink,Contacter=inserted.Contacter,BankName=inserted.BankName,BankAccount=inserted.BankAccount
from inserted where Entity=Obj
if update(Corporater) or update(President) or update(OrganCode) or update(EnterpriseCode) or update(TaxpayerCode) or update(ManufactureID)
update Firm set Corporater=inserted.Corporater,President=inserted.President,OrganCode=inserted.OrganCode,EnterpriseCode=inserted.EnterpriseCode,TaxpayerCode=inserted.TaxpayerCode,ManufactureID=inserted.ManufactureID
from inserted where Firm=Obj
if update(TraderNo) or update(IsSupplier) or update(IsCustomer) or update(Grade)
update Trader set TraderNo=inserted.TraderNo,IsSupplier=inserted.IsSupplier,IsCustomer=inserted.IsCustomer,Grade=inserted.Grade
from inserted where Trader=Obj
go
create trigger CustomerObj_Del on CustomerObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
create trigger Supplier_Supplier on Obj for delete as
if @@rowcount>0
begin
set nocount on
delete Supplier from deleted where Supplier=Obj
end
go
create view SupplierObj as
select Obj,Cls,DocTime,Owner,State,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount,Corporater,President,OrganCode,EnterpriseCode,TaxpayerCode,ManufactureID,TraderNo,IsSupplier,IsCustomer,Grade
from Obj join Doc on Doc=Obj join Sociar on Sociar=Obj join Entity on Entity=Obj join Firm on Firm=Obj join Trader on Trader=Obj join Supplier on Supplier=Obj
go
create trigger SupplierObj_Ins on SupplierObj instead of insert as
set nocount on
insert Obj(Obj, Cls)
select Obj, 'Supplier'
from inserted
insert Doc(Doc,DocTime,Owner,State)
select Obj,DocTime,Owner,State
from inserted
insert Sociar(Sociar,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary)
select Obj,Name,Namee,Tel,Fax,Email,Web,Address,Addresse,PostCode
,Country,Districts,Citys,Resume,Resumee,Mobile,Summary
from inserted
insert Entity(Entity,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount)
select Obj,FullName,FullNamee,EdiLink,Contacter,BankName,BankAccount
from inserted
insert Firm(Firm,Corporater,President,OrganCode,EnterpriseCode,TaxpayerCode,ManufactureID)
select Obj,Corporater,President,OrganCode,EnterpriseCode,TaxpayerCode,ManufactureID
from inserted
insert Trader(Trader,TraderNo,IsSupplier,IsCustomer,Grade)
select Obj,TraderNo,IsSupplier,IsCustomer,Grade
from inserted
insert Supplier(Supplier)
select Obj
from inserted
go
create trigger SupplierObj_Upd on SupplierObj instead of update as
set nocount on
if update(DocTime) or update(Owner) or update(State)
update Doc set DocTime=inserted.DocTime,Owner=inserted.Owner,State=inserted.State
from inserted where Doc=Obj
if update(Name) or update(Namee) or update(Tel) or update(Fax) or update(Email) or update(Web) or update(Address) or update(Addresse) or update(PostCode)
or update(Country) or update(Districts) or update(Citys) or update(Resume) or update(Resumee) or update(Mobile) or update(Summary)
update Sociar set Name=inserted.Name,Namee=inserted.Namee,Tel=inserted.Tel,Fax=inserted.Fax,Email=inserted.Email,Web=inserted.Web,Address=inserted.Address,Addresse=inserted.Addresse,PostCode=inserted.PostCode,
Country=inserted.Country,Districts=inserted.Districts,Citys=inserted.Citys,Resume=inserted.Resume,Resumee=inserted.Resumee,Mobile=inserted.Mobile,Summary=inserted.Summary
from inserted where Sociar=Obj
if update(FullName) or update(FullNamee) or update(EdiLink) or update(Contacter) or update(BankName) or update(BankAccount)
update Entity set FullName=inserted.FullName,FullNamee=inserted.FullNamee,EdiLink=inserted.EdiLink,Contacter=inserted.Contacter,BankName=inserted.BankName,BankAccount=inserted.BankAccount
from inserted where Entity=Obj
if update(Corporater) or update(President) or update(OrganCode) or update(EnterpriseCode) or update(TaxpayerCode) or update(ManufactureID)
update Firm set Corporater=inserted.Corporater,President=inserted.President,OrganCode=inserted.OrganCode,EnterpriseCode=inserted.EnterpriseCode,TaxpayerCode=inserted.TaxpayerCode,ManufactureID=inserted.ManufactureID
from inserted where Firm=Obj
if update(TraderNo) or update(IsSupplier) or update(IsCustomer) or update(Grade)
update Trader set TraderNo=inserted.TraderNo,IsSupplier=inserted.IsSupplier,IsCustomer=inserted.IsCustomer,Grade=inserted.Grade
from inserted where Trader=Obj
go
create trigger SupplierObj_Del on SupplierObj instead of delete as
set nocount on
delete Obj from deleted where Obj.Obj=deleted.Obj
go
李战(leadzen)