jdhunter Posted March 31, 2006 Posted March 31, 2006 I'm trying to create a script that creates an invoice for a company. I want a script that can will take the name of company record that i am in and search for it within the invoice section. I can't figure out how to perform a generic script search using the record that i am viewing. thanks,
VICH Posted March 31, 2006 Posted March 31, 2006 have a global feild hidden on the layout... once you do that set up to script to set the global feild to the name of the company from that record. then enter find mode and set the company name feild in find mode to the global feild. then perform the find that should do it
Ender Posted March 31, 2006 Posted March 31, 2006 Using the Set Field[] script step, there's no need to have the field on the layout.
LaRetta Posted March 31, 2006 Posted March 31, 2006 Hi jdhunter, You begin by saying you want to create an invoice then you say you want to search for that customer in invoices. I believe you want to 'search' meaning you want to somehow create a new invoice then FIND that customer to insert into the invoice? Globals aren't required here. Here is the general approach: Go to Layout [ Invoices "New Invoice" layout ] New Record Request Set Field [ Invoices::CustomerID ; Get ( ScriptParameter ) ] Commit Records/Requests Then, back in your Customer layout, make a 'Create Invoice' button. Right-click the button to add your script, ie, Perform Script [ above script ] and, below is where the script parameter should be entered. In that calc box, insert ONLY your Customers::CustomerID field. When that button is clicked, the script parameter will be used within the script and your Customer will be FOUND when the new Invoice is created. I assumed (and I shouldn't) that you have a relationship established from Customers::CustomerID = Invoices::CustomerID? If not, you NEED one. At the moment you commit the new Invoice record, the customer information can be displayed on the Invoice (by just placing the Customer fields directly on it). Some Customer information can simply be displayed but the Invoice should have duplicate fields of the critical Customer Information such as address. This is because (over time) a customer might move ... but it's a bummer to open an old invoice and have it display the customer's NEW address. It is best to 'freeze in time' all important Invoice information (which may change). In this way, it's like printing a hard-copy of the Invoice. It takes more space in your solution but it is worth it. If you need help on how to 'transfer' the customer address etc. to the Invoice (Lookups or Auto-Enter), let us know and we can walk you through it. And if you meant something else than creating a new Invoice, speak up as well ... sometimes it is difficult to express a need when writing it ... and it is just as difficult to interpret written words and know exactly what someone needs. But there are great people here ready to help you. LaRetta :wink2:
LaRetta Posted March 31, 2006 Posted March 31, 2006 Hi Mike, I must have been typing very slow this morning - no coffee yet! Well, I'll leave my fluff as I think it has some merit ...
jdhunter Posted March 31, 2006 Author Posted March 31, 2006 (edited) I'm using a report to create invoices, is the process still the same when i create a new record/request. The invoices or just grouped information from the job order table. Thanks for the help so far. jonny Edited March 31, 2006 by Guest
LaRetta Posted April 1, 2006 Posted April 1, 2006 Hi Jonny, Several questions ... and don't be short on the information ... here is what would help us: 1. What is the type of layout? Is it list, table, form? 2. Select Layouts > Layout Setup and what does it say in 'Show Records From.' Is it based upon an Invoice table occurrence (your Job Order table?) or on your Customer table? 3. "The invoices or just grouped information from the job order table." I don't understand this part. Can you say more about this? 4. What are your key fields? How are they related? Are they related on CustomerID? 5. What are the table names of these two tables? A List layout can have buttons in the body which pick up the script parameter (CustomerID) and the script I suggested would work fine; and Form view would work. Tables would NOT work. But we simply need to know more ... LaRetta
jdhunter Posted April 1, 2006 Author Posted April 1, 2006 (edited) Thanks again for the help, it is super helpful so far. Here are the answers to your questions. 1. List view. I created the invoice sheets using the create report function. It is in List form though. 2. It is based off of information from the job order table. I want to be able to create invoices from the client id table though. 3. To answer this question i guess i should explain what i'm trying to do, which is dispatch bike riders for a messenger company. So the key fields are the address's that the rider goes to the cost of the job and the time picked up and dropped. All pretty simple. 4. The names of the tables i use are client id and job orders and addresses. The client id is used in order to give information such as its location and such and also which zone it is located in. The Job Order pulls all the information from the client ID and then records a single job order. The Invoicing layout is just caculating the summary of all the job orders under the client id. Thanks so much for you help. Jonny Edited April 1, 2006 by Guest
LaRetta Posted April 1, 2006 Posted April 1, 2006 I'm afraid I still don't understand what you need or what you are doing. Invoices are usually records - not reports. Can you attach your file? It would help a lot. :wink2:
jdhunter Posted April 2, 2006 Author Posted April 2, 2006 (edited) Okay, so i spent some time with the script maker and figured a bit out about why i'm so confusing when i am talking about this problem. So basically what i want to happen is not create a new invoice for the client but perform a search. I want my script do a search in the job orders for all of the job order for a specific client. So the script you pointed out had me creating a new record and then set field for that new request. What i really want is a script that will perform a search in the job order table. So what i have right now is this. Go to Layout [Job Orders] Perform Find [] so how do i get the perform find to use the client id from the client id table to peform the find. I have the client id related to the client id in the job orders table. I will post the file later as i'm not on the computer with the file right now. Jonny Edited April 2, 2006 by Guest
jdhunter Posted April 2, 2006 Author Posted April 2, 2006 Okay here is a file with the record on it. Jonny 4_Star_Dispatch-2.fp7.zip
LaRetta Posted April 2, 2006 Posted April 2, 2006 You have two Job Order fields which pertain to your request - Paid (yes or no) and Invoiced (yes or no). You are performing your find for the UNPAID invoices to invoice them again? And what about the Invoices which haven't been invoiced yet? At the same time, if a Job Order has just been completed, it may not be time to invoice it yet? Are all customers prepaid, ie, you don't extend Net30 terms for instance? Or are you using a date range also to determining which Job Orders are ready to generate? If you can answer the above then we'll be ready to go. BTW, you have your primary keys still on the Customer name. I will assume (since you've added a new ClientID) that you plan to switch your structure to using serial-generated IDs instead and drop the name stuff, right? You should do that NOW before you get further into your design. :wink2:
jdhunter Posted April 3, 2006 Author Posted April 3, 2006 The most important one is making sure that the invoices say "No", I think the other functions that i use will be easy enought to not automate such as paid and unpaid. Yeah, i was going to switch over the Client ID after i figured out the invoicing. Jonny
LaRetta Posted April 3, 2006 Posted April 3, 2006 I've attached a script parameter to your Create Invoice of Unpaid Jobs button on your Clients layout. Then your Find will use that to isolate Job Orders for that specific Client. Keep in mind that you will need to change your script parameter AND the Set Field[] in your script when you switch your keys. That's why I was asking about them. There are other approaches, such as GTRR. But this seemed to fit into your design (and where you're at) at bit better. LaRetta :wink2: 4_Star_DispatchREV.zip
jdhunter Posted April 4, 2006 Author Posted April 4, 2006 Thanks so much, you have been a great help. If you ever have a question about bikes let me know. Jonny
Recommended Posts
This topic is 6811 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