OBJECT Table 3 Payment Terms { OBJECT-PROPERTIES { Date=; Time=; Version List=; } PROPERTIES { DataCaptionFields=Code,Description; OnDelete=VAR PaymentTermsTranslation@1000 : Record 462; BEGIN WITH PaymentTermsTranslation DO BEGIN SETRANGE("Payment Term",Code); DELETEALL END; IF ApplicationManagement.AccessToCartera THEN BEGIN Installment.SETRANGE("Payment Terms Code",Code); Installment.DELETEALL; END; END; CaptionML=ENU=Payment Terms; LookupPageID=Page4; } FIELDS { { 1 ; ;Code ;Code10 ;CaptionML=ENU=Code; NotBlank=Yes } { 2 ; ;Due Date Calculation;DateFormula ;CaptionML=ENU=Due Date Calculation } { 3 ; ;Discount Date Calculation;DateFormula; CaptionML=ENU=Discount Date Calculation } { 4 ; ;Discount % ;Decimal ;CaptionML=ENU=Discount %; DecimalPlaces=0:6; MinValue=0; MaxValue=100 } { 5 ; ;Description ;Text50 ;CaptionML=ENU=Description } { 6 ; ;Calc. Pmt. Disc. on Cr. Memos;Boolean; CaptionML=ENU=Calc. Pmt. Disc. on Cr. Memos } { 10710; ;Max. No. of Days till Due Date;Integer; OnValidate=BEGIN IF "Max. No. of Days till Due Date" < 0 THEN ERROR(Text10701); END; CaptionML=ENU=Max. No. of Days till Due Date; BlankZero=Yes } { 7000000;;No. of Installments ;Integer ;FieldClass=FlowField; CalcFormula=Count(Installment WHERE (Payment Terms Code=FIELD(Code))); CaptionML=ENU=No. of Installments; BlankZero=Yes; Editable=No } { 7000002;;VAT distribution ;Option ;CaptionML=ENU=VAT distribution; OptionCaptionML=ENU=First Installment,Last Installment,Proportional; OptionString=First Installment,Last Installment,Proportional } } KEYS { { ;Code ;Clustered=Yes } } FIELDGROUPS { { 1 ;DropDown ;Code,Description,Due Date Calculation } } CODE { VAR Installment@1100000 : Record 7000018; ApplicationManagement@1100001 : Codeunit 1; Text10700@1100002 : TextConst '@@@=%1 is fieldcaption,%2 is fieldcaption,%3 is tablecaption;ENU=The %1 exceeds the %2 defined on the %3.'; Text10701@1100003 : TextConst 'ENU=The value must be greater than or equal to 0.'; PROCEDURE TranslateDescription@1(VAR PaymentTerms@1000 : Record 3;Language@1001 : Code[10]); VAR PaymentTermsTranslation@1002 : Record 462; BEGIN IF PaymentTermsTranslation.GET(PaymentTerms.Code,Language) THEN PaymentTerms.Description := PaymentTermsTranslation.Description; END; PROCEDURE CalculateMaxDueDate@1100000(BaseDate@1100000 : Date) : Date; BEGIN IF "Max. No. of Days till Due Date" = 0 THEN EXIT(31129999D); EXIT(CALCDATE(STRSUBSTNO('<%1D>',"Max. No. of Days till Due Date"),BaseDate)); END; PROCEDURE VerifyMaxNoDaysTillDueDate@1100002(DueDate@1100002 : Date;DocumentDate@1100003 : Date;MessageFieldCaption@1100001 : Text[50]); BEGIN IF (DueDate <> 0D) AND ("Max. No. of Days till Due Date" > 0) THEN IF DueDate - DocumentDate > "Max. No. of Days till Due Date" THEN ERROR(Text10700,MessageFieldCaption,FIELDCAPTION("Max. No. of Days till Due Date"),TABLECAPTION); END; BEGIN END. } }