我们使用的是用友通精算普及版,以前使用的一个帐套在2015年过账时删除,现在需要查看被删除帐套的数据,应如何操作
2015-2-28 0:0:0 wondial我们使用的是用友通精算普及版,以前使用的一个帐套在2015年过账时删除,现在需要查看被删除帐套的数据,应如何操作
您好:您看下您安装路径下一般为c盘/ufsmart/admin/zt001(账套号)/2015 下是否有UFDATA.MDF UFDATA.LDF文件如果您的问题还没有解决,可以到 T+搜索>>上找一下
相关阅读
- 用友T6软件如何增加操作员?2021-6-17 8:45:27
- 用友T6软件如何计提折旧?2021-6-17 8:41:2
- 用友T6软件出现零出库2021-5-21 13:50:36
- 用友T6软件用友财务报表,利润表,资产负债表提示正在被用户使用,出现加锁怎么解决2021-5-21 13:47:3
- 用友T6软件销售类型有哪些?2021-5-21 13:44:29
- 用友T6软件期初对账时应付模块和总账对账不平?2021-5-6 17:33:9
- 用友T6软件年结检查2021-5-6 17:32:7
- 用友T6软件客户往来期初对账不平2021-5-6 17:29:47
- T6如何计算偿债能力图文教程2021-1-10 13:47:49
- T6设置凭证账簿套打图文教程2021-1-9 14:1:58
最新信息
U8.52系统管理端无法清除异常任务U8.52系统管理端无法清除异常任务
U8.52-系统管理端无法清除异常任务
自动编号: | 12794 | 产品版本: | U8.52 |
产品模块: | 系统环境 | 所属行业: | 通用 |
适用产品: | 852 | 关 键 字: | 系统管理端无法清除异常任务 |
问题名称: | 系统管理端无法清除异常任务 | ||
问题现象: | 客户端上报账中心,当客户端退出后,系统管理端没有将此任务清除,仍显示此用户在线 | ||
原因分析: | 环境问题 | ||
解决方案: | 将CONFIG.DAT删除后,重新配置应用服务器 温馨提示:如果您的问题还没有解决,欢迎进入用友云基地。 |
U8.52数据引入时系统提示格式不同,是否强行追加U8.52数据引入时系统提示格式不同,是否强行追加
U8.52-数据引入时系统提示格式不同,是否强行追加
自动编号: | 18419 | 产品版本: | U8.52 |
产品模块: | 行业报表 | 所属行业: | 通用 |
适用产品: | U852----行业报表 | 关 键 字: | 数据引入 |
问题名称: | 数据引入时系统提示格式不同,是否强行追加 | ||
问题现象: | 行业报表数据引入时系统提示格式不同,是否强行追加:在没有修改下属单位报表格式状态下,接收下属单位上报报表时,系统提示格式不同,是否强行追加等信息。 | ||
原因分析: | 造成问题原因是报表与样表的格式不一致。假设E盘为U8安装盘,报表体系名称为“卫生局报表”,E:\U8SOFT\YCBB\卫生局报表\样表文件夹中的"1(医院表一)资产负债表.rep"文件,与E:\U8SOFT\YCBB\卫生局报表\报表文件夹中的"1(医院表一)资产负债表.rep"文件格式不一致。 | ||
解决方案: | 方法1、在上级单位把原来的样表重新创建引用表,将新创建的引用表加入到要下发的表集中后,下发到下级单位填写数据。 方法2、在上级单位把体系文件夹下的Send_ParentTableMng.dat文件改名后(假设E盘为U8安装盘,报表体系名称为“卫生局报表”,文件路径为E:\U8SOFT\YCBB\卫生局报表\),把有错误的报表的样表重新定义,再重新单独下发此表到下级单位填写数据。 温馨提示:如果您的问题还没有解决,欢迎进入用友云基地。 |
计算机审计存在的风险 计算机审计存在的风险
(一)具体目标扩展带来的风险。,对被审计单位各种财务数据真实性、合法性、正确性的认定,就必然包含对其电子数据的载体(网络、信息系统及数据库)的安全性、可靠性的认定。具体审计目标扩展了,审计内容更加宽泛复杂,计算机信息系统的开放性、易被攻击性及网络活动的无痕型、网络交易的虚拟性,都使得计算机审计面临的不确定因素增多、风险加大。
(二)审计对象增加、范围扩大带来的审计风险。计算机审计增加了现行信息系统的审计和电子数据的审计,已突破传统财务审计的范围。以报表评价为主要目标的审计,因实时网络的存在,往往同业务审计、经营审计和管理审计密不可分。包罗万象的大审计,使审计风险来源增加。被审计单位网络、信息系统及数据库、应用软件的不稳定性,电子数据的易被改变、被复制和被消除性,以及信息系统目前难以实现直接查阅源程序等,必然带来新的审计风险要素。
- 单核算模快,采购入库单的可用量和收发存汇总表的现存量对不上,整理过了
- T3升级到G6产品,2016年正常使用,2015年以前年度报错“此帐套行业性质与科目设置中的科目分类不符,请调整”,点确定后提示没有设置数据库连接
- 现在代理商的技术支持网怎么登陆不了呢,我需要提交数据问题
- T3标准版,卸载后,删除哪几个注册表,在什么地方-
- 如何删除T3系统固定资产模块结转的凭证?
- 你好,我买的T3用友软件按照安装说明装完以后,启动T3图标没有显示初始化以后没有账套信息和会计年度,无法登录,请问这要怎么处理?
- 咨询一下老师,畅捷通T3数据库中没有账套和UFsystenm数据库,为什么T3中账套能登进去呢
- 用友T6应收款管理操作流程
- 销售统计表和发货统计表数据不一致
- 用友软件清除异常
零售结算前台的收银单之后用对账收款然后自动生成凭证,现在我能不能直接按收银单填凭证,对期末结账没有影响吧 零售结算前台的收银单之后用对账收款然后自动生成凭证,现在我能不能直接按收银单填凭证,对期末结账没有影响吧[]
您的意思是手工填制凭证?
可以的,不会影响。
单位自建的工程需要交建筑营业税吗- 单位自建的工程需要交建筑营业税吗?
问:单位自建的工程需要交建筑营业税吗?
答:《国家税务总局关于企业(单位)所属建筑安装企业征收营业税问题的批复》国税函发(1995)191号文件规定:对企业(单位)附属的建筑安装企业承担本企业(单位)的建筑安装工程,如果所属建筑安装企业属于独立核算单位,应当征收营业税。如果所属建筑安装企业属于非独立核算单位,根据《中华人民共和国营业税暂行条例实施细则》第十一条:“负有营业税纳税义务的单位为发生应税行为并向对方收取货币、货物或其他经济利益的单位,包括独立核算的单位和不独立核算的单位”的规定,凡同本单位结算工程价款的,不论是否编制工程概(预)算,也不论工程价款中是否包括营业税税金,均应当征收营业税;凡不与本单位结算工程价款的,不征收营业税。
- 凭证打印时别的都能正常打印,由固定资产生成的凭证打印时提示打印机缺纸,错误号1001
- 销售出库单 记账失败 提示 单据号“00000001” 记账失败
- 提示此帐套行业性质与科目设置中的科目分类不符这么怎么办
- 11.5客户端登录一直这样,服务器可以打开,地址可以ping通,端口也可以
- t3安装到最后一直不提示重新启动,强制重启后,服务里没有T3,这是怎么回事啊-电脑装的是WIN7 32位的
- T3 10.8.2 反记账按CTRL+H没 反应 反结账可以
- T3普及版10.8puls1 民间非盈利组织 选择10月现金流量,现金流量表的累计算到11月份。这是怎么回事,11月份算过了,但是往回查选择10月份,不会算到10月份,算到11月份。
- 怎么查看加密狗对应的软件版本,现在有加密狗,不知道安装什么版本的软件
- 总账与往来账对账不平
- 总账与明细账不平在哪里修改
T6HR的年假 如刚进来的员工年假是7天 3年后每年增加一天 这个年假公式怎么设置 T6HR的年假 如刚进来的员工年假是7天 3年后每年增加一天 这个年假公式怎么设置[]
稍等,我这边设置看一下分情况 如果 MonthsBetween(人员基本信息.入职时间,登录日期) / 12 分情况 如果 yearsBetween(人员基本信息.入职时间,登录日期) / 12 以这个为准:
分情况 如果 yearsBetween(人员基本信息.入职时间,登录日期)
- 客户重装操作系统后自行安装T3普,但将“UFSMART”改为“T3普及版”,软件出错,为其卸载,在控制面板--程序里、开始菜单用友自己的卸载、360等其他第三方工具都卸载不了。现在停止数据库后,直接删除了安装目录,但点击安装后还是提示删除T3,但又删除不掉
- 用友T1商贸宝批发零售版
- 用友T6企业管理软件
- 用友软件U8
- 用友T3标准版
- 实施用友软件U8+CRM的成功率目前是多少,是否像ERP那么低?
- 实时错误339 _0
- T+12.0标准版-凭证记账,反记账,能否像T3标准版那样,点了全选的,会默认把所有该月要记账的凭证都选中,再点记账;反记账也是只需要选中,即可把整个月的凭证都反记账,方便多了,求教,谢谢!
- 打印的时候报错
- 新建账套,原材料科目余额表没有余额,但明细账有余额,报表又平,有无解决方法
用系统管理员admin备份帐套的时候提示‘当前路径没有写权限’,但是自动备份正常 这是什么情况? 用系统管理员admin备份帐套的时候提示‘当前路径没有写权限’,但是自动备份正常 这是什么情况?[]
建议更新软件补丁来处理。
检查保存文件的路径。
右键文件夹属性,安全页签,
添加user、everyone对此文件夹的全部控制权限。@畅捷支持侯椿寳:和自动备份的文件是一个路径 里面有昨天的自动备份 但是手动备份的时候 选择这个路径就不行尝试其他路径,如果依旧报错,还是需要重装软件并更新补丁来处理。
单据界面无法显示“整单折让”字段?原因分析:没有启用”折扣业务“,单据中不显示”整单折让“字段。问题解答:进入系统维护——录帐配置中将“启用折扣”勾选后,出入库单中就会有“整单折让”字段。注:此处的选项,在系统开账后就不能去修改,所以建议在开账前就将此选项勾选上。
用友T6软件零售单过账提示数据不正确资产负债表不平零售单过账提示数据不正确资产负债表不平
零售单过账提示数据不正确资产负债表不平原因分析: 当软件计算金额与电子称打印金额不一致时,就会出现“数据不正确,资产负债表不平”的提示。例如:商品的电子秤识别码为1200011011106,单价为后5位,11106,金额代表11.106,输入该商品后,用11.106除以该商品的单价35.00反算数量,最后在该商品行会显示一个合计金额11.10000010,这个合计金额不等于11.106,过账就会发生错误。问题解答: 先备份数据,再在查询分析器中执行如下脚本。set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgoALTER PROCEDURE [dbo].[P_SetMoneyList] @Bill_ID int, @Bill_ID_Old int, @BillType int AS declare @Act_ID int, @Act_Money numeric(28,10), @Card_Money numeric(28,10), @YH_Money numeric(28,10), @PCMoney numeric(28,10) declare @CostMoney numeric(28,10), @DisMoney numeric(28,10), @DisMoney0 numeric(28,10), @TaxMoney numeric(28,10), @TaxMoney0 numeric(28,10), @CostMoney_1 numeric(28,10), @DisMoney_1 numeric(28,10), @TaxMoney_1 numeric(28,10), @TaxMoney0_1 numeric(28,10) declare @CostMoney_1_out numeric(28,10), @DisMoney_1_out numeric(28,10), @TaxMoney_1_out numeric(28,10), @TaxMoney0_1_out numeric(28,10), @CostMoney_2_in numeric(28,10), @DisMoney_2_in numeric(28,10), @TaxMoney_2_in numeric(28,10), @TaxMoney0_2_in numeric(28,10) declare @PD_Money numeric(28,10), @LS_Money_DJJ numeric(28,10), @LS_Money_Other_Tmp numeric(28,10), @LS_Money_DJJ_Tmp numeric(28,10), @Tmp_Money numeric(28,10) declare @Unit_ID_List int, @Act_ID_List int, @Act_Money_List numeric(28,10), @Act_Money_List1 numeric(28,10), @Act_Money_List_Tot numeric(28,10), @Act_Money_List1_Tot numeric(28,10) declare @s_Syb int, @BillDate varchar(10) , @BillSN varchar(100), @Unit_ID int, @User_ID int, @Audit_ID int, @Oper_ID int, @Period int declare @ActFullID_ZZ varchar(30), @Money_JF numeric(28,10), @Money_DF numeric(28,10), @Tmp_ZC numeric(28,10), @Tmp_FZ numeric(28,10), @Tmp_QY numeric(28,10) declare @JSMoney numeric(28,10), @Writejsbill int, @TmpWLBill_ID varchar(50), @TmpQLBill_ID int, @BillType_QL int, @YSDate varchar(20), @YU_Money numeric(28,10), @YU_Money_JS numeric(28,10), @YU_Money_JS_List numeric(28,10),@RecPayDate varchar(10) declare @OrderId int, @YUS_YUF_Money numeric(28,10),@YUS_YUF_Money_List numeric(28,10)declare @BillID_O int, @OrderId_O int, @NotMoney_O numeric(28,10), @CurrMoney_O numeric(28,10), @SelMoney_O numeric(28,10), @VIP_SwapIntegralM numeric(28,10) declare @Money_XS int declare @Thirdpayment int, @ThirdPaymentMoney numeric(28,10), @ItemBillNo varchar(30), @SumShippingMoney numeric(28,10), @SumShippingMoney_List_P numeric(28,10), @SumShippingMoney_List_Z numeric(28,10), @SRUnit int, @SRAcount_ID int, @SRAcount_Money numeric(28,10), @SRJSMoney numeric(28,10) declare @ysyf_id int,@BackMoney numeric(28,10),@order_id int,@BackYsyfMoney numeric(28,10) set nocount on if @BillType>=0 and @BillType<=300 begin select @s_Syb=s_Syb, @BillDate=BillDate, @BillSN=BillSN, @Unit_ID=isnull(Unit_ID,-1), @User_ID=Emp_ID, @Audit_ID=Audit_ID, @Oper_ID=Oper_ID, @Period=Period, @Act_ID=Act_ID, @Act_Money=case when Act_ID>1 then isnull(Act_Money,0) else 0 end, @Card_Money=isnull(Card_Money,0), @YH_Money=isnull(YH_Money,0), @PCMoney=abs(isnull(PCMoney,0)),@PD_Money=isnull(SumTaxMoney,0), @YUS_YUF_Money=isnull(YUS_YUF_Money,0),@VIP_SwapIntegralM=isnull(VIP_SwapIntegralM,0) ,@Thirdpayment=isnull(Thirdpayment,0), @ThirdPaymentMoney=isnull(ThirdPaymentMoney,0),@ItemBillNo=ItemBillNo,@SumShippingMoney=isnull(SumShippingMoney,0), @SRUnit=isnull(SRUnit,-1),@SRAcount_ID=isnull(SRAcount_ID,-1),@SRAcount_Money=isnull(SRAcount_Money,0), @SRJSMoney=isnull(SRJSMoney,0) from MasterBill where AutoID=@Bill_ID end if @BillType in (1,4,14,15,16,51,52,53,54,59) begin if @billtype in (59)begin select @PD_Money=sum(costmoney) from dbo.ListProdCheck where Bill_ID=@Bill_ID endelse if @BillType in (1,4,15,16) begin select @CostMoney=Isnull(Sum((CostMoney)),0), @DisMoney =Isnull(Sum((DisMoney)),0), @TaxMoney =Isnull(Sum((TaxMoney)),0), @TaxMoney0=Isnull(Sum((TaxMoney0)),0) from ListSale where Bill_ID=@Bill_ID and ZS_Syb=0 select @CostMoney_1=Isnull(Sum((CostMoney)),0), @DisMoney_1 =Isnull(Sum((DisMoney)),0), @TaxMoney_1 =Isnull(Sum((TaxMoney)),0), @TaxMoney0_1=Isnull(Sum((TaxMoney0)),0) from ListSale where Bill_ID=@Bill_ID and ZS_Syb=1 end else if @BillType=14 begin select @CostMoney=Isnull(Sum((CostMoney)),0), @DisMoney =Isnull(Sum((DisMoney)),0), @TaxMoney =Isnull(Sum((TaxMoney)),0), @TaxMoney0=Isnull(Sum((TaxMoney0)),0) from ListSale where Bill_ID=@Bill_ID and InorOut=1 and ZS_Syb=0 select @CostMoney_1_out=Isnull(Sum((CostMoney)),0), @DisMoney_1_out =Isnull(Sum((DisMoney)),0), @TaxMoney_1_out =Isnull(Sum((TaxMoney)),0), @TaxMoney0_1_out=Isnull(Sum((TaxMoney0)),0) from ListSale where Bill_ID=@Bill_ID and InorOut=1 and ZS_Syb=1 select @CostMoney_1=Isnull(Sum((CostMoney)),0), @DisMoney_1 =Isnull(Sum((DisMoney)),0), @TaxMoney_1 =Isnull(Sum((TaxMoney)),0), @TaxMoney0_1=Isnull(Sum((TaxMoney0)),0) from ListSale where Bill_ID=@Bill_ID and InorOut=2 and ZS_Syb=0 select @CostMoney_2_in=Isnull(Sum((CostMoney)),0), @DisMoney_2_in =Isnull(Sum((DisMoney)),0), @TaxMoney_2_in =Isnull(Sum((TaxMoney)),0), @TaxMoney0_2_in=Isnull(Sum((TaxMoney0)),0) from ListSale where Bill_ID=@Bill_ID and InorOut=2 and ZS_Syb=1 end else if @BillType=53 begin select @CostMoney=Isnull(Sum((CostMoney)),0), @DisMoney =Isnull(Sum((DisMoney)),0), @TaxMoney =Isnull(Sum((TaxMoney)),0), @TaxMoney0=Isnull(Sum((TaxMoney0)),0) from ListSale where Bill_ID=@Bill_ID and ZS_Syb=0 select @CostMoney_1=Isnull(Sum((CostMoney)),0), @DisMoney_1 =Isnull(Sum((DisMoney)),0), @TaxMoney_1 =Isnull(Sum((TaxMoney)),0), @TaxMoney0_1=Isnull(Sum((TaxMoney0)),0) from ListSale where Bill_ID=@Bill_ID and ZS_Syb=1 end else begin select @CostMoney=Isnull(Sum((CostMoney)),0), @DisMoney =Isnull(Sum((DisMoney)),0), @TaxMoney =Isnull(Sum((TaxMoney)),0), @TaxMoney0=Isnull(Sum((TaxMoney0)),0) from ListSale where Bill_ID=@Bill_ID end end else if @BillType in (0,3,55,56,57,58,61) begin if @BillType in (0,3) begin select @CostMoney=Isnull(Sum((CostMoney)),0), @DisMoney =Isnull(Sum((DisMoney)),0),@SumShippingMoney_List_P=isnull(sum(ShippingMoney),0), @TaxMoney =Isnull(Sum((TaxMoney)),0), @TaxMoney0 =Isnull(Sum((TaxMoney0)),0) from ListBuy where Bill_ID=@Bill_ID and ZS_Syb=0 select @CostMoney_1=Isnull(Sum((CostMoney)),0), @DisMoney_1 =Isnull(Sum((DisMoney)),0),@SumShippingMoney_List_Z=isnull(sum(ShippingMoney),0), @TaxMoney_1 =Isnull(Sum((TaxMoney)),0), @TaxMoney0_1 =Isnull(Sum((TaxMoney0)),0) from ListBuy where Bill_ID=@Bill_ID and ZS_Syb=1 end else if @BillType=61 begin select @CostMoney=Isnull(Sum((CostMoney)),0), @DisMoney=Isnull(Sum((DisMoney)),0), @TaxMoney=Isnull(Sum((TaxMoney)),0), @TaxMoney0=Isnull(Sum((TaxMoney0)),0) from ListBuy where Bill_ID=@Bill_ID and InorOut=1 and ZS_Syb=0 select @CostMoney_1_out=Isnull(Sum((CostMoney)),0), @DisMoney_1_out=Isnull(Sum((DisMoney)),0), @TaxMoney_1_out=Isnull(Sum((TaxMoney)),0), @TaxMoney0_1_out=Isnull(Sum((TaxMoney0)),0) from ListBuy where Bill_ID=@Bill_ID and InorOut=1 and ZS_Syb=1 select @CostMoney_1=Isnull(Sum(CostMoney),0), @DisMoney_1=Isnull(Sum((DisMoney)),0), @TaxMoney_1=Isnull(Sum((TaxMoney)),0), @TaxMoney0_1=Isnull(Sum((TaxMoney0)),0) from ListBuy where Bill_ID=@Bill_ID and InorOut=2 and ZS_Syb=0 select @CostMoney_2_in=Isnull(Sum(CostMoney),0), @DisMoney_2_in=Isnull(Sum((DisMoney)),0), @TaxMoney_2_in=Isnull(Sum((TaxMoney)),0), @TaxMoney0_2_in=Isnull(Sum((TaxMoney0)),0) from ListBuy where Bill_ID=@Bill_ID and InorOut=2 and ZS_Syb=1 end else begin select @CostMoney=Isnull(Sum((CostMoney)),0), @DisMoney=Isnull(Sum((DisMoney)),0), @TaxMoney=Isnull(Sum(TaxMoney),0), @TaxMoney0=Isnull(Sum((TaxMoney0)),0) from ListBuy where Bill_ID=@Bill_ID end end else if @BillType in (2,7,8,9,10,11,12,13,17,18,242,243,244,245,251,252) begin if @BillType=13 begin select @CostMoney=Isnull(Sum((CostMoney)),0), @DisMoney =Isnull(Sum((DisMoney)),0) from ListOther where Bill_ID=@Bill_ID and InorOut=1 select @CostMoney_1=Isnull(Sum((CostMoney)),0),@DisMoney_1 =Isnull(Sum((DisMoney)),0) from ListOther where Bill_ID=@Bill_ID and InorOut=2 end else if @BillType=251 begin select @DisMoney0=Isnull(Sum((DisMoney0)),0), @TaxMoney0 =Isnull(Sum((TaxMoney0)),0),@CostMoney=isnull(sum(Isnull((DisMoney0),0)-Isnull((TaxMoney0),0)),0) from ListOther where Bill_ID=@Bill_ID end else if @BillType=252 begin select @DisMoney0=Isnull(Sum((DisMoney0)),0), @TaxMoney0 =Isnull(Sum((TaxMoney0)),0),@CostMoney=isnull(sum(Isnull((DisMoney0),0)-Isnull((TaxMoney0),0)),0) from ListOther where Bill_ID=@Bill_ID end else begin select @CostMoney=Isnull(Sum((CostMoney)),0),@DisMoney =Isnull(Sum((DisMoney)),0) from ListOther where Bill_ID=@Bill_ID end end if (@BillType >=0 and @BillType<=59) or (@BillType>=242 and @BillType<=245) or (@BillType=61) or (@BillType=251) or (@BillType=252) begin if @s_Syb<>0 and @Bill_ID_Old<>-100 and @BillType=251 begin Declare Cur_Red Cursor Local Scroll for SELECT BillDate, BillSN, BillType, Unit_ID, User_ID, Audit_ID,Oper_ID, Period,Act_ID, -Act_Money FROM MoneyList where Bill_ID=@Bill_ID_Old and Act_ID not in(3,100) Open Cur_Red Fetch next from Cur_Red into @BillDate,@BillSN,@BillType,@Unit_ID,@User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Act_Money while @@Fetch_Status=0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) select @s_Syb,@BillDate,@Bill_ID,@BillSN,@BillType,@Unit_ID,@User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Act_Money if @@error<>0 goto Error Fetch next from Cur_Red into @BillDate,@BillSN,@BillType,@Unit_ID,@User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Act_Money end Close Cur_Red deallocate Cur_Red if @CostMoney<>0 begin if @CostMoney>0 set @Tmp_Money=-abs(@CostMoney) if @CostMoney<0 set @Tmp_Money=abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end if @TaxMoney0<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,100,@TaxMoney0) if @@error<>0 goto Error end update MoneyList set s_Syb=-2 where Bill_ID=@Bill_ID_Old and @Bill_ID_Old<>-100 and s_Syb=0 if @@error<>0 goto Error goto Success end if @BillType=251 and @s_Syb=0 begin if @DisMoney0>0 begin if @Act_Money<=@DisMoney0 begin set @Tmp_Money=abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Tmp_Money) if @@error<>0 goto Error if @Act_Money<@DisMoney0 begin set @Tmp_Money=-abs(@DisMoney0-@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,19,@Tmp_Money) if @@error<>0 goto Error end end if @Act_Money>@DisMoney0 begin set @Tmp_Money=abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Tmp_Money) if @@error<>0 goto Error if @Act_Money>@DisMoney0 begin set @Tmp_Money=abs(@DisMoney0-@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,19,@Tmp_Money) if @@error<>0 goto Error end end end if @DisMoney0<=0 begin if @Act_Money>0 begin set @Tmp_Money=abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Tmp_Money) if @@error<>0 goto Error end if abs(abs(@DisMoney0)+abs(@Act_Money))>0 begin set @Tmp_Money=abs(abs(@DisMoney0)+abs(@Act_Money)) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,19,@Tmp_Money) if @@error<>0 goto Error end end if @CostMoney<>0 begin if @CostMoney>0 set @Tmp_Money=-abs(@CostMoney) if @CostMoney<0 set @Tmp_Money=abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end if @TaxMoney0<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,100,@TaxMoney0) if @@error<>0 goto Error end goto Success end if @BillType=252 and @s_Syb=0 begin if @DisMoney0>0 begin if @Act_Money<=@DisMoney0 begin set @Tmp_Money=-abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Tmp_Money) if @@error<>0 goto Error if @Act_Money<@DisMoney0 begin set @Tmp_Money=-abs(@DisMoney0-@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,11,@Tmp_Money) if @@error<>0 goto Error end end if @Act_Money>@DisMoney0 begin set @Tmp_Money=-abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Tmp_Money) if @@error<>0 goto Error if @Act_Money>@DisMoney0 begin set @Tmp_Money=abs(@DisMoney0-@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,11,@Tmp_Money) if @@error<>0 goto Error end end end if @DisMoney0<=0 begin if @Act_Money>0 begin set @Tmp_Money=-abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Tmp_Money) if @@error<>0 goto Error end if abs(abs(@DisMoney0)+abs(@Act_Money))>0 begin set @Tmp_Money=abs(abs(@DisMoney0)+abs(@Act_Money)) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,11,@Tmp_Money) if @@error<>0 goto Error end end if @TaxMoney0<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,101,@TaxMoney0) if @@error<>0 goto Error end goto Success end if @BillType=1 and @s_Syb=0 begin if @YH_Money<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,48,@YH_Money) if @@error<>0 goto Error end if @Act_Money<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Act_Money) if @@error<>0 goto Error end if @YUS_YUF_Money<>0 begin set @Tmp_Money=-@YUS_YUF_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,57,@Tmp_Money) if @@error<>0 goto Error end if @VIP_SwapIntegralM<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,54,@VIP_SwapIntegralM) if @@error<>0 goto Error end if @Card_Money<>0 begin set @Tmp_Money=-abs(@Card_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,52,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin set @Tmp_Money=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end if abs(@TaxMoney)-abs(@TaxMoney0)<>0 Begin set @Tmp_Money=abs(@TaxMoney)-abs(@TaxMoney0) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,24,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,40,@CostMoney) if @@error<>0 goto Error end if @TaxMoney0<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,21,@TaxMoney0) if @@error<>0 goto Error end if isnull(@Thirdpayment,0)>0 and isnull(@ThirdPaymentMoney,0)>0 Begin set @Tmp_Money=@ThirdPaymentMoney insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Thirdpayment, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end if abs(@TaxMoney)-(abs(@Act_Money)+@YH_Money+@Card_Money+@YUS_YUF_Money+@VIP_SwapIntegralM+@ThirdPaymentMoney)>0 Begin set @Tmp_Money=abs(@TaxMoney)-abs(@Act_Money)-@YH_Money-@Card_Money-@YUS_YUF_Money-@VIP_SwapIntegralM-@ThirdPaymentMoney insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end if abs(@TaxMoney)-(abs(@Act_Money)+@YH_Money+@Card_Money+@YUS_YUF_Money+@VIP_SwapIntegralM+@ThirdPaymentMoney)<0 Begin set @Tmp_Money=-(abs(@TaxMoney)-abs(@Act_Money)-@YH_Money-@Card_Money-@YUS_YUF_Money-@VIP_SwapIntegralM-@ThirdPaymentMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,19,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,43,@CostMoney_1) if @@error<>0 goto Error end if @CostMoney_1<>0 begin set @CostMoney_1=-abs(@CostMoney_1) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney_1) if @@error<>0 goto Error set @CostMoney_1=abs(@CostMoney_1) end goto Success end if @BillType=4 and @s_Syb=0 begin if @YH_Money<>0 begin set @Tmp_Money=-@YH_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,48,@Tmp_Money) if @@error<>0 goto Error end if @Act_Money<>0 begin set @Act_Money=-abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Act_Money) if @@error<>0 goto Error set @Act_Money=abs(@Act_Money) end if @VIP_SwapIntegralM<>0 begin set @Tmp_Money=-@VIP_SwapIntegralM insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,54,@Tmp_Money) if @@error<>0 goto Error end if @Card_Money<>0 begin set @Tmp_Money=@Card_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,52,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error end if abs(@TaxMoney)-abs(@TaxMoney0)<>0 Begin set @Tmp_Money=-(abs(@TaxMoney)-abs(@TaxMoney0)) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,24,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin set @CostMoney=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @Bill, Date, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,40,@CostMoney) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end if @TaxMoney0<>0 begin set @TaxMoney0=-Abs(@TaxMoney0) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,21,@TaxMoney0) if @@error<>0 goto Error set @TaxMoney0=Abs(@TaxMoney0) end if abs(@TaxMoney)-(abs(@Act_Money)+abs(@VIP_SwapIntegralM)+@Card_Money+@YH_Money)>0 Begin set @Tmp_Money=abs(@TaxMoney)-abs(@Act_Money)-abs(@VIP_SwapIntegralM)-@Card_Money-@YH_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,19,@Tmp_Money) if @@error<>0 goto Error end if abs(@TaxMoney)-(abs(@Act_Money)+abs(@VIP_SwapIntegralM)+@YH_Money+@Card_Money)<0 Begin set @Tmp_Money=-(abs(@TaxMoney)-abs(@Act_Money)-abs(@VIP_SwapIntegralM)-@YH_Money-@Card_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1<>0 begin set @Tmp_Money=-@CostMoney_1 insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,43,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1<>0 begin set @Tmp_Money=@CostMoney_1 insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=14 and @s_Syb=0 begin if @YH_Money<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,48,@YH_Money) if @@error<>0 goto Error end if @Act_Money<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Act_Money) if @@error<>0 goto Error end if @CostMoney_1-@CostMoney<>0 begin set @Tmp_Money=@CostMoney_1-@CostMoney insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney-@CostMoney_1<>0 begin set @Tmp_Money=@CostMoney-@CostMoney_1 insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,40,@Tmp_Money) if @@error<>0 goto Error end if abs(@DisMoney)-abs(@DisMoney_1)<>0 Begin set @Tmp_Money=abs(@DisMoney)-abs(@DisMoney_1) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,24,@Tmp_Money) if @@error<>0 goto Error end if @TaxMoney0-@TaxMoney0_1<>0 begin set @Tmp_Money=@TaxMoney0-@TaxMoney0_1 insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,21,@Tmp_Money) if @@error<>0 goto Error end if (abs(@TaxMoney)-abs(@TaxMoney_1))-(@Act_Money+@YH_Money)>0 Begin set @Tmp_Money=(abs(@TaxMoney)-abs(@TaxMoney_1))-(@Act_Money+@YH_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end if (abs(@TaxMoney)-abs(@TaxMoney_1))-(@Act_Money+@YH_Money)<0 Begin set @Tmp_Money=-((abs(@TaxMoney)-abs(@TaxMoney_1))-(@Act_Money+@YH_Money)) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,19,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1_out<>0 begin set @Tmp_Money=@CostMoney_1_out insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,43,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1_out<>0 begin set @Tmp_Money=-@CostMoney_1_out insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_2_in<>0 begin set @Tmp_Money=-@CostMoney_2_in insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,43,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_2_in<>0 begin set @Tmp_Money=@CostMoney_2_in insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=0 and @s_Syb=0 begin if @YH_Money<>0 begin set @Tmp_Money=-@YH_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,48,@Tmp_Money) if @@error<>0 goto Error end if @YUS_YUF_Money<>0 begin set @Tmp_Money=-@YUS_YUF_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,56,@Tmp_Money) if @@error<>0 goto Error end if @Act_Money<>0 begin set @Tmp_Money=-@Act_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin set @CostMoney=abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end if @TaxMoney0<>0 begin set @TaxMoney0=-Abs(@TaxMoney0) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,21,@TaxMoney0) if @@error<>0 goto Error set @TaxMoney0=Abs(@TaxMoney0) end if abs(@TaxMoney)-(abs(@Act_Money)+@YH_Money+@YUS_YUF_Money)>0 Begin set @Tmp_Money=abs(@TaxMoney)-abs(@Act_Money)-@YH_Money-@YUS_YUF_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money) if @@error<>0 goto Error end if abs(@TaxMoney)-(abs(@Act_Money)+@YH_Money+@YUS_YUF_Money)<0 Begin set @Tmp_Money=-(abs(@TaxMoney)-abs(@Act_Money)-@YH_Money-@YUS_YUF_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,11,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1-@SumShippingMoney_List_Z<>0 begin set @Tmp_Money=@CostMoney_1-@SumShippingMoney_List_Z insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,27,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney_1) if @@error<>0 goto Error end if @SRAcount_ID>0 and @SRAcount_Money>0 begin set @Tmp_Money=-@SRAcount_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@SRAcount_ID,@Tmp_Money) if @@error<>0 goto Error end if @SumShippingMoney-@SRAcount_Money>0 Begin set @Tmp_Money=@SumShippingMoney-@SRAcount_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @SRUnit, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=3 and @s_Syb=0 begin if @YH_Money<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,48,@YH_Money) if @@error<>0 goto Error end if @Act_Money<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Act_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin set @CostMoney=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end if abs(@TaxMoney)-abs(@CostMoney)-abs(@TaxMoney0)<>0 Begin set @Tmp_Money=abs(@TaxMoney)-abs(@CostMoney)-abs(@TaxMoney0) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,29,@Tmp_Money) if @@error<>0 goto Error end if @TaxMoney0<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,21,@TaxMoney0) if @@error<>0 goto Error end if abs(@TaxMoney)-(abs(@Act_Money)+@YH_Money)>0 Begin set @Tmp_Money=abs(@TaxMoney)-abs(@Act_Money)-@YH_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end if abs(@TaxMoney)-(abs(@Act_Money)+@YH_Money)<0 Begin set @Tmp_Money=-(abs(@TaxMoney)-abs(@Act_Money)-@YH_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,19,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1<>0 begin set @Tmp_Money=-@CostMoney_1 insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,27,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1<>0 begin set @Tmp_Money=-@CostMoney_1 insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=61 and @s_Syb=0 begin if @YH_Money<>0 begin set @Tmp_Money=-@YH_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,48,@Tmp_Money) if @@error<>0 goto Error end if @Act_Money<>0 begin set @Tmp_Money=-(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1-@CostMoney<>0 begin set @Tmp_Money=@CostMoney_1-@CostMoney insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end if abs(@TaxMoney)-abs(@CostMoney)-abs(@TaxMoney0)<>0 Begin set @Tmp_Money=abs(@TaxMoney)-abs(@CostMoney)-abs(@TaxMoney0) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,29,@Tmp_Money) if @@error<>0 goto Error end if @TaxMoney0_1-@TaxMoney0<>0 begin set @Tmp_Money=-(@TaxMoney0_1-@TaxMoney0) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,21,@Tmp_Money) if @@error<>0 goto Error end if (@TaxMoney_1-@TaxMoney)-(@Act_Money+@YH_Money)>0 Begin set @Tmp_Money=(@TaxMoney_1-@TaxMoney)-@Act_Money-@YH_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money) if @@error<>0 goto Error end if (@TaxMoney_1-@TaxMoney)-(@Act_Money+@YH_Money)<0 Begin set @Tmp_Money=-((@TaxMoney_1-@TaxMoney)-@Act_Money-@YH_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,11,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1_out<>0 begin set @Tmp_Money=-@CostMoney_1_out insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,27,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1_out<>0 begin set @Tmp_Money=-@CostMoney_1_out insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_2_in<>0 begin set @Tmp_Money=@CostMoney_2_in insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,27,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_2_in<>0 begin set @Tmp_Money=@CostMoney_2_in insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=55 and @s_Syb=0 begin if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,22,@CostMoney) if @@error<>0 goto Error end goto Success end if @BillType=56 and @s_Syb=0 begin if @CostMoney<>0 begin set @CostMoney=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end if @DisMoney<>0 begin set @Tmp_Money=-@DisMoney insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,22,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney-@DisMoney<>0 begin set @Tmp_Money=@CostMoney-@DisMoney insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,40,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=57 and @s_Syb=0 begin if @Act_Money<>0 begin set @Act_Money=-abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Act_Money) if @@error<>0 goto Error set @Act_Money=abs(@Act_Money) end if @TaxMoney0<>0 begin set @Tmp_Money=-Abs(@TaxMoney0) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,21,@Tmp_Money) if @@error<>0 goto Error end if @TaxMoney-@TaxMoney0<>0 begin set @Tmp_Money=-(abs(@TaxMoney)-@TaxMoney0) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,22,@Tmp_Money) if @@error<>0 goto Error end if abs(@TaxMoney)-abs(@Act_Money)>0 Begin set @Tmp_Money=abs(@TaxMoney)-abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,19,@Tmp_Money) if @@error<>0 goto Error end if abs(@TaxMoney)-abs(@Act_Money)<0 Begin set @Tmp_Money=-(abs(@TaxMoney)-abs(@Act_Money)) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=58 and @s_Syb=0 begin if @DisMoney-@CostMoney<>0 begin set @Tmp_Money=(@DisMoney)-(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,40,@Tmp_Money) if @@error<>0 goto Error end if @DisMoney-@CostMoney<>0 begin set @Tmp_Money=(@DisMoney)-(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,22,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=59 and @s_Syb=0 begin if @PD_Money<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_, Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@PD_Money) if @@error<>0 goto Error end if @PD_Money>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,26,@PD_Money) if @@error<>0 goto Error end else if @PD_Money<0 begin set @Tmp_Money=abs(@PD_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,42,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=15 and @s_Syb=0 begin set @LS_Money_Other_Tmp=0 set @LS_Money_DJJ_Tmp=0 if @YH_Money<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,48,@YH_Money) if @@error<>0 goto Error end Declare curMoney Cursor Local Scroll for select Act_ID,isnull(PayMoney,0) from ListSaleAcount where Bill_ID=@Bill_ID Open curMoney Fetch next from CurMoney into @Act_ID_List,@Act_Money_List while @@Fetch_Status=0 begin if @Act_ID_List<>17 set @LS_Money_Other_Tmp=isnull(@LS_Money_Other_Tmp,0)+@Act_Money_List else set @LS_Money_DJJ_Tmp=isnull(@LS_Money_DJJ_Tmp,0)+@Act_Money_List if @Act_ID_List=52 set @Tmp_Money=-(@Act_Money_List) else set @Tmp_Money=@Act_Money_List insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID_List,@Tmp_Money) if @@error<>0 goto Error Fetch next from CurMoney into @Act_ID_List,@Act_Money_List end Close curMoney deallocate curMoney if @LS_Money_DJJ_Tmp-@TaxMoney+@YH_Money+@LS_Money_Other_Tmp>0 begin set @Tmp_Money=@LS_Money_DJJ_Tmp-@TaxMoney+@YH_Money+@LS_Money_Other_Tmp insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,34,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin set @CostMoney=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end if abs(@TaxMoney)-abs(@TaxMoney0)<>0 Begin set @Tmp_Money=abs(@TaxMoney)-abs(@TaxMoney0) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,24,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,40,@CostMoney) if @@error<>0 goto Error end if @TaxMoney0<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,21,@TaxMoney0) if @@error<>0 goto Error end if @CostMoney_1<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,43,@CostMoney_1) if @@error<>0 goto Error end if @CostMoney_1<>0 begin set @CostMoney_1=-abs(@CostMoney_1) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney_1) if @@error<>0 goto Error set @CostMoney_1=abs(@CostMoney_1) end goto Success end if @BillType=16 and @s_Syb=0 begin set @LS_Money_Other_Tmp=0 set @LS_Money_DJJ_Tmp=0 if @YH_Money<>0 begin set @Tmp_Money=-@YH_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,48,@Tmp_Money) if @@error<>0 goto Error end Declare curMoney Cursor Local Scroll for select Act_ID,isnull(PayMoney,0) from ListSaleAcount where Bill_ID=@Bill_ID Open curMoney Fetch next from CurMoney into @Act_ID_List,@Act_Money_List while @@Fetch_Status=0 begin if @Act_ID_List<>17 set @LS_Money_Other_Tmp=@LS_Money_Other_Tmp+@Act_Money_List else set @LS_Money_DJJ_Tmp=@LS_Money_DJJ_Tmp+@Act_Money_List if @Act_ID_List=52 set @Tmp_Money=@Act_Money_List else set @Tmp_Money=-@Act_Money_List insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID_List,@Tmp_Money) if @@error<>0 goto Error Fetch next from CurMoney into @Act_ID_List,@Act_Money_List end Close curMoney deallocate curMoney if @LS_Money_DJJ_Tmp-@TaxMoney+@YH_Money+@LS_Money_Other_Tmp>0 begin set @Tmp_Money=-(@LS_Money_DJJ_Tmp-@TaxMoney+@YH_Money+@LS_Money_Other_Tmp) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,34,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error end if abs(@TaxMoney)-abs(@TaxMoney0)<>0 Begin set @Tmp_Money=-(abs(@TaxMoney)-abs(@TaxMoney0)) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,24,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin set @CostMoney=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,40,@CostMoney) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end if @TaxMoney0<>0 begin set @TaxMoney0=-Abs(@TaxMoney0) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,21,@TaxMoney0) if @@error<>0 goto Error set @TaxMoney0=Abs(@TaxMoney0) end if @CostMoney_1<>0 begin set @Tmp_Money=-@CostMoney_1 insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,43,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney_1<>0 begin set @Tmp_Money=@CostMoney_1 insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=51 and @s_Syb=0 begin if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,15,@CostMoney) if @@error<>0 goto Error end if @CostMoney<>0 begin set @CostMoney=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end goto Success end if @BillType=52 and @s_Syb=0 begin if @CostMoney<>0 begin set @CostMoney=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,15,@CostMoney) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error end goto Success end if @BillType=53 and @s_Syb=0 begin if @CostMoney_1<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,43,@CostMoney_1) if @@error<>0 goto Error end if @CostMoney_1<>0 begin set @CostMoney_1=-abs(@CostMoney_1) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,15,@CostMoney_1) if @@error<>0 goto Error set @CostMoney_1=abs(@CostMoney_1) end if @Act_Money<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Act_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin set @CostMoney=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,15,@CostMoney) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end if abs(@TaxMoney)-abs(@TaxMoney0)<>0 Begin set @Tmp_Money=abs(@TaxMoney)-abs(@TaxMoney0) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,24,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,40,@CostMoney) if @@error<>0 goto Error end if @TaxMoney0<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,21,@TaxMoney0) if @@error<>0 goto Error end if abs(@TaxMoney)-abs(@Act_Money)>0 Begin set @Tmp_Money=abs(@TaxMoney)-abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end if abs(@TaxMoney)-abs(@Act_Money)<0 Begin set @Tmp_Money=-(abs(@TaxMoney)-abs(@Act_Money)) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,19,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=2 and @s_Syb=0 begin if Abs(@DisMoney)-Abs(@CostMoney)<>0 begin set @Tmp_Money= Abs(@DisMoney)-Abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,28,@Tmp_Money) if @@error<>0 goto Error end if Abs(@DisMoney)-Abs(@CostMoney)<>0 begin set @Tmp_Money= Abs(@DisMoney)-Abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=8 and @s_Syb=0 begin set @TaxMoney=@DisMoney if abs(@TaxMoney)>abs(@CostMoney) Begin set @Tmp_Money=abs(@TaxMoney-@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,30,@Tmp_Money) if @@error<>0 goto Error end else Begin set @Tmp_Money=-abs(@TaxMoney-@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,30,@Tmp_Money) if @@error<>0 goto Error end if abs(@TaxMoney)>abs(@CostMoney) Begin set @Tmp_Money=abs(@TaxMoney-@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end else Begin set @Tmp_Money=-abs(@TaxMoney-@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=9 and @s_Syb=0 begin if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,42,@CostMoney) if @@error<>0 goto Error end if @CostMoney<>0 begin set @CostMoney=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end goto Success end if @BillType=10 and @s_Syb=0 begin if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,26,@CostMoney) if @@error<>0 goto Error end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error end goto Success end if @BillType=11 and @s_Syb=0 begin if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,43,@CostMoney) if @@error<>0 goto Error end if @CostMoney<>0 begin set @CostMoney=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end goto Success end if @BillType=12 and @s_Syb=0 begin if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,27,@CostMoney) if @@error<>0 goto Error end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error end goto Success end if @BillType=13 and @s_Syb=0 begin if abs(@CostMoney_1)-abs(@CostMoney)<>0 begin set @Tmp_Money=abs(@CostMoney_1)-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,31,@Tmp_Money) if @@error<>0 goto Error end if abs(@CostMoney_1)-abs(@CostMoney)<>0 begin set @Tmp_Money=abs(@CostMoney_1)-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end goto Success end if @BillType=17 and @s_Syb=0 begin if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@CostMoney) if @@error<>0 goto Error end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error end goto Success end if @BillType=18 and @s_Syb=0 begin if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@CostMoney) if @@error<>0 goto Error end if @CostMoney<>0 begin set @CostMoney=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error set @CostMoney=abs(@CostMoney) end goto Success end if @BillType=242 and @s_Syb=0 begin if @CostMoney<>0 begin set @Tmp_Money=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,16,@CostMoney) if @@error<>0 goto Error end goto Success end if @BillType=243 and @s_Syb=0 begin if @CostMoney<>0 begin set @Tmp_Money=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,16,@Tmp_Money) if @@error<>0 goto Error end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,3,@CostMoney) if @@error<>0 goto Error end goto Success end if @BillType=244 and @s_Syb=0 begin if @CostMoney<>0 begin set @Tmp_Money=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,16,@Tmp_Money) if @@error<>0 goto E, rror end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,44,@CostMoney) if @@error<>0 goto Error end goto Success end if @BillType=245 and @s_Syb=0 begin if @CostMoney<>0 begin set @Tmp_Money=-abs(@CostMoney) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,16,@Tmp_Money) if @@error<>0 goto Error end if @PCMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,33,@PCMoney) if @@error<>0 goto Error end if @PCMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,6,@PCMoney) if @@error<>0 goto Error end if @CostMoney<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,44,@CostMoney) if @@error<>0 goto Error end goto Success end if @s_Syb<>0 and @Bill_ID_Old not in(-100,-200,-300) and @BillType<>251 begin Declare curMoney Cursor Local Scroll for SELECT BillDate, BillSN, BillType, Unit_ID, User_ID, Audit_ID,Oper_ID, Period,Act_ID, -Act_Money FROM MoneyList where Bill_ID=@Bill_ID_Old Open curMoney Fetch next from curMoney into @BillDate,@BillSN,@BillType,@Unit_ID,@User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Act_Money while @@Fetch_Status=0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) select @s_Syb,@BillDate,@Bill_ID,@BillSN,@BillType,@Unit_ID,@User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Act_Money if @@error<>0 goto Error_Cur Fetch next from curMoney into @BillDate,@BillSN,@BillType,@Unit_ID,@User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID,@Act_Money end Close curMoney deallocate curMoney update MoneyList set s_Syb=-2 where Bill_ID=@Bill_ID_Old and @Bill_ID_Old<>-100 and s_Syb=0 if @@error<>0 goto Error goto Success end end if (@BillType>=100 and @BillType<=121) begin select @Act_Money_List_Tot=Isnull(Sum((Money)),0), @Act_Money_List1_Tot=Isnull(Sum((Money1)),0) from ListMoney where Bill_ID=@Bill_ID and Act_ID>1 if @Bill_ID_Old not in (-100,-200,-300) update MoneyList set s_Syb=-2 where Bill_ID=@Bill_ID_Old and s_Syb=0 if @Bill_ID_Old in(-100,-200,-300) and @s_Syb=0 begin if @BillType=118 begin if @Bill_ID_Old in(-100,-200) begin Select @JSMoney=isnull(sum(Money_JS),0) from JS_Bill where QL_BillID_Gat=@Bill_ID and WL_Red=0 and QL_Red=0 and IfGZ=0 if @JSMoney<>0 Begin set @Tmp_Money=-@JSMoney insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money],[GL_JS_YUSYUF] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 57,@Tmp_Money,1) if @@error<>0 goto Error insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ,[GL_JS_YUSYUF]) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money,1) if @@error<>0 goto Error end end if @Bill_ID_Old in(-300) begin Select @JSMoney=isnull(sum(Money_JS),0) from JS_Bill where QL_BillID_Gat=@Bill_ID and WL_Red=0 and QL_Red=0 and IfGZ=1 and IfJH_XS_CD=0 if @JSMoney<>0 Begin set @Tmp_Money=@JSMoney insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money],[GL_JS_YUSYUF] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 57,@Tmp_Money,-1) if @@error<>0 goto Error insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money],[GL_JS_YUSYUF] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money,-1) if @@error<>0 goto Error end update moneylist set GL_JS_YUSYUF=-1 where Bill_ID=@Bill_ID and GL_JS_YUSYUF=1 if @@error<>0 goto Error end end if @BillType=119 begin if @Bill_ID_Old in(-100,-200) begin Select @JSMoney=isnull(sum(Money_JS),0) from JS_Bill where QL_BillID_Pay=@Bill_ID and WL_Red=0 and QL_Red=0 and IfGZ=0 if @JSMoney<>0 Begin set @Tmp_Money=-@JSMoney insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money],[GL_JS_YUSYUF] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 56,@Tmp_Money,1) if @@error<>0 goto Error insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money],[GL_JS_YUSYUF] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money,1) if @@error<>0 goto Error end end if @Bill_ID_Old in(-300) begin Select @JSMoney=isnull(sum(Money_JS),0) from JS_Bill where QL_BillID_Pay=@Bill_ID and WL_Red=0 and QL_Red=0 and IfGZ=1 and IfJH_XS_CD=0 if @JSMoney<>0 Begin set @Tmp_Money=@JSMoney insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money],[GL_JS_YUSYUF] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 56,@Tmp_Money,-1) if @@error<>0 goto Error insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money],[GL_JS_YUSYUF] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money,-1) if @@error<>0 goto Error end update moneylist set GL_JS_YUSYUF=-1 where Bill_ID=@Bill_ID and GL_JS_YUSYUF=1 if @@error<>0 goto Error end end end if @s_Syb in(0,-1,-2) and @Bill_ID_Old<>-200 and @Bill_ID_Old<>-300 begin if @BillType=100 begin if @Act_Money_List_Tot<>0 Begin if @s_Syb=0 set @Tmp_Money=@Act_Money_List_Tot+@YH_Money else set @Tmp_Money=(@Act_Money_List_Tot+@YH_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end if @YH_Money<>0 begin set @YH_Money=-@YH_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,48,@YH_Money) if @@error<>0 goto Error set @YH_Money=-@YH_Money end end if @BillType=101 begin if @Act_Money_List_Tot<>0 Begin if @s_Syb=0 set @Tmp_Money=@Act_Money_List_Tot+@YH_Money else set @Tmp_Money=(@Act_Money_List_Tot+@YH_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money) if @@error<>0 goto Error end if @YH_Money<>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,48,@YH_Money) if @@error<>0 goto Error end end if @BillType=102 begin if @Act_Money_List_Tot<>0 Begin if isnull(@Act_ID,0)=0 set @Act_ID=6 if @s_Syb=0 set @Tmp_Money=-abs(@Act_Money_List_Tot) else set @Tmp_Money=abs(@Act_Money_List_Tot) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, @Act_ID,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=103 begin if @Act_Money<>0 Begin if @s_Syb=0 set @Tmp_Money=-abs(@Act_Money) else set @Tmp_Money=abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, @Act_ID,@Tmp_Money) if @@error<>0 goto Error end if abs(@Act_Money)>abs(@Act_Money_List_Tot) Begin if @s_Syb=0 set @Tmp_Money=@Act_Money-@Act_Money_List_Tot else set @Tmp_Money=-(Abs(@Act_Money)-Abs(@Act_Money_List_Tot)) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end if abs(@Act_Money)<abs(@Act_Money_List_Tot) begin if @s_Syb=0 set @Tmp_Money=@Act_Money_List_Tot-@Act_Money else set @Tmp_Money=-(Abs(@Act_Money_List_Tot)-Abs(@Act_Money)) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=104 begin if @Act_Money<>0 Begin if @s_Syb=0 set @Tmp_Money=abs(@Act_Money) else set @Tmp_Money=-abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, @Act_ID,@Tmp_Money) if @@error<>0 goto Error end if abs(@Act_Money_List_Tot)>abs(@Act_Money) Begin if @s_Syb=0 set @Tmp_Money=@Act_Money_List_Tot-@Act_Money else set @Tmp_Money=-(Abs(@Act_Money_List_Tot)-Abs(@Act_Money)) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end if abs(@Act_Money_List_Tot)<abs(@Act_Money) begin if @s_Syb=0 set @Tmp_Money=abs(@Act_Money_List_Tot-@Act_Money) else set @Tmp_Money=-abs(@Act_Money_List_Tot-@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=105 begin if @Act_Money<>0 and @Act_Money=@Act_Money_List_Tot Begin if @s_Syb=0 set @Tmp_Money=-abs(@Act_Money) else set @Tmp_Money=abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, @Act_ID,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=106 begin if @Act_Money<>0 Begin if @s_Syb=0 set @Tmp_Money=-abs(@Act_Money) else set @Tmp_Money=abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, @Act_ID,@Tmp_Money) if @@error<>0 goto Error end if abs(@Act_Money_List_Tot)>abs(@Act_Money) Begin if @s_Syb=0 set @Tmp_Money=@Act_Money_List_Tot-@Act_Money else set @Tmp_Money=-(Abs(@Act_Money_List_Tot)-Abs(@Act_Money)) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money) if @@error<>0 goto Error end if abs(@Act_Money_List_Tot)<abs(@Act_Money) begin if @s_Syb=0 set @Tmp_Money=abs(@Act_Money_List_Tot-@Act_Money) else set @Tmp_Money=-abs(@Act_Money_List_Tot-@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=107 begin if @Act_Money_List_Tot<>0 Begin if @s_Syb=0 set @Tmp_Money=abs(@Act_Money_List_Tot) else set @Tmp_Money=-abs(@Act_Money_List_Tot) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 47,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=108 begin if @Act_Money<>0 Begin if @s_Syb=0 set @Tmp_Money=abs(@Act_Money) else set @Tmp_Money=-abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, @Act_ID,@Tmp_Money) if @@error<>0 goto Error end if abs(@Act_Money_List_Tot)>abs(@Act_Money) Begin if @s_Syb=0 set @Tmp_Money=@Act_Money_List_Tot-@Act_Money else set @Tmp_Money=-(Abs(@Act_Money_List_Tot)-Abs(@Act_Money)) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end if abs(@Act_Money_List_Tot)<abs(@Act_Money) begin if @s_Syb=0 set @Tmp_Money=abs(@Act_Money_List_Tot-@Act_Money) else set @Tmp_Money=-abs(@Act_Money_List_Tot-@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=109 begin if @Act_Money_List_Tot<>0 Begin if @s_Syb=0 set @Tmp_Money=@Act_Money_List_Tot else set @Tmp_Money=-abs(@Act_Money_List_Tot) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=110 begin if @Act_Money_List_Tot<>0 Begin if @s_Syb=0 set @Tmp_Money=-abs(@Act_Money_List_Tot) else set @Tmp_Money=abs(@Act_Money_List_Tot) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=111 begin if @Act_Money_List_Tot<>0 Begin if @s_Syb=0 set @Tmp_Money=abs(@Act_Money_List_Tot) else set @Tmp_Money=-abs(@Act_Money_List_Tot) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=112 begin if @Act_Money_List_Tot<>0 Begin if @s_Syb=0 set @Tmp_Money=-abs(@Act_Money_List_Tot) else set @Tmp_Money=abs(@Act_Money_List_Tot) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=113 begin if @Act_Money<>0 and @Act_Money=@Act_Money_List_Tot Begin if @s_Syb=0 set @Tmp_Money=abs(@Act_Money) else set @Tmp_Money=-abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, @Act_ID,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=114 begin if @Act_Money<>0 and @Act_Money=@Act_Money_List_Tot Begin if @s_Syb=0 set @Tmp_Money=-abs(@Act_Money) else set @Tmp_Money=abs(@Act_Money) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, @Act_ID,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=115 begin if @Act_Money_List_Tot<>0 Begin if @s_Syb=0 set @Tmp_Money=abs(@Act_Money_List_Tot) else set @Tmp_Money=-abs(@Act_Money_List_Tot) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 13,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=116 begin if @Act_Money_List_Tot<>0 Begin if @s_Syb=0 set @Tmp_Money=-abs(@Act_Money_List_Tot) else set @Tmp_Money=abs(@Act_Money_List_Tot) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 13,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=118 begin if @Act_Money_List_Tot<>0 Begin if @s_Syb=0 set @Tmp_Money=@Act_Money_List_Tot else set @Tmp_Money=(@Act_Money_List_Tot) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 57,@Tmp_Money) if @@error<>0 goto Error if @s_Syb<>0 begin select @OrderId=isnull(Order_ID,-1) from Masterbill where AutoID=@Bill_ID_Old if @OrderId>0 begin update MasterOrder set JSMoney=0,Act_ID=-1,Act_Money=0 where s_ID=@OrderId if @@error<>0 goto Error end end end end if @BillType=119 begin if @Act_Money_List_Tot<>0 Begin if @s_Syb=0 set @Tmp_Money=@Act_Money_List_Tot else set @Tmp_Money=(@Act_Money_List_Tot) insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 56,@Tmp_Money) if @@error<>0 goto Error if @s_Syb<>0 begin select @OrderId=isnull(Order_ID,-1) from Masterbill where AutoID=@Bill_ID_Old if @OrderId>0 begin update MasterOrder set JSMoney=0,Act_ID=-1,Act_Money=0 where s_ID=@OrderId if @@error<>0 goto Error end end end end if @BillType=120 begin select @Act_Money_List_Tot=-sum(isnull(BackMoney,0)) from ListYsyf where bill_ID=@Bill_ID if @Act_Money_List_Tot<>0 Begin set @Tmp_Money=@Act_Money_List_Tot insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 57,@Tmp_Money) if @@error<>0 goto Error end if @Act_Money<>0 Begin set @Tmp_Money=-@Act_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, @Act_ID,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=121 begin select @Act_Money_List_Tot=-sum(isnull(BackMoney,0)) from ListYsyf where bill_ID=@Bill_ID if @Act_Money_List_Tot<>0 Begin set @Tmp_Money=@Act_Money_List_Tot insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 56,@Tmp_Money) if @@error<>0 goto Error end if @Act_Money<>0 Begin set @Tmp_Money=@Act_Money insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, @Act_ID,@Tmp_Money) if @@error<>0 goto Error end end if (@BillType>=100 and @BillType<=116) or (@BillType in (118,119)) begin Declare curMoney Cursor Local Scroll for select Act_ID,Money from ListMoney where Bill_ID=@Bill_ID Open curMoney Fetch next from CurMoney into @Act_ID_List,@Act_Money_List while @@Fetch_Status=0 begin if @BillType in (100,115,107,108,119) set @Act_Money_List=-@Act_Money_List insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID_List,@Act_Money_List) if @@Error<>0 goto Error_Cur Fetch next from CurMoney into @Act_ID_List,@Act_Money_List end Close curMoney deallocate curMoney end else if @BillType=117 begin Declare curMoney Cursor Local Scroll for select substring(a.s_FullId,1,5) as Sys_FullId,isnull(b.Act_ID,0) as Act_ID,isnull(b.Unit_ID,0) as Unit_ID ,isnull(b.Money,0) as Money,isnull(b.Money1,0) as , Money1 from MoneyAccount a,ListMoney b where a.s_id=b.Act_ID and b.Bill_ID=@Bill_ID Open curMoney Fetch next from curMoney into @ActFullID_ZZ,@Act_ID_List,@Unit_ID_List,@Money_JF,@Money_DF while @@Fetch_Status=0 begin if (@ActFullID_ZZ='00001' or @ActFullID_ZZ='00004') begin if @Money_JF>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID_List, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID_List,@Money_JF) if @@error<>0 goto Error_Cur end if @Money_DF>0 begin set @Money_DF=-@Money_DF insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID_List, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID_List,@Money_DF) if @@error<>0 goto Error_Cur set @Money_DF=-@Money_DF end end if @ActFullID_ZZ='00002' or @ActFullID_ZZ='00003' begin if @Money_JF>0 begin set @Money_JF=-@Money_JF insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID_List, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID_List,@Money_JF) if @@error<>0 goto Error_Cur set @Money_JF=-@Money_JF end if @Money_DF>0 begin insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN], [BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID,@BillSN,@BillType, @Unit_ID_List, @User_ID,@Audit_ID,@Oper_ID,@Period,@Act_ID_List,@Money_DF) if @@error<>0 goto Error_Cur end end Fetch next from curMoney into @ActFullID_ZZ,@Act_ID_List,@Unit_ID_List,@Money_JF,@Money_DF end Close curMoney deallocate curMoney end else if @BillType in (120,121) begin Declare curMoney Cursor Local Scroll for Select a.ysyf_id,a.BackMoney,b.order_id from ListYsyf a inner join masterbill b on a.ysyf_ID=b.autoid where Bill_ID=@Bill_ID Open curMoney Fetch next from CurMoney into @ysyf_id ,@BackMoney,@order_id while @@Fetch_Status=0 begin select @Act_Money=isnull(sumtaxmoney,0),@JSMoney=isnull(JSMoney,0),@BackYsyfMoney=isnull(BackYsyfMoney,0) from masterbill where autoid=@ysyf_id if @BackYsyfMoney+@JSMoney+@BackMoney>@Act_Money return -907 update masterbill set BackYsyfMoney=isnull(BackYsyfMoney,0)+@BackMoney where autoid=@ysyf_id if @@Error<>0 goto Error_Cur update masterorder set BackYsyfMoney=isnull(BackYsyfMoney,0)+@BackMoney where s_ID=@order_id if @@Error<>0 goto Error_Cur Fetch next from CurMoney into @ysyf_id ,@BackMoney,@order_id end Close curMoney deallocate curMoney end end if @s_Syb <>0 and @Bill_ID_Old not in(-100,-200,-300 ) and @BillType in(103,106,104,108,118,119,120,121) begin --预收、预付被核销的单据红冲时需要更新账户,收付款单据核销的不影响账户,直接在结算存储过程里修改。此处是核销的钱流单据。 if @BillType in(103,106,104,108) and exists(select * from JS_Bill where WL_BillID=@Bill_ID_Old and WL_Red=0 and QL_Red=0 and IfGZ=1 and BillType_QL in (118,119)) begin Declare curMoney Cursor Local Scroll for Select WL_BillID,isnull(Money_JS,0) as Money_JS,BillType,QL_BillID,BillType_QL from JS_Bill where WL_BillID=@Bill_ID_Old and WL_Red=0 and QL_Red=0 and IfGZ=1 and BillType_QL in (118,119) Open curMoney Fetch next from curMoney into @TmpWLBill_ID,@JSMoney,@BillType,@TmpQLBill_ID,@BillType_QL while @@Fetch_Status=0 begin set @YU_Money_JS_List=0 if @BillType_QL=118 begin update MasterBill set JSMoney=isnull(JSMoney,0)-isnull(@JSMoney,0), WriteJSBill=isnull(WriteJSBill,0)-1 where AutoID=@TmpWLBill_ID and JSMoney<>0 if @@error<>0 goto Error_Cur if exists(select * from JS_Bill where WL_BillID=@TmpWLBill_ID and QL_BillID_Gat<>@TmpQLBill_ID and WL_Red=0 and QL_Red=0 and IfGZ=1 ) begin select @RecPayDate=min(QL_Date) from JS_Bill where WL_BillID=@TmpWLBill_ID and QL_BillID_Gat<>@TmpQLBill_ID and WL_Red=0 and QL_Red=0 and IfGZ=1 update MasterBill set FirstDate=@RecPayDate where AutoID=@TmpWLBill_ID if @@error<>0 goto Error_Cur end else begin update MasterBill set FirstDate=null where AutoID=@TmpWLBill_ID if @@error<>0 goto Error_Cur end if @JSMoney<>0 Begin select @s_Syb=s_Syb, @BillDate=BillDate, @BillSN=BillSN, @Unit_ID=isnull(Unit_ID,-1), @User_ID=Emp_ID, @Audit_ID=Audit_ID, @Oper_ID=Oper_ID, @Period=Period, @Act_ID=Act_ID, @Act_Money=case when Act_ID>1 then isnull(Act_Money,0) else 0 end, @Card_Money=isnull(Card_Money,0), @YH_Money=isnull(YH_Money,0), @PCMoney=abs(PCMoney),@PD_Money=isnull(SumTaxMoney,0) from MasterBill where AutoID=@TmpQLBill_ID set @Tmp_Money=@JSMoney insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @TmpQLBill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 57,@Tmp_Money) if @@error<>0 goto Error_Cur insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @TmpQLBill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error_Cur end update MasterBill set JSMoney=isnull(JSMoney,0)-isnull(@JSMoney,0), WriteJSBill=isnull(WriteJSBill,0)-1 where AutoID=@TmpQLBill_ID if @@error<>0 goto Error_Cur select @OrderId=isnull(Order_ID,-1) from Masterbill where AutoID=@TmpQLBill_ID if @OrderId>0 begin update MasterOrder set JSMoney=isnull(JSMoney,0)-isnull(@JSMoney,0) where s_ID=@OrderId if @@error<>0 goto Error_Cur end update JS_Bill set WL_Red=1 where WL_BillID=@Bill_ID_Old if @@error<>0 goto Error_Cur end if @BillType_QL=119 begin update MasterBill set JSMoney=isnull(JSMoney,0)-isnull(@JSMoney,0), WriteJSBill=isnull(WriteJSBill,0)-1 where AutoID=@TmpWLBill_ID and JSMoney<>0 if @@error<>0 goto Error_Cur if exists(select * from JS_Bill where WL_BillID=@TmpWLBill_ID and QL_BillID_Pay<>@TmpQLBill_ID and WL_Red=0 and QL_Red=0 and IfGZ=1) begin select @RecPayDate=min(QL_Date) from JS_Bill where WL_BillID=@TmpWLBill_ID and QL_BillID_Pay<>@TmpQLBill_ID and WL_Red=0 and QL_Red=0 and IfGZ=1 update MasterBill set FirstDate=@RecPayDate where AutoID=@TmpWLBill_ID if @@error<>0 goto Error end else begin update MasterBill set FirstDate=null where AutoID=@TmpWLBill_ID if @@error<>0 goto Error_Cur end if @JSMoney<>0 Begin select @s_Syb=s_Syb, @BillDate=BillDate, @BillSN=BillSN, @Unit_ID=isnull(Unit_ID,-1), @User_ID=Emp_ID, @Audit_ID=Audit_ID, @Oper_ID=Oper_ID, @Period=Period, @Act_ID=Act_ID, @Act_Money=case when Act_ID>1 then isnull(Act_Money,0) else 0 end, @Card_Money=isnull(Card_Money,0), @YH_Money=isnull(YH_Money,0), @PCMoney=abs(PCMoney),@PD_Money=isnull(SumTaxMoney,0) from MasterBill where AutoID=@TmpQLBill_ID set @Tmp_Money=@JSMoney insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @TmpQLBill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 56,@Tmp_Money) if @@error<>0 goto Error insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @TmpQLBill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money) if @@error<>0 goto Error end update MasterBill set JSMoney=isnull(JSMoney,0)-isnull(@JSMoney,0), WriteJSBill=isnull(WriteJSBill,0)-1 where AutoID=@TmpQLBill_ID if @@error<>0 goto Error_Cur select @OrderId=isnull(Order_ID,-1) from Masterbill where AutoID=@TmpQLBill_ID if @OrderId>0 begin update MasterOrder set JSMoney=isnull(JSMoney,0)-isnull(@JSMoney,0) where s_ID=@OrderId if @@error<>0 goto Error_Cur end update JS_Bill set WL_Red=1 where WL_BillID=@Bill_ID_Old if @@error<>0 goto Error_Cur end Fetch next from curMoney into @TmpWLBill_ID,@JSMoney,@BillType,@TmpQLBill_ID,@BillType_QL end Close curMoney deallocate curMoney end if @BillType=118 and exists(select * from JS_Bill where QL_BillID_Gat=@Bill_ID_Old and WL_Red=0 and QL_Red=0 and IfGZ=1) begin Declare curMoney Cursor Local Scroll for Select WL_BillID,isnull(Money_JS,0),BillType from JS_Bill where QL_BillID_Gat=@Bill_ID_Old and WL_Red=0 and QL_Red=0 and IfGZ=1 Open curMoney Fetch next from curMoney into @TmpWLBill_ID,@JSMoney,@BillType while @@Fetch_Status=0 begin set @YU_Money_JS_List=isnull(@YU_Money_JS_List,0)+isnull(@JSMoney,0) update MasterBill set JSMoney=isnull(JSMoney,0)-isnull(@JSMoney,0), WriteJSBill=isnull(WriteJSBill,0)-1 where AutoID=@TmpWLBill_ID and JSMoney<>0 if @@error<>0 goto Error_Cur if exists(select * from JS_Bill where WL_BillID=@TmpWLBill_ID and QL_BillID_Gat<>@Bill_ID_Old and WL_Red=0 and QL_Red=0 and IfGZ=1) begin select @RecPayDate=min(QL_Date) from JS_Bill where WL_BillID=@TmpWLBill_ID and QL_BillID_Gat<>@Bill_ID_Old and WL_Red=0 and QL_Red=0 and IfGZ=1 update MasterBill set FirstDate=@RecPayDate where AutoID=@TmpWLBill_ID if @@error<>0 goto Error_Cur end else begin update MasterBill set FirstDate=null where AutoID=@TmpWLBill_ID if @@error<>0 goto Error_Cur end Fetch next from curMoney into @TmpWLBill_ID,@JSMoney,@BillType end Close curMoney deallocate curMoney update MasterBill set JSMoney=isnull(JSMoney,0)-isnull(@YU_Money_JS_List,0), WriteJSBill=isnull(WriteJSBill,0)-1 where AutoID=@Bill_ID_Old and @s_Syb=-2 if @@error<>0 goto Error update JS_Bill set WL_Red=1, QL_Red=1 where QL_BillID_Gat=@Bill_ID_Old if @@error<>0 goto Error if @YU_Money_JS_List<>0 Begin set @Tmp_Money=@YU_Money_JS_List insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 57,@Tmp_Money) if @@error<>0 goto Error insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 11,@Tmp_Money) if @@error<>0 goto Error end end if @BillType=119 and exists(select * from JS_Bill where QL_BillID_Pay=@Bill_ID_Old and WL_Red=0 and QL_Red=0 and IfGZ=1) begin Declare curMoney Cursor Local Scroll for Select WL_BillID,isnull(Money_JS,0),BillType from JS_Bill where QL_BillID_Pay=@Bill_ID_Old and WL_Red=0 and QL_Red=0 and IfGZ=1 Open curMoney Fetch next from curMoney into @TmpWLBill_ID,@JSMoney,@BillType while @@Fetch_Status=0 begin set @YU_Money_JS_List=isnull(@YU_Money_JS_List,0)+isnull(@JSMoney,0) update MasterBill set JSMoney=isnull(JSMoney,0)-isnull(@JSMoney,0), WriteJSBill=isnull(WriteJSBill,0)-1 where AutoID=@TmpWLBill_ID and JSMoney<>0 if @@error<>0 goto Error_Cur if exists(select * from JS_Bill where WL_BillID=@TmpWLBill_ID and QL_BillID_Pay<>@Bill_ID_Old and WL_Red=0 and QL_Red=0 and IfGZ=1) begin select @RecPayDate=min(QL_Date) from JS_Bill where WL_BillID=@TmpWLBill_ID and QL_BillID_Pay<>@Bill_ID_Old and WL_Red=0 and QL_Red=0 and IfGZ=1 update MasterBill set FirstDate=@RecPayDate where AutoID=@TmpWLBill_ID if @@error<>0 goto Error end else begin update MasterBill set FirstDate=null where AutoID=@TmpWLBill_ID if @@error<>0 goto Error_Cur end Fetch next from curMoney into @TmpWLBill_ID,@JSMoney,@BillType end Close curMoney deallocate curMoney update MasterBill set JSMoney=isnull(JSMoney,0)-isnull(@YU_Money_JS_List,0), WriteJSBill=isnull(WriteJSBill,0)-1 where AutoID=@Bill_ID_Old and @s_Syb=-2 if @@error<>0 goto Error update JS_Bill set WL_Red=1, QL_Red=1 where QL_BillID_Pay=@Bill_ID_Old if @@error<>0 goto Error if @YU_Money_JS_List<>0 Begin set @Tmp_Money=@YU_Money_JS_List insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 56,@Tmp_Money) if @@error<>0 goto Error insert into MoneyList ([s_Syb], [BillDate], [Bill_ID], [BillSN],[BillType], [Unit_ID], [User_ID], [Audit_ID], [Oper_ID], [Period], [Act_ID], [Act_Money] ) values (@s_Syb, @BillDate, @Bill_ID, @BillSN,@BillType, @Unit_ID, @User_ID,@Audit_ID,@Oper_ID,@Period, 19,@Tmp_Money) if @@error<>0 goto Error end end end goto Success end Success: select @Tmp_ZC=isnull(Sum(Act_Tot),0) from MoneyAccount where s_FullID like '00001%' select @Tmp_FZ=isnull(Sum(Act_Tot),0) from MoneyAccount where s_FullID like '00002%' select @Tmp_QY=isnull(Sum(Act_Tot),0) from MoneyAccount where s_FullID like '00005%' select @Money_XS= convert(int, isnull(IfAllow,8)) from setsysteminfo where s_FullID='0000600003' -- if ROUND(@Tmp_ZC,@Money_XS, 0)= ROUND(@Tmp_FZ+@Tmp_QY,@Money_XS, 0) return 0 else return -999 return 0 Error: return -1 Error_Cur: Close curMoney deallocate curMoney return -1