表事件
报价明细_DataColChanged
Dim b As String
Select Case e.DataCol.Name
Case "订购数量","单价","折扣"
Dim bh As String = e.DataRow("客户编号")
If bh.StartsWith("X") Then
If e.DataRow("产品名称").Contains("TX") Or e.DataRow("产品名称").Contains("碳纤") Then
e.DataRow("佣金") = e.DataRow("单价") * e.DataRow("折扣") * e.DataRow("订购数量") * 0.05
Else
e.DataRow("佣金") = e.DataRow("单价") * e.DataRow("折扣") * e.DataRow("订购数量") * 0.1
End If
Else
e.DataRow("佣金") = 0
End If
e.DataRow("折扣金额") = e.DataRow("单价") * (1 - e.DataRow("折扣")) * e.DataRow("订购数量")
e.DataRow("总价") = e.DataRow("单价") * e.DataRow("折扣") * e.DataRow("订购数量") + e.DataRow("模具") + e.DataRow("工装") + e.DataRow("其他")
msgbox(1)
If Forms("报价").Opened Then
msgbox(2)
b = Forms("报价").Controls("ComboBox1").value
Dim sl As Double = Tables("报价明细").Compute("Sum(订购数量)", "编号 = '" & b & "'")
Dim zk As Double = Tables("报价明细").Compute("Sum(折扣金额)", "编号 = '" & b & "'")
Dim tj As Double = Tables("报价明细").Compute("Sum(订购数量)", "编号 = '" & b & "' and 产品名称 like '%J'")
tj = sl + tj
Dim jg As Double = Tables("报价明细").Compute("Sum(总价)", "编号 = '" & b & "'")
Dim sj As Double = jg * Forms("报价").Controls("ComboBox9").value
Dim zj As Double = jg + sj + Forms("报价").Controls("ComboBox11").value + Forms("报价").Controls("ComboBox12").value
Forms("报价").Controls("ComboBox01").value = zk
Forms("报价").Controls("ComboBox10").value = tj
Forms("报价").Controls("ComboBox13").value = sj
Forms("报价").Controls("ComboBox14").value = zj
Forms("报价").Controls("TextBox1").value = sl
Forms("报价").Controls("TextBox2").value = jg
ElseIf Forms("报价修改").Opened Then
b = Forms("报价修改").Controls("ComboBox1").value
Dim sl As Double = Tables("报价明细").Compute("Sum(订购数量)", "编号 = '" & b & "'")
Dim zk As Double = Tables("报价明细").Compute("Sum(折扣金额)", "编号 = '" & b & "'")
Dim tj As Double = Tables("报价明细").Compute("Sum(订购数量)", "编号 = '" & b & "' and 产品名称 like '%J'")
tj = sl + tj
Dim jg As Double = Tables("报价明细").Compute("Sum(总价)", "编号 = '" & b & "'")
Dim sj As Double = jg * Forms("报价修改").Controls("ComboBox9").value
Dim zj As Double = jg + sj + Forms("报价修改").Controls("ComboBox11").value + Forms("报价").Controls("ComboBox12").value
Forms("报价修改").Controls("ComboBox01").value = zk
Forms("报价修改").Controls("ComboBox10").value = tj
Forms("报价修改").Controls("ComboBox13").value = sj
Forms("报价修改").Controls("ComboBox14").value = zj
Forms("报价修改").Controls("TextBox1").value = sl
Forms("报价修改").Controls("TextBox2").value = jg
End If
Case "模具","工装","其他"
e.DataRow("折扣金额") = e.DataRow("单价") * (1 - e.DataRow("折扣")) * e.DataRow("订购数量")
e.DataRow("总价") = e.DataRow("单价") * e.DataRow("折扣") * e.DataRow("订购数量") + e.DataRow("模具") + e.DataRow("工装") + e.DataRow("其他")
If Forms("报价").Opened Then
b = Forms("报价").Controls("ComboBox1").value
Dim jg As Double = Tables("报价明细").Compute("Sum(总价)", "编号 = '" & b & "'")
Dim sj As Double = jg * Forms("报价").Controls("ComboBox9").value
Dim zj As Double = jg + sj + Forms("报价").Controls("ComboBox11").value + Forms("报价").Controls("ComboBox12").value
Forms("报价").Controls("ComboBox13").value = sj
Forms("报价").Controls("ComboBox14").value = zj
Forms("报价").Controls("TextBox2").value = jg
ElseIf Forms("报价修改").Opened Then
b = Forms("报价修改").Controls("ComboBox1").value
Dim jg As Double = Tables("报价明细").Compute("Sum(总价)", "编号 = '" & b & "'")
Dim sj As Double = jg * Forms("报价修改").Controls("ComboBox9").value
Dim zj As Double = jg + sj + Forms("报价修改").Controls("ComboBox11").value + Forms("报价").Controls("ComboBox12").value
Forms("报价修改").Controls("ComboBox13").value = sj
Forms("报价修改").Controls("ComboBox14").value = zj
Forms("报价修改").Controls("TextBox2").value = jg
End If
End Select