psdi.app.inventory

Class InvCost

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


    public class InvCost
    extends Mbo
    implements InvCostRemote
    MBO object to represent InvCost. This object contains the costs and gl accounts at a condition code level. *

    See Inventory Package description.

    This is a site level object.

    The key attributes in this object are as follows: itemnum,itemsetid,location,conditioncode

    The persistent attributes in this object are as follows:

    Attribute NameDescription
    AvgCostThe Average Cost for the condition of item.
    ConditionCodeThe condition of the inventory item.
    CondRateThe percentage rate of the condition.
    ControlaccThe Control Account.
    ControlaccountThe Control Account for cost adjustments, a non-persistent column created for standard or average cost adjustments.
    GLAccountGL Account.
    InvCostAdjAccThe Cost Adjustment Account.
    InvCostAdjAccThe Accounts for cost adjustments, a non-persistent column created for standard or average cost adjustments.
    itemnumItem for the condition code. Item Number can be null.
    ItemSetIdThe Item Set.
    LastCostThe Last Cost for the condition of item.
    LocationThe inventory location.
    NewAvgCostThe new average cost, non-persistent column created for user input of new average cost for Average Cost Adjustment.
    NewStdCostThe new standard cost, non-persistent column created for user input of new standard cost for Standard Cost Adjustment.
    OrgIdThe organization.
    PercentageIncreaseThe percentage increase, non-persistent column created for user input of percentage increase for Average Cost Adjustment.
    ShrinkageAccShrinkage Account.
    SiteIdIdentifier of the site for this object.
    StdCostThe standard cost of the item condition.
    • Constructor Detail

      • InvCost

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

      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        add() Provides defaults for a new InvCost Record. The table below shows the default values for each of the attributes listed.
        Attribute NameAttribute Value
        AVGCOST0(zero)
        STDCOST0(zero)
        LASTCOST0(zero)

        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXException - MXAccessException thrown when the the user does not have privileges to add a cost to a storeroom.
        java.rmi.RemoteException
      • init

        public void init()
                  throws MXException
        Initialization rountine.
        Set field flags for both always readonly attributes as well as those fields which are editable only during insert.
        Overrides:
        init in class Mbo
        Parameters:
        none -
        Throws:
        none
        MXException
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        last minute validate before save(). column conditioncode is required if item is condition enabled
        Overrides:
        appValidate in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • updateAverageCost

        public void updateAverageCost(double quantity,
                                      double totalvalue,
                                      double exr)
                               throws MXException,
                                      java.rmi.RemoteException
        This method performs the core logic of average cost calculation and update of the invcost. Balances are based on invbalances passed. This is called by any transaction that increases/decreases INVBALANCES
        Parameters:
        quantity - QUANTITY (in Issueunits) by which the CURBAL is being increased
        totalvalue - The TOTALVALUE of the QUANTITY (LOADEDCOST)
        exr - EXR - The exchangerate applicable from this transaction to basecurrency
        Throws:
        MXException
        java.rmi.RemoteException
      • updateAverageCost

        public void updateAverageCost(double quantity,
                                      double totalvalue,
                                      double exr,
                                      boolean transferWithinStore)
                               throws MXException,
                                      java.rmi.RemoteException
        This method performs the core logic of average cost calculation and update of the invcost. Balances are based on invbalances passed. This is called by any transaction that increases/decreases INVBALANCES
        Parameters:
        quantity - QUANTITY (in Issueunits) by which the CURBAL is being increased
        totalvalue - The TOTALVALUE of the QUANTITY (LOADEDCOST)
        exr - EXR - The exchangerate applicable from this transaction to basecurrency
        transferWithinStore - - true if the transfer is between bins within the same storeroom
        Throws:
        MXException
        java.rmi.RemoteException
      • updateLastCost

        public void updateLastCost(double value)
                            throws MXException,
                                   java.rmi.RemoteException
        This method is provided to update the lastcost of this invcost.
        Parameters:
        value - the most recent purchase cost of the item
        Throws:
        MXException
        java.rmi.RemoteException
      • adjustAverageCost

        public MboRemote adjustAverageCost(double newcost)
                                    throws MXException,
                                           java.rmi.RemoteException
        adjustAverageCost(1,2) Adjust Inventory Average Cost (AVGCSTADJ) This method is used to carry out an average cost adjustment (not updating as in receipts/ returns). The New Average Cost specified is assumed to be in the currency units corresponding to BASE1. Average Cost Adjustment updates this object with the new AVGCOST. In addition, it creates an INVTRANS record of AVGCSTADJ type.
        Parameters:
        newcost - The NEWCOST i.e. the new value of the average cost for the item-storeroom-conditioncode, in the currency units corresponding to BASE1
        Returns:
        Returns the InvTrans Record that was added during the adjustment
        Throws:
        MXException - Generates an MXAccessException if the user does not have the privileges to perform this transaction.
        MXApplicationException - thrown if the item is capitalized or if the new cost is the same as the old cost
        java.rmi.RemoteException
      • adjustStandardCost

        public MboRemote adjustStandardCost(double newcost)
                                     throws MXException,
                                            java.rmi.RemoteException
        adjustStandardCost(1,2) Adjust Inventory Standard Cost (STDCSTADJ) This method is used to carry out a standard cost adjustment. The New Standard Cost specified is assumed to be in the currency units corresponding to BASE1.
        Parameters:
        newcost - The NEWCOST i.e. the new value of the standard cost for the item-storeroom-conditioncode, in the currency units corresponding to BASE1
        Returns:
        Returns the InvTrans record that was added during the Transaction
        Throws:
        MXException - Generates an MXAccessException if the user does not have the privileges to perform this transaction. MXApplicationException thrown if the item is capitalized or if the new cost is the same as the old cost
        java.rmi.RemoteException
      • createInvTrans

        public MboRemote createInvTrans(double old_cost,
                                        double newcost,
                                        java.lang.String costType)
                                 throws MXException,
                                        java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • getDefaultIssueCost

        public double getDefaultIssueCost()
                                   throws MXException,
                                          java.rmi.RemoteException
        getDefaultIssueCost() Core logic to return the default issue cost for this item/storeroom/conditioncode Checks inventory.costtype and returns the value from that field Note: Cost Returned is in base Currency
        Returns:
        The default issue cost for this item/location/conditioncode combination
        Throws:
        MXException
        java.rmi.RemoteException
      • modify

        public void modify()
                    throws MXException,
                           java.rmi.RemoteException
        Description copied from class: Mbo
        This called whenever a change is made to the attributes of a MBO. The programmer should override if interested in intercepting this event. An example of the use of this is to set the changeby/changedate of a work order whenever one of the attributes is set. If an MXException is thrown from this routine, the change of value is rolled back, this provides a mechanism to abort any changes. Default behavior is to do nothing. The derived method has to call super.modify().
        Overrides:
        modify in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException