以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 如何根据客户报价及自设公式,计算产品单价 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=15806) |
||||
-- 作者:jinruan -- 发布时间:2012/1/12 11:27:00 -- 如何根据客户报价及自设公式,计算产品单价 如何根据客户报价及自设公式,结合录入的长、宽、高,计算出产品单价
见附件:
|
||||
-- 作者:狐狸爸爸 -- 发布时间:2012/1/12 12:40:00 --
注意:
输入公式要规范,列名用方括号括起来,运算符号包括括号,应该是半角。 |
||||
-- 作者:blackzhu -- 发布时间:2012/1/12 12:47:00 -- Select Case e.DataCol.Name Case "客户","公式" If e.DataRow.IsNull("客户") Or e.DataRow.IsNull("公式") Then e.DataRow("产品单价")=Nothing Else Dim dr As DataRow dr=DataTables("客户报价").Find("客户=\'" & e.DataRow("客户") & "\'") If dr IsNot Nothing Then Dim r As DataRow = e.DataRow If r("公式")="公式1" Then r("产品单价")=((r("长")+r("宽"))*(r("宽")+r("高"))*dr("报价"))/1000 Else r("产品单价")=(((r("长")+2)*(r("宽")+1))*((r("宽")+2)*(r("高")+1)))*dr("报价")/1000 End If End If End If End Select |
||||
-- 作者:blackzhu -- 发布时间:2012/1/12 12:47:00 -- DataColChanged 表事件中执行,看看结果对不? |
||||
-- 作者:jinruan -- 发布时间:2012/1/12 13:34:00 -- 狐狸爸爸 这个答案很给力,Foxtable强悍!谢谢!
Select Case e.DataCol.name [此贴子已经被作者于2012-1-12 13:36:22编辑过]
|
||||
-- 作者:jinruan -- 发布时间:2012/1/12 13:36:00 --
|
||||
-- 作者:小猪鑫鑫 -- 发布时间:2012/1/12 23:01:00 -- foxtable很强,顶 |