Dim dt As DataTable = DataTables("进出库信息记录")
Dim tbl As Table = Tables("进出库信息记录")
Dim form4 As winform.form = forms("常用信息统计")
Dim d1 As Date = Form4.controls("DateTimePicker1").value
Dim d2 As Date = Form4.controls("DateTimePicker2").value
Dim lbl2 As winform.control = Form4.controls("label2")
Dim lbl4 As winform.control = Form4.controls("label4")
Dim lbl6 As winform.control = Form4.controls("label6")
Dim lbl8 As winform.control = Form4.controls("label8")
Dim lbl10 As winform.control = Form4.controls("label10")
Dim lbl12 As winform.control = Form4.controls("label12")
Dim Tatol As Decimal
Dim tatol1 As Decimal
Dim tatol2 As Decimal
Dim Tatol3 As Decimal
Dim tatol4 As Decimal
Dim tatol5 As Decimal
Dim Tatol6 As Decimal
Dim Tatol7 As Decimal
If e.Form.controls("DateTimePicker2").value Is Nothing Then
e.Form.controls("Label2").text = 0
e.Form.controls("Label4").text = 0
e.Form.controls("Label6").text = 0
e.Form.controls("Label8").text = 0
e.Form.controls("Label10").text = 0
e.Form.controls("Label12").text = 0
End If
If e.Form.controls("DateTimePicker2").value IsNot Nothing And e.Form.controls("DateTimePicker1").value Is Nothing Then
Tatol = Tables("进出库信息记录").compute("sum(吨位)","([进出库分类]= '进库' or [进出库分类]= '对过') and [日期] = '"& e.Form.controls("DateTimePicker2").Value & "'")
e.Form.controls("Label2").text = Round2(Tatol,2)
tatol1=dt.compute("sum(吨位)","([进出库分类]='进库' Or [进出库分类]='转存') And [日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'")
tatol2=dt.compute("sum(吨位)","[进出库分类]='出库'And [日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'")
tatol3 = tatol1-tatol2
e.Form.controls("Label4").text = Round2(Tatol3,2)
Tatol4 = Tables("进出库信息记录").compute("sum(车船数)","[到发方式]='火车' and [日期] = '"& e.Form.controls("DateTimePicker2").Value & "'")
e.Form.controls("Label6").text = Round2(Tatol4,2)
Tatol5 = Tables("进出库信息记录").compute("sum(过磅吨位)","[日期] = '"& e.Form.controls("DateTimePicker2").Value & "'")
e.Form.controls("Label8").text = Round2(Tatol5,2)
Tatol6 = Tables("进出库信息记录").compute("sum(车船数)","[到发方式]='船舶' and [日期] = '"& e.Form.controls("DateTimePicker2").Value & "'")
e.Form.controls("Label10").text = Round2(Tatol6,2)
Tatol7 = Tables("进出库信息记录").compute("sum(二码头对过)","[日期] = '"& e.Form.controls("DateTimePicker2").Value & "'")
e.Form.controls("Label12").text = Round2(Tatol7,2)
End If
If e.Form.controls("DateTimePicker2").value IsNot Nothing And e.Form.controls("DateTimePicker1").value IsNot Nothing Then
If e.Form.controls("ComboBox1").value Is Nothing And e.Form.controls("ComboBox2").value Is Nothing And e.Form.controls("ComboBox3").value Is Nothing Then
Tatol = Tables("进出库信息记录").compute("sum(吨位)","([进出库分类]= '进库' or [进出库分类]= '对过') and [日期] >= '"& e.Form.controls("DateTimePicker1").Value & "'and [日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'")
e.Form.controls("Label2").text = Round2(Tatol,2)
tatol1=dt.compute("sum(吨位)","([进出库分类]='进库' Or [进出库分类]='转存') And [日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'")
tatol2=dt.compute("sum(吨位)","[进出库分类]='出库'And [日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'")
tatol3 = tatol1-tatol2
e.Form.controls("Label4").text = Round2(Tatol3,2)
Tatol4 = Tables("进出库信息记录").compute("sum(车船数)","[到发方式]='火车' and [日期] >= '"& e.Form.controls("DateTimePicker1").Value & "'and [日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'")
e.Form.controls("Label6").text = Round2(Tatol4,2)
Tatol5 = Tables("进出库信息记录").compute("sum(过磅吨位)","[日期] >= '"& e.Form.controls("DateTimePicker1").Value & "'and [日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'")
e.Form.controls("Label8").text = Round2(Tatol5,2)
Tatol6 = Tables("进出库信息记录").compute("sum(车船数)","[到发方式]='船舶' and [日期] >= '"& e.Form.controls("DateTimePicker1").Value & "'and [日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'")
e.Form.controls("Label10").text = Round2(Tatol6,2)
Tatol6 = Tables("进出库信息记录").compute("sum(二码头对过)","[日期] >= '"& e.Form.controls("DateTimePicker1").Value & "'and [日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'")
e.Form.controls("Label12").text = Round2(Tatol7,2)
End If
If e.Form.controls("ComboBox1").value IsNot Nothing And e.Form.controls("ComboBox2").value Is Nothing And e.Form.controls("ComboBox3").value Is Nothing Then
Tatol = Tables("进出库信息记录").compute("sum(吨位)","([进出库分类]= '进库' or [进出库分类]= '对过') and ([日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'and [日期] >= '"& e.Form.controls("DateTimePicker2").Value & "')")
e.Form.controls("Label2").text = Round2(Tatol,2)
tatol1=dt.compute("sum(吨位)","([进出库分类]='进库' Or [进出库分类]='转存') And [日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'")
tatol2=dt.compute("sum(吨位)","[进出库分类]='出库'And [日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'")
tatol3 = tatol1-tatol2
e.Form.controls("Label4").text = Round2(Tatol3,2)
Tatol4 = Tables("进出库信息记录").compute("sum(车船数)","[到发方式]='火车' and ([日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'and [日期] >= '"& e.Form.controls("DateTimePicker2").Value & "')")
e.Form.controls("Label6").text = Round2(Tatol4,2)
Tatol5 = Tables("进出库信息记录").compute("sum(过磅吨位)","[日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'and [日期] >= '"& e.Form.controls("DateTimePicker2").Value & "'")
e.Form.controls("Label8").text = Round2(Tatol5,2)
Tatol6 = Tables("进出库信息记录").compute("sum(车船数)","[到发方式]='船舶' and ([日期] <= '"& e.Form.controls("DateTimePicker2").Value & "'and [日期] >= '"& e.Form.controls("DateTimePicker2").Value & "')")
e.Form.controls("Label10").text = Round2(Tatol6,2)
Tatol6 = Tables("进出库信息记录").compute("sum(二码头对过)","[日期] = '"& e.Form.controls("DateTimePicker2").Value & "'")
e.Form.controls("Label12").text = Round2(Tatol7,2)
End If