Creating XML output for accounting software - Printable Version +- CoreBOSBB (https://discussions.corebos.org) +-- Forum: Support (https://discussions.corebos.org/forumdisplay.php?fid=17) +--- Forum: Administrator Support (https://discussions.corebos.org/forumdisplay.php?fid=8) +--- Thread: Creating XML output for accounting software (/showthread.php?tid=197) |
Creating XML output for accounting software - Guido1982 - 11-12-2015 I'm in the process of creating an XLM output for accounting software. At first I wanted to base this on the 'Inventory details' module, but there's a problem. Here's what I have so far: PHP Code: <?php Which produces: Code: <xml><invoice><invoicenumber>20151252</invoicenumber><invoicedate>09-11-2015</invoicedate><products><product>Zak granulaat</product><product>Verpakking- en verzendkosten</product><product>Zak granulaat</product><product>Verpakking- en verzendkosten</product></products><accounts><accountname>Schurer Kamphuis</accountname><accountno>ACC962</accountno></accounts></invoice><invoice><invoicenumber>20151256</invoicenumber><invoicedate>06-11-2015</invoicedate><products><product>GVL40</product><product>Verpakking- en verzendkosten</product></products><accounts><accountname>Autobedrijf Taris</accountname><accountno>ACC1055</accountno></accounts></invoice><invoice><invoicenumber>20151261</invoicenumber><invoicedate>06-11-2015</invoicedate><products/><accounts><accountname>Autoherstel Charlois</accountname><accountno>ACC1979</accountno></accounts></invoice></xml> That's all very nice, but as you can see the first invoice holds the same products twice. This is because I edited and saved this invoice twice. I checked the database and the Inventory details module creates a record each and every time the related module record saves. This could be fine, maybe it's the designers intended behaviour, so not a complaint about the module, but not the behaviour I want. So I searched for a way to list products and services related to an invoice from the traditional inventory module. I found that in the inventory_products_rel table all products ever listed get a record, and products that belong to the same inventory (list) receive the same inventory number. What I can't find out is how an invoice, SO or something like this knows which inventory number to use. I need this information to list the products, prices etc. in my XML. RE: Creating XML output for accounting software - joebordes - 11-12-2015 inventoryproduct_rel.id = invoiceid or quoteid or salesorderid or purchaseorderid RE: Creating XML output for accounting software - joebordes - 11-12-2015 I just tried editing and saving an invoice and the inventory details module acted correctly: as expected it eliminated the other records and created new ones. Note that the system never really deletes information it only marks it as deleted by setting vtiger_crmentity.deleted=1, you have to filter those out from your query with an inner join RE: Creating XML output for accounting software - Guido1982 - 11-12-2015 Thanks, I'll take yout tips and work on this. In the application the records are deleted yes, but not in the database, but this may be due to the behaviour you described. |