Dim cj As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim dm As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim hm As WinForm.ComboBox = e.Form.Controls("ComboBox3")
Dim kpn As WinForm.ComboBox = e.Form.Controls("ComboBox4")
Dim kpy As WinForm.ComboBox = e.Form.Controls("ComboBox5")
Dim r As Row = Tables("开piao主表").Current
Dim Book As New XLS.Book(ProjectPath & "Attachments\开piao汇总清单.xls") '打开模板
Dim fl As String = ""
If cj.text > "" Then
If kpn.text > "" Then
If kpy.text > "" Then
fl ="d:/开piao信息/"+ (r("年")) +"年" + (r("月")) +"月" +(r("客户名称"))+"开piao汇总清单.xls"
Else
fl ="d:/开piao信息/"+ (r("年")) +"年" +(r("客户名称"))+"开piao汇总清单.xls"
End If
Else
If kpy.text > "" Then
fl ="d:/开piao信息/"+ (r("月")) +"月" +(r("客户名称"))+"开piao汇总清单.xls"
Else
fl ="d:/开piao信息/"+ (r("客户名称"))+"开piao汇总清单.xls"
End If
End If
Else
If kpn.text > "" Then
If kpy.text > "" Then
fl ="d:/开piao信息/"+ (r("年")) +"年" + (r("月")) +"月 开piao汇总清单.xls"
Else
fl ="d:/开piao信息/"+ (r("年")) + "年 开piao汇总""> "
End If
Else
If kpy.text > "" Then
fl ="d:/开piao信息/"+ (r("月")) +"月 开piao汇总清单.xls"
Else
fl ="d:/开piao信息/" + "开piao汇总清单.xls"
End If
End If
End If
If FileSys.FileExists("fl") Then '如果指定的文件存在
FileSys.DeleteFile("fl",2,2) '则彻底删除之
End If
Dim Sheet As XLS.Sheet = Book.Sheets(0)
If cj.text > "" Then
If kpn.text > "" Then
If kpy.text > "" Then
Sheet(1,1).Value = "<[@企业信息,企业名称,0] & [@开piao主表,年,0] & ""年"" & [@开piao主表,月,0] & ""月"" & [@开piao主表,客户名称,0] & ""开piao汇总""> "
Else
Sheet(1,1).Value = "<[@企业信息,企业名称,0] & [@开piao主表,年,0] & ""年"" & [@开piao主表,客户名称,0] & ""开piao汇总""> "
End If
Else
If kpy.text > "" Then
Sheet(1,1).Value = "<[@企业信息,企业名称,0] & [@开piao主表,月,0] & ""月"" & [@开piao主表,客户名称,0] & ""开piao汇总""> "
Else
Sheet(1,1).Value = "<[@企业信息,企业名称,0] & "" "" & [@开piao主表,客户名称,0] & ""开piao汇总""> "
End If
End If
Else
If kpn.text > "" Then
If kpy.text > "" Then
Sheet(1,1).Value = "<[@企业信息,企业名称,0] & [@开piao主表,年,0] & ""年"" & [@开piao主表,月,0] & ""月 开piao汇总""> "
Else
Sheet(1,1).Value = "<[@企业信息,企业名称,0] & [@开piao主表,年,0] & ""年 开piao汇总""> "
End If
Else
If kpy.text > "" Then
Sheet(1,1).Value = "<[@企业信息,企业名称,0] & [@开piao主表,月,0] & ""月 开piao汇总""> "
Else
Sheet(1,1).Value = "<[@企业信息,企业名称,0] & ""开piao汇总""> "
End If
End If
End If
Book.Build() '生成报表
Book.Save(fl)
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
App.Visible = True
Ws.PrintPreview
App.Quit