Ron Posted April 15, 2005 Share Posted April 15, 2005 Hi there, I have built a point of sale system in FM7 and have most of the process working. What I am trying to do now is when you "add the sale" I need the system to look at the products in the invoice to check whether the item is a Product or service. This is for a Salon so there could be a hair cut and 2 bottles of shampoo. 1 x service and 2 products. If the item is a product then the system needs to minus the quantity sold from its inventory. I am hoping someone can give me an idea of how to achieve this (the thought process) Please let me know if you need more info. Kindest regards Ron NEville Link to comment Share on other sites More sharing options...
Maarten Witberg Posted April 15, 2005 Share Posted April 15, 2005 sounds like you could benefit from looking at tom's inventory sample. see this post here kjoe Link to comment Share on other sites More sharing options...
FileMakin' Tom Posted April 15, 2005 Share Posted April 15, 2005 Hi Ron . . . Quite simple really. Services are not listed in the inventory, so obviously they cannot be deducted from it. But if a product is entered which IS in the inventory, then the appropriate reduction is automatically made. Be well . . . Tom Link to comment Share on other sites More sharing options...
Ron Posted May 5, 2005 Author Share Posted May 5, 2005 I am a little lost with the concept of products and services. The way I have it set up at the moment is all are products with a Product/Service category field. If the drop down category is set to product then the inventory fields appear. (Love those invisible buttons via relationship) So I do a sale which includes 1 x Shampoo and 1 x Conditioner. when I run the "Post sale" script I need it to loop through each line item and firstly check whether its category is set to product or service. If it is a product then I need to deduct the quantity from its inventory. Can someone give me an idea of the looping script which would achieve the result... regards Ron Link to comment Share on other sites More sharing options...
Maarten Witberg Posted May 5, 2005 Share Posted May 5, 2005 There's an invoices file that has line items portal with sales? Where do you keep track of the stock? In a third file or in the sales line items file? kjoe Link to comment Share on other sites More sharing options...
Ron Posted May 5, 2005 Author Share Posted May 5, 2005 Thanks Kjoe, I am building this section ATM and not sure if I am doing this right but the inventory is tracked via the products database. Any suggestions would be appreciated. Ron Link to comment Share on other sites More sharing options...
Maarten Witberg Posted May 6, 2005 Share Posted May 6, 2005 I think you're doing fine. what you do is this: you make sure you've got the product ID in the sales line items file. then set up a relation between the sales line items file/table and the products file/table. the script runs like this: Code: #you're in the invoices table#go to related records [show only related, "LineItems"]#you've got a found set of all line items now#go to record [first]loop if[Category=Product] set field[Products::QtyInStock, Products::QtyInStock-LineItems::ItemsSold] #ItemsSold is the quantity sold# end ifgo to record [exit after last, next]end loop i just typed out this script without testing, so if you run into problems please let me know. the if/end if wrap is probably redundant. kjoe Link to comment Share on other sites More sharing options...
FileMakin' Tom Posted May 6, 2005 Share Posted May 6, 2005 Why run a script at all? If you have properly set up your data base, the entry of a product ID and quantity dynamically reduces the product's quantity by the amount entered. If you change it to a lesser or greater amount, it will instantly reflect that change. I see no reason to add the step of running a script when one can dynamically update their inventory instantly. Tom Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.