# t_sql

执行:
---
INSERT INTO[t_sys_soft]([版本号],[系统],[版本1],[版本2],[版本3],[软件名称]) VALUES('7.22.0829', NULL, '7', '22', '0829', 'd7')
---
GO

delete From user_authority_info where GID='B64E8500-E56B-40D0-BA51-96FB37471C60'
insert Into user_authority_info (GID,NAME,DESCRIPTION,MODULEURL,ISALL,ISCOMPANY,ISDEPT,ISPERSON,CREATEUSER
,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,ISDELETE) values(
'B64E8500-E56B-40D0-BA51-96FB37471C60','modOp_BLISSUESP','特殊放单申请','Mvcshipping/MsOp_BLISSUE/Index_SP',0,0,0,0,'1BEC90E1-9780-472F-90C2-0C6390C044A4','2022-08-03 10:07:45.173','1BEC90E1-9780-472F-90C2-0C6390C044A4',getdate(),0)


执行:
---
INSERT INTO[t_sys_soft]([版本号],[系统],[版本1],[版本2],[版本3],[软件名称]) VALUES('7.22.0830', NULL, '7', '22', '0830', 'd7')
---
GO

alter table op_blissuelist add AUDITOR varchar(50) null
GO

ALTER VIEW [dbo].[VW_user]
AS
SELECT     ub.USERID, u.CODENAME, u.SHOWNAME, uc.COMPANYID, c.NAME AS companyname, sd.GID AS deptgid, sd.DEPTNAME, sd.DEPTNO, ub.EMAIL1, ub.mailsign, 
                      u.WeChatAccount,
  (select top 1 value from user_userattribute where userid=u.GID and attributeid='3C91140E-6FB6-4B5A-B5AB-30E59E3CBBED' ) ISSALEMAN
  ,u.SHOWNAME UserName,u.CODENAME+'-'+u.SHOWNAME CodeAndName
FROM         dbo.user_baseinfo AS ub 
LEFT OUTER JOIN dbo.user_company AS uc ON uc.USERID = ub.USERID 
LEFT OUTER JOIN dbo.sys_dept AS sd ON sd.DEPTNAME = ub.DEPTNAME AND sd.LINKID = uc.COMPANYID 
LEFT OUTER JOIN dbo.[user] AS u ON u.GID = ub.USERID 
LEFT OUTER JOIN dbo.company AS c ON c.GID = uc.COMPANYID
WHERE     (u.ISDISABLE = 0) AND (u.ISDELETED = 0)


GO


执行:
---
INSERT INTO[t_sys_soft]([版本号],[系统],[版本1],[版本2],[版本3],[软件名称]) VALUES('7.22.0831', NULL, '7', '22', '0831', 'd7')
---
GO


alter table crm_aireorder add WAREHOUSINGNO varchar(200) null


alter table op_aire add WAREHOUSINGNO varchar(200) null


执行:
---
INSERT INTO[t_sys_soft]([版本号],[系统],[版本1],[版本2],[版本3],[软件名称]) VALUES('7.22.0901', NULL, '7', '22', '0901', 'd7')
---
GO

ALTER PROCEDURE [dbo].[p_update_recvapplycation]
@con_no varchar(100)
 AS
DECLARE
@RMBAMOUNT [numeric](18, 4),
@RMBDOAMOUNT [numeric](18, 4),
@USDAMOUNT [numeric](18, 4),
@USDDOAMOUNT [numeric](18, 4),
@AMOUNTCOUNT int,
@DOAMOUNTCOUNT int,
@COUNT int


select 
@RMBAMOUNT=0,
@RMBDOAMOUNT=0,
@USDAMOUNT=0,
@USDDOAMOUNT=0

SELECT 
@RMBAMOUNT=isnull(SUM(CASE WHEN CURRENCY='RMB' THEN (CASE FEETYPE WHEN 1 THEN AMOUNT ELSE -AMOUNT END) ELSE 0 END),0),
@RMBDOAMOUNT=isnull(SUM(CASE WHEN CURRENCY='RMB' THEN (CASE FEETYPE WHEN 1 THEN DOAMOUNT ELSE -DOAMOUNT END) ELSE 0 END),0),
@USDAMOUNT=isnull(SUM(CASE WHEN CURRENCY<>'RMB' THEN (CASE FEETYPE WHEN 1 THEN AMOUNT ELSE -AMOUNT END) ELSE 0 END),0),
@USDDOAMOUNT=isnull(SUM(CASE WHEN CURRENCY<>'RMB' THEN (CASE FEETYPE WHEN 1 THEN DOAMOUNT ELSE -DOAMOUNT END) ELSE 0 END),0)
FROM ch_fee_do
WHERE BILLNO=@con_no and CATEGORY=5 

SELECT 
@COUNT=COUNT(*)
FROM ch_fee_do
WHERE BILLNO=@con_no and CATEGORY=5 
SELECT 
@DOAMOUNTCOUNT=COUNT(*)
FROM ch_fee_do
WHERE BILLNO=@con_no and CATEGORY=5 and AMOUNT=DOAMOUNT
SELECT 
@AMOUNTCOUNT=COUNT(*)
FROM ch_fee_do
WHERE BILLNO=@con_no and CATEGORY=5 and DOAMOUNT=0

UPDATE ch_fee_recvapplication SET AMOUNTRMB=@RMBAMOUNT,SETTLERMB=@RMBDOAMOUNT,AMOUNTUSD=@USDAMOUNT,SETTLEUSD=@USDDOAMOUNT
 WHERE BILLNO=@con_no



GO


