Hi M,
I am using a function to check the totals below. Where you see "string(abs(net_dr - total_check))" is where the odd amount shows seemingly to be to some exponential power.
Paul
string returnvalue
long rows
long i
string description2
decimal{2} amount
rows = w_trip_closeout_ii.dw_vc_charges.rowcount()
if rows > 0 then
for i = 1 to rows
description2 = trim(w_trip_closeout_ii.dw_vc_charges.getitemstring(i, "closeout_item_description_long_1111111111"))
amount = w_trip_closeout_ii.dw_vc_charges.getitemdecimal(i, "amount")
if description2 = "Base Rate:" then
basic_rate_dr = round(amount,2)
end if
if description2 = "Gratuity:" then
tips_charges_dr = round(amount,2)
end if
if description2 = "Tolls:" then
tolls_charges_dr = round(amount,2)
end if
if description2 = "Parking:" then
parking_charges_dr = round(amount,2)
end if
if description2 = "Fuel:" then
fuel_surcharge_dr = round(amount,2)
end if
if description2 = "STC:" then
stc_charges_dr = round(amount,2)
end if
if description2 = "Meet/Greet:" then
m_g_charges_dr = round(amount,2)
end if
if description2 = "EMLN/Holiday:" then
ot_charges_dr = round(amount,2)
end if
if description2 = "Airport Fee:" then
miscellaneous_dr = round(amount,2)
end if
if description2 = "Stops Charges:" then
stops_charges_dr = round(amount,2)
end if
if description2 = "Wait Charges:" then
wt_charges_dr = round(amount,2)
end if
if description2 = "Misc. Charges:" then
miscellaneous_dr = round(amount,2)
end if
if description2 = "Discount:" then
discount_dr = round(amount,2)
end if
if description2 = "NYC Workers Comp:" then
wc_charges_dr = round(amount,2)
end if
if description2 = "Tax:" then
sales_tax_dr = round(amount,2)
end if
if description2 = "Total:" then
net_dr = round(amount,2)
end if
next
end if
if isnull(basic_rate) then
basic_rate_dr = 0
end if
if isnull(parking) then
parking_charges_dr = 0
end if
if isnull(m_g_charges) then
m_g_charges_dr = 0
end if
if isnull(ot_charges) then
ot_charges_dr = 0
end if
if isnull(stc) then
stc_charges_dr = 0
end if
if isnull(fuel) then
fuel_surcharge_dr = 0
end if
if isnull(airport_fee) then
airport_fee_dr = 0
end if
if isnull(stops_charge) then
stops_charges_dr = 0
end if
if isnull(wait_charge) then
wt_charges_dr = 0
end if
if isnull(tolls) then
tolls_charges_dr = 0
end if
if isnull(misc_charge) then
miscellaneous_dr = 0
end if
if isnull(tip_charge) then
tips_charges_dr = 0
end if
if isnull(emln_holiday) then
ot_charges_dr = 0
end if
if isnull(discount) then
discount_dr = 0
end if
if isnull(subtotal) then
subtotal = 0
end if
if isnull(nyc_wc_fee) then
wc_charges_dr = 0
end if
if isnull(sales_tax) then
sales_tax_dr = 0
end if
if isnull(price_est) then
net_dr = 0
end if
decimal{2} total_check
total_check = round(basic_rate_dr + tips_charges_dr + tolls_charges_dr + parking_charges_dr + fuel_surcharge_dr + stc_charges_dr + m_g_charges_dr + ot_charges_dr + airport_fee_dr + stops_charges_dr + wt_charges_dr + miscellaneous_dr - discount_dr + wc_charges_dr + sales_tax_dr,2)
if total_check <> net_dr then
messagebox("Error!","Sorry, the total of the price elements do not match the total of " + string(net_dr) + " entered. The difference is " + string(abs(net_dr - total_check)) + ". Please adjust the price elements or the total to match. Alternatively, you can request a trip closeout override.")
returnvalue = "NOMATCH"
elseif net_dr = 0 then
messagebox("Error!","Sorry, the total price cannot be zero.")
returnvalue = "NOMATCH"
elseif basic_rate_dr = 0 then
messagebox("Error!","Sorry, the base rate cannot be zero.")
returnvalue = "NOMATCH"
else
returnvalue = "MATCH"
end if
return returnvalue