[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2885] addons/1.3/assets/trunk
- Subject: SF.net SVN: ledger-smb:[2885] addons/1.3/assets/trunk
- From: ..hidden..
- Date: Wed, 10 Feb 2010 22:33:58 +0000
Revision: 2885
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2885&view=rev
Author: einhverfr
Date: 2010-02-10 22:33:58 +0000 (Wed, 10 Feb 2010)
Log Message:
-----------
Fixing workflow and template files
Modified Paths:
--------------
addons/1.3/assets/trunk/UI/asset/begin_depreciation_all.html
addons/1.3/assets/trunk/scripts/asset.pl
addons/1.3/assets/trunk/sql/modules/Assets.sql
Modified: addons/1.3/assets/trunk/UI/asset/begin_depreciation_all.html
===================================================================
--- addons/1.3/assets/trunk/UI/asset/begin_depreciation_all.html 2010-02-10 05:26:39 UTC (rev 2884)
+++ addons/1.3/assets/trunk/UI/asset/begin_depreciation_all.html 2010-02-10 22:33:58 UTC (rev 2885)
@@ -3,7 +3,6 @@
<?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 = {
Modified: addons/1.3/assets/trunk/scripts/asset.pl
===================================================================
--- addons/1.3/assets/trunk/scripts/asset.pl 2010-02-10 05:26:39 UTC (rev 2884)
+++ addons/1.3/assets/trunk/scripts/asset.pl 2010-02-10 22:33:58 UTC (rev 2885)
@@ -29,6 +29,7 @@
}
$dep->save;
}
+ search_reports($request);
}
sub asset_category_screen {
Modified: addons/1.3/assets/trunk/sql/modules/Assets.sql
===================================================================
--- addons/1.3/assets/trunk/sql/modules/Assets.sql 2010-02-10 05:26:39 UTC (rev 2884)
+++ addons/1.3/assets/trunk/sql/modules/Assets.sql 2010-02-10 22:33:58 UTC (rev 2885)
@@ -38,7 +38,21 @@
SELECT ai.id, $3,
asset_dep__straight_line_base(
ai.usable_life,
- get_fractional_year(
+ asset_dep_get_usable_life_yr(
+ (case when max(rep.report_date) is null
+ THEN ai.usable_life::numeric
+ ELSE ai.usable_life - extract (YEAR from
+ max(rep.report_date)::timestamp
+ - coalesce(
+ ai.start_depreciation::timestamp,
+ ai.purchase_date::timestamp))
+ - extract (DOY from
+ max(rep.report_date)::timestamp
+ - coalesce(
+ ai.start_depreciation::timestamp,
+ ai.purchase_date::timestamp))::numeric / 365
+ END)::numeric,
+
coalesce(
max(rep.report_date),
ai.start_depreciation,
@@ -55,11 +69,49 @@
GROUP BY ai.id, ai.start_depreciation, ai.purchase_date, ai.purchase_value,
ai.salvage_value, ai.department_id, ai.location_id, ai.usable_life;
- UPDATE asset_report SET depreciated = true WHERE id = in_report_id;
+ UPDATE asset_report SET report_class = 1 WHERE id = $3;
select true;
$$ language sql;
+CREATE OR REPLACE FUNCTION asset_dep_straight_line_month
+(in_asset_ids int[], in_report_date date, in_report_id int)
+RETURNS bool AS
+$$
+ INSERT INTO asset_report_line (asset_id, report_id, amount, department_id,
+ warehouse_id)
+ SELECT ai.id, $3,
+ asset_dep__straight_line_base(
+ ai.usable_life,
+ asset_dep__used_months(
+ coalesce(
+ max(rep.report_date),
+ ai.start_depreciation,
+ ai.purchase_date
+ ),
+ $2,
+ ai.usable_life -
+ coalesce(extract (month from
+ max(rep.report_date::timestamp) -
+ coalesce(ai.start_depreciation::timestamp,
+ ai.purchase_date::timestamp))::numeric,
+ 0::numeric)
+ ),
+ ai.purchase_value - ai.salvage_value
+ -coalesce(sum(repline.amount), 0)),
+ ai.department_id, ai.location_id
+ FROM asset_item ai
+ LEFT JOIN asset_report_line repline ON (repline.asset_id = ai.id)
+ LEFT JOIN asset_report rep ON (repline.report_id = rep.id)
+ WHERE ai.id = ANY ($1)
+ GROUP BY ai.id, ai.start_depreciation, ai.purchase_date, ai.purchase_value,
+ ai.salvage_value, ai.department_id, ai.location_id, ai.usable_life;
+
+ UPDATE asset_report SET report_class = 1 WHERE id = $3;
+
+ select true;
+$$ language sql;
+
CREATE OR REPLACE FUNCTION asset_report__generate_gl(in_report_id int, in_accum_account_id int)
RETURNS INT AS
$$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.