[calc] if ( $CGI->{showarchive} ) { delete $Values->{showpending}; $Values->{showarchive} = 1; $Scratch->{archive_sense} = 'eq'; $Scratch->{archive_img} = 'left.gif'; $Scratch->{archive_nm} = 'unarchive'; $Scratch->{archive_label} = 'archived'; } elsif($CGI->{showpending}) { delete $Values->{showarchive}; $Values->{showpending} = 1; $Scratch->{archive_sense} = 'ne'; $Scratch->{archive_img} = 'right.gif'; $Scratch->{archive_nm} = 'archive'; $Scratch->{archive_label} = 'pending'; } elsif(! $Values->{showarchive} and ! $Values->{showpending}) { delete $Values->{showarchive}; $Values->{showpending} = 1; $Scratch->{archive_sense} = 'ne'; $Scratch->{archive_img} = 'right.gif'; $Scratch->{archive_nm} = 'archive'; $Scratch->{archive_label} = 'pending'; } $Scratch->{archive_label} = $Tag->loc('', "$Scratch->{archive_label} displayed"); return; [/calc] [set icon_name]icon_orders.gif[/set] [seti page_title] [if value showarchive] [L]Orders[/L]: [L]Archived Orders[/L] [set help_name]order.main.archived[/set] [else] [L]Orders[/L]: [L]Pending Orders[/L] [set help_name]order.main.pending[/set] [/else] [/if] [/seti] [set ui_class]Orders[/set] [tmp page_perm]order=l[/tmp] @_UI_STD_HEAD_@ [value name=mv_data_table set=transactions hide=1] [if-mm !tables] [set ui_error] [L]Not authorized for order administration. Contact administrator?[/L] [/set] [bounce page="__UI_BASE__/error"] [/if-mm] [tag flag write]transactions[/tag] [perl tables=transactions] delete $Scratch->{ui_location}; my $db = $Db{transactions}; if(! $db) { $Scratch->{ui_error} = "Error: no transactions database.
"; $Scratch->{ui_location} = "__UI_BASE__/error"; return; } my ($value, $action_col); if($CGI->{archiveorder}) { $value = 1; $action_col = 'archived'; } elsif($CGI->{unarchiveorder}) { $value = 0; $action_col = 'archived'; } elsif($CGI->{deleteorder}) { $value = 1; $action_col = 'deleted'; } elsif($CGI->{vieworder} and ! $CGI->{viewnext}) { $CGI->{order} =~ s/^\0+//; $CGI->{order} =~ s/\0+$//; $Scratch->{ui_location} = $Tag->area('__UI_BASE__/order_view', $CGI->{order}); } elsif($CGI->{xload}) { $Scratch->{ui_location} = $Tag->area('__UI_BASE__/dbdownload'); } else { $CGI->{order} =~ s/^\0+//; $CGI->{order} =~ s/\0.*//s; $Scratch->{start_at} = "sm=$CGI->{order}"; } if($action_col) { for(grep $_, @{$CGI_array->{order}}) { $db->set_field($_, $action_col, $value); } } if(@errors) { my $plural = @errors > 1 ? 's' : ''; return "Error$plural:
"; } if($CGI->{viewnext}) { my $ordnum = $CGI->{order}; $ordnum =~ s/[\0,\s].*//; return if ! $ordnum; $ordnum++; CHECKNEXT: { if (! $db->record_exists($ordnum) ) { undef $ordnum; last CHECKNEXT; } if ($db->field($ordnum, 'deleted') ) { $ordnum++; next CHECKNEXT; } if ($Values->{showarchive} and ! $db->field($ordnum, 'archived') ) { undef $ordnum; last CHECKNEXT; } else { last CHECKNEXT; } } if ($ordnum) { $Scratch->{ui_location} = $Tag->area( { href => '__UI_BASE__/order_view', form => "order=$ordnum", } ); } else { $Scratch->{message} = "[L]No next order.[/L]"; } } return; [/perl] [if scratch ui_location] [bounce href=`delete $Scratch->{ui_location}`] [/if] [update values] [if scratch message]
[scratch message]
[set message][/set] [/if] [if scratch ui_message]
[scratch ui_message] [set ui_message][/set]

  [/if]
[L]or[/L]
[if cgi ui_text_qualification]

[L]Entries containing[/L] "[cgi ui_text_qualification]"

[/if] [search-region more=1 arg=" fi=transactions ml=__UI_SZ_LIST_ORDER__ md=1 st=db [if cgi ui_text_qualification] se=[cgi ui_text_qualification] [else] co=yes sf=archived se=1 op=[scratch archive_sense] sf=deleted se=1 op=ne [/else] [/if] [scratch start_at][set start_at][/set] [if cgi ui_sort_field] tf=[cgi ui_sort_field] to=[cgi ui_sort_option] [else] tf=0 [/else] [/if] rf=code,order_date,total_cost,nitems,status,city,state,country,fname,lname,username "] [calc] my $so = $CGI->{ui_sort_option}; my $fld = $CGI->{ui_sort_field}; my $qual = $CGI->{ui_text_qualification} ? "se=$CGI->{ui_text_qualification}" : ''; $fld =~ s/[\s,\0].*//; sub sortrev { my ($f, $n) = @_; my $out = "$qual\nui_sort_option="; $out .= 'n' if $n; return $out unless ($fld eq $f) || ($f eq 'code'); return $out if $so =~ /r/; return $out . 'r'; } return; [/calc]
[search-list] [/search-list] [no-match] [/no-match] [more-list] [/more-list]
  [page href=@@MV_PAGE@@ form=` return "ui_sort_field=code\n" . sortrev('code'); `][L]Order[/L] [page href=@@MV_PAGE@@ form=` return "ui_sort_field=lname,fname\n" . sortrev('lname'); `][L]User[/L] [page href=@@MV_PAGE@@ form=` return "ui_sort_field=country,state,city\n" . sortrev('country'); `][L]Location[/L] [page href=@@MV_PAGE@@ form=` return "ui_sort_field=order_date\n" . sortrev('order_date'); `][L]Date[/L]/[L]Time[/L] [page href=@@MV_PAGE@@ form=` return "ui_sort_field=nitems\n" . sortrev('nitems', 1); `][L]Items[/L] [page href=@@MV_PAGE@@ form=` return "ui_sort_field=total_cost\n" . sortrev('total_cost', 1); `][L]Total[/L] [page href=@@MV_PAGE@@ form=` return "ui_sort_field=status\n" . sortrev('status'); `][L]Status[/L]
{archive_nm} eq 'unarchive'; return 'CHECKED' if q{[item-data transactions status]} eq '__UI_SHIPPED_STATUS__'; return; [/item-calc] > [page href="@@MV_PAGE@@" form=" [scratch archive_nm]order=1 order=[item-code] "][scratch archive_nm] [item-code] DELETE [item-code] [page href=__UI_BASE__/order_view form="order=[item-code]"][item-code] [page href=__UI_BASE__/customer_view form="customer=[item-param username]"][item-param lname], [item-param fname][if-item-param company] -- [item-param company][/if-item-param] [item-filter 30][item-param city], [item-param state] [item-param country][/item-filter] [convert-date][item-param order_date][/convert-date] [item-param nitems] [currency][item-param total_cost][/currency] [page href="__UI_BASE__/order_status" form="order=[item-code]"][loc][item-param status][/loc]

[L]No orders[/L]

[msg arg.0="[matches]" arg.1="[value mv_search_match_count]" arg.2="[scratch archive_label]"]Orders %s of %s %s.[/msg] [L]More orders[/L]: [decade-next][/decade-next] [more] [decade-prev][/decade-prev]
[if-mm advanced order=d] [button form=batch text="[L]Delete checked orders[/L]" confirm='[L]Are you sure you want to delete the checked orders?[/L]']deleteorder=1 [/button] [/if-mm]    [button form=batch src="[scratch archive_img]" text=` my $tmp = "$Scratch->{archive_nm} checked orders"; return $Tag->loc('', "\u$tmp"); `] [scratch archive_nm]order=1[/button]
[/search-region] @_UI_STD_FOOTER_@