psdi.app.labor

Class Attendance

  • All Implemented Interfaces:
    java.rmi.Remote, AttendanceRemote, MboConstants, MboRemote, MaxRemoteProxy


    public class Attendance
    extends Mbo
    implements AttendanceRemote
    Mbo object to represent Attendance. See the Labor package description for details.

    This is an Organization level object.

    The attributes in this object are as follows:

    Attribute Description

    AttributeDescription
    EnterByEnter By For Attendance Transaction
    EnterDateEnter Date For Attendance Transaction
    FinishDateFinish Date For Attendance Transaction
    FinishTimeFinish Time For Attendance Transaction
    LaborCodeLaborcode For Transaction
    LaborHoursTotal Hours For Attendance Transaction
    OrgIdIdentifier for the Organization of this Attendance
    StartDateStart Date For Attendance Transaction
    StartTimeStart Time For Attendance Transaction
    TransDateTime Stamp For Attendance Transaction
    See Also:
    Labor, psdi.app.labor.LaborAuth, LabTrans, ServRecTrans
    • Constructor Detail

      • Attendance

        public Attendance(MboSet ms)
                   throws MXException,
                          java.rmi.RemoteException
        Construct the Attendance object
        Throws:
        MXException
        java.rmi.RemoteException
    • Method Detail

      • getProcess

        public java.lang.String getProcess()
                                    throws MXException,
                                           java.rmi.RemoteException
        Return the work flow process for ATTENDANCE
        Throws:
        MXException
        java.rmi.RemoteException
      • init

        public void init()
                  throws MXException
        init overridden to make existing records read/only
        Overrides:
        init in class Mbo
        Throws:
        MXException
      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Add a new Attendance Object. Initialise all the fields that are "required". The table below shows the default values for each of the attributes listed.
        Attribute NameAttribute Value
        laborcodelaborcode (from Labor)
        startdatecurrent date
        laborhours0
        enterdatecurrent date
        enterbycurrent user
        transdatecurrent date
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        psdi.mbo.Mbo#add.
      • getTotalAttendance

        public double getTotalAttendance()
                                  throws MXException,
                                         java.rmi.RemoteException
        This will sum up the total labor hours of a particular labor
        Throws:
        MXException
        java.rmi.RemoteException
      • isSameDate

        public boolean isSameDate(java.util.Date date1,
                                  java.util.Date date2)
                           throws MXException,
                                  java.rmi.RemoteException
        This method takes 2 date parameters and checks if the two dates are equal.If the two dates are equal it returns true
        Parameters:
        - - Date1,Date2 - the two dates to be compared.
        Returns:
        - true if the two dates are equal.false if the two dates are not.
        Throws:
        MXException
        java.rmi.RemoteException
      • isStartAfterFinshDate

        public static boolean isStartAfterFinshDate(java.util.Date startDate,
                                                    java.util.Date finishDate)
                                             throws MXException,
                                                    java.rmi.RemoteException
        This method checks if the finish date is before the start date. This method can be used by anybody without instantating this class because
        Throws:
        MXException
        java.rmi.RemoteException
      • getTotalHrsinMinutes

        public int getTotalHrsinMinutes()
                                 throws MXException,
                                        java.rmi.RemoteException
        Return the totalhrs in minutes for laborhours
        Throws:
        MXException
        java.rmi.RemoteException
      • checkStartDateTime

        public void checkStartDateTime()
                                throws MXException,
                                       java.rmi.RemoteException
        Validation for Startdate and Starttime If the starttime is null, finishdate, finishtime, labor hrs are not null, then calculate and set the the starttime value.
        Throws:
        MXException
        java.rmi.RemoteException
      • checkFinishDateTime

        public void checkFinishDateTime()
                                 throws MXException,
                                        java.rmi.RemoteException
        Validation for FinishDate and FinishTime If the finishdate is null, finishtime and starttime are not null, then the calculate and set the value for finishdate If the finishtime is null, finishdate and starttime are not null, then calculate and set the value for finishtime.
        Throws:
        MXException
        java.rmi.RemoteException
      • getDatesDiff

        public double getDatesDiff()
                            throws MXException,
                                   java.rmi.RemoteException
        Return the time difference between the startdate, starttime, finishdate and finishtime.
        Throws:
        MXException
        java.rmi.RemoteException
      • validDates

        public boolean validDates()
                           throws MXException,
                                  java.rmi.RemoteException
        Return true if startdate, starttime, finishdate and finishtime are not null
        Throws:
        MXException
        java.rmi.RemoteException
      • checkDates

        public void checkDates()
                        throws MXException,
                               java.rmi.RemoteException
        Check startdate, starttime, finishdate and finishtime validity If the startdate is later than the finishdate or if the combination of startdate and starttime is laterthan than the combination of finishdate and finishtime, then throw the exception
        Throws:
        MXException
        java.rmi.RemoteException
      • checkLaborHrs

        public void checkLaborHrs()
                           throws MXException,
                                  java.rmi.RemoteException
        Validation for Labor hrs. If the finishdate and finishtime are null and laborhours is not null, then calculate and set the values for finishdate and finishtime. Same for startdate and starttime. If the laborhrs are more than the summaryhrs (difference between startdate and time and finishdate and time), then throw the exception. This method is called on FldAttendanceHrs.action()
        Throws:
        MXException
        java.rmi.RemoteException
      • validateDateTime

        public java.util.Date validateDateTime(java.util.Date date,
                                               java.util.Date time)
                                        throws MXException,
                                               java.rmi.RemoteException
        This method will take two dates as a parameters and remove the date section from one and combine it with the time section from the other. The return value will be a new date/time object.
        Parameters:
        time -
        date -
        Throws:
        MXException
        java.rmi.RemoteException
      • getNextDateTime

        public java.util.Date getNextDateTime(java.util.Date d1,
                                              java.util.Date d2,
                                              int minutes)
                                       throws MXException,
                                              java.rmi.RemoteException
        This method will take two date parameters (date d1 and time d2), combine them in a new date/time and create a new next date object (result ) by adding a number of minutes to original date .
        Parameters:
        minutes -
        d1 -
        d2 -
        Throws:
        MXException
        java.rmi.RemoteException