[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1706] trunk
- Subject: SF.net SVN: ledger-smb: [1706] trunk
- From: ..hidden..
- Date: Fri, 05 Oct 2007 15:02:52 -0700
Revision: 1706
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1706&view=rev
Author: tetragon
Date: 2007-10-05 15:02:51 -0700 (Fri, 05 Oct 2007)
Log Message:
-----------
Convert the defaults screen to using a template
Make the defaults screen valid XHTML 1.0 Transitional
Modified Paths:
--------------
trunk/bin/am.pl
Added Paths:
-----------
trunk/UI/am-defaults.html
Added: trunk/UI/am-defaults.html
===================================================================
--- trunk/UI/am-defaults.html (rev 0)
+++ trunk/UI/am-defaults.html 2007-10-05 22:02:51 UTC (rev 1706)
@@ -0,0 +1,152 @@
+<!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>
+<?lsmb PROCESS elements.html ?>
+
+<body>
+<form method="post" action="<?lsmb form.script ?>">
+<table width="100%">
+ <tr><th class="listtop"><?lsmb text('System Defaults') ?></th></tr>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="right"><?lsmb text('Business Number') ?></th>
+ <td><input name="businessnumber" size="25" value="<?lsmb form.businessnumber ?>" /></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Weight Unit') ?></th>
+ <td><input name="weightunit" size="5" value="<?lsmb form.weightunit ?>" /></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <th class="listheading"><?lsmb escape(text('Last Numbers & Default Accounts')) ?></th>
+ </tr>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Inventory') ?></th>
+ <td>
+<?lsmb PROCESS select element_data=selects.IC ?>
+ </td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Income') ?></th>
+ <td>
+<?lsmb PROCESS select element_data=selects.IC_income ?>
+ </td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Expense') ?></th>
+ <td>
+<?lsmb PROCESS select element_data=selects.IC_expense ?>
+ </td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Foreign Exchange Gain') ?></th>
+ <td>
+<?lsmb PROCESS select element_data=selects.FX_gain ?>
+ </td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Foreign Exchange Loss') ?></th>
+ <td>
+<?lsmb PROCESS select element_data=selects.FX_loss ?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <th align="left"><?lsmb escape(text('Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies')) ?></th>
+ </tr>
+ <tr>
+ <td>
+ <input name="curr" size="40" value="<?lsmb form.curr ?>" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('GL Reference Number') ?></th>
+ <td><input name="glnumber" size="40" value="<?lsmb form.glnumber ?>" /></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Sales Invoice/AR Transaction Number') ?></th>
+ <td><input name="sinumber" size="40" value="<?lsmb form.sinumber ?>" /></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Sales Order Number') ?></th>
+ <td><input name="sonumber" size="40" value="<?lsmb form.sonumber ?>" /></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Vendor Invoice/AP Transaction Number') ?></th>
+ <td><input name="vinumber" size="40" value="<?lsmb form.vinumber ?>" /></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Purchase Order Number') ?></th>
+ <td><input name="ponumber" size="40" value="<?lsmb form.ponumber ?>" /></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Sales Quotation Number') ?></th>
+ <td><input name="sqnumber" size="40" value="<?lsmb form.sqnumber ?>" /></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('RFQ Number') ?></th>
+ <td><input name="rfqnumber" size="40" value="<?lsmb form.rfqnumber ?>" /></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Part Number') ?></th>
+ <td><input name="partnumber" size="40" value="<?lsmb form.partnumber ?>" /></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Job/Project Number') ?></th>
+ <td><input name="projectnumber" size="40" value="<?lsmb form.projectnumber ?>" /></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Employee Number') ?></th>
+ <td><input name="employeenumber" size="40" value="<?lsmb form.employeenumber ?>" /></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Customer Number') ?></th>
+ <td><input name="customernumber" size="40" value="<?lsmb form.customernumber ?>" /></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="nowrap"><?lsmb text('Vendor Number') ?></th>
+ <td><input name="vendornumber" size="40" value="<?lsmb form.vendornumber ?>" /></td>
+ </tr>
+ </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 => 'save' text => text('Save')} ?>
+ </form>
+
+</body>
+</html>
Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl 2007-10-05 22:00:53 UTC (rev 1705)
+++ trunk/bin/am.pl 2007-10-05 22:02:51 UTC (rev 1706)
@@ -1693,182 +1693,48 @@
# get defaults for account numbers and last numbers
AM->get_all_defaults( \%$form );
+ my %selects = (
+ 'FX_loss' => {name => 'FX_loss', options => []},
+ 'FX_gain' => {name => 'FX_gain', options => []},
+ 'IC_expense' => {name => 'IC_expense', options => []},
+ 'IC_income' => {name => 'IC_income', options => []},
+ 'IC_inventory' => {name => 'IC_inventory', options => []},
+ 'IC' => {name => 'IC', options => []},
+ );
foreach $key ( keys %{ $form->{accno} } ) {
foreach $accno ( sort keys %{ $form->{accno}{$key} } ) {
- $form->{account}{$key} .=
- "<option>$accno--$form->{accno}{$key}{$accno}{description}\n";
- $form->{accno}{ $form->{accno}{$key}{$accno}{id} } = $accno;
+ push @{$selects{$key}{options}}, {
+ text => "$accno--$form->{accno}{$key}{$accno}{description}",
+ value => "$accno--$form->{accno}{$key}{$accno}{description}",
+ };
+ $selects{$key}{default_values} = "$accno--$form->{accno}{$key}{$accno}{description}" if
+ ($form->{defaults}{$key} == $form->{accno}{$key}{$accno}{id});
}
}
- for (qw(IC IC_inventory IC_income IC_expense FX_gain FX_loss)) {
- $form->{account}{$_} =~
-s/>$form->{accno}{$form->{defaults}{$_}}/ selected>$form->{accno}{$form->{defaults}{$_}}/;
- }
-
for (qw(accno defaults)) { delete $form->{$_} }
- $form->{title} = $locale->text('System Defaults');
+##SC: temporary commenting out
+## if ( $form->{lynx} ) {
+## require "bin/menu.pl";
+## &menubar;
+## }
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=type value=defaults>
-
-<table width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align="right">| . $locale->text('Business Number') . qq|</th>
- <td><input name=businessnumber size=25 value="$form->{businessnumber}"></td>
- </tr>
- <tr>
- <th align="right">| . $locale->text('Weight Unit') . qq|</th>
- <td><input name=weightunit size=5 value="$form->{weightunit}"></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <th class="listheading">|
- . $locale->text('Last Numbers & Default Accounts')
- . qq|</th>
- </tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align="right" nowrap>| . $locale->text('Inventory') . qq|</th>
- <td><select name=IC>$form->{account}{IC}</select></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Income') . qq|</th>
- <td><select name=IC_income>$form->{account}{IC_income}</select></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Expense') . qq|</th>
- <td><select name=IC_expense>$form->{account}{IC_expense}</select></td>
- </tr>
- <tr>
- <th align="right" nowrap>|
- . $locale->text('Foreign Exchange Gain')
- . qq|</th>
- <td><select name=FX_gain>$form->{account}{FX_gain}</select></td>
- </tr>
- <tr>
- <th align="right" nowrap>|
- . $locale->text('Foreign Exchange Loss')
- . qq|</th>
- <td><select name=FX_loss>$form->{account}{FX_loss}</select></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <th align=left>|
- . $locale->text(
-'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
- )
- . qq|</th>
- </tr>
- <tr>
- <td>
- <input name=curr size=40 value="$form->{curr}">
- </td>
- </tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align="right" nowrap>| . $locale->text('GL Reference Number') . qq|</th>
- <td><input name=glnumber size=40 value="$form->{glnumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|
- . $locale->text('Sales Invoice/AR Transaction Number')
- . qq|</th>
- <td><input name=sinumber size=40 value="$form->{sinumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Sales Order Number') . qq|</th>
- <td><input name=sonumber size=40 value="$form->{sonumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|
- . $locale->text('Vendor Invoice/AP Transaction Number')
- . qq|</th>
- <td><input name=vinumber size=40 value="$form->{vinumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|
- . $locale->text('Purchase Order Number')
- . qq|</th>
- <td><input name=ponumber size=40 value="$form->{ponumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|
- . $locale->text('Sales Quotation Number')
- . qq|</th>
- <td><input name=sqnumber size=40 value="$form->{sqnumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('RFQ Number') . qq|</th>
- <td><input name=rfqnumber size=40 value="$form->{rfqnumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Part Number') . qq|</th>
- <td><input name=partnumber size=40 value="$form->{partnumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Job/Project Number') . qq|</th>
- <td><input name=projectnumber size=40 value="$form->{projectnumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Employee Number') . qq|</th>
- <td><input name=employeenumber size=40 value="$form->{employeenumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Customer Number') . qq|</th>
- <td><input name=customernumber size=40 value="$form->{customernumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Vendor Number') . qq|</th>
- <td><input name=vendornumber size=40 value="$form->{vendornumber}"></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
- $form->hide_form(qw(path login sessionid));
-
- print qq|
-<button type="submit" class="submit" name="action" value="save">|
- . $locale->text('Save')
- . qq|</button>|;
-
- if ( $form->{lynx} ) {
- require "bin/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
-
+ my %hiddens = (
+ path => $form->{path},
+ login => $form->{login},
+ sessionid => $form->{sessionid},
+ type => 'defaults',
+ );
+ my $template = LedgerSMB::Template->new_UI(
+ user => \%myconfig,
+ locale => $locale,
+ template => 'am-defaults');
+ $template->render({
+ form => $form,
+ hiddens => \%hiddens,
+ selects => \%selects,
+ });
}
sub taxes {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.