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

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



Revision: 2585
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2585&view=rev
Author:   einhverfr
Date:     2009-05-01 17:34:40 +0000 (Fri, 01 May 2009)

Log Message:
-----------
Adding template for GL searches

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

Added Paths:
-----------
    trunk/UI/journal/
    trunk/UI/journal/search.html

Added: trunk/UI/journal/search.html
===================================================================
--- trunk/UI/journal/search.html	                        (rev 0)
+++ trunk/UI/journal/search.html	2009-05-01 17:34:40 UTC (rev 2585)
@@ -0,0 +1,335 @@
+<?lsmb INCLUDE 'ui-header.html' ?>
+<?lsmb PROCESS 'elements.html' ?>
+<body>
+
+<form method="post" action="<?lsmb script ?>">
+<?lsmb PROCESS input element_data = {
+    type = "hidden"
+    name = "sort"
+    value = "transdate"
+} ?>
+
+<table width="100%">
+  <tr>
+    <th class="listtop"><?lsmb text('General Ledger Reports') ?></th>
+
+  </tr>
+  <tr height="5"></tr>
+  <tr>
+    <td>
+      <table>
+	<tr>
+	  <th align="right"><?lsmb text('Reference') ?></th>
+	  <td><?lsmb PROCESS input element_data = {
+                  name = "reference"
+                  size = "20"
+                  type = "text"
+                } ?></td>
+        </tr>
+         <tr>
+          <th align="right"><?lsmb text('Account') ?></th>
+          <td><?lsmb PROCESS select element_data = {
+                     name = "account"
+                     options = all_accounts 
+                     text_attr = 'accno'
+                     value_attr = 'id'
+              } ?> </td>
+	  </tr>
+	  <tr>
+	  <th align="right"><?lsmb text('Source') ?></th>
+	  <td><?lsmb PROCESS input element_data = {
+                     name = 'source'
+                     type = 'text'
+                     size = 20 } ?></td>
+	  <th align="right"><?lsmb text('Memo') ?></th>
+	  <td><?lsmb PROCESS input element_data = {
+                     name="memo" 
+                     size="20"
+                     type="text"
+              } ?></td>
+	</tr>
+	
+	<tr>
+
+	  <th align="right"><?lsmb text('Description') ?></th>
+	  <td colspan="5"><?lsmb PROCESS input element_data = {
+                                name='description' 
+                                size='60'
+                                type='text' } ?></td>
+	</tr>
+	<tr>
+	  <th align="right"><?lsmb text('Notes') ?></th>
+	  <td colspan="5"><?lsmb PROCESS input element_data = {
+                              name='notes' 
+                              size='60'
+                              type='text' } ?></td>
+	</tr>
+        <?lsmb IF all_departments.size -?>
+        <tr>
+          <th align="right"><?lsmb text('Department') ?></th>
+          <td colspan="5"><?lsmb PROCESS select element_data = {
+                                 name = 'department'
+                                 options = all_departments
+                                 value_attr = 'id'
+                                 text_attr = 'description'
+                              } ?></td>
+        </tr>
+        <?lsmb END -?>
+	<tr>
+
+	  <th align="right"><?lsmb text('From') ?></th>
+	  <td><?lsmb PROCESS input element_data = {
+               class="date" 
+               name="datefrom" 
+               size="11" 
+               title=datestyle } ?></td>
+	  <th align="right"><?lsmb text('To') ?></th>
+	  <td><?lsmb PROCESS input element_data = {
+                 class="date" 
+                 name="dateto" 
+                 size="11" 
+                 title=datestyle } ?></td>
+	</tr>
+	
+        <tr>
+	<th align="right"><?lsmb text('Period') ?></th>
+
+	<td colspan="5">
+        <?lsmb PROCESS select element_data = {
+               name = "month"
+               options = accountingmonths
+               text_attr = "month"
+               value_attr = "id"
+        } ?>
+
+	<?lsmb PROCESS select element_data = {
+               name="year"
+               options = all_years
+               text_attr = "year"
+               value_attr = "year"
+        } ?>
+	<?lsmb PROCESS input element_data = {
+               name="interval"
+               class="radio"
+               type="radio"
+               value="0" 
+               checked="checked" } ?>&nbsp;<?lsmb text('Current') ?>
+	<?lsmb PROCESS input element_data = { 
+               name="interval" 
+               class="radio" 
+               type="radio" 
+               value="1" } ?>&nbsp;<?lsmb text('Month') ?>
+	<?lsmb PROCESS input element_data = {
+               name="interval"
+               class="radio"
+               type="radio"
+               value="3" } ?>&nbsp;<?lsmb text('Quarter') ?>
+	<input name=interval class=radio type=radio value=12>&nbsp;Year
+	</td>
+      </tr>
+
+	<tr>
+
+	  <th align="right"><?lsmb text('Amount') ?> &gt;=</th>
+	  <td><?lsmb PROCESS input element_data = {
+                     name="amountfrom" 
+                     size="11"
+                     type="text"
+               } ?></td>
+	  <th align="right">Amount &lt;=</th>
+	  <td><?lsmb PROCESS input element_data = {
+                     name="amountto" 
+                     size="11"
+                     type="text" 
+              } ?></td>
+	</tr>
+	<tr>
+	  <th align="right"><?lsmb text('Include in Report') ?></th>
+
+	  <td colspan="5">
+	    <table>
+	      <tr>
+		<td>
+		  <?lsmb PROCESS input element_data = {
+                          name="category" 
+                          class="radio" 
+                          type="radio" 
+                          value="X" 
+                          checked = "checked"
+                   } ?>&nbsp;<?lsmb text('All') ?>
+		  <?lsmb PROCESS input element_data = {
+                          name="category" 
+                          class="radio"
+                          type="radio" 
+                          value="A"
+                   } ?>&nbsp;<?lsmb text('Asset') ?>
+		  <?lsmb PROCESS input element_data = { 
+                          name="category" 
+                          class="radio" 
+                          type="radio" 
+                          value="L"
+                   } ?>&nbsp;<?lsmb text('Liability') ?>
+		  <?lsmb PROCESS input element_data = {
+                         name="category" 
+                         class="radio"
+                         type="radio" 
+                         value="Q"
+                  } ?>&nbsp;<?lsmb text('Equity') ?>
+		  <?lsmb PROCESS input element_data = {
+                         name="category"
+                         class="radio" 
+                         type="radio" 
+                         value="I"
+                    } ?>&nbsp;<?lsmb text('Income') ?>
+		  <?lsmb PROCESS input element_data = {
+                         name="category" 
+                         class="radio" 
+                         type="radio" 
+                         value="E"
+                    } ?>&nbsp;<?lsmb text('Expense') ?>
+		</td>
+	      </tr>
+
+	      <tr>
+		<table>
+                    <tr>
+                      <td nowrap><?lsmb PROCESS input element_data = {
+                                        name="l_id" 
+                                        class="checkbox" 
+                                        type="checkbox" 
+                                        value="Y"
+                                 } ?> <?lsmb text('ID') ?></td>
+                      <td nowrap><?lsmb PROCESS input element_data = {
+                                        name="l_transdate" 
+                                        class="checkbox" 
+                                        type="checkbox" 
+                                        value="Y" 
+                                        checked="checked"
+                                  } ?> <?lsmb text('Date') ?></td>
+                     <td nowrap><?lsmb PROCESS input element_data = {
+                                       name="l_reference" 
+                                       class="checkbox" 
+                                       type="checkbox" 
+                                       value="Y" 
+                                       checked="checked"
+                                } ?> <?lsmb text('Reference') ?></td>
+                     <td nowrap><?lsmb PROCESS input element_data = {
+                                       name="l_description" 
+                                       class="checkbox" 
+                                       type="checkbox" 
+                                       value="Y" 
+                                       checked="checked"
+                                 } ?> <?lsmb text('Description') ?></td>
+
+                     <td nowrap><?lsmb PROCESS input element_data = {
+                                       name="l_notes" 
+                                       class="checkbox" 
+                                       type="checkbox" 
+                                       value="Y"
+                                } ?> <?lsmb text('Notes') ?></td>
+                  </tr>
+                  <tr>
+                    <td nowrap><?lsmb PROCESS input element_data = { 
+                                      name="l_debit" 
+                                      class="checkbox" 
+                                      type="checkbox" 
+                                      value="Y" 
+                                      checked="checked"
+                               } ?> <?lsmb text('Debit') ?></td>
+                    <td nowrap><?lsmb PROCESS input element_data = {
+                                      name="l_credit" 
+                                      class="checkbox" 
+                                      type="checkbox" 
+                                      value="Y" 
+                                      checked="checked" 
+                                } ?> <?lsmb text('Credit') ?></td>
+                   <td nowrap><?lsmb PROCESS input element_data = {
+                                     name="l_source" 
+                                     class="checkbox" 
+                                     type="checkbox" 
+                                     value="Y" 
+                                     checked="checked"
+                                } ?> <?lsmb text('Source') ?></td>
+                   <td nowrap><?lsmb PROCESS input element_data = {
+                                     name="l_memo" 
+                                     class="checkbox" 
+                                     type="checkbox" 
+                                     value="Y"
+                              } ?> <?lsmb text('Memo') ?></td>
+                   <td nowrap><?lsmb PROCESS input element_data = {
+                                     name="l_accno" 
+                                     class="checkbox" 
+                                     type="checkbox" 
+                                     value="Y" 
+                                     checked="checked"
+                             } ?> <?lsmb text('Account') ?></td>
+                  </tr>
+                  <tr>
+		    <td nowrap><?lsmb PROCESS input element_data = {
+                                      name="l_subtotal" 
+                                      class="checkbox" 
+                                      type="checkbox" 
+                                      value="Y"
+                                } ?> <?lsmb text('Subtotal') ?></td>
+		    <td nowrap><?lsmb PROCESS input element_data = {
+                                      name="l_balance" 
+                                      class="checkbox" 
+                                      type="checkbox" 
+                                      value="Y" 
+                                } ?> <?lsmb text('Balance') ?></td>
+                     <td nowrap><?lsmb PROCESS input element_data = {
+                                       name="l_gifi_accno" 
+                                       class="checkbox" 
+                                       type="checkbox" 
+                                       value="Y" 
+                                  } ?> <?lsmb text('GIFI') ?></td>
+                    <?lsmb IF all_departments.length -?>
+		    <td nowrap><?lsmb PROCESS input element_data = {
+                                      name="l_department" 
+                                      class="checkbox" 
+                                      type="checkbox" 
+                                      value="Y" 
+                                } ?> <?lsmb text('Department') ?></td>
+                    <?lsmb ELSE ?>
+                    <td nowrap></td>
+                    <?lsmb END # IF ?>
+                    <td nowrap></td>
+                  </tr>
+		</table>
+	      </tr>
+	    </table>
+	</tr>
+
+      </table>
+    </td>
+  </tr>
+  <tr>
+    <td><hr size=3 noshade></td>
+  </tr>
+</table>
+
+<?lsmb PROCESS input element_data = {
+       type="hidden" 
+       name="path" 
+       value=path
+} ?>
+<?lsmb PROCESS input element_data = { 
+       type="hidden" 
+       name="login" 
+       value=login
+} ?>
+
+<br>
+<?lsmb PROCESS button element_data = {
+       text = text('Continue')
+       class="submit" 
+       type="submit" 
+       name="action" 
+       value="generate_report"
+} ?>
+</form>
+
+
+</body>
+</html>
+

Modified: trunk/bin/gl.pl
===================================================================
--- trunk/bin/gl.pl	2009-05-01 05:33:20 UTC (rev 2584)
+++ trunk/bin/gl.pl	2009-05-01 17:34:40 UTC (rev 2585)
@@ -253,229 +253,36 @@
 
     # departments
     if ( @{ $form->{all_department} } ) {
-        $form->{selectdepartment} = "<option>\n";
-        for ( @{ $form->{all_department} } ) {
-            $form->{selectdepartment} .=
-qq|<option value="$_->{description}--$_->{id}">$_->{description}\n|;
-        }
-
-        $l_department =
-          qq|<input name="l_department" class=checkbox type=checkbox value=Y> |
-          . $locale->text('Department');
-
-        $department = qq|
-  	<tr>
-	  <th align=right nowrap>| . $locale->text('Department') . qq|</th>
-	  <td colspan=$colspan><select name=department>$form->{selectdepartment}</select></td>
-	</tr>
-|;
+        unshift @{ $form->{all_department} }, {id => "", description => ""};
     }
 
-    my @accounts = $form->all_accounts;
-    my $account_select = qq|<select name="chart_id" class="account>|;
-    for my $act (@accounts){
-        $account_select .= qq|<option value="$act->{id}">$act->{accno}--| .
-            qq|$act->{description}</option>|;
-    }
+    @{$form->{all_accounts}} = $form->all_accounts;
+    unshift @{$form->{all_accounts}}, {id => "", accno => ""};
 
     if ( @{ $form->{all_years} } ) {
 
         # accounting years
-        $form->{selectaccountingyear} = "<option>\n";
         for ( @{ $form->{all_years} } ) {
-            $form->{selectaccountingyear} .= qq|<option>$_\n|;
+             $_ = {year => $_};
         }
-        $form->{selectaccountingmonth} = "<option>\n";
+        unshift @{ $form->{all_years} }, {};
+        $form->{accountingmonths} = [];
         for ( sort keys %{ $form->{all_month} } ) {
-            $form->{selectaccountingmonth} .=
-              qq|<option value=$_>|
-              . $locale->text( $form->{all_month}{$_} ) . qq|\n|;
+            push @{$form->{accountingmonths}}, 
+                {id     => $_,
+                 month  => $locale->text( $form->{all_month}{$_} )};
         }
 
-        $selectfrom = qq|
-        <tr>
-	<th align=right>| . $locale->text('Period') . qq|</th>
-	<td colspan=$colspan>
-	<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>
-|;
     }
-
-    @a = ();
-    push @a, qq|<input name="l_id" class=checkbox type=checkbox value=Y> |
-      . $locale->text('ID');
-    push @a,
-qq|<input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
-      . $locale->text('Date');
-    push @a,
-qq|<input name="l_reference" class=checkbox type=checkbox value=Y checked> |
-      . $locale->text('Reference');
-    push @a,
-qq|<input name="l_description" class=checkbox type=checkbox value=Y checked> |
-      . $locale->text('Description');
-    push @a, qq|<input name="l_notes" class=checkbox type=checkbox value=Y> |
-      . $locale->text('Notes');
-    push @a, $l_department if $l_department;
-    push @a,
-      qq|<input name="l_debit" class=checkbox type=checkbox value=Y checked> |
-      . $locale->text('Debit');
-    push @a,
-      qq|<input name="l_credit" class=checkbox type=checkbox value=Y checked> |
-      . $locale->text('Credit');
-    push @a,
-      qq|<input name="l_source" class=checkbox type=checkbox value=Y checked> |
-      . $locale->text('Source');
-    push @a, qq|<input name="l_memo" class=checkbox type=checkbox value=Y> |
-      . $locale->text('Memo');
-    push @a,
-      qq|<input name="l_accno" class=checkbox type=checkbox value=Y checked> |
-      . $locale->text('Account');
-    push @a,
-      qq|<input name="l_gifi_accno" class=checkbox type=checkbox value=Y> |
-      . $locale->text('GIFI');
-
-    $form->header;
-
-    print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=sort value=transdate>
-
-<table width=100%>
-  <tr>
-    <th class=listtop>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <td>
-      <table>
-	<tr>
-	  <th align=right>| . $locale->text('Reference') . qq|</th>
-	  <td><input name=reference size=20></td>
-        </tr>
-         <tr>
-          <th align="right">| . $locale->text('Account') . qq|</th>
-          <td>$account_select</td>
-	  </tr>
-	  <tr>
-	  <th align=right>| . $locale->text('Source') . qq|</th>
-	  <td><input name=source size=20></td>
-	  <th align=right>| . $locale->text('Memo') . qq|</th>
-	  <td><input name=memo size=20></td>
-	</tr>
-	$department
-	<tr>
-	  <th align=right>| . $locale->text('Description') . qq|</th>
-	  <td colspan=$colspan><input name=description size=60></td>
-	</tr>
-	<tr>
-	  <th align=right>| . $locale->text('Notes') . qq|</th>
-	  <td colspan=$colspan><input name=notes size=60></td>
-	</tr>
-	<tr>
-	  <th align=right>| . $locale->text('From') . qq|</th>
-	  <td><input class="date" name=datefrom size=11 title="$myconfig{dateformat}"></td>
-	  <th align=right>| . $locale->text('To') . qq|</th>
-	  <td><input class="date" name=dateto size=11 title="$myconfig{dateformat}"></td>
-	</tr>
-	$selectfrom
-	<tr>
-	  <th align=right>| . $locale->text('Amount') . qq| >=</th>
-	  <td><input name=amountfrom size=11></td>
-	  <th align=right>| . $locale->text('Amount') . qq| <=</th>
-	  <td><input name=amountto size=11></td>
-	</tr>
-	<tr>
-	  <th align=right>| . $locale->text('Include in Report') . qq|</th>
-	  <td colspan=$colspan>
-	    <table>
-	      <tr>
-		<td>
-		  <input name="category" class=radio type=radio value=X checked>&nbsp;|
-      . $locale->text('All') . qq|
-		  <input name="category" class=radio type=radio value=A>&nbsp;|
-      . $locale->text('Asset') . qq|
-		  <input name="category" class=radio type=radio value=L>&nbsp;|
-      . $locale->text('Liability') . qq|
-		  <input name="category" class=radio type=radio value=Q>&nbsp;|
-      . $locale->text('Equity') . qq|
-		  <input name="category" class=radio type=radio value=I>&nbsp;|
-      . $locale->text('Income') . qq|
-		  <input name="category" class=radio type=radio value=E>&nbsp;|
-      . $locale->text('Expense') . qq|
-		</td>
-	      </tr>
-	      <tr>
-		<table>
-|;
-
-    while (@a) {
-        print qq|<tr>\n|;
-        for ( 1 .. 5 ) {
-            print qq|<td nowrap>| . shift @a;
-            print qq|</td>\n|;
-        }
-        print qq|</tr>\n|;
-    }
-
-    print qq|
-		  <tr>
-		    <td nowrap><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
-      . $locale->text('Subtotal')
-      . qq|</td>
-		  </tr>
-		  <tr>
-		    <td nowrap><input name="l_balance" class=checkbox type=checkbox value=Y> |
-      . $locale->text('Balance')
-      . qq|</td>
-		  </tr>
-		</table>
-	      </tr>
-	    </table>
-	</tr>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-</table>
-
-<input type=hidden name=nextsub value=generate_report>
-|;
-
-    $form->hide_form(qw(path login sessionid));
-
-    print qq|
-<br>
-<button class="submit" type="submit" name="action" value="continue">|
-      . $locale->text('Continue')
-      . qq|</button>
-</form>
-|;
-
-    if ( $form->{lynx} ) {
-        require "bin/menu.pl";
-        &menubar;
-    }
-
-    print qq|
-
-</body>
-</html>
-|;
+    my $template = LedgerSMB::Template->new(
+        user => \%myconfig,
+        locale => $locale,
+        path => 'UI/journal',
+        template => 'search',
+        format => 'HTML',
+        );
+    $template->render($form);
+    
 }
 
 sub generate_report {


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