Robbydobbs Posted March 28, 2003 Posted March 28, 2003 If I have a buyer that purchased an item and then printed out an invoice. Each invoice will have it's own unique ID, once an invoice is printed a date printed is stamped on the invoice. The same buyer comes back again and wants another item. The buyer ID is the same so the previous item purchased will also show up as the items are related by buyer ID. Now I have two invoices to choose from, both have a unique ID number but one has been printed with a date stamp on it and the other has not. How would I write a script stating that I only want the item that has not yet been printed to print? I think it should be something to the fact: "compare records if buyer ID is the same and the invoice ID does not match and if date printed is (" "), then print only that record".
danjacoby Posted March 28, 2003 Posted March 28, 2003 Assuming each invoice is a separate record (and you weren't clear on this), then when you get the print dialog box, just choose "Print Current Record".
LiveOak Posted March 28, 2003 Posted March 28, 2003 There are a couple of basic techniques. You can: 1) Perform a find setting Buyer ID to the correct ID and Date Printed to "=". 2) Create a relationship which shows only those invoices for this buyer which have not been printed. For this you will need to create a compound key based upon Buyer ID and a calculated field which would indicate if Date Printed has been filled out. The "left side" key might look like: NoPrintKey (calculation, text, indexed, ASCII) = BuyerID & "-" & "0" The "right side key" in the related file would look like: PrintKey (calculation, text, indexed, ASCII) = BuyerID & "-" & Case(IsEmpty(Date Printed), 0, 1) This give you a relationship which only show invoices which have not be printed for a given Buyer ID. You can isolate these records in the related file using the Goto Related Record[show only related records] script step in the main file. -bd
Ugo DI LUCA Posted March 28, 2003 Posted March 28, 2003 Hi Dobbers, Strange you are relating items to buyer_Id.... What happens when there is more than one item on the invoice ? I don't get the process right now, but if you really have this relationship, you surely have a portal. Then use a Go to Related record script. Would still need to understand what's the logic for that setup though ?
Robbydobbs Posted March 28, 2003 Author Posted March 28, 2003 Ugo, let me try to explain as much as I can about what I am trying to do. We run an Auto Auction I have two types of customers. One customer may purchase a vehicle and come up front at that time to pay for the purchase on that vehicle and go back out to get another. When he comes up front to pay for his one vehicle I need to be able to print an invoice for that one particular vehicle and then have that invoice shown as printed and not be able to show that purchase again. Now the customer may go out again and purchase another vehicle. He has the same customer number but a new purchase. He then comes in to pay for his new purchase but the previous purchase cannot show up on this invoice. Now the second kind of customer may be someone who purchase 3 vehicles through out the day and then comes in and wants all three vehicles on the same invoice. Then he may go out again and purchase another vehicle and this purchase can not be on the same invoice as the previous three. The buyer is generated in a separate database called Bidder with a unique buyer_id. The item is generated in a database called Inventory with a unique item_id. The items that are purchased are assigned prices and quantity are in a database called Clerking. Invoices are printed out of the Clerking database. The payments applied to the items are in a database called Payments. I have a portal in payments from the clerking database showing all items that are purchased by the buyer by buyer_id. I then have line items for each payment a buyer makes for his purchase. This is also related by buyer_id. Does this explain a little more in detail what it is I need? LiveOak gave me some great advise, I don't really understand the code, I'm not that advanced in FMPro. It's probally exactly what I need to make it work, but I don't understand what it is I'm suppose to do. So if you could explain what I need to do in more literal terms I would appreciate it.
Ugo DI LUCA Posted March 28, 2003 Posted March 28, 2003 Hi Dobbers, Very clear. I cannot see the relationship from bidder to item here. That's OK though as I couldn't see any reason for that. Some more details please : How do you know in advance a buyer may come back and ask to add an item to his invoice ? Are payments made on each item sold ? That would mean that each payment should be entered as a deposit, not as a "clerking" payment.
Robbydobbs Posted March 28, 2003 Author Posted March 28, 2003 How do you know in advance a buyer may come back and ask to add an item to his invoice ? I don't, but we have to be prepared for someone always coming back in to do another transaction so we have to close out an invoice once it has been printed. Are payments made on each item sold ? The buyer can make a down payment of $300 and come back and make another later. If this happens once the $300 payment is made we then close out the invoice by printing it and make adjustments to the database later when the rest of the money is brought. That would mean that each payment should be entered as a deposit, not as a "clerking" payment. Some buyers may pay for their purchase in full the first time they come to pay.
Ugo DI LUCA Posted March 28, 2003 Posted March 28, 2003 Hi Dobber, Now I'm getting confused. we have to be prepared for someone always coming back in to do another transaction so we have to close out an invoice once it has been printed. So you're always printing the invoices Just to make sure... He then comes in to pay for his new purchase but the previous purchase cannot show up on this invoice purchase = payment ?
Ugo DI LUCA Posted March 28, 2003 Posted March 28, 2003 Hi Dobbers, I think I'm getting it right now. But it seems to me more likely a relational problem than a script problem. What you are calling "Invoices printed" and "Invoice non printed" should be called "Invoice" and "CustomerOrder". One customer order could be partly paid (deposits) or totally paid. One Invoice could group one or many customer orders, then would group all deposits on Customer Order. Then I would create a Customer Order file, using you Clerking file... Tell me if I'm far from what you need.
Robbydobbs Posted March 28, 2003 Author Posted March 28, 2003 I know this can be quite confusing. But what has to happen is that when a buyer wins a bid on a vehicle and comes in to make a $300 deposit on the vehicle he just purchased, then we have to be able to print out an invoice with the vehicle he just bidded on. Once the invoice with that transaction has been printed, my employer wants a message to show that the invoice has been printed for that vehicle and if we want to do any other transaction we will have to reprint the invoice. Each invoice has it's own unique ID number. When I enter the payment database and perform any action, the invoice_id will be generated. Once an invoice has a unique id number it is assigned to the lot number or item number of the vehicle that is purchased. A buyer can have 3 vehicles on the same invoice with the same invoice id number as long as there has not been a payment on any of the vehicles prior to this. Then the same buyer can come back again later in the day with a new vehicle and would get a new invoice with a new invoice_id. example: Buyer #: 235 Vehicle #'s 123 ($500), 124 ($2000), 125 ($1500), 126 ($750). Invoice #'s 500000, 500001 Buyer # 235 purchases (wins bid) on 3 vehicles 123, 124, 125 at 12:30 p.m. an invoice is printed: Invoice #500000 Buyer # 235 Vehicle # 123 Vehicle # 124 Vehicle # 125 amount paid Visa $900.00 amount owed $3100.00 Invoice printed. If someone trys to print Invoice #500000 again, they should receive a message stating that this invoice has already been printed do you want to reprint it again. Buyer #235 comes back again at 3:00 p.m. purchases (wins bid) on vehicle 126. an invoice is printed. No information other then the information pertaining to Vehicle 126 will be on this invoice. This also includes any payment made. Invoice # 500001 Buyer # 235 Vehicle # 126 amount paid Visa $300.00 amount owed $450.00 Invoice printed.
Robbydobbs Posted March 28, 2003 Author Posted March 28, 2003 Ugo, thank you for being so patient with me. I really appreciate this.
Ugo DI LUCA Posted March 28, 2003 Posted March 28, 2003 Hi Dobbers, Thanks for clearing us on your needs. Stating that the customer will never go back home with the keys of the car before paying it, I would definitely create some customer reservations (more appropriate that my first Customer Order suggestion). Then, at the end of the Auction : - if the customer wants all his 3 cars on a separate invoice, you would script a create an invoice based on each reservation_N
Recommended Posts
This topic is 7914 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 accountSign in
Already have an account? Sign in here.
Sign In Now