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

SF.net SVN: ledger-smb:[2864] addons/1.3/assets/trunk



Revision: 2864
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2864&view=rev
Author:   einhverfr
Date:     2010-02-08 04:06:30 +0000 (Mon, 08 Feb 2010)

Log Message:
-----------
Minor changes to depreciation workflow

Modified Paths:
--------------
    addons/1.3/assets/trunk/scripts/asset.pl

Added Paths:
-----------
    addons/1.3/assets/trunk/UI/asset/begin_depreciation_all.html

Added: addons/1.3/assets/trunk/UI/asset/begin_depreciation_all.html
===================================================================
--- addons/1.3/assets/trunk/UI/asset/begin_depreciation_all.html	                        (rev 0)
+++ addons/1.3/assets/trunk/UI/asset/begin_depreciation_all.html	2010-02-08 04:06:30 UTC (rev 2864)
@@ -0,0 +1,34 @@
+<?lsmb INCLUDE "ui-header.html"
+       include_stylesheet = ["UI/asset/asset.css"] -?>
+<?lsmb PROCESS "elements.html" -?>
+<body>
+<div class="listtop"><?lsmb text('Depreciate All') ?></div>
+<div class="inputrow" id="classrow"><div class="inputgroup" id="classgrp">
+<form action="asset.pl" method="post">
+<div class="inputrow" id="daterow"><div class="inputgroup" id="dategroup">
+<?lsmb PROCESS input element_data = {
+     name = "report_date"
+     class = "date"
+     value = report_date
+     label = text("Date")
+} ?>
+</div></div>
+<?lsmb PROCESS input element_data = {
+     name = "depreciation"
+     type = "hidden"
+     value = 1
+} ?>
+<div class="inputrow" id="buttonrow">
+<div class="inputgroup" id="buttongroupnext">
+<label>&nbsp;</label>
+<?lsmb PROCESS button element_data = {
+     name = "action"
+     text = text("Continue")
+     value = "depreciate_all"
+     type = "submit"
+     class = "submit"
+} ?>
+</div></div>
+</form>
+</body>
+</html>

Modified: addons/1.3/assets/trunk/scripts/asset.pl
===================================================================
--- addons/1.3/assets/trunk/scripts/asset.pl	2010-02-08 04:05:12 UTC (rev 2863)
+++ addons/1.3/assets/trunk/scripts/asset.pl	2010-02-08 04:06:30 UTC (rev 2864)
@@ -4,7 +4,33 @@
 use LedgerSMB::DBObject::Asset;
 use LedgerSMB::DBObject::Asset_Report;
 
+sub begin_depreciation_all {
+    my ($request) = @_;
+    my $template = LedgerSMB::Template->new(
+        user =>$request->{_user}, 
+        locale => $request->{_locale},
+        path => 'UI/asset',
+        template => 'begin_depreciation_all',
+        format => 'HTML'
+    );
+    $template->render($request);
+}
 
+sub depreciate_all {
+    my ($request) = @_;
+    my $report = LedgerSMB::DBObject::Asset_Report->new(base => $request);
+    $report->get_metadata;
+    for my $ac(@{$report->{asset_classes}}){
+        my $dep = LedgerSMB::DBObject::Asset_Report->new(base => $request);
+        $dep->{asset_class} = $ac->{id};
+        $dep->generate;
+        for my $asset (@{$dep->{assets}}){
+            push @{$report->{asset_ids}}, $asset->{id};
+        }
+        $dep->save;
+    }
+}
+
 sub asset_category_screen {
     my ($request) = @_;
     if ($request->{id}){


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