[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[5127] trunk
- Subject: SF.net SVN: ledger-smb:[5127] trunk
- From: ..hidden..
- Date: Thu, 06 Sep 2012 09:50:34 +0000
Revision: 5127
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5127&view=rev
Author: einhverfr
Date: 2012-09-06 09:50:34 +0000 (Thu, 06 Sep 2012)
Log Message:
-----------
Payroll income/deduction class search routines
Modified Paths:
--------------
trunk/LedgerSMB/Report/Payroll/Income_Types.pm
trunk/sql/modules/Payroll.sql
Added Paths:
-----------
trunk/LedgerSMB/Report/Payroll/Deduction_Types.pm
Copied: trunk/LedgerSMB/Report/Payroll/Deduction_Types.pm (from rev 5125, trunk/LedgerSMB/Report/Payroll/Income_Types.pm)
===================================================================
--- trunk/LedgerSMB/Report/Payroll/Deduction_Types.pm (rev 0)
+++ trunk/LedgerSMB/Report/Payroll/Deduction_Types.pm 2012-09-06 09:50:34 UTC (rev 5127)
@@ -0,0 +1,132 @@
+=head1 NAME
+
+LedgerSMB::Payroll::Deduction_Types - Deduction Types Searches for LedgerSMB
+
+=head1 SYNPOSIS
+
+ LedgerSMB::Payroll::Deduction_Types->new(%$request)->render(%$request);
+
+=cut
+
+package LedgerSMB::Payroll::Deduction_Types;
+use Moose;
+extends 'LedgerSMB::Payroll';
+
+=head1 DESCRIPTION
+
+This module provides for searching for deduction types.
+
+=head1 CONSTANT METHODS
+
+=over
+
+=item columns
+
+=cut
+
+sub columns {
+ return [
+ { col_id => 'country_name',
+ name => text('Country'),
+ type => 'text',
+ },
+ { col_id => 'deduction_class',
+ name => text('Deduction Class'),
+ type => 'text' },
+ { col_id => 'label',
+ name => text('Label'),
+ type => 'href',
+ href_base => 'payrol.pl?action=edit&id=' },
+ ];
+}
+
+=item header_lines
+
+=cut
+
+sub header_lines {
+ return [];
+}
+
+=item name
+
+=cut
+
+sub name { return text('Deduction Types') }
+
+=back
+
+=head1 CRITERIA PROPERTIES
+
+=over
+
+=item country_id int
+
+Exact match on country id
+
+=cut
+
+has country_id => (is => 'ro', isa => 'Int', required => '0');
+
+=item label string
+
+Matches the beginning of the label
+
+=cut
+
+has label => (is => 'ro', isa => 'Str', required => '0');
+
+=item pdc_id int
+
+Exact match on payroll deduction class id
+
+=cut
+
+has pdc_id => (is => 'ro', isa => 'Int', required => '0');
+
+
+=item account_id int
+
+Exact match of the account id
+
+=cut
+
+has account_id => (is => 'ro', isa => 'Int', required => '0');
+
+
+=item unit string
+
+Exact match on unit
+
+=cut
+
+has unit => (is => 'ro', isa => 'Str', required => '0');
+
+=back
+
+=head1 METHODS
+
+=over
+
+=item run_report
+
+=cut
+
+sub run_report {
+ my ($self) = $_;
+ my @rows = $self->exec_method(funcname => 'payroll_deduction_type__search');
+ $_->{row_id} = $_->{id} for my (@rows);
+ $self->rows(@rows);
+}
+
+=back
+
+=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;
Modified: trunk/LedgerSMB/Report/Payroll/Income_Types.pm
===================================================================
--- trunk/LedgerSMB/Report/Payroll/Income_Types.pm 2012-09-04 09:06:54 UTC (rev 5126)
+++ trunk/LedgerSMB/Report/Payroll/Income_Types.pm 2012-09-06 09:50:34 UTC (rev 5127)
@@ -0,0 +1,132 @@
+=head1 NAME
+
+LedgerSMB::Payroll::Income_Types - Income Types Searches for LedgerSMB
+
+=head1 SYNPOSIS
+
+ LedgerSMB::Payroll::Income_Types->new(%$request)->render(%$request);
+
+=cut
+
+package LedgerSMB::Payroll::Income_Types;
+use Moose;
+extends 'LedgerSMB::Payroll';
+
+=head1 DESCRIPTION
+
+This module provides for searching for income types.
+
+=head1 CONSTANT METHODS
+
+=over
+
+=item columns
+
+=cut
+
+sub columns {
+ return [
+ { col_id => 'country_name',
+ name => text('Country'),
+ type => 'text',
+ },
+ { col_id => 'income_class',
+ name => text('Income Class'),
+ type => 'text' },
+ { col_id => 'label',
+ name => text('Label'),
+ type => 'href',
+ href_base => 'payrol.pl?action=edit&id=' },
+ ];
+}
+
+=item header_lines
+
+=cut
+
+sub header_lines {
+ return [];
+}
+
+=item name
+
+=cut
+
+sub name { return text('Income Types') }
+
+=back
+
+=head1 CRITERIA PROPERTIES
+
+=over
+
+=item country_id int
+
+Exact match on country id
+
+=cut
+
+has country_id => (is => 'ro', isa => 'Int', required => '0');
+
+=item label string
+
+Matches the beginning of the label
+
+=cut
+
+has label => (is => 'ro', isa => 'Str', required => '0');
+
+=item pic_id int
+
+Exact match on payroll income class id
+
+=cut
+
+has pic_id => (is => 'ro', isa => 'Int', required => '0');
+
+
+=item account_id int
+
+Exact match of the account id
+
+=cut
+
+has account_id => (is => 'ro', isa => 'Int', required => '0');
+
+
+=item unit string
+
+Exact match on unit
+
+=cut
+
+has unit => (is => 'ro', isa => 'Str', required => '0');
+
+=back
+
+=head1 METHODS
+
+=over
+
+=item run_report
+
+=cut
+
+sub run_report {
+ my ($self) = $_;
+ my @rows = $self->exec_method(funcname => 'payroll_income_type__search');
+ $_->{row_id} = $_->{id} for my (@rows);
+ $self->rows(@rows);
+}
+
+=back
+
+=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;
Modified: trunk/sql/modules/Payroll.sql
===================================================================
--- trunk/sql/modules/Payroll.sql 2012-09-04 09:06:54 UTC (rev 5126)
+++ trunk/sql/modules/Payroll.sql 2012-09-06 09:50:34 UTC (rev 5127)
@@ -115,4 +115,32 @@
END;
$$ LANGUAGE PLPGSQL;
+CREATE OR REPLACE FUNCTION payroll_income_type__search
+(in_account_id int, in_pic_id int, in_country_id int, in_label text,
+in_unit text) RETURNS SETOF payroll_income_type
+LANGUAGE SQL STABLE AS
+$$
+SELECT *
+ FROM payroll_income_type
+ where (account_id = $1 OR $1 IS NULL) AND
+ (pic_id = $2 OR $2 IS NULL) AND
+ (country_id = $3 OR $3 IS NULL) AND
+ ($4 IS NULL OR label LIKE $4 || '%') AND
+ (unit = $5 or $5 IS NULL);
+$$;
+
+CREATE OR REPLACE FUNCTION payroll_deduction_type__search
+(in_account_id int, in_pdc_id int, in_country_id int, in_label text,
+in_unit text) RETURNS SETOF payroll_deduction_type
+LANGUAGE SQL STABLE AS
+$$
+SELECT *
+ FROM payroll_deduction_type
+ where (account_id = $1 OR $1 IS NULL) AND
+ (pdc_id = $2 OR $2 IS NULL) AND
+ (country_id = $3 OR $3 IS NULL) AND
+ ($4 IS NULL OR label LIKE $4 || '%') AND
+ (unit = $5 or $5 IS NULL);
+$$;
+
COMMIT;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.