Auto-issue part numbers based on stock group category
  • Joe
    Auto-issue part numbers based on stock group category

    by Joe » Sat Apr 22, 2006 12:16 am

    Is it possible to have Capital automatically assign product codes with different number ranges based on the stock item's product group?

    For example if the stock group is ABC, I'd like numbers between 10000-19999 automatically assigned to stock items as the product code. If the stock group is BCD I'd like numbers 20000-29999 assigned and so on. Can it be done?
  • COBS Tech Support
    Posts:683
    Joined:Fri Sep 09, 2005 8:23 am

    by COBS Tech Support » Sat Apr 22, 2006 12:25 am

    There are many ways you could approach doing this. One way is to design a card file that holds the stock group, and a number range for assignment to product items. Then add a script to the stock control screen to automatically assign these numbers to your inventory.

    1. Build a new card file with these fields:

    CODE, 8 wide, type character, ascending sort, specify the Input Clause as: @!

    ID1, (whatever length is applicable), type numeric.
    ID2, (whatever length is applicable but make it the same as ID1), type numeric.

    When you save the card file call it "CardNum"

    2. Open the Screen Builder, and then the Stock screen.

    From menu select File|Screen Script

    Paste the following script here:

    * Save event
    If Mode = 3
    If IsEmpty(SCRRead("NAME")) .AND. .NOT. IsEmpty(SCRRead("TYPE"))
    OpenTable("Cardnum")

    If CardNum->(Find(SCRRead("TYPE")))
    If CardNum->ID1 >= CardNum->ID2
    Echo("No more numbers are available for this product. Please revise number range in Cardnum card file.")
    Return FALSE
    Endif

    If CardNum->(LockRecord())
    SCRWrite("NAME", CardNum->ID1)
    CardNum->ID1 := CardNum->ID1 + 1
    CardNum->(UnlockRecord())
    Endif
    Endif
    Endif
    Endif

    Return TRUE

    Some things to note about the above script:

    A. You'll have to add number ranges for each stock group you're setting up inside the card file.

    B. If the stock item has a stock group and a product code isn't assigned, this script will automatically assign the next available number within the range specified inside the card file.

    C. If the product code is filled in, this script does nothing.

    D. If the card file record for the group has not been entered, this script does nothing.

Who is online

Users browsing this forum: No registered users and 30 guests