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

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



Revision: 5368
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5368&view=rev
Author:   einhverfr
Date:     2012-12-16 15:23:23 +0000 (Sun, 16 Dec 2012)
Log Message:
-----------
Beginnings of payments/receipts report class (will be moving these reports, and the reversal processes, over to the new framework before beta 2, but for now this code is unaccessed

Modified Paths:
--------------
    trunk/LedgerSMB/Scripts/payment.pm

Added Paths:
-----------
    trunk/LedgerSMB/Report/Invoices/Payments.pm
    trunk/UI/Reports/filters/payments.html

Removed Paths:
-------------
    trunk/UI/payments/search.html

Added: trunk/LedgerSMB/Report/Invoices/Payments.pm
===================================================================
--- trunk/LedgerSMB/Report/Invoices/Payments.pm	                        (rev 0)
+++ trunk/LedgerSMB/Report/Invoices/Payments.pm	2012-12-16 15:23:23 UTC (rev 5368)
@@ -0,0 +1,104 @@
+=head1 NAME
+
+LedgerSMB::Report::Invoices::Payments - Payment Search Report for LedgerSMB
+
+=head1 SYNPOSIS
+
+ my $report = LedgerSMB::Report::Invoices::Payments->new(%$request);
+ $report->render($request);
+
+=cut
+
+package LedgerSMB::Report::Invoices::Payments;
+use Moose;
+extends 'LedgerSMB::Report';
+with 'LedgerSMB::Report::Dates';
+
+=head1 DESCRIPTION
+
+This class provides routines for searching payments and displaying the report in
+the standard supported reporting formats.
+
+=head1 CRITERIA PROPERTIES
+
+=over
+
+=item meta_number
+
+Customer or vendor account number, prefix search
+
+=cut
+
+has meta_number => (is => 'ro', isa => 'Str', required => '0');
+
+=item cash_account_id
+
+Account id, exact match
+
+=cut
+
+has cash_account_id => (is => 'ro', isa => 'Int', required => 1);
+
+=item source
+
+Source field, prefix search
+
+=cut
+
+has source => (is => 'ro', isa => 'Str', required => '0');
+
+=back
+
+=head1 ACTION PROPERTIES
+
+This report is sometimes used when searching for payments to reverse payments.
+We allow related data to be set here.  This is to be passed on to the next
+stage of the reversal process.
+
+=over
+
+=item batch_id
+
+ID of batch used.  If this is not set we assume we are not reversing payments.
+
+=cut
+
+has batch_id => (is => 'ro', isa => 'Int', required => '0');
+
+=item curr
+
+Currency used.  If not set, we assume that this is the default currency (and
+exchange rate of 1).
+
+=cut
+
+has curr => (is => 'ro', isa => 'Str', required => '0');
+
+=item exchange_rate
+
+Exchange rate for reversal.  If not set, we use 1 if the currency is the default
+currency.  If not, we pull the existing exchange rate for the reversal date, 
+and if this is not set, an error will be returned during the reversal process.
+
+=cut 
+
+has exchange_rate => (is => 'ro', isa => 'LedgerSMB::Moose::Number', 
+                required => 0, coerce => 1);
+
+=back
+
+=head1 INTERNALS
+
+=head2 columns
+
+=head2 header_lines
+
+=head2 name
+
+=head1 METHODS
+
+=head1 COPYRIGHT
+
+=cut
+
+__PACKAGE__->meta->make_immutable;

Modified: trunk/LedgerSMB/Scripts/payment.pm
===================================================================
--- trunk/LedgerSMB/Scripts/payment.pm	2012-12-15 15:33:56 UTC (rev 5367)
+++ trunk/LedgerSMB/Scripts/payment.pm	2012-12-16 15:23:23 UTC (rev 5368)
@@ -50,6 +50,7 @@
 use LedgerSMB::Sysconfig;
 use LedgerSMB::DBObject::Payment;
 use LedgerSMB::DBObject::Date;
+use LedgerSMB::Scripts::reports;
 use Error::Simple;
 use Error;
 use strict; 
@@ -112,14 +113,8 @@
         $payment->{date_reversed} = $payment->{batch_date};
     }
     @{$payment->{currencies}} = $payment->get_open_currencies();
-    my $template = LedgerSMB::Template->new(
-        user     => $request->{_user},
-        locale   => $request->{_locale},
-        path     => 'UI/payments',
-        template => 'search',
-        format   => 'HTML', 
-    );
-    $template->render($payment);
+    $payment->{report_name} = 'payments';
+    LedgerSMB::Scripts::reports::start_report($payment);
 }
 
 =item pre_bulk_post_report 

Copied: trunk/UI/Reports/filters/payments.html (from rev 5367, trunk/UI/payments/search.html)
===================================================================
--- trunk/UI/Reports/filters/payments.html	                        (rev 0)
+++ trunk/UI/Reports/filters/payments.html	2012-12-16 15:23:23 UTC (rev 5368)
@@ -0,0 +1,134 @@
+<?lsmb INCLUDE 'ui-header.html'
+                stylesheet = stylesheet
+		include_stylesheet = [
+			'css/global.css' 
+			'UI/payments/payments.css'
+		]
+		titlebar = text('Search Payments') # '
+?><?lsmb PROCESS 'elements.html' ?>
+<body>
+<?lsmb IF    account_class == 2 ?><?lsmb contact_type = "Customer" -?>
+<?lsmb ELSIF account_class == 1 ?><?lsmb contact_type = "Vendor" -?>
+<?lsmb ELSE ?><?lsmb contact_type = "Unsupported" -?>
+<?lsmb END # if account_class -?>
+<!-- CT: Text strings for localization:
+	<?lsmb text('Customer Number') ?>
+	<?lsmb text('Vendor Number') ?>
+	<?lsmb text('Unsupported Number') ?>
+-->
+<form action="payment.pl" method="get" name="main_form" 
+	id="payment_search_form">
+	<?lsmb INCLUDE input element_data = {
+		type  = "hidden"
+		name  = "batch_id"
+		value = batch_id
+	} ?>
+	<?lsmb INCLUDE input element_data = {
+		type  = "hidden"
+		name  = "account_class"
+		value = account_class
+	} ?>
+<div class="listtop" id="page_title"><?lsmb text('Search Payments') ?></div>
+<div class="input" id="vendor_input_div">
+	<?lsmb INCLUDE input element_data = {
+		name  = "meta_number"
+		value = meta_number
+		class = "text"
+		type  = "text"
+		size  = "20"
+		label = text("$contact_type Number") # "
+	} ?><!-- CT:  Not yet working for search.
+	<?lsmb INCLUDE input element_data = {
+		name  = "name"
+		value = name
+		class = "text"
+		type  = "text"
+		size  = "20"
+		label = text('Name')
+	} ?> --></div>
+<div class="input" id="account_input_div">
+	<?lsmb INCLUDE select element_data = {
+		name           = "cash_accno"
+		options        = cash_accounts
+		default_values = [cash_accno]
+		class          = "account"
+                value_attr     = "accno"
+		label          = text('Cash Account') # '
+	} ?></div>
+<div class="input" id="source_input_div">
+	<?lsmb INCLUDE input element_data = {
+		name  = "source"
+		value = source
+		class = "text"
+		type  = "text"
+		size  = "20"
+		label = text('Source')
+	} ?></div>
+<div class="input" id="date_input_div">
+	<?lsmb INCLUDE input element_data = {
+		name  = "date_from"
+		value = date_from
+		class = "date"
+		type  = "text"
+		size  = "20"
+		label = text('From Date') # '
+	} ?>
+	<?lsmb INCLUDE input element_data = {
+		name  = "date_to"
+		value = date_to
+		class = "date"
+		type  = "text"
+		size  = "20"
+		label = text('Through Date') # '
+	} ?></div>
+<?lsmb IF ! search_only ?>
+<div class="listtop"><?lsmb text('Payment Reversal Information') ?></div>
+<div class="input">
+ 	<?lsmb IF batch_id -?>
+	<label for="batch_post_span"><?lsmb text('Date Reversed') ?></label>
+	<span id="batch_post_span"><?lsmb date_reversed ?></span>
+	<?lsmb INCLUDE input element_data = {
+		type  = "hidden"
+		value = date_reversed
+		name  = "date_reversed"
+	} ?>
+	<?lsmb ELSE -?>
+	<?lsmb INCLUDE input element_data = {
+		name  = "date_reversed"
+		value = date_reversed
+		type  = "text"
+		size  = "20"
+		class = "date"
+		label = text('Date Reversed') # '
+	} ?>
+	<?lsmb END # if batch_id ?></div>
+<div class="input" id="curr-exchange-div">
+      <?lsmb INCLUDE select element_data = {
+              name = 'currency'
+           options = currencies
+         text_attr = 'payments_get_open_currencies'
+        value_attr = 'payments_get_open_currencies'
+  default_optiopns = [default_currency]
+             label = text('Currency')
+      } ?>
+      <?lsmb INCLUDE input element_data = {
+             label = text('Exchange Rate') #'
+              type = 'text'
+              size = 10
+              name = 'exchangerate'
+             value = exchangerate
+             class = 'fxrate'
+      } ?>
+</div>
+<?lsmb END # if ! search_only -?>
+<div class="input" id="search_button_div">
+	<?lsmb INCLUDE button element_data = {
+		name  = "action"
+		type  = "submit"
+		class = "submit"
+		value = "get_search_results"
+		text  = text('Search')
+	} ?></div>
+</form>
+</body>
+</html>

Deleted: trunk/UI/payments/search.html
===================================================================
--- trunk/UI/payments/search.html	2012-12-15 15:33:56 UTC (rev 5367)
+++ trunk/UI/payments/search.html	2012-12-16 15:23:23 UTC (rev 5368)
@@ -1,134 +0,0 @@
-<?lsmb INCLUDE 'ui-header.html'
-                stylesheet = stylesheet
-		include_stylesheet = [
-			'css/global.css' 
-			'UI/payments/payments.css'
-		]
-		titlebar = text('Search Payments') # '
-?><?lsmb PROCESS 'elements.html' ?>
-<body>
-<?lsmb IF    account_class == 2 ?><?lsmb contact_type = "Customer" -?>
-<?lsmb ELSIF account_class == 1 ?><?lsmb contact_type = "Vendor" -?>
-<?lsmb ELSE ?><?lsmb contact_type = "Unsupported" -?>
-<?lsmb END # if account_class -?>
-<!-- CT: Text strings for localization:
-	<?lsmb text('Customer Number') ?>
-	<?lsmb text('Vendor Number') ?>
-	<?lsmb text('Unsupported Number') ?>
--->
-<form action="payment.pl" method="get" name="main_form" 
-	id="payment_search_form">
-	<?lsmb INCLUDE input element_data = {
-		type  = "hidden"
-		name  = "batch_id"
-		value = batch_id
-	} ?>
-	<?lsmb INCLUDE input element_data = {
-		type  = "hidden"
-		name  = "account_class"
-		value = account_class
-	} ?>
-<div class="listtop" id="page_title"><?lsmb text('Search Payments') ?></div>
-<div class="input" id="vendor_input_div">
-	<?lsmb INCLUDE input element_data = {
-		name  = "meta_number"
-		value = meta_number
-		class = "text"
-		type  = "text"
-		size  = "20"
-		label = text("$contact_type Number") # "
-	} ?><!-- CT:  Not yet working for search.
-	<?lsmb INCLUDE input element_data = {
-		name  = "name"
-		value = name
-		class = "text"
-		type  = "text"
-		size  = "20"
-		label = text('Name')
-	} ?> --></div>
-<div class="input" id="account_input_div">
-	<?lsmb INCLUDE select element_data = {
-		name           = "cash_accno"
-		options        = cash_accounts
-		default_values = [cash_accno]
-		class          = "account"
-                value_attr     = "accno"
-		label          = text('Cash Account') # '
-	} ?></div>
-<div class="input" id="source_input_div">
-	<?lsmb INCLUDE input element_data = {
-		name  = "source"
-		value = source
-		class = "text"
-		type  = "text"
-		size  = "20"
-		label = text('Source')
-	} ?></div>
-<div class="input" id="date_input_div">
-	<?lsmb INCLUDE input element_data = {
-		name  = "date_from"
-		value = date_from
-		class = "date"
-		type  = "text"
-		size  = "20"
-		label = text('From Date') # '
-	} ?>
-	<?lsmb INCLUDE input element_data = {
-		name  = "date_to"
-		value = date_to
-		class = "date"
-		type  = "text"
-		size  = "20"
-		label = text('Through Date') # '
-	} ?></div>
-<?lsmb IF ! search_only ?>
-<div class="listtop"><?lsmb text('Payment Reversal Information') ?></div>
-<div class="input">
- 	<?lsmb IF batch_id -?>
-	<label for="batch_post_span"><?lsmb text('Date Reversed') ?></label>
-	<span id="batch_post_span"><?lsmb date_reversed ?></span>
-	<?lsmb INCLUDE input element_data = {
-		type  = "hidden"
-		value = date_reversed
-		name  = "date_reversed"
-	} ?>
-	<?lsmb ELSE -?>
-	<?lsmb INCLUDE input element_data = {
-		name  = "date_reversed"
-		value = date_reversed
-		type  = "text"
-		size  = "20"
-		class = "date"
-		label = text('Date Reversed') # '
-	} ?>
-	<?lsmb END # if batch_id ?></div>
-<div class="input" id="curr-exchange-div">
-      <?lsmb INCLUDE select element_data = {
-              name = 'currency'
-           options = currencies
-         text_attr = 'payments_get_open_currencies'
-        value_attr = 'payments_get_open_currencies'
-  default_optiopns = [default_currency]
-             label = text('Currency')
-      } ?>
-      <?lsmb INCLUDE input element_data = {
-             label = text('Exchange Rate') #'
-              type = 'text'
-              size = 10
-              name = 'exchangerate'
-             value = exchangerate
-             class = 'fxrate'
-      } ?>
-</div>
-<?lsmb END # if ! search_only -?>
-<div class="input" id="search_button_div">
-	<?lsmb INCLUDE button element_data = {
-		name  = "action"
-		type  = "submit"
-		class = "submit"
-		value = "get_search_results"
-		text  = text('Search')
-	} ?></div>
-</form>
-</body>
-</html>

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