Gossamer Forum
Home : Products : DBMan : Customization :

Wierd Modification

Quote Reply
Wierd Modification
What I would like to do, is basically build a warehouse tracking system, and to do this, basically someone will enter a record containing whats being moved into the warehouse, then gradually move stuff out of the warehouse, but generate new records for the parts moved out, and reduce the total in the original record.

Basically I intend it to work like this Smile
User inputs record containing orginal load.
Loads gets moved out (uses new split load function I am coding - see below), whihc basically takes inputs of orignial load ID, then reduces the quantity field, in original record... then creates new record identical to orginal with this quantity (but diff load ID), with the following fields changed : Load ID, End Date (to current date (&get_date)), quantity, and 'In warehouse'

I'd appreciate idea on howto do this (I have added a men option for it, but need to code the subroutine to do it, but don't have a clue where to start.

Tanks for the help with teh addition JP, helped a lot, and helped me ake sense of how the daabase works.

Oh, and yes, I will purchase a copy of DBMan, once its done.. as this will then be for corporate use, but atm, its a trial, in house, as we're trying to recreate our shitty current database!

Dan
Quote Reply
Re: Wierd Modification In reply to
Let's see. Your menu item would need to include the $db_key value for the original load. You would need to have a form to be able to enter the quantity that was moved out. You would probably use "&get_record" to load in the information into the form, so the person would be sure it was the correct load.

So this would require two subroutines in html.pl -- one for the form and one for the success.

Then there would need to be a new subroutine in db.cgi. It would have to find the main load, subtract the amount being moved (checking to be sure that the amount wasn't greater than what was available), saving the old record and then inserting the new values into the fields and saving that one, too.

I would look to sub modify_record as a beginning of how to code it. If you come up with some code and you're not sure about it, post it here and I'll be glad to help you debug it. (It does help if you use the
Code:
/
tags on the forum. I find it much easier to read. If you're not sure what I mean, check the "UBB Code" link on the response form. It explains it pretty well.)

------------------
JPD





Quote Reply
Re: Wierd Modification In reply to
Another suggestion is to create a field in the default.cfg file called something like "Status" with the variables of "in" and "out". Then you can use the db_select_fields to build this field as a drop-down menu.

Then you can add the appropriate codes in the html.pl. Of course, if you actually want separate ID #'s for moved in and moved out records, then JPDeni's suggestion is the best.

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us