Service Contract Line Value based on Currency Code

havhav Member Posts: 299
Hi,
The Currency Code on Service Contract header is the code in which the amount value on the document related to this contract will be converted and NOT the code in which the Line Value on the Service Contract subform is to be entered.
Am i right?

One of my client has a requirement that he needs to manually do the conversion which entering the value in LCY on Line Value column of the Service Contract Line whereas the invoice is to be obtained in FCY. He wants that if he enters Currency Code on the header in INR and the Line Value on the subform should also be entered in INR and NOT LCY.

I have thought of a workaround to achieve this by tweaking the CU 5940-ServContractManagement.
I think the AmountToFCY() handles the conversion when generating the service ledger entry as below:
AmountToFCY(AmountLCY : Decimal;VAR SalesHeader3 : Record "Sales Header") : Decimal
Currency.GET(SalesHeader3."Currency Code");
Currency.TESTFIELD("Unit-Amount Rounding Precision");
  ROUND(
    CurrExchRate.ExchangeAmtLCYToFCY(
      SalesHeader3."Posting Date",SalesHeader3."Currency Code",
      AmountLCY,SalesHeader3."Currency Factor"),
      Currency."Unit-Amount Rounding Precision"));
If i change the above code to
AmountToFCY(AmountLCY : Decimal;VAR SalesHeader3 : Record "Sales Header") : Decimal
Currency.GET(SalesHeader3."Currency Code");
Currency.TESTFIELD("Unit-Amount Rounding Precision");
EXIT(LCY)
then i think it should be fine to meet the client's requirement.

However i am slightly not in favour of changing the standard base code.
Can this be achieved via some setup?
Is there any other alternative?

Any suggestion?

Regards,
Hemant
Regards,
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)

Comments

  • havhav Member Posts: 299
    I have to meet my client requirements at the earliest possible.
    Please advise.


    Regards,
    Hemant
    Regards,
    Hemant
    MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
  • jglathejglathe Member Posts: 639
    Hello Hemant,

    interestingly I had the same problem this week at my employer. To solve the ambiguity I also modified AmountToFCY() in CU5940. A complete solution would involve:

    1. If the currency code of the contract header differs from the newly generated invoice header, do the conversion from currency (contract) to currency (invoice header).

    2. There is a side effect: The same function is used to calculate the amounts on the service ledger entries - so this is good. The LCY amount, however, is calculated via CalcContractLineAmount() (also in CU5940), which assumes that the contract lines are in LCY. To make up for the contract lines being in LCY this function must be changed to respect the currency code in the contract header as well.

    HTH.

    with best regards

    Jens
  • havhav Member Posts: 299
    Hi,
    Thanks for your reply.

    I think of another alternative as below:
    - Add a new column Line Value(FCY) before Line Value on the contract line subform
    - Make Line Value non-editable
    - Allow user to enter Line Value(FCY) as the value corresponding to the Currency Code in the contract header.
    - Add a new function AmountFCYtoLCY() which does the revers of AmountLCYtoFCY()
    - Set the calculated LCY value in Line Value field.

    The above has an advantage of not tweaking the base code plus allowing the user to input what he desires. The system will still be using Line Value.

    Let me know what you think.

    Regards,
    Hemant
    Regards,
    Hemant
    MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
  • jglathejglathe Member Posts: 639
    Hi Hemant,

    I would suggest not to do it this way. When you specify a line amount and a line amount (FCY) then you implicitly force the exchange rate for the entire length of the contract. IMO this is not desirable. When a new periodic invoice is generated (and service ledger entries are being posted), I would expect the current exchange to be the base of the amount calculation. Otherwise you would eventually have large currency gains/losses on payment and distortions in your income accounts.

    with best regards

    Jens
  • havhav Member Posts: 299
    Hi Jens,
    I am slightly not getting when you say-
    hav wrote:
    When you specify a line amount and a line amount (FCY) then you implicitly force the exchange rate for the entire length of the contract
    Please elaborate.

    Also if you can paste your modified AmountToFCY() function here then it would be better for me to understand.

    Note that the Service Contract Header table has single Currency Code field which is used as a SourceExpr for Currrency Code field on Contract | General tab as well as Contract | Invoice Details tab.
    What's the difference in specify the currency values at two different places even if the source field is going to remain the same.

    Regards,
    Hemant
    Regards,
    Hemant
    MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
  • jglathejglathe Member Posts: 639
    Hi Hemant,

    no source code, sorry... my comments were more on the business logic than on specific fields shown. Defining a contract in FCY is a functional requirement, with some implications on the logic behind in CU5940 and the statistics window. As it is now, you can specify a currency for the bills, but the contract itself (the lines) is to be set up in LCY. This understandable from a certain POV, but IMO confusing for real-world use. It doesn't make sense, however, to define both FCY and LCY in the same contract - meaning you want to bill with the resulting exchange rate. This would only make sense if you have a F/X hedge transaction on the whole contract volume, but there are other ways to implement this in NAV. So, the only thing I did is redefining what "Currency Code" in the contract header meant: The currency of the contract, for the whole volume. The lines are interpreted as FCY values. In this case you have to modify CU5940.

    with best regards

    Jens
  • PhennoPhenno Member Posts: 630
    Hi all!

    It seems that I missed something. For u number of NAV versions amounts in Service Contract Lines are in LCY and "Currency Code" in Service Contract Header is used only for purpose of creating invoice in that currency (by converting line amounts to that currency).

    But Help documentation says differently for that fields. For example here it says that Line Amount would be in currency of service contract
    https://msdn.microsoft.com/en-us/library/hh178101(v=nav.90).aspx

    I checked the code and it is really in LCY regardless of what documentation says. I suppose it will update documentation sooner or later...


    But the question is why would it be in LCY only? What if I have agreement with customer for monthly services fee in his preferred currency? Further more, it is highly misleading to enter currency code in header but amounts in LCY, specifically if field name does not contain "LCY" label...
Sign In or Register to comment.