标题: 这段计件单价的代码能不能优化一下? [打印本页] 作者: laiguiyou 时间: 2006-11-14 17:16 标题: 这段计件单价的代码能不能优化一下? Dim a, B, c, d, e, f, g, h, i, J, k, l, m, n, p, q, r As Single
Dim pr As Currency
If Me.[部门] = "8" Then
If Me.订单量 >= 1 And Me.订单量 <= 2 Then
Me.单价2 = pr * a
ElseIf Me.订单量 >= 3 And Me.订单量 <= 4 Then
Me.单价2 = pr * B
ElseIf Me.订单量 >= 5 And Me.订单量 <= 6 Then
Me.单价2 = pr * c
ElseIf Me.订单量 >= 7 And Me.订单量 <= 10 Then
Me.单价2 = pr * d
ElseIf Me.订单量 >= 11 And Me.订单量 <= 30 Then
Me.单价2 = pr * e
ElseIf Me.订单量 >= 31 And Me.订单量 <= 99 Then '31---99
Me.单价2 = pr * f
ElseIf Me.订单量 >= 100 Then '100以上
Me.单价2 = pr * m
End If
ElseIf Me.[部门] = "2" Then '彩绘大线
If Me.订单量 >= 1 And Me.订单量 <= 10 Then
Me.单价2 = pr * p
ElseIf Me.订单量 >= 11 And Me.订单量 <= 30 Then
Me.单价2 = pr * q
ElseIf Me.订单量 >= 31 And Me.订单量 <= 99 Then
Me.单价2 = pr * q
ElseIf Me.订单量 > 100 Then
Me.单价2 = pr
End If
ElseIf Me.[部门] = "6" Then '包装
Me.单价2 = pr * 1.5
ElseIf Me.[部门] = "1" Then '白坯大线
If Me.订单量 >= 1 And Me.订单量 <= 2 Then
Me.单价2 = pr * g
ElseIf Me.订单量 >= 3 And Me.订单量 <= 5 Then
Me.单价2 = pr * h
ElseIf Me.订单量 >= 6 And Me.订单量 <= 10 Then
Me.单价2 = pr * i
ElseIf Me.订单量 >= 11 And Me.订单量 <= 20 Then
Me.单价2 = pr * J
ElseIf Me.订单量 > 21 Then
Me.单价2 = pr
End If
ElseIf Me.[部门] = "24" Then
If Me.订单量 >= 1 And Me.订单量 <= 2 Then
Me.单价2 = pr * g
ElseIf Me.订单量 >= 3 And Me.订单量 <= 5 Then
Me.单价2 = pr * h
ElseIf Me.订单量 >= 6 And Me.订单量 <= 10 Then
Me.单价2 = pr * i
ElseIf Me.订单量 >= 11 And Me.订单量 <= 20 Then