declare @JMSID int;
if exists(select 1 from Company c where c.CompanyName = @CompanyName and DelFlag=0 ) return;else
begin
begin tran tran1
insert into Company(CompanyName,Province,City,CompanyDesc,ContactPerson,Tel,OrgID,JMSCode,BusiContactPerson,BusiTel,BusMailbox)
values(@CompanyName,@Province,@City,@CompanyDesc,@ContactPerson,@Tel,@OrgID,@JMSCode,@OpPerson,@OpTel,@OpMail); SELECT @JMSID = SCOPE_IDENTITY();
insert into JMS_PartCompany(JMSID,PartCompanyID)
values(@JMSID,@CompanyID)
insert into OperatorAuditMoney(OperatorID,RCLoanTypeID,OperatorAuditMoney)
values(@JMSID,1,0);
insert into OperatorAuditMoney(OperatorID,RCLoanTypeID,OperatorAuditMoney)
values(@JMSID,2,0);
commit tran tran1
if @@ERROR <>0
rollback tran tran1
end ;";
if exists(select 1 from Company c where c.CompanyName = @CompanyName and DelFlag=0 ) return;else
begin
begin tran tran1
insert into Company(CompanyName,Province,City,CompanyDesc,ContactPerson,Tel,OrgID,JMSCode,BusiContactPerson,BusiTel,BusMailbox)
values(@CompanyName,@Province,@City,@CompanyDesc,@ContactPerson,@Tel,@OrgID,@JMSCode,@OpPerson,@OpTel,@OpMail); SELECT @JMSID = SCOPE_IDENTITY();
insert into JMS_PartCompany(JMSID,PartCompanyID)
values(@JMSID,@CompanyID)
insert into OperatorAuditMoney(OperatorID,RCLoanTypeID,OperatorAuditMoney)
values(@JMSID,1,0);
insert into OperatorAuditMoney(OperatorID,RCLoanTypeID,OperatorAuditMoney)
values(@JMSID,2,0);
commit tran tran1
if @@ERROR <>0
rollback tran tran1
end ;";