Revision e2e5606d
Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt
SL/Presenter/Record.pm | ||
---|---|---|
|
||
use SL::Presenter;
|
||
use SL::Presenter::EscapedText qw(escape is_escaped);
|
||
use SL::Presenter::Tag qw(html_tag);
|
||
|
||
use Exporter qw(import);
|
||
our @EXPORT_OK = qw(grouped_record_list empty_record_list record_list record);
|
||
... | ... | |
use Carp;
|
||
use List::Util qw(first);
|
||
|
||
my @ORDERED_TYPES = qw(
|
||
requirement_spec
|
||
shop_order
|
||
sales_quotation
|
||
sales_order_intake
|
||
sales_order
|
||
sales_delivery_order
|
||
rma_delivery_order
|
||
sales_reclamation
|
||
sales_invoice
|
||
ar_transaction
|
||
request_quotation
|
||
purchase_quotation_intake
|
||
purchase_order
|
||
purchase_delivery_order
|
||
supplier_delivery_order
|
||
purchase_reclamation
|
||
purchase_invoice
|
||
ap_transaction
|
||
gl_transaction
|
||
bank_transaction
|
||
sepa_collection
|
||
sepa_transfer
|
||
letter
|
||
email_journal
|
||
dunning
|
||
);
|
||
|
||
my %TYPE_TO_PARAMS = (
|
||
# sub gets other params as arguments to override if needed
|
||
# has to encoupsulated in a sub for evaluation of locale translations
|
||
requirement_spec => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Requirement specs'),
|
||
type => 'requirement_spec',
|
||
columns => [
|
||
[ $::locale->text('Requirement spec number'), sub { $_[0]->presenter->requirement_spec(display => 'table-cell') } ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Title'), 'title' ],
|
||
[ $::locale->text('Project'), 'project', ],
|
||
[ $::locale->text('Status'), sub { $_[0]->status->description } ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
shop_order => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Shop Orders'),
|
||
type => 'shop_order',
|
||
columns => [
|
||
[ $::locale->text('Shop Order Date'), sub { $_[0]->order_date->to_kivitendo } ],
|
||
[ $::locale->text('Shop Order Number'), sub { $_[0]->presenter->shop_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Transfer Date'), 'transfer_date' ],
|
||
[ $::locale->text('Amount'), 'amount' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
sales_quotation => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Sales Quotations'),
|
||
type => 'sales_quotation',
|
||
columns => [
|
||
[ $::locale->text('Quotation Date'), 'transdate' ],
|
||
[ $::locale->text('Quotation Number'), sub { $_[0]->presenter->sales_quotation(display => 'table-cell') } ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
request_quotation => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Request Quotations'),
|
||
type => 'request_quotation',
|
||
columns => [
|
||
[ $::locale->text('Quotation Date'), 'transdate' ],
|
||
[ $::locale->text('Quotation Number'), sub { $_[0]->presenter->request_quotation(display => 'table-cell') } ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
purchase_quotation_intake => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Purchase Quotation Intakes'),
|
||
type => 'purchase_quotation_intake',
|
||
columns => [
|
||
[ $::locale->text('Quotation Date'), 'transdate' ],
|
||
[ $::locale->text('Quotation Number'), sub { $_[0]->presenter->purchase_quotation_intake(display => 'table-cell') } ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
sales_order_intake => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Sales Order Intakes'),
|
||
type => 'sales_order_intake',
|
||
columns => [
|
||
[ $::locale->text('Order Date'), 'transdate' ],
|
||
[ $::locale->text('Order Number'), sub { $_[0]->presenter->sales_order_intake(display => 'table-cell') } ],
|
||
[ $::locale->text('Quotation'), 'quonumber' ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
sales_order => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Sales Orders'),
|
||
type => 'sales_order',
|
||
columns => [
|
||
[ $::locale->text('Order Date'), 'transdate' ],
|
||
[ $::locale->text('Order Number'), sub { $_[0]->presenter->sales_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Quotation'), 'quonumber' ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
purchase_order => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Purchase Orders'),
|
||
type => 'purchase_order',
|
||
columns => [
|
||
[ $::locale->text('Order Date'), 'transdate' ],
|
||
[ $::locale->text('Order Number'), sub { $_[0]->presenter->purchase_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Request for Quotation'), 'quonumber' ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
sales_delivery_order => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Sales Delivery Orders'),
|
||
type => 'sales_delivery_order',
|
||
columns => [
|
||
[ $::locale->text('Delivery Order Date'), 'transdate' ],
|
||
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->sales_delivery_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Order Number'), 'ordnumber' ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Delivered'), 'delivered' ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
rma_delivery_order => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('RMA Delivery Orders'),
|
||
type => 'rma_delivery_order',
|
||
columns => [
|
||
[ $::locale->text('Delivery Order Date'), 'transdate' ],
|
||
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->rma_delivery_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Order Number'), 'ordnumber' ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Delivered'), 'delivered' ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
purchase_delivery_order => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Purchase Delivery Orders'),
|
||
type => 'purchase_delivery_order',
|
||
columns => [
|
||
[ $::locale->text('Delivery Order Date'), 'transdate' ],
|
||
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->purchase_delivery_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Order Number'), 'ordnumber' ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Delivered'), 'delivered' ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
supplier_delivery_order => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Supplier Delivery Orders'),
|
||
type => 'supplier_delivery_order',
|
||
columns => [
|
||
[ $::locale->text('Delivery Order Date'), 'transdate' ],
|
||
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->supplier_delivery_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Order Number'), 'ordnumber' ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Delivered'), 'delivered' ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
sales_reclamation => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Sales Reclamations'),
|
||
type => 'sales_reclamation',
|
||
columns => [
|
||
[ $::locale->text('Reclamation Date'), 'transdate' ],
|
||
[ $::locale->text('Reclamation Number'), sub { $_[0]->presenter->sales_reclamation(display => 'table-cell') } ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Delivered'), 'delivered' ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
purchase_reclamation => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Purchase Reclamations'),
|
||
type => 'purchase_reclamation',
|
||
columns => [
|
||
[ $::locale->text('Reclamation Date'), 'transdate' ],
|
||
[ $::locale->text('Reclamation Number'), sub { $_[0]->presenter->purchase_reclamation(display => 'table-cell') } ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Delivered'), 'delivered' ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
sales_invoice => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Sales Invoices'),
|
||
type => 'sales_invoice',
|
||
columns => [
|
||
[ $::locale->text('Invoice Date'), 'transdate' ],
|
||
[ $::locale->text('Type'), sub { $_[0]->displayable_type } ],
|
||
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->sales_invoice(display => 'table-cell') } ],
|
||
[ $::locale->text('Quotation Number'), 'quonumber' ],
|
||
[ $::locale->text('Order Number'), 'ordnumber' ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Paid'), 'paid' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
purchase_invoice => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Purchase Invoices'),
|
||
type => 'purchase_invoice',
|
||
columns => [
|
||
[ $::locale->text('Invoice Date'), 'transdate' ],
|
||
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->purchase_invoice(display => 'table-cell') } ],
|
||
[ $::locale->text('Request for Quotation Number'), 'quonumber' ],
|
||
[ $::locale->text('Order Number'), 'ordnumber' ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Paid'), 'paid' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
ar_transaction => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('AR Transactions'),
|
||
type => 'ar_transaction',
|
||
columns => [
|
||
[ $::locale->text('Invoice Date'), 'transdate' ],
|
||
[ $::locale->text('Type'), sub { $_[0]->displayable_type } ],
|
||
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->ar_transaction(display => 'table-cell') } ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Paid'), 'paid' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
ap_transaction => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('AP Transactions'),
|
||
type => 'ap_transaction',
|
||
columns => [
|
||
[ $::locale->text('Invoice Date'), 'transdate' ],
|
||
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->ap_transaction(display => 'table-cell') } ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Paid'), 'paid' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
gl_transaction => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('GL Transactions'),
|
||
type => 'gl_transaction',
|
||
columns => [
|
||
[ $::locale->text('Transdate'), 'transdate' ],
|
||
[ $::locale->text('Reference'), 'reference' ],
|
||
[ $::locale->text('Description'), sub { $_[0]->presenter->gl_transaction(display => 'table-cell') } ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
bank_transaction => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Bank transactions'),
|
||
type => 'bank_transactions',
|
||
columns => [
|
||
[ $::locale->text('Transdate'), 'transdate' ],
|
||
[ $::locale->text('Local Bank Code'), sub { $_[0]->local_bank_account->presenter->bank_code } ],
|
||
[ $::locale->text('Local account number'), sub { $_[0]->local_bank_account->presenter->account_number } ],
|
||
[ $::locale->text('Remote Bank Code'), 'remote_bank_code' ],
|
||
[ $::locale->text('Remote account number'),'remote_account_number' ],
|
||
[ $::locale->text('Valutadate'), 'valutadate' ],
|
||
[ $::locale->text('Amount'), 'amount' ],
|
||
[ $::locale->text('Currency'), sub { $_[0]->currency->name } ],
|
||
[ $::locale->text('Remote name'), 'remote_name' ],
|
||
[ $::locale->text('Purpose'), 'purpose' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
# sepa_export gets called from sepa_transfer and sepa_collection
|
||
sepa_export => sub {
|
||
my (%params) = @_;
|
||
|
||
my ($source, $destination) = $params{type} eq 'sepa_transfer' ? qw(our vc) : qw(vc our);
|
||
$params{title} = $params{type} eq 'sepa_transfer' ? $::locale->text('Bank transfers via SEPA') : $::locale->text('Bank collections via SEPA');
|
||
$params{with_columns} = [ grep { $_ ne 'record_link_direction' } @{ $params{with_columns} || [] } ];
|
||
|
||
delete $params{edit_record_links};
|
||
|
||
{
|
||
columns => [
|
||
[ $::locale->text('Export Number'), 'sepa_export', ],
|
||
[ $::locale->text('Execution date'), 'execution_date' ],
|
||
[ $::locale->text('Export date'), sub { $_[0]->sepa_export->itime->to_kivitendo } ],
|
||
[ $::locale->text('Source BIC'), "${source}_bic" ],
|
||
[ $::locale->text('Source IBAN'), "${source}_iban" ],
|
||
[ $::locale->text('Destination BIC'), "${destination}_bic" ],
|
||
[ $::locale->text('Destination IBAN'), "${destination}_iban" ],
|
||
[ $::locale->text('Amount'), 'amount' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
sepa_transfer => sub {
|
||
my (%params) = @_;
|
||
_get_type_params('sepa_export', %params, type => 'sepa_transfer');
|
||
},
|
||
sepa_collection => sub {
|
||
my (%params) = @_;
|
||
_get_type_params('sepa_export', %params, type => 'sepa_collection');
|
||
},
|
||
letter => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Letters'),
|
||
type => 'letter',
|
||
columns => [
|
||
[ $::locale->text('Date'), 'date' ],
|
||
[ $::locale->text('Letternumber'), sub { $_[0]->presenter->letter(display => 'table-cell') } ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Reference'), 'reference' ],
|
||
[ $::locale->text('Subject'), 'subject' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
email_journal => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Email'),
|
||
type => 'email_journal',
|
||
columns => [
|
||
[ $::locale->text('Sent on'), sub { $_[0]->sent_on->to_kivitendo(precision => 'seconds') } ],
|
||
[ $::locale->text('Subject'), sub { $_[0]->presenter->email_journal(display => 'table-cell') } ],
|
||
[ $::locale->text('Status'), 'status' ],
|
||
[ $::locale->text('From'), 'from' ],
|
||
[ $::locale->text('To'), 'recipients' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
dunning => sub {
|
||
my (%params) = @_;
|
||
{
|
||
title => $::locale->text('Dunnings'),
|
||
type => 'dunning',
|
||
columns => [
|
||
[ $::locale->text('Dunning Level'), sub { $_[0]->presenter->dunning(display => 'table-cell') } ],
|
||
[ $::locale->text('Dunning Date'), 'transdate' ],
|
||
[ $::locale->text('Dunning Duedate'), 'duedate' ],
|
||
[ $::locale->text('Total Fees'), 'fee' ],
|
||
[ $::locale->text('Interest'), 'interest' ],
|
||
],
|
||
%params,
|
||
}
|
||
},
|
||
);
|
||
|
||
sub _get_type_params {
|
||
my ($type, %params) = @_;
|
||
|
||
my $type_params = $TYPE_TO_PARAMS{$type};
|
||
croak "Unknown type '$type'" unless $type_params;
|
||
|
||
return %{$type_params->(%params)};
|
||
}
|
||
|
||
sub _arrayify {
|
||
my ($array) = @_;
|
||
return [] if !defined $array;
|
||
... | ... | |
my %grouped = _group_records( [ $record ] ); # pass $record as arrayref
|
||
my $type = (keys %grouped)[0];
|
||
|
||
$record->presenter->sales_invoice( $record, %params) if $type eq 'sales_invoices';
|
||
$record->presenter->purchase_invoice($record, %params) if $type eq 'purchase_invoices';
|
||
$record->presenter->ar_transaction( $record, %params) if $type eq 'ar_transactions';
|
||
$record->presenter->ap_transaction( $record, %params) if $type eq 'ap_transactions';
|
||
$record->presenter->gl_transaction( $record, %params) if $type eq 'gl_transactions';
|
||
$record->presenter->sales_invoice( $record, %params) if $type eq 'sales_invoice';
|
||
$record->presenter->purchase_invoice($record, %params) if $type eq 'purchase_invoice';
|
||
$record->presenter->ar_transaction( $record, %params) if $type eq 'ar_transaction';
|
||
$record->presenter->ap_transaction( $record, %params) if $type eq 'ap_transaction';
|
||
$record->presenter->gl_transaction( $record, %params) if $type eq 'gl_transaction';
|
||
|
||
return '';
|
||
}
|
||
... | ... | |
my %groups = _sort_grouped_lists(_group_records($list));
|
||
my $output = '';
|
||
|
||
$output .= _requirement_spec_list( $groups{requirement_specs}, %params) if $groups{requirement_specs};
|
||
$output .= _shop_order_list( $groups{shop_orders}, %params) if $groups{shop_orders};
|
||
$output .= _sales_quotation_list( $groups{sales_quotations}, %params) if $groups{sales_quotations};
|
||
$output .= _sales_order_intake_list( $groups{sales_order_intakes}, %params) if $groups{sales_order_intakes};
|
||
$output .= _sales_order_list( $groups{sales_orders}, %params) if $groups{sales_orders};
|
||
$output .= _sales_delivery_order_list( $groups{sales_delivery_orders}, %params) if $groups{sales_delivery_orders};
|
||
$output .= _rma_delivery_order_list( $groups{rma_delivery_orders}, %params) if $groups{rma_delivery_orders};
|
||
$output .= _sales_reclamation_list( $groups{sales_reclamation}, %params) if $groups{sales_reclamation};
|
||
$output .= _sales_invoice_list( $groups{sales_invoices}, %params) if $groups{sales_invoices};
|
||
$output .= _ar_transaction_list( $groups{ar_transactions}, %params) if $groups{ar_transactions};
|
||
|
||
$output .= _request_quotation_list( $groups{purchase_quotations}, %params) if $groups{purchase_quotations};
|
||
$output .= _purchase_quotation_intake_list( $groups{purchase_quotation_intakes}, %params) if $groups{purchase_quotation_intakes};
|
||
$output .= _purchase_order_list( $groups{purchase_orders}, %params) if $groups{purchase_orders};
|
||
$output .= _purchase_delivery_order_list( $groups{purchase_delivery_orders}, %params) if $groups{purchase_delivery_orders};
|
||
$output .= _supplier_delivery_order_list( $groups{supplier_delivery_orders}, %params) if $groups{supplier_delivery_orders};
|
||
$output .= _purchase_reclamation_list( $groups{purchase_reclamation}, %params) if $groups{purchase_reclamation};
|
||
$output .= _purchase_invoice_list( $groups{purchase_invoices}, %params) if $groups{purchase_invoices};
|
||
$output .= _ap_transaction_list( $groups{ap_transactions}, %params) if $groups{ap_transactions};
|
||
foreach my $type (@ORDERED_TYPES) {
|
||
$output .= record_list($groups{$type}, _get_type_params($type, %params)) if $groups{$type};
|
||
}
|
||
|
||
$output .= _gl_transaction_list( $groups{gl_transactions}, %params) if $groups{gl_transactions};
|
||
$output = SL::Presenter->get->render('presenter/record/grouped_record_list', %params, output => $output);
|
||
|
||
$output .= _bank_transactions( $groups{bank_transactions}, %params) if $groups{bank_transactions};
|
||
return $output;
|
||
}
|
||
|
||
$output .= _sepa_collection_list( $groups{sepa_collections}, %params) if $groups{sepa_collections};
|
||
$output .= _sepa_transfer_list( $groups{sepa_transfers}, %params) if $groups{sepa_transfers};
|
||
sub grouped_list { goto &grouped_record_list }
|
||
|
||
$output .= _letter_list( $groups{letters}, %params) if $groups{letters};
|
||
$output .= _email_journal_list( $groups{email_journals}, %params) if $groups{email_journals};
|
||
sub simple_grouped_record_list {
|
||
my ($list, %params) = @_;
|
||
|
||
$output .= _dunning_list( $groups{dunnings}, %params) if $groups{dunnings};
|
||
my %groups = _sort_grouped_lists(_group_records($list));
|
||
my $output = '';
|
||
|
||
$output = SL::Presenter->get->render('presenter/record/grouped_record_list', %params, output => $output);
|
||
foreach my $type (@ORDERED_TYPES) {
|
||
my $ordered_records = $groups{$type};
|
||
next unless $ordered_records;
|
||
my %type_params = _get_type_params($type, %params);
|
||
my $type_output = html_tag('b', $type_params{title} . ": ");
|
||
$type_output .= join (', ',
|
||
map { $_->presenter->show(%params) }
|
||
@{ $ordered_records }
|
||
);
|
||
$output .= html_tag('div', $type_output);
|
||
}
|
||
|
||
return $output;
|
||
}
|
||
|
||
sub grouped_list { goto &grouped_record_list }
|
||
|
||
sub empty_record_list {
|
||
my (%params) = @_;
|
||
return grouped_record_list([], %params);
|
||
... | ... | |
sub _group_records {
|
||
my ($list) = @_;
|
||
my %matchers = (
|
||
requirement_specs => sub { (ref($_[0]) eq 'SL::DB::RequirementSpec') },
|
||
shop_orders => sub { (ref($_[0]) eq 'SL::DB::ShopOrder') && $_[0]->id },
|
||
sales_quotations => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_quotation') },
|
||
sales_order_intakes => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_order_intake') },
|
||
sales_orders => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_order') },
|
||
sales_delivery_orders => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('sales_delivery_order') },
|
||
rma_delivery_orders => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('rma_delivery_order') },
|
||
sales_reclamation => sub { (ref($_[0]) eq 'SL::DB::Reclamation') && $_[0]->is_type('sales_reclamation') },
|
||
sales_invoices => sub { (ref($_[0]) eq 'SL::DB::Invoice') && $_[0]->invoice },
|
||
ar_transactions => sub { (ref($_[0]) eq 'SL::DB::Invoice') && !$_[0]->invoice },
|
||
purchase_quotations => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('request_quotation') },
|
||
purchase_quotation_intakes => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('purchase_quotation_intake') },
|
||
purchase_orders => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('purchase_order') },
|
||
purchase_delivery_orders => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('purchase_delivery_order') },
|
||
supplier_delivery_orders => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('supplier_delivery_order') },
|
||
purchase_reclamation => sub { (ref($_[0]) eq 'SL::DB::Reclamation') && $_[0]->is_type('purchase_reclamation')},
|
||
purchase_invoices => sub { (ref($_[0]) eq 'SL::DB::PurchaseInvoice') && $_[0]->invoice },
|
||
ap_transactions => sub { (ref($_[0]) eq 'SL::DB::PurchaseInvoice') && !$_[0]->invoice },
|
||
sepa_collections => sub { (ref($_[0]) eq 'SL::DB::SepaExportItem') && $_[0]->ar_id },
|
||
sepa_transfers => sub { (ref($_[0]) eq 'SL::DB::SepaExportItem') && $_[0]->ap_id },
|
||
gl_transactions => sub { (ref($_[0]) eq 'SL::DB::GLTransaction') },
|
||
bank_transactions => sub { (ref($_[0]) eq 'SL::DB::BankTransaction') && $_[0]->id },
|
||
letters => sub { (ref($_[0]) eq 'SL::DB::Letter') && $_[0]->id },
|
||
email_journals => sub { (ref($_[0]) eq 'SL::DB::EmailJournal') && $_[0]->id },
|
||
dunnings => sub { (ref($_[0]) eq 'SL::DB::Dunning') },
|
||
requirement_spec => sub { (ref($_[0]) eq 'SL::DB::RequirementSpec') },
|
||
shop_order => sub { (ref($_[0]) eq 'SL::DB::ShopOrder') && $_[0]->id },
|
||
sales_quotation => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_quotation') },
|
||
sales_order_intake => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_order_intake') },
|
||
sales_order => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_order') },
|
||
sales_delivery_order => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('sales_delivery_order') },
|
||
rma_delivery_order => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('rma_delivery_order') },
|
||
sales_reclamation => sub { (ref($_[0]) eq 'SL::DB::Reclamation') && $_[0]->is_type('sales_reclamation') },
|
||
sales_invoice => sub { (ref($_[0]) eq 'SL::DB::Invoice') && $_[0]->invoice },
|
||
ar_transaction => sub { (ref($_[0]) eq 'SL::DB::Invoice') && !$_[0]->invoice },
|
||
request_quotation => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('request_quotation') },
|
||
purchase_quotation_intake => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('purchase_quotation_intake') },
|
||
purchase_order => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('purchase_order') },
|
||
purchase_delivery_order => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('purchase_delivery_order') },
|
||
supplier_delivery_order => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_type('supplier_delivery_order') },
|
||
purchase_reclamation => sub { (ref($_[0]) eq 'SL::DB::Reclamation') && $_[0]->is_type('purchase_reclamation')},
|
||
purchase_invoice => sub { (ref($_[0]) eq 'SL::DB::PurchaseInvoice') && $_[0]->invoice },
|
||
ap_transaction => sub { (ref($_[0]) eq 'SL::DB::PurchaseInvoice') && !$_[0]->invoice },
|
||
sepa_collection => sub { (ref($_[0]) eq 'SL::DB::SepaExportItem') && $_[0]->ar_id },
|
||
sepa_transfer => sub { (ref($_[0]) eq 'SL::DB::SepaExportItem') && $_[0]->ap_id },
|
||
gl_transaction => sub { (ref($_[0]) eq 'SL::DB::GLTransaction') },
|
||
bank_transaction => sub { (ref($_[0]) eq 'SL::DB::BankTransaction') && $_[0]->id },
|
||
letter => sub { (ref($_[0]) eq 'SL::DB::Letter') && $_[0]->id },
|
||
email_journal => sub { (ref($_[0]) eq 'SL::DB::EmailJournal') && $_[0]->id },
|
||
dunning => sub { (ref($_[0]) eq 'SL::DB::Dunning') },
|
||
);
|
||
|
||
my %groups;
|
||
... | ... | |
return %groups;
|
||
}
|
||
|
||
sub _requirement_spec_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Requirement specs'),
|
||
type => 'requirement_spec',
|
||
columns => [
|
||
[ $::locale->text('Requirement spec number'), sub { $_[0]->presenter->requirement_spec(display => 'table-cell') } ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Title'), 'title' ],
|
||
[ $::locale->text('Project'), 'project', ],
|
||
[ $::locale->text('Status'), sub { $_[0]->status->description } ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _shop_order_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Shop Orders'),
|
||
type => 'shop_order',
|
||
columns => [
|
||
[ $::locale->text('Shop Order Date'), sub { $_[0]->order_date->to_kivitendo } ],
|
||
[ $::locale->text('Shop Order Number'), sub { $_[0]->presenter->shop_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Transfer Date'), 'transfer_date' ],
|
||
[ $::locale->text('Amount'), 'amount' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _sales_quotation_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Sales Quotations'),
|
||
type => 'sales_quotation',
|
||
columns => [
|
||
[ $::locale->text('Quotation Date'), 'transdate' ],
|
||
[ $::locale->text('Quotation Number'), sub { $_[0]->presenter->sales_quotation(display => 'table-cell') } ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _request_quotation_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Request Quotations'),
|
||
type => 'request_quotation',
|
||
columns => [
|
||
[ $::locale->text('Quotation Date'), 'transdate' ],
|
||
[ $::locale->text('Quotation Number'), sub { $_[0]->presenter->request_quotation(display => 'table-cell') } ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _purchase_quotation_intake_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Purchase Quotation Intakes'),
|
||
type => 'purchase_quotation_intake',
|
||
columns => [
|
||
[ $::locale->text('Quotation Date'), 'transdate' ],
|
||
[ $::locale->text('Quotation Number'), sub { $_[0]->presenter->purchase_quotation_intake(display => 'table-cell') } ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _sales_order_intake_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Sales Order Intakes'),
|
||
type => 'sales_order_intake',
|
||
columns => [
|
||
[ $::locale->text('Order Date'), 'transdate' ],
|
||
[ $::locale->text('Order Number'), sub { $_[0]->presenter->sales_order_intake(display => 'table-cell') } ],
|
||
[ $::locale->text('Quotation'), 'quonumber' ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _sales_order_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Sales Orders'),
|
||
type => 'sales_order',
|
||
columns => [
|
||
[ $::locale->text('Order Date'), 'transdate' ],
|
||
[ $::locale->text('Order Number'), sub { $_[0]->presenter->sales_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Quotation'), 'quonumber' ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _purchase_order_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Purchase Orders'),
|
||
type => 'purchase_order',
|
||
columns => [
|
||
[ $::locale->text('Order Date'), 'transdate' ],
|
||
[ $::locale->text('Order Number'), sub { $_[0]->presenter->purchase_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Request for Quotation'), 'quonumber' ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _sales_delivery_order_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Sales Delivery Orders'),
|
||
type => 'sales_delivery_order',
|
||
columns => [
|
||
[ $::locale->text('Delivery Order Date'), 'transdate' ],
|
||
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->sales_delivery_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Order Number'), 'ordnumber' ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Delivered'), 'delivered' ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _rma_delivery_order_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('RMA Delivery Orders'),
|
||
type => 'rma_delivery_order',
|
||
columns => [
|
||
[ $::locale->text('Delivery Order Date'), 'transdate' ],
|
||
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->rma_delivery_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Order Number'), 'ordnumber' ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Delivered'), 'delivered' ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _purchase_delivery_order_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Purchase Delivery Orders'),
|
||
type => 'purchase_delivery_order',
|
||
columns => [
|
||
[ $::locale->text('Delivery Order Date'), 'transdate' ],
|
||
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->purchase_delivery_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Order Number'), 'ordnumber' ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Delivered'), 'delivered' ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _supplier_delivery_order_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Supplier Delivery Orders'),
|
||
type => 'supplier_delivery_order',
|
||
columns => [
|
||
[ $::locale->text('Delivery Order Date'), 'transdate' ],
|
||
[ $::locale->text('Delivery Order Number'), sub { $_[0]->presenter->supplier_delivery_order(display => 'table-cell') } ],
|
||
[ $::locale->text('Order Number'), 'ordnumber' ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Delivered'), 'delivered' ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _sales_reclamation_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Sales Reclamation'),
|
||
type => 'sales_reclamation',
|
||
columns => [
|
||
[ $::locale->text('Reclamation Date'), 'transdate' ],
|
||
[ $::locale->text('Reclamation Number'), sub { $_[0]->presenter->sales_reclamation(display => 'table-cell') } ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Delivered'), 'delivered' ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _purchase_reclamation_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Purchase Reclamation'),
|
||
type => 'purchase_reclamation',
|
||
columns => [
|
||
[ $::locale->text('Reclamation Date'), 'transdate' ],
|
||
[ $::locale->text('Reclamation Number'), sub { $_[0]->presenter->purchase_reclamation(display => 'table-cell') } ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
[ $::locale->text('Project'), 'globalproject', ],
|
||
[ $::locale->text('Delivered'), 'delivered' ],
|
||
[ $::locale->text('Closed'), 'closed' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _sales_invoice_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Sales Invoices'),
|
||
type => 'sales_invoice',
|
||
columns => [
|
||
[ $::locale->text('Invoice Date'), 'transdate' ],
|
||
[ $::locale->text('Type'), sub { $_[0]->displayable_type } ],
|
||
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->sales_invoice(display => 'table-cell') } ],
|
||
[ $::locale->text('Quotation Number'), 'quonumber' ],
|
||
[ $::locale->text('Order Number'), 'ordnumber' ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Paid'), 'paid' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _purchase_invoice_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Purchase Invoices'),
|
||
type => 'purchase_invoice',
|
||
columns => [
|
||
[ $::locale->text('Invoice Date'), 'transdate' ],
|
||
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->purchase_invoice(display => 'table-cell') } ],
|
||
[ $::locale->text('Request for Quotation Number'), 'quonumber' ],
|
||
[ $::locale->text('Order Number'), 'ordnumber' ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Paid'), 'paid' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _ar_transaction_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('AR Transactions'),
|
||
type => 'ar_transaction',
|
||
columns => [
|
||
[ $::locale->text('Invoice Date'), 'transdate' ],
|
||
[ $::locale->text('Type'), sub { $_[0]->displayable_type } ],
|
||
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->ar_transaction(display => 'table-cell') } ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Paid'), 'paid' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _ap_transaction_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('AP Transactions'),
|
||
type => 'ap_transaction',
|
||
columns => [
|
||
[ $::locale->text('Invoice Date'), 'transdate' ],
|
||
[ $::locale->text('Invoice Number'), sub { $_[0]->presenter->ap_transaction(display => 'table-cell') } ],
|
||
[ $::locale->text('Vendor'), 'vendor' ],
|
||
[ $::locale->text('Net amount'), 'netamount' ],
|
||
[ $::locale->text('Paid'), 'paid' ],
|
||
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _gl_transaction_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('GL Transactions'),
|
||
type => 'gl_transaction',
|
||
columns => [
|
||
[ $::locale->text('Transdate'), 'transdate' ],
|
||
[ $::locale->text('Reference'), 'reference' ],
|
||
[ $::locale->text('Description'), sub { $_[0]->presenter->gl_transaction(display => 'table-cell') } ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _bank_transactions {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Bank transactions'),
|
||
type => 'bank_transactions',
|
||
columns => [
|
||
[ $::locale->text('Transdate'), 'transdate' ],
|
||
[ $::locale->text('Local Bank Code'), sub { $_[0]->local_bank_account->presenter->bank_code } ],
|
||
[ $::locale->text('Local account number'), sub { $_[0]->local_bank_account->presenter->account_number } ],
|
||
[ $::locale->text('Remote Bank Code'), 'remote_bank_code' ],
|
||
[ $::locale->text('Remote account number'),'remote_account_number' ],
|
||
[ $::locale->text('Valutadate'), 'valutadate' ],
|
||
[ $::locale->text('Amount'), 'amount' ],
|
||
[ $::locale->text('Currency'), sub { $_[0]->currency->name } ],
|
||
[ $::locale->text('Remote name'), 'remote_name' ],
|
||
[ $::locale->text('Purpose'), 'purpose' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _sepa_export_list {
|
||
my ($list, %params) = @_;
|
||
|
||
my ($source, $destination) = $params{type} eq 'sepa_transfer' ? qw(our vc) : qw(vc our);
|
||
$params{title} = $params{type} eq 'sepa_transfer' ? $::locale->text('Bank transfers via SEPA') : $::locale->text('Bank collections via SEPA');
|
||
$params{with_columns} = [ grep { $_ ne 'record_link_direction' } @{ $params{with_columns} || [] } ];
|
||
|
||
delete $params{edit_record_links};
|
||
|
||
return record_list(
|
||
$list,
|
||
columns => [
|
||
[ $::locale->text('Export Number'), 'sepa_export', ],
|
||
[ $::locale->text('Execution date'), 'execution_date' ],
|
||
[ $::locale->text('Export date'), sub { $_[0]->sepa_export->itime->to_kivitendo } ],
|
||
[ $::locale->text('Source BIC'), "${source}_bic" ],
|
||
[ $::locale->text('Source IBAN'), "${source}_iban" ],
|
||
[ $::locale->text('Destination BIC'), "${destination}_bic" ],
|
||
[ $::locale->text('Destination IBAN'), "${destination}_iban" ],
|
||
[ $::locale->text('Amount'), 'amount' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _sepa_transfer_list {
|
||
my ($list, %params) = @_;
|
||
_sepa_export_list($list, %params, type => 'sepa_transfer');
|
||
}
|
||
|
||
sub _sepa_collection_list {
|
||
my ($list, %params) = @_;
|
||
_sepa_export_list($list, %params, type => 'sepa_collection');
|
||
}
|
||
|
||
sub _letter_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Letters'),
|
||
type => 'letter',
|
||
columns => [
|
||
[ $::locale->text('Date'), 'date' ],
|
||
[ $::locale->text('Letternumber'), sub { $_[0]->presenter->letter(display => 'table-cell') } ],
|
||
[ $::locale->text('Customer'), 'customer' ],
|
||
[ $::locale->text('Reference'), 'reference' ],
|
||
[ $::locale->text('Subject'), 'subject' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
sub _email_journal_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Email'),
|
||
type => 'email_journal',
|
||
columns => [
|
||
[ $::locale->text('Sent on'), sub { $_[0]->sent_on->to_kivitendo(precision => 'seconds') } ],
|
||
[ $::locale->text('Subject'), sub { $_[0]->presenter->email_journal(display => 'table-cell') } ],
|
||
[ $::locale->text('Status'), 'status' ],
|
||
[ $::locale->text('From'), 'from' ],
|
||
[ $::locale->text('To'), 'recipients' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
sub _dunning_list {
|
||
my ($list, %params) = @_;
|
||
|
||
return record_list(
|
||
$list,
|
||
title => $::locale->text('Dunnings'),
|
||
type => 'dunning',
|
||
columns => [
|
||
[ $::locale->text('Dunning Level'), sub { $_[0]->presenter->dunning(display => 'table-cell') } ],
|
||
[ $::locale->text('Dunning Date'), 'transdate' ],
|
||
[ $::locale->text('Dunning Duedate'), 'duedate' ],
|
||
[ $::locale->text('Total Fees'), 'fee' ],
|
||
[ $::locale->text('Interest'), 'interest' ],
|
||
],
|
||
%params,
|
||
);
|
||
}
|
||
|
||
1;
|
||
|
||
__END__
|
||
... | ... | |
|
||
# Give HTML representation:
|
||
my $html = SL::Presenter->get->grouped_record_list($records);
|
||
# simple html version:
|
||
my $html = SL::Presenter->get->simple_grouped_record_list($records);
|
||
|
||
=head1 OVERVIEW
|
||
|
||
... | ... | |
my $record = SL::DB::Manager::AccTransaction->get_first()->record;
|
||
my $html = SL::Presenter->get->record($record, display => 'inline');
|
||
|
||
=item C<grouped_record_list $list, %params>
|
||
|
||
=item C<empty_record_list>
|
||
|
||
Returns a rendered version (actually an instance of
|
||
L<SL::Presenter::EscapedText>) of an empty list of records. Is usually
|
||
only called by L<grouped_record_list> if its list is empty.
|
||
|
||
=item C<simple_grouped_record_list $list, %params>
|
||
|
||
Generates a simple list of records. The order of the records is the
|
||
same as in L<grouped_record_list>.
|
||
|
||
=item C<grouped_record_list $list, %params>
|
||
|
||
Given a number of Rose::DB objects in the array reference C<$list>
|
Auch abrufbar als: Unified diff
SL::Presenter::Record: Schlichte Darstellung für verknüpfte Belege.