[set page_title]Quickbooks -- Generate new IIF files[/set] [set help_name]quickbooks.main[/set] [set icon_name]icon_config.gif[/set] @_UI_STD_HEAD_@
Please note: we do not recommend generating more than 100 IIF files at a time, due to the load on the system.
Starting generation...
[log create=1 umask=022 file=">orders/0_qb_results.iif" type=text interpolate=0 hide=1][/log] [comment] [if cgi query_type eq 'any_new'] [tmp addsql] AND comments NOT LIKE '%(syncronized)%' [tmp last_order_generated][file etc/last_order_generated.number][/tmp] [if !scratch last_order_generated] [log create=1 umask=022 file=">etc/last_order_generated.number" type=text hide=1][/log] [/if] [calc] $CGI->{ 'order_from' } = 1020; $CGI->{ 'order_to' } = 1030; [/calc] [goto done] [/if] [/comment] [tmp sql] SELECT * FROM transactions WHERE 1=1 AND deleted <> 1 [if cgi date_from] AND order_ymd >= '[cgi date_from]' AND order_ymd <= '[cgi date_to]' [/if] [if cgi order_number] AND order_number = '[cgi order_number]' [/if] [if cgi order_from] AND order_number >= '[cgi order_from]' AND order_number <= '[cgi order_to]' [/if] [if cgi query_type eq 'any_new'] AND comments NOT LIKE '%(syncronized)' LIMIT [scratch any_new_limit] [/if] [/tmp] [comment] This is done so that the IIF files can be downloaded [/comment] [tmp mv_add_dot_html]0[/tmp] [query base=transactions prefix=tx list=1 type=list sql='[scratch sql]'] [no-match] No Match. Query was[scratch sql][/no-match] [list] [calc] if ( $CGI->{ 'qb_invoice_num' } ) { if ( ! $Scratch->{ 'qb_invoice_num' } ) { # If this is our first time around, initialize tmp var, and subtract one. $Tag->tmp( 'qb_invoice_num', 0 ); $Scratch->{ 'qb_invoice_num' } = $CGI->{ 'qb_invoice_num' } + q{ [tx-increment] } - 1; } else { $Scratch->{ 'qb_invoice_num' } = $Scratch->{ 'qb_invoice_num' } + 1; } } return; [/calc] [if cgi query_type eq 'any_new'] [tmp hideme] [data table=transactions field=comments value='[tx-param comments] (syncronized)' key='[tx-param code]'] [/tmp] [/if] [tx-increment]: Generating [tx-param order_number][if cgi qb_invoice_num] using QB invoice number [scratch qb_invoice_num].[/if] (Download [page href="ui_download/orders/[tx-param order_number].iif"][tx-param order_number])
[tmp hideme]@_TRANS_QUICKBOOKS_@[/tmp] [/list] [/query]
...done.