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 => <data>, date => <data>, payment_status => <data>, po => <data> amount_no_tax => <data>, amount => <data>, tax => <data> }, seller => { identifier => <data>, name =><data>, tax_code => <data> }, address => { street => <data>, town => <data>, zip => <data>, country_code => <data>, po_box => <data> }, contact => { name => <data>, email => <data>, phone => <data> }, invoicerow => [ { row_id => <data>, sku => <data>, name => <data>, qty => <data>, qty_unit => <data>, unit_price => <data>, amount => <data>, amount_no_tax => <data>, tax => <data> }, { ... }, ] }
-
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 <mirod@xmltwig.com>
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 - Episode 2 - Per Un Pugno Di Euros: http://www.xmltwig.com/article/ways_to_rome_2/