Jump to content
Server Maintenance This Week. ×

This topic is 7546 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello TereLavin,

By 'cantity', I assume you mean quantity??

If so, then the process is relatively simple. Basically you need a related file (eg a product file) with a quantity field in it, and you will need a script which cycles through the items on an invoice and subtracts the invoice quantity from the products quantity, then marks the invoice as committed (so it can't be accidentally committed twice).

A very simple example of such a script is:

If ["not IsEmpty(ComittedField)"]

Show Message ["This record is already comitted"]

Exit Script

End If

Go To Portal Row [<Line Items>, First]

Loop

Set Field ["gCurrentProduct", "LineItems::ProductID"]

Set Field ["Inventory::QuantityOnHand", "Inventory::QuantityOnHand - LineItems::Quantity"]

Go To Portal Row [Exit after last, Next]

End Loop

Set Field ["CommittedField", " "X" "]

Such a script would work in an invoice file that has a portal listing line items for the current invoice, plus a relationship called 'inventory' which matches a global field called 'gCurrentProduct' with the ProductID field in the products file.

It would generally also be wise to set validations or record level access (or other measures) to ensure that invoices cannot be edited after they have been committed.

There are many variations and many embellishements that are possible - all of which depend on the business rules and on the structure of the solution. But the above should give you a few ideas to work with. wink.gif

Link to comment
Share on other sites

This topic is 7546 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.