cmd.com ma ndtext = "se l ect * fr om 销售订单明细表 wh ere 销售订单编号 = '" & trm("销售订单编号") & "'"
'打印设置
With Sheet.PrintSetting
'.PaperKind = 9 '设为A4纸
'.LandScape = True '横向打印
.MarginLeft = 10 '左右边距设为20毫米
.MarginRight = 10
.MarginTop = 15 '上下边距设为15毫米
.MarginBottom = 15
End With
'msgbox(2)
Sheet(2,0).Value = "<" & tbM.name & ",1>" '主表数据开始标记
Sheet(2,1).Value = "销售发货单" '表单标题
Sheet(3,1).Value = "订单编号:" & trM("销售订单编号")
Sheet(4,1).Value = "客户编号:" & trM("客户编号")
Sheet(5,1).Value = "客户名称:" & trM("客户名称")
Sheet(3,13).Value = "创建时间:" & trM("创建时间")
Sheet(4,13).Value = "创建人:" & functions.execute("SYS_其它_纯值换其它字段",trM("创建人"),"用户名表","工号","用户名称","",0)
Sheet(3,25).Value = "发货日期:" & trM("发货日期")
Sheet(4,25).Value = "所在区域:" & functions.execute("SYS_字典值换取字典名称",trM("所在区域"),"所在区域:")
If trm.isnull("是否调拨") OrElse trm("是否调拨") = 0 Then
Sheet(5,25).Value = "是否调拨:" & "否"
Else
Sheet(5,25).Value = "是否调拨:" & "是"
End If
Sheet(7,0).Value = "<headerrow>" '明细区域表头
Sheet(7,1).Value = "序"
Sheet(7,3).Value = "物料编号"
Sheet(7,7).Value = "物料名称"
Sheet(7,15).Value = "单位"
Sheet(7,17).Value = "需求量"
Sheet(7,20).Value = "计划量"
Sheet(7,23).Value = "实发量"
Sheet(7,26).Value = "实收量"
Sheet(8,0).Value = "<子表>" '明细区域数据
Sheet(8,1).Value = "[序]"
Sheet(8,3).Value = "[物料编号]"
Sheet(8,7).Value = "[物料名称]"
Sheet(8,15).Value = "[单位]"
Sheet(8,17).Value = "[需求量]"
Sheet(8,20).Value = "[计划量]"
Sheet(8,23).Value = "[实发量]"
Sheet(8,26).Value = "[实收量]"
Sheet(9,15).Value = "合计:"
Sheet(9,17).Value = format(n1,"f")
Sheet(9,20).Value = format(n2,"f")
Sheet(9,23).Value = format(n3,"f")
Sheet(9,26).Value = format(n4,"f")
Sheet(11,0).Value = "<" & tbM.name & ">" '主表数据开始标记
Sheet(11,1).Value = "送货人:"
Sheet(11,13).Value = "品控部:"
Sheet(11,25).Value = "收货人:"
'设置页头页脚
Sheet.PrintSetting.Header = "&L单据名称:" & "销售发货单" & "&C单据编号:" & trM("销售订单编号") & " &R客户名称:" & trM("客户名称")
Sheet.PrintSetting.Footer = "&L打印时间:" & Date.now & " &C打印人:" & _UserName1 & " &R第&P页,总&N页"
Book.Build() '生成细节区
Sheet = Book.Sheets(0)
Dim k As Integer = 7 + i
Sheet.MergeCell(2,0,1,36)
'进行合并
For j As Integer = 7 To k
Sheet.MergeCell(j,0,1,2)
Sheet.MergeCell(j,2,1,4)
Sheet.MergeCell(j,6,1,8)
Sheet.MergeCell(j,14,1,2)
Sheet.MergeCell(j,16,1,3)
Sheet.MergeCell(j,19,1,3)
Sheet.MergeCell(j,22,1,3)
Sheet.MergeCell(j,25,1,3)
Next
For r As Integer = 7 To k
For c As Integer =0 To 27
Sheet(r,c).Style = Style1
Next
Next
Next
Book.Save(fl) '保存工作簿
If Relations.Contains("单据报表") Then
Relations.Delete("单据报表")
End If
Forms("正在更新提示").close
SystemReady = True
tbM.Refresh
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Start()