Hehe, thanks. I'm going to start a new topic about using the global adb object.
Ah I see, the 'crmid' column corresponds with the ID in each individual table for quotes, invoices etc. and the 'setype' column tells you which module it relates to.
So let's see if I can set up some basic workflow here (and please tell me if you want me to start a different topic for this, I'll move this entry then):
Let's say I want to create an XML file that creates an entry for each invoice, and within that invoice entry I want to create an entry for each inventory line.
- I'll start by selecting from the invoices table all records, and place them into an array. No need to check for type 'invoice' against the 'crmentity' table because I know the ID's are unique.
- For each entry in the beforementioned array, I perform another query retrieving from the 'inventory details' table all records that are related to the invoice ID in the current iteration of the loop.
- I'll build an associative multi level array with all invoices and inventory lines.
- Then use DOMDocument to parse this into an XML structure.
- Save the XML file locally on the server.
- Setup a workflow that fires the creation of this file on every invoice's first save.
- Get the accounting software to read from this file every 15 minutes or so to keep it up to date.
Let me know if there are some logic errors here.
Ah I see, the 'crmid' column corresponds with the ID in each individual table for quotes, invoices etc. and the 'setype' column tells you which module it relates to.
So let's see if I can set up some basic workflow here (and please tell me if you want me to start a different topic for this, I'll move this entry then):
Let's say I want to create an XML file that creates an entry for each invoice, and within that invoice entry I want to create an entry for each inventory line.
- I'll start by selecting from the invoices table all records, and place them into an array. No need to check for type 'invoice' against the 'crmentity' table because I know the ID's are unique.
- For each entry in the beforementioned array, I perform another query retrieving from the 'inventory details' table all records that are related to the invoice ID in the current iteration of the loop.
- I'll build an associative multi level array with all invoices and inventory lines.
- Then use DOMDocument to parse this into an XML structure.
- Save the XML file locally on the server.
- Setup a workflow that fires the creation of this file on every invoice's first save.
- Get the accounting software to read from this file every 15 minutes or so to keep it up to date.
Let me know if there are some logic errors here.