OBJECT Table 50001 Global Currency { OBJECT-PROPERTIES { Date=27/10/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10; } PROPERTIES { OnInsert=BEGIN IF ("Exchange Rate Amt." = 0) AND ("Relational Exch. Rate Amt." = 0) THEN "Exchange Rate Amt." := 1; UpdateType; "Last Updated Date Time" := ROUNDDATETIME(CURRENTDATETIME,60000L); END; OnModify=BEGIN IF ("Exchange Rate Amt." = 0) AND ("Relational Exch. Rate Amt." = 0) THEN "Exchange Rate Amt." := 1; UpdateType; "Last Updated Date Time" := ROUNDDATETIME(CURRENTDATETIME,60000L); END; CaptionML=ENU=Currency; } FIELDS { { 1 ; ;Company Name ;Text30 ;TableRelation=Company; ValidateTableRelation=No; TestTableRelation=No; CaptionML=ENU=Company Name; Editable=No } { 2 ; ;Currency Code ;Code10 ;CaptionML=ENU=Currency Code; NotBlank=Yes; Editable=No } { 4 ; ;LCY Code ;Code10 ;Editable=No } { 5 ; ;Exchange Rate Amt. ;Decimal ;OnValidate=BEGIN IF "Exchange Rate Amt." = xRec."Exchange Rate Amt." THEN EXIT; IF "Exchange Rate Amt." <> 0 THEN "Relational Exch. Rate Amt." := 0; IF ("Exchange Rate Amt." = 0) AND ("Relational Exch. Rate Amt." = 0) THEN "Exchange Rate Amt." := xRec."Exchange Rate Amt."; UpdateType; END; CaptionML=ENU=Exchange Rate Amt.; DecimalPlaces=0:0; MinValue=0; BlankZero=Yes } { 6 ; ;Relational Exch. Rate Amt.;Decimal ;OnValidate=BEGIN IF "Relational Exch. Rate Amt." = xRec."Relational Exch. Rate Amt." THEN EXIT; IF "Relational Exch. Rate Amt." <> 0 THEN "Exchange Rate Amt." := 0; IF ("Exchange Rate Amt." = 0) AND ("Relational Exch. Rate Amt." = 0) THEN "Relational Exch. Rate Amt." := xRec."Relational Exch. Rate Amt."; UpdateType; END; CaptionML=ENU=Relational Exch. Rate Amount; DecimalPlaces=0:0; MinValue=0; BlankZero=Yes } { 9 ; ;Last Updated Date Time;DateTime ;CaptionML=ENU=Last Updated Date Time; Editable=No } { 10 ; ;Description ;Text30 ;CaptionML=ENU=Description } { 12 ; ;Type ;Option ;OptionCaptionML=ENU=" ,Normal Rate,Inverse Rate"; OptionString=[ ,Normal Rate,Inverse Rate]; Editable=No } } KEYS { { ;Company Name,Currency Code ;Clustered=Yes } } FIELDGROUPS { } CODE { LOCAL PROCEDURE UpdateType@1000000000(); BEGIN IF ("Exchange Rate Amt." <> 0) THEN IF ("Exchange Rate Amt." MOD 1 = 0) THEN Type := Type::"Inverse Rate" ELSE Type := Type::" "; IF ("Relational Exch. Rate Amt." <> 0) THEN IF ("Relational Exch. Rate Amt." MOD 1 = 0) THEN Type := Type::"Normal Rate" ELSE Type := Type::" "; IF ("Exchange Rate Amt." = 0) AND ("Relational Exch. Rate Amt." = 0)THEN Type := Type::" "; END; BEGIN END. } } OBJECT Table 50002 Global Exchange Rates { OBJECT-PROPERTIES { Date=27/10/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10; } PROPERTIES { OnInsert=BEGIN IF ("Exchange Rate Amount" = 0) AND ("Relational Exch. Rate Amount" = 0) THEN "Exchange Rate Amount" := 1; InitRate; UpdateStatus; "Updated Date Time" := ROUNDDATETIME(CURRENTDATETIME,60000L); END; OnModify=BEGIN IF "Company Name" = '' THEN ERROR(Text001); IF ("Exchange Rate Amount" = 0) AND ("Relational Exch. Rate Amount" = 0) THEN "Exchange Rate Amount" := 1; UpdateStatus; "Updated Date Time" := ROUNDDATETIME(CURRENTDATETIME,60000L); END; CaptionML=ENU=Global Exchange Rates; } FIELDS { { 1 ; ;Company Name ;Text30 ;TableRelation=Company; ValidateTableRelation=No; TestTableRelation=No; CaptionML=ENU=Company Name; Editable=No } { 2 ; ;Currency Code ;Code10 ;CaptionML=ENU=Currency Code; NotBlank=Yes; Editable=No } { 3 ; ;Currency Date ;Date ;Editable=No } { 4 ; ;LCY Code ;Code10 ;Editable=No } { 5 ; ;Exchange Rate Amount;Decimal ;OnValidate=BEGIN IF "Exchange Rate Amount" = xRec."Exchange Rate Amount" THEN EXIT; IF ("Exchange Rate Amount" = 0) AND ("Relational Exch. Rate Amount" = 0) THEN "Exchange Rate Amount" := xRec."Exchange Rate Amount"; UpdateStatus; END; CaptionML=ENU=Exchange Rate Amount; DecimalPlaces=1:6 } { 6 ; ;Relational Exch. Rate Amount;Decimal; OnValidate=BEGIN IF "Relational Exch. Rate Amount" = xRec."Relational Exch. Rate Amount" THEN EXIT; IF ("Exchange Rate Amount" = 0) AND ("Relational Exch. Rate Amount" = 0) THEN "Relational Exch. Rate Amount" := xRec."Relational Exch. Rate Amount"; UpdateStatus; END; CaptionML=ENU=Relational Exch. Rate Amount; DecimalPlaces=1:6 } { 7 ; ;Currency Factor ;Decimal ;DecimalPlaces=0:15; Editable=No } { 8 ; ;Existing Rate Amount;Decimal ;CaptionML=ENU=Existing Rate Amount; DecimalPlaces=1:6; Editable=No } { 9 ; ;Updated Date Time ;DateTime ;CaptionML=ENU=Last Updated Date Time; Editable=No } { 10 ; ;Description ;Text30 ;CaptionML=ENU=Description } { 11 ; ;Currency Action ;Option ;CaptionML=ENU=Currency Action; OptionString=Insert Rate,Update Rate,Skip Rate,Error,Applied; Editable=No } { 12 ; ;Type ;Option ;OptionCaptionML=ENU=" ,Normal Rate,Inverse Rate"; OptionString=[ ,Normal Rate,Inverse Rate]; Editable=No } { 13 ; ;Imported ;Boolean ;Editable=No } { 14 ; ;Existing Rate Date ;Date ;CaptionML=ENU=Existing Rate Date; Editable=No } } KEYS { { ;Company Name,Currency Code,Currency Date;Clustered=Yes } { ;Company Name,Currency Action } } FIELDGROUPS { } CODE { VAR Text001@1000000000 : TextConst 'ENU=Imported Entries Cannot Be Edited'; PROCEDURE InitRate@1000000002(); VAR GlobalCurrency@1000000001 : Record 50001; CurrExchRate@1000000000 : Record 330; BEGIN IF ("Company Name" = '')OR("Currency Code" = '')OR ("Currency Date" = 0D) THEN EXIT; IF GlobalCurrency.GET("Company Name","Currency Code") THEN BEGIN CurrExchRate.RESET; CurrExchRate.SETRANGE("Currency Code","Currency Code"); CurrExchRate.SETRANGE("Starting Date",0D,"Currency Date"); IF CurrExchRate.FINDLAST THEN BEGIN "Exchange Rate Amount" := CurrExchRate."Exchange Rate Amount"; "Relational Exch. Rate Amount" := CurrExchRate."Relational Exch. Rate Amount"; UpdateStatus; IF Type = Type::"Inverse Rate" THEN "Existing Rate Amount" := CurrExchRate."Relational Exch. Rate Amount" ELSE "Existing Rate Amount" := CurrExchRate."Exchange Rate Amount"; "Existing Rate Date" := CurrExchRate."Starting Date"; END ELSE BEGIN "Exchange Rate Amount" := GlobalCurrency."Exchange Rate Amt."; "Relational Exch. Rate Amount" := GlobalCurrency."Relational Exch. Rate Amt."; END; Description := GlobalCurrency.Description; Type := GlobalCurrency.Type; END; END; LOCAL PROCEDURE CalcFactor@1000000000(); BEGIN IF ("Relational Exch. Rate Amount" <> 0) AND ("Exchange Rate Amount" <> 0) THEN BEGIN IF Type = Type::"Normal Rate" THEN "Currency Factor" := "Relational Exch. Rate Amount" / "Exchange Rate Amount" ELSE "Currency Factor" := "Exchange Rate Amount" / "Relational Exch. Rate Amount"; END ELSE "Currency Factor" := 0; END; LOCAL PROCEDURE UpdateStatus@1000000001(); BEGIN //Set the Type IF ("Exchange Rate Amount" = 0) AND ("Relational Exch. Rate Amount" = 0) THEN BEGIN "Currency Action" := "Currency Action"::Error; CalcFactor; EXIT; END; IF ("Exchange Rate Amount" <> 0) AND ("Relational Exch. Rate Amount" <> 0) THEN BEGIN IF ("Exchange Rate Amount" MOD 1 = 0)AND ("Relational Exch. Rate Amount" MOD 1 = 0)THEN BEGIN "Currency Action" := "Currency Action"::Error; CalcFactor; EXIT; END; END; IF ("Exchange Rate Amount" <> 0) AND ("Exchange Rate Amount" MOD 1 = 0) THEN Type := Type::"Inverse Rate" ELSE Type := Type::"Normal Rate"; IF Type = Type::"Normal Rate" THEN BEGIN IF "Existing Rate Amount" <> "Exchange Rate Amount" THEN IF "Existing Rate Amount" = 0 THEN "Currency Action" := "Currency Action"::"Insert Rate" ELSE "Currency Action" := "Currency Action"::"Update Rate"; IF "Existing Rate Amount" = ROUND("Exchange Rate Amount",0.000001) THEN "Currency Action" := "Currency Action"::"Skip Rate"; END ELSE BEGIN IF "Existing Rate Amount" <> "Relational Exch. Rate Amount" THEN IF "Existing Rate Amount" = 0 THEN "Currency Action" := "Currency Action"::"Insert Rate" ELSE "Currency Action" := "Currency Action"::"Update Rate"; IF "Existing Rate Amount" = ROUND("Relational Exch. Rate Amount",0.000001) THEN "Currency Action" := "Currency Action"::"Skip Rate"; END; CalcFactor; END; BEGIN END. } } OBJECT Report 50002 Get Currency Rates { OBJECT-PROPERTIES { Date=27/10/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10; } PROPERTIES { ProcessingOnly=Yes; OnInitReport=BEGIN CurrencyDate := TODAY; END; OnPreReport=BEGIN IF CurrencyDate < TODAY THEN ERROR(Text001,TODAY); END; } DATASET { { 1000000000;;DataItem; ; DataItemTable=Table2000000006; DataItemTableView=SORTING(Name); OnPreDataItem=BEGIN SETRANGE(Company.Name,COMPANYNAME); END; OnAfterGetRecord=VAR CurrencyMgmt@1000000000 : Codeunit 50002; BEGIN CLEAR(CurrencyMgmt); CurrencyMgmt.GetCurrencyRates(CurrencyDate); END; } } REQUESTPAGE { PROPERTIES { } CONTROLS { { 1000000000;;Container; Name=ContentArea; ContainerType=ContentArea } { 1000000001;1;Group ; CaptionML=ENU=Options; GroupType=Group } { 1000000002;2;Field ; OptionCaptionML=ENU=Currency Date; SourceExpr=CurrencyDate } } } LABELS { } CODE { VAR CurrencyDate@1000000000 : Date; Text001@1000000001 : TextConst 'ENU=The Currency Date Cannot be Blank or Before %1'; BEGIN END. } RDLDATA { } } OBJECT Codeunit 50002 Currency Dashboard Management { OBJECT-PROPERTIES { Date=27/10/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10; } PROPERTIES { OnRun=VAR TestText@1000000000 : Text; BEGIN END; } CODE { VAR Text001@1000000000 : TextConst 'ENU=#1#########################\\'; Text002@1000000001 : TextConst 'ENU=#2#########################'; Text003@1000000002 : TextConst 'ENU=%1 %2'; PROCEDURE GetCurrency@1000000005(); VAR GLSetup@1000000018 : Record 98; Currency@1000000017 : Record 4; CurrExchRate@1000000002 : Record 330; GlobalCurrency@1000000000 : Record 50001; Window@1000000019 : Dialog; BEGIN IF GUIALLOWED THEN BEGIN Window.OPEN(Text001 + Text002); Window.UPDATE(1,''); Window.UPDATE(2,''); END; GLSetup.GET; GLSetup.TESTFIELD("LCY Code"); IF GUIALLOWED THEN BEGIN Window.UPDATE(1,COMPANYNAME); Window.UPDATE(2,''); END; IF Currency.FINDSET(FALSE) THEN BEGIN REPEAT Window.UPDATE(2,Currency.Code); IF (Currency.Code <> GLSetup."LCY Code")THEN BEGIN //Insert the Currency Record IF NOT GlobalCurrency.GET(COMPANYNAME,Currency.Code) THEN BEGIN GlobalCurrency.INIT; GlobalCurrency."Company Name" := COMPANYNAME; GlobalCurrency."Currency Code" := Currency.Code; GlobalCurrency."LCY Code" := GLSetup."LCY Code"; GlobalCurrency.Description := Currency.Description; //do we have a Default CurrExchRate.RESET; CurrExchRate.SETRANGE("Currency Code",Currency.Code); CurrExchRate.SETFILTER("Exchange Rate Amount",'<>0'); IF CurrExchRate.FINDLAST THEN BEGIN IF ROUND(CurrExchRate."Exchange Rate Amount",1) = CurrExchRate."Exchange Rate Amount" THEN BEGIN IF CurrExchRate."Exchange Rate Amount" <> GlobalCurrency."Exchange Rate Amt." THEN BEGIN GlobalCurrency."Exchange Rate Amt." := CurrExchRate."Exchange Rate Amount"; END; END; IF ROUND(CurrExchRate."Relational Exch. Rate Amount",1) = CurrExchRate."Relational Exch. Rate Amount" THEN BEGIN IF CurrExchRate."Relational Exch. Rate Amount" <> GlobalCurrency."Relational Exch. Rate Amt." THEN BEGIN GlobalCurrency."Exchange Rate Amt." := 0; GlobalCurrency."Relational Exch. Rate Amt." := CurrExchRate."Relational Exch. Rate Amount"; END; END; END; GlobalCurrency.INSERT(TRUE); END; END; UNTIL Currency.NEXT = 0; END; IF GUIALLOWED THEN Window.CLOSE; END; PROCEDURE GetCurrencyRates@1000000004(CurrencyDate@1000000020 : Date); VAR GLSetup@1000000000 : Record 98; GlobalCurrency@1000000017 : Record 50001; GlobalRate@1000000016 : Record 50002; Window@1000000019 : Dialog; BEGIN IF CurrencyDate = 0D THEN EXIT; //See if there are Global Currencies for the Company GlobalCurrency.RESET; GlobalCurrency.SETRANGE("Company Name",COMPANYNAME); IF GlobalCurrency.ISEMPTY THEN EXIT; //Get the Local Currency Code GLSetup.GET; GLSetup.TESTFIELD("LCY Code"); //Clear the Existing Values GlobalRate.SETRANGE("Company Name",COMPANYNAME); GlobalRate.DELETEALL; //Open a Dialogue Window IF GUIALLOWED THEN BEGIN Window.OPEN(Text001 + Text002); Window.UPDATE(1,COMPANYNAME); Window.UPDATE(2,''); END; //Find the Record Set GlobalCurrency.FINDSET(FALSE); REPEAT IF GUIALLOWED THEN Window.UPDATE(2,STRSUBSTNO(Text003,GlobalCurrency."Currency Code",CurrencyDate)); //Insert the System Rate GlobalRate.INIT; GlobalRate."Company Name" := COMPANYNAME; GlobalRate."LCY Code" := GLSetup."LCY Code"; GlobalRate."Currency Code" := GlobalCurrency."Currency Code"; GlobalRate."Currency Date" := CurrencyDate; GlobalRate.INSERT(TRUE); UNTIL GlobalCurrency.NEXT = 0; IF GUIALLOWED THEN Window.CLOSE; END; PROCEDURE ApplyCurrencyRates@1000000006(); VAR GlobalRate@1000000016 : Record 50002; CurrExchRate@1000000001 : Record 330; Window@1000000019 : Dialog; BEGIN //Find any rates to Apply GlobalRate.RESET; GlobalRate.SETCURRENTKEY("Company Name","Currency Action"); GlobalRate.SETRANGE("Company Name",COMPANYNAME); GlobalRate.SETRANGE("Currency Action", GlobalRate."Currency Action"::"Insert Rate", GlobalRate."Currency Action"::"Update Rate" ); //No rates then Exit IF GlobalRate.ISEMPTY THEN EXIT; //Open a Dialogue Window IF GUIALLOWED THEN BEGIN Window.OPEN(Text001 + Text002); Window.UPDATE(1,COMPANYNAME); Window.UPDATE(2,''); END; //Find the Record Set to Edit GlobalRate.FINDSET(TRUE); REPEAT //Update the Window IF GUIALLOWED THEN Window.UPDATE(2,STRSUBSTNO(Text003, GlobalRate."Currency Code", GlobalRate."Currency Date") ); //See if there is a Record to Update IF CurrExchRate.GET( GlobalRate."Currency Code",GlobalRate."Currency Date")THEN BEGIN //Found a Record to Update CurrExchRate."Exchange Rate Amount" := GlobalRate."Exchange Rate Amount"; CurrExchRate."Adjustment Exch. Rate Amount" := GlobalRate."Exchange Rate Amount"; CurrExchRate."Relational Exch. Rate Amount" := GlobalRate."Relational Exch. Rate Amount"; CurrExchRate."Relational Adjmt Exch Rate Amt" := GlobalRate."Relational Exch. Rate Amount"; IF NOT CurrExchRate.INSERT THEN CurrExchRate.MODIFY; END ELSE BEGIN //No Record then Insert CurrExchRate.INIT; CurrExchRate."Currency Code" := GlobalRate."Currency Code"; CurrExchRate."Starting Date" := GlobalRate."Currency Date"; CurrExchRate."Exchange Rate Amount" := GlobalRate."Exchange Rate Amount"; CurrExchRate."Adjustment Exch. Rate Amount" := GlobalRate."Exchange Rate Amount"; CurrExchRate."Relational Exch. Rate Amount" := GlobalRate."Relational Exch. Rate Amount"; CurrExchRate."Relational Adjmt Exch Rate Amt" := GlobalRate."Relational Exch. Rate Amount"; CurrExchRate.INSERT; END; //Update the Record IF GlobalRate.Type = GlobalRate.Type::"Inverse Rate" THEN GlobalRate."Existing Rate Amount" := GlobalRate."Relational Exch. Rate Amount" ELSE GlobalRate."Existing Rate Amount" := GlobalRate."Exchange Rate Amount"; GlobalRate."Currency Action" := GlobalRate."Currency Action"::Applied; GlobalRate.MODIFY; UNTIL GlobalRate.NEXT = 0; //Close the Window IF GUIALLOWED THEN Window.CLOSE; END; BEGIN END. } } OBJECT Page 50004 Currency Dashboard { OBJECT-PROPERTIES { Date=27/10/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.00; } PROPERTIES { Editable=Yes; CaptionML=ENU=Currency Dashboard; InsertAllowed=No; DeleteAllowed=No; LinksAllowed=No; SourceTable=Table2000000006; PageType=Document; RefreshOnActivate=Yes; OnOpenPage=BEGIN SETRANGE(Name,COMPANYNAME); END; OnAfterGetRecord=VAR CurrencyExchangeRate@1000 : Record 330; BEGIN TESTFIELD(Name,COMPANYNAME); END; ActionList=ACTIONS { { 1900000004;0 ;ActionContainer; ActionContainerType=ActionItems } { 60 ;1 ;ActionGroup; CaptionML=[ENU=F&unctions; ENG=F&unctions]; Image=Action } { 1000000002;2 ;Action ; Name=Get Currency Lines; Promoted=Yes; Image=Currency; PromotedCategory=Process; OnAction=BEGIN CurrDashboardMgmt.GetCurrency; END; } { 1000000000;2 ;Action ; Name=Get System Currency Rates; Promoted=Yes; Image=GetLines; PromotedCategory=Process; OnAction=VAR Company@1000000000 : Record 2000000006; BEGIN Company.SETRANGE(Name,COMPANYNAME); REPORT.RUN(REPORT::"Get Currency Rates",TRUE,FALSE,Company); END; } { 1000000005;2 ;Action ; Name=Apply Exchange Rates; Promoted=Yes; Image=CurrencyExchangeRates; PromotedCategory=Process; OnAction=BEGIN CurrDashboardMgmt.ApplyCurrencyRates; END; } } } CONTROLS { { 1900000001;0;Container; ContainerType=ContentArea } { 1000000001;1;Part ; SubPageView=SORTING(Company Name); SubPageLink=Company Name=FIELD(Name); PagePartID=Page50005; Editable=TRUE; PartType=Page } { 1000000003;1;Part ; CaptionML=ENU=Currency Exchange Rate; SubPageView=SORTING(Company Name); SubPageLink=Company Name=FIELD(Name); PagePartID=Page50006; Editable=TRUE; PartType=Page } } CODE { VAR CurrDashboardMgmt@1000000000 : Codeunit 50002; BEGIN END. } } OBJECT Page 50005 Currency { OBJECT-PROPERTIES { Date=27/10/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.00; } PROPERTIES { Editable=Yes; CaptionML=ENU=Currencies; InsertAllowed=No; DeleteAllowed=No; LinksAllowed=No; SourceTable=Table50001; PageType=ListPart; ShowFilter=No; OnAfterGetRecord=VAR CurrencyExchangeRate@1000 : Record 330; BEGIN END; } CONTROLS { { 1900000001;0;Container; ContainerType=ContentArea } { 1 ;1 ;Group ; GroupType=Repeater } { 1000000004;2;Field ; SourceExpr="LCY Code" } { 1000000006;2;Field ; SourceExpr="Currency Code" } { 1000000007;2;Field ; SourceExpr=Description } { 1000000008;2;Field ; SourceExpr="Exchange Rate Amt." } { 1000000009;2;Field ; SourceExpr="Relational Exch. Rate Amt." } { 1000000010;2;Field ; SourceExpr=Type } } CODE { BEGIN END. } } OBJECT Page 50006 Currency Exchange Rate { OBJECT-PROPERTIES { Date=27/10/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.00; } PROPERTIES { Editable=Yes; CaptionML=ENU=Currency Exchange Rate; InsertAllowed=No; DeleteAllowed=No; LinksAllowed=No; SourceTable=Table50002; SourceTableView=SORTING(Company Name); PageType=ListPart; ShowFilter=No; OnAfterGetRecord=VAR CurrencyExchangeRate@1000 : Record 330; BEGIN RateEditable := Type = Type::"Normal Rate"; RelRateEditable := Type = Type::"Inverse Rate"; END; OnAfterGetCurrRecord=BEGIN RateEditable := Type = Type::"Normal Rate"; RelRateEditable := Type = Type::"Inverse Rate"; END; ActionList=ACTIONS { { 1000000005; ;ActionContainer; ActionContainerType=ActionItems } { 1000000012;1 ;ActionGroup; CaptionML=ENU=&Line } { 1000000010;2 ;Action ; Name=Currency Exchange Rates; CaptionML=ENU=Currency Exchange Rates; RunObject=Page 483; RunPageView=SORTING(Currency Code); RunPageLink=Currency Code=FIELD(Currency Code); Image=CurrencyExchangeRates } { 1000000013;2 ;Action ; Name=Show Information; CaptionML=ENU=Show Information; Image=Info; OnAction=BEGIN ShowInfo; END; } } } CONTROLS { { 1900000001;0;Container; ContainerType=ContentArea } { 1 ;1 ;Group ; GroupType=Repeater } { 1000000004;2;Field ; SourceExpr="LCY Code"; Editable=FALSE } { 1000000007;2;Field ; SourceExpr="Currency Date"; Editable=FALSE } { 1000000006;2;Field ; SourceExpr="Currency Code"; Editable=FALSE } { 1000000011;2;Field ; SourceExpr=Description; Editable=FALSE } { 1000000008;2;Field ; SourceExpr="Exchange Rate Amount"; Editable=RateEditable } { 1000000009;2;Field ; SourceExpr="Relational Exch. Rate Amount"; Editable=RelRateEditable } { 1000000001;2;Field ; SourceExpr="Existing Rate Amount" } { 1000000002;2;Field ; SourceExpr="Existing Rate Date" } { 1000000000;2;Field ; SourceExpr=Type; Visible=FALSE } { 1000000003;2;Field ; SourceExpr="Currency Action" } } CODE { VAR RateEditable@1000000001 : Boolean; RelRateEditable@1000000002 : Boolean; Text001@1000000000 : TextConst 'ENU="1 %1 = %2 %3\\"'; PROCEDURE ShowInfo@1000000000(); VAR CurrAmt@1000000000 : ARRAY [2] OF Decimal; BEGIN IF ("Exchange Rate Amount" = 0) OR ("Relational Exch. Rate Amount" = 0) OR ("Currency Factor" = 0) THEN EXIT; IF Type = Type::"Inverse Rate" THEN BEGIN CurrAmt[1] := ROUND("Exchange Rate Amount" / "Relational Exch. Rate Amount",0.000001); CurrAmt[2] := ROUND("Relational Exch. Rate Amount" / "Exchange Rate Amount",0.000001); END ELSE BEGIN CurrAmt[2] := ROUND("Relational Exch. Rate Amount" / "Exchange Rate Amount",0.000001); CurrAmt[1] := ROUND("Exchange Rate Amount" / "Relational Exch. Rate Amount",0.000001); END; MESSAGE( STRSUBSTNO(Text001,"LCY Code",CurrAmt[1],"Currency Code")+ STRSUBSTNO(Text001,"Currency Code",CurrAmt[2],"LCY Code") ); END; BEGIN END. } }