OBJECT Table 50001 Global Currency { OBJECT-PROPERTIES { Date=02/11/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10.00,CM01; } PROPERTIES { OnInsert=BEGIN IF ("Exchange Rate Amount" = 0) AND ("Relational Exch. Rate Amount" = 0) THEN "Exchange Rate Amount" := 1; UpdateType; Updated := ROUNDDATETIME(CURRENTDATETIME,60000L); END; OnModify=BEGIN IF ("Exchange Rate Amount" = 0) AND ("Relational Exch. Rate Amount" = 0) THEN "Exchange Rate Amount" := 1; UpdateType; Updated := ROUNDDATETIME(CURRENTDATETIME,60000L); END; OnDelete=VAR GlobalRates@1000000000 : Record 50002; BEGIN GlobalRates.RESET; GlobalRates.SETRANGE(Name,Name); GlobalRates.SETRANGE("Currency Code","Currency Code"); GlobalRates.DELETEALL; END; CaptionML=ENU=Currency; } FIELDS { { 1 ; ;Name ;Text30 ;TableRelation=Company; ValidateTableRelation=No; TestTableRelation=No; CaptionML=ENU=Name; Editable=No } { 2 ; ;Currency Code ;Code10 ;CaptionML=ENU=Currency Code; NotBlank=Yes; 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 THEN "Relational Exch. Rate Amount" := 0; IF ("Exchange Rate Amount" = 0) AND ("Relational Exch. Rate Amount" = 0) THEN "Exchange Rate Amount" := xRec."Exchange Rate Amount"; UpdateType; END; CaptionML=ENU=Exchange Rate Amount; DecimalPlaces=0:0; MinValue=0; BlankZero=Yes; ValuesAllowed=[1;10;100;1,000;10,000] } { 6 ; ;Relational Exch. Rate Amount;Decimal; OnValidate=BEGIN IF "Relational Exch. Rate Amount" = xRec."Relational Exch. Rate Amount" THEN EXIT; IF "Relational Exch. Rate Amount" <> 0 THEN "Exchange Rate Amount" := 0; IF ("Exchange Rate Amount" = 0) AND ("Relational Exch. Rate Amount" = 0) THEN "Relational Exch. Rate Amount" := xRec."Relational Exch. Rate Amount"; UpdateType; END; CaptionML=ENU=Relational Exch. Rate Amount; DecimalPlaces=0:0; MinValue=0; BlankZero=Yes; ValuesAllowed=[1;10;100;1,000;10,000] } { 9 ; ;Updated ;DateTime ;CaptionML=ENU=Updated; 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 { { ;Name,Currency Code ;Clustered=Yes } } FIELDGROUPS { } CODE { LOCAL PROCEDURE UpdateType@1000000000(); BEGIN IF ("Exchange Rate Amount" <> 0) THEN IF ("Exchange Rate Amount" MOD 1 = 0) THEN Type := Type::"Inverse Rate" ELSE Type := Type::" "; IF ("Relational Exch. Rate Amount" <> 0) THEN IF ("Relational Exch. Rate Amount" MOD 1 = 0) THEN Type := Type::"Normal Rate" ELSE Type := Type::" "; IF ("Exchange Rate Amount" = 0) AND ("Relational Exch. Rate Amount" = 0)THEN Type := Type::" "; END; BEGIN END. } } OBJECT Table 50002 Global Exchange Rates { OBJECT-PROPERTIES { Date=02/11/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10.00,CM01; } PROPERTIES { OnInsert=BEGIN InitRate; UpdateStatus; Updated := ROUNDDATETIME(CURRENTDATETIME,1000L); END; OnModify=BEGIN IF Locked THEN ERROR(Text001); UpdateStatus; Updated := ROUNDDATETIME(CURRENTDATETIME,1000L); END; CaptionML=ENU=Global Exchange Rates; } FIELDS { { 1 ; ;Name ;Text30 ;TableRelation=Company; ValidateTableRelation=No; TestTableRelation=No; CaptionML=ENU=Name; Editable=No } { 2 ; ;Currency Code ;Code10 ;CaptionML=ENU=Currency Code; NotBlank=Yes; Editable=No } { 3 ; ;Date ;Date ;CaptionML=ENU=Date; Editable=No } { 4 ; ;LCY Code ;Code10 ;Editable=No } { 5 ; ;Exchange Rate ;Decimal ;OnValidate=VAR CurrencySetup@1000000000 : Record 50003; RoundTo@1000000001 : Text[10]; BEGIN IF "Exchange Rate" = xRec."Exchange Rate" THEN EXIT; IF ("Exchange Rate" = 0) AND ("Inverse Rate" = 0) THEN "Exchange Rate" := xRec."Exchange Rate"; IF "Exchange Rate" <> 0 THEN BEGIN CurrencySetup.GET; CurrencySetup.TESTFIELD(Precision); CASE CurrencySetup.Rounding OF CurrencySetup.Rounding::Nearest: RoundTo := '='; CurrencySetup.Rounding::"Round Up": RoundTo := '>'; CurrencySetup.Rounding::"Round Down": RoundTo := '<'; END; "Exchange Rate" := ROUND("Exchange Rate", CurrencySetup.Precision,RoundTo); "Inverse Rate" := ROUND(1 / "Exchange Rate", CurrencySetup.Precision,RoundTo); END ELSE "Inverse Rate" := 0; UpdateStatus; END; CaptionML=ENU=Exchange Rate; DecimalPlaces=1:6 } { 6 ; ;Inverse Rate ;Decimal ;OnValidate=VAR CurrencySetup@1000000000 : Record 50003; RoundTo@1000000001 : Text[10]; BEGIN IF "Inverse Rate" = xRec."Inverse Rate" THEN EXIT; IF "Inverse Rate" <> 0 THEN BEGIN CurrencySetup.GET; CurrencySetup.TESTFIELD(Precision); CASE CurrencySetup.Rounding OF CurrencySetup.Rounding::Nearest: RoundTo := '='; CurrencySetup.Rounding::"Round Up": RoundTo := '>'; CurrencySetup.Rounding::"Round Down": RoundTo := '<'; END; "Inverse Rate" := ROUND("Inverse Rate", CurrencySetup.Precision,RoundTo); "Exchange Rate" := ROUND(1 / "Inverse Rate", CurrencySetup.Precision,RoundTo); END ELSE "Exchange Rate" := 0; UpdateStatus; END; CaptionML=ENU=Inverse Rate; DecimalPlaces=1:6 } { 7 ; ;Existing Rate ;Decimal ;CaptionML=ENU=Existing Rate; DecimalPlaces=0:15; Editable=No } { 8 ; ;Existing Inverse Rate;Decimal ;CaptionML=ENU=Existing Inverse Rate; DecimalPlaces=1:6; Editable=No } { 9 ; ;Updated ;DateTime ;CaptionML=ENU=Updated; Editable=No } { 10 ; ;Description ;Text30 ;CaptionML=ENU=Description } { 11 ; ;Action ;Option ;CaptionML=ENU=Action; OptionString=Insert Rate,Update Rate,Skip Rate,Error,Applied; Editable=No } { 12 ; ;Type ;Option ;CaptionML=ENU=Type; OptionCaptionML=ENU=" ,Normal Rate,Inverse Rate"; OptionString=[ ,Normal Rate,Inverse Rate]; Editable=No } { 13 ; ;Locked ;Boolean ;CaptionML=ENU=Locked; Editable=No } { 14 ; ;Existing Date ;Date ;CaptionML=ENU=Existing Date; Editable=No } } KEYS { { ;Name,Currency Code,Date ;Clustered=Yes } { ;Name,Action } { ;LCY Code,Currency Code,Date } } FIELDGROUPS { } CODE { VAR Text001@1000000000 : TextConst 'ENU=Locked Entries Cannot Be Edited'; PROCEDURE InitRate@1000000002(); VAR CurrencySetup@1000000002 : Record 50003; GlobalCurrency@1000000001 : Record 50001; CurrExchRate@1000000000 : Record 330; BEGIN CurrencySetup.GET; IF Name = CurrencySetup.Name THEN EXIT; IF (Name = '')OR("Currency Code" = '')OR (Date = 0D) THEN EXIT; CurrExchRate.CHANGECOMPANY(Name); IF GlobalCurrency.GET(Name,"Currency Code") THEN BEGIN Description := GlobalCurrency.Description; CurrExchRate.RESET; CurrExchRate.SETRANGE("Currency Code","Currency Code"); CurrExchRate.SETRANGE("Starting Date",0D,Date); CurrExchRate.SETFILTER("Exchange Rate Amount",'<>0'); CurrExchRate.SETFILTER("Relational Exch. Rate Amount",'<>0'); IF CurrExchRate.FINDLAST THEN BEGIN IF CurrExchRate."Exchange Rate Amount" IN[1,10,100,1000,10000]THEN VALIDATE("Inverse Rate",CurrExchRate."Relational Exch. Rate Amount" / CurrExchRate."Exchange Rate Amount") ELSE VALIDATE("Exchange Rate",CurrExchRate."Exchange Rate Amount" / CurrExchRate."Relational Exch. Rate Amount"); "Existing Rate" := "Exchange Rate"; "Existing Inverse Rate" := "Inverse Rate"; "Existing Date" := CurrExchRate."Starting Date"; UpdateStatus; END ELSE Type := GlobalCurrency.Type; END; END; LOCAL PROCEDURE UpdateStatus@1000000001(); VAR GlobalCurrency@1000000000 : Record 50001; BEGIN //Set the Type IF NOT GlobalCurrency.GET(Name,"Currency Code")THEN BEGIN Action := Action::Error; EXIT; END; IF "Existing Rate" = 0 THEN Type := GlobalCurrency.Type; Description := GlobalCurrency.Description; IF ("Exchange Rate" = 0) AND ("Inverse Rate" = 0) THEN BEGIN Action := Action::"Skip Rate"; EXIT; END; IF "Inverse Rate" = "Existing Inverse Rate" THEN BEGIN Action := Action::"Skip Rate"; EXIT; END; IF (Date <> "Existing Date") THEN Action := Action::"Insert Rate" ELSE Action := Action::"Update Rate"; END; BEGIN END. } } OBJECT Table 50003 Currency Setup { OBJECT-PROPERTIES { Date=02/11/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10.00,CM01; } PROPERTIES { CaptionML=ENU=Currency Setup; } FIELDS { { 1 ; ;Primary Key ;Code10 ;CaptionML=[ENU=Primary Key; ENG=Primary Key] } { 2 ; ;Management ;Option ;OnValidate=VAR GLSetup@1000000000 : Record 98; BEGIN IF Management = xRec.Management THEN EXIT; IF Management = Management::"Manage All" THEN BEGIN Name := Text002; GLSetup.GET; GLSetup.TESTFIELD("LCY Code"); "Currency Code" := GLSetup."LCY Code"; END ELSE BEGIN Name := ''; "Currency Code" := ''; END; END; CaptionML=ENU=Management; OptionCaptionML=ENU=Manage LCY,View LCY,View All,View All - Manage LCY,Manage All; OptionString=Manage LCY,View LCY,View All,View All - Manage LCY,Manage All } { 3 ; ;Precision ;Decimal ;InitValue=0.000001; CaptionML=ENU=Precision; DecimalPlaces=0:6; MinValue=0.000001; MaxValue=0.001 } { 4 ; ;Rounding ;Option ;CaptionML=ENU=Rounding; OptionString=Nearest,Round Up,Round Down } { 5 ; ;Name ;Text30 ;OnValidate=VAR Company@1000000000 : Record 2000000006; BEGIN IF Name = xRec.Name THEN EXIT; IF Name = '' THEN BEGIN IF Management = Management::"Manage All" THEN ERROR(Text003,FIELDCAPTION(Name),FIELDCAPTION(Management), FORMAT(Management)); EXIT; END; IF Company.GET(Name)THEN ERROR(Text001,FIELDCAPTION(Name)); END; CaptionML=ENU=Name } { 6 ; ;Currency Code ;Code10 ;TableRelation=Currency; OnValidate=VAR GLSetup@1000000000 : Record 98; Currency@1000000001 : Record 4; BEGIN IF "Currency Code" = '' THEN BEGIN IF Management = Management::"Manage All" THEN ERROR(Text003,FIELDCAPTION("Currency Code"), FIELDCAPTION(Management),FORMAT(Management)); EXIT; END ELSE BEGIN GLSetup.GET; IF "Currency Code" = GLSetup."LCY Code" THEN EXIT; IF Currency.GET("Currency Code")THEN EXIT; ERROR(Text004,"Currency Code"); END; END; ValidateTableRelation=No; TestTableRelation=No; CaptionML=ENU=Currency Code } } KEYS { { ;Primary Key ;Clustered=Yes } } FIELDGROUPS { } CODE { VAR Text001@1000000000 : TextConst 'ENU=The %1 Cannot be the Same as an Existing Company'; Text002@1000000001 : TextConst 'ENU=Global Currency'; Text003@1000000002 : TextConst 'ENU=%1 must not be Blank when %2 is %3'; Text004@1000000003 : TextConst 'ENU=%1 is not a valid Currency Code'; BEGIN END. } } OBJECT Report 50002 Get Currency Rates { OBJECT-PROPERTIES { Date=02/11/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10.00,CM01; } PROPERTIES { ProcessingOnly=Yes; OnInitReport=BEGIN CurrencyDate := TODAY; CurrencySetup.GET; IF CurrencySetup.Management < CurrencySetup.Management::"View All" THEN Company.SETRANGE(Name,COMPANYNAME); END; OnPreReport=BEGIN IF CurrencyDate < TODAY THEN ERROR(Text001,TODAY); IF CurrencySetup.Management < CurrencySetup.Management::"View All" THEN Company.SETRANGE(Name,COMPANYNAME); END; } DATASET { { 1000000000;;DataItem; ; DataItemTable=Table2000000006; DataItemTableView=SORTING(Name); OnAfterGetRecord=VAR CurrencyMgmt@1000000000 : Codeunit 50002; BEGIN CLEAR(CurrencyMgmt); IF IsGlobal THEN CurrencyMgmt.GetGlobalCurrencyRates(CurrencyDate) ELSE CurrencyMgmt.GetCurrencyRates(Name,CurrencyDate); END; ReqFilterFields=Name } } 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 CurrencySetup@1000000002 : Record 50003; CurrencyDate@1000000000 : Date; Text001@1000000001 : TextConst 'ENU=The Currency Date Cannot be Blank or Before %1'; IsGlobal@1000000003 : Boolean; PROCEDURE SetGlobal@1000000000(Global@1000000000 : Boolean); BEGIN IsGlobal := Global; END; BEGIN END. } RDLDATA { } } OBJECT Codeunit 50002 Currency Dashboard Management { OBJECT-PROPERTIES { Date=02/11/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10.00,CM01; } 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 GetCurrencies@1000000005(CompName@1000000001 : Text[30]); VAR CurrencySetup@1000000005 : Record 50003; GLSetup@1000000018 : Record 98; Currency@1000000017 : Record 4; CurrExchRate@1000000002 : Record 330; GlobalCurrency@1000000000 : Record 50001; GlobalCurrency2@1000000004 : Record 50001; Window@1000000019 : Dialog; GlobalName@1000000003 : Text[30]; BEGIN IF CompName = '' THEN EXIT; GLSetup.CHANGECOMPANY(CompName); Currency.CHANGECOMPANY(CompName); CurrExchRate.CHANGECOMPANY(CompName); GLSetup.GET; GLSetup.TESTFIELD("LCY Code"); //Open a Dialogue Window IF GUIALLOWED THEN BEGIN Window.OPEN(Text001 + Text002); Window.UPDATE(1,CompName); Window.UPDATE(2,''); END; Currency.RESET; 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(CompName,Currency.Code) THEN BEGIN GlobalCurrency.INIT; GlobalCurrency.Name := CompName; 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 CurrExchRate."Exchange Rate Amount" IN[1,10,100,1000,10000] THEN BEGIN IF CurrExchRate."Exchange Rate Amount" <> GlobalCurrency."Exchange Rate Amount" THEN BEGIN GlobalCurrency."Exchange Rate Amount" := CurrExchRate."Exchange Rate Amount"; END; END; IF CurrExchRate."Relational Exch. Rate Amount" IN[1,10,100,1000,10000] THEN BEGIN IF CurrExchRate."Relational Exch. Rate Amount" <> GlobalCurrency."Relational Exch. Rate Amount" THEN BEGIN GlobalCurrency."Exchange Rate Amount" := 0; GlobalCurrency."Relational Exch. Rate Amount" := 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(CompName@1000000001 : Text[30];CurrencyDate@1000000020 : Date); VAR GLSetup@1000000000 : Record 98; GlobalCurrency@1000000017 : Record 50001; GlobalCurrency2@1000000005 : Record 50001; GlobalRate@1000000016 : Record 50002; Window@1000000019 : Dialog; BEGIN IF (CompName = '')OR(CurrencyDate = 0D) THEN EXIT; //See if there are Global Currencies for the Company GlobalCurrency.RESET; GlobalCurrency.SETRANGE(Name,CompName); IF GlobalCurrency.ISEMPTY THEN EXIT; //Get the Local Currency Code GLSetup.CHANGECOMPANY(CompName); GLSetup.GET; GLSetup.TESTFIELD("LCY Code"); //Clear the Existing Values GlobalRate.SETRANGE(Name,CompName); GlobalRate.DELETEALL; //Open a Dialogue Window IF GUIALLOWED THEN BEGIN Window.OPEN(Text001 + Text002); Window.UPDATE(1,CompName); 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.Name := CompName; GlobalRate."LCY Code" := GLSetup."LCY Code"; GlobalRate."Currency Code" := GlobalCurrency."Currency Code"; GlobalRate.Date := CurrencyDate; GlobalRate.INSERT(TRUE); UNTIL GlobalCurrency.NEXT = 0; IF GUIALLOWED THEN Window.CLOSE; END; PROCEDURE ApplyCurrencyRates@1000000006(CompName@1000000000 : Text[30]); VAR CurrencySetup@1000000004 : Record 50003; GlobalCurrency@1000000002 : Record 50001; GlobalRate@1000000016 : Record 50002; GlobalRate2@1000000005 : Record 50002; CurrExchRate@1000000001 : Record 330; Window@1000000019 : Dialog; RoundingPrecision@1000000003 : Decimal; BEGIN IF (CompName = '') THEN EXIT; CurrencySetup.GET; CurrencySetup.TESTFIELD(Precision); RoundingPrecision := CurrencySetup.Precision; //Find any rates to Apply GlobalRate.RESET; GlobalRate.SETCURRENTKEY(Name,Action); GlobalRate.SETRANGE(Name,CompName); GlobalRate.SETRANGE(Action, GlobalRate.Action::"Insert Rate", GlobalRate.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,CompName); Window.UPDATE(2,''); END; CurrExchRate.CHANGECOMPANY(CompName); CurrExchRate.RESET; //Find the Record Set to Edit GlobalRate.FINDSET(FALSE); REPEAT //Update the Window IF GUIALLOWED THEN Window.UPDATE(2,STRSUBSTNO(Text003, GlobalRate."Currency Code", GlobalRate.Date) ); IF GlobalCurrency.GET(CompName,GlobalRate."Currency Code") THEN BEGIN //No Record then Insert IF NOT CurrExchRate.GET( GlobalRate."Currency Code",GlobalRate.Date)THEN BEGIN CurrExchRate.INIT; CurrExchRate."Currency Code" := GlobalRate."Currency Code"; CurrExchRate."Starting Date" := GlobalRate.Date; CurrExchRate.INSERT; END; //Update the Record IF GlobalCurrency.Type = GlobalCurrency.Type::"Normal Rate" THEN BEGIN GlobalCurrency.TESTFIELD("Relational Exch. Rate Amount"); CurrExchRate."Exchange Rate Amount" := GlobalRate."Exchange Rate" * GlobalCurrency."Relational Exch. Rate Amount"; CurrExchRate."Relational Exch. Rate Amount" := GlobalCurrency."Relational Exch. Rate Amount"; END ELSE BEGIN GlobalCurrency.TESTFIELD("Exchange Rate Amount"); CurrExchRate."Relational Exch. Rate Amount" := GlobalRate."Inverse Rate" * GlobalCurrency."Exchange Rate Amount"; CurrExchRate."Exchange Rate Amount" := GlobalCurrency."Exchange Rate Amount"; END; CurrExchRate."Adjustment Exch. Rate Amount" := CurrExchRate."Exchange Rate Amount"; CurrExchRate."Relational Adjmt Exch Rate Amt" := CurrExchRate."Relational Exch. Rate Amount"; IF NOT CurrExchRate.INSERT THEN CurrExchRate.MODIFY; //Update the Record GlobalRate2 := GlobalRate; GlobalRate2.FIND; GlobalRate2."Existing Rate" := GlobalRate."Exchange Rate"; GlobalRate2."Existing Inverse Rate" := GlobalRate."Inverse Rate"; GlobalRate2."Existing Date" := GlobalRate.Date; GlobalRate2.Action := GlobalRate.Action::Applied; GlobalRate2.MODIFY; END; UNTIL GlobalRate.NEXT = 0; //Close the Window IF GUIALLOWED THEN Window.CLOSE; END; PROCEDURE GetGlobalCurrencies@1000000002(); VAR CurrencySetup@1000000005 : Record 50003; GLSetup@1000000018 : Record 98; GlobalCurrency@1000000000 : Record 50001; GlobalCurrency2@1000000004 : Record 50001; Window@1000000019 : Dialog; GlobalName@1000000003 : Text[30]; LCYCode@1000000002 : Code[10]; BEGIN CurrencySetup.GET; CurrencySetup.TESTFIELD(Name); CurrencySetup.TESTFIELD("Currency Code"); GlobalName := CurrencySetup.Name; LCYCode := CurrencySetup."Currency Code"; GlobalCurrency.RESET; GlobalCurrency.SETRANGE(Name,GlobalName); GlobalCurrency.DELETEALL; GlobalCurrency.RESET; IF GlobalCurrency.ISEMPTY THEN EXIT; //Open a Dialogue Window IF GUIALLOWED THEN BEGIN Window.OPEN(Text001 + Text002); Window.UPDATE(1,GlobalName); Window.UPDATE(2,''); END; GlobalCurrency.FINDSET(FALSE); REPEAT IF GUIALLOWED THEN Window.UPDATE(2,GlobalCurrency."Currency Code"); //Insert the Currency Record IF NOT GlobalCurrency2.GET( GlobalName,GlobalCurrency."Currency Code") THEN BEGIN GlobalCurrency2.INIT; GlobalCurrency2.TRANSFERFIELDS(GlobalCurrency); GlobalCurrency2.Name := GlobalName; GlobalCurrency2."LCY Code" := LCYCode; GlobalCurrency2."Exchange Rate Amount" := 1; GlobalCurrency2."Relational Exch. Rate Amount" := 0; GlobalCurrency2.INSERT(TRUE); END; UNTIL GlobalCurrency.NEXT = 0; IF NOT GlobalCurrency2.GET(GlobalName,LCYCode) THEN BEGIN GlobalCurrency2.INIT; GlobalCurrency2.TRANSFERFIELDS(GlobalCurrency); GlobalCurrency2.Name := GlobalName; GlobalCurrency2."LCY Code" := LCYCode; GlobalCurrency2."Exchange Rate Amount" := 1; GlobalCurrency2."Relational Exch. Rate Amount" := 0; GlobalCurrency2.INSERT(TRUE); END; IF GUIALLOWED THEN Window.CLOSE; END; PROCEDURE GetGlobalCurrencyRates@1000000000(CurrencyDate@1000000004 : Date); VAR CurrencySetup@1000000007 : Record 50003; Company@1000000002 : Record 2000000006; GLSetup@1000000009 : Record 98; GlobalCurrency@1000000000 : Record 50001; GlobalCurrency2@1000000005 : Record 50001; GlobalRate@1000000016 : Record 50002; GlobalRate2@1000000003 : Record 50002; LCYCode@1000000006 : Code[10]; Window@1000000019 : Dialog; GlobalName@1000000008 : Text[30]; BEGIN IF CurrencyDate = 0D THEN EXIT; //Get the Global Currency Name CurrencySetup.GET; CurrencySetup.TESTFIELD(Name); CurrencySetup.TESTFIELD("Currency Code"); GlobalName := CurrencySetup.Name; LCYCode := CurrencySetup."Currency Code"; //Any Currencies? GlobalCurrency.RESET; GlobalCurrency.SETRANGE(Name,GlobalName); IF GlobalCurrency.ISEMPTY THEN EXIT; GetGlobalRates(CurrencyDate); GlobalRate.RESET; IF GlobalRate.ISEMPTY THEN EXIT; //Open a Dialogue Window IF GUIALLOWED THEN BEGIN Window.OPEN(Text001 + Text002); Window.UPDATE(1,GlobalName); Window.UPDATE(2,''); END; //Populate Global Exchange Rates GlobalCurrency.RESET; GlobalCurrency.SETRANGE(Name,GlobalName); GlobalCurrency.FINDSET; REPEAT Window.UPDATE(2,STRSUBSTNO('%1 %2', GlobalCurrency."Currency Code", CurrencyDate)); IF NOT GlobalRate.GET( GlobalName,GlobalCurrency."Currency Code",CurrencyDate)THEN BEGIN //Insert a Record GlobalRate2.INIT; GlobalRate2.Name := GlobalName; GlobalRate2."LCY Code" := LCYCode; GlobalRate2."Currency Code" := GlobalCurrency."Currency Code"; GlobalRate2.Date := CurrencyDate; IF GlobalRate2."Currency Code" = LCYCode THEN BEGIN GlobalRate2."Exchange Rate" := 1; GlobalRate2."Inverse Rate" := 1; GlobalRate2.Locked := TRUE; END; GlobalRate2.INSERT(TRUE); END; UNTIL GlobalCurrency.NEXT = 0; IF GUIALLOWED THEN Window.CLOSE; END; LOCAL PROCEDURE GetGlobalRates@1000000003(CurrencyDate@1000000020 : Date); VAR CurrencySetup@1000000002 : Record 50003; GLSetup@1000000000 : Record 98; Company@1000000001 : Record 2000000006; GlobalCurrency@1000000017 : Record 50001; GlobalCurrency2@1000000005 : Record 50001; GlobalRate@1000000016 : Record 50002; GlobalRate2@1000000006 : Record 50002; Window@1000000019 : Dialog; GlobalName@1000000003 : Text[30]; LCYCode@1000000004 : Code[10]; BEGIN IF CurrencyDate = 0D THEN EXIT; //Get the Global Currency Name CurrencySetup.GET; CurrencySetup.TESTFIELD(Name); CurrencySetup.TESTFIELD("Currency Code"); GlobalName := CurrencySetup.Name; LCYCode := CurrencySetup."Currency Code"; GlobalRate.DELETEALL; GlobalRate2.INIT; GlobalRate2.Name := GlobalName; GlobalRate2."Currency Code" := LCYCode; GlobalRate2.Date := CurrencyDate; GlobalRate2."LCY Code" := LCYCode; GlobalRate2."Exchange Rate" := 1; GlobalRate2."Inverse Rate" := 1; GlobalRate2.Locked := TRUE; GlobalRate2.INSERT(TRUE); //Open a Dialogue Window IF GUIALLOWED THEN BEGIN Window.OPEN(Text001 + Text002); Window.UPDATE(1,''); Window.UPDATE(2,''); END; Company.RESET; Company.FINDSET; REPEAT Window.UPDATE(1,Company.Name); //See if there are Global Currencies for the Company GlobalCurrency.RESET; GlobalCurrency.SETRANGE(Name,Company.Name); IF GlobalCurrency.FINDSET(FALSE) THEN BEGIN //Get the Local Currency Code GLSetup.CHANGECOMPANY(Company.Name); GLSetup.GET; GLSetup.TESTFIELD("LCY Code"); //Find the Record Set GlobalCurrency.FINDSET(FALSE); REPEAT IF GUIALLOWED THEN Window.UPDATE(2, STRSUBSTNO(Text003,GlobalCurrency."Currency Code",CurrencyDate)); IF GlobalCurrency2.GET( GlobalName,GlobalCurrency."Currency Code")THEN BEGIN //Insert the System Rate GlobalRate.INIT; GlobalRate.Name := GlobalCurrency.Name; GlobalRate."LCY Code" := GLSetup."LCY Code"; GlobalRate."Currency Code" := GlobalCurrency."Currency Code"; GlobalRate.Date := CurrencyDate; GlobalRate.Locked := TRUE; GlobalRate.INSERT(TRUE); IF(GlobalRate."LCY Code" = LCYCode)THEN BEGIN GlobalRate2 := GlobalRate; GlobalRate2.Name := GlobalName; GlobalRate2.Locked := FALSE; IF NOT GlobalRate2.FIND THEN GlobalRate2.INSERT(TRUE); END; END; UNTIL GlobalCurrency.NEXT = 0; END; UNTIL Company.NEXT = 0; IF GUIALLOWED THEN Window.CLOSE; END; PROCEDURE SetGlobalCurrencyRate@1000000001(); VAR CurrencySetup@1000000000 : Record 50003; GlobalCurrency@1000000001 : Record 50001; GlobalRate@1000000003 : ARRAY [3] OF Record 50002; LCYCode@1000000006 : Code[10]; GlobalName@1000000008 : Text[30]; RoundTo@1000000007 : Text[10]; Window@1000000019 : Dialog; RoundingPrecision@1000000002 : Decimal; TriangulationRate@1000000004 : ARRAY [4] OF Decimal; UpdatedDT@1000000005 : DateTime; BEGIN CurrencySetup.GET; CurrencySetup.TESTFIELD(Precision); CurrencySetup.TESTFIELD(Name); GlobalName := CurrencySetup.Name; GlobalRate[1].RESET; GlobalRate[1].SETFILTER(Name,GlobalName); GlobalRate[1].SETRANGE(Action, GlobalRate[1].Action::"Insert Rate", GlobalRate[1].Action::"Update Rate" ); IF GlobalRate[1].ISEMPTY THEN EXIT; UpdatedDT := ROUNDDATETIME(CURRENTDATETIME - 10000,1000L); RoundingPrecision := CurrencySetup.Precision; CASE CurrencySetup.Rounding OF CurrencySetup.Rounding::Nearest: RoundTo := '='; CurrencySetup.Rounding::"Round Up": RoundTo := '>'; CurrencySetup.Rounding::"Round Down": RoundTo := '<'; END; //Open a Dialogue Window IF GUIALLOWED THEN BEGIN Window.OPEN(Text001 + Text002); Window.UPDATE(1,''); Window.UPDATE(2,''); END; GlobalRate[1].FINDSET(FALSE); IF GUIALLOWED THEN Window.UPDATE(1,LCYCode); REPEAT IF GUIALLOWED THEN Window.UPDATE(2,STRSUBSTNO('%1 %2',GlobalRate[1]."LCY Code",GlobalRate[1].Date)); //Matching Entries Set Normal Rate GlobalRate[2].RESET; GlobalRate[2].SETFILTER(Name,'<>%1',GlobalName); GlobalRate[2].SETRANGE("LCY Code",GlobalRate[1]."LCY Code"); GlobalRate[2].SETRANGE("Currency Code",GlobalRate[1]."Currency Code"); GlobalRate[2].SETRANGE(Date,GlobalRate[1].Date); IF GlobalRate[2].FINDSET(FALSE)THEN BEGIN REPEAT IF GlobalCurrency.GET(GlobalName,GlobalRate[2]."Currency Code") THEN BEGIN TriangulationRate[1] := GlobalRate[2]."Exchange Rate"; GlobalRate[3] := GlobalRate[2]; GlobalRate[3].FIND; IF TriangulationRate[1] <> GlobalRate[3]."Exchange Rate" THEN BEGIN GlobalRate[3].VALIDATE("Exchange Rate",TriangulationRate[1]); GlobalRate[3].Updated := UpdatedDT; GlobalRate[3].MODIFY; END; END; UNTIL GlobalRate[2].NEXT = 0; END; //Matching Entries Set Inverse Rate GlobalRate[2].RESET; GlobalRate[2].SETFILTER(Name,'<>%1',GlobalName); GlobalRate[2].SETRANGE("LCY Code",GlobalRate[1]."Currency Code"); GlobalRate[2].SETRANGE("Currency Code",GlobalRate[1]."LCY Code"); GlobalRate[2].SETRANGE(Date,GlobalRate[1].Date); IF GlobalRate[2].FINDSET(FALSE)THEN BEGIN REPEAT IF GlobalCurrency.GET(GlobalName,GlobalRate[2]."LCY Code") THEN BEGIN TriangulationRate[1] := GlobalRate[1]."Exchange Rate"; GlobalRate[3] := GlobalRate[2]; GlobalRate[3].FIND; IF TriangulationRate[1] <> GlobalRate[3]."Inverse Rate" THEN BEGIN GlobalRate[3].VALIDATE("Inverse Rate",TriangulationRate[1]); GlobalRate[3].Updated := UpdatedDT; GlobalRate[3].MODIFY; END; END; UNTIL GlobalRate[2].NEXT = 0; END; //Triangulate GlobalRate[2].RESET; GlobalRate[2].SETFILTER(Name,'<>%1',GlobalName); GlobalRate[2].SETRANGE("Currency Code",GlobalRate[1]."Currency Code"); GlobalRate[2].SETRANGE(Date,GlobalRate[1].Date); IF GlobalRate[2].FINDSET(FALSE)THEN BEGIN REPEAT IF GlobalRate[2].Updated <> UpdatedDT THEN BEGIN IF GlobalCurrency.GET( GlobalName,GlobalRate[2]."Currency Code") THEN BEGIN CLEAR(TriangulationRate); IF GlobalRate[3].GET( GlobalName,GlobalRate[2]."Currency Code",GlobalRate[2].Date)THEN IF GlobalRate[3]."Exchange Rate" <> 0 THEN TriangulationRate[2] := GlobalRate[3]."Exchange Rate"; IF GlobalRate[3].GET( GlobalName,GlobalRate[2]."LCY Code",GlobalRate[2].Date)THEN IF GlobalRate[3]."Exchange Rate" <> 0 THEN TriangulationRate[3] := GlobalRate[3]."Exchange Rate"; IF TriangulationRate[2] <> 0 THEN BEGIN TriangulationRate[4] := TriangulationRate[3] / TriangulationRate[2]; TriangulationRate[1] := ROUND(1 / TriangulationRate[4],RoundingPrecision,RoundTo); END; IF (TriangulationRate[1] <> 0) AND (TriangulationRate[1] <> GlobalRate[2]."Exchange Rate") THEN BEGIN TriangulationRate[1] := 1 / TriangulationRate[4]; GlobalRate[3] := GlobalRate[2]; GlobalRate[3].FIND; GlobalRate[3].VALIDATE("Exchange Rate",TriangulationRate[1]); GlobalRate[3].MODIFY; END; END; END; UNTIL GlobalRate[2].NEXT = 0; END; UNTIL GlobalRate[1].NEXT = 0; END; BEGIN END. } } OBJECT MenuSuite 1060 Dept - Add-on 10 Currency Mgmt { OBJECT-PROPERTIES { Date=02/11/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10.00,CM01; } PROPERTIES { } MENUNODES { { MenuGroup ;[{A1659947-CAFA-4C10-8CEE-CDEE7776584D}] ;Name=Currency Management; CaptionML=ENU=Currency Management; MemberOfMenu=[{F8D2429D-034B-4C58-9B5E-81BE962DB1BC}]; ParentNodeID=[{E58D3A70-4058-41B4-B455-A4B10C1FAA66}]; Visible=Yes; NextNodeID=[{2ACDDD7C-B22F-484A-99B0-ECBC5F17B328}]; FirstChild=[{12C1F5B7-0F9C-4637-AF6B-7DFA8ACEC163}]; IsDepartmentPage=Yes } { ;[{5858D635-8860-415E-8A06-3136300DC59B}] ;NextNodeID=[{A1659947-CAFA-4C10-8CEE-CDEE7776584D}] } { MenuItem ;[{12C1F5B7-0F9C-4637-AF6B-7DFA8ACEC163}] ;Name=Currency Setup; CaptionML=ENU=Currency Setup; MemberOfMenu=[{F8D2429D-034B-4C58-9B5E-81BE962DB1BC}]; RunObjectType=Page; RunObjectID=50007; ParentNodeID=[{A1659947-CAFA-4C10-8CEE-CDEE7776584D}]; Visible=Yes; NextNodeID=[{69411666-E7F9-4FBB-946E-3FE0507C3D6B}]; DepartmentCategory=Administration } { MenuItem ;[{69411666-E7F9-4FBB-946E-3FE0507C3D6B}] ;Name=Currency Worksheet; CaptionML=ENU=Currency Worksheet; MemberOfMenu=[{F8D2429D-034B-4C58-9B5E-81BE962DB1BC}]; RunObjectType=Page; RunObjectID=50004; ParentNodeID=[{A1659947-CAFA-4C10-8CEE-CDEE7776584D}]; Visible=Yes; NextNodeID=[{1A23871A-9E78-462E-AD2E-F6E2CCCF57F2}]; DepartmentCategory=Administration } { MenuItem ;[{1A23871A-9E78-462E-AD2E-F6E2CCCF57F2}] ;Name=Global Currency Worksheet; CaptionML=ENU=Global Currency Worksheet; MemberOfMenu=[{F8D2429D-034B-4C58-9B5E-81BE962DB1BC}]; RunObjectType=Page; RunObjectID=50008; ParentNodeID=[{A1659947-CAFA-4C10-8CEE-CDEE7776584D}]; Visible=Yes; NextNodeID=[{00000000-0000-0000-0000-000000000000}]; DepartmentCategory=Administration } } } OBJECT Page 50004 Currency Worksheet { OBJECT-PROPERTIES { Date=02/11/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10.00,CM01; } PROPERTIES { Editable=Yes; CaptionML=ENU=Currency Worksheet; InsertAllowed=No; DeleteAllowed=No; LinksAllowed=No; SourceTable=Table2000000006; PageType=Document; RefreshOnActivate=Yes; OnInit=BEGIN IF NOT CurrencySetup.GET THEN BEGIN CurrencySetup.INIT; CurrencySetup.INSERT(TRUE); END; END; OnOpenPage=BEGIN CurrencySetup.GET; IF CurrencySetup.Management < CurrencySetup.Management::"View All" THEN SETRANGE(Name,COMPANYNAME) ELSE BEGIN SETRANGE(Name); GET(COMPANYNAME); END; ManageGlobal := CurrencySetup.Management = CurrencySetup.Management::"Manage All"; END; OnAfterGetRecord=VAR CurrencyExchangeRate@1000 : Record 330; BEGIN IF Name = COMPANYNAME THEN ManageCurrencies := (CurrencySetup.Management = CurrencySetup.Management::"Manage LCY")OR (CurrencySetup.Management > CurrencySetup.Management::"View All") ELSE ManageCurrencies := CurrencySetup.Management = CurrencySetup.Management::"Manage All"; GLSetup.CHANGECOMPANY(Name); GLSetup.GET; GLSetup.TESTFIELD("LCY Code"); 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 Currencies; CaptionML=ENU=Get Currencies; Promoted=Yes; PromotedIsBig=Yes; Image=Currency; PromotedCategory=Process; OnAction=BEGIN CLEAR(CurrDashboardMgmt); CurrDashboardMgmt.GetCurrencies(Name); END; } { 1000000000;2 ;Action ; Name=Get Currency Rates; CaptionML=ENU=Get Currency Rates; Promoted=Yes; PromotedIsBig=Yes; Image=RefreshLines; PromotedCategory=Process; OnAction=VAR Company@1000000000 : Record 2000000006; BEGIN IF CurrencySetup.Management < CurrencySetup.Management::"View All" THEN Company.SETRANGE(Name,COMPANYNAME) ELSE Company.SETRANGE(Name,Name); REPORT.RUN(REPORT::"Get Currency Rates",TRUE,FALSE,Company); END; } { 1000000005;2 ;Action ; Name=Apply Exchange Rates; Promoted=Yes; Enabled=ManageCurrencies; Image=InsertCurrency; PromotedCategory=Process; OnAction=BEGIN CLEAR(CurrDashboardMgmt); CurrDashboardMgmt.ApplyCurrencyRates(Name); END; } { 1000000008;2 ;Action ; Name=Global Currency Card; RunObject=Page 50008; Promoted=Yes; Enabled=ManageGlobal; Image=AdjustExchangeRates; PromotedCategory=Process } } } CONTROLS { { 1900000001;0;Container; ContainerType=ContentArea } { 1000000007;1;Group ; CaptionML=ENU=Company; GroupType=Group } { 1000000004;2;Field ; CaptionML=ENU=Currency Management; SourceExpr=FORMAT(CurrencySetup.Management); Enabled=FALSE } { 1000000006;2;Field ; CaptionML=ENU=Local Currency Code; SourceExpr=GLSetup."LCY Code"; Enabled=FALSE } { 1000000001;1;Part ; SubPageView=SORTING(Name); SubPageLink=Name=FIELD(Name); PagePartID=Page50005; Editable=ManageCurrencies; PartType=Page } { 1000000003;1;Part ; CaptionML=ENU=Currency Exchange Rate; SubPageView=SORTING(Name); SubPageLink=Name=FIELD(Name); PagePartID=Page50006; Editable=ManageCurrencies; PartType=Page } } CODE { VAR GLSetup@1000000003 : Record 98; CurrencySetup@1000000001 : Record 50003; CurrDashboardMgmt@1000000000 : Codeunit 50002; ManageCurrencies@1000000002 : Boolean INDATASET; ManageGlobal@1000000004 : Boolean; BEGIN END. } } OBJECT Page 50005 Currency { OBJECT-PROPERTIES { Date=02/11/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10.00,CM01; } PROPERTIES { Editable=Yes; CaptionML=ENU=Currencies; InsertAllowed=No; LinksAllowed=No; SourceTable=Table50001; PageType=ListPart; ShowFilter=No; OnOpenPage=BEGIN CurrencySetup.GET; END; OnAfterGetRecord=VAR CurrencyExchangeRate@1000 : Record 330; BEGIN IsGlobal := Name = CurrencySetup.Name; END; } CONTROLS { { 1900000001;0;Container; ContainerType=ContentArea } { 1 ;1 ;Group ; GroupType=Repeater } { 1000000000;2;Field ; SourceExpr="LCY Code"; Visible=IsGlobal; Editable=FALSE } { 1000000006;2;Field ; SourceExpr="Currency Code" } { 1000000007;2;Field ; SourceExpr=Description } { 1000000008;2;Field ; SourceExpr="Exchange Rate Amount" } { 1000000009;2;Field ; SourceExpr="Relational Exch. Rate Amount" } { 1000000010;2;Field ; SourceExpr=Type } } CODE { VAR CurrencySetup@1000000001 : Record 50003; IsGlobal@1000000000 : Boolean; BEGIN END. } } OBJECT Page 50006 Currency Exchange Rate { OBJECT-PROPERTIES { Date=02/11/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10.00,CM01; } PROPERTIES { Editable=Yes; CaptionML=ENU=Currency Exchange Rate; InsertAllowed=No; LinksAllowed=No; SourceTable=Table50002; SourceTableView=SORTING(Name); PageType=ListPart; ShowFilter=No; OnOpenPage=BEGIN CurrencySetup.GET; END; OnAfterGetRecord=VAR CurrencyExchangeRate@1000 : Record 330; BEGIN IsGlobal := Name = CurrencySetup.Name; 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; Image=CurrencyExchangeRates; OnAction=BEGIN GetExchangeRates; END; } { 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"; Visible=IsGlobal; Editable=FALSE } { 1000000007;2;Field ; SourceExpr=Date; Editable=FALSE } { 1000000006;2;Field ; SourceExpr="Currency Code"; Editable=FALSE } { 1000000011;2;Field ; SourceExpr=Description; Editable=FALSE } { 1000000008;2;Field ; SourceExpr="Exchange Rate" } { 1000000009;2;Field ; SourceExpr="Inverse Rate" } { 1000000015;2;Field ; SourceExpr="Existing Rate" } { 1000000001;2;Field ; SourceExpr="Existing Inverse Rate" } { 1000000002;2;Field ; SourceExpr="Existing Date" } { 1000000000;2;Field ; SourceExpr=Type; Visible=FALSE } { 1000000003;2;Field ; SourceExpr=Action } { 1000000014;2;Field ; SourceExpr=Locked } } CODE { VAR CurrencySetup@1000000004 : Record 50003; RateEditable@1000000001 : Boolean; RelRateEditable@1000000002 : Boolean; Text001@1000000000 : TextConst 'ENU="%1 1 %2 = %3 %4\\"'; IsGlobal@1000000003 : Boolean; PROCEDURE ShowInfo@1000000000(); VAR CurrAmt@1000000000 : ARRAY [2] OF Decimal; BEGIN IF ("Exchange Rate" = 0) OR ("Inverse Rate" = 0) THEN EXIT; MESSAGE( STRSUBSTNO(Text001,FORMAT(Type::"Normal Rate"),"LCY Code","Exchange Rate","Currency Code")+ STRSUBSTNO(Text001,FORMAT(Type::"Inverse Rate"),"Currency Code","Inverse Rate","LCY Code") ); END; PROCEDURE GetExchangeRates@1000000001(); VAR CurrExchRate@1000000000 : Record 330; TempCurrExchRate@1000000002 : TEMPORARY Record 330; CurrExchRateList@1000000001 : Page 50008; BEGIN IF Name = CurrencySetup.Name THEN EXIT; CurrExchRate.CHANGECOMPANY(Name); CurrExchRate.SETRANGE("Currency Code","Currency Code"); IF CurrExchRate.ISEMPTY THEN EXIT; TempCurrExchRate.DELETEALL; CurrExchRate.FINDSET(FALSE); REPEAT TempCurrExchRate.INIT; TempCurrExchRate.TRANSFERFIELDS(CurrExchRate); TempCurrExchRate.INSERT; UNTIL CurrExchRate.NEXT = 0; TempCurrExchRate.FINDSET; PAGE.RUN(PAGE::"Exchange Rates Lookup",TempCurrExchRate); END; BEGIN END. } } OBJECT Page 50007 Currency Setup { OBJECT-PROPERTIES { Date=02/11/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10.00,CM01; } PROPERTIES { CaptionML=ENU=Currency Setup; InsertAllowed=No; DeleteAllowed=No; SourceTable=Table50003; PageType=Card; OnOpenPage=BEGIN RESET; IF NOT GET THEN BEGIN INIT; INSERT; END; END; } CONTROLS { { 1900000001;0;Container; ContainerType=ContentArea } { 1 ;1 ;Group ; CaptionML=ENU=Currency; GroupType=Group } { 1000000000;2;Field ; SourceExpr=Management } { 1000000001;2;Field ; SourceExpr=Precision } { 1000000002;2;Field ; SourceExpr=Rounding } { 1000000004;1;Group ; CaptionML=ENU=Global Currency; Enabled="Management" = "Management"::"Manage All"; GroupType=Group } { 1000000003;2;Field ; SourceExpr=Name } { 1000000005;2;Field ; SourceExpr="Currency Code" } { 1900000007;0;Container; ContainerType=FactBoxArea } { 1900383207;1;Part ; Visible=FALSE; PartType=System; SystemPartID=RecordLinks } { 1905767507;1;Part ; Visible=FALSE; PartType=System; SystemPartID=Notes } } CODE { BEGIN END. } } OBJECT Page 50008 Global Currency Worksheet { OBJECT-PROPERTIES { Date=02/11/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10.00,CM01; } PROPERTIES { Editable=Yes; CaptionML=ENU=Global Currency Worksheet; InsertAllowed=No; DeleteAllowed=No; LinksAllowed=No; SourceTable=Table50003; PageType=Document; RefreshOnActivate=Yes; OnInit=BEGIN IF NOT GET THEN BEGIN INIT; INSERT(TRUE); END; END; OnOpenPage=BEGIN CurrencySetup.GET; ManageCurrencies := CurrencySetup.Management = CurrencySetup.Management::"Manage All"; END; OnAfterGetRecord=VAR CurrencyExchangeRate@1000 : Record 330; BEGIN END; ActionList=ACTIONS { { 1900000004;0 ;ActionContainer; ActionContainerType=ActionItems } { 60 ;1 ;ActionGroup; CaptionML=[ENU=F&unctions; ENG=F&unctions]; Image=Action } { 1000000004;2 ;Action ; Name=Get Currencies; CaptionML=ENU=Get Currencies; Promoted=Yes; Enabled=ManageCurrencies; PromotedIsBig=Yes; Image=Currency; PromotedCategory=Process; OnAction=BEGIN CLEAR(CurrDashboardMgmt); CurrDashboardMgmt.GetGlobalCurrencies; END; } { 1000000000;2 ;Action ; Name=Get Currency Rates; CaptionML=ENU=Get Currency Rates; Promoted=Yes; Enabled=ManageCurrencies; PromotedIsBig=Yes; Image=RefreshLines; PromotedCategory=Process; OnAction=VAR Company@1000000000 : Record 2000000006; GetCurrencyRates@1000000001 : Report 50002; BEGIN Company.SETRANGE(Name,COMPANYNAME); CLEAR(GetCurrencyRates); GetCurrencyRates.SetGlobal(TRUE); GetCurrencyRates.SETTABLEVIEW(Company); GetCurrencyRates.RUN; END; } { 1000000002;2 ;Action ; Name=Set Currency Rates; Promoted=Yes; Enabled=ManageCurrencies; PromotedIsBig=Yes; Image=InsertCurrency; PromotedCategory=Process; OnAction=BEGIN CurrDashboardMgmt.SetGlobalCurrencyRate; END; } } } CONTROLS { { 1900000001;0;Container; ContainerType=ContentArea } { 1000000001;1;Part ; SubPageView=SORTING(Name); SubPageLink=Name=FIELD(Name); PagePartID=Page50005; Editable=ManageCurrencies; PartType=Page } { 1000000003;1;Part ; CaptionML=ENU=Currency Exchange Rate; SubPageView=SORTING(Name); SubPageLink=Name=FIELD(Name); PagePartID=Page50006; Editable=ManageCurrencies; PartType=Page } } CODE { VAR GLSetup@1000000003 : Record 98; CurrencySetup@1000000001 : Record 50003; CurrDashboardMgmt@1000000000 : Codeunit 50002; ManageCurrencies@1000000002 : Boolean INDATASET; BEGIN END. } } OBJECT Page 50009 Exchange Rates Lookup { OBJECT-PROPERTIES { Date=02/11/14; Time=13:00:00; Modified=Yes; Version List=NAVW17.10.00,CM01; } PROPERTIES { Editable=No; CaptionML=[ENU=Currency Exchange Rates; ENG=Currency Exchange Rates]; SourceTable=Table330; DataCaptionFields=Currency Code; PageType=List; SourceTableTemporary=Yes; OnInsertRecord=VAR CurrExchRate@1001 : Record 330; BEGIN CurrExchRate := xRec; IF NOT BelowxRec THEN BEGIN CurrExchRate.COPYFILTERS(Rec); IF CurrExchRate.NEXT(-1) <> 0 THEN TRANSFERFIELDS(CurrExchRate,FALSE) END ELSE TRANSFERFIELDS(CurrExchRate,FALSE) END; } CONTROLS { { 1900000001;0;Container; ContainerType=ContentArea } { 1 ;1 ;Group ; GroupType=Repeater } { 2 ;2 ;Field ; SourceExpr="Starting Date" } { 17 ;2 ;Field ; SourceExpr="Currency Code" } { 19 ;2 ;Field ; SourceExpr="Relational Currency Code" } { 4 ;2 ;Field ; SourceExpr="Exchange Rate Amount" } { 13 ;2 ;Field ; SourceExpr="Relational Exch. Rate Amount" } { 6 ;2 ;Field ; SourceExpr="Adjustment Exch. Rate Amount" } { 21 ;2 ;Field ; SourceExpr="Relational Adjmt Exch Rate Amt" } { 15 ;2 ;Field ; SourceExpr="Fix Exchange Rate Amount" } { 1900000007;0;Container; ContainerType=FactBoxArea } { 1900383207;1;Part ; Visible=FALSE; PartType=System; SystemPartID=RecordLinks } { 1905767507;1;Part ; Visible=FALSE; PartType=System; SystemPartID=Notes } } CODE { BEGIN END. } }