Database Tracking

### Index Up << >>

## Database Tracking

Once the order report is processed, you can be sure the order will complete. Therefore it is the perfect place to put MiniVend tags that make order entries in database tables.

A good model is to place a single record in a database summarizing the order, and a series of lines that correspond to each line item in the order. This can be in the same database table; if the order number itself is the key for the summary, you can append a line number to the order number to show each line of the order.

The following would summarize a sample order number S00001 for part number 00-0011 and 99-102:

        code     order_number part_number  quantity   price    shipping  tax
        S00001   S00001                    3          2010     12.72     100.50
        S00001-1 S00001       00-0011      2          1000     UPS       yes
        S00001-2 S00001       99-102       1          10       UPS       yes

You can add fields as appropriate, perhaps with order status, shipping tracking number, address, customer number, or other information.

The above can be easily done with MiniVend's `[import ....]` tag using the convenient `NOTES` format:

        [set import_status]
        [import table=orders type=LINE continue=NOTES]

        code: [value mv_order_number]
        order_number: [value mv_order_number]
        quantity: [nitems]
        price: [subtotal noformat=1]
        shipping: [shipping noformat=1]
        tax: [salestax noformat=1]

        [/import]

        [item-list]
        [import table=orders type=LINE continue=NOTES]

        code: [value mv_order_number]-[item-increment]
        order_number: [value mv_order_number]
        quantity: [item-quantity]
        price: [item-price noformat=1]
        shipping: [shipping-description]
        tax: [if-item-field nontaxable]No[else]Yes[/else][/if]

        [/import][/item-list]

### Index Up << >>