[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FN_GACCSTAT()
 Get Account Status of an Object
------------------------------------------------------------------------------
 Syntax
      aStatus := FN_gAccStat( cObjName,nObjType )
 Arguments
     <cObjName> is the name of the bindery object
     <nObjType> is the bindery object's type

 Returns

      <aStatus> is an array containing three elements as follows:

         aStatus[1] : Account Balance (numeric)
         aStatus[2] : Credit Limit (numeric)
         aStatus[3] : Array of holds (array)
                      { nObject_id,nHold_Amt }

     If the call was successful the status array will be updated
     accordingly, otherwise an empty array is returned.

     If an empty array is returned, you can examine the return
     code from FN_ERROR() for one of the following:

             192      No account privileges

                      The object that is making this call must
                      be a member of the SET property
                      "ACCOUNT_SERVERS" for this file server,
                      and accounting must be installed.

             193      No account balance

 Description

  This function returns the status of the account status for given
  bindery object.  The return pack holds the following information:

    Account Balance:  Current balance in units of money, usually cents
    Credit Limit   :  Minimum balance, if negative, user can request
                      more services than the account balance allows.  If
                      positive, you can ensure that money is alway left
                      in the account.  Once the account balance drops
                      below the credit limit, services will be denied.
    Server holds   :  Services (other bindery objects) can place holds
                      on an account.  A hold reserves a certain amount
                      of money for the service until the service bills
                      for it.  An object can have up to 16 holds against
                      it.  This array contains the object id and the amount
                      of the hold for up to the 16 service holds.

 Examples

      #define  ACCOUNT_BALANCE     aResult[1]
      #define  CREDIT_LIMIT        aResult[2]


      procedure PrintJob
      if oktorun(cWho,nType)
         //
         // Run the printer job
         //
      else
         Alert( "Insufficient funds" )
      endif
      return


      function oktorun(cWho,nType)
      LOCAL   aResult:={}, is_ok := .F.
      aResult := FN_gAccSta(cWho,nType)
      if !empty( aResult )
         is_ok := ACCOUNT_BALANCE > CREDIT_LIMIT
      endif

      return NIL


 Source: N:\SRC\ACCTNG\GACCSTA.PRG

 Author: Joseph D. Booth

See Also: FN_sAccChg() FN_sAccHold() FN_sAccNote()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson