summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UI/am-yearend.html70
-rw-r--r--bin/am.pl90
2 files changed, 99 insertions, 61 deletions
diff --git a/UI/am-yearend.html b/UI/am-yearend.html
new file mode 100644
index 00000000..33159a97
--- /dev/null
+++ b/UI/am-yearend.html
@@ -0,0 +1,70 @@
+<?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> </td></tr>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="right"><?lsmb text('Yearend') ?></th>
+ <td><?lsmb PROCESS input element_data={
+ class => 'date',
+ name => 'todate',
+ size => 11,
+ title => user.dateformat,
+ } -?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Reference') ?></th>
+ <td><?lsmb PROCESS input element_data={
+ name => 'reference',
+ size => 20,
+ value => text('Yearend'),
+ } -?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Description') ?></th>
+ <td><?lsmb PROCESS textarea element_data={
+ name => 'description',
+ rows => 3,
+ cols => 50,
+ } -?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Retained Earnings') ?></th>
+ <td><?lsmb PROCESS select element_data=accounts -?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Method') ?></th>
+ <td><?lsmb PROCESS input element_data={
+ name => 'method',
+ type => 'radio',
+ value => 'accrual',
+ checked => 'checked',
+ label => text('Accrual'),
+ };
+ PROCESS input element_data={
+ name => 'method',
+ type => 'radio',
+ value => 'cash',
+ label => text('Cash'),
+ } -?></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+<hr size="3" noshade="noshade" />
+<?lsmb FOREACH hidden IN hiddens.keys;
+ PROCESS input element_data={
+ type => 'hidden',
+ name => hidden,
+ value => hiddens.item(hidden)
+ }; END ?>
+<?lsmb FOREACH button IN buttons; PROCESS button element_data=button; END ?>
+</form>
+</body>
+</html>
diff --git a/bin/am.pl b/bin/am.pl
index 3bb2468f..96442c6f 100644
--- a/bin/am.pl
+++ b/bin/am.pl
@@ -2130,73 +2130,41 @@ sub delete_warehouse {
sub yearend {
AM->earningsaccounts( \%myconfig, \%$form );
- $chart = "";
+ my %hiddens;
+ my $chart = "";
+ my %accounts = (
+ name => 'accno',
+ options => [],
+ );
for ( @{ $form->{chart} } ) {
- $chart .= "<option>$_->{accno}--$_->{description}";
+ push @{$accounts{options}}, {
+ text => "$_->{accno}--$_->{description}",
+ value => "$_->{accno}--$_->{description}",
+ };
}
-
$form->{title} = $locale->text('Yearend');
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=decimalplaces value=2>
-<input type=hidden name=l_accno value=Y>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align="right">| . $locale->text('Yearend') . qq|</th>
- <td><input class="date" name=todate size=11 title="$myconfig{dateformat}" value=$todate></td>
- </tr>
- <tr>
- <th align="right">| . $locale->text('Reference') . qq|</th>
- <td><input name=reference size=20 value="|
- . $locale->text('Yearend')
- . qq|"></td>
- </tr>
- <tr>
- <th align="right">| . $locale->text('Description') . qq|</th>
- <td><textarea name=description rows=3 cols=50 wrap=soft></textarea></td>
- </tr>
- <tr>
- <th align="right">| . $locale->text('Retained Earnings') . qq|</th>
- <td><select name=accno>$chart</select></td>
- </tr>
- <tr>
- <th align="right">| . $locale->text('Method') . qq|</th>
- <td><input name=method class=radio type=radio value=accrual checked>&nbsp;|
- . $locale->text('Accrual')
- . qq|&nbsp;<input name=method class=radio type=radio value=cash>&nbsp;|
- . $locale->text('Cash')
- . qq|</td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-<hr size=3 noshade>
-
-<input type=hidden name=nextsub value=generate_yearend>
-|;
- $form->hide_form(qw(path login sessionid));
+ $hiddens{decimalplaces} = 2;
+ $hiddens{l_accno} = 'Y';
+ $hiddens{$_} = $form->{$_} foreach qw(path login sessionid);
- print qq|
-<button class="submit" type="submit" name="action" value="continue">|
- . $locale->text('Continue')
- . qq|</button>|;
+ my @buttons = ({
+ name => 'action',
+ value => 'generate_yearend',
+ text => $locale->text('Continue'),
+ });
+ my $template = LedgerSMB::Template->new_UI(
+ user => \%myconfig,
+ locale => $locale,
+ template => 'am-yearend');
+ $template->render({
+ user => \%myconfig,
+ form => $form,
+ buttons => \@buttons,
+ hiddens => \%hiddens,
+ accounts => \%accounts,
+ });
}
sub generate_yearend {