Class MPeriod

    • Constructor Detail

      • MPeriod

        public MPeriod​(Properties ctx,
                       int C_Period_ID,
                       String trxName)
        Standard Constructor
        Parameters:
        ctx - context
        C_Period_ID - id
        trxName - transaction
      • MPeriod

        public MPeriod​(Properties ctx,
                       ResultSet rs,
                       String trxName)
        Load Constructor
        Parameters:
        ctx - context
        rs - result set
        trxName - transaction
      • MPeriod

        public MPeriod​(MYear year,
                       int PeriodNo,
                       String name,
                       Timestamp startDate,
                       Timestamp endDate)
        Parent constructor
        Parameters:
        year - year
        PeriodNo - no
        name - name
        startDate - start
        endDate - end
      • MPeriod

        public MPeriod​(MPeriod copy)
        Parameters:
        copy -
      • MPeriod

        public MPeriod​(Properties ctx,
                       MPeriod copy)
        Parameters:
        ctx -
        copy -
    • Method Detail

      • get

        public static MPeriod get​(int C_Period_ID)
        Get Period from Cache (immutable)
        Parameters:
        C_Period_ID - id
        Returns:
        MPeriod
      • get

        public static MPeriod get​(Properties ctx,
                                  int C_Period_ID)
        Get Period from Cache (immutable)
        Parameters:
        ctx - context
        C_Period_ID - id
        Returns:
        MPeriod
      • get

        public static MPeriod get​(Properties ctx,
                                  Timestamp DateAcct)
        Deprecated.
        Find standard Period of DateAcct based on Client Calendar
        Parameters:
        ctx - context
        DateAcct - date
        Returns:
        active Period or null
      • get

        public static MPeriod get​(Properties ctx,
                                  Timestamp DateAcct,
                                  int AD_Org_ID,
                                  String trxName)
        Find standard Period of DateAcct based on Client Calendar
        Parameters:
        ctx - context
        DateAcct - date
        AD_Org_ID - Organization
        Returns:
        active Period or null
      • getCopy

        public static MPeriod getCopy​(Properties ctx,
                                      int C_Period_ID,
                                      String trxName)
        Get updateable copy of MPeriod from cache
        Parameters:
        ctx -
        C_Period_ID -
        trxName -
        Returns:
        MPeriod
      • findByCalendar

        public static MPeriod findByCalendar​(Properties ctx,
                                             Timestamp DateAcct,
                                             int C_Calendar_ID)
        Deprecated.
        Parameters:
        ctx -
        DateAcct -
        C_Calendar_ID -
        Returns:
        MPeriod
      • findByCalendar

        public static MPeriod findByCalendar​(Properties ctx,
                                             Timestamp DateAcct,
                                             int C_Calendar_ID,
                                             String trxName)
        Parameters:
        ctx -
        DateAcct -
        C_Calendar_ID -
        trxName -
        Returns:
        MPeriod
      • getC_Period_ID

        public static int getC_Period_ID​(Properties ctx,
                                         Timestamp DateAcct)
        Deprecated.
        Find valid standard Period of DateAcct based on Client Calendar
        Parameters:
        ctx - context
        DateAcct - date
        Returns:
        C_Period_ID or 0
      • getC_Period_ID

        public static int getC_Period_ID​(Properties ctx,
                                         Timestamp DateAcct,
                                         int AD_Org_ID)
        Find valid standard Period of DateAcct based on Client Calendar
        Parameters:
        ctx - context
        DateAcct - date
        AD_Org_ID - Organization
        Returns:
        C_Period_ID or 0
      • isOpen

        public static boolean isOpen​(Properties ctx,
                                     Timestamp DateAcct,
                                     String DocBaseType)
        Deprecated.
        Is standard Period Open for Document Base Type
        Parameters:
        ctx - context
        DateAcct - date
        DocBaseType - base type
        Returns:
        true if open
      • isOpen

        public static boolean isOpen​(Properties ctx,
                                     Timestamp DateAcct,
                                     String DocBaseType,
                                     int AD_Org_ID)
        Is standard Period Open for Document Base Type
        Parameters:
        ctx - context
        DateAcct - date
        DocBaseType - base type
        AD_Org_ID - Organization
        Returns:
        true if open
      • isOpen

        public static boolean isOpen​(Properties ctx,
                                     int tableID,
                                     int recordID,
                                     String trxName)
        Is standard Period Open - based on tableID+recordID (for IDEMPIERE-2392)
        Parameters:
        ctx - context
        tableID -
        recordID -
        Returns:
        true if open
      • getFirstInYear

        public static MPeriod getFirstInYear​(Properties ctx,
                                             Timestamp DateAcct)
        Deprecated.
        Find first Year Period of DateAcct based on Client Calendar
        Parameters:
        ctx - context
        DateAcct - date
        Returns:
        active first Period
      • getFirstInYear

        public static MPeriod getFirstInYear​(Properties ctx,
                                             Timestamp DateAcct,
                                             int AD_Org_ID)
        Find first Year Period of DateAcct based on Client Calendar
        Parameters:
        ctx - context
        DateAcct - date
        AD_Org_ID - TODO
        Returns:
        active first Period
      • getPeriodControls

        public MPeriodControl[] getPeriodControls​(boolean requery)
        Get Period Control
        Parameters:
        requery - requery
        Returns:
        period controls
      • getPeriodControl

        public MPeriodControl getPeriodControl​(String DocBaseType)
        Get Period Control
        Parameters:
        DocBaseType - Document Base Type
        Returns:
        period control or null
      • isInPeriod

        public boolean isInPeriod​(Timestamp date)
        Date In Period
        Parameters:
        date - date
        Returns:
        true if in period
      • isOpen

        public boolean isOpen​(String DocBaseType)
        Deprecated.
        since 3.3.1b; use isOpen(String, Timestamp) instead
        Is Period Open for Doc Base Type
        Parameters:
        DocBaseType - document base type
        Returns:
        true if open
      • isOpen

        public boolean isOpen​(String DocBaseType,
                              Timestamp dateAcct)
        Is Period Open for Doc Base Type
        Parameters:
        DocBaseType - document base type
        dateAcct - date; Applies only for "Auto Period Control":
      • if not null, date should be in auto period range (today - OpenHistory, today+OpenHistory)
      • if null, this period should be in auto period range
      • Returns:
        true if open
        Since:
        3.3.1b
      • isStandardPeriod

        public boolean isStandardPeriod()
        Standard Period
        Returns:
        true if standard calendar periods
      • beforeSave

        protected boolean beforeSave​(boolean newRecord)
        Before Save. Truncate Dates
        Overrides:
        beforeSave in class PO
        Parameters:
        newRecord - new
        Returns:
        true
      • afterSave

        protected boolean afterSave​(boolean newRecord,
                                    boolean success)
        After Save
        Overrides:
        afterSave in class PO
        Parameters:
        newRecord - new
        success - success
        Returns:
        success
      • testPeriodOpen

        public static void testPeriodOpen​(Properties ctx,
                                          Timestamp dateAcct,
                                          int C_DocType_ID,
                                          int AD_Org_ID)
                                   throws PeriodClosedException
        Convenient method for testing if a period is open
        Parameters:
        ctx -
        dateAcct -
        C_DocType_ID -
        AD_Org_ID - Organization
        Throws:
        PeriodClosedException
      • getC_Calendar_ID

        public int getC_Calendar_ID()
        Get Calendar of Period
        Returns:
        calendar
      • getC_Calendar_ID

        public static int getC_Calendar_ID​(Properties ctx,
                                           int AD_Org_ID)
        Get Calendar for Organization
        Parameters:
        ctx - Context
        AD_Org_ID - Organization
        Returns: