[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1815] trunk



Revision: 1815
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1815&view=rev
Author:   tetragon
Date:     2007-10-24 15:50:12 -0700 (Wed, 24 Oct 2007)

Log Message:
-----------
Convert the yearend form to a template

Modified Paths:
--------------
    trunk/bin/am.pl

Added Paths:
-----------
    trunk/UI/am-yearend.html

Added: trunk/UI/am-yearend.html
===================================================================
--- trunk/UI/am-yearend.html	                        (rev 0)
+++ trunk/UI/am-yearend.html	2007-10-24 22:50:12 UTC (rev 1815)
@@ -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>

Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl	2007-10-24 22:21:31 UTC (rev 1814)
+++ trunk/bin/am.pl	2007-10-24 22:50:12 UTC (rev 1815)
@@ -2130,73 +2130,41 @@
 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>
+    $hiddens{decimalplaces} = 2;
+    $hiddens{l_accno} = 'Y';
+    $hiddens{$_} = $form->{$_} foreach qw(path login sessionid);
 
-<form method=post action=$form->{script}>
+    my @buttons = ({
+        name => 'action',
+        value => 'generate_yearend',
+        text => $locale->text('Continue'),
+        });
 
-<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));
-
-    print qq|
-<button class="submit" type="submit" name="action" value="continue">|
-      . $locale->text('Continue')
-      . qq|</button>|;
-
+    my $template = LedgerSMB::Template->new_UI(
+        user => \%myconfig, 
+        locale => $locale,
+        template => 'am-yearend');
+    $template->render({
+        user => \%myconfig, 
+        form => $form,
+        buttons => ..hidden..,
+	hiddens => \%hiddens,
+	accounts => \%accounts,
+    });
 }
 
 sub generate_yearend {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.