壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1340|回复: 2

用友的自定义报表——请问如何给变量赋值?

[复制链接]
发表于 2011/8/23 15:28:56 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622  。

您需要 登录 才可以下载或查看,没有帐号?注册

x
本帖最后由 allen31820 于 2011/8/23 15:29 编辑

ALTER    PROC fa_Q_ZJQD_lzb(@LoginDate DateTime,@LoginPeriod int,@zclb varchar(50)) AS
SELECT fa_Cards.sCardNum as 卡片编码, fa_Cards.sAssetNum 资产编码, fa_Cards.sAssetName 资产名称,
(CASE @LoginPeriod WHEN 1 THEN [dblMonthValue1] WHEN 2 THEN [dblMonthValue2] WHEN 3 THEN [dblMonthValue3] WHEN 4 THEN [dblMonthValue4] WHEN 5 THEN [dblMonthValue5] WHEN 6 THEN [dblMonthValue6] WHEN 7 THEN [dblMonthValue7] WHEN 8 THEN [dblMonthValue8] WHEN 9 THEN [dblMonthValue9] WHEN 10 THEN [dblMonthValue10] WHEN 11 THEN [dblMonthValue11] ELSE [dblMonthValue12] END) AS 原值,
100*(CASE @LoginPeriod WHEN 1 THEN [dblDeprRate1] WHEN 2 THEN [dblDeprRate2] WHEN 3 THEN [dblDeprRate3] WHEN 4 THEN [dblDeprRate4] WHEN 5 THEN [dblDeprRate5] WHEN 6 THEN [dblDeprRate6] WHEN 7 THEN [dblDeprRate7] WHEN 8 THEN [dblDeprRate8] WHEN 9 THEN [dblDeprRate9] WHEN 10 THEN [dblDeprRate10] WHEN 11 THEN [dblDeprRate11] ELSE [dblDeprRate12] END) as [月折旧率%],
(CASE @LoginPeriod WHEN 1 THEN [dblDepr1] WHEN 2 THEN [dblDepr2] WHEN 3 THEN [dblDepr3] WHEN 4 THEN [dblDepr4] WHEN 5 THEN [dblDepr5] WHEN 6 THEN [dblDepr6] WHEN 7 THEN [dblDepr7] WHEN 8 THEN [dblDepr8] WHEN 9 THEN [dblDepr9] WHEN 10 THEN [dblDepr10] WHEN 11 THEN [dblDepr11] ELSE [dblDepr12] END) AS 月折旧额,
(CASE WHEN [fa_Cards].[iDisposePeriod]=2 THEN [fa_Cards].[dblDecDeprT] ELSE (CASE @LoginPeriod WHEN 1 THEN [dblDeprT1] WHEN 2 THEN [dblDeprT2] WHEN 3 THEN [dblDeprT3] WHEN 4 THEN [dblDeprT4] WHEN 5 THEN [dblDeprT5] WHEN 6 THEN [dblDeprT6] WHEN 7 THEN [dblDeprT7] WHEN 8 THEN [dblDeprT8] WHEN 9 THEN [dblDeprT9] WHEN 10 THEN [dblDeprT10] WHEN 11 THEN [dblDeprT11] ELSE [dblDeprT12] END) END) AS 累计折旧,
--添加净值
(CASE @LoginPeriod WHEN 1 THEN [dblMonthValue1] WHEN 2 THEN [dblMonthValue2] WHEN 3 THEN [dblMonthValue3] WHEN 4 THEN [dblMonthValue4] WHEN 5 THEN [dblMonthValue5] WHEN 6 THEN [dblMonthValue6] WHEN 7 THEN [dblMonthValue7] WHEN 8 THEN [dblMonthValue8] WHEN 9 THEN [dblMonthValue9] WHEN 10 THEN [dblMonthValue10] WHEN 11 THEN [dblMonthValue11] ELSE [dblMonthValue12] END)
-(CASE WHEN [fa_Cards].[iDisposePeriod]=2 THEN [fa_Cards].[dblDecDeprT] ELSE (CASE @LoginPeriod WHEN 1 THEN [dblDeprT1] WHEN 2 THEN [dblDeprT2] WHEN 3 THEN [dblDeprT3] WHEN 4 THEN [dblDeprT4] WHEN 5 THEN [dblDeprT5] WHEN 6 THEN [dblDeprT6] WHEN 7 THEN [dblDeprT7] WHEN 8 THEN [dblDeprT8] WHEN 9 THEN [dblDeprT9] WHEN 10 THEN [dblDeprT10] WHEN 11 THEN [dblDeprT11] ELSE [dblDeprT12] END) END) AS 净值 ,
(CASE @LoginPeriod WHEN 1 THEN [dblPerDepr1] WHEN 2 THEN [dblPerDepr2] WHEN 3 THEN [dblPerDepr3] WHEN 4 THEN [dblPerDepr4] WHEN 5 THEN [dblPerDepr5] WHEN 6 THEN [dblPerDepr6] WHEN 7 THEN [dblPerDepr7] WHEN 8 THEN [dblPerDepr8] WHEN 9 THEN [dblPerDepr9] WHEN 10 THEN [dblPerDepr10] WHEN 11 THEN [dblPerDepr11] ELSE [dblPerDepr12] END) AS dblPerDepr_,
(CASE @LoginPeriod WHEN 1 THEN [dblWork1] WHEN 2 THEN [dblWork2] WHEN 3 THEN [dblWork3] WHEN 4 THEN [dblWork4] WHEN 5 THEN [dblWork5] WHEN 6 THEN [dblWork6] WHEN 7 THEN [dblWork7] WHEN 8 THEN [dblWork8] WHEN 9 THEN [dblWork9] WHEN 10 THEN [dblWork10] WHEN 11 THEN [dblWork11] ELSE [dblWork12] END) AS dblWork_,
(CASE @LoginPeriod WHEN 1 THEN [dblWorkT1] WHEN 2 THEN [dblWorkT2] WHEN 3 THEN [dblWorkT3] WHEN 4 THEN [dblWorkT4] WHEN 5 THEN [dblWorkT5] WHEN 6 THEN [dblWorkT6] WHEN 7 THEN [dblWorkT7] WHEN 8 THEN [dblWorkT8] WHEN 9 THEN [dblWorkT9] WHEN 10 THEN [dblWorkT10] WHEN 11 THEN [dblWorkT11] ELSE [dblWorkT12] END) AS dblWorkTotal_
FROM (fa_Cards LEFT JOIN fa_DeprTransactions ON fa_Cards.sCardNum = fa_DeprTransactions.sCardNum) LEFT JOIN fa_WorkLoad ON fa_Cards.sCardNum = fa_WorkLoad.sCardNum
--添加过滤变量
JOIN fa_AssetTypes on fa_Cards.stypenum=fa_AssetTypes.snum
WHERE ((((CASE @LoginPeriod WHEN 1 THEN [dblDepr1] WHEN 2 THEN [dblDepr2] WHEN 3 THEN [dblDepr3] WHEN 4 THEN [dblDepr4] WHEN 5 THEN [dblDepr5] WHEN 6 THEN [dblDepr6] WHEN 7 THEN [dblDepr7] WHEN 8 THEN [dblDepr8] WHEN 9 THEN [dblDepr9] WHEN 10 THEN [dblDepr10] WHEN 11 THEN [dblDepr11] ELSE [dblDepr12] END))>0))
AND fa_Cards.sCardID IN(SELECT Max(sCardID) FROM fa_Cards
    WHERE (((fa_Cards.dInputDate)<=@LoginDate) AND ((fa_Cards.dTransDate)<=@LoginDate Or (fa_Cards.dTransDate) Is Null) AND ((fa_Cards.dDisposeDate)<=@LoginDate Or (fa_Cards.dDisposeDate) Is Null))
    GROUP BY fa_Cards.sCardNum)  and fa_AssetTypes.sname=@zclb
ORDER BY fa_Cards.sCardNum

在开打这个报表的时候如何给这些 @LoginDate ,@LoginPeriod ,@zclb 变量赋值呢?
 楼主| 发表于 2011/8/26 13:57:01 | 显示全部楼层
没有懂的吗
{:soso_e101:}
发表于 2011/11/15 22:54:31 | 显示全部楼层
我也看不懂,太乱了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/29 15:42 , Processed in 0.014022 second(s), 14 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表