From 1036b3068092e00d59c21c4538fc841a1a24b1a0 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Fri, 8 Sep 2006 06:21:56 +0000 Subject: Added inventory activity report git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@43 4979c152-3d1c-0410-bac9-87ea11338e46 --- bin/mozilla/rp.pl | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) (limited to 'bin') diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index c4e6eec9..ff3beec2 100755 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -77,6 +77,7 @@ sub report { receipts => { title => 'Receipts', vc => 'customer' }, payments => { title => 'Payments' }, projects => { title => 'Project Transactions' }, + inv_activity => { title => 'Inventory Activity'}, ); $form->{title} = $locale->text($report{$form->{report}}->{title}); @@ -209,6 +210,36 @@ sub report { |; } + if ($form->{report} eq "inv_activity"){ + $gifi = ''; + print qq| + + + |.$locale->text('From').qq| + {fromdate}> + |.$locale->text('To').qq| + + + + |.$locale->text('Period').qq| + + + + |.$locale->text('Current').qq| + |.$locale->text('Month').qq| + |.$locale->text('Quarter').qq| + |.$locale->text('Year').qq| + + + + + + + + + + |; + } if ($form->{report} eq "income_statement") { print qq| $project @@ -734,6 +765,152 @@ $gifi sub continue { &{$form->{nextsub}} }; +sub generate_inv_activity { + $form->header; + + RP->inventory_activity(\%myconfig, \%$form); + + $title = $form->escape($form->{title}); + +# if ($form->{department}) { +# ($department) = split /--/, $form->{department}; +# $options = $locale->text('Department')." : $department
"; +# $department = $form->escape($form->{department}); +# } +## if ($form->{projectnumber}) { +# ($projectnumber) = split /--/, $form->{projectnumber}; +# $options .= $locale->text('Project Number')." : $projectnumber
"; +# $projectnumber = $form->escape($form->{projectnumber}); +# } + + # if there are any dates + if ($form->{fromdate} || $form->{todate}) { + if ($form->{fromdate}) { + $fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1); + } + if ($form->{todate}) { + $todate = $locale->date(\%myconfig, $form->{todate}, 1); + } + + $form->{period} = "$fromdate - $todate"; + } else { + $form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1); + + } + $options .= $form->{period}; + + @column_index = qw(partnumber description sold revenue received expense); + + $href = qq|rp.pl?path=$form->{path}&action=continue&accounttype=$form->{accounttype}&login=$form->{login}&sessionid=$form->{sessionid}&fromdate=$form->{fromdate}&todate=$form->{todate}&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}|; + + $column_header{partnumber} = qq| + |; + $column_header{description} = qq| + |; + $column_header{sold} = qq| + |; + $column_header{revenue} = qq| + |; + $column_header{received} = qq| + |; + $column_header{expense} = qq| + |; + + + + print qq| + + +
|.$locale->text("Part Number").qq||.$locale->text('Description').qq|
| + .$locale->text('Part Number').qq|| + .$locale->text('Description').qq|| + .$locale->text('Sold').qq|| + .$locale->text('Revenue').qq|| + .$locale->text('Received').qq|| + .$locale->text('Expense').qq|
+ + + + + + + + + + + + + +
$form->{title}
$options
+ + |; + + map { print "$column_header{$_}\n" } @column_index; + + print qq| + +|; + + + + if ($form->{sort_col} eq 'qty' || $form->{sort_col} eq 'revenue'){ + $form->{sort_type} = 'numeric'; + } + $i = 0; + $cols = "l_transdate=Y&l_name=Y&l_invnumber=Y&summary=1"; + $dates= "transdatefrom=$form->{fromdate}&transdateto=$form->{todate}&year=$form->{fromyear}&month=$form->{frommonth}&interval=$form->{interval}"; + $base="path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"; + + $form->{callback} = "rp.pl?action=continue&$base"; + $form->{callback} = $form->escape($form->{callback}); + $callback = "callback=$form->{callback}"; + # sort the whole thing by account numbers and display + foreach $ref (@{ $form->{TB} }) { + $description = $form->escape($ref->{description}); + $i = $i % 2; + + $pnumhref="ic.pl?action=edit&id=$ref->{id}&$base&callback=$form->{callback}"; + $soldhref="ar.pl?action=transactions&partsid=$ref->{id}&$base&$cols&$dates&$callback"; + $rechref="ap.pl?action=transactions&partsid=$ref->{id}&$base&$cols&$dates&callback=$form->{callback}"; + + $ml = ($ref->{category} =~ /(A|E)/) ? -1 : 1; + + $debit = $form->format_amount(\%myconfig, $ref->{debit}, 2, " "); + $credit = $form->format_amount(\%myconfig, $ref->{credit}, 2, " "); + $begbalance = $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2, " "); + $endbalance = $form->format_amount(\%myconfig, ($ref->{balance} + $ref->{amount}) * $ml, 2, " "); + + $ref->{partnumber} = qq|$ref->{partnumber}|; + $ref->{sold} = qq|$ref->{sold}|; + $ref->{received} = qq|$ref->{received}|; + map { $column_data{$_} = "" } + @column_index; + + + + print qq| + + |; + map { print "\n" } @column_index; + + print qq| + +|; + ++$i; + } + + + print qq| + +
 
$ref->{$_}
+

+ + + +|; + +} + sub generate_income_statement { -- cgit v1.2.3