If e.Form.Controls("CheckBox1").Checked = False AndAlso e.Form.Controls("CheckBox2").Checked = False Then
MessageBox.Show("Please Choose Whether To Convert To An Order!", "Error")
Return
End If
If Tables("报价单").Current.DataRow.RowState = DataRowState.Added AndAlso Tables("报价单").Current IsNot Nothing Then
If Tables("报价明细表").Current Is Nothing Then
MessageBox.Show("No details cannot be saved 无订单明细,无法保存!", "Error 错误提示")
Tables("报价单").Current.Delete
Else
Tables("报价单").Current("客户名称") = e.Form.Controls("DropBox4").Text
Tables("报价单").Current("客户电话") = e.Form.Controls("DropBox2").Text
Tables("报价单").Current("折扣") = e.Form.Controls("TextBox3").Text
Tables("报价单").Current("备注") = Tables("报价单").Current("备注") & e.Form.Controls("TextBox4").Text
'Tables("报价单").Current("已付款") = e.Form.Controls("TextBox9").Text
If Tables("报价单").Current IsNot Nothing Then
Tables("报价单").Current.Save
Tables("报价单").AllowEdit = False
End If
Tables("报价明细表").Save
End If
End If
Dim khmc As WinForm.DropDownBox = e.Form.Controls("DropBox4")
Dim khdh As WinForm.DropDownBox = e.Form.Controls("DropBox2")
If e.Form.Controls("DropBox4").value IsNot Nothing Or e.Form.Controls("DropBox2").value IsNot Nothing Then
'添加客户信息
Dim tbl As Table = Tables("客户信息表")
Dim drn As DataRow = DataTables("客户信息表").SQLFind("客户名称 = '" & khmc.Text & "'")
Dim drp As DataRow = DataTables("客户信息表").SQLFind("客户电话 = '" & khdh.Text & "'")
If drn Is Nothing AndAlso drp Is Nothing Then
Dim n As Row = tbl.AddNew()
n("客户名称") = e.Form.Controls("DropBox4").Text
n("客户电话") = e.Form.Controls("DropBox2").Text
tbl.Current.Save()
Else If drn Is Nothing AndAlso drp IsNot Nothing Then
tbl.current("客户名称") = e.Form.Controls("DropBox4").Text
tbl.Current.Save()
Else If drn IsNot Nothing AndAlso drp Is Nothing Then
Dim n2 As Row = tbl.AddNew()
n2("客户名称") = e.Form.Controls("DropBox4").Text
n2("客户电话") = e.Form.Controls("DropBox2").Text
tbl.Current.Save()
End If
End If
Dim zk As WinForm.TextBox = e.Form.Controls("textbox3")
Dim cpxh As WinForm.DropDownBox = e.Form.Controls("DropBox1")
Dim sl As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox2")
Dim dj As WinForm.TextBox = e.Form.Controls("textbox5")
Dim sfje As WinForm.TextBox = e.Form.Controls("textbox9")
Dim ytsl As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox1")
Dim bz As WinForm.TextBox = e.Form.Controls("textbox4")
Dim zffs As WinForm.ComboBox = e.Form.Controls("ComboBox1")
khmc.Text = ""
khdh.Text = ""
cpxh.Text = ""
sl.Value = Nothing
dj.Text = ""
sfje.Text = ""
zk.Text = "0"
ytsl.Value = Nothing
bz.Text = ""
zffs.Text = "Cash"
Dim t As Table = Tables("Quotation_Table2")
With Tables("报价单")
If .Current Is Nothing Then
t.Filter = "False"
Else
t.Filter = "订单号 = '" & .Current("订单号") & "'"
End If
End With
With Tables("报价明细表")
Tables("报价明细表").Filter = "1=2"
.Cols("数量").GrandTotal = True
.Cols("金额").GrandTotal = True
.GrandTotal = False
End With
Dim xzcp As WinForm.Button = e.Form.Controls("新增产品")
xzcp.Enabled = False
Dim bc As WinForm.Button = e.Form.Controls("保存")
bc.Enabled = False
If e.Form.Controls("CheckBox1").Checked = True Then
If MessageBox.Show("Are You Sure To Convert This Quotation To An Order?","Confirm",MessageBoxButtons.YesNo,MessageBoxIcon.Question) = DialogResult.Yes Then
Dim dr1 As Row = Tables("报价单").Current
Dim Cols1() As String = {"日期","订单号","客户名称","客户电话","折扣","编辑者","备注"}
Dim Cols2() As String = {"日期","订单号","客户名称","客户电话","折扣","编辑者","备注"}
Dim Cols3() As String = {"日期","订单号","客户名称","客户电话","产品型号","产品类别","数量","销售单价","备注","单价成本"}
Dim Cols4() As String = {"日期","订单号","客户名称","客户电话","产品型号","产品类别","数量","销售单价","备注","单价成本"}
Dim dr2 As DataRow = DataTables("销售订单").AddNew()
For i As Integer = 0 To Cols1.Length -1
dr2(Cols2(i)) = dr1(Cols1(i))
Next
For Each dr3 As DataRow In dr1.DataRow.GetChildRows("报价明细表")
Dim dr4 As DataRow = DataTables("销售明细表").AddNew()
For i As Integer = 0 To Cols3.Length -1
dr4(Cols4(i)) = dr3(Cols3(i))
Next
Next
Tables("报价单").Current.delete
DataTables("报价单").Save()
DataTables("销售订单").Save()
DataTables("销售明细表").Save()
End If
End If
帮我看看是不是代码或者逻辑有问题。