Re: Currency problem in choosing the appropriate supplier in requirement

2010-11-27 Thread Shereen

I wanted to make a simple regarding the requirement problem of assigning the
requirement to the supplier that has the least price regardless of the
difference in currencies.
I created a field in the entity supplier product called priceDefaultCurrency
which will hold the price in my default currency.
I've decided to use the table in the accounting that holds foreign currency
changes and idea is when we automatically assign a requirement we'll check
if the price is the default say USD or not 
if it's in USD then priceDefaultCurrency will be equal the lastPrice and if
not the I'll get the record that holds the conversion rate from the table
uomConversionDated. and get the conversion factor and multiply it to the
price and this will be the value of priceDefaultCurrency 
I'll depend in my code that there exists for example just oe rate from say
EUR to USD then I can fix that.
I've tried to that in minilang but I've an exception 

the case where the price is in USD the code goes right and the
priceDefaultCurrency is updated right
the case where the price isn't in USD it gve me exception and the
priceDefaultCurrency is 0


here's the code I've it in the service autoAssignRequirementToSupplier










   







































this the whole service code I know it doesn't do the assignmet in the right
way but at least I need to update the field priceDefaultCurrency

and the exception is Exception: org.ofbiz.entity.GenericDataSourceException
Message: SQL Exception while executing the following:SELECT COUNT(1) FROM
(SELEC
T COUNT(DISTINCT *)  FROM OFBIZ.REQUIREMENT RQ INNER JOIN
OFBIZ.REQUIREMENT_ROLE
 RQR ON RQ.REQUIREMENT_ID = RQR.REQUIREMENT_ID WHERE (RQR.ROLE_TYPE_ID = ?
AND R
Q.STATUS_ID = ? AND RQ.REQUIREMENT_TYPE_ID = ? AND ((RQR.THRU_DATE IS NULL
OR RQ
R.THRU_DATE > ?) AND (RQR.FROM_DATE IS NULL OR RQR.FROM_DATE <= ?))) GROUP
BY RQ
R.PARTY_ID) TEMP_NAME (Syntax error: Encountered "*" at line 1, column 45.)
 cause
-

Exception: java.sql.SQLSyntaxErrorException
Message: Syntax error: Encountered "*" at line 1, column 45.
 cause
-

Exception: org.apache.derby.impl.jdbc.EmbedSQLException
Message: Syntax error: Encountered "*" at line 1, column 45.
 cause
-

Exception: org.apache.derby.iapi.error.StandardException
Message: Syntax error: Encountered "*" at line 1, column 45.
 stack trace
---

ERROR 42X01: Syntax error: Encountered "*" at line 1, column 45.
org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(Unknown Source)
org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalS
tatement(Unknown Source)
org.apache.derby.impl.jdbc.EmbedPreparedStatement.(Unknown Source)
org.apache.derby.impl.jdbc.EmbedPreparedStatement20.(Unknown Source)
org.apache.derby.impl.jdbc.EmbedPreparedStatement30.(Unknown Source)
org.apache.derby.impl.jdbc.EmbedPreparedStatement40.(Unknown Source)
org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown Source)
org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnecti



-- 
View this message in context: 
http://ofbiz.135035.n4.nabble.com/Currency-problem-in-choosing-the-appropriate-supplier-in-requirement-tp2551814p3061844.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: Currency problem in choosing the appropriate supplier in requirement

2010-09-23 Thread Shereen

Useful information thanks
I think I'll be back to the technical problem in a while and I'll have to
fix that problem.
because I'm just testing all functionality and try to decide what needs to
be done for my system.

-- 
View this message in context: 
http://ofbiz.135035.n4.nabble.com/Currency-problem-in-choosing-the-appropriate-supplier-in-requirement-tp2551814p2551887.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: Currency problem in choosing the appropriate supplier in requirement

2010-09-23 Thread BJ Freeman
it has been discussed before but the hang up is finding a free source 
for getting currency rates, that can be put in the code.


Shereen sent the following on 9/23/2010 4:36 AM:


Thanks I'd be like to contribute. I just wanted to make sure that this
function doesn't exist yet and I wasn't missing something




Re: Currency problem in choosing the appropriate supplier in requirement

2010-09-23 Thread Shereen

Thanks I'd be like to contribute. I just wanted to make sure that this
function doesn't exist yet and I wasn't missing something
-- 
View this message in context: 
http://ofbiz.135035.n4.nabble.com/Currency-problem-in-choosing-the-appropriate-supplier-in-requirement-tp2551814p2551858.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: Currency problem in choosing the appropriate supplier in requirement

2010-09-23 Thread BJ Freeman
what needs to be implemented is a look up of current currency rates then 
add that into the code for the comparison.

if you would like to contribute please read.
https://cwiki.apache.org/confluence/display/OFBADMIN/OFBiz+Contributors+Best+Practices

Sheree sent the following on 9/23/2010 3:58 AM:


Hi
I have the following problem.

For a certain product I've many suppliers those suppliers have their prices
in different currencies .
When I go to the order manager and then to the requirements
when I choose the product the system automatically chooses the supplier for
me but IT DOESNT CONSIDER CURRENCY it just finds the lowest price but IT
CONSIDERS the  ordered quantity

so finally it chooses the lowest price of the suitable ordered quantity
without currency check

this problem in all versions I used 9.04 and 10.04

Any suggestions please? has anyone implemented something like a currency
converter?