[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2974] addons/1.3/assets/trunk
- Subject: SF.net SVN: ledger-smb:[2974] addons/1.3/assets/trunk
- From: ..hidden..
- Date: Thu, 18 Mar 2010 19:46:54 +0000
Revision: 2974
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2974&view=rev
Author: einhverfr
Date: 2010-03-18 19:46:54 +0000 (Thu, 18 Mar 2010)
Log Message:
-----------
Basic partial disposal working. Two more test cases to pass
Modified Paths:
--------------
addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset_Report.pm
addons/1.3/assets/trunk/UI/asset/begin_report.html
addons/1.3/assets/trunk/scripts/asset.pl
addons/1.3/assets/trunk/sql/modules/Assets-tables.sql
addons/1.3/assets/trunk/sql/modules/Assets.sql
Modified: addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset_Report.pm
===================================================================
--- addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset_Report.pm 2010-03-18 17:50:15 UTC (rev 2973)
+++ addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset_Report.pm 2010-03-18 19:46:54 UTC (rev 2974)
@@ -89,6 +89,9 @@
@{$self->{gain_accounts}} = $self->exec_method(
funcname => 'asset_report__get_gain_accts'
);
+ @{$self->{disp_methods}} = $self->exec_method(
+ funcname => 'asset_report__get_disposal_methods'
+ );
@{$self->{loss_accounts}} = $self->exec_method(
funcname => 'asset_report__get_loss_accts'
);
Modified: addons/1.3/assets/trunk/UI/asset/begin_report.html
===================================================================
--- addons/1.3/assets/trunk/UI/asset/begin_report.html 2010-03-18 17:50:15 UTC (rev 2973)
+++ addons/1.3/assets/trunk/UI/asset/begin_report.html 2010-03-18 19:46:54 UTC (rev 2974)
@@ -2,9 +2,9 @@
include_stylesheet = ["UI/asset/asset.css"] -?>
<?lsmb PROCESS "elements.html" -?>
<body>
+<form action="asset.pl" method="post">
<div class="listtop"><?lsmb text('New Asset Report') ?></div>
<div class="inputrow" id="classrow"><div class="inputgroup" id="classgrp">
-<form action="asset.pl" method="post">
<?lsmb PROCESS select element_data = {
name = "asset_class"
default_values = [asset_class]
@@ -22,6 +22,27 @@
label = text("Date")
} ?>
</div></div>
+<div class="inputrow" id="disposaltyperow">
+<div class="inputgroup">
+<?lsmb PROCESS input element_data ={
+ name = 'report_class'
+ class = 'type'
+ label = text('Full')
+ value = 2
+ checked = 'CHECKED'
+ type = 'radio'
+} ?>
+
+</div>
+<div class="inputgroup">
+<?lsmb PROCESS input element_data ={
+ name = 'report_class'
+ class = 'type'
+ label = text('Partial')
+ value = 4
+ type = 'radio'
+} ?>
+</div></div>
<?lsmb PROCESS input element_data = {
name = "depreciation"
type = "hidden"
Modified: addons/1.3/assets/trunk/scripts/asset.pl
===================================================================
--- addons/1.3/assets/trunk/scripts/asset.pl 2010-03-18 17:50:15 UTC (rev 2973)
+++ addons/1.3/assets/trunk/scripts/asset.pl 2010-03-18 19:46:54 UTC (rev 2974)
@@ -347,6 +347,8 @@
sub display_report {
my ($request) = @_;
+ my $report = LedgerSMB::DBObject::Asset_Report->new({base => $request});
+ $report->get_metadata;
my $locale = $request->{_locale};
my $cols = [];
@$cols = qw(select tag description purchase_date purchase_value);
@@ -356,6 +358,8 @@
purchase_date => $locale->text('Purchase Date') ,
purchase_value => $locale->text('Purchase Value') ,
amount => $locale->text('Amount'),
+ dm => $locale->text('Disposal Method'),
+ percent => $locale->text('Percent'),
};
my $rows = [];
my $hiddens = {};
@@ -374,6 +378,13 @@
purchase_value => $request->format_amount(
amount => $asset->{purchase_value}
),
+ dm => {select => { name => "dm_$asset->{id}",
+ options => $report->{disp_methods},
+ text_attr => 'label',
+ value_attr => 'id',
+ },
+ },
+
amount => {input => { name => "amount_$asset->{id}",
type => 'text',
class => 'amount',
@@ -381,6 +392,13 @@
size => 20,
},
},
+ percent => {input => { name => "percent_$asset->{id}",
+ type => 'text',
+ class => 'percent',
+ value => $request->{"percent_$asset->{id}"},
+ size => 6,
+ },
+ },
};
$hiddens->{"id_$count"} = $asset->{id};
++$count;
@@ -398,8 +416,12 @@
$request->{title} = $locale->text('Asset Depreciation Report');
} else {
$request->{title} = $locale->text('Asset Disposal Report');
- push @$cols, 'amount';
+ push @$cols, 'dm', 'amount';
}
+ if ($request->{report_class} == 4){
+ $request->{title} = $locale->text('Asset Partial Disposal Report');
+ push @$cols, 'percent';
+ }
for my $hide (qw(exp_account_id gain_account_id loss_account_id report_date
asset_class rowcount depreciation))
{
Modified: addons/1.3/assets/trunk/sql/modules/Assets-tables.sql
===================================================================
--- addons/1.3/assets/trunk/sql/modules/Assets-tables.sql 2010-03-18 17:50:15 UTC (rev 2973)
+++ addons/1.3/assets/trunk/sql/modules/Assets-tables.sql 2010-03-18 19:46:54 UTC (rev 2974)
@@ -46,9 +46,8 @@
CREATE TABLE asset_disposal_method (
label text primary key,
id serial unique,
- multiple int,
- short_label char(1),
- check multiple_check (multiple in (1, 0, -1))
+ multiple int check (multiple in (1, 0, -1)),
+ short_label char(1)
);
INSERT INTO disposal_method (label, multiple, short_label)
Modified: addons/1.3/assets/trunk/sql/modules/Assets.sql
===================================================================
--- addons/1.3/assets/trunk/sql/modules/Assets.sql 2010-03-18 17:50:15 UTC (rev 2973)
+++ addons/1.3/assets/trunk/sql/modules/Assets.sql 2010-03-18 19:46:54 UTC (rev 2974)
@@ -905,6 +905,12 @@
end;
$$ language plpgsql;
+CREATE OR REPLACE FUNCTION asset_report__get_disposal_methods()
+RETURNS SETOF asset_disposal_method as
+$$
+SELECT * FROM asset_disposal_method order by label;
+$$ language sql;
+
CREATE OR REPLACE FUNCTION asset_disposal__approve
(in_report_id int, in_gain_acct int, in_loss_acct int, in_asset_acct int)
returns asset_report
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.