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

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



Revision: 3464
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3464&view=rev
Author:   einhverfr
Date:     2011-07-08 10:51:20 +0000 (Fri, 08 Jul 2011)

Log Message:
-----------
Redesigned Edit Accounts screen, more doc strings on fixed asset module

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Account.pm
    trunk/LedgerSMB/DBObject/Asset_Report.pm
    trunk/UI/accounts/edit.html
    trunk/scripts/account.pl
    trunk/scripts/asset.pl
    trunk/sql/coa/id/chart/General.sql
    trunk/sql/modules/Account.sql

Modified: trunk/LedgerSMB/DBObject/Account.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Account.pm	2011-07-08 01:44:54 UTC (rev 3463)
+++ trunk/LedgerSMB/DBObject/Account.pm	2011-07-08 10:51:20 UTC (rev 3464)
@@ -163,6 +163,17 @@
     $self->{link} = $self->_db_array_scalars(@links);
 }
 
+=item list_headings
+
+Returns a list of account_heading's.  No inputs required.
+
+=cut
+
+sub list_headings {
+   my ($self) = shift @_;
+   return $self->exec_method(funcname => 'account_heading__list');
+}
+
 =back
 
 =head1 SEE ALSO

Modified: trunk/LedgerSMB/DBObject/Asset_Report.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Asset_Report.pm	2011-07-08 01:44:54 UTC (rev 3463)
+++ trunk/LedgerSMB/DBObject/Asset_Report.pm	2011-07-08 10:51:20 UTC (rev 3464)
@@ -181,6 +181,10 @@
 
 id
 
+For depreciation accounts, expense_acct must be set.
+
+For disposal accounts, gain_acct and loss_acct must be set.
+
 Approves the referenced transaction and creates a GL draft (which must then be 
 approved.
 

Modified: trunk/UI/accounts/edit.html
===================================================================
--- trunk/UI/accounts/edit.html	2011-07-08 01:44:54 UTC (rev 3463)
+++ trunk/UI/accounts/edit.html	2011-07-08 10:51:20 UTC (rev 3464)
@@ -1,275 +1,374 @@
-<?lsmb INCLUDE 'ui-header.html' ?> 
+<?lsmb 
+INCLUDE 'ui-header.html' 
+    include_stylesheet =  [stylesheet, 'UI/accounts/edit.css']
+    include_script = ['UI/account/edit.js']
+?> 
 <?lsmb PROCESS elements.html ?> 
-<body>
+<body onload="init()">
 <form method="post" action="<?lsmb form.script ?>">
-<table border="0" width="100%">
-  <tr><th class="listtop"><?lsmb form.title ?></th></tr>
-  <tr><td> </td></tr>
-  <tr valign="top">
-    <td>
-      <table>
-        <tr>
-          <th align="right"><?lsmb text('Account Number') ?></th>
-          <td><?lsmb INCLUDE input element_data={
-            name => 'accno',
-            size => '20',
-            value => form.accno} ?></td>
-        </tr>
-        <tr>
-          <th align="right"><?lsmb text('Description') ?></th>
-          <td><?lsmb INCLUDE input element_data={
-            name => 'description',
-            size => '40',
-            value => form.description} ?></td>
-        </tr>
-        <tr>
-          <th align="right"><?lsmb text('Account Type') ?></th>
-          <td>
-            <table>
-              <tr valign="top">
-                <td align="right">
-                  <?lsmb INCLUDE input element_data={
-                          name => 'category',
-                          type => 'radio',
-                          label => text('Asset'),
-                          value => 'A',
-                          ${checked.A_} => checked.A_,
-                          } ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'category',
-                          type => 'radio',
-                          label => text('Liability'),
-                          ${checked.L_} => checked.L_,
-                          value => 'L'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'category',
-                          type => 'radio',
-                          label => text('Equity'),
-                          ${checked.Q_} => checked.Q_,
-                          value => 'Q'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'category',
-                          type => 'radio',
-                          label => text('Income'),
-                          ${checked.I_} => checked.I_,
-                          value => 'I'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'category',
-                          type => 'radio',
-                          label => text('Expense'),
-                          ${checked.E_} => checked.E_,
-                          value => 'E'} ?>
-                </td>
-                <td align="right">
-                  <?lsmb INCLUDE input element_data={
-                          name => 'contra',
-                          type => 'checkbox',
-                          label => text('Contra'),
-                          ${checked.contra} => checked.contra,
-                          value => '1'} ?><br/>
-                  <?lsmb INCLUDE input element_data={
-                          name => 'recon',
-                          type => 'checkbox',
-                          label => text('Recon'),
-                          ${checked.recon} => checked.recon,
-                          value => '1'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'tax',
-                          type => 'checkbox',
-                          label => text('Tax'),
-                          ${checked.tax} => checked.tax,
-                          value => '1'} ?>
-                </td>
-                <td align="right">
-                  <?lsmb INCLUDE input element_data={
-                          name => 'charttype',
-                          type => 'radio',
-                          label => text('Heading'),
-                          ${checked.H} => checked.H,
-                          value => 'H'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'charttype',
-                          type => 'radio',
-                          label => text('Account'),
-                          ${checked.A} => checked.A,
-                          value => 'A'} ?>
-                </td>
-              </tr>
-            </table>
-          </td>
-        </tr>
-<?lsmb IF form.charttype == 'A' ?>
-        <tr>
-          <td colspan="2">
-            <table>
-              <tr>
-                <th align="left"><?lsmb text('Is this a summary account to record') ?></th>
-                <td>
-                  <?lsmb INCLUDE input element_data={
-                          name => 'AR',
-                          type => 'checkbox',
-                          label => text('AR'),
-                          ${form.AR} => form.AR,
-                          value => 'AR'} ?> 
-                  <?lsmb INCLUDE input element_data={
-                          name => 'AP',
-                          type => 'checkbox',
-                          label => text('AP'),
-                          ${form.AP} => form.AP,
-                          value => 'AP'} ?> 
-                  <?lsmb INCLUDE input element_data={
-                          name => 'IC',
-                          type => 'checkbox',
-                          label => text('Inventory'),
-                          ${form.IC} => form.IC,
-                          value => 'IC'} ?> 
-                </td>
-              </tr>
-            </table>
-          </td>
-        </tr>
-        <tr>
-          <th colspan="2" align="left"><?lsmb text('Include in drop-down menus') ?></th>
-        </tr>
-        <tr valign="top">
-          <td colspan="2">
-            <table width="100%">
-              <tr>
-                <th align="left"><?lsmb text('Receivables') ?></th>
-                <th align="left"><?lsmb text('Payables') ?></th>
-                <th align="left"><?lsmb text('Tracking Items') ?></th>
-                <th align="left"><?lsmb text('Non-tracking Items') ?></th>
-              </tr>
-              <tr>
-                <td align="right">
-                  <?lsmb INCLUDE input element_data={
-                          name => 'AR_amount',
-                          type => 'checkbox',
-                          label => text('Income'),
-                          ${form.AR_amount} => form.AR_amount,
-                          value => 'AR_amount'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'AR_paid',
-                          type => 'checkbox',
-                          label => text('Payment'),
-                          ${form.AR_paid} => form.AR_paid,
-                          value => 'AR_paid'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'AR_tax',
-                          type => 'checkbox',
-                          label => text('Tax'),
-                          ${form.AR_tax} => form.AR_tax,
-                          value => 'AR_tax'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'AR_overpayment',
-                          type => 'checkbox',
-                          label => text('Overpayment'),
-                          ${form.AR_overpayment} => form.AR_overpayment,
-                          value => 'AR_overpayment'} ?><br />        
-                   <?lsmb INCLUDE input element_data={
-                          name => 'AR_discount',
-                          type => 'checkbox',
-                          label => text('Discount'),
-                          ${form.AR_discount} => form.AR_discount,
-                          value => 'AR_discount'} ?>
-                          
-                </td>
-                <td align="right">
-                  <?lsmb INCLUDE input element_data={
-                          name => 'AP_amount',
-                          type => 'checkbox',
-                          label => text('Expense/Asset'),
-                          ${form.AP_amount} => form.AP_amount,
-                          value => 'AP_amount'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'AP_paid',
-                          type => 'checkbox',
-                          label => text('Payment'),
-                          ${form.AP_paid} => form.AP_paid,
-                          value => 'AP_paid'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'AP_tax',
-                          type => 'checkbox',
-                          label => text('Tax'),
-                          ${form.AP_tax} => form.AP_tax,
-                          value => 'AP_tax'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'AP_overpayment',
-                          type => 'checkbox',
-                          label => text('Overpayment'),
-                          ${form.AP_overpayment} => form.AP_overpayment,
-                          value => 'AP_overpayment'} ?><br /> 
-                  <?lsmb INCLUDE input element_data={
-                          name => 'AP_discount',
-                          type => 'checkbox',
-                          label => text('Discount'),
-                          ${form.AP_overpayment} => form.AP_discount,
-                          value => 'AP_discount'} ?>       
-                </td>
-                <td align="right" valign="top">
-                  <?lsmb INCLUDE input element_data={
-                          name => 'IC_sale',
-                          type => 'checkbox',
-                          label => text('Income'),
-                          ${form.IC_sale} => form.IC_sale,
-                          value => 'IC_sale'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'IC_cogs',
-                          type => 'checkbox',
-                          label => text('COGS'),
-                          ${form.IC_cogs} => form.IC_cogs,
-                          value => 'IC_cogs'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'IC_taxpart',
-                          type => 'checkbox',
-                          label => text('Tax'),
-                          ${form.IC_taxpart} => form.IC_taxpart,
-                          value => 'IC_taxpart'} ?>
-                </td>
-                <td align="right" valign="top">
-                  <?lsmb INCLUDE input element_data={
-                          name => 'IC_income',
-                          type => 'checkbox',
-                          label => text('Income'),
-                          ${form.IC_income} => form.IC_income,
-                          value => 'IC_income'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'IC_expense',
-                          type => 'checkbox',
-                          label => text('Expense'),
-                          ${form.IC_expense} => form.IC_expense,
-                          value => 'IC_expense'} ?><br />
-                  <?lsmb INCLUDE input element_data={
-                          name => 'IC_taxservice',
-                          type => 'checkbox',
-                          label => text('Tax'),
-                          ${form.IC_taxservice} => form.IC_taxservice,
-                          value => 'IC_taxservice'} ?>
-                </td>
-              </tr>
-            </table>
-          </td>
-        </tr>
-<?lsmb END ?>
-        <tr><td> </td></tr>
-        <tr>
-          <th align="right"><?lsmb text('GIFI') ?></th>
-          <td><?lsmb INCLUDE input element_data={
-            name => 'gifi_accno',
-            size => '9',
-            value => form.gifi_accno} ?></td>
-        </tr>
-      </table>
-    </td>
-  </tr>
-  <tr><td><hr size="3" noshade="noshade" /></td></tr>
-</table>
+<div class="listtop"><?lsmb form.title ?></div>
+<div class="inputline" id="accno-line">
+  <label class="line"><?lsmb text('Account Number') ?></label>
+  <div class="inputgroup">
+    <?lsmb 
+    INCLUDE input element_data = {
+      name = 'accno'
+      size = '20'
+     value = form.accno
+      type = 'text'
+     class = 'control-code'
+    } ?>
+  </div>
+</div>
+<div class="inputline" id="desc-line">
+   <label class="line"><?lsmb text('Description') ?></label>
+   <div class="inputgroup">
+      <?lsmb 
+    INCLUDE input element_data = {
+      name = 'description'
+      size = '40'
+     value = form.description
+      type = 'text'
+     class = 'description'
+    } ?>
+   </div>
+</div>
+<div class="inputline" id="heading-line">
+   <label class="line"><?lsmb text('Heading') ?></label>
+   <div class="inputgroup">
+      <?lsmb 
+    INCLUDE select element_data = {
+                  name = 'heading'
+               options = form.all_headings
+       default_options = [form.heading]
+             text_attr = 'text'
+            value_attr = 'id'
+                 class = 'account'
+    } ?>
+   </div>
+</div>
+<div class="inputline" id="charttype-line">
+   <label class="line"><?lsmb text('GIFI') ?></label>
+   <div class="inputgroup">
+       <?lsmb INCLUDE input element_data={
+            name = 'gifi_accno',
+            size = '9',
+           value = form.gifi_accno} ?>
+   </div>
+</div>
+<div class="inputline" id="charttype-line">
+   <label class="line">&nbsp;</label>
+   <div class="inputgroup">
+    <?lsmb 
+     ctypes = [
+                { text = 'Account', value = 'A'}
+                { text = 'Heading', value = 'H'}
+              ];
+    INCLUDE select element_data = {
+                  name = 'charttype'
+               options = ctypes
+        default_values = [form.charttype]
+    };?>
+  </div>
+</div>
+<div class="inputline" id="acctype-line">
+   <label class="line"><?lsmb text('Account Type') ?></label>
+   <div class="inputgroup">
+      <?lsmb
+        a_types = [
+              { value = 'A', text = text('Asset') }
+              { value = 'L', text = text('Liability') }
+              { value = 'Q', text = text('Equity') }
+              { value = 'I', text = text('Income') }
+              { value = 'E', text = text('Expense') }
+        ];  
+    INCLUDE select element_data = {
+                  name = 'category'
+               options = a_types
+        default_values = [form.category]
+    }; ?>
+  </div>
+</div>
+<div class="inputline" id="acc-options-line">
+   <label class="line"><?lsmb text('Options') ?></label>
+   <div class="inputgroup">
+       <?lsmb 
+       IF form.contra;
+          contra = 'CHECKED';
+       END;
+       INCLUDE input element_data = {
+               type = 'checkbox'
+               name = 'contra'
+              label = text('Contra')
+              value = '1'
+            checked = contra
+       } ?>
+   </div>
+   <div class="inputgroup">
+     <?lsmb 
+        IF form.recon; 
+           recon = 'CHECKED';
+        END; 
+        INCLUDE input element_data={
+               name = 'recon'
+               type = 'checkbox',
+              label = text('Recon')
+            checked = recon
+              value = '1'
+        } ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb 
+        IF form.tax; tax = 'CHECKED'; END;
+        INCLUDE input element_data={
+               name = 'tax',
+               type = 'checkbox',
+              label = text('Tax'),
+            checked = checked.tax,
+              value = '1'} ?>
+   </div>
+</div>
+<div class="inputline" id="summary-line">
+   <label class="line"><?lsmb text('Summary account for') ?></label>
+   <div class="inputgroup">
+   <?lsmb # fixed_asset may eventually go in here too depending on future
+          # directions in development.
+      summary = [];
+      IF form.AR; summary = 'AR'; END;
+      IF form.AP; summary = 'AP'; END;
+      IF form.IC; summary = 'IC'; END;
+      s_accts = [ 
+        {}
+        {text = 'AR',        value = 'AR'}
+        {text = 'AP',        value = 'AP'}
+        {text = 'Inventory', value = 'IC'}
+      ];
+      INCLUDE select element_data = {
+               name = "summary"
+            options = s_accts
+     default_values = [summary]
+      }; ?>    
+   </div>
+</div>
+<div class="subsectionhead">
+   <?lsmb text('Include in drop-down menus') ?>
+</div>
+<div class="inputline" id="ar-line">
+   <label class="line"><?lsmb text('Receivables') ?></label>
+   <div class="inputgroup">
+      <?lsmb IF form.AR_amount; AR_amount = 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'AR_amount',
+              type = 'checkbox',
+             label = text('Income'),
+           checked = AR_amount,
+             value = 'AR_amount'
+         } ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.AR_paid; AR_paid = 'CHECKED'; END;
+          INCLUDE input element_data={
+              name = 'AR_paid',
+              type = 'checkbox',
+             label = text('Payment'),
+           checked = AR_paid,
+             value = 'AR_paid'
+     } ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.AR_tax; AR_tax = 'CHECKED'; END;
+          INCLUDE input element_data={
+              name = 'AR_tax',
+              type = 'checkbox',
+             label = text('Tax'),
+           checked = AR_tax,
+             value = 'AR_tax'
+      } ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.AR_overpayment; AR_overpayment = 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'AR_overpayment',
+              type = 'checkbox',
+             label = text('Overpayment'),
+           checked = AR_overpayment,
+             value = 'AR_overpayment'
+       } ?>    
+   </div>
+   <div class="inputgroup">
+       <?lsmb IF form.AR_overpayment; AR_overpayment = 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'AR_discount',
+              type = 'checkbox',
+             label = text('Discount'),
+           checked = AR_discount,
+             value = 'AR_discount'
+        } ?>
+   </div>
+</div>
+<div class="inputline" id="ap-line">
+   <label class="line"><?lsmb text('Payables') ?></label>
+   <div class="inputgroup">
+      <?lsmb IF form.AP_amount; AP_amount= 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'AP_amount',
+              type = 'checkbox',
+             label = text('Expense/Asset'),
+           checked = AP_amount,
+             value = 'AP_amount'} ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.AP_paid; AP_paid= 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'AP_paid',
+              type = 'checkbox',
+             label = text('Payment'),
+           checked = AP_paid,
+             value = 'AP_paid'} ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.AP_tax; AP_tax= 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'AP_tax',
+              type = 'checkbox',
+             label = text('Tax'),
+           checked = AP_tax,
+             value = 'AP_tax'} ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.AP_overpayment; AP_overpayment= 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'AP_overpayment',
+              type = 'checkbox',
+             label = text('Overpayment'),
+           checked = AP_overpayment,
+             value = 'AP_overpayment'} ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.AP_discount; AP_discount= 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'AP_discount',
+              type = 'checkbox',
+             label = text('Discount'),
+           checked = AP_discount,
+             value = 'AP_discount'} ?>       
+   </div>
+</div>
+<div class="inputline" id="goods-line">
+   <label class="line"><?lsmb text('Tracking Items') ?></label>
+   <div class="inputgroup">
+      <?lsmb IF form.IC_sale; IC_sale= 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'IC_sale',
+              type = 'checkbox',
+             label = text('Income'),
+           checked = IC_sale,
+             value = 'IC_sale'} ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.IC_cogs; IC_cogs= 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'IC_cogs',
+              type = 'checkbox',
+             label = text('COGS'),
+           checked = IC_cogs,
+             value = 'IC_cogs'} ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.IC_cogs; IC_cogs= 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'IC_taxpart',
+              type = 'checkbox',
+             label = text('Tax'),
+           checked = IC_taxpart,
+             value = 'IC_taxpart'} ?>
+   </div>
+</div>
+<div class="inputline" id="services-line">
+   <label class="line"><?lsmb text('Non-tracking Items') ?></label>
+   <div class="inputgroup">
+      <?lsmb IF form.IC_cogs; IC_cogs= 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'IC_income',
+              type = 'checkbox',
+             label = text('Income'),
+           checked = IC_income,
+             value = 'IC_income'} ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.IC_cogs; IC_cogs= 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'IC_expense',
+              type = 'checkbox',
+             label = text('Expense'),
+           checked = IC_expense,
+             value = 'IC_expense'} ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.IC_taxservice; IC_taxservice= 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'IC_taxservice',
+              type = 'checkbox',
+             label = text('Tax'),
+           checked = IC_taxservice,
+             value = 'IC_taxservice'} ?>
+   </div>
+</div>
+<div class="inputline" id="assets-line">
+   <label class="line"><?lsmb text('Fixed Assets') ?></label>
+   <div class="inputgroup">
+      <?lsmb IF form.fixed_asset;fixed_asset= 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'fixed_asset',
+              type = 'checkbox',
+             label = text('Fixed Asset'), #'
+           checked = fixed_asset,
+             value = 'fixed_asset'} ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.accum_dep;accum_dep = 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'accum_dep',
+              type = 'checkbox',
+             label = text('Depreciation'), 
+           checked = accum_dep,
+             value = 'accum_dep'} ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.asset_expense;asset_expense = 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'asset_expense',
+              type = 'checkbox',
+             label = text('Expense'), 
+           checked = asset_expense,
+             value = 'asset_expense'} ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.asset_gain;asset_gain = 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'asset_gain',
+              type = 'checkbox',
+             label = text('Gain'), 
+           checked = asset_gain,
+             value = 'asset_gain'} ?>
+   </div>
+   <div class="inputgroup">
+      <?lsmb IF form.asset_loss;asset_loss = 'CHECKED'; END;
+         INCLUDE input element_data={
+              name = 'asset_loss',
+              type = 'checkbox',
+             label = text('Loss'), 
+           checked = asset_loss,
+             value = 'asset_loss'} ?>
+   </div>
+</div>
 <?lsmb FOREACH hidden IN hiddens.keys;
 	INCLUDE input element_data={
-		type => 'hidden',
-		name => hidden,
-		value => hiddens.item(hidden)
+		type = 'hidden',
+		name = hidden,
+		value = hiddens.item(hidden)
 		}; END ?>
+<hr size="3" noshade="noshade" />
 <?lsmb FOREACH button IN buttons; INCLUDE button element_data=button; END ?>
 </form>
 </body>

Modified: trunk/scripts/account.pl
===================================================================
--- trunk/scripts/account.pl	2011-07-08 01:44:54 UTC (rev 3463)
+++ trunk/scripts/account.pl	2011-07-08 10:51:20 UTC (rev 3464)
@@ -99,6 +99,9 @@
 # copied from AM.pm.  To be refactored.
 sub _display_account_screen {
     my ($form) = @_;
+    my $account = LedgerSMB::DBObject::Account->new({base => $form});
+    @{$form->{all_headings}} = $account->list_headings();
+    $form->error(..hidden..>{all_headings}});
     my $locale = $form->{_locale};
     my $buttons = [];
     my $checked;
@@ -114,13 +117,6 @@
     $hiddens->{$_} = $form->{$_} foreach qw(id inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id);
     $checked->{ $form->{charttype} } = "checked";
 
-    for my $ct (qw(A E I Q L)){
-        $checked->{"${ct}_"} = "checked" if $form->{category} eq $ct;
-    } 
-
-    for my $cb (qw(contra tax)){
-        $checked->{$cb} = "checked" if $form->{$cb};
-    }
     my %button = ();
 
     if ( $form->{id} ) {

Modified: trunk/scripts/asset.pl
===================================================================
--- trunk/scripts/asset.pl	2011-07-08 01:44:54 UTC (rev 3463)
+++ trunk/scripts/asset.pl	2011-07-08 10:51:20 UTC (rev 3464)
@@ -467,20 +467,12 @@
     new_report($request);
 }
 
-sub search_reports {
-    my ($request) = @_;
-    my $report = LedgerSMB::DBObject::Report->new(base => $request);
-    $report->get_metadata;
-    my $template = LedgerSMB::Template->new(
-        user =>$request->{_user}, 
-        locale => $request->{_locale},
-        path => 'UI/asset',
-        template => 'report_criteria',
-        format => 'HTML'
-    );
-    $template->render($report);
-}
+=item report_get
 
+Retrieves the report identified by the id input and displays it.
+
+=cut
+
 sub report_get {
     my ($request) = @_;
     my $report = LedgerSMB::DBObject::Asset_Report->new(base => $request);
@@ -488,6 +480,17 @@
     display_report($report);
 }
 
+=item display_report
+
+Not directly called.  This routine displays a report that is set up.
+
+Assumes that all standard properties of LedgerSMB::DBObject::Asset_Report are 
+set, and also requires $request->{assets} is an array ref to the report line
+items.  Each has the standard properties of the LedgerSMB::DBObject::Asset plus
+dm (disposal method id) and amount (amount to depreciate).
+
+=cut
+
 sub display_report {
     my ($request) = @_;
     my $report = LedgerSMB::DBObject::Asset_Report->new({base => $request});
@@ -587,6 +590,14 @@
     });
 }
 
+=item search_reports
+
+Displays search report filter.  No inputs required,  Any inputs required by
+report_results can be used here to set defaults.  See the required inputs for
+LedgerSMB::DBObject::Asset_Report->search() for a list of such inputs.
+
+=cut
+
 sub search_reports {
     my ($request) = @_;
     $request->{title} = $request->{_locale}->text('Search reports');
@@ -602,6 +613,14 @@
     $template->render($ar);
 }
 
+=item report_results
+
+Executes the search for asset reports and displays the results.  See the 
+required inputs for LedgerSMB::DBObject::Asset_Report->search() for a list of 
+inputs.
+
+=cut
+
 sub report_results {
     my ($request) = @_;
     my $locale = $request->{_locale};
@@ -691,6 +710,13 @@
    });
 }
 
+=item report_details
+
+Displays the details of an existing report.  Requires that the id request arg is
+set which represents the id of the report.
+
+=cut
+
 sub report_details {
     my ($request) = @_;
     my $locale = $request->{_locale};
@@ -755,6 +781,13 @@
     });
 }
 
+=item partial_disposal_details 
+
+Displays the results of a partial disposal report.  The id must be set to the 
+id of the report desired.
+
+=cut
+
 sub partial_disposal_details {
     my ($request) = @_;
     my $locale = $request->{_locale};
@@ -819,6 +852,14 @@
     });
 }
 
+=item disposal_details
+
+Displays the details of a disposal report.
+
+id must be set to the id of the report to be displayed.
+
+=cut
+
 sub disposal_details {
     my ($request) = @_;
     my $locale = $request->{_locale};
@@ -878,10 +919,28 @@
     });
 }
 
+=sub disposal_details_approve
+
+Pass through function for form-dynatable's action munging.  An lias for 
+report_details_approve.
+
+=cut
+
 sub disposal_details_approve {
     report_details_approve(@_);
 }
 
+=iten report_details_approve
+
+Approves disposal details.  id must be set,
+
+For disposal reports, gain_acct and loss_acct must be set to appropriate 
+account id's.
+
+For depreciation reports, expense_acct must be set to an appropriate accont id.
+
+=cut
+
 sub report_details_approve {
     my ($request) = @_;
     my $report = LedgerSMB::DBObject::Asset_Report->new(base => $request);
@@ -889,6 +948,20 @@
     search_reports($request);
 }
 
+=item report_results_approve
+
+Loops through the input and approves all selected reports.
+
+For disposal reports, gain_acct and loss_acct must be set to appropriate 
+account id's.
+
+For depreciation reports, expense_acct must be set to an appropriate accont id.
+
+For each row, there is  report_$id field which if set to a true value, indicates
+a report to be approved.
+
+=cut
+
 sub report_results_approve {
     my ($request) = @_;
     for my $l (0 .. $request->{rowcount}){
@@ -902,6 +975,8 @@
 
 }
 
+# I don't believe this is used,  Not documenting for now. --CT
+
 sub begin_nbv {
     my ($request) = @_;
     my $template = LedgerSMB::Template->new(
@@ -914,6 +989,15 @@
     $template->render($request);
 }
 
+=item display_nbv
+
+Displays the net book value report, namely the current net value of all active
+active assets.
+
+No inputs required or used.
+
+=cut
+
 sub display_nbv {
     my ($request) = @_;
     my $locale = $request->{_locale};
@@ -959,6 +1043,14 @@
     });
 }
 
+=item begin_import 
+
+Displays the initial screen for asset import routines.
+
+No inputs required.
+
+=cut
+
 sub begin_import {
     my ($request) = @_;
     my $template = LedgerSMB::Template->new(
@@ -971,6 +1063,18 @@
     $template->render($request);
 }
 
+=item run_import
+
+Runs the actual import based on a CSV file.  This is tested primarily against
+Excel for the Mac which has known CSV generation problems, and Gnumeric which 
+produces very good CSV.  It should work on most CSV files if the format is 
+consistent.
+
+See the Customization Notes section below for more info on how to set up 
+CSV formats.
+
+=cut
+
 sub run_import {
 
     my ($request) = @_;
@@ -1060,8 +1164,14 @@
 
 =head1 CUSTOMIZATION NOTES
 
-The handling of CSV imports of fixed assets is handled by 
+The handling of CSV imports of fixed assets is handled by @file_columns.  This
+can be set in a custom/ file.
 
+=head1 Copyright (C) 2010, The LedgerSMB core team.
 
+This file is licensed under the Gnu General Public License version 2, or at your
+option any later version.  A copy of the license should have been included with
+your software.
 
-1;
+=cut
+;

Modified: trunk/sql/coa/id/chart/General.sql
===================================================================
--- trunk/sql/coa/id/chart/General.sql	2011-07-08 01:44:54 UTC (rev 3463)
+++ trunk/sql/coa/id/chart/General.sql	2011-07-08 10:51:20 UTC (rev 3464)
@@ -80,9 +80,11 @@
 
  INSERT INTO defaults (setting_key, value) VALUES ('fxloss_accno_id', (select id from chart where accno = '5810'));
 
- INSERT INTO defaults (setting_key, value) VALUES ('curr', 'IDR:USD:CAD:EUR');
+ UPDATE defaults SET value  = 'IDR:USD:CAD:EUR'
+  where setting_key = 'curr';
 
- INSERT INTO defaults (setting_key, value) VALUES ('weightunit', 'kg');
+ UPDATE defaults SET value = 'kg'
+  WHERE setting_key = 'weightunit';
 --
 commit;
 UPDATE account

Modified: trunk/sql/modules/Account.sql
===================================================================
--- trunk/sql/modules/Account.sql	2011-07-08 01:44:54 UTC (rev 3463)
+++ trunk/sql/modules/Account.sql	2011-07-08 10:51:20 UTC (rev 3464)
@@ -185,6 +185,7 @@
 ELSE
  account_save(new.id, new.accno, new.description, new.category,
   new.gifi_accno, NULL,
+  -- should these be rewritten as coalesces? --CT
   CASE WHEN new.contra IS NULL THEN FALSE ELSE new.contra END,
   CASE WHEN new.tax IS NULL THEN FALSE ELSE new.tax END,
   string_to_array(new.link, ':'))
@@ -230,6 +231,14 @@
 COMMENT ON FUNCTION get_link_descriptions() IS
 $$ Gets a set of all valid account_link descriptions.$$;
 
+CREATE OR REPLACE FUNCTION account_heading__list()
+RETURNS SETOF account_heading AS
+$$ SELECT * FROM account_heading order by accno; $$ language sql;
+
+COMMENT ON FUNCTION account_heading__list() IS
+$$ Returns a list of all account headings, currently ordered by account number.
+$$;
+
 CREATE OR REPLACE FUNCTION account__save_tax
 (in_chart_id int, in_validto date, in_rate numeric, in_taxnumber text, 
 in_pass int, in_taxmodule_id int, in_old_validto date)


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