SYNOPSYS see wtr2_* for how to use this DESCRIPTION Provides basic functions for the various wtr2 scripts FUNCTIONS check_buyer ( $id, $name, $errors) Check that the $id and $name of the buyer are OK in the invoice Return 1 if name and id are OK, else return 0 and add error message(s) to $errors check_po ( $po, $errors) Checks that the $po (purchase order) exists in the data base. Return 1 if it exists, else return 0 and add error message to $errors check_qtty ( $row, $delivered_qtty, $delivered_unit, $ordered_qtty, $ordered_unit, $errors) Check that the quantity delivered is the same as the quantity ordered for each invoice row Return 1 if quantities are OK, else return 0 and add error message to $errors store_all ( $data) Store all data for an invoice. $data should hold the data extracted from the XML in this format: { invoice => { number => , date => , payment_status => , po => amount_no_tax => , amount => , tax => }, seller => { identifier => , name =>, tax_code => }, address => { street => , town => , zip => , country_code => , po_box => }, contact => { name => , email => , phone => }, invoicerow => [ { row_id => , sku => , name => , qty => , qty_unit => , unit_price => , amount => , amount_no_tax => , tax => }, { ... }, ] } store_all will add the links between records in the various tables (the FOREIGN KEYs) reset_default_row_id Set the default_row_id to 0 default_row_id Generate a default row id for those rows which do not have one AUTHOR Michel Rodriguez LICENSE This code is Copyright (c) 2003 Michel Rodriguez. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Comments can be sent to mirod@xmltwig.com SEE ALSO DBI, DBD::SQLite, Memoize Ways to Rome 2 - Kourallinen Dollareita - http://www.xmltwig.com/article/ways_to_rome_2/