summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-10-15 00:40:15 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-10-15 00:40:15 +0000
commitafa0644850bc67077861b9cc57495bb38e38351a (patch)
tree2d685ee1de94e72506c3316bc5e190732def8b3d
parent812247d1bb08e01f7a413a52958e7918a752ff81 (diff)
Converting receipt time period selection to template
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1755 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r--UI/pos-receipts.html64
-rw-r--r--bin/pos.pl134
2 files changed, 110 insertions, 88 deletions
diff --git a/UI/pos-receipts.html b/UI/pos-receipts.html
new file mode 100644
index 00000000..60d42af9
--- /dev/null
+++ b/UI/pos-receipts.html
@@ -0,0 +1,64 @@
+<?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 height="5"></tr>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="right"><?lsmb text('From') ?></th>
+ <td><?lsmb PROCESS input element_data={
+ class => 'date',
+ name => 'fromdate',
+ size => 11,
+ title => user.dateformat,
+ value => form.fromdate} ?></td>
+ <th align="right"><?lsmb text('To') ?></th>
+ <td><?lsmb PROCESS input element_data={
+ class => 'date',
+ name => 'todate',
+ size => 11,
+ title => user.dateformat,
+ value => form.todate} ?></td>
+ </tr>
+
+<?lsmb IF form.selectaccountingyear.defined ?>
+ <tr>
+ <th align="right"><?lsmb text('Period') ?></th>
+ <td colspan="3">
+<?lsmb PROCESS select element_data=form.selectaccountingmonth;
+ PROCESS select element_data=form.selectaccountingyear;
+ PROCESS input element_data={type => 'radio', name => 'interval', value => '0', label => text('Current'), checked => 'checked'};
+ PROCESS input element_data={type => 'radio', name => 'interval', value => '1', label => text('Month')};
+ PROCESS input element_data={type => 'radio', name => 'interval', value => '3', label => text('Quarter')};
+ PROCESS input element_data={type => 'radio', name => 'interval', value => '12', label => text('Year')} ?>
+ </td>
+ </tr>
+<?lsmb END ?>
+
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td><hr size="3" noshade="noshade" /></td>
+ </tr>
+</table>
+
+<br />
+<?lsmb FOREACH hidden IN hiddens.keys;
+ PROCESS input element_data={
+ type => 'hidden',
+ name => hidden,
+ value => hiddens.item(hidden)
+ }; END;
+PROCESS button element_data=buttons.0 ?>
+</form>
+</body>
+</html>
diff --git a/bin/pos.pl b/bin/pos.pl
index 6364a882..cbc3ddea 100644
--- a/bin/pos.pl
+++ b/bin/pos.pl
@@ -1119,6 +1119,7 @@ sub print_options {
sub receipts {
+ my %hiddens;
$form->{title} = $locale->text('Receipts');
$form->{db} = 'ar';
@@ -1130,99 +1131,56 @@ sub receipts {
if ( @{ $form->{all_years} } ) {
# accounting years
- $form->{selectaccountingyear} = "<option>\n";
+ $form->{selectaccountingyear} = {name => 'year', options => []};
+ push @{$form->{selectaccountingyear}{options}}, {text => ' ', value => ''};
for ( @{ $form->{all_years} } ) {
- $form->{selectaccountingyear} .= qq|<option>$_\n|;
+ push @{$form->{selectaccountingyear}{options}}, {
+ text => $_,
+ value => $_,
+ };
}
- $form->{selectaccountingmonth} = "<option>\n";
+ $form->{selectaccountingmonth} = {name => 'month', options => []};
+ push @{$form->{selectaccountingmonth}{options}}, {text => ' ', value => ''};
for ( sort keys %{ $form->{all_month} } ) {
- $form->{selectaccountingmonth} .=
- qq|<option value=$_>|
- . $locale->text( $form->{all_month}{$_} ) . qq|\n|;
+ push @{$form->{selectaccountingmonth}{options}}, {
+ text => $locale->text($form->{all_month}{$_}),
+ value => $_,
+ };
}
-
- $selectfrom = qq|
- <tr>
- <th align=right>| . $locale->text('Period') . qq|</th>
- <td colspan=3>
- <select name=month>$form->{selectaccountingmonth}</select>
- <select name=year>$form->{selectaccountingyear}</select>
- <input name=interval class=radio type=radio value=0 checked>&nbsp;|
- . $locale->text('Current') . qq|
- <input name=interval class=radio type=radio value=1>&nbsp;|
- . $locale->text('Month') . qq|
- <input name=interval class=radio type=radio value=3>&nbsp;|
- . $locale->text('Quarter') . qq|
- <input name=interval class=radio type=radio value=12>&nbsp;|
- . $locale->text('Year') . qq|
- </td>
- </tr>
-|;
}
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=title value="$form->{title}">
-<input type=hidden name=paymentaccounts value="$paymentaccounts">
-
-<input type=hidden name=till value=1>
-<input type=hidden name=subtotal value=1>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
-
- <input type=hidden name=nextsub value=list_payments>
-
- <tr>
- <th align=right>| . $locale->text('From') . qq|</th>
- <td><input class="date" name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
- <th align=right>| . $locale->text('To') . qq|</th>
- <td><input class="date" name=todate size=11 title="$myconfig{dateformat}"></td>
- </tr>
- $selectfrom
- <input type=hidden name=sort value=transdate>
- <input type=hidden name=db value=$form->{db}>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<input type="hidden" name="path" value="$form->{path}">
-<input type="hidden" name="login" value="$form->{login}">
-<input type="hidden" name="sessionid" value="$form->{sessionid}">
-
-<button type="submit" class="submit" name="action" value="continue">|
- . $locale->text('Continue')
- . qq|</button>
-|;
-
- if ( $form->{lynx} ) {
- require "bin/menu.pl";
- &menubar;
- }
-
- print qq|
-
-</form>
-
-</body>
-</html>
-|;
-
+ $hiddens{path} = $form->{path};
+ $hiddens{login} = $form->{login};
+ $hiddens{sessionid} = $form->{sessionid};
+ $hiddens{db} = $form->{db};
+ $hiddens{title} = $form->{title};
+ $hiddens{paymentsaccounts} = $paymentsaccounts;
+ $hiddens{till} = '1';
+ $hiddens{subtotal} = '1';
+ $hiddens{nextsub} = 'list_payments';
+ $hiddens{sort} = 'transdate';
+
+##SC: Temporary commenting
+## if ( $form->{lynx} ) {
+## require "bin/menu.pl";
+## &menubar;
+## }
+
+ my @buttons = ({
+ name => 'action',
+ value => 'list_payments',
+ text => $locale->text('Continue'),
+ });
+ my $template = LedgerSMB::Template->new_UI(
+ user => \%myconfig,
+ locale => $locale,
+ template => 'pos-receipts',
+ );
+ $template->render({
+ form => $form,
+ user => \%myconfig,
+ hiddens => \%hiddens,
+ buttons => \@buttons,
+ });
}