[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3868] addons/1.3/budgetting/trunk
- Subject: SF.net SVN: ledger-smb:[3868] addons/1.3/budgetting/trunk
- From: ..hidden..
- Date: Sat, 15 Oct 2011 13:12:23 +0000
Revision: 3868
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3868&view=rev
Author: einhverfr
Date: 2011-10-15 13:12:23 +0000 (Sat, 15 Oct 2011)
Log Message:
-----------
A few more UI and refactoring bits for budgets
Modified Paths:
--------------
addons/1.3/budgetting/trunk/UI/budgetting/budget_entry.html
addons/1.3/budgetting/trunk/scripts/budgets.pl
Modified: addons/1.3/budgetting/trunk/UI/budgetting/budget_entry.html
===================================================================
--- addons/1.3/budgetting/trunk/UI/budgetting/budget_entry.html 2011-10-15 13:02:42 UTC (rev 3867)
+++ addons/1.3/budgetting/trunk/UI/budgetting/budget_entry.html 2011-10-15 13:12:23 UTC (rev 3868)
@@ -3,19 +3,19 @@
"UI/ajax/scriptaculous/lib/prototype.js",
"UI/ajax/scriptaculous/src/scriptaculous.js?load=builder,effects,dragdrop,controls",
"UI/ajax/helpers.js"]
- stylesheet=form.stylesheet ?>
+ stylesheet=stylesheet ?>
<?lsmb PROCESS elements.html ?>
<body>
-<form method="post" action="<?lsmb form.script ?>">
+<form method="post" action="<?lsmb script ?>">
<div id="budget-header">
-<div class="listtop"><?lsmb form.title ?></div>
+<div class="listtop"><?lsmb title ?></div>
<div class="input_row" id = "reference_row">
<div class="input_group">
<?lsmb INCLUDE input element_data = {
name = "reference",
- value = form.reference,
+ value = reference,
type = "text",
size = "20",
class = 'reference',
@@ -23,21 +23,9 @@
} ?>
</div>
<div class="input_group">
- <?lsmb INCLUDE input element_data = {
- name = "transdate"
- value = form.transdate
- type = "text"
- size = "11"
- class = 'date'
- label = text('Date')
- } ?>
-</div></div>
-<div class="input_row" id = "description_row">
-<div class="input_group">
-
<?lsmb INCLUDE input element_data = {
name = "description",
- value = form.description,
+ value = description,
type = "text",
size = "50",
class = 'description'
@@ -45,13 +33,36 @@
}
?>
</div></div>
+<div class="input_row" id = "date_row">
+<div class="input_group">
+ <?lsmb INCLUDE input element_data = {
+ name = "start_date"
+ value = start_date
+ type = "text"
+ size = "11"
+ class = 'date'
+ label = text('Start Date') #'
+ } ?>
+</div>
+<div class="input_group">
+ <?lsmb INCLUDE input element_data = {
+ name = "end_date"
+ value = end_date
+ type = "text"
+ size = "11"
+ class = 'date'
+ label = text('End Date') #'
+ } ?>
+</div>
+
+</div></div>
<div class="input_row" id = "description_row">
<div class="input_group">
<?lsmb INCLUDE select element_data = {
text_attr = "description"
- value_attr = "departmentstyle"
- default_values = [form.department]
- options = form.all_department
+ value_attr = "id"
+ default_values = [department]
+ options = departments
name = "department"
label = text('Department')
} ?>
@@ -61,8 +72,8 @@
<?lsmb INCLUDE select element_data = {
text_attr = "description"
value_attr = "id"
- default_values = [form.projects]
- options = form.projects
+ default_values = [project]
+ options = projects
name = "project"
label = text('Project')
} ?>
@@ -73,7 +84,7 @@
<tr>
<th align="right"><?lsmb text('Notes') ?></th>
<td colspan="3">
- <?lsmb IF form.colrownotes ==1 ?>
+ <?lsmb IF colrownotes ==1 ?>
<?lsmb INCLUDE textarea element_data={
name = "notes"
rows = form.rowsnotes
@@ -101,16 +112,12 @@
<table width="100%">
<tr class="listheading">
<th class="listheading"><?lsmb text('Account') ?></th>
- <?lsmb IF form.transfer == 1 ?>
+ <?lsmb IF transfer == 1 ?>
<th class="listheading"><?lsmb text('FX') ?></th>
<?lsmb END ?>
<th class="listheading"><?lsmb text('Debit') ?></th>
<th class="listheading"><?lsmb text('Credit') ?></th>
- <th class="listheading"><?lsmb text('Source') ?></th>
- <th class="listheading"><?lsmb text('Memo') ?></th>
- <?lsmb IF form.projectset == 1 ?>
- <th class="listheading"><?lsmb text('Project') ?></th>
- <?lsmb END ?>
+ <th class="listheading"><?lsmb text('Description') ?></th>
</tr>
<?lsmb FOREACH displayrow IN display_rows ?>
<tr>
@@ -118,7 +125,7 @@
<td>
<?lsmb IF displayrow.accnoset == 0 ?>
<?lsmb PROCESS ajaxselect element_data = {
- name = "accno_$INDEX"
+ name = "account_id_$INDEX"
initial_value = ${"accno_$INDEX"}
text_attr = 'accno'
value_attr = 'id'
@@ -128,7 +135,7 @@
<?lsmb ELSE ?>
<?lsmb PROCESS label element_data = {
- text = displayrow.accno
+ text = displayrow.account_id
align = 'right'
id = "acc_$INDEX"
} ?>
@@ -145,7 +152,6 @@
type = "text"
size = 12
accesskey = displayrow.index
- id = "deb_$INDEX"
} ?>
</td>
@@ -156,62 +162,29 @@
name = "credit_$INDEX"
type = "text"
size = 12
- id = "cre_$INDEX"
} ?>
</td>
<td>
<?lsmb PROCESS input element_data = {
- value = displayrow.source
- name = "source_$INDEX"
+ value = displayrow.description
+ name = "description_$INDEX"
type = "text"
- size = 10
- id = "sou_$INDEX"
-
- } ?>
-
- </td>
-
- <td>
- <?lsmb PROCESS input element_data = {
- value = displayrow.memo
- name = "memo_$INDEX"
- type = "text"
size = 30
- id = "mem_$INDEX"
} ?>
</td>
</tr>
<?lsmb END ?>
- <tr class="listtotal">
- <th> </th>
- <?lsmb IF form.transfer == 1 ?>
- <th class="listheading"> </th>
- <?lsmb END ?>
- <th class="listtotal" align="right">
- <?lsmb form.totaldebit ?>
- </th>
-
- <th class="listtotal" align="right">
- <?lsmb form.totalcredit ?>
- </th>
- <th> </th>
- <th> </th>
- <?lsmb IF form.projectset == 1 ?>
- <th class="listheading"> </th>
- <?lsmb END ?>
- </tr>
-
</table>
<hr size="3">
<?lsmb FOREACH hidden IN hiddens.keys;
PROCESS input element_data={
- type => 'hidden',
- name => hidden,
- value => hiddens.item(hidden)
+ type = 'hidden',
+ name = hidden,
+ value = hiddens.item(hidden)
}; END ?>
<?lsmb FOREACH button IN buttons; PROCESS button element_data=button; END ?>
Modified: addons/1.3/budgetting/trunk/scripts/budgets.pl
===================================================================
--- addons/1.3/budgetting/trunk/scripts/budgets.pl 2011-10-15 13:02:42 UTC (rev 3867)
+++ addons/1.3/budgetting/trunk/scripts/budgets.pl 2011-10-15 13:12:23 UTC (rev 3868)
@@ -42,9 +42,6 @@
sub new_budget {
my ($request) = @_;
my $budget = LedgerSMB::DBObject::Budget->new({base => $request});
- for (1 .. 25) {
- push @{$budget->{display_rows}}, {accnoset => 0, index => $_};
- }
_render_screen($budget);
}
@@ -55,13 +52,17 @@
sub _render_screen {
my ($budget) = @_;
+ $additional_rows = 5;
+ $additional_rows +=20 unless $budget->{rowcount};
+ for (1 .. $additional_rows) {
+ push @{$budget->{display_rows}}, {accnoset => 0, index => $_};
+ }
$budget->error('Invalid object')
unless $budget->isa('LedgerSMB::DBObject::Budget');
@{$budget->{projects}} = $budget->list_projects;
unshift @{$budget->{projects}}, {};
@{$budget->{departments}} = $budget->list_departments;
unshift @{$budget->{departments}}, {};
- $budget->{display_rows} = [];
# The button logic is kinda complicated here. The basic idea is that there
# are three stages in the handling of the budget: Initial entry, review and
# approval, and review with the possibility of obsolescence.
@@ -124,7 +125,7 @@
template => 'budget_entry',
format => 'HTML'
);
-
+ $budget->{hiddens} = {rowcount => $budget->{rowcount}};
$template->render($budget);
}
@@ -134,6 +135,16 @@
=cut
sub update {
+ my ($request) = @_;
+ for (1 .. $request->{rowcount}){
+ push @{$request->{display_rows}},
+ { account_id => $request->{"account_id_$i"},
+ debit => $request->{"debit_$i"},
+ credit => $request->{"credit_$i"},
+ description => $request->{"description_$i"},
+ } if ($request->{"debits_$_"} or $request->{"credits_$_"});
+ }
+ $budget->{rowcount} = scalar @{$request->{display_rows}};
new_budget(@_);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.