Marketcircle    Forums  Hop To Forum Categories  Billings  Hop To Forums  Creating Estimates and Invoices    Multiple Currencies
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Apprentice
Posted
I have to bill my clients in Euros and Swiss Francs. Therefore I created customized invoices. All works fine. Now i need a report where everything is in euros. The idea was the following: I use one of the Project Extra Fields to define the factor for the currency conversion and in the report i multiply the project total with this number (eg. project total is 800 Swiss Francs multiplied with the defined currency rate (0.625) which results in Euros. If a invoice is allready in euros i just put 1 in the extra field. So far works fine. But now i don't know how to sum all these numbers up in the total field. If i use the @sum total statement the result is wrong since the currencies will be ignored. Is there a way to sum all the fields of this table or do i need to do the converseion somwhere else? Thanks!
 
Posts: 9 | Registered: February 07, 2008Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
OK I AM ONE STEP CLOSER NOW WITH THIS SCRIPT FOR THE PROJECT TOTAL:

currency := element 'parent.reportData.object.project.extraField1'.

balance := element valueForKeyPath:'parent.reportData.object.total'.
balance := balance*currency.

a := balance.

(a == nil) ifTrue:
[
a := 0.

].


total := (element enclosingReportLayout) reportDataForKey:'runningTotal'.

(total == nil) ifTrue:
[
total := 0.

].

total := total + a.

(element enclosingReportLayout) setReportData:total forKey:'runningTotal'.

balance.

-------
AND THIS FOR THE OVERALL TOTAL:
totalAmount := (element enclosingReportLayout) reportDataForKey:'runningTotal'.
totalAmount.

------
The only problem now is that the ExtraField comes in as a String and not a number. So multiplying the total with the ExtraField doesn't give a result.

Does anyone know how to convert this string into a number so i can do calculations with it?

Thanks
 
Posts: 9 | Registered: February 07, 2008Reply With QuoteEdit or Delete MessageReport This Post
Marketcircle Team
Picture of Oscar
Posted Hide Post
currency := element 'parent.reportData.object.project.extraField1'.

"The following is how to convert a string into an int value(number)"
currency := currency intValue.

balance := element valueForKeyPath:'parent.reportData.object.total'.
balance := balance*currency.

a := balance.

(a == nil) ifTrue:
[
a := 0.

].


total := (element enclosingReportLayout) reportDataForKey:'runningTotal'.

(total == nil) ifTrue:
[
total := 0.

].

total := total + a.

(element enclosingReportLayout) setReportData:total forKey:'runningTotal'.

balance.
 
Posts: 495 | Location: Toronto | Registered: February 20, 2007Reply With QuoteEdit or Delete MessageReport This Post
Marketcircle Team
Picture of Oscar
Posted Hide Post
Though please note that when you go to record payments in the account status you will not see amount calculated using this fscript because the script does not actually interact with the database. We can just pull and manipulate information externally.
 
Posts: 495 | Location: Toronto | Registered: February 20, 2007Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
thanks oscar that did the trick
 
Posts: 9 | Registered: February 07, 2008Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

Marketcircle    Forums  Hop To Forum Categories  Billings  Hop To Forums  Creating Estimates and Invoices    Multiple Currencies

© Copyright 2006 Marketcircle Inc. All rights reserved.