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.