I have an existing report which is providing the number of hotel rooms multiplied by the duration and then by the nightly room rate which is sub totalled by company department then totalled. However the nightly currency rates are different due to different countries. I would like to convert the foreign currency to a common type
Currently the cells identify the Hotel_Type_Currency and formula for the @NightlyRate
Numbervar X;
stringvar TheField := {cv_accomodation_segment.HOTEL_NIGHTLY_RATE};
Stringvar TempString := "0";
for x := 1 to len(TheField) do(
if isnumeric(mid(TheField,X,1))
or mid(TheField,X,1) = "." then
TempString := TempString+mid(TheField,X,1)
);
If isnumeric(TempString) then
val(TempString)
else
0
However due to hotel guests staying in different countries the room rate changes due to currency i.e. Hong Kong Dollars HKD 1200 for one line and USD 144 for the next line. The result in the sub totals and totals being inaccurate.
whilePrintingrecords;
booleanVar dataflag :=false;// to identify bad data
NumberVar result:={cv_accomodation_segment.DURATION} * {cv_accomodation_segment.NUMBER_OF_UNITS};
NumberVar ResultTotal;
NumberVar DeptTotal;
NumberVar GrandTotal;
if not isnull({cv_accomodation_segment.HOTEL_NIGHTLY_RATE}) and
isnumeric({cv_accomodation_segment.HOTEL_NIGHTLY_RATE}) then result:= result
* ToNumber ({cv_accomodation_segment.HOTEL_NIGHTLY_RATE})
else (result:=result)* (0);
dataFlag:=true;
ResultTotal := ResultTotal + Result;
DeptTotal := DeptTotal + Result;
GrandTotal := GrandTotal + Result;
result;
there are typically only approximately 10 different currencies. How can I convert the nightly rate to a common currency?
Thank you for your help
Peter
Currently the cells identify the Hotel_Type_Currency and formula for the @NightlyRate
Numbervar X;
stringvar TheField := {cv_accomodation_segment.HOTEL_NIGHTLY_RATE};
Stringvar TempString := "0";
for x := 1 to len(TheField) do(
if isnumeric(mid(TheField,X,1))
or mid(TheField,X,1) = "." then
TempString := TempString+mid(TheField,X,1)
);
If isnumeric(TempString) then
val(TempString)
else
0
However due to hotel guests staying in different countries the room rate changes due to currency i.e. Hong Kong Dollars HKD 1200 for one line and USD 144 for the next line. The result in the sub totals and totals being inaccurate.
whilePrintingrecords;
booleanVar dataflag :=false;// to identify bad data
NumberVar result:={cv_accomodation_segment.DURATION} * {cv_accomodation_segment.NUMBER_OF_UNITS};
NumberVar ResultTotal;
NumberVar DeptTotal;
NumberVar GrandTotal;
if not isnull({cv_accomodation_segment.HOTEL_NIGHTLY_RATE}) and
isnumeric({cv_accomodation_segment.HOTEL_NIGHTLY_RATE}) then result:= result
* ToNumber ({cv_accomodation_segment.HOTEL_NIGHTLY_RATE})
else (result:=result)* (0);
dataFlag:=true;
ResultTotal := ResultTotal + Result;
DeptTotal := DeptTotal + Result;
GrandTotal := GrandTotal + Result;
result;
there are typically only approximately 10 different currencies. How can I convert the nightly rate to a common currency?
Thank you for your help
Peter