psdi.app.labor

Class LabTrans

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


    public class LabTrans
    extends Mbo
    implements LabTransRemote
    Mbo object to represent Labor Transactions object. See the Labor package description for details.

    This is a Site level object.

    The key attributes for this object are SiteId and LabTransID.

    The attributes in this object are as follows:

    Attribute Description

    AttributeDescription
    AssetNumAsset Number
    ContractnumLabor Contract that an outside Laborer was working under.
    CraftCraft
    EnterByApproved By (Authorized Manager Signature)
    EnterDateDate Labor Was Reported
    EnteredAsTaskWas this transaction created against a work order task?
    ExchangeRate2Base Exchange Rate 2
    ExternalRefIDExternal Reference ID
    FinancialPeriodFinancial period in a format corresponding to that required by the accounting system.
    FinCntrlIDFinancial Control Identifier
    FinishDateFinish Date For Transaction
    FinishTimeFinish Time For Transaction
    GenApprServReceiptIndicates whether or not this transaction has been approved and a service receipt can be written
    GLCreditAcctGL Contra Account.
    GLDebitAcctGL Account.
    LaborCodeLabor Code
    LabtransIDPrimary key for the table
    LineCostExtended or lump sum cost of transaction line.
    LineCost2Base Currency Line Cost 2.
    LocationCharge Location.
    MemoA memo field that can be used to make any notes about work carried out.
    OrgIdIdentifier for the Organization of this Labor Transaction
    OutsideShould Transactions be Tracked as Outside Costs?
    OwnerSysIDOwner System ID
    PaymentTransDateIndicates the date and time a payment transaction has been created
    PayRateRate At Which Labor Is Paid
    POLineNumPO line item number.
    PONumPurchase order number that is labor is being purchased on.
    PremiumPayCodePremium Pay Code for labor transaction.
    PremiumPayHoursPremium Pay Hours for labor transaction.
    PremiumPayRatePremium Pay Rate for labor transaction.
    RegularHrsRegular Hours Worked
    RevisionnumThe Active Revision Number of the defined Contract for this Labor Transaction.
    RefWOReferenced Work Order
    RollupIndicates whether this transaction has been rolled up.
    SenderSysIDColumn used by ERP-Integration (APIs)
    ServRecTransIDCreated when Create service Receipt is used
    SiteIdIdentifier for the site of this Labor Transaction
    SourceSysIDSource System ID
    SkillLevelDefines the Skill used by the laborer
    StartDateStart Date For Transaction
    StartTimeStart Time For Transaction
    TransDateTimestamp - Key To Table
    TransTypeTransaction Type For Transaction
    VendorVendor for the labor transaction
    WONumWork Order Number. This is a non-persistent column.
    See Also:
    Attendance, psdi.app.labor.LaborAuth, Labor, ServRecTrans
    • Field Detail

      • prevApproved

        protected boolean prevApproved
      • prevOutside

        protected boolean prevOutside
      • prevRegularHrs

        protected double prevRegularHrs
      • prevPremiumHrs

        protected double prevPremiumHrs
      • prevLinecost

        protected double prevLinecost
      • prevLabor

        protected java.lang.String prevLabor
      • isSetFromLabtrans

        public boolean isSetFromLabtrans
        Flag used to prevent FldClass Validation from triggering when setting the Regularhrs value. Unable to set NOVALIDATION, since it disables domain validation.
      • numberOfTimesSetByLabTransNotByUser

        public int numberOfTimesSetByLabTransNotByUser
        12-13761/IV24110:since the three instance values are very closely interacted, the logic is very specific to fix 12-13761: In Select Planned Labor, the regularhrs copied from assignment.laborhrs is setValue with NONE flag. So it went in FldLabTransRegularHrs class and set isRegularHrs to true - but the field is copied, not touched by ther user.
    • Constructor Detail

      • LabTrans

        public LabTrans(MboSet ms)
                 throws MXException,
                        java.rmi.RemoteException
        Construct the Labor Transactionobject
        Parameters:
        ms -
        Throws:
        MXException
        java.rmi.RemoteException
    • Method Detail

      • init

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

        protected void setEditibilityFlags()
                                    throws MXException,
                                           java.rmi.RemoteException
        set flags for approved/unapproved labor transactions
        Throws:
        MXException
        java.rmi.RemoteException
      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Add a new Labtrans Object. Initialise all the fields that are "required". The table below shows the default values for each of the attributes listed.
        Attribute NameAttribute Value
        enterdatecurrent date
        enterbycurrent user
        transdatecurrent date
        startdatecurrent date
        starttimecurrent time
        regularhrs0.0
        transtypetranstype (DefaultValue("lttype","WORK"))
        linecost0.0
        rollupNo
        outsideNo
        genapprservreceiptNo
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • modify

        public void modify()
                    throws MXException,
                           java.rmi.RemoteException
        The first time a field of a labtrans object is modified.
        Overrides:
        modify in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • setGenApprFlag

        protected void setGenApprFlag()
                               throws MXException,
                                      java.rmi.RemoteException
        Sets the value for genapprservreceipt based on the inside or outside labor maxvars
        Throws:
        MXException
        java.rmi.RemoteException
      • checkCraftMisMatch

        protected void checkCraftMisMatch()
                                   throws MXException,
                                          java.rmi.RemoteException
        Check the maxvar option, whether the labor and craft mismatch is allowed
        Throws:
        MXException
        java.rmi.RemoteException
      • checkOwner

        public void checkOwner()
                        throws MXException,
                               java.rmi.RemoteException
        set rdonly fields based on the owner of this set (workorder or labtrans)
        Throws:
        MXException
        java.rmi.RemoteException
      • setGLDebitAcct

        protected void setGLDebitAcct()
                               throws MXException,
                                      java.rmi.RemoteException
        Set the gldebitacct based on the values entered in wonum, assetnum, location and laborcode
        Throws:
        MXException
        java.rmi.RemoteException
      • setGLCreditAcct

        protected void setGLCreditAcct()
                                throws MXException,
                                       java.rmi.RemoteException
        Set the glcreditacct based on the values entered in laborcode,craft, skilllevel, vendor and contractnum
        Throws:
        MXException
        java.rmi.RemoteException
      • canDelete

        public void canDelete()
                       throws MXException,
                              java.rmi.RemoteException
        Check that only unapproved labor transaction can be deleted
        Overrides:
        canDelete in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        Based on a maxvar value check if the GL debit and credit accounts are required for this transaction. Merge gldebitacct on save.
        Overrides:
        appValidate in class Mbo
        Throws:
        MXApplicationException - (financial, GLRequiredForTrans) The debit and credit GL accounts require a value.
        MXException
        java.rmi.RemoteException
        See Also:
        LabTrans.checkforPORequired()
      • save

        protected void save()
                     throws MXException,
                            java.rmi.RemoteException
        This mbo needs to update the totals of the workorder or ticket and labor records referenced by this labtrans record. If the owner of this Mbo's set is either a WO or Labor Mbo, then their totals will be update as the attributes are modified. Assumes the owner is a WO, Labor, or else there is no owning Mbo.
        Overrides:
        save in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • validatePOforApproval

        public void validatePOforApproval()
                                   throws MXException,
                                          java.rmi.RemoteException
        Validate PO before approving labor transaction. The PO Status must be open and approved. The PO Vendor should match the labor vendor
        Throws:
        MXException
        java.rmi.RemoteException
      • validatePOLineforApproval

        public POLineRemote validatePOLineforApproval()
                                               throws MXException,
                                                      java.rmi.RemoteException
        The PoLine specified must be a service line and the PoLine must not be complete for approval and the POLINE must not be PRORATED.
        Returns:
        POLineRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • setLineCost

        public void setLineCost()
                         throws MXException,
                                java.rmi.RemoteException
        Calculates the line cost for the labor transaction record
        Throws:
        MXException
        java.rmi.RemoteException
      • getExchangeRate

        public double getExchangeRate()
                               throws MXException,
                                      java.rmi.RemoteException
        Sets exchangerate2 field
        Throws:
        MXException
        java.rmi.RemoteException
      • getPO

        public PORemote getPO()
                       throws MXException,
                              java.rmi.RemoteException
        Deprecated. 
        Use the PO relationship instead.
        Throws:
        MXException
        java.rmi.RemoteException
      • getValidateOrder

        public java.lang.String[] getValidateOrder()
        Validate order of LabTrans order attributes.
        Overrides:
        getValidateOrder in class Mbo
      • checkforPORequired

        public boolean checkforPORequired()
                                   throws MXException,
                                          java.rmi.RemoteException
        This method will check if a PO and POLine are required before saving or approving.
        Throws:
        MXException
        java.rmi.RemoteException
      • delete

        public void delete(long accessModifier)
                    throws MXException,
                           java.rmi.RemoteException
        Subtracts the line cost from WO.ActLabCost.
        Specified by:
        delete in interface MboRemote
        Overrides:
        delete in class Mbo
        Parameters:
        accessModifier -
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Mbo.delete(long)
      • checkTransType

        public void checkTransType()
                            throws MXException,
                                   java.rmi.RemoteException
        When the transtype = 'WORK', either of the fields refwo, assetnum, location, gldebitacct or glcreditacct should be filled in.
        Throws:
        MXException
        java.rmi.RemoteException
      • getPayRate

        public double getPayRate()
                          throws MXException,
                                 java.rmi.RemoteException
        Return payrate depending on labor, craft combination
        Returns:
        double
        Throws:
        MXException
        java.rmi.RemoteException
      • updateActualLabwithRegularHrs

        public void updateActualLabwithRegularHrs()
                                           throws MXException,
                                                  java.rmi.RemoteException
        Updates Actual labor hrs on workorder when the regularhrs are entered, if the workorder owns this labor transaction
        Throws:
        MXException
        java.rmi.RemoteException
      • updateActualLabwithPremiumHrs

        public void updateActualLabwithPremiumHrs()
                                           throws MXException,
                                                  java.rmi.RemoteException
        Updates Actual labor hrs on workorder when the premiumpay hours are entered, if the workorder owns this labor transaction
        Throws:
        MXException
        java.rmi.RemoteException
      • updateActualLabCost

        public void updateActualLabCost()
                                 throws MXException,
                                        java.rmi.RemoteException
        Updates Actual labor cost on workorder when the linecost is updated for this transaction, if the workorder owns this labor transaction
        Throws:
        MXException
        java.rmi.RemoteException
      • validateVendor

        public void validateVendor()
                            throws MXException,
                                   java.rmi.RemoteException
        Labor and Vendor mismatch is not allowed any time.
        Throws:
        MXException
        java.rmi.RemoteException
      • validateWOAcceptsCharges

        public void validateWOAcceptsCharges()
                                      throws MXException,
                                             java.rmi.RemoteException
        Check to validate the workorder associated with this transactions has the acceptscharges true.
        Throws:
        MXException
        java.rmi.RemoteException
      • setSelectedValues

        public void setSelectedValues(MboRemote mbo)
                               throws MXException,
                                      java.rmi.RemoteException
        This method will set the values from the selected record from the source mbo to the multiple fields in the target mbo.
        Specified by:
        setSelectedValues in interface LabTransRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • clearFields

        protected void clearFields()
                            throws MXException,
                                   java.rmi.RemoteException
        This will clear the values from the fields when the record is selected from the lookup which will set the values from multiple columns. This is required to prevent the validation to occur before all the values are set.
        Throws:
        MXException
        java.rmi.RemoteException
      • getCriteriaForContractWithRevision

        public java.lang.String getCriteriaForContractWithRevision()
                                                            throws MXException,
                                                                   java.rmi.RemoteException
        Create sql for contract criteria. This will be called to return craftrateset
        Specified by:
        getCriteriaForContractWithRevision in interface LabTransRemote
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • setContractRevision

        public void setContractRevision()
                                 throws MXException,
                                        java.rmi.RemoteException
        Set the revisionnum when contractnum is not null and for the valid startdate and starttime
        Throws:
        MXException
        java.rmi.RemoteException
      • getTotalHrsinMinutes

        public int getTotalHrsinMinutes()
                                 throws MXException,
                                        java.rmi.RemoteException
        Return the totalhrs in minutes for regularhrs and othrs
        Throws:
        MXException
        java.rmi.RemoteException
      • getTotalHrs

        public double getTotalHrs()
                           throws MXException,
                                  java.rmi.RemoteException
        Return the totalhrs for regularhrs and othrs
        Throws:
        MXException
        java.rmi.RemoteException
      • setValuesForRegularPremiumHrs

        public void setValuesForRegularPremiumHrs()
                                           throws MXException,
                                                  java.rmi.RemoteException
        This will set the values for regularhrs and othrs when there is a change in the date and time values
        Throws:
        MXException
        java.rmi.RemoteException
      • setValuesForStartDtTm

        public void setValuesForStartDtTm()
                                   throws MXException,
                                          java.rmi.RemoteException
        This will set the values for start date and time when there is a change in the comination of finish date and time or regularhrs and othrs
        Throws:
        MXException
        java.rmi.RemoteException
      • setValuesForFinishDtTm

        public void setValuesForFinishDtTm()
                                    throws MXException,
                                           java.rmi.RemoteException
        This will set the values for finish date and time when there is a change in the comination of start date and time or regularhrs and othrs
        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, regularhrs 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
      • checkValidFinishDtTm

        public void checkValidFinishDtTm()
                                  throws MXException,
                                         java.rmi.RemoteException
        Validate finish date and time, if it is manually entered or calculated.
        Throws:
        MXException
        java.rmi.RemoteException
      • checkValidStartDtTm

        public void checkValidStartDtTm()
                                 throws MXException,
                                        java.rmi.RemoteException
        Validate start date and time, if it is manually entered or calculated.
        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
      • checkRegularAndPremiumHrs

        public void checkRegularAndPremiumHrs()
                                       throws MXException,
                                              java.rmi.RemoteException
        Validation for Regular hrs. If the finishdate and finishtime are null and regularhrs is not null, then calculate and set the values for finishdate and finishtime. Same for startdate and starttime. If the totalhrs (regularhrs+oths) is more than the summaryhrs (difference between startdate and time and finishdate and time), then throw the exception. This method is called on FldLabTransRegularHrs.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.
        Specified by:
        validateDateTime in interface LabTransRemote
        Parameters:
        time -
        date -
        Throws:
        MXException
        java.rmi.RemoteException
      • validateDateTimeWithUserTimeZone

        public java.util.Date validateDateTimeWithUserTimeZone(java.util.Date date,
                                                               java.util.Date time)
                                                        throws MXException,
                                                               java.rmi.RemoteException
        IJ07852: Fix per Sarika. This method will take two dates as 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 in the client's timezone.
        Specified by:
        validateDateTimeWithUserTimeZone in interface LabTransRemote
        Parameters:
        time -
        date -
        Throws:
        MXException
        java.rmi.RemoteException
      • validateDateTimeWithTimeZone

        public java.util.Date validateDateTimeWithTimeZone(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.
        Specified by:
        validateDateTimeWithTimeZone in interface LabTransRemote
        Parameters:
        time -
        date -
        Throws:
        MXException
        java.rmi.RemoteException
      • validateFutureTolerance

        public void validateFutureTolerance()
                                     throws MXException,
                                            java.rmi.RemoteException
        Validation for future tolerance. The labor transaction can be reported based on the specified duration in the future in in the multisite labor options. If it is zero tolerance, then labor transaction cannot be reported later than the current date and time.
        Throws:
        MXException
        java.rmi.RemoteException
      • isUncommitted

        public boolean isUncommitted()
        Does this LabTrans have values not committed to the database?
        Returns:
        uncommitted
      • setUncommitted

        public void setUncommitted(boolean uncommitted)
        Set the uncommitted flag
        Parameters:
        uncommitted - What to set the flag to.
      • smartFindByObjectName

        public MboSetRemote smartFindByObjectName(java.lang.String sourceObj,
                                                  java.lang.String targetAttrName,
                                                  java.lang.String value,
                                                  boolean exact)
                                           throws MXException,
                                                  java.rmi.RemoteException
        Find a set of records of the object of the specified the application by the specified attribute and values of the current record.
        Specified by:
        smartFindByObjectName in interface MboRemote
        Overrides:
        smartFindByObjectName in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        psdi.mbo.Mbo#smartFindByObjectName()
      • checkForApprContractAsOfStartDate

        public void checkForApprContractAsOfStartDate()
                                               throws MXException,
                                                      java.rmi.RemoteException
        Checks to see if a contract exists that is APPR before the entered start date. If either startdate or contractnum is null, no check is done.
        Throws:
        MXException - If a contract exists, but does not have a status of APPR.
        java.rmi.RemoteException
      • setValue

        public void setValue(java.lang.String attributeName,
                             java.lang.String val,
                             long accessModifier)
                      throws MXException,
                             java.rmi.RemoteException
        12-13761/IV24110: in Select Planned Labor from wotrack or quick rep WO.copyPlanLaborToLabTransSet, the add() method defaults regularhours to 0 and then copies the assignment.laborhrs to labtrans.regularhrs. In validate() of FldLabTransReqularhrs, it sets instance variable isRegularOtHrs to true. This means that the reqular Hours field is "touched", but it is not by user, it is set by programming. Override setValue here to distiguish between user input or setValue by code.
        Specified by:
        setValue in interface MboRemote
        Overrides:
        setValue in class Mbo
        Parameters:
        attributeName - The attribute name within the current object.
        val - The string value to set to the attribute.
        accessModifier - The bitwise flags such as NOACCESSCHECK, NOVALIDATION_AND_NOACTION, and DELAYVALIDATION.
        Throws:
        MXException - "Attribute {0} does not exist" exception will be thrown if the attribute does not exist in the object. "Field is read only" exception will be thrown if the attribute is READONLY and the accessModifier does not specify NOACCESSCHECK. "Invalid Data Type" exception will be thrown for datatype mismatch. For example, setting a string value of characters to an attribute which has datatype of YORN.
        java.rmi.RemoteException
        See Also:
        Mbo.setValue(String,String,long)
      • setContractCountPrompt

        public void setContractCountPrompt(int count)
      • getContractCountPrompt

        public int getContractCountPrompt()
      • getOffsetDateTime

        public java.util.Date getOffsetDateTime(java.util.Date dateValue,
                                                java.util.Date timeValue,
                                                boolean plus)
                                         throws java.rmi.RemoteException
        Specified by:
        getOffsetDateTime in interface LabTransRemote
        Throws:
        java.rmi.RemoteException
      • setDateTimeEntered

        public void setDateTimeEntered()
                                throws MXException,
                                       java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • getWorkOrderForUpdate

        public WORemote getWorkOrderForUpdate()
                                       throws MXException,
                                              java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • fireEvent

        public void fireEvent(java.lang.String type)
                       throws MXException,
                              java.rmi.RemoteException
        IJ32752: Extends Mbo.fireEvent(String type) to reset labor actuals that have been set on this LABTRANS and the related work order or ticket if a pre-commit event (validate, preSaveEventAction, preSaveInternalEventAction, eventAction, postSaveInternalEventAction encounters an error. The events are fired in MXTransactionImpl.saveTransaction(MXTransaction txn).
        Overrides:
        fireEvent in class Mbo
        Parameters:
        type - the event type
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Mbo.fireEvent(String), MXTransactionImpl.saveTransaction(MXTransaction txn)