Home » Developer & Programmer » Forms » Control The Quantity
Control The Quantity [message #157285] Wed, 01 February 2006 07:25 Go to next message
kolen6
Messages: 5
Registered: February 2006
Junior Member
Hi All,

I have a form for invoice.
In the block I have one column called "Item_no" and another column called "Quantity".
this from read data from warehouse table .
when i insert the item_no the quantity is initial value 1 ,the quantity is "display_item".
when I come in the next record, I want to control the quantity .
example : in warehouse table iterm_no 123 quantity 2.
if i insert item_no 123 the quantity is appear 1 next record insert same number and the third record insert same number (three times insert same number) i saved the
form ok, the quantity in warehouse table for 123 become -1.
How to control the quantity before go to next record.
THE PREVIOUS RECORD IS NOT YET SAVED.

Thanks
Kolen
Re: Control The Quantity [message #157688 is a reply to message #157285] Fri, 03 February 2006 20:29 Go to previous messageGo to next message
M0nst3r
Messages: 38
Registered: February 2006
Location: Wherever the Money Is
Member
Your example isn't very clear.

To display the changes on the form, it sounds like all you need to do is add code to your invoice block's Quantity text item's WHEN-VALIDATE-ITEM trigger to adjust the Inventory Quantity's display item's value. Add code to the block level WHEN-REMOVE-RECORD trigger to reverse an adjustment if a user deletes a record.

You have several options for handling the adjustment to the inventory table quantity.
1. Use database triggers on the invoice table to adjust the quantity on the inventory table.
2. Add DML to your ON-INSERT and ON-UPDATE triggers in the invoice block to adjust the inventory quantities.
3. etc.
Re: Control The Quantity [message #157720 is a reply to message #157688] Sat, 04 February 2006 12:16 Go to previous messageGo to next message
kolen6
Messages: 5
Registered: February 2006
Junior Member
Thank M0nst3r
My Example
- I have project point of sale the are table invoice, invoice _details, warehouse,…

-Invoice_ details column item_ no, quantity, item_ price,

-Warehouse column item_ no, quantity,

Invoice screen read data from warehouse table and save description for invoice in invoice and invoice _details tables, and update quantity for item _no in warehouse table

Example
Data in Warehouse table
Item_ no quantity
123 3
344 1
544 2
. .
. .
. .

- In invoice screen
Write the item _no 123
Item no quantity item price ……
123 1 10

- The quantity is default 1 the end user just write (insert) the item _no

-If I saved the form is ok.
- If I check the quantity for item_ no 123 in warehouse table

Item_ no quantity
123 2
344 1
544 2
. .
- The quantity is 2 ok.

-New invoice
Item no quantity item price ……
123 1 10
123 1 10
123 1 10
123 1 10
344 1 20
544 1 5

- If I saved the form is ok,
- If I check the quantity for item_ no in warehouse table

Item_ no quantity
123 -2
344 0
544 1
. .

-look the quantity for item _no 123 is -2
-the quantity for item no 344 is 0 next invoice can not sale item no 344 because the quantity is 0 is ok,



How to control the quantity before go to next record?

- I means before third record in invoice form for item _no 123
Before become minus.

THE PREVIOUS RECORD IS NOT YET SAVED.


Thanks again M0nst3r
Re: Control The Quantity [message #157725 is a reply to message #157285] Sat, 04 February 2006 15:27 Go to previous messageGo to next message
M0nst3r
Messages: 38
Registered: February 2006
Location: Wherever the Money Is
Member
In that case, you'll want to use a record group to keep track of the quantity ordered for each invoice line. On your invoice quantity's WHEN-VALIDATE-ITEM trigger, you'll have code that compares the quantity on-hand with the quantity ordered plus the previously ordered. You'll need additional code to modify the record group to handle changes to the quantity.

After you get this code working, you should account for any problems that may occur in a multiuser environment.

For example,
Quantity On-hand = 100
First, user 1 enters a quantity of 80 but doesn't save.
Then, user 2 enters a quantity of 50 and saves. (Quantity = 50)
User 1 saves his invoice. (Quantity = -30)

In this scenario, user 2's quantity passes validation. User 1's quantity also passed validation.
Re: Control The Quantity [message #157794 is a reply to message #157725] Mon, 06 February 2006 01:40 Go to previous messageGo to next message
kolen6
Messages: 5
Registered: February 2006
Junior Member
Thank you M0nst3r
I will try to use record group.
Re: Control The Quantity [message #157847 is a reply to message #157794] Mon, 06 February 2006 12:27 Go to previous message
M0nst3r
Messages: 38
Registered: February 2006
Location: Wherever the Money Is
Member
If your form is simple (ie. has only one block), you might want to consider using the POST built-in as an easier option.
Previous Topic: list box 3
Next Topic: how to create text item at runtime. help me!!!!!!!!
Goto Forum:
  


Current Time: Fri Sep 20 05:52:34 CDT 2024