[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4783] trunk
- Subject: SF.net SVN: ledger-smb:[4783] trunk
- From: ..hidden..
- Date: Sat, 26 May 2012 08:47:10 +0000
Revision: 4783
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4783&view=rev
Author: einhverfr
Date: 2012-05-26 08:47:09 +0000 (Sat, 26 May 2012)
Log Message:
-----------
ordering now works on reporting framework. Unsure about subtotals
Also moved contact search to new reporting framework and made it more extensible.
Modified Paths:
--------------
trunk/LedgerSMB/App_State.pm
trunk/LedgerSMB/DBObject/Report/GL.pm
trunk/LedgerSMB/DBObject/Report.pm
trunk/UI/Reports/display_report.html
trunk/UI/lib/dynatable.html
trunk/css/ledgersmb.css
trunk/sql/modules/Company.sql
Added Paths:
-----------
trunk/LedgerSMB/DBObject/Report/Contact/
trunk/LedgerSMB/Scripts/contact.pm
trunk/LedgerSMB/Scripts/contact_reports.pm
trunk/UI/Reports/filters/contact_search.html
trunk/contact.pl
trunk/contact_reports.pl
Removed Paths:
-------------
trunk/UI/Contact/search.html
Property Changed:
----------------
trunk/
trunk/LedgerSMB/Scripts/account.pm
trunk/LedgerSMB/Scripts/admin.pm
trunk/LedgerSMB/Scripts/customer.pm
trunk/LedgerSMB/Scripts/employee.pm
trunk/LedgerSMB/Scripts/file.pm
trunk/LedgerSMB/Scripts/journal.pm
trunk/LedgerSMB/Scripts/login.pm
trunk/LedgerSMB/Scripts/menu.pm
trunk/LedgerSMB/Scripts/payment.pm
trunk/LedgerSMB/Scripts/recon.pm
trunk/LedgerSMB/Scripts/setup.pm
trunk/LedgerSMB/Scripts/taxform.pm
trunk/LedgerSMB/Scripts/vendor.pm
trunk/sql/upgrade/1.2-1.3-manual.sql
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3:3711-4777
+ /branches/1.3:3711-4782
Modified: trunk/LedgerSMB/App_State.pm
===================================================================
--- trunk/LedgerSMB/App_State.pm 2012-05-25 23:36:03 UTC (rev 4782)
+++ trunk/LedgerSMB/App_State.pm 2012-05-26 08:47:09 UTC (rev 4783)
@@ -139,6 +139,19 @@
1;
+=item get_url
+
+Returns URL of get request or undef
+
+=cut
+
+sub get_url {
+ if ($ENV{REQUEST_METHOD} ne 'GET') {
+ return undef;
+ }
+ return "$ENV{SCRIPT_NAME}?$ENV{QUERY_STRING}";
+}
+
=back
=head1 COPYRIGHT
Modified: trunk/LedgerSMB/DBObject/Report/GL.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/GL.pm 2012-05-25 23:36:03 UTC (rev 4782)
+++ trunk/LedgerSMB/DBObject/Report/GL.pm 2012-05-26 08:47:09 UTC (rev 4783)
@@ -205,6 +205,16 @@
text => $locale->text('Source')}];
}
+=item subtotal_cols
+
+Returns list of columns for subtotals
+
+=cut
+
+sub subtotal_cols {
+ return ['debits', 'credits'];
+}
+
=head2 Criteria Properties
Note that in all cases, undef matches everything.
Modified: trunk/LedgerSMB/DBObject/Report.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report.pm 2012-05-25 23:36:03 UTC (rev 4782)
+++ trunk/LedgerSMB/DBObject/Report.pm 2012-05-26 08:47:09 UTC (rev 4783)
@@ -108,6 +108,46 @@
has 'format' => (is => 'rw', isa => 'Maybe[Str]');
+=item order_by
+
+The column to order on. used in providing subtotals also.
+
+=cut
+
+has order_by => (is => 'rw', isa => 'Maybe[Str]');
+
+=item old_order_by
+
+Previous order by. Used internally to determine order direction.
+
+=cut
+
+has old_order_by => (is => 'rw', isa => 'Maybe[Str]');
+
+=item order_dir
+
+either asc, desc, or undef. used to determine next ordering.
+
+=cut
+
+has order_dir => (is => 'rw', isa => 'Maybe[Str]');
+
+=item order_url
+
+Url for order redirection. Interal only.
+
+=cut
+
+has order_url => (is => 'rw', isa => 'Maybe[Str]');
+
+=item show_subtotals
+
+bool, determines whether to show subtotals.
+
+=cut
+
+has show_subtotals => (is => 'rw', isa => 'Bool');
+
=back
=head1 METHODS
@@ -129,6 +169,52 @@
eval {$template = $self->template};
$template ||= 'Reports/display_report';
+ # Sorting and Subtotal logic
+ my $url = LedgerSMB::App_State::get_url();
+ if ($self->order_by eq $self->old_order_by){
+ if (lc($self->order_dir) eq 'asc'){
+ $self->order_dir('desc');
+ } else {
+ $self->order_dir('asc');
+ }
+ }
+ $url =~ s/&?order_by=[^\&]*/$1/g;
+ $url =~ s/&?order_dir=[^\&]*/$1/g;
+ $self->order_url(
+ "$url&old_order_by=".$self->order_by."&order_dir=".$self->order_dir
+ );
+
+ my $rows = $self->rows;
+ @$rows = sort {$a->{$self->order_by} cmp $b->{$self->order_by}} @$rows
+ if $self->order_by;
+ if (lc($self->order_dir) eq 'desc' and $self->order_by) {
+ @$rows = reverse @$rows;
+ }
+ $self->rows($rows);
+ if ($self->show_subtotals){
+ my @newrows;
+ my $subtotals = {html_class => 'subtotal'};
+ for my $col ({eval $self->subtotal_on}){
+ $subtotals->{$col} = 0;
+ }
+ my $col_val = undef;
+ for my $r (@{$self->rows}){
+ if (defined $col_val and ($col_val ne $r->{$self->order_by})){
+ push @newrows, $subtotals;
+ $subtotals = {html_class => 'subtotal'};
+ for my $col ({eval $self->subtotal_on}){
+ $subtotals->{$col} = 0;
+ }
+ }
+ for my $col ({eval $self->subtotal_on}){
+ $subtotals->{$col} += $r->{$col};
+ }
+ push @newrows, $r;
+ }
+ }
+
+ # Rendering
+
if (!defined $self->format){
$self->format('html');
}
@@ -144,6 +230,7 @@
name => $self->name,
hlines => $self->header_lines,
columns => $self->show_cols($request),
+ order_url => $self->order_url,
rows => $self->rows});
}
Property changes on: trunk/LedgerSMB/Scripts/account.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/account.pm:4369-4777
/branches/1.3/scripts/account.pl:3711-4368
+ /branches/1.3/LedgerSMB/Scripts/account.pm:3712-4782
/branches/1.3/scripts/account.pl:3711-4368
Property changes on: trunk/LedgerSMB/Scripts/admin.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4777
/branches/1.3/scripts/admin.pl:3711-4678
+ /branches/1.3/LedgerSMB/Scripts/admin.pm:3712-4782
/branches/1.3/scripts/admin.pl:3711-4678
Copied: trunk/LedgerSMB/Scripts/contact.pm (from rev 4779, trunk/LedgerSMB/Scripts/customer.pm)
===================================================================
--- trunk/LedgerSMB/Scripts/contact.pm (rev 0)
+++ trunk/LedgerSMB/Scripts/contact.pm 2012-05-26 08:47:09 UTC (rev 4783)
@@ -0,0 +1,79 @@
+
+=pod
+
+=head1 NAME
+
+LedgerSMB::Scripts::contact - LedgerSMB class defining the Controller
+functions, template instantiation and rendering for customer editing and display.
+
+=head1 SYOPSIS
+
+This module is the UI controller for the customer, vendor, etc functions; it
+
+=head1 METHODS
+
+=cut
+
+package LedgerSMB::Scripts::contact;
+
+use LedgerSMB::DBObject::Customer;
+use base qw(LedgerSMB::ScriptLib::Company);
+
+
+=head1 INHERITS
+
+LedgerSMB::ScriptLib::Company
+
+=head1 COPYRIGHT
+
+Copyright (c) 2009, the LedgerSMB Core Team. This is licensed under the GNU
+General Public License, version 2, or at your option any later version. Please
+see the accompanying License.txt for more information.
+
+=cut
+
+=head1 METHODS
+
+=over
+
+=item get_by_cc
+
+Populates the company area with info on the company, pulled up through the
+control code
+
+=cut
+
+sub get_by_cc {
+ my ($request) = @_;
+ $request->{entity_class} ||= $request->{account_class};
+ $request->{legal_name} ||= 'test';
+ $request->{country_id} = 0;
+ my $company = LedgerSMB::DBObject::Entity::Company->new(%$request);
+ $company = $company->get_by_cc($request->{control_code});
+ $request->{company} = $company;
+ LedgerSMB::ScriptLib::Company::_render_main_screen($request, $company);
+}
+
+
+=item get($self, $request, $user)
+
+Requires form var: id
+
+Extracts a single company from the database, using its company ID as the primary
+point of uniqueness. Shows (appropriate to user privileges) and allows editing
+of the company information.
+
+=cut
+
+sub get {
+ my ($request) = @_;
+ $request->{entity_class} ||= $request->{account_class};
+ $request->{legal_name} ||= 'test';
+ my $company = LedgerSMB::DBObject::Entity::Company->new(%$request);
+ $company = $company->get($request->{entity_id});
+ $request->{company} = $company;
+ LedgerSMB::ScriptLib::Company::_render_main_screen($request, $company);
+}
+
+
+1;
Property changes on: trunk/LedgerSMB/Scripts/contact.pm
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/1.3/LedgerSMB/Scripts/customer.pm:3712-4782
/branches/1.3/scripts/customer.pl:4273-4287
Copied: trunk/LedgerSMB/Scripts/contact_reports.pm (from rev 4778, trunk/LedgerSMB/Scripts/report_aging.pm)
===================================================================
--- trunk/LedgerSMB/Scripts/contact_reports.pm (rev 0)
+++ trunk/LedgerSMB/Scripts/contact_reports.pm 2012-05-26 08:47:09 UTC (rev 4783)
@@ -0,0 +1,38 @@
+=head1 NAME
+
+LedgerSMB::Scripts::report_aging - Aging Reports and Statements for LedgerSMB
+
+=head1 SYNOPSIS
+
+This module provides AR/AP aging reports and statements for LedgerSMB.
+
+=head1 METHODS
+
+=cut
+
+package LedgerSMB::Scripts::contact_reports;
+our $VERSION = '1.0';
+
+use LedgerSMB;
+use LedgerSMB::Template;
+use LedgerSMB::DBObject::Report::Contact::Search;
+use strict;
+
+=pod
+
+=item search
+
+Runs the search report and displays it
+
+=cut
+
+sub search{
+ my ($request) = @_;
+
+ LedgerSMB::DBObject::Report::Contact::Search->prepare_criteria($request);
+ my $report = LedgerSMB::DBObject::Report::Contact::Search->new(%$request);
+ $report->run_report;
+ $report->render($request);
+}
+
+return 1;
Property changes on: trunk/LedgerSMB/Scripts/customer.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/customer.pm:4288-4777
/branches/1.3/scripts/customer.pl:4273-4287
+ /branches/1.3/LedgerSMB/Scripts/customer.pm:3712-4782
/branches/1.3/scripts/customer.pl:4273-4287
Property changes on: trunk/LedgerSMB/Scripts/employee.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4777
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310
+ /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4782
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310
Property changes on: trunk/LedgerSMB/Scripts/file.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4777
/branches/1.3/scripts/file.pl:3711-4138
+ /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4782
/branches/1.3/scripts/file.pl:3711-4138
Property changes on: trunk/LedgerSMB/Scripts/journal.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/journal.pm:4288-4777
/branches/1.3/scripts/journal.pl:3711-4328
+ /branches/1.3/LedgerSMB/Scripts/journal.pm:3712-4782
/branches/1.3/scripts/journal.pl:3711-4328
Property changes on: trunk/LedgerSMB/Scripts/login.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/login.pm:4193-4777
/branches/1.3/scripts/login.pl:3711-4192
+ /branches/1.3/LedgerSMB/Scripts/login.pm:3712-4782
/branches/1.3/scripts/login.pl:3711-4192
Property changes on: trunk/LedgerSMB/Scripts/menu.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4777
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287
+ /branches/1.3/LedgerSMB/Scripts/menu.pm:3712-4782
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287
Property changes on: trunk/LedgerSMB/Scripts/payment.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4777
/branches/1.3/scripts/payment.pl:3711-4680
+ /branches/1.3/LedgerSMB/Scripts/payment.pm:3712-4782
/branches/1.3/scripts/payment.pl:3711-4680
Property changes on: trunk/LedgerSMB/Scripts/recon.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4777
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438
+ /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4782
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438
Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4777
/branches/1.3/scripts/setup.pl:3711-4550
+ /branches/1.3/LedgerSMB/Scripts/setup.pm:3712-4782
/branches/1.3/scripts/setup.pl:3711-4550
Property changes on: trunk/LedgerSMB/Scripts/taxform.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4777
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287
+ /branches/1.3/LedgerSMB/Scripts/taxform.pm:3712-4782
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287
Property changes on: trunk/LedgerSMB/Scripts/vendor.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/vendor.pm:4288-4777
/branches/1.3/scripts/vendor.pl:4273-4287
+ /branches/1.3/LedgerSMB/Scripts/vendor.pm:3712-4782
/branches/1.3/scripts/vendor.pl:4273-4287
Deleted: trunk/UI/Contact/search.html
===================================================================
--- trunk/UI/Contact/search.html 2012-05-25 23:36:03 UTC (rev 4782)
+++ trunk/UI/Contact/search.html 2012-05-26 08:47:09 UTC (rev 4783)
@@ -1,485 +0,0 @@
-<?lsmb INCLUDE 'ui-header.html' ?>
-<?lsmb PROCESS elements.html ?>
-<?lsmb account_class = entity_class ?>
-<body>
-<?lsmb
-IF account_class == 0;
- title = text('Contact Search'); #'
-ELSIF account_class == 1;
- title = text('Vendor Search'); #'
-ELSIF account_class == 2;
- title = text('Customer Search'); #'
-ELSIF account_class == 3;
- title = text('Employee Search'); #'
-ELSE;
- title = text('Unsupported. Expect errors'); #'
-END -?>
-<form method="get" action="">
-<?lsmb INCLUDE input element_data = {
- type = "hidden"
- name = "account_class"
- value = account_class
-} -?>
-<table width="100%">
- <tr><th class="listtop"><?lsmb title ?></th></tr>
-
- <tr><td /></tr>
- <tr valign="top">
- <td>
- <table>
- <tr valign="top">
- <td>
- <table>
- <tr>
- <th align="right"><?lsmb text('Name') ?></th>
- <td><?lsmb INCLUDE input element_data={size = '32', name = 'legal_name'} ?></td>
- </tr>
- <tr>
- <th align="right"><?lsmb text('Control Code') ?></th>
- <td><?lsmb PROCESS input element_data = {
- size = 32
- name = "control_code"
- type = "text"
- value = control_code
- } ?></td>
- </tr>
- <tr>
- <th align="right"><?lsmb text('Contact') ?></th>
- <td><?lsmb INCLUDE input element_data={size = '32', name = 'contact'} ?></td>
- </tr>
- <tr>
- <th align="right"><?lsmb text('E-mail') ?></th>
- <td><?lsmb INCLUDE input element_data={size = '32', name = 'email'} ?></td>
- </tr>
- <tr>
- <th align="right"><?lsmb text('Phone') ?></th>
- <td><?lsmb INCLUDE input element_data={size = '20', name = 'phone'} ?></td>
- </tr>
- <tr>
-<?lsmb IF entity_type == 'Customer' -?>
- <th align="right"><?lsmb text('Salesperson') ?></th>
- <td><?lsmb INCLUDE input element_data={size = '32', name = 'employee'} ?></td>
-<?lsmb ELSIF entity_type == 'Vendor' -?>
- <th align="right"><?lsmb text('Employee') ?></th>
- <td><?lsmb INCLUDE input element_data={size = '32', name = 'employee'} ?></td>
-<?lsmb END -?>
- </tr>
- <!-- tr>
- <th align="right"><?lsmb text('Notes') ?></th>
- <td><?lsmb INCLUDE textarea element_data={
- rows = '3', cols = '32', name = 'notes'} ?></td>
- </tr -->
- </table>
- </td>
- <td>
- <table>
- <tr>
- <th align="right"><?lsmb text("Account Number") ?></th>
- <td><?lsmb INCLUDE input element_data={
- size = '32', name = "meta_number"} ?></td>
- </tr>
- <tr>
- <th align="right"><?lsmb text('Address') ?></th>
- <td><?lsmb INCLUDE input element_data={
- size = '32', name = 'address'} ?></td>
- </tr>
- <tr>
- <th align="right"><?lsmb text('City') ?></th>
- <td><?lsmb INCLUDE input element_data={
- size = '32', name = 'city'} ?></td>
- </tr>
- <tr>
- <th align="right"><?lsmb text('State/Province') ?></th>
- <td><?lsmb INCLUDE input element_data={
- size = '32', name = 'state'} ?></td>
- </tr>
- <tr>
- <th align="right"><?lsmb text('Zip/Postal Code') ?></th>
- <td><?lsmb INCLUDE input element_data={
- size = '10', name = 'mail_code'} ?></td>
- </tr>
- <tr>
- <th align="right"><?lsmb text('Country') ?></th>
- <td><?lsmb INCLUDE input element_data={
- size = '32', name = 'country'} ?></td>
- </tr>
- <tr>
- <th align="right"><?lsmb text('Active') ?></th>
- <td>
- <?lsmb text('From'); ' '; INCLUDE input element_data={
- size = '11', name = 'startdatefrom', class = 'date', title = user.dateformat};
- text('Date to'); ' '; INCLUDE input element_data={
- size = '11', name = 'startdateto', class = 'date', title = user.dateformat} ?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
- <table>
-<?lsmb IF target == 'list_history' -?>
- <tr>
- <td />
- <td>
- <table>
- <tr>
- <td>
- <table>
- <tr>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- type = 'radio',
- name = 'type',
- value = 'invoice',
- label = text('Invoice'),
- checked = 'checked',
- } -?>
- </td>
- </tr>
- <tr>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- type = 'radio',
- name = 'type',
- value = 'order',
- label = text('Order'),
- } -?>
- </td>
- </tr>
- <tr>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- type = 'radio',
- name = 'type',
- value = 'quotation',
- label = text('Quotation'),
- } -?>
- </td>
- </tr>
- </table>
- </td>
- <td>
- <table>
- <tr>
- <th><?lsmb text('From') ?></th>
- <td><?lsmb INCLUDE input element_data={
- size = '11', name = 'transdatefrom', class = 'date', title = user.dateformat} -?></td>
- <th><?lsmb text('To') ?></th>
- <td><?lsmb INCLUDE input element_data={
- size = '11', name = 'transdateto', class = 'date', title = user.dateformat} -?></td>
- </tr>
- <tr>
- <td />
- <td colspan="3">
- <?lsmb INCLUDE input element_data={
- name = 'open',
- type = 'checkbox',
- value = 'Y',
- label = text('Open'),
- checked = 'checked'
- } -?>
- <?lsmb INCLUDE input element_data={
- name = 'closed',
- type = 'checkbox',
- value = 'Y',
- label = text('Closed'),
- } -?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <th align="right"><?lsmb text('Include in Report') ?></th>
- <td>
- <table>
- <tr>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'history',
- type = 'radio',
- value = 'summary',
- label = text('Summary'),
- checked = 'checked',
- } -?>
- </td>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'history',
- type = 'radio',
- value = 'detail',
- label = text('Detail'),
- } -?>
- </td>
- </tr>
- <tr>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_partnumber',
- type = 'checkbox',
- value = 'Y',
- label = text('Part Number'), # '
- checked = 'checked',
- } -?>
- </td>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_description',
- type = 'checkbox',
- value = 'Y',
- label = text('Description'),
- checked = 'checked',
- } -?>
- </td>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_sellprice',
- type = 'checkbox',
- value = 'Y',
- label = text('Sell Price'), # '
- checked = 'checked',
- } -?>
- </td>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_curr',
- type = 'checkbox',
- value = 'Y',
- label = text('Currency'),
- } -?>
- </td>
- </tr>
- <tr>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_qty',
- type = 'checkbox',
- value = 'Y',
- label = text('Qty'),
- } -?>
- </td>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_unit',
- type = 'checkbox',
- value = 'Y',
- label = text('Unit'),
- } -?>
- </td>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_discount',
- type = 'checkbox',
- value = 'Y',
- label = text('Discount'),
- } -?>
- </td>
- </tr>
- <tr>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_deliverydate',
- type = 'checkbox',
- value = 'Y',
- label = text('Delivery Date'), # '
- } -?>
- </td>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_projectnumber',
- type = 'checkbox',
- value = 'Y',
- label = text('Project Number'), # '
- } -?>
- </td>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_serialnumber',
- type = 'checkbox',
- value = 'Y',
- label = text('Serial Number'), # '
- } -?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-<?lsmb ELSIF target == 'list_names' ?>
- <tr>
- <td />
- <td>
- <?lsmb INCLUDE input element_data={name = 'status', type = 'radio', value = 'all', label = text('All'), checked = 'checked'} -?>
- <?lsmb INCLUDE input element_data={name = 'status', type = 'radio', value = 'active', label = text('Active')} -?>
- <?lsmb INCLUDE input element_data={name = 'status', type = 'radio', value = 'inactive', label = text('Inactive')} -?>
- <?lsmb INCLUDE input element_data={name = 'status', type = 'radio', value = 'orphaned', label = text('Orphaned')} -?>
- </td>
- </tr>
- <tr>
- <td />
- <td>
- <table>
- <tr>
- <td>
- <table>
- <tr>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_transnumber',
- type = 'checkbox',
- value = 'Y',
- label = form.translabel,
- } -?>
- </td>
- </tr>
- <tr>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_invnumber',
- type = 'checkbox',
- value = 'Y',
- label = form.invlabel,
- } -?>
- </td>
- </tr>
- <tr>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_ordnumber',
- type = 'checkbox',
- value = 'Y',
- label = form.ordlabel,
- } -?>
- </td>
- </tr>
- <tr>
- <td align="right">
- <?lsmb INCLUDE input element_data={
- name = 'col_quonumber',
- type = 'checkbox',
- value = 'Y',
- label = form.quolabel,
- } -?>
- </td>
- </tr>
- </table>
- </td>
- <td>
- <table>
- <tr>
- <th><?lsmb text('From') ?></th>
- <td>
- <?lsmb INCLUDE input element_data={
- name = 'transdatefrom',
- class = 'date'
- size = '11',
- title = user.dateformat,
- } -?>
- </td>
- <th><?lsmb text('To') ?></th>
- <td>
- <?lsmb INCLUDE input element_data={
- name = 'transdateto',
- class = 'date'
- size = '11',
- title = user.dateformat,
- } -?>
- </td>
- </tr>
- <tr>
- <td />
- <td colspan="3">
- <?lsmb INCLUDE input element_data={
- name = 'open',
- type = 'checkbox',
- value = 'Y',
- label = text('Open'),
- checked = 'checked'
- } -?>
- <?lsmb INCLUDE input element_data={
- name = 'closed',
- type = 'checkbox',
- value = 'Y',
- label = text('Closed'),
- } -?>
- </td>
- </tr>
- <tr>
- <td />
- <td colspan="3">
- <?lsmb INCLUDE input element_data={
- name = 'col_amount',
- type = 'checkbox',
- value = 'Y',
- label = text('Amount'),
- checked = 'checked'
- } -?>
- <?lsmb INCLUDE input element_data={
- name = 'col_tax',
- type = 'checkbox',
- value = 'Y',
- label = text('Tax'),
- checked = 'checked'
- } -?>
- <?lsmb INCLUDE input element_data={
- name = 'col_total',
- type = 'checkbox',
- value = 'Y',
- label = text('Total'),
- checked = 'checked'
- } -?>
- <?lsmb INCLUDE input element_data={
- name = 'col_subtotal',
- type = 'checkbox',
- value = 'Y',
- label = text('Subtotal'),
- } -?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <th align="right"><?lsmb text('Include in Report') ?></th>
- <td>
- <table>
- <?lsmb FOREACH line IN form.includes -?>
- <tr>
- <?lsmb FOREACH item IN line -?>
- <td align="right">
- <?lsmb INCLUDE input element_data=item -?>
- </td>
- <?lsmb END -?>
- </tr>
- <?lsmb END -?>
- </table>
- </td>
- </tr>
-<?lsmb END ?>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size="3" noshade="noshade" /></td>
- </tr>
-</table>
-<?lsmb INCLUDE button element_data = {
- text = text('Search')
- name = "action"
- value = 'get_results'
- class = "submit"
- type = "submit"
-} ?>
- </form>
-
-</body>
-</html>
Modified: trunk/UI/Reports/display_report.html
===================================================================
--- trunk/UI/Reports/display_report.html 2012-05-25 23:36:03 UTC (rev 4782)
+++ trunk/UI/Reports/display_report.html 2012-05-26 08:47:09 UTC (rev 4783)
@@ -21,11 +21,11 @@
</div>
<?lsmb FOREACH LINE IN hlines ?>
<div class="report_header"><label><?lsmb LINE.text ?>:</label>
-<span class="report_header"><?lsmb request.${LINE.name} ?></span>
+<span class="report_header"><?lsmb request.${LINE.name} ?><?lsmb report ?></span>
</div>
<?lsmb END ?>
<?lsmb PROCESS dynatable tbody = {rows => rows }
- attributes = {class = 'report' } ?>
+ attributes = {class = 'report', order_url = order_url } ?>
<a href="<?lsmb LINK ?>">[<?lsmb text('permalink') ?>]</a>
<?lsmb IF FORMATS.grep('PDF').size()
Copied: trunk/UI/Reports/filters/contact_search.html (from rev 4781, trunk/UI/Contact/search.html)
===================================================================
--- trunk/UI/Reports/filters/contact_search.html (rev 0)
+++ trunk/UI/Reports/filters/contact_search.html 2012-05-26 08:47:09 UTC (rev 4783)
@@ -0,0 +1,482 @@
+<?lsmb INCLUDE 'ui-header.html' ?>
+<?lsmb PROCESS elements.html ?>
+<body>
+<?lsmb
+IF account_class == 0;
+ title = text('Contact Search'); #'
+ELSIF account_class == 1;
+ title = text('Vendor Search'); #'
+ELSIF account_class == 2;
+ title = text('Customer Search'); #'
+ELSIF account_class == 3;
+ title = text('Employee Search'); #'
+ELSE;
+ title = text('Unsupported. Expect errors'); #'
+END -?>
+<form method="get" action="contact_reports.pl">
+<?lsmb INCLUDE input element_data = {
+ type = "hidden"
+ name = "account_class"
+ value = account_class
+} -?>
+<table width="100%">
+ <tr><th class="listtop"><?lsmb title ?></th></tr>
+
+ <tr><td /></tr>
+ <tr valign="top">
+ <td>
+ <table>
+ <tr valign="top">
+ <td>
+ <table>
+ <tr>
+ <th align="right"><?lsmb text('Name') ?></th>
+ <td><?lsmb INCLUDE input element_data={
+ size = '32', name = 'name_part'
+ } ?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Control Code') ?></th>
+ <td><?lsmb PROCESS input element_data = {
+ size = 32
+ name = "control_code"
+ type = "text"
+ value = control_code
+ } ?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('E-mail') ?></th>
+ <td><?lsmb INCLUDE input element_data={size = '32', name = 'email'} ?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Phone') ?></th>
+ <td><?lsmb INCLUDE input element_data={size = '20', name = 'phone'} ?></td>
+ </tr>
+ <tr>
+<?lsmb IF entity_type == 'Customer' -?>
+ <th align="right"><?lsmb text('Salesperson') ?></th>
+ <td><?lsmb INCLUDE input element_data={size = '32', name = 'employee'} ?></td>
+<?lsmb ELSIF entity_type == 'Vendor' -?>
+ <th align="right"><?lsmb text('Employee') ?></th>
+ <td><?lsmb INCLUDE input element_data={size = '32', name = 'employee'} ?></td>
+<?lsmb END -?>
+ </tr>
+ <!-- tr>
+ <th align="right"><?lsmb text('Notes') ?></th>
+ <td><?lsmb INCLUDE textarea element_data={
+ rows = '3', cols = '32', name = 'notes'} ?></td>
+ </tr -->
+ </table>
+ </td>
+ <td>
+ <table>
+ <tr>
+ <th align="right"><?lsmb text("Account Number") ?></th>
+ <td><?lsmb INCLUDE input element_data={
+ size = '32', name = "meta_number"} ?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Address') ?></th>
+ <td><?lsmb INCLUDE input element_data={
+ size = '32', name = 'address'} ?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('City') ?></th>
+ <td><?lsmb INCLUDE input element_data={
+ size = '32', name = 'city'} ?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('State/Province') ?></th>
+ <td><?lsmb INCLUDE input element_data={
+ size = '32', name = 'state'} ?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Zip/Postal Code') ?></th>
+ <td><?lsmb INCLUDE input element_data={
+ size = '10', name = 'mail_code'} ?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Country') ?></th>
+ <td><?lsmb INCLUDE input element_data={
+ size = '32', name = 'country'} ?></td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Active') ?></th>
+ <td>
+ <?lsmb text('From'); ' '; INCLUDE input element_data={
+ size = '11', name = 'active_date_from', class = 'date', title = user.dateformat};
+ text('Date to'); ' '; INCLUDE input element_data={
+ size = '11', name = 'active_date_to', class = 'date', title = user.dateformat} ?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table>
+<?lsmb IF target == 'list_history' -?>
+ <tr>
+ <td />
+ <td>
+ <table>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ type = 'radio',
+ name = 'type',
+ value = 'invoice',
+ label = text('Invoice'),
+ checked = 'checked',
+ } -?>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ type = 'radio',
+ name = 'type',
+ value = 'order',
+ label = text('Order'),
+ } -?>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ type = 'radio',
+ name = 'type',
+ value = 'quotation',
+ label = text('Quotation'),
+ } -?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table>
+ <tr>
+ <th><?lsmb text('From') ?></th>
+ <td><?lsmb INCLUDE input element_data={
+ size = '11', name = 'transdatefrom', class = 'date', title = user.dateformat} -?></td>
+ <th><?lsmb text('To') ?></th>
+ <td><?lsmb INCLUDE input element_data={
+ size = '11', name = 'transdateto', class = 'date', title = user.dateformat} -?></td>
+ </tr>
+ <tr>
+ <td />
+ <td colspan="3">
+ <?lsmb INCLUDE input element_data={
+ name = 'open',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Open'),
+ checked = 'checked'
+ } -?>
+ <?lsmb INCLUDE input element_data={
+ name = 'closed',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Closed'),
+ } -?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Include in Report') ?></th>
+ <td>
+ <table>
+ <tr>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'history',
+ type = 'radio',
+ value = 'summary',
+ label = text('Summary'),
+ checked = 'checked',
+ } -?>
+ </td>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'history',
+ type = 'radio',
+ value = 'detail',
+ label = text('Detail'),
+ } -?>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_partnumber',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Part Number'), # '
+ checked = 'checked',
+ } -?>
+ </td>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_description',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Description'),
+ checked = 'checked',
+ } -?>
+ </td>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_sellprice',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Sell Price'), # '
+ checked = 'checked',
+ } -?>
+ </td>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_curr',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Currency'),
+ } -?>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_qty',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Qty'),
+ } -?>
+ </td>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_unit',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Unit'),
+ } -?>
+ </td>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_discount',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Discount'),
+ } -?>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_deliverydate',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Delivery Date'), # '
+ } -?>
+ </td>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_projectnumber',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Project Number'), # '
+ } -?>
+ </td>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_serialnumber',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Serial Number'), # '
+ } -?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+<?lsmb ELSIF target == 'list_names' ?>
+ <tr>
+ <td />
+ <td>
+ <?lsmb INCLUDE input element_data={name = 'status', type = 'radio', value = 'all', label = text('All'), checked = 'checked'} -?>
+ <?lsmb INCLUDE input element_data={name = 'status', type = 'radio', value = 'active', label = text('Active')} -?>
+ <?lsmb INCLUDE input element_data={name = 'status', type = 'radio', value = 'inactive', label = text('Inactive')} -?>
+ <?lsmb INCLUDE input element_data={name = 'status', type = 'radio', value = 'orphaned', label = text('Orphaned')} -?>
+ </td>
+ </tr>
+ <tr>
+ <td />
+ <td>
+ <table>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_transnumber',
+ type = 'checkbox',
+ value = 'Y',
+ label = form.translabel,
+ } -?>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_invnumber',
+ type = 'checkbox',
+ value = 'Y',
+ label = form.invlabel,
+ } -?>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_ordnumber',
+ type = 'checkbox',
+ value = 'Y',
+ label = form.ordlabel,
+ } -?>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_quonumber',
+ type = 'checkbox',
+ value = 'Y',
+ label = form.quolabel,
+ } -?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table>
+ <tr>
+ <th><?lsmb text('From') ?></th>
+ <td>
+ <?lsmb INCLUDE input element_data={
+ name = 'transdatefrom',
+ class = 'date'
+ size = '11',
+ title = user.dateformat,
+ } -?>
+ </td>
+ <th><?lsmb text('To') ?></th>
+ <td>
+ <?lsmb INCLUDE input element_data={
+ name = 'transdateto',
+ class = 'date'
+ size = '11',
+ title = user.dateformat,
+ } -?>
+ </td>
+ </tr>
+ <tr>
+ <td />
+ <td colspan="3">
+ <?lsmb INCLUDE input element_data={
+ name = 'open',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Open'),
+ checked = 'checked'
+ } -?>
+ <?lsmb INCLUDE input element_data={
+ name = 'closed',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Closed'),
+ } -?>
+ </td>
+ </tr>
+ <tr>
+ <td />
+ <td colspan="3">
+ <?lsmb INCLUDE input element_data={
+ name = 'col_amount',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Amount'),
+ checked = 'checked'
+ } -?>
+ <?lsmb INCLUDE input element_data={
+ name = 'col_tax',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Tax'),
+ checked = 'checked'
+ } -?>
+ <?lsmb INCLUDE input element_data={
+ name = 'col_total',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Total'),
+ checked = 'checked'
+ } -?>
+ <?lsmb INCLUDE input element_data={
+ name = 'col_subtotal',
+ type = 'checkbox',
+ value = 'Y',
+ label = text('Subtotal'),
+ } -?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <th align="right"><?lsmb text('Include in Report') ?></th>
+ <td>
+ <table>
+ <?lsmb FOREACH line IN form.includes -?>
+ <tr>
+ <?lsmb FOREACH item IN line -?>
+ <td align="right">
+ <?lsmb INCLUDE input element_data=item -?>
+ </td>
+ <?lsmb END -?>
+ </tr>
+ <?lsmb END -?>
+ </table>
+ </td>
+ </tr>
+<?lsmb END ?>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td><hr size="3" noshade="noshade" /></td>
+ </tr>
+</table>
+<?lsmb INCLUDE button element_data = {
+ text = text('Search')
+ name = "action"
+ value = 'search'
+ class = "submit"
+ type = "submit"
+} ?>
+ </form>
+
+</body>
+</html>
Modified: trunk/UI/lib/dynatable.html
===================================================================
--- trunk/UI/lib/dynatable.html 2012-05-25 23:36:03 UTC (rev 4782)
+++ trunk/UI/lib/dynatable.html 2012-05-26 08:47:09 UTC (rev 4783)
@@ -1,13 +1,20 @@
<?lsmb BLOCK dynatable ?>
<table id="<?lsmb attributes.id ?>" class="dynatable <?lsmb attributes.class ?>"
-width="attributes.width">
+width="<?lsmb attributes.width ?>">
<?lsmb- IF !hide_header -?>
<thead>
<tr>
<?lsmb- FOREACH COL IN columns;
IF COL.type != 'hidden'; -?>
- <th class="<?lsmb COL.col_id _ ' ' _ COL.class _ ' ' _ COL.type ?>">
- <?lsmb COL.name ?>
+ <th class="<?lsmb COL.col_id _ ' ' _ COL.class _ ' ' _ COL.type ?>"><?lsmb
+
+IF attributes.order_url
+?> <a href="<?lsmb order_url ?>&order_by=<?lsmb COL.col_id ?>"><?lsmb
+END;
+COL.name;
+IF attributes.order_url
+?></a><?lsmb
+END; ?>
</th>
<?lsmb- END; END; -?>
</tr>
Copied: trunk/contact.pl (from rev 4778, trunk/reports.pl)
===================================================================
--- trunk/contact.pl (rev 0)
+++ trunk/contact.pl 2012-05-26 08:47:09 UTC (rev 4783)
@@ -0,0 +1,8 @@
+#!/usr/bin/perl
+
+use FindBin;
+BEGIN {
+ lib->import($FindBin::Bin) unless $ENV{mod_perl}
+}
+
+require 'lsmb-request.pl';
Copied: trunk/contact_reports.pl (from rev 4778, trunk/reports.pl)
===================================================================
--- trunk/contact_reports.pl (rev 0)
+++ trunk/contact_reports.pl 2012-05-26 08:47:09 UTC (rev 4783)
@@ -0,0 +1,8 @@
+#!/usr/bin/perl
+
+use FindBin;
+BEGIN {
+ lib->import($FindBin::Bin) unless $ENV{mod_perl}
+}
+
+require 'lsmb-request.pl';
Modified: trunk/css/ledgersmb.css
===================================================================
--- trunk/css/ledgersmb.css 2012-05-25 23:36:03 UTC (rev 4782)
+++ trunk/css/ledgersmb.css 2012-05-26 08:47:09 UTC (rev 4783)
@@ -147,8 +147,11 @@
.listtop { font-size: 10pt; background-color: black; color: white; }
.listheading, thead th { font-size: 10pt; background-color: #004a80; color: white; }
+.listheading, thead A:link {
+text-decoration: none; color: white; font-weight: bold
+}
A.listheading:link, A.listheading:active, A.listheading:visited {
- text-decoration: none; }
+ text-decoration: none; color: white; font-weight: bold}
.listrow1, table.dynatable tr:nth-child(odd) { font-size: 10pt; background-color: #e6e6fa; color: black; vertical-align: top; }
.listrow0, table.dynatable tr:nth-child(even) { font-size: 10pt; background-color: #ffe4e1; color: black; vertical-align: top; }
.listsubtotal { font-size: 10pt; background-color: #5a7d9b; color: white; }
Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql 2012-05-25 23:36:03 UTC (rev 4782)
+++ trunk/sql/modules/Company.sql 2012-05-26 08:47:09 UTC (rev 4783)
@@ -38,17 +38,16 @@
);
-DROP TYPE IF EXISTS company_search_result CASCADE;
+DROP TYPE IF EXISTS contact_search_result CASCADE;
-CREATE TYPE company_search_result AS (
+CREATE TYPE contact_search_result AS (
entity_id int,
entity_control_code text,
- company_id int,
entity_credit_id int,
meta_number text,
credit_description text,
entity_class int,
- legal_name text,
+ name text,
sic_code text,
business_type text,
curr text
@@ -222,15 +221,28 @@
group by id, name, meta_number, curr, parts_id, partnumber, description, unit
order by meta_number;
$$ LANGUAGE SQL;
+
+COMMENT ON FUNCTION eca_history_summary
+(in_name text, in_meta_number text, in_contact_info text, in_address_line text,
+ in_city text, in_state text, in_zip text, in_salesperson text, in_notes text,
+ in_country_id int, in_from_date date, in_to_date date, in_type char(1),
+ in_start_from date, in_start_to date, in_account_class int,
+ in_inc_open bool, in_inc_closed bool) IS
+$$Creates a summary account (no quantities, just parts group by invoice).
+
+meta_number must match exactly or be NULL. inc_open and inc_closed are exact
+matches too. All other values specify ranges or may match partially.$$;
+
--HV coalesce(ec.entity_class,e.entity_class) in case entity but not yet entity_credit_account
-CREATE OR REPLACE FUNCTION company__search
+CREATE OR REPLACE FUNCTION contact__search
(in_account_class int, in_contact text, in_contact_info text[],
in_meta_number text, in_address text, in_city text, in_state text,
- in_mail_code text, in_country text, in_date_from date, in_date_to date,
- in_business_id int, in_legal_name text, in_control_code text)
-RETURNS SETOF company_search_result AS $$
+ in_mail_code text, in_country text, in_active_date_from date,
+ in_active_date_to date,
+ in_business_id int, in_name_part text, in_control_code text)
+RETURNS SETOF contact_search_result AS $$
DECLARE
- out_row company_search_result;
+ out_row contact_search_result;
loop_count int;
t_contact_info text[];
BEGIN
@@ -238,17 +250,31 @@
FOR out_row IN
- SELECT e.id, e.control_code, c.id, ec.id, ec.meta_number,
+ SELECT e.id, e.control_code, ec.id, ec.meta_number,
ec.description, ec.entity_class,
c.legal_name, c.sic_code, b.description , ec.curr::text
- FROM (select * from entity where in_control_code = control_code
+ FROM (select * from entity
+ where control_code like in_control_code || '%'
union
select * from entity where in_control_code is null) e
- JOIN (SELECT * FROM company
- WHERE legal_name ilike '%' || in_legal_name || '%'
+ JOIN (SELECT legal_name, sic_code, entity_id
+ FROM company
+ WHERE legal_name @@ plainto_tsquery(in_name_part)
UNION ALL
- SELECT * FROM company
- WHERE in_legal_name IS NULL) c ON (e.id = c.entity_id)
+ SELECT legal_name, sic_code, entity_id
+ FROM company
+ WHERE in_name_part IS NULL
+ UNION ALL
+ SELECT first_name || ' ' || middle_name || ' '
+ || last_name, null, entity_id
+ FROM person
+ WHERE first_name || ' ' || middle_name || ' '
+ || last_name @@ plainto_tsquery(in_name_part)
+ UNION ALL
+ SELECT first_name || ' ' || middle_name || ' '
+ || last_name, null, entity_id
+ FROM person
+ WHERE in_name_part IS NULL) c ON (e.id = c.entity_id)
LEFT JOIN entity_credit_account ec ON (ec.entity_id = e.id)
LEFT JOIN business b ON (ec.business_id = b.id)
WHERE coalesce(ec.entity_class,e.entity_class) = in_account_class
@@ -260,8 +286,6 @@
ALL(t_contact_info)
OR t_contact_info IS NULL)
- AND (c.legal_name ilike '%' || in_legal_name || '%'
- OR in_legal_name IS NULL)
AND ((in_address IS NULL AND in_city IS NULL
AND in_state IS NULL
AND in_country IS NULL)
@@ -269,10 +293,14 @@
(select entity_id FROM entity_to_location
WHERE location_id IN
(SELECT id FROM location
- WHERE line_one
- ilike '%' ||
- coalesce(in_address, '')
- || '%'
+ WHERE (line_one @@ plainto_tsquery(
+ in_address)
+ OR
+ line_two @@ plainto_tsquery(
+ in_address)
+ OR
+ line_three @@ plainto_tsquery(
+ in_address))
AND city ILIKE
'%' ||
coalesce(in_city, '')
@@ -288,8 +316,8 @@
|| '%'
AND country_id IN
(SELECT id FROM country
- WHERE name ILIKE '%' ||
- in_country ||'%'
+ WHERE name ilike
+ in_country
OR short_name
ilike
in_country)))))
@@ -297,12 +325,12 @@
coalesce(in_business_id, ec.business_id)
OR (ec.business_id IS NULL
AND in_business_id IS NULL))
- AND (ec.startdate <= coalesce(in_date_to,
+ AND (ec.startdate <= coalesce(in_active_date_to,
ec.startdate)
OR (ec.startdate IS NULL))
- AND (ec.enddate >= coalesce(in_date_from, ec.enddate)
+ AND (ec.enddate >= coalesce(in_active_date_from, ec.enddate)
OR (ec.enddate IS NULL))
- AND (ec.meta_number = in_meta_number
+ AND (ec.meta_number like in_meta_number || '%'
OR in_meta_number IS NULL)
LOOP
RETURN NEXT out_row;
@@ -310,17 +338,6 @@
END;
$$ language plpgsql;
-COMMENT ON FUNCTION eca_history_summary
-(in_name text, in_meta_number text, in_contact_info text, in_address_line text,
- in_city text, in_state text, in_zip text, in_salesperson text, in_notes text,
- in_country_id int, in_from_date date, in_to_date date, in_type char(1),
- in_start_from date, in_start_to date, in_account_class int,
- in_inc_open bool, in_inc_closed bool) IS
-$$Creates a summary account (no quantities, just parts group by invoice).
-
-meta_number must match exactly or be NULL. inc_open and inc_closed are exact
-matches too. All other values specify ranges or may match partially.$$;
-
DROP FUNCTION IF EXISTS eca__get_taxes(in_credit_id int);
CREATE OR REPLACE FUNCTION eca__get_taxes(in_id int)
Property changes on: trunk/sql/upgrade/1.2-1.3-manual.sql
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4777
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
+ /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4782
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.