diff options
-rw-r--r-- | UI/am-taxes.html | 47 | ||||
-rw-r--r-- | UI/ui-header.html | 14 | ||||
-rw-r--r-- | bin/am.pl | 118 |
3 files changed, 97 insertions, 82 deletions
diff --git a/UI/am-taxes.html b/UI/am-taxes.html new file mode 100644 index 00000000..58bdb114 --- /dev/null +++ b/UI/am-taxes.html @@ -0,0 +1,47 @@ +<?lsmb INCLUDE 'ui-header.html' ?> +<?lsmb PROCESS elements.html ?> +<body> +<form method="post" action="<?lsmb form.script ?>"> +<table width="100%"> + <tr><th class="listtop"><?lsmb form.title ?></th></tr> + <tr> + <td> + <table> + <tr> + <th></th> + <th><?lsmb text('Rate (%)') ?></th> + <th><?lsmb text('Number') ?></th> + <th><?lsmb text('Valid To') ?></th> + <th><?lsmb text('Ordering') ?></th> + <th><?lsmb text('Tax Rules') ?></th> + </tr> +<?lsmb FOREACH row IN rows; i = loop.count ?> + <tr> + <th align="right"><?lsmb row.0 ?></th> + <td><input name="taxrate_<?lsmb i ?>" size="6" value="<?lsmb form.item("taxrate_$i") ?>" /></td> + <td><input name="taxnumber_<?lsmb i ?>" value="<?lsmb form.item("taxnumber_$i") ?>" /></td> + <td><input class="date" name="validto_<?lsmb i ?>" size="11" value="<?lsmb form.item("validto_$i") ?>" title="<?lsmb user.dateformat ?>" /></td> + <td><input name="pass_<?lsmb i ?>" size="6" value="<?lsmb form.item("pass_$i") ?>" /></td> + <td><?lsmb PROCESS select element_data=row.1 ?></td> + </tr> +<?lsmb END ?> + </table> + </td> + </tr> + <tr> + <td><hr size="3" noshade="noshade" /></td> + </tr> +</table> + +<?lsmb FOREACH hidden IN hiddens.keys; + PROCESS input element_data={ + type => 'hidden', + name => hidden, + value => hiddens.item(hidden) + }; END; +PROCESS button element_data={name => 'action', value => 'update', text => text('Update')}; +PROCESS button element_data={name => 'action', value => 'save_taxes', text => text('Save')} ?> + </form> + +</body> +</html> diff --git a/UI/ui-header.html b/UI/ui-header.html new file mode 100644 index 00000000..5a429866 --- /dev/null +++ b/UI/ui-header.html @@ -0,0 +1,14 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title><?lsmb form.titlebar ?></title> + <meta http-equiv="Pragma" content="no-cache" /> + <meta http-equiv="Expires" content="-1" /> + <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> + <link rel="stylesheet" href="css/<?lsmb form.stylesheet ?>" type="text/css" title="LedgerSMB stylesheet" /> + + <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> + <meta name="robots" content="noindex,nofollow" /> + +</head> @@ -1763,31 +1763,14 @@ sub taxes { sub display_taxes { $form->{title} = $locale->text('Taxes'); + my %hiddens = ( + path => $form->{path}, + login => $form->{login}, + sessionid => $form->{sessionid}, + type => 'taxes', + ); - $form->header; - - print qq| -<body> - -<form method=post action=$form->{script}> - -<input type=hidden name=type value=taxes> - -<table width=100%> - <tr><th class=listtop>$form->{title}</th></tr> - <tr> - <td> - <table> - <tr> - <th></th> - <th>| . $locale->text('Rate') . qq| (%)</th> - <th>| . $locale->text('Number') . qq|</th> - <th>| . $locale->text('Valid To') . qq|</th> - <th>| . $locale->text('Ordering') . qq|</th> - <th>| . $locale->text('Tax Rules') . qq|</th> - </tr> -|; - + my @rows; for ( split( / /, $form->{taxaccounts} ) ) { ( $null, $i ) = split /_/, $_; @@ -1795,81 +1778,52 @@ sub display_taxes { $form->{"taxrate_$i"} = $form->format_amount( \%myconfig, $form->{"taxrate_$i"} ); - $form->hide_form("taxdescription_$i"); - - print qq| - <tr> - <th align="right">|; - - if ( $form->{"taxdescription_$i"} eq $sametax ) { - print ""; - } - else { - print qq|$form->{"taxdescription_$i"}|; - } + $hiddens{"taxdescription_$i"} = $form->{"taxdescription_$i"}; - print qq|</th> - <td><input name="taxrate_$i" size=6 value=$form->{"taxrate_$i"}></td> - <td><input name="taxnumber_$i" value="$form->{"taxnumber_$i"}"></td> - <td><input class="date" name="validto_$i" size=11 value="$form->{"validto_$i"}" title="$myconfig{dateformat}"></td> - <td><input name="pass_$i" size=6 value="$form->{"pass_$i"}"></td> - <td><select name="taxmodule_id_$i" size=1>|; + my %select = (name => "taxmodule_id_$i", options => []); foreach my $taxmodule ( sort keys %$form ) { next if ( $taxmodule !~ /^taxmodule_/ ); next if ( $taxmodule =~ /^taxmodule_id_/ ); my $modulenum = $taxmodule; $modulenum =~ s/^taxmodule_//; - print '<option label="' - . $form->{$taxmodule} - . '" value="' - . $modulenum . '"'; - print " SELECTED " + push @{$select{options}}, + {text => $form->{$taxmodule}, value => $modulenum}; + $select{default_values} = $modulenum if $form->{$taxmodule} eq $form->{"taxmodulename_$i"}; - print ">" . $form->{$taxmodule} . "</option>\n"; } - print qq|</select></td> - </tr> |; - $sametax = $form->{"taxdescription_$i"}; + if ( $form->{"taxdescription_$i"} eq $sametax ) { + push @rows, ["", \%select]; + } else { + push @rows, [$form->{"taxdescription_$i"}, \%select]; + } - } + $sametax = $form->{"taxdescription_$i"}; - print qq| - </table> - </td> - </tr> - <tr> - <td><hr size=3 noshade></td> - </tr> -</table> -|; + } - $form->hide_form(qw(taxaccounts path login sessionid)); + $hiddens{taxaccounts} = $form->{taxaccounts}; foreach my $taxmodule ( sort keys %$form ) { next if ( $taxmodule !~ /^taxmodule_/ ); next if ( $taxmodule =~ /^taxmodule_id_/ ); - $form->hide_form("$taxmodule"); - } - - print qq| -<button type="submit" class="submit" name="action" value="update">| - . $locale->text('Update') - . qq|</button> -<button type="submit" class="submit" name="action" value="save_taxes">| - . $locale->text('Save') - . qq|</button>|; - - if ( $form->{lynx} ) { - require "bin/menu.pl"; - &menubar; + $hiddens{$taxmodule}; } - print qq| - </form> - -</body> -</html> -|; +##SC: Temporary removal +## if ( $form->{lynx} ) { +## require "bin/menu.pl"; +## &menubar; +## } + my $template = LedgerSMB::Template->new_UI( + user => \%myconfig, + locale => $locale, + template => 'am-taxes'); + $template->render({ + form => $form, + hiddens => \%hiddens, + selects => \%selects, + rows => \@rows, + }); } sub update { |