[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4850] trunk



Revision: 4850
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4850&view=rev
Author:   einhverfr
Date:     2012-06-06 09:20:54 +0000 (Wed, 06 Jun 2012)
Log Message:
-----------
Draft search to new reporting framework

Modified Paths:
--------------
    trunk/LedgerSMB/Scripts/drafts.pm
    trunk/UI/Reports/display_report.html
    trunk/templates/demo/sales_quotation.tex

Added Paths:
-----------
    trunk/LedgerSMB/DBObject/Report/Unapproved/
    trunk/LedgerSMB/DBObject/Report/Unapproved/Drafts.pm

Property Changed:
----------------
    trunk/
    trunk/LedgerSMB/Scripts/account.pm
    trunk/LedgerSMB/Scripts/admin.pm
    trunk/LedgerSMB/Scripts/contact.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/sql/upgrade/1.2-1.3-manual.sql


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3:3711-4844
   + /branches/1.3:3711-4848

Added: trunk/LedgerSMB/DBObject/Report/Unapproved/Drafts.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/Unapproved/Drafts.pm	                        (rev 0)
+++ trunk/LedgerSMB/DBObject/Report/Unapproved/Drafts.pm	2012-06-06 09:20:54 UTC (rev 4850)
@@ -0,0 +1,226 @@
+=head1 NAME
+
+LedgerSMB::DBObject::Report::Unapproved::Drafts - Unapproved Drafts (single 
+transactions) in LedgerSMB
+
+=head1 SYNPOSIS
+
+  my $report = LedgerSMB::DBObject::Report::Unapproved::Drafts->new(%$request);
+  $report->run;
+  $report->render($request, $format);
+
+=head1 DESCRIPTION
+
+This provides an ability to search for (and approve or delete) pending
+transactions.  
+
+=head1 INHERITS
+
+=over
+
+=item LedgerSMB::DBObject::Report;
+
+=back
+
+=cut
+
+package LedgerSMB::DBObject::Report::Unapproved::Drafts;
+use Moose;
+extends 'LedgerSMB::DBObject::Report';
+
+use LedgerSMB::DBObject::Business_Unit_Class;
+use LedgerSMB::DBObject::Business_Unit;
+use LedgerSMB::App_State;
+
+my $locale = $LedgerSMB::App_State::Locale;
+
+=head1 PROPERTIES
+
+=over
+
+=item columns
+
+Read-only accessor, returns a list of columns.
+
+=over
+
+=item select
+
+Select boxes for selecting the returned items.
+
+=item id
+
+ID of transaction
+
+=item transdate
+
+Post date of transaction
+
+=item reference text
+
+Invoice number or GL reference
+
+=item description
+
+Description of transaction
+
+=item amount
+
+Amount
+
+=back
+
+=cut
+
+our @COLUMNS = (
+    {col_id => 'select',
+       name => '',
+       type => 'checkbox' },
+
+    {col_id => 'id',
+       name => $locale->text('ID'),
+       type => 'text',
+     pwidth => 1, },
+
+    {col_id => 'transdate',
+       name => $locale->text('Date'),
+       type => 'text',
+     pwidth => '4', },
+
+    {col_id => 'reference',
+       name => $locale->text('Reference'),
+       type => 'href',
+  href_base => '',
+     pwidth => '3', },
+
+    {col_id => 'description',
+       name => $locale->text('Description'),
+       type => 'text',
+     pwidth => '6', },
+
+    {col_id => 'amount',
+       name => $locale->text('AR/AP/GL Amount'),
+       type => 'text',
+     pwidth => '2', },
+
+);
+
+sub columns {
+    return ..hidden..;
+}
+
+    # TODO:  business_units int[]
+
+=item name
+
+Returns the localized template name
+
+=cut
+
+sub name {
+    return $locale->text('Draft Search');
+}
+
+=item header_lines
+
+Returns the inputs to display on header.
+
+=cut
+
+sub header_lines {
+    return [{name => 'type',
+             text => $locale->text('Draft Type')},
+            {name => 'reference',
+             text => $locale->text('Reference')},
+            {name => 'amount_gt',
+             text => $locale->text('Amount Greater Than')},
+            {name => 'amount_lt',
+             text => $locale->text('Amount Less Than')}, ]
+}
+
+=item subtotal_cols
+
+Returns list of columns for subtotals
+
+=cut
+
+sub subtotal_cols {
+    return [];
+}
+
+=head2 Criteria Properties
+
+Note that in all cases, undef matches everything.
+
+=item reference (text)
+
+Exact match on reference or invoice number.
+
+=cut
+
+has 'reference' => (is => 'rw', isa => 'Maybe[Str]');
+
+=item type
+
+ar for AR drafts, ap for AP drafts, gl for GL ones.
+
+=cut
+
+has 'type' => (is => 'rw', isa => 'Maybe[Str]');
+
+=item amount_gt
+
+The amount of the draft must be greater than this for it to show up.
+
+=cut
+
+has 'amount_gt' => (is => 'rw', isa => 'Maybe[Str]');
+
+=item amount_lt
+
+The amount of the draft must be less than this for it to show up.
+
+=cut
+
+has 'amount_lt' => (is => 'rw', isa => 'Maybe[Str]');
+
+=back
+
+=head1 METHODS
+
+=over
+
+=item prepare_criteria($request)
+
+Instantiates the PGDate and PGNumber inputs.
+
+=cut
+
+sub prepare_criteria{
+    my ($self, $request) = @_;
+}
+
+=item run_report()
+
+Runs the report, and assigns rows to $self->rows.
+
+=cut
+
+sub run_report{
+    my ($self) = @_;
+    my @rows = $self->exec_method({funcname => 'draft__search'});
+    # TODO:  Add URL handling
+    $self->rows(..hidden..);
+}
+
+
+=head1 COPYRIGHT
+
+COPYRIGHT (C) 2012 The LedgerSMB Core Team.  This file may be re-used following
+the terms of the GNU General Public License version 2 or at your option any
+later version.  Please see included LICENSE.TXT for details.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;
+return 1;


Property changes on: trunk/LedgerSMB/Scripts/account.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/account.pm:3712-4844
/branches/1.3/scripts/account.pl:3711-4368
   + /branches/1.3/LedgerSMB/Scripts/account.pm:3712-4848
/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:3712-4844
/branches/1.3/scripts/admin.pl:3711-4678
   + /branches/1.3/LedgerSMB/Scripts/admin.pm:3712-4848
/branches/1.3/scripts/admin.pl:3711-4678


Property changes on: trunk/LedgerSMB/Scripts/contact.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/contact.pm:4783-4844
/branches/1.3/LedgerSMB/Scripts/customer.pm:3712-4782
/branches/1.3/scripts/customer.pl:4273-4287
   + /branches/1.3/LedgerSMB/Scripts/contact.pm:4783-4848
/branches/1.3/LedgerSMB/Scripts/customer.pm:3712-4782
/branches/1.3/scripts/customer.pl:4273-4287

Modified: trunk/LedgerSMB/Scripts/drafts.pm
===================================================================
--- trunk/LedgerSMB/Scripts/drafts.pm	2012-06-06 08:34:56 UTC (rev 4849)
+++ trunk/LedgerSMB/Scripts/drafts.pm	2012-06-06 09:20:54 UTC (rev 4850)
@@ -144,112 +144,10 @@
 
 sub list_drafts {
     my ($request) = @_;
-    $request->{action} = 'list_drafts';
-    my $draft= LedgerSMB::DBObject::Draft->new(base => $request);
-    $draft->close_form;
-    $draft->open_form({commit => 1});
-    my $callback = 'drafts.pl?action=list_drafts';
-    for (qw(type reference amount_gy amount_lt)){
-        if (defined $draft->{$_}){
-            $callback .= "&$_=$draft->{$_}";
-        }
-    }
-    if ($draft->{order_by}){
-        $draft->set_ordering(
-		{method => 'draft__search', 
-		 column => $draft->{order_by}}
-        );
-    }
-    my @search_results = $draft->search;
-    $draft->{script} = "drafts.pl";
-    $draft->{callback} = $draft->escape(string => $callback);
-    my @columns = 
-        qw(select id transdate reference description amount);
-
-    my $base_href = "drafts.pl";
-    my $search_href = "$base_href?action=list_drafts";
-    my $draft_href= "$base_href?action=get_transaction";
-
-    for my $key (
-       qw(type approved created_by description amount_gt amount_lt)
-    ){
-       $search_href .= "&$key=$draft->{$key}";
-    }
-
-    my $column_names = {
-        'select' => 'Select',
-         amount =>  'AR/AP/GL Total',
-         description => 'Description',
-         id => 'ID',
-         reference => 'Reference',
-         transdate => 'Date'
-    };
-    my $sort_href = "$search_href&order_by";
-    my @sort_columns = qw(id transdate reference description amount);
-    
-    my $count = 0;
-    my @rows;
-    for my $result (@search_results){
-        ++$count;
-        $draft->{"row_$count"} = $result->{id};
-        push @rows, {
-            'select'          => {
-                                 input => {
-                                           type  => 'checkbox',
-                                           value => 1,
-                                           name  => "draft_$result->{id}"
-                                 }
-            },
-            amount => $draft->format_amount(
-                                     amount => $result->{amount}
-				),
-            reference => { 
-                  text => $result->{reference},
-                  href => "$request->{type}.pl?action=edit&id=$result->{id}" .
-				"&callback=$draft->{callback}",
-            },
-            description => $result->{description},
-            transdate => $result->{transdate},
-            id => $result->{id},
-        };
-    }
-    $draft->{rowcount} = $count;
-    my $template = LedgerSMB::Template->new(
-        user     => $request->{_user},
-        locale   => $request->{_locale},
-        path     => 'UI',
-        template => 'form-dynatable',
-        format   => ($draft->{format}) ? $draft->{format} : 'HTML', 
-    );
-
-    my $hiddens = $draft->take_top_level();
-    $draft->{rowcount} = "$count";
-    delete $draft->{search_results};
-
-    my $column_heading = $template->column_heading($column_names,
-        {href => $sort_href, columns => ..hidden..
-    );
-
-    $template->render({ 
-	form    => $draft,
-	columns => ..hidden..,
-	heading => $column_heading,
-        rows    => ..hidden..,
-        hiddens => $hiddens,
-        buttons => [{
-                    name  => 'action',
-                    type  => 'submit',
-                    text  => $request->{_locale}->text('Post'),
-                    value => 'draft_approve',
-                    class => 'submit',
-		},{
-                    name  => 'action',
-                    type  => 'submit',
-                    text  => $request->{_locale}->text('Delete'),
-                    value => 'draft_delete',
-                    class => 'submit',
-               }]
-    });
+    use LedgerSMB::DBObject::Report::Unapproved::Drafts;
+    my $report = LedgerSMB::DBObject::Report::Unapproved::Drafts->new(%$request);
+    $report->run_report;
+    $report->render;
 }
 
 =back


Property changes on: trunk/LedgerSMB/Scripts/employee.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4844
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310
   + /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4848
/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-4844
/branches/1.3/scripts/file.pl:3711-4138
   + /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4848
/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:3712-4844
/branches/1.3/scripts/journal.pl:3711-4328
   + /branches/1.3/LedgerSMB/Scripts/journal.pm:3712-4848
/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:3712-4844
/branches/1.3/scripts/login.pl:3711-4192
   + /branches/1.3/LedgerSMB/Scripts/login.pm:3712-4848
/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:3712-4844
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/menu.pm:3712-4848
/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:3712-4844
/branches/1.3/scripts/payment.pl:3711-4680
   + /branches/1.3/LedgerSMB/Scripts/payment.pm:3712-4848
/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-4844
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438
   + /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4848
/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:3712-4844
/branches/1.3/scripts/setup.pl:3711-4550
   + /branches/1.3/LedgerSMB/Scripts/setup.pm:3712-4848
/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:3712-4844
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/taxform.pm:3712-4848
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287

Modified: trunk/UI/Reports/display_report.html
===================================================================
--- trunk/UI/Reports/display_report.html	2012-06-06 08:34:56 UTC (rev 4849)
+++ trunk/UI/Reports/display_report.html	2012-06-06 09:20:54 UTC (rev 4850)
@@ -31,12 +31,17 @@
             ?></span>
 </div>
 <?lsmb END ?>
-<?lsmb PROCESS dynatable tbody = {rows => rows } 
+<form method="post" action="<?lsmb ENVARS.SCRIPT_NAME ?>">
+<?lsmb PROCESS dynatable tbody = {rows = rows } 
                attributes = {class = 'report', order_url = order_url } ?>
 
-<a href="<?lsmb LINK ?>">[<?lsmb text('permalink') ?>]</a>&nbsp;
 <?lsmb IF FORMATS.grep('PDF').size()
 ?>
+<?lsmb 
+FOREACH BUTTON IN buttons;
+  PROCESS button element_data = BUTTON;
+END; ?><br />
+<a href="<?lsmb LINK ?>">[<?lsmb text('permalink') ?>]</a>&nbsp;
 <a href="<?lsmb LINK _ '&format=PDF' ?>">[<?lsmb text('PDF') ?>]</a>&nbsp;
 <?lsmb END;
 IF FORMATS.grep('TXT').size();


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-4844
/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-4848
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710

Modified: trunk/templates/demo/sales_quotation.tex
===================================================================
--- trunk/templates/demo/sales_quotation.tex	2012-06-06 08:34:56 UTC (rev 4849)
+++ trunk/templates/demo/sales_quotation.tex	2012-06-06 09:20:54 UTC (rev 4850)
@@ -92,12 +92,16 @@
 <?lsmb FOREACH number ?>
 <?lsmb lc = loop.count - 1 ?>
   <?lsmb number.${lc} ?> &
-  <?lsmb description.${lc} ?> &
+\begin{minipage}{4in}
+\raggedright
+  <?lsmb description.${lc} ?> 
+\end{minipage}&
   <?lsmb qty.${lc} ?> &
   <?lsmb unit.${lc} ?> &
   <?lsmb sellprice.${lc} ?> &
   <?lsmb discountrate.${lc} ?> &
   <?lsmb linetotal.${lc} ?> \\
+ & & & & & \\
 <?lsmb END ?>
 \hline \hline
 \multicolumn{6}{r|}{<?lsmb text('Subtotal') ?>} & <?lsmb subtotal ?> \\*

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.