psdi.app.pr

Class PRLine

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


    public class PRLine
    extends PurchasingLineMbo
    implements PRLineRemote
    MBO to represent a PRLine in the Maximo System. The items and services that are ordered from a vendor or from a storeroom location are specified in the PRLines. It contains attributes like the order quantity, unit cost, line cost for the items or services that are being ordered. See Purchase Requisition Package description for details.

    This is a site level object.

    The key attributes for this object are SiteId and PRLineId.

    The attributes in this object are as follows:

    Attribute Name Description
    CatalogCode Vendor's catalog or product list number. The default is taken from Inventory Control.
    Category Indicates if the item on the line is stocked, non-stocked or a special order part (STK, NS or SP).
    ChargeStore Y/N field indicating whether the cost of this line should be added to the asset. The default value is N.
    Conversion Conversion unit from order unit to issue unit. For example, if the order unit is a "BOX" and the conversion factor is 250, indicating that the box has a 250 quantity. *
    ConvertToRFQY/N field indicating whether this PRLine should be allowed to convert to a request for quotation (RFQ) or not. The default value is N.
    Description Short description of the item or service of this PRLine. Also accommodates a long description.
    EnterBy, EnterDate The name of the person who entered this PRLine; the date on which this PRLine was entered.
    EnteredAsTaskY/N field indicating whether this transaction created against a work order task. The default value is N.
    AssetNum Asset to charge the cost of this line item.
    FinCntrlIdFinancial control identifier for this PRLine.
    GLCreditAcct GL credit account. Account code for the general ledger (GL) account credited with the cost of this line item. Any refunds or credits from the vendor or storeroom go to this GL account.
    GLDebitAcct GL debit account. Code for the GL account to be debited for the cost of this line item.
    InspectionRequiredY/N field indicating whether this item requires inspection upon receipt. The default value is N.
    IsDistributedY/N field indicating whether the cost on this PRLine is distributed or not. The default value is N.
    IssueIssue on receipt. Y/N field Indicating whether the line item is a direct issue to a work order, GL account, location, or a piece of asset. The default value is N.
    ItemNum Identifier for the item number on this PRLine.
    LDKeyLong Description Key. This is a link to text stored in the LongDescription table.
    LineCost Cost of the line item, calculated as quantity * unit cost. For service lines, this field could be directly entered by the user.
    LineCost2 Line cost in base currency2.
    LineTypeThe type of PR Line. It could be ITEM, MATERIAL, EXTERNAL, SERVICE or SPORDER type.
    LoadedCost The sum of line cost, taxes and special charges.
    Location Location where the item or service will be used. If a work order is entered, the location is taken from the corresponding work order record.
    Manufacturer Code for the manufacturer who manufactures this item.
    ModelNum Manufacturer's model number for the item. It is defaulted from inventory.
    MRLineNumLine number of the requisition created in desktop requisitions if this PRLine is for an MRLine.
    MRNumMaterial requisition number that is linked to this PRLine. This PR was created from this MR in desktop requisitions.
    OrderQty The number of units of the item that have been ordered. If this PR was generated from Inventory, the default is the reorder quantity calculated in inventory.
    OrderUnit Standard unit by which this item is ordered, such as dozen or box.
    OrgIdIdentifier of the organization for this PR line.
    PCardExpDate The expiry date of the procurement card (mm/yy). Crosses over from MR.PCardExpDate.
    PCardNum The number of the procurement card. Crosses over from MR.PCardNum.
    PCardType The type of procurement card. Crosses over from MR.PCardType.
    PCardVerification Procurement card verification value.
    POLineIdInternal PO line identifier. This attribute is uniquly generated and cannot be changed.
    POLineNumPurchase order line number corresponding to the PR line. If a POLine (which is part of a PO) was created from this PRLine, the corresponding POLineNum and POLineId would be assigned to this PRLine.
    PONum If a POLine (which is part of a PO) was created from this PRLine, the corresponding PO number would be assigned to this PRLine.
    PRLineIdInternal PR line identifier. This attribute is uniquly generated and does not change.
    PRLineNum Unique line number that identifies this PRLine.
    PRNumUnique PR identifier that identifies this PR. This is the key to the PRLine table.
    ProrateServiceY/N field indicating whether the cost of service be prorated (loaded) to line items cost when invoicing. The default value is N.
    ReceiptReqdY/N field indicating whether a receipt is required during invoicing. The default value is Y.
    RefWOReferenced workorder number for which the PR line is used. This value is determined by this PR line's non-persistent WONum and TaskId attributes. If this line's TaskId is non-null, RefWO is a child of WONum. RefWO is set to the WONum from the work order whose Parent and TaskId match this line's WONum and TaskId. If this line's TaskId is null, then RefWO is set to this line's WONum value.
    Remark Any additional description or remarks that need to be specified for this PRLine. Long description enabled.
    ReqDeliveryDate Date on which the delivery is required.
    RequestedByThe username who requested this PRLine.
    RFQLineIdInternal RFQ line identifier. This attribute is uniquly and does not change.
    RFQLineNumRequest for quotation line number corresponding to the PR line.
    RFQNumIf an RFQLine (part of an RFQ) was created using this PRLine, the corresponding RFQLineId, RFQLineNum and RFQNum from the RFQLine will be assigned to this PRLine. MAXIMO System does this automatically if you create an RFQ from a PR.
    SiteIdIdentifier of the site for this PR line.
    StoreLocThe storeroom location that currently stocks the item if the request is for a storeroom and not for a direct issue.
    TaskId Non-persistent attribute used to maintain WorkOrder.TaskId through the PRLine object. The TaskId and WONum attributes determine the RefWO attribute. See the TaskId attribute defined in WorkOrder for more information.
    Tax1 - Tax5 Amount of Tax1 - Tax5 due on good being purchased. Tax1 - Tax5 is added to the grand tax-total only if Inclusive1 - Inclusive 5 is YES.
    Tax1Code - Tax5Code The code associated with the Tax1 - Tax5. It is used to calculate the value of Tax1 - Tax5.
    UnitCost Cost of each unit on this PRLine.
    VendDeliveryDate Estimated delivery date by the vendor.
    VendorPackCodeThe vendor's pack code for the product. Indicates how the items will be packed. For example, BOX (12 to a box) or PALLET (30 to a pallet).
    VendorPackQuantityIndicates the number of items included in a pack.
    VendorWarehouseVendor warehouse that the product will come from.
    WONumNon-persistent attribute used to maintain WorkOrder.WONum through PRLine object. The WONum and TaskId attributes determine the RefWO attribute. If the TaskId is null, then RefWO will be equal to this attribute. If you specify a work order number, MAXIMO takes information from the work order to fill in location, asset and debit GL account fields. See the WONum attribute defined in WorkOrder for more information.
    PRLALN1 - PRLALN5 Extra fields. Crosses over from MRLine.MRLALN1 - MRLine.MRLALN5.
    RL1 - RL10 Extra fields.
    RLIN1 - RLIN9 Extra fields.
    • Constructor Detail

      • PRLine

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

      • init

        public void init()
                  throws MXException
        Initialization routine. The following fields are set to read only:

        • category
        • chargestore
        • contractnum
        • contractlinenum
        • contractlineid
        • contractrev
        • contractrefid
        • contractrefrev
        • loadedcost
        • mrnum
        • mrlinenum
        • ponum
        • polinenum
        • receiptreqd
        • refwo
        • rfqnum
        • rfqlinenum
        ChargeStore and receiptreqd flag are editable only if it's a service line. If PR's status is WAPPR and PRLine has been assigned to PO or RFQ, PRLine should be read only.

        Overrides:
        init in class Mbo
        Throws:
        MXException
      • initFieldFlagsOnMbo

        public void initFieldFlagsOnMbo(java.lang.String attrName)
                                 throws MXException
        Description copied from class: Mbo
        The logic of setting the readonly and required field flags to the mbo. Any setting of the field flags that require expensive operation, such as database query should be moved from init() to this method. However, those which don't require steps such as fetching Mbos can be left in init(). You can group the logic for a few attributes together if logic of deciding their flag is the same, or in other words, can be handled at once.
        Overrides:
        initFieldFlagsOnMbo in class PurchasingLineMbo
        Throws:
        MXException
      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Adds a new Purchase Requisition Line Item. Required fields of the PRLine are initialized in this method. The following fields are initialized with their respective values.

        Attribute Name Attribute Value
        chargestore No
        converttorfq No
        converttocontract No
        enterby Current User
        enterdate Current Date
        inspectionrequired No
        issue No
        linecost 0 (zero)
        linecost2 0 (zero)
        loadedcost 0 (zero)
        linetype ITEM
        orderqty 1.0
        prlinenum Last PRLineNum + 1
        prnum PR.PRNum
        prorateservice No
        receiptreqd Yes
        requestedby Current User
        tax1 - tax5 0 (zero)
        unitcost 0 (zero)
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • canDelete

        public void canDelete()
                       throws MXException,
                              java.rmi.RemoteException
        This method is called by the delete() method. All the conditions under which this Mbo can be deleted must be checked here. Can delete a PRLine only if the status of the PR is "WAPPR". Cannot delete a PRLine if the line already belongs to a PO.
        Overrides:
        canDelete in class Mbo
        Throws:
        MXApplicationException - (pr, cannotDelete) is thrown if the status of PR is not "WAPPR".
        MXApplicationException - (pr, alreadyinPO) is thrown if the PRLine is already generated a PO.
        MXApplicationException - (pr, alreadyinRFQ) is thrown if the PRLine is already generated an RFQ.
        MXException
        java.rmi.RemoteException
      • delete

        public void delete(long accessModifier)
                    throws MXException,
                           java.rmi.RemoteException
        Deletes a PRLine after successful completion of the canDelete() method. Deduct the tax1 - tax5 values of the line being deleted from totaltax1 - totaltax5 values. Also recalculate the total cost.
        Specified by:
        delete in interface MboRemote
        Overrides:
        delete in class Mbo
        Parameters:
        accessModifier - the flag for deletion
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        PurchasingMbo.recalculateTotalCost()
      • undelete

        public void undelete()
                      throws MXException,
                             java.rmi.RemoteException
        This method un-deletes a PRLine that has been marked for deletion.
        1. It adds the line cost of the undeleted line to the Pretax total on the PR Header The pretax total field validation updates the total cost and also the base total cost.
        2. It also adds up the taxes to the PR header total Tax.
        3. Please note that if PR is not the owner of this PRLine then this method throws an exception because you cannot just get a PRLine reference and call this method. You must go through th PR.
        Specified by:
        undelete in interface MboRemote
        Overrides:
        undelete in class Mbo
        Throws:
        MXApplicationException - (pr, OwnerMustBePR) is thrown if the owner of this PRLine is not PR.
        MXException
        java.rmi.RemoteException
        See Also:
        PurchasingMbo.recalculateTotalCost()
      • save

        public void save()
                  throws MXException,
                         java.rmi.RemoteException
        This saves the PRLine and all related Mbos
        Overrides:
        save in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • updateCost1s

        public void updateCost1s()
                          throws MXException,
                                 java.rmi.RemoteException
        This updates the PRLine linecost1 and loadedcost1 fields with linecost1 = linecost * exchangerate and loadedcost1 = loadedcost * exchangerate
        Specified by:
        updateCost1s in interface PRLineRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        PRLine.updateCost1s()
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        This method is automatically called before the save() is called.
        • At least one of assetnum, wonum, location or GlDebit must have a value.
        • If CHARGESTORE = Y and ASSETNUM != NULL the ASSETNUM must be a rotating asset.
        • If ISSUE = N and STORELOC = NULL, raise error.
        • If an internal PR has a material line, raise error.
        • Based on a maxvar value check if the GL debit and credit accounts are required for this transaction.
        Overrides:
        appValidate in class PurchasingLineMbo
        Throws:
        MXApplicationException(po, - ItemOrDescIsRequired) is thrown when the POLine does not have either the itemnum or description.
        MXApplicationException - (pr, assetwolocglNull) is thrown if the issue flag is true and none of assetnum, wonum, location or GLDebit have a value.
        MXApplicationException - (pr, storeLocNull) is thrown if the issue flag is false and storeloc is null.
        MXApplicationException(po, - AssetNumNull) is thrown when the chargestore flag is true but the PRLine does not have an asset.
        MXApplicationException(po, - NoItemForLineType) is thrown when line type is ITEM and does not have an item number associate with it.
        MXException
        java.rmi.RemoteException
      • skipCopyField

        protected boolean skipCopyField(MboValueInfo mvi)
                                 throws java.rmi.RemoteException,
                                        MXException
        This method overrides the skipCopyField() in the Mbo.Since this method takes the MboValueInfo as its parameter just check to see if this field needs to be copied or skipped.If this field does not need to be copied return true. The following is a list of fields that are not copied from the source PRLine to the target PRLine.
        1. enterby
        2. enterdate
        3. mrlinenum
        4. mrnum
        5. polineid
        6. polinenum
        7. ponum
        8. prnum
        9. reqdeliverydate
        10. requestedby
        11. rfqlineid
        12. rfqlinenum
        13. rfqnum
        14. vendeliverydate
        15. vendorpackcode
        16. vendorpackquantity
        17. vendorwarehouse
        Overrides:
        skipCopyField in class Mbo
        Parameters:
        - - The MboValueInfo object of the MboValue that needs to be copied.
        Returns:
        - True,if the field does not need to be copied.In all other cases return false.
        Throws:
        java.rmi.RemoteException
        MXException
      • canDistribute

        public void canDistribute()
                           throws MXException,
                                  java.rmi.RemoteException
        Checks if distribution can be allowed on a PRLine Distribution cannot be allowed if
        • The pr line has to be saved before distributing costs.
        • the status of the PR is not waiting for approval.
        • this line is a prorate service.
        • this line is not a direct issue line.
        • the item on this line is a rotating item.
        Specified by:
        canDistribute in interface PRLineRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        PRLine.canDistribute()
      • afterAdd

        public void afterAdd()
                      throws MXException,
                             java.rmi.RemoteException
        Called right after the new PRLine mbo is added to the PRLineSet. It creates a new PRCost Mbo using a relationship. The PRCost Mbo has a percentage value set to 100. Since the linecost and the loadedcost dont have values yet, they are not copied over from the POLine.
        Throws:
        MXException
        java.rmi.RemoteException
      • setApprEditibilityFlags

        protected void setApprEditibilityFlags()
                                        throws MXException,
                                               java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • checkPRCostValidity

        public void checkPRCostValidity()
                                 throws MXException,
                                        java.rmi.RemoteException
        Checks if the PRCost lines associated with this PRLine have correct values for percentage and loadedcost. If the percentage is not equal to hundred but the sum of the loadedcosts are equal to that of the parent prline, the percentage on the last distribution line is increased so that the sum of the percentages on the distribution is 100. The loaded cost on the last line is adjusted so that the sum of the loadedcosts on the distribution matches the loadedcost on the PRLine if the percentages total to 100.
        Specified by:
        checkPRCostValidity in interface PRLineRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        PRLine.checkPRCostValidity()
      • propagateKeyValue

        public void propagateKeyValue(java.lang.String keyName,
                                      java.lang.String keyValue)
                               throws MXException,
                                      java.rmi.RemoteException
        Set value for PRNUM.
        Specified by:
        propagateKeyValue in interface MboRemote
        Overrides:
        propagateKeyValue in class Mbo
        Parameters:
        keyName - Should equal "PRNUM" or else nothing will be propagated.
        keyValue - The new value of prnum.
        Throws:
        MXException
        java.rmi.RemoteException
      • setVendorItem

        public void setVendorItem(boolean value)
                           throws MXException,
                                  java.rmi.RemoteException
        Set fromVendorItem variable. fromVendorItem indicates if the action is from Vendor Item page or not.
        Throws:
        MXException
        java.rmi.RemoteException
      • getVendorItem

        public boolean getVendorItem()
                              throws MXException,
                                     java.rmi.RemoteException
        Return true if the action is from Vendor Item page. Otherwise return false.
        Throws:
        MXException
        java.rmi.RemoteException
      • getValidateOrder

        public java.lang.String[] getValidateOrder()
        Validation Order for PRLine attributes.
        Overrides:
        getValidateOrder in class Mbo
      • initRelationship

        public void initRelationship(java.lang.String relationName,
                                     MboSetRemote mboSet)
                              throws MXException,
                                     java.rmi.RemoteException
        Called whenever a relationship is initailized or reset from this Mbo to another MboSet. The PRCOST relationship is dealt with here.
        Overrides:
        initRelationship in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • 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()