Dim id As Integer = DataTables("报价单").Compute("Max(_Identify)")
Dim Filter As String = "[_Identify] > " & id
DataTables("报价单").AppendLoad(Filter, False)
Dim sts() As String = {"dropbox2","DropBox4"}
For Each st As String In sts
If e.Form.Controls(st).value Is Nothing Then
MessageBox.show("Please enter the name,phone number!","Remind")
Return
End If
Next
Tables("报价单").AllowEdit = True
Dim dr As Row = Tables("报价单").AddNew
dr("日期") = Date.Today
dr("客户名称") = e.Form.Controls("DropBox4").Text
dr("客户电话") = e.Form.Controls("DropBox2").Text
\'dr.Save
Dim xzcp As WinForm.Button = e.Form.Controls("新增产品")
xzcp.Enabled = True
Dim bc As WinForm.Button = e.Form.Controls("保存")
bc.Enabled = True
e.Form.Controls("Button1").Enabled =False
报价单DataColChanged代码:
If e.DataCol.Name = "订单号" Then \'发生变化的是产品列和订单号
\'则累计订单出库明细表中同名产品总的销售量,然后赋值给变动行的已提数量列
e.DataRow("总金额") = DataTables("报价明细表").Compute("sum(金额)","订单号 = \'" & e.DataRow("订单号") & "\'")
e.DataRow("总数量") = DataTables("报价明细表").Compute("sum(数量)","订单号 = \'" & e.DataRow("订单号") & "\'")
e.DataRow("合计成本") = DataTables("报价明细表").Compute("sum(合计成本)","订单号 = \'" & e.DataRow("订单号") & "\'")
e.DataRow("合计成本") = iif(e.DataRow("合计成本") = Nothing,0, e.DataRow("合计成本"))
End If
Select Case e.DataCol.Name
Case "总金额" ,"折扣","已付款","合计成本"
e.DataRow("GrandTotal") = e.DataRow("总金额") - e.DataRow("折扣")
e.DataRow("已付款") = e.DataRow("GrandTotal")
e.DataRow("未付款") = e.DataRow("GrandTotal") - e.DataRow("已付款")
e.DataRow("销售毛利") = e.DataRow("GrandTotal") - e.DataRow("合计成本") - DataTables("花销").Compute("sum(花销)","订单号 = \'" & e.DataRow("订单号") & "\'")
End Select
报价单DataRowAdding代码:
e.DataRow("编辑者") = User.name
Static Index As Integer = 99999
e.DataRow("订单号") = Format(Date.Today(),"BJyyMMdd") & Index
Index = Index - 1