Foxtable(狐表)用户栏目专家坐堂 → 用函数拆分程序代码


  共有2935人关注过本帖树形打印复制链接

主题:用函数拆分程序代码

美女呀,离线,留言给我吧!
朱女士
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:453 积分:3683 威望:0 精华:0 注册:2020/2/8 11:14:00
用函数拆分程序代码  发帖心情 Post By:2022/3/1 11:19:00 [显示全部帖子]

老师您好!
     还是昨天的问题,由于代码编辑器里的程序过长,光标和滑块不锁定的问题。我看了一下您发得帮助链接,仍然没弄明白怎么用函数拆分程序代码。例如:以下代码怎么拆分?谢谢指点!
 If xm="4121车间人员工资"
                wr("合计")=round2(tcjgz,2)
                mtgh1=DataTables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt5 & "# and [发货日期]<= #" & dt6 & "# and [客户]='" & nm & "'And substring([ddlb],1,1)='c'" & " and 发货日期 Is not null")  '分月层压木产量
                mtgh2=DataTables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt5 & "# and [发货日期]<= #" & dt6 & "# and [客户]='" & nm & "'And substring([ddlb],1,1)='z'" & " and 发货日期 Is not null")  '分月纸板产量
                mtgh=mtgh1+mtgh2
                mtzb1=mtgh1/mtgh
                mtzb2=mtgh2/mtgh
                
                mtcjgz0=DataTables("fyb").Compute("Sum(金额)","[日期]>= #" & dt5 & "# and [日期]<= #" & dt6 & "# and [二级代码]='a010'")   '车间工资
                mtcjgz1=mtcjgz0*mtzb1
                mtcjgz2=mtcjgz0*mtzb2
                mtcjgz=mtcjgz1+mtcjgz2
                wr(zd1)=round2(mtcjgz,2)
                
            End If
            If xm="4122车间人员社保"
                wr("合计")=round2(tsba,2)
                mtgh1=DataTables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt5 & "# and [发货日期]<= #" & dt6 & "# and [客户]='" & nm & "'And substring([ddlb],1,1)='c'" & " and 发货日期 Is not null")  '分月层压木产量
                mtgh2=DataTables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt5 & "# and [发货日期]<= #" & dt6 & "# and [客户]='" & nm & "'And substring([ddlb],1,1)='z'" & " and 发货日期 Is not null")  '分月纸板产量
                mtgh=mtgh1+mtgh2
                mtzb1=mtgh1/mtgh
                mtzb2=mtgh2/mtgh
                mtsba90=DataTables("fyb").Compute("Sum(金额)","[日期]>= #" & dt5 & "# and [日期]<= #" & dt6 & "# and [二级代码]='a090'")   '社保
                mtsba91=DataTables("fyb").Compute("Sum(金额)","[日期]>= #" & dt5 & "# and [日期]<= #" & dt6 & "# and [二级代码]='a091'")   '社保
                
                mtsba0=mtsba90+mtsba91  '社保
                mtsba1=mtsba0*mtzb1
                mtsba2=mtsba0*mtzb2
                mtsba=mtsba1+mtsba2
                wr(zd1)=round2(mtsba,2)
            End If
            If xm="4123固定资产折旧"
                wr("合计")=round2(tzj,2)
                mtgh1=DataTables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt5 & "# and [发货日期]<= #" & dt6 & "# and [客户]='" & nm & "'And substring([ddlb],1,1)='c'" & " and 发货日期 Is not null")  '分月层压木产量
                mtgh2=DataTables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt5 & "# and [发货日期]<= #" & dt6 & "# and [客户]='" & nm & "'And substring([ddlb],1,1)='z'" & " and 发货日期 Is not null")  '分月纸板产量
                mtgh=mtgh1+mtgh2
                mtzb1=mtgh1/mtgh
                mtzb2=mtgh2/mtgh
                
                mtzj0=DataTables("fyb").Compute("Sum(金额)","[日期]>= #" & dt5 & "# and [日期]<= #" & dt6 & "# and [二级代码]='a110'")   '折旧
                mtzj1=mtzj0*mtzb1
                mtzj2=mtzj0*mtzb2
                mtzj=mtzj1+mtzj2
                wr(zd1)=round2(mtzj,2)
            End If
            If xm="4124设备维修维护"
                wr("合计")=round2(twhf,2)
                mtwhf0=DataTables("fyb").Compute("Sum(金额)","[日期]>= #" & dt5 & "# and [日期]<= #" & dt6 & "# and [二级代码]='a050'")   '设备维护费
                mtgh1=DataTables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt5 & "# and [发货日期]<= #" & dt6 & "# and [客户]='" & nm & "'And substring([ddlb],1,1)='c'" & " and 发货日期 Is not null")  '分月层压木产量
                mtgh2=DataTables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt5 & "# and [发货日期]<= #" & dt6 & "# and [客户]='" & nm & "'And substring([ddlb],1,1)='z'" & " and 发货日期 Is not null")  '分月纸板产量
                mtgh=mtgh1+mtgh2
                mtzb1=mtgh1/mtgh
                mtzb2=mtgh2/mtgh
                mtwhf1=mtwhf0*mtzb1
                mtwhf2=mtwhf0*mtzb2
                mtwhf=mtwhf1+mtwhf2
                wr(zd1)=round2(mtwhf,2)
            End If
            If xm="4125税金"
                wr("合计")=round2(tsj,2)
                mtgh1=DataTables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt5 & "# and [发货日期]<= #" & dt6 & "# and [客户]='" & nm & "'And substring([ddlb],1,1)='c'" & " and 发货日期 Is not null")  '分月层压木产量
                mtgh2=DataTables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt5 & "# and [发货日期]<= #" & dt6 & "# and [客户]='" & nm & "'And substring([ddlb],1,1)='z'" & " and 发货日期 Is not null")  '分月纸板产量
                mtgh=mtgh1+mtgh2
                mtzb1=mtgh1/mtgh
                mtzb2=mtgh2/mtgh
                mtsj0=DataTables("fyb").Compute("Sum(金额)","[日期]>= #" & dt5 & "# and [日期]<= #" & dt6 & "# and [二级代码]='a100'")   '税金
                mtsj1=mtsj0*mtzb1
                mtsj2=mtsj0*mtzb2
                mtsj=mtsj1+mtsj2
                wr(zd1)=round2(mtsj,2)
            End If
            If xm="4126易耗工具及材料"
                wr("合计")=round2(tyhf,2)
                mtgh1=DataTables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt5 & "# and [发货日期]<= #" & dt6 & "# and [客户]='" & nm & "'And substring([ddlb],1,1)='c'" & " and 发货日期 Is not null")  '分月层压木产量
                mtgh2=DataTables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt5 & "# and [发货日期]<= #" & dt6 & "# and [客户]='" & nm & "'And substring([ddlb],1,1)='z'" & " and 发货日期 Is not null")  '分月纸板产量
                mtgh=mtgh1+mtgh2
                mtzb1=mtgh1/mtgh
                mtzb2=mtgh2/mtgh
                
                mtyhf0=DataTables("fyb").Compute("Sum(金额)","[日期]>= #" & dt5 & "# and [日期]<= #" & dt6 & "# and [二级代码]='a030'")  '易耗材料工具
                mtyhf1=mtyhf0*mtzb1
                mtyhf2=mtyhf0*mtzb2
                mtyhf=mtyhf1+mtyhf2
                wr(zd1)=round2(mtyhf,2)
                
            End If


 回到顶部
美女呀,离线,留言给我吧!
朱女士
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:453 积分:3683 威望:0 精华:0 注册:2020/2/8 11:14:00
  发帖心情 Post By:2022/3/1 12:11:00 [显示全部帖子]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:程序.txt


 回到顶部