This topic is locked

order entry

12/7/2007 4:15:49 AM
PHPRunner General questions
G
garethp authorDevClub member

Hey there. Not being a programmer I am really hoping someone can help with the following.
I am trying to create a order entry process and have 4 tables - so_header and so_details (master-details set up), parts, users
so_header has the following fields - order_no, raised_by, date, customer

  1. Can I can populate raised_by based on the user logged in?
  2. Can date be populed with the current date?
  3. Can customer be populated automatically - the users table has a field called customer which restricts this user to see this customer only.
  4. When I click "save" in the "add new" screen can I be taken to the so_details add screen? I have managed this with an after record added event to take me to sor_details add.php but the master key is not held for the sor_header just created and populates order_no with zero.
    so_details has the following fields - line, order_no (link back to header), part, description
  5. is there any way to do a search on part table to populate this? I have 1000 parts so a dropdown does not work well for this?
  6. Can description be populated based on part selected?
    Sorry to ask so many question but I thought easier to explain exactly what I am trying to achieve - many thanks.

Alexey admin 12/7/2007

Hi,
please see my answers below:

1.2.

Use Before record addedevent for this.

$values["raised_by"]=$_SESSION["UserID"];

$values["date"]=now();

3. Yes. You need to save customer ID into a session variable in After successful loginevent then assign it to $values["customer"] in Before record added.
4. before redirecting to details table save master key info in session variables.

$_SESSION["so_details_mastertable"]="so_header";

$_SESSION["so_details_masterkey1"]=$keys["order_no"];



5. Yes. Double-click on your partnumber field in Visual Editor, switch to Edit as tab and choose Lookup wizard type.

Check off Lookup wizard as editbox with AJAX lookup there.

6. Yes. Either set the description as a Lookup wizard with AJAX popup and make it dependent on partnumber. Or fill in this field in Before record added/updated event.