summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2010-06-01 17:40:33 +0000
committermark <mark>2010-06-01 17:40:33 +0000
commit7581a6dd497780979eeebeb4d70b76477c23441e (patch)
tree85c54d4fa2c371ff68eed092ee6d5ac758ab0e79
parentac92259461861b64bccb4134358da0edb9039883 (diff)
RT#8460: monthly opening balance
-rw-r--r--httemplate/search/h_inventory_item.html10
1 files changed, 9 insertions, 1 deletions
diff --git a/httemplate/search/h_inventory_item.html b/httemplate/search/h_inventory_item.html
index 2ac00651c..38e5b95e7 100644
--- a/httemplate/search/h_inventory_item.html
+++ b/httemplate/search/h_inventory_item.html
@@ -51,9 +51,17 @@ my @labels = (
'Closing Balance',
);
my @rows = ( map {[ (0) x $numdays ]} @labels);
+my $opening_balance = scalar(
+ qsearch('h_inventory_item',
+ { 'svcnum' => '',
+ ($classnum ? ('classnum' => $classnum) : () ) },
+ FS::h_inventory_item->sql_h_search($sdate) )
+ ) || 0;
foreach my $day (0..$numdays-1) {
- $rows[0][$day] = $rows[4][$day-1] if($day > 0);
+ $rows[0][$day] = ($day == 0) ?
+ $opening_balance :
+ $rows[4][$day-1];
my %history;
foreach my $action (qw(insert replace_new replace_old)) {