From 4fff0f4b1155fa0e1085d27c891c55de08bcbd29 Mon Sep 17 00:00:00 2001 From: tetragon Date: Sat, 3 Nov 2007 20:31:44 +0000 Subject: Templating history search and search forms git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1846 4979c152-3d1c-0410-bac9-87ea11338e46 --- UI/ct-search.html | 458 +++++++++++++++++++++++++++++++++++ bin/ct.pl | 695 ++++++++++++++++++------------------------------------ 2 files changed, 683 insertions(+), 470 deletions(-) create mode 100644 UI/ct-search.html diff --git a/UI/ct-search.html b/UI/ct-search.html new file mode 100644 index 00000000..bd0dfaf6 --- /dev/null +++ b/UI/ct-search.html @@ -0,0 +1,458 @@ + + + +
+ + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
'32', name => 'name'} ?>
'32', name => 'contact'} ?>
'32', name => 'email'} ?>
'20', name => 'phone'} ?>
'32', name => 'employee'} ?> '32', name => 'employee'} ?>
'3', cols => '32', name => 'notes'} ?>
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
'32', name => "${form.db}number"} ?>
'32', name => 'address'} ?>
'32', name => 'city'} ?>
'32', name => 'state'} ?>
'10', name => 'zipcode'} ?>
'32', name => 'country'} ?>
+ '11', name => 'startdatefrom', class => 'date', title => user.dateformat}; + text('To'); ' '; PROCESS input element_data={ + size => '11', name => 'startdateto', class => 'date', title => user.dateformat} ?> +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + +
+ 'radio', + name => 'type', + value => 'invoice', + label => form.invlabel, + checked => 'checked', + } -?> +
+ 'radio', + name => 'type', + value => 'order', + label => form.ordlabel, + } -?> +
+ 'radio', + name => 'type', + value => 'quotation', + label => form.quolabel, + } -?> +
+
+ + + + + + + + + + +
'11', name => 'transdatefrom', class => 'date', title => user.dateformat} -?> '11', name => 'transdateto', class => 'date', title => user.dateformat} -?>
+ + 'open', + type => 'checkbox', + value => 'Y', + label => text('Open'), + checked => 'checked' + } -?> + 'closed', + type => 'checkbox', + value => 'Y', + label => text('Closed'), + } -?> +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ 'history', + type => 'radio', + value => 'summary', + label => text('Summary'), + checked => 'checked', + } -?> + + 'history', + type => 'radio', + value => 'detail', + label => text('Detail'), + } -?> +
+ 'l_partnumber', + type => 'checkbox', + value => 'Y', + label => text('Part Number'), + checked => 'checked', + } -?> + + 'l_description', + type => 'checkbox', + value => 'Y', + label => text('Description'), + checked => 'checked', + } -?> + + 'l_sellprice', + type => 'checkbox', + value => 'Y', + label => text('Sell Price'), + checked => 'checked', + } -?> + + 'l_curr', + type => 'checkbox', + value => 'Y', + label => text('Currency'), + } -?> +
+ 'l_qty', + type => 'checkbox', + value => 'Y', + label => text('Qty'), + } -?> + + 'l_unit', + type => 'checkbox', + value => 'Y', + label => text('Unit'), + } -?> + + 'l_discount', + type => 'checkbox', + value => 'Y', + label => text('Discount'), + } -?> +
+ 'l_deliverydate', + type => 'checkbox', + value => 'Y', + label => text('Delivery Date'), + } -?> + + 'l_projectnumber', + type => 'checkbox', + value => 'Y', + label => text('Project Number'), + } -?> + + 'l_serialnumber', + type => 'checkbox', + value => 'Y', + label => text('Serial Number'), + } -?> +
+
+ + 'status', type => 'radio', value => 'all', label => text('All'), checked => 'checked'} -?> + 'status', type => 'radio', value => 'active', label => text('Active')} -?> + 'status', type => 'radio', value => 'inactive', label => text('Inactive')} -?> + 'status', type => 'radio', value => 'orphaned', label => text('Orphaned')} -?> +
+ + + + + + +
+ + + + + + + + + + + + + +
+ 'l_transnumber', + type => 'checkbox', + value => 'Y', + label => form.translabel, + } -?> +
+ 'l_invnumber', + type => 'checkbox', + value => 'Y', + label => form.invlabel, + } -?> +
+ 'l_ordnumber', + type => 'checkbox', + value => 'Y', + label => form.ordlabel, + } -?> +
+ 'l_quonumber', + type => 'checkbox', + value => 'Y', + label => form.quolabel, + } -?> +
+
+ + + + + + + + + + + + + +
+ 'transdatefrom', + class => 'date' + size => '11', + title => user.dateformat, + } -?> + + 'transdateto', + class => 'date' + size => '11', + title => user.dateformat, + } -?> +
+ + 'open', + type => 'checkbox', + value => 'Y', + label => text('Open'), + checked => 'checked' + } -?> + 'closed', + type => 'checkbox', + value => 'Y', + label => text('Closed'), + } -?> +
+ + 'l_amount', + type => 'checkbox', + value => 'Y', + label => text('Amount'), + checked => 'checked' + } -?> + 'l_tax', + type => 'checkbox', + value => 'Y', + label => text('Tax'), + checked => 'checked' + } -?> + 'l_total', + type => 'checkbox', + value => 'Y', + label => text('Total'), + checked => 'checked' + } -?> + 'l_subtotal', + type => 'checkbox', + value => 'Y', + label => text('Subtotal'), + } -?> +
+
+
+ + + + + + + + +
+ +
+
+

+ + 'hidden', + name => hidden, + value => hiddens.item(hidden) + }; END -?> + +
+ + + diff --git a/bin/ct.pl b/bin/ct.pl index d5cadf32..ced978cc 100644 --- a/bin/ct.pl +++ b/bin/ct.pl @@ -42,6 +42,7 @@ #====================================================================== use LedgerSMB::CT; +use LedgerSMB::Template; 1; @@ -70,345 +71,227 @@ sub history { # $locale->text('Customer History') # $locale->text('Vendor History') + my %hiddens; + my @buttons; $history = 1; $label = ucfirst $form->{db}; $label .= " History"; if ( $form->{db} eq 'customer' ) { - $invlabel = $locale->text('Sales Invoices'); - $ordlabel = $locale->text('Sales Orders'); - $quolabel = $locale->text('Quotations'); - } - else { - $invlabel = $locale->text('Vendor Invoices'); - $ordlabel = $locale->text('Purchase Orders'); - $quolabel = $locale->text('Request for Quotations'); + $form->{invlabel} = $locale->text('Sales Invoices'); + $form->{ordlabel} = $locale->text('Sales Orders'); + $form->{quolabel} = $locale->text('Quotations'); + } else { + $form->{invlabel} = $locale->text('Vendor Invoices'); + $form->{ordlabel} = $locale->text('Purchase Orders'); + $form->{quolabel} = $locale->text('Request for Quotations'); } $form->{title} = $locale->text($label); $form->{nextsub} = "list_history"; - $transactions = qq| - - - - - - - - -
- - - - - - - - - - -
$invlabel
$ordlabel
$quolabel
-
- - - - - - - - - - - -
| . $locale->text('From') . qq|| . $locale->text('To') . qq|
-  | - . $locale->text('Open') . qq| -  | - . $locale->text('Closed') . qq| -
-
- - -|; - - $include = qq| - - | . $locale->text('Include in Report') . qq| - - - - - - - - - - - - - - - - - - - - - - -
| - . $locale->text('Summary') - . qq| | - . $locale->text('Detail') . qq| -
-  | - . $locale->text('Part Number') . qq| - -  | - . $locale->text('Description') . qq| - -  | - . $locale->text('Sell Price') . qq| - -  | - . $locale->text('Currency') . qq| -
-  | - . $locale->text('Qty') . qq| - -  | - . $locale->text('Unit') . qq| - -  | - . $locale->text('Discount') . qq| -
-  | - . $locale->text('Delivery Date') . qq| - -  | - . $locale->text('Project Number') . qq| - -  | - . $locale->text('Serial Number') . qq| -
- - -|; - - &search_name; - - if ( $form->{lynx} ) { - require "bin/menu.pl"; - &menubar; - } - - print qq| - - -|; - + &search_name(\%hiddens, \@buttons); + +##SC: Temporary removal +## if ( $form->{lynx} ) { +## require "bin/menu.pl"; +## &menubar; +## } + + my $template = LedgerSMB::Template->new_UI( + user => \%myconfig, + locale => $locale, + template => 'ct-search', + ); + $template->render({ + form => $form, + user => \%myconfig, + hiddens => \%hiddens, + buttons => \@buttons, + }); } sub transactions { - if ( $form->{db} eq 'customer' ) { - $translabel = $locale->text('AR Transactions'); - $invlabel = $locale->text('Sales Invoices'); - $ordlabel = $locale->text('Sales Orders'); - $quolabel = $locale->text('Quotations'); + $form->{translabel} = $locale->text('AR Transactions'); + $form->{invlabel} = $locale->text('Sales Invoices'); + $form->{ordlabel} = $locale->text('Sales Orders'); + $form->{quolabel} = $locale->text('Quotations'); + } else { + $form->{translabel} = $locale->text('AP Transactions'); + $form->{invlabel} = $locale->text('Vendor Invoices'); + $form->{ordlabel} = $locale->text('Purchase Orders'); + $form->{quolabel} = $locale->text('Request for Quotations'); } - else { - $translabel = $locale->text('AP Transactions'); - $invlabel = $locale->text('Vendor Invoices'); - $ordlabel = $locale->text('Purchase Orders'); - $quolabel = $locale->text('Request for Quotations'); - } - - $transactions = qq| - - - - - - - - -
- - - - - - - - - - - - - -
$translabel
$invlabel
$ordlabel
$quolabel
-
- - - - - - - - - - - - - - - -
| . $locale->text('From') . qq|| . $locale->text('To') . qq|
-  | - . $locale->text('Open') . qq| -  | - . $locale->text('Closed') . qq| -
-  | - . $locale->text('Amount') . qq| -  | - . $locale->text('Tax') . qq| -  | - . $locale->text('Total') . qq| -  | - . $locale->text('Subtotal') . qq| -
-
- - -|; - } sub include_in_report { $label = ucfirst $form->{db}; - @a = (); - - push @a, qq| | - . $locale->text('No.'); - push @a, qq| | - . $locale->text('ID'); - push @a, -qq| | - . $locale->text( $label . ' Number' ); - push @a, -qq|{l_name}> | - . $locale->text('Company Name'); - push @a, -qq|{l_contact}> | - . $locale->text('Contact'); - push @a, -qq|{l_email}> | - . $locale->text('E-mail'); - push @a, qq| | - . $locale->text('Address'); - push @a, qq| | - . $locale->text('City'); - push @a, qq| | - . $locale->text('State/Province'); - push @a, qq| | - . $locale->text('Zip/Postal Code'); - push @a, qq| | - . $locale->text('Country'); - push @a, -qq|{l_phone}> | - . $locale->text('Phone'); - push @a, qq| | - . $locale->text('Fax'); - push @a, qq| | - . $locale->text('Cc'); + my @fields = (); + + push @fields, { + name => 'l_ndx', + label => $locale->text('No.'), + }; + push @fields, { + name => 'l_id', + label => $locale->text('ID'), + }; + push @fields, { + name => "l_$form->{db}number", + label => $locale->text($label . ' Number'), + }; + push @fields, { + name => 'l_name', + label => $locale->text('Company Name'), + $form->{l_name} => $form->{l_name}, + }; + push @fields, { + name => 'l_contact', + label => $locale->text('Contact'), + $form->{l_contact} => $form->{l_contact}, + }; + push @fields, { + name => 'l_email', + label => $locale->text('E-mail'), + $form->{l_email} => $form->{l_email}, + }; + push @fields, { + name => 'l_address', + label => $locale->text('Address'), + }; + push @fields, { + name => 'l_city', + label => $locale->text('City'), + }; + push @fields, { + name => 'l_state', + label => $locale->text('State/Province'), + }; + push @fields, { + name => 'l_zipcode', + label => $locale->text('Zip/Postal Code'), + }; + push @fields, { + name => 'l_country', + label => $locale->text('Country'), + }; + push @fields, { + name => 'l_phone', + label => $locale->text('Phone'), + $form->{l_phone} => $form->{l_phone}, + }; + push @fields, { + name => 'l_fax', + label => $locale->text('Fax'), + }; + push @fields, { + name => 'l_cc', + label => $locale->text('Cc'), + }; if ( $myconfig{role} =~ /(admin|manager)/ ) { - push @a, qq| | - . $locale->text('Bcc'); - } - - push @a, qq| | - . $locale->text('Notes'); - push @a, qq| | - . $locale->text('Discount'); - push @a, - qq| | - . $locale->text('Tax Account'); - push @a, - qq| | - . $locale->text('Tax Number'); + push @fields, { + name => 'l_bcc', + label => $locale->text('Bcc'), + }; + } + + push @fields, { + name => 'l_notes', + label => $locale->text('Notes'), + }; + push @fields, { + name => 'l_discount', + label => $locale->text('Discount'), + }; + push @fields, { + name => 'l_taxaccount', + label => $locale->text('Tax Account'), + }; + push @fields, { + name => 'l_taxnumber', + label => $locale->text('Tax Number'), + }; if ( $form->{db} eq 'customer' ) { - push @a, - qq| | - . $locale->text('Salesperson'); - push @a, - qq| | - . $locale->text('Manager'); - push @a, - qq| | - . $locale->text('Pricegroup'); - - } - else { - push @a, - qq| | - . $locale->text('Employee'); - push @a, - qq| | - . $locale->text('Manager'); - push @a, - qq| | - . $locale->text('GIFI'); - - } - - push @a, qq| | - . $locale->text('SIC'); - push @a, qq| | - . $locale->text('IBAN'); - push @a, qq| | - . $locale->text('BIC'); - push @a, qq| | - . $locale->text('Type of Business'); - push @a, qq| | - . $locale->text('Terms'); - push @a, qq| | - . $locale->text('Language'); - push @a, - qq| | - . $locale->text('Startdate'); - push @a, qq| | - . $locale->text('Enddate'); - - $include = qq| - - | . $locale->text('Include in Report') . qq| - - -|; - - while (@a) { - $include .= qq|\n|; + push @fields, { + name => 'l_employee', + label => $locale->text('Salesperson'), + }; + push @fields, { + name => 'l_manager', + label => $locale->text('Manager'), + }; + push @fields, { + name => 'l_pricegroup', + label => $locale->text('Pricegroup'), + }; + + } else { + push @fields, { + name => 'l_employee', + label => $locale->text('Employee'), + }; + push @fields, { + name => 'l_manager', + label => $locale->text('Manager'), + }; + push @fields, { + name => 'l_gifi_accno', + label => $locale->text('GIFI'), + }; + } + + push @fields, { + name => 'l_sic_code', + label => $locale->text('SIC'), + }; + push @fields, { + name => 'l_iban', + label => $locale->text('IBAN'), + }; + push @fields, { + name => 'l_bic', + label => $locale->text('BIC'), + }; + push @fields, { + name => 'l_business', + label => $locale->text('Type of Business'), + }; + push @fields, { + name => 'l_terms', + label => $locale->text('Terms'), + }; + push @fields, { + name => 'l_langauge', + label => $locale->text('Language'), + }; + push @fields, { + name => 'l_startdate', + label => $locale->text('Startdate'), + }; + push @fields, { + name => 'l_enddate', + label => $locale->text('Enddate'), + }; + + $form->{includes} = []; + my $i = 0; + while (@fields) { + push @{$form->{includes}}, []; for ( 1 .. 5 ) { - $include .= qq|\n|; + push @{$form->{includes}[$i]}, shift(@fields); + if ($form->{includes}[$i][$_ - 1]) { + $form->{includes}[$i][$_ - 1]{type} = 'checkbox'; + $form->{includes}[$i][$_ - 1]{value} = 'Y'; + } } - $include .= qq|\n|; + $i++; } - - $include .= qq| -
| . shift @a; - $include .= qq|
- - -|; - } sub search { @@ -416,178 +299,50 @@ sub search { # $locale->text('Customers') # $locale->text('Vendors') + my %hiddens; + my @buttons; $form->{title} = $locale->text('Search') unless $form->{title}; for (qw(name contact phone email)) { $form->{"l_$_"} = 'checked' } $form->{nextsub} = "list_names"; - $orphan = qq| - - -  | - . $locale->text('All') . qq| -  | - . $locale->text('Active') . qq| -  | - . $locale->text('Inactive') . qq| -  | - . $locale->text('Orphaned') - . qq| - -|; - &transactions; &include_in_report; - &search_name; - - if ( $form->{lynx} ) { - require "bin/menu.pl"; - &menubar; - } - - print qq| - - - -|; - + &search_name(\%hiddens, \@buttons); + +##SC: Temporary removal +## if ( $form->{lynx} ) { +## require "bin/menu.pl"; +## &menubar; +## } + + my $template = LedgerSMB::Template->new_UI( + user => \%myconfig, + locale => $locale, + template => 'ct-search', + ); + $template->render({ + form => $form, + user => \%myconfig, + hiddens => \%hiddens, + buttons => \@buttons, + }); } sub search_name { - $label = ucfirst $form->{db}; - - if ( $form->{db} eq 'customer' ) { - $employee = qq| - | . $locale->text('Salesperson') . qq| - -|; - } - if ( $form->{db} eq 'vendor' ) { - $employee = qq| - | . $locale->text('Employee') . qq| - -|; - } - - $form->header; - - print qq| - - -
{script}> - -{db}> - - - - - - - - - - - - - - - - - -
$form->{title}
- - - - - - -
- - - - - - - - - - - - - - - - - - - $employee - - - - - -
| . $locale->text('Company Name') . qq|
| . $locale->text('Contact') . qq|
| . $locale->text('E-mail') . qq|
| . $locale->text('Phone') . qq|
| . $locale->text('Notes') . qq|
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| . $locale->text( $label . ' Number' ) . qq|{db}number size=32>
| . $locale->text('Address') . qq|
| . $locale->text('City') . qq|
| . $locale->text('State/Province') . qq|
| . $locale->text('Zip/Postal Code') . qq|
| . $locale->text('Country') . qq|
| . $locale->text('Startdate') . qq|| - . $locale->text('From') - . qq| | - . $locale->text('To') - . qq|
-
-
- - - $orphan - $transactions - $include - -
-

- - - - - - - -
- -
-|; - + my $hiddens = shift; + my $buttons = shift; + + my $label = ucfirst $form->{db}; + $form->{label} = $label; + $hiddens->{$_} = $form->{$_} foreach qw(db nextsub path login sessionid); + push @{$buttons}, { + name => 'action', + value => 'continue', + text => $locale->text('Continue'), + }; } sub list_names { -- cgit v1.2.3