[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2918] addons/1.3/assets/trunk
- Subject: SF.net SVN: ledger-smb:[2918] addons/1.3/assets/trunk
- From: ..hidden..
- Date: Sat, 27 Feb 2010 21:49:30 +0000
Revision: 2918
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2918&view=rev
Author: einhverfr
Date: 2010-02-27 21:49:30 +0000 (Sat, 27 Feb 2010)
Log Message:
-----------
Expense account moved to asset screen
Modified Paths:
--------------
addons/1.3/assets/trunk/UI/asset/begin_approval.html
addons/1.3/assets/trunk/UI/asset/edit_asset.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_approval.html
===================================================================
--- addons/1.3/assets/trunk/UI/asset/begin_approval.html 2010-02-27 20:39:21 UTC (rev 2917)
+++ addons/1.3/assets/trunk/UI/asset/begin_approval.html 2010-02-27 21:49:30 UTC (rev 2918)
@@ -33,17 +33,7 @@
</div>
<div class="inputrow" id="accountrow">
<?lsmb IF depreciation ?>
-<div class="inputgroup" id="expenserow">
-<?lsmb PROCESS select element_data = {
- name = "expense_acct"
- class = "account"
- options = exp_accounts
- text_attr = 'text'
- value_attr = 'id'
- default_values = [expense_acct]
- label = text('Expense Account') #'
-} ?>
-</div>
+<!-- moved expense acct drop down to asset screen -->
<?lsmb ELSE ?>
<div class="inputgroup" id="gaingroup"
<?lsmb PROCESS select element_data = {
Modified: addons/1.3/assets/trunk/UI/asset/edit_asset.html
===================================================================
--- addons/1.3/assets/trunk/UI/asset/edit_asset.html 2010-02-27 20:39:21 UTC (rev 2917)
+++ addons/1.3/assets/trunk/UI/asset/edit_asset.html 2010-02-27 21:49:30 UTC (rev 2918)
@@ -167,6 +167,18 @@
} ?>
</span>
</div>
+<div class="inputrow" id="exprow"
+<span class="inputgroup" id="expensegroup">
+<?lsmb PROCESS select element_data = {
+ name = "exp_account_id"
+ class = "account"
+ options = exp_accounts
+ text_attr = 'text'
+ value_attr = 'id'
+ default_values = [exp_account_id]
+ label = text('Expense Account') #'
+} ?>
+</span></div>
<div class="inputrow" id="invoicerow">
<span class="inputgroup" id="vendorgroup">
<?lsmb PROCESS input element_data = {
Modified: addons/1.3/assets/trunk/scripts/asset.pl
===================================================================
--- addons/1.3/assets/trunk/scripts/asset.pl 2010-02-27 20:39:21 UTC (rev 2917)
+++ addons/1.3/assets/trunk/scripts/asset.pl 2010-02-27 21:49:30 UTC (rev 2918)
@@ -442,7 +442,7 @@
my @results = $ar->search;
my $cols = [];
@$cols = qw(select id report_date type asset_class entered_at
- approved_at);
+ approved_at total);
my $header = {
id => $locale->text('ID'),
report_date => $locale->text('Date'),
@@ -450,6 +450,7 @@
asset_class => $locale->text('Asset Class'),
entered_at => $locale->text('Entered at'),
approved_at => $locale->text('Approved at'),
+ total => $locale->text('Total'),
};
my $rows = [];
my $hiddens = {};
@@ -472,6 +473,8 @@
report_date => $r->{report_date},
entered_at => $r->{entered_at},
approved_at => $r->{approved_at},
+ total => $ar->format_amount({amount => $r->{total},
+ money => 1}),
};
for my $ac (@{$ar->{asset_classes}}){
if ($ac->{id} = $r->{asset_class}){
Modified: addons/1.3/assets/trunk/sql/modules/Assets.sql
===================================================================
--- addons/1.3/assets/trunk/sql/modules/Assets.sql 2010-02-27 20:39:21 UTC (rev 2917)
+++ addons/1.3/assets/trunk/sql/modules/Assets.sql 2010-02-27 21:49:30 UTC (rev 2918)
@@ -353,7 +353,7 @@
in_usable_life numeric, in_salvage_value numeric,
in_start_depreciation date, in_warehouse_id int,
in_department_id int, in_invoice_id int,
-in_asset_account_id int, in_dep_account_id int)
+in_asset_account_id int, in_dep_account_id int, in_exp_account_id int)
returns asset_item AS
$$
DECLARE ret_val asset_item;
@@ -370,6 +370,7 @@
invoice_id = in_invoice_id,
salvage_value = in_salvage_value,
asset_account_id = in_asset_account_id,
+ exp_account_id = in_exp_account_id,
start_depreciation =
coalesce(in_start_depreciation, in_purchase_date),
dep_account_id = in_dep_account_id
@@ -382,12 +383,13 @@
INSERT INTO asset_item (asset_class_id, description, tag, purchase_date,
purchase_value, usable_life, salvage_value, department_id,
location_id, invoice_id, asset_account_id, dep_account_id,
- start_depreciation)
+ start_depreciation, exp_account_id)
VALUES (in_asset_class, in_description, in_tag, in_purchase_date,
in_purchase_value, in_usable_life, in_salvage_value,
in_department_id, in_warehouse_id, in_invoice_id,
in_asset_account_id, in_dep_account_id,
- coalesce(in_start_depreciation, in_purchase_date));
+ coalesce(in_start_depreciation, in_purchase_date)
+ in_exp_account_id);
SELECT * INTO ret_val FROM asset_item
WHERE id = currval('asset_item_id_seq');
@@ -584,20 +586,42 @@
ai.description, ai.purchase_date;
$$ language sql;
+CREATE TYPE asset_report_result AS (
+ id int,
+ report_date date,
+ gl_id bigint,
+ asset_class bigint,
+ report_class int,
+ entered_by bigint,
+ approved_by bigint,
+ entered_at timestamp,
+ approved_at timestamp,
+ depreciated_qty numeric,
+ dont_approve bool,
+ submitted bool,
+ total numeric
+);
+
CREATE OR REPLACE FUNCTION asset_report__search
(in_start_date date, in_end_date date, in_asset_class int, in_approved bool,
in_entered_by int)
-returns setof asset_report AS $$
+returns setof asset_report_result AS $$
-SELECT *
- FROM asset_report
- where ($1 is null or $1 <= report_date)
- and ($2 is null or $2 >= report_date)
- and ($3 is null or $3 = asset_class)
- and ($4 is null
- or ($4 is true and approved_by is not null)
- or ($4 is false and approved_by is null))
- and ($5 is null or $5 = entered_by);
+ SELECT r.id, r.report_date, r.gl_id, r.asset_class, r.report_class,
+ r.entered_by, r.approved_by, r.entered_at, r.approved_at,
+ r.depreciated_qty, r.dont_approve, r.submitted, sum(l.amount)
+ FROM asset_report r
+ JOIN asset_report_line l ON (l.report_id = r.id)
+ where ($1 is null or $1 <= report_date)
+ and ($2 is null or $2 >= report_date)
+ and ($3 is null or $3 = asset_class)
+ and ($4 is null
+ or ($4 is true and approved_by is not null)
+ or ($4 is false and approved_by is null))
+ and ($5 is null or $5 = entered_by)
+GROUP BY r.id, r.report_date, r.gl_id, r.asset_class, r.report_class,
+ r.entered_by, r.approved_by, r.entered_at, r.approved_at,
+ r.depreciated_qty, r.dont_approve, r.submitted;
$$ language sql;
CREATE OR REPLACE FUNCTION asset_report__generate
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.