[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[5507] trunk
- Subject: SF.net SVN: ledger-smb:[5507] trunk
- From: ..hidden..
- Date: Mon, 07 Jan 2013 12:39:06 +0000
Revision: 5507
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5507&view=rev
Author: einhverfr
Date: 2013-01-07 12:39:05 +0000 (Mon, 07 Jan 2013)
Log Message:
-----------
Moving inventory activity report to new framework
Modified Paths:
--------------
trunk/LedgerSMB/Report/Inventory/Activity.pm
trunk/LedgerSMB/Scripts/goods.pm
trunk/bin/rp.pl
trunk/css/ledgersmb.css
trunk/sql/Pg-database.sql
trunk/sql/modules/Goods.sql
trunk/sql/modules/menu_rebuild.sql
Added Paths:
-----------
trunk/UI/Reports/filters/inventory_activity.html
Removed Paths:
-------------
trunk/UI/rp-search-generate_inv_activity.html
Modified: trunk/LedgerSMB/Report/Inventory/Activity.pm
===================================================================
--- trunk/LedgerSMB/Report/Inventory/Activity.pm 2013-01-07 11:02:09 UTC (rev 5506)
+++ trunk/LedgerSMB/Report/Inventory/Activity.pm 2013-01-07 12:39:05 UTC (rev 5507)
@@ -63,27 +63,31 @@
sub columns {
my $self = shift;
+ my $from_date = $self->from_date;
+ $from_date = $from_date->to_db if $from_date;
+ my $to_date = $self->to_date;
+ $to_date = $to_date->to_db if $to_date;
return [
{col_id => 'partnumber',
type => 'text',
- name => LedgerSMB::Report::text('Partnumber'), }
+ name => LedgerSMB::Report::text('Partnumber'), },
{col_id => 'description',
type => 'text',
- name => LedgerSMB::Report::text('Description'), }
+ name => LedgerSMB::Report::text('Description'), },
{col_id => 'sold',
type => 'href',
name => LedgerSMB::Report::text('Sold'),
- href_base => "invoice.pl&date_from=$self->date_from&date_to=$self->date_to"
+ href_base => "invoice.pl&from_date=$from_date&to_date=$to_date"
. "&open=1&closed=1&"
. 'col_invnumber=1&col_transdate=1&col_entity_name=1&'
. 'col_netamount=1&entity_class=2&parts_id=',
- }
+ },
{col_id => 'receivable',
type => 'text',
- name => LedgerSMB::Report::text('Receivable'), }
+ name => LedgerSMB::Report::text('Receivable'), },
{col_id => 'purchased',
type => 'href',
@@ -92,7 +96,7 @@
. "&open=1&closed=1&"
. 'col_invnumber=1&col_transdate=1&col_entity_name=1&'
. 'col_netamount=1&entity_class=1&parts_id=',
- }
+ },
{col_id => 'payable',
type => 'text',
@@ -145,6 +149,7 @@
for my $r (@rows) {
$r->{row_id} = $r->{parts_id};
}
+ $self->rows(..hidden..);
}
=head1 COPYRIGHT
Modified: trunk/LedgerSMB/Scripts/goods.pm
===================================================================
--- trunk/LedgerSMB/Scripts/goods.pm 2013-01-07 11:02:09 UTC (rev 5506)
+++ trunk/LedgerSMB/Scripts/goods.pm 2013-01-07 12:39:05 UTC (rev 5507)
@@ -9,6 +9,7 @@
use LedgerSMB::Scripts::reports;
use LedgerSMB::Report::Inventory::Partsgroups;
use LedgerSMB::Report::Inventory::Pricegroups;
+use LedgerSMB::Report::Inventory::Activity;
=head1 SYNOPSIS
@@ -68,6 +69,18 @@
$report->render($request);
}
+=item inventory_activity
+
+This routine runs the inventory activity report/
+
+=cut
+
+sub inventory_activity {
+ my ($request) = @_;
+ my $report = LedgerSMB::Report::Inventory::Activity->new(%$request);
+ $report->render($request);
+}
+
=back
=head1 COPYRIGHT
Added: trunk/UI/Reports/filters/inventory_activity.html
===================================================================
--- trunk/UI/Reports/filters/inventory_activity.html (rev 0)
+++ trunk/UI/Reports/filters/inventory_activity.html 2013-01-07 12:39:05 UTC (rev 5507)
@@ -0,0 +1,39 @@
+<?lsmb INCLUDE 'ui-header.html';
+ PROCESS 'elements.html';
+ PROCESS 'report_base.html'; ?>
+<body>
+<form action="goods.pl" method="get">
+<div class="listtop"><?lsmb text('Inventory Activity') ?></div>
+<table>
+<tr>
+</tr>
+<tr>
+<th align="right"><?lsmb text('Part Number') ?></th>
+<td><?lsmb PROCESS input element_data = {
+ type = 'text',
+ size = '16',
+ class = 'control_code',
+ value = partnumber
+ name = 'partnumber'
+} ?></td>
+<th align="right"><?lsmb text('Description') ?></th>
+<td><?lsmb PROCESS input element_data = {
+ type = 'text',
+ size = '32',
+ class = 'description',
+ value = description
+ name = 'description'
+} ?></td>
+<tr>
+</tr>
+<?lsmb PROCESS date_row ?>
+</table>
+<?lsmb PROCESS button element_data = {
+ text = text('Continue'),
+ name = 'action'
+ type = 'submit'
+ class = 'submit'
+ value = 'inventory_activity'
+} ?>
+</form>
+</body>
Deleted: trunk/UI/rp-search-generate_inv_activity.html
===================================================================
--- trunk/UI/rp-search-generate_inv_activity.html 2013-01-07 11:02:09 UTC (rev 5506)
+++ trunk/UI/rp-search-generate_inv_activity.html 2013-01-07 12:39:05 UTC (rev 5507)
@@ -1,60 +0,0 @@
- <tr>
- <th align="right"><?lsmb text('From') ?></th>
- <td><?lsmb PROCESS input element_data={
- class => 'date',
- name => 'fromdate',
- size => '11',
- title => user.dateformat,
- value => form.fromdate,
- } ?></td>
- <th align="right"><?lsmb text('To') ?></th>
- <td><?lsmb PROCESS input element_data={
- class => 'date',
- name => 'todate',
- size => '11',
- title => user.dateformat,
- value => form.todate,
- } ?></td>
- </tr>
-<?lsmb IF form.selectaccountingyear.defined ?>
- <tr>
- <th align="right"><?lsmb text('Period') ?></th>
- <td colspan="3">
- <?lsmb PROCESS select element_data=form.selectaccountingmonth -?>
- <?lsmb PROCESS select element_data=form.selectaccountingyear -?>
- <?lsmb PROCESS input element_data={
- type => 'radio',
- name => 'interval',
- value => '0',
- label => text('Current'),
- checked => 'checked',
- } -?>
- <?lsmb PROCESS input element_data={
- type => 'radio',
- name => 'interval',
- value => '1',
- label => text('Month'),
- } -?>
- <?lsmb PROCESS input element_data={
- type => 'radio',
- name => 'interval',
- value => '3',
- label => text('Quarter'),
- } -?>
- <?lsmb PROCESS input element_data={
- type => 'radio',
- name => 'interval',
- value => '12',
- label => text('Year'),
- } -?>
- </td>
- </tr>
-<?lsmb END ?>
- </table>
- <table>
- <tr>
- <th><?lsmb text('Part Number') ?></th>
- <td><?lsmb PROCESS input element_data={name => 'partnumber'} ?></td>
- <th><?lsmb text('Description') ?></th>
- <td><?lsmb PROCESS input element_data={name => 'description'} ?></td>
- </tr>
Modified: trunk/bin/rp.pl
===================================================================
--- trunk/bin/rp.pl 2013-01-07 11:02:09 UTC (rev 5506)
+++ trunk/bin/rp.pl 2013-01-07 12:39:05 UTC (rev 5507)
@@ -187,142 +187,6 @@
sub continue { &{ $form->{nextsub} } }
-sub generate_inv_activity {
-
- my %hiddens;
- my @options;
- my $title = $form->{title};
-
- RP->inventory_activity( \%myconfig, \%$form );
-
- # if ($form->{department}) {
- # ($department) = split /--/, $form->{department};
- # $options = $locale->text('Department')." : $department<br>";
- # $department = $form->escape($form->{department});
- # }
-## if ($form->{projectnumber}) {
- # ($projectnumber) = split /--/, $form->{projectnumber};
- # $options .= $locale->text('Project Number')." : $projectnumber<br>";
- # $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 );
-
- }
- push @options, $form->{period};
-
- my @column_index = qw(partnumber description sold revenue received expense);
-
- my $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}|;
-
- my $column_names = {
- partnumber => 'Part Number',
- description => 'Description',
- sold => 'Sold',
- revenue => 'Revenue',
- received => 'Received',
- expense => 'Expense'
- };
- my @sort_columns = @column_index;
- my $sort_href = "$href&sort_col";
-
- if ( $form->{sort_col} eq 'qty' || $form->{sort_col} eq 'revenue' ) {
- $form->{sort_type} = 'numeric';
- }
- my $i = 0;
- my $cols = "l_transdate=Y&l_name=Y&l_invnumber=Y&summary=1";
- my $dates =
-"transdatefrom=$form->{fromdate}&transdateto=$form->{todate}&year=$form->{fromyear}&month=$form->{frommonth}&interval=$form->{interval}";
- my $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
- my @rows;
- foreach my $ref ( @{ $form->{TB} } ) {
- my $description = $form->escape( $ref->{description} );
- my %column_data;
- $i = $i % 2;
- $column_data{i} = $i;
-
- $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, " " );
-
- $column_data{partnumber} = {
- text => $ref->{partnumber},
- href => $pnumhref,
- };
- $column_data{sold} = {
- text => $ref->{sold},
- href => $soldhref,
- };
- $column_data{received} = {
- text => $ref->{received},
- href => $rechref,
- };
-
- push @rows, \%column_data;
- ++$i;
- }
-
- my $template = LedgerSMB::Template->new_UI(
- user => \%myconfig,
- locale => $locale,
- template => 'form-dynatable',
- );
-
- my $column_heading = $template->column_heading($column_names,
- {href => $sort_href, columns => ..hidden..
- );
-
- $template->render({
- form => $form,
- hiddens => \%hiddens,
- options => ..hidden..,
- columns => ..hidden..,
- heading => $column_heading,
- rows => ..hidden..,
- row_alignment => {
- sold => 'right',
- revenue => 'right',
- received => 'right',
- expense => 'right',
- },
- });
-}
-
sub generate_balance_sheet {
init_company_config($form);
RP->balance_sheet( \%myconfig, \%$form );
Modified: trunk/css/ledgersmb.css
===================================================================
--- trunk/css/ledgersmb.css 2013-01-07 11:02:09 UTC (rev 5506)
+++ trunk/css/ledgersmb.css 2013-01-07 12:39:05 UTC (rev 5507)
@@ -157,7 +157,7 @@
background: #004a80;
}
-.listtop { font-size: 10pt; background-color: black; color: white; }
+.listtop { font-size: 10pt; background-color: black; color: white; font-weight: bold}
.listheading, thead th { font-size: 10pt; background-color: #004a80; color: white; }
.listheading, thead A:link {
text-decoration: none; color: white; font-weight: bold
Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql 2013-01-07 11:02:09 UTC (rev 5506)
+++ trunk/sql/Pg-database.sql 2013-01-07 12:39:05 UTC (rev 5507)
@@ -2635,6 +2635,7 @@
106 Search 98 1
101 Generate 98 4
8 Import 98 3
+114 Inventory Activity 85 2
206 Batches 205 1
14 Search 19 2
12 Add Contact 19 3
@@ -2688,7 +2689,6 @@
107 Translations 98 5
108 Description 107 1
113 Balance Sheet 109 4
-114 Inventory Activity 109 5
117 Sales Invoices 116 1
118 Sales Orders 116 2
119 Checks 116 3
@@ -3082,9 +3082,6 @@
113 action report 281
113 module rp.pl 282
113 report balance_sheet 283
-114 action report 284
-114 module rp.pl 285
-114 report inv_activity 286
115 action recurring_transactions 287
115 module am.pl 288
116 menu 1 289
@@ -3203,6 +3200,9 @@
165 action list_templates 411
166 action list_templates 412
167 action list_templates 413
+114 module reports.pl 285
+114 report_name inventory_activity 286
+114 action start_report 284
168 action list_templates 414
169 action list_templates 415
170 action list_templates 416
@@ -3494,7 +3494,6 @@
8 type timecard 94
\.
-
--
CREATE TABLE menu_acl (
Modified: trunk/sql/modules/Goods.sql
===================================================================
--- trunk/sql/modules/Goods.sql 2013-01-07 11:02:09 UTC (rev 5506)
+++ trunk/sql/modules/Goods.sql 2013-01-07 12:39:05 UTC (rev 5507)
@@ -146,7 +146,7 @@
);
CREATE OR REPLACE FUNCTION inventory__activity
-(in_date_from date, in_date_to date, in_partnumber text, in_description text)
+(in_from_date date, in_to_date date, in_partnumber text, in_description text)
RETURNS SETOF inv_activity_line LANGUAGE SQL AS
$$
SELECT p.id, p.description, p.partnumber,
@@ -166,7 +166,7 @@
WHERE ($1 IS NULL OR a.transdate >= $1)
AND ($2 IS NULL OR a.transdate <= $2)
AND ($3 IS NULL OR p.partnumber ilike $3 || '%')
- AND ($4 IS NULL OR plainto_tsquery($4) @@ p.description);
+ AND ($4 IS NULL OR p.description @@ plainto_tsquery($4))
GROUP BY p.id, p.description, p.partnumber
$$;
Modified: trunk/sql/modules/menu_rebuild.sql
===================================================================
--- trunk/sql/modules/menu_rebuild.sql 2013-01-07 11:02:09 UTC (rev 5506)
+++ trunk/sql/modules/menu_rebuild.sql 2013-01-07 12:39:05 UTC (rev 5507)
@@ -21,11 +21,11 @@
ALTER TABLE public.menu_attribute ALTER COLUMN id DROP DEFAULT;
ALTER TABLE public.menu_acl ALTER COLUMN id DROP DEFAULT;
DROP SEQUENCE public.menu_node_id_seq;
-DROP TABLE public.menu_node CASCADE;
+DROP TABLE public.menu_node;
DROP SEQUENCE public.menu_attribute_id_seq;
DROP TABLE public.menu_attribute;
DROP SEQUENCE public.menu_acl_id_seq;
-DROP TABLE public.menu_acl;
+DROP TABLE public.menu_acl CASCADE;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
@@ -393,9 +393,6 @@
113 action report 281
113 module rp.pl 282
113 report balance_sheet 283
-114 action report 284
-114 module rp.pl 285
-114 report inv_activity 286
115 action recurring_transactions 287
115 module am.pl 288
116 menu 1 289
@@ -514,6 +511,9 @@
165 action list_templates 411
166 action list_templates 412
167 action list_templates 413
+114 module reports.pl 285
+114 report_name inventory_activity 286
+114 action start_report 284
168 action list_templates 414
169 action list_templates 415
170 action list_templates 416
@@ -824,6 +824,7 @@
106 Search 98 1
101 Generate 98 4
8 Import 98 3
+114 Inventory Activity 85 2
206 Batches 205 1
14 Search 19 2
12 Add Contact 19 3
@@ -877,7 +878,6 @@
107 Translations 98 5
108 Description 107 1
113 Balance Sheet 109 4
-114 Inventory Activity 109 5
117 Sales Invoices 116 1
118 Sales Orders 116 2
119 Checks 116 3
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.