还是昨天的问题,由于代码编辑器里的程序过长,光标和滑块不锁定的问题。我看了一下您发得帮助链接,仍然没弄明白怎么用函数拆分程序代码。例如:以下代码怎么拆分?谢谢指点!
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