|
|
Проценты - Цена по наценке и скидке "по хитрому"
Public Function esPriceUpDown(cPrice As Currency, iMargin As Integer, iDiscount As Integer) As Currency
Dim tPrice As Currency
Dim rPrice As Currency
On Error GoTo esPriceUpDown_Err
tPrice = cPrice
rPrice = cPrice
If iMargin <> 0 Then
rPrice = CCur(Format(tPrice * (iMargin / 100 + 1), "0.00"))
If rPrice = tPrice Then
rPrice = tPrice + 0.01
End If
End If
If iDiscount <> 0 Then
tPrice = rPrice
rPrice = CCur(Format(tPrice * (1 - iDiscount / 100), "0.00"))
If rPrice = tPrice Then
If rPrice > 0.02 Then rPrice = tPrice - 0.01
End If
End If
esPriceUpDown_Bye:
esPriceUpDown = rPrice
Exit Function
esPriceUpDown_Err:
rPrice = 0
Err.Clear
Resume esPriceUpDown_Bye
End Function
|
|