WIN7旗舰版,T1商贸宝12.0,SQL 2008 R2,原来一直正常,今天突然总是提示“演示版到期”,加密狗拔下来重新插上,设备管理里面没有未安装的驱动,加密狗驱动程序也重新安装了,该从哪里查找原因?
2017-5-12 0:0:0 wondialWIN7旗舰版,T1商贸宝12.0,SQL 2008 R2,原来一直正常,今天突然总是提示“演示版到期”,加密狗拔下来重新插上,设备管理里面没有未安装的驱动,加密狗驱动程序也重新安装了,该从哪里查找原因?
WIN7旗舰版,T1商贸宝12.0,SQL 2008 R2,原来一直正常,今天突然总是提示“演示版到期”,加密狗拔下来重新插上,设备管理里面没有未安装的驱动,加密狗驱动程序也重新安装了,该从哪里查找原因?[]您好,控制面板,管理工具,服务中将T1-批发零售版服务右键启动或重启动之后再登录进去谢谢!重新启动了一下电脑,现在正常了。@风雨ABn:好的,不客气的,祝您工作愉快![/微笑]
如果您的问题还没有解决,可以到 T+搜索>>上找一下
相关阅读
- 进入固定资产提示未启用模块2021-6-17 8:44:25
- T6新年度期初对账操作图文教程2021-1-10 13:59:13
- T6如何跨账套测算销售收入图文教程2021-1-10 13:49:42
- T6银行对账期初录入图文教程2021-1-9 14:8:28
- T6收发类别设置图文教程2021-1-9 14:6:17
- T6如何设置指定科目图文教程2020-12-25 17:2:11
- T6如何设置外币核算图文教程2020-12-25 16:59:32
- T6如何查询客户往来账龄分析图文教程2020-12-25 16:8:50
- T6如何整理断号图文教程2020-12-23 15:30:56
- T6如何修改期初余额图文教程2020-12-23 15:23:59
最新信息
![固定资产卡片新增加项目在,升级sql数据库报错!](https://www.kuaiji66.com/t6/zb_users/plugin/MiniTu/noimg.png)
固定资产卡片新增加项目在,升级sql数据库报错!原因分析:问题解答:原因分析数据库表fa_items中存在sid为309的纪录,进行升级sql数据库,需要对该表重新插入一条记录为309得卡片项目!此时报违反约束错误,导致升级不成功!首先,对新装的T3软件打上最新的补丁!之后恢复数据,在升级sql数据库。此时数据能够升级成功。然后对该帐套执行脚本即可解决问题!
![U8.52网络连接失败](https://www.kuaiji66.com/t6/zb_users/plugin/MiniTu/noimg.png)
U8.52网络连接失败U8.52网络连接失败
U8.52-网络连接失败
自动编号: | 11926 | 产品版本: | U8.52 |
产品模块: | 其他 | 所属行业: | 通用 |
适用产品: | U852 | 关 键 字: | 网络连接失败 |
问题名称: | 网络连接失败 | ||
问题现象: | 网络连接失败 | ||
原因分析: | 显示器分辨率问题 | ||
解决方案: | 安装显卡驱动 温馨提示:如果您的问题还没有解决,欢迎进入用友云基地。 |
![工业企业存货清查的核算](https://www.kuaiji66.com/t6/zb_users/plugin/MiniTu/noimg.png)
工业企业存货清查的核算 工业企业存货清查的核算
存货清查是通过对存货进行实物清点并与各存货明细账上所记录的结存数进行核对,确定各项存货的实存数与账存数是否相符的一种专门方法。
由于存货流动性较大,企业应在年末对存货进行全面的清查,在年度中间,还要区别不同情况对存货进行定期或不定期的清查或重点的抽查。
在对存货清查前,应将各存货明细账登记齐全,账证核对相符,账账核对相符,在此基础上通过点数、过磅、量尺、计方等方法确定各种存货的实存数量,进行账实核对。发现账实不符或有超储积压、残损变质的存货,要进一步找出原因,分清责任。对于存货清查的结果,应编制“存货盘点报告表”,将账实不符的存货记入表内,列出盘盈或盘亏的数量,并注明盘盈盘亏的原因,报企业领导和有关部门审批。
![工业企业的制造成本会计核算](https://www.kuaiji66.com/t6/zb_users/plugin/MiniTu/noimg.png)
工业企业的制造成本会计核算 工业企业的制造成本会计核算
工业企业生产经营活动分为供应、生产、销售三大环节,其中生产环节为组织产品生产所发生的直接材料、直接人工和制造费用,按产品对象形成产品生产成本,即为制造成本。产品制造成本核算的准确与否,直接影响到产品销售成本结转的正确性,进而影响当期的利润和应所得额。因此,对制造成本的审查应作为纳税审查的重点。
制造成本通过“生产成本”、“制造费用”科目进行核算。“生产成本”科目核算企业进行工业性生产所发生的各项生产费用,包括生产各种产成品、自制半成品、自制材料、自制工具以及自制设备等所发生的各项费用;该科目设置“基本生产成本”和“辅助生产成本”两个二级科目。“基本生产成本”二级科目核算企业为完成主要生产目的而进行的产品生产发生的费用,用于计算基本生产的产品成本;“辅助生产成本”二级科目核算企业为基本生产及其他服务而进行的产品生产和劳务供应发生的费用,用于计算辅助生产产品和劳务成本。该科目按成本核算对象设明细账,明细账用多栏式账页按成本项目设专栏进行明细核算。
- 单核算模快,采购入库单的可用量和收发存汇总表的现存量对不上,整理过了
- T3升级到G6产品,2016年正常使用,2015年以前年度报错“此帐套行业性质与科目设置中的科目分类不符,请调整”,点确定后提示没有设置数据库连接
- 现在代理商的技术支持网怎么登陆不了呢,我需要提交数据问题
- T3标准版,卸载后,删除哪几个注册表,在什么地方-
- 如何删除T3系统固定资产模块结转的凭证?
- 你好,我买的T3用友软件按照安装说明装完以后,启动T3图标没有显示初始化以后没有账套信息和会计年度,无法登录,请问这要怎么处理?
- 咨询一下老师,畅捷通T3数据库中没有账套和UFsystenm数据库,为什么T3中账套能登进去呢
- 用友T6应收款管理操作流程
- 销售统计表和发货统计表数据不一致
- 存货单据生成凭证出错
![代征税款手续费收入是否纳税?](https://www.kuaiji66.com/t6/zb_users/plugin/MiniTu/noimg.png)
代征税款手续费收入是否纳税? 代征税款手续费收入是否纳税?
问:对税务机关支付给扣缴义务人或委托代征单位代扣代缴、代收代缴、委托代征税款的手续费收入是否应当纳税?
答:根据《财政部 国家税务总局关于个人所得税若干政策问题的通知》(财税字「1994」第020号)第二条规定:个人办理代扣代缴税款手续,按规定取得的扣缴手续费暂免征收个人所得税。
根据《营业税暂行条例》规定:单位或个人有偿提供营业税条例中规定的应税劳务应按规定缴纳营业税。扣缴、委托代征单位提供的劳务是属营业税应税劳务中的“服务业-代理业”项目;在企业所得税上,根据《企业所得税暂行条例》第五条第七项规定:“纳税人的收入总额包括:(一)生产、经营收入;(二)财产转让收入;(三)利息收入;(四)租赁收入;(五)特许权使用费收入;(六)股息收入;(七)其他收入。”。而何为“其他收入”?根据《企业所得税暂行条例实施细则》第七条的解释:“条例第五条(七)项所称其他收入,是指除上述各项收入之外的一切收入,包括固定资产盘盈收入,罚款收入,因债权人缘故确实无法支付的应付款项,物资及现金的溢余收入,教育费附加返还款,包装物押金收入以及其他收入。”从该规定中可以看出,企业所得税的应税收入应当包括除列举的收入之外的“一切收入”。当然,对国务院、财政部和国家税务总局另有规定的除外。
- 凭证打印时别的都能正常打印,由固定资产生成的凭证打印时提示打印机缺纸,错误号1001
- 销售出库单 记账失败 提示 单据号“00000001” 记账失败
- 提示此帐套行业性质与科目设置中的科目分类不符这么怎么办
- 11.5客户端登录一直这样,服务器可以打开,地址可以ping通,端口也可以
- t3安装到最后一直不提示重新启动,强制重启后,服务里没有T3,这是怎么回事啊-电脑装的是WIN7 32位的
- T3 10.8.2 反记账按CTRL+H没 反应 反结账可以
- T3普及版10.8puls1 民间非盈利组织 选择10月现金流量,现金流量表的累计算到11月份。这是怎么回事,11月份算过了,但是往回查选择10月份,不会算到10月份,算到11月份。
- 如果我13年12月份的资产负债表 和利润表对不上 怎么修改 需要反年结吗 还是正常登录13年 反结12月份的账
- 如果电脑上有FN键怎么反结账和反记账
- 就是下载的是买书时财政局附送的光盘下载的畅捷通软件t3。期初余额是不能修改吗?
![请问公司收到个人的货款,银行回单已有。请问会计分录是:借:银行存款 贷:应收账款——王某某 还是:借:银行存款 贷:其他应收款——王某某](https://www.kuaiji66.com/t6/zb_users/plugin/MiniTu/noimg.png)
请问公司收到个人的货款,银行回单已有。请问会计分录是:借:银行存款 贷:应收账款——王某某 还是:借:银行存款 贷:其他应收款——王某某 请问公司收到个人的货款,银行回单已有。请问会计分录是:借:银行存款 贷:应收账款——王某某 还是:借:银行存款 贷:其他应收款——王某某[]
一般情况下是使用 其他应收款。个人一般走其他应收款,但最好用二级分清楚,内部的个人应收和外部的个人应收
![U8.61852升级到861后出现此现象后,采购入库单的税率丢失](https://www.kuaiji66.com/t6/zb_users/plugin/MiniTu/noimg.png)
U8.61852升级到861后出现此现象后,采购入库单的税率丢失U8.61852升级到861后出现此现象后,采购入库单的税率丢失
U8.61-852升级到861后出现此现象后,采购入库单的税率丢失
自动编号: | 13518 | 产品版本: | U8.61 |
产品模块: | 报账中心 | 所属行业: | 通用 |
适用产品: | U861--财务会计--库存管理 | 关 键 字: | 税率 |
问题名称: | 852升级到861后出现此现象后,采购入库单的税率丢失 | ||
问题现象: | 852升级到861后出现此现象后,采购入库单的税率丢失 | ||
原因分析: | 原因:852升级到861后出现此现象后,采购入库单的税率丢失 | ||
解决方案: | 下边两个脚本,第一个用于更新数据,使入库单的税率及税额等根据存货的税率进行调整。对于已经结算部分,我查了一下,客户的结算额都等于本币金额,所以不用做修改。第二个脚本用于查找剩余的税率为零的入库单,这一部分是因为存货的入库单为零或为空。 --更新数据 update rdrecords set itaxrate=b.iTaxRate,itaxprice=iprice*b.iTaxRate*0.01,ioritaxprice=itaxprice, isum=iprice+itaxprice,ioritaxcos 温馨提示:如果您的问题还没有解决,欢迎进入用友云基地。 |
- 客户重装操作系统后自行安装T3普,但将“UFSMART”改为“T3普及版”,软件出错,为其卸载,在控制面板--程序里、开始菜单用友自己的卸载、360等其他第三方工具都卸载不了。现在停止数据库后,直接删除了安装目录,但点击安装后还是提示删除T3,但又删除不掉
- 用友T1商贸宝批发零售版
- 用友T6企业管理软件
- 用友软件U8
- 用友T3标准版
- 什么是ROP?U8+的ROP是如何实现的?
- T3普及版10.8plus2什么时候出最新的补丁,把总账里的恢复记账前状态显示出来,很多人都反映总账~期末~对账~Ctrl+h恢复记账前状态被激活特别不方便!
- VersionCo_1=8.21908_用友通10.1 这对应是哪个版本 从那里可以 下载 学校应用的T3的哪个考试版本
- 客户2015年初的本年利润贷方有余额,导致资产负债表中的未分配利润和利润变对应不上,该如何操作修改呢?
- 已把上年数据结转为本期的期初余额,已经做了部分业务 。现在发现上年度有个分录漏记了需要补录。。。应该怎么操作
![什么是《入境旅客行李物品和个人邮递物品进口税税率表》](https://www.kuaiji66.com/t6/zb_users/plugin/MiniTu/noimg.png)
什么是《入境旅客行李物品和个人邮递物品进口税税率表》 什么是《入境旅客行李物品和个人邮递物品进口税税率表》
《入境旅客行李物品和个人邮递物品进口税税率表》是由国务院关税税则委员会制定的,对准许应税进口的旅客行李物品、个人邮递物品以及其他个人自用物品所适用税率的一种表。它是《关于入境旅客行李物品和个人邮递物品征收进口税办法》的组成部分,其税率调整须经国务院关税税则委员会审定,由海关总署对外公布实施。目前这一税率表共设有四档税率,即10%(如书、报和金、银制品等)、30%(如纺织品、电器等)、80%(化妆品、摄象机)和100%(烟、酒)。
![什么是清算审计](https://www.kuaiji66.com/t6/zb_users/plugin/MiniTu/noimg.png)
什么是清算审计 什么是清算审计
清算
清算审计是对由于各种原因终止的企业清算期间的债权债务清偿情况、资产变现情况,清算期间的收益和损失、费用支出情况及清算截止日净资产分配情况进行的审计,以确认清算企业是否合法、公开、公正进行全部清算活动,对清算结果发表合法、公允的审计意见。
清算审计通常包括破产清算审计、合同约定终止清算审计等。主管部门在对企业进行税务清缴,出具完税证明前,工商部门在对企业进行注销登记前都需要该审计报告。
![用友T6软件零售单过账提示数据不正确资产负债表不平](https://www.kuaiji66.com/t6/zb_users/plugin/MiniTu/noimg.png)
用友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
运维服务
更多热点文章
培训教程
用友软件怎么设置合并打印分录
用友软件怎么设置合并打印分录
在打印凭证界面设置合并打印分录
标题:在打印凭证界面设置合并打印分录问题现象:打印凭证时需要合并打印分录,但是打印凭证界面没有“合并打印分录”选项,如何设置?
原因分析:见问题答案问题答案:点击“总账”--“设置”--“选项”,勾选“合并凭证显示、打印”,再进入凭证打印界面可以看到“合并打印分录”选项,勾选即可。
用友软件如何删除T3 、T6 年度账
用友软件如何删除T3 、T6 年度账用友如何删除T3 、T6 年度账?
当删除年度账不成功时,可以用如下方法
用友热销产品
使用技巧
进入固定资产提示未启用模块
进入固定资产提示未启用模块
原因分析:此问题是由于数据库中UA_Account_sub这张表中有些字段对应的值不正确造成的
问题解答:需要在企业管理器中打开ufsystem中的UA_Account_sub这张表,如果问题帐套的帐套号是005,那么找到cAcc_id=005,iYear=9999,cSub_id=FA这一行,把这一行对应的dSubSysUsed字段改成2005-01-01,然后退出,再到软件中点击固定资产就没问题了。按照上述方法可以解决,请在执行操作前备份好帐套。
T3标准版如何设置自动备份
T3标准版如何设置自动备份
1.软件提供手工备份和自动备份两种方式,自动备份可以按照用户设定的要求,在规定的时间点自动备份账套数据。
2.要实现自动备份需要自行设定备份计划,点这里为您呈现自动备份计划设置步骤哦!
- 最新文章排行
- 热门文章排行
知识库
用友T6软件如何计提折旧?
用友t6软件如何计提折旧?
如何计提折旧?
如何计提折旧?
原因分析:见问题答案。问题解答:点击“固定资产”-“处理”-“计提本月折旧”,屏幕出现提醒对话框,点击‘是’按钮,再点击‘是’,屏幕出现计提折旧过程界面,直至折旧计提完毕。
用友T6软件出现零出库