Stock ID format for subcategories on Inventory

View: New views
3 Messages — Rating Filter:   Alert me  

Stock ID format for subcategories on Inventory

by PCS-Lists :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm helping to build a numeric stock ID format for an enterprise and they want to use some like this:
XX.YYY.ZZZZZ where the XX is an ID for categories, YYY is an ID for subcategories and ZZZZZ is an ID that specify the items. The first part must to have only two digits and I only got to put three. Is there a way to automate a code like this?

Thanks and regards.

Re: Stock ID format for subcategories on Inventory

by Nathan Gray :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 10-Aug-09, at 2:24 PM, PCS-Lists wrote:

> I'm helping to build a numeric stock ID format ...


First, let's get some terminology straight, because otherwise you'll  
be very confused.
You want to change the stock number (stock_num).  This field is also  
known as stock code or SKU, depending on your organisation.
You do not want to touch stock ID, which is a system generated field.

> want to use some like this:
> XX.YYY.ZZZZZ where the XX is an ID for categories, YYY is an ID for
> subcategories and ZZZZZ is an ID that specify the items. The first  
> part must
> to have only two digits and I only got to put three. Is there a way to
> automate a code like this?


It is possible, you'll have to make some adjustments to add in parent  
category.

1.  See class.so_perp_stock.inc.php, suggest_stock_number().
You'll have to look up the stock item's category, find the parent  
category, and add that into the sprintf.

2.  Add your new parameter into class.hook_perp_inventory.inc.php,  
around line 137.

When done, you should be able to use this as a stock number format:
%2$02d.%6$03d.%1$05d

After you get it working, please send a diff and I'll add it into SVN.

Nathan Gray
nathan at goarctic dot com


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Perp-developers mailing list
Perp-developers@...
https://lists.sourceforge.net/lists/listinfo/perp-developers

Re: Stock ID format for subcategories on Inventory

by PCS-Lists :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Nathan Gray wrote:
...
It is possible, you'll have to make some adjustments to add in parent  
category.

1.  See class.so_perp_stock.inc.php, suggest_stock_number().
You'll have to look up the stock item's category, find the parent  
category, and add that into the sprintf.

2.  Add your new parameter into class.hook_perp_inventory.inc.php,  
around line 137.

When done, you should be able to use this as a stock number format:
%2$02d.%6$03d.%1$05d

After you get it working, please send a diff and I'll add it into SVN.
Nathan,

Forgive me, but I don't understood what I have to do. I found the file and function that you said but I don't know what did you mean with "find the parent category, and add that into the sprintf.". and with Add your new parameter into class.hook_perp_inventory.inc.php. What parameter do I have to add? I'm a rookie on php. Can you try to explain me once more?

Forgive me and thanks.