my $output = '';
$output .= _requirement_spec_list( $self, $groups{requirement_specs}, %params) if $groups{requirement_specs};
+ $output .= _shop_order_list( $self, $groups{shop_orders}, %params) if $groups{shop_orders};
$output .= _sales_quotation_list( $self, $groups{sales_quotations}, %params) if $groups{sales_quotations};
$output .= _sales_order_list( $self, $groups{sales_orders}, %params) if $groups{sales_orders};
$output .= _sales_delivery_order_list( $self, $groups{sales_delivery_orders}, %params) if $groups{sales_delivery_orders};
$output .= _purchase_invoice_list( $self, $groups{purchase_invoices}, %params) if $groups{purchase_invoices};
$output .= _ap_transaction_list( $self, $groups{ap_transactions}, %params) if $groups{ap_transactions};
+ $output .= _gl_transaction_list( $self, $groups{gl_transactions}, %params) if $groups{gl_transactions};
+
+ $output .= _bank_transactions( $self, $groups{bank_transactions}, %params) if $groups{bank_transactions};
+
$output .= _sepa_collection_list( $self, $groups{sepa_collections}, %params) if $groups{sepa_collections};
$output .= _sepa_transfer_list( $self, $groups{sepa_transfers}, %params) if $groups{sepa_transfers};
+ $output .= _letter_list( $self, $groups{letters}, %params) if $groups{letters};
+
$output = $self->render('presenter/record/grouped_record_list', %params, output => $output);
return $output;
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_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_sales },
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 },
);
my %groups;
);
}
+sub _shop_order_list {
+ my ($self, $list, %params) = @_;
+
+ return $self->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 { $self->shop_order($_[0], display => 'table-cell') } ],
+ [ $::locale->text('Transfer Date'), 'transfer_date' ],
+ [ $::locale->text('Amount'), 'amount' ],
+ ],
+ %params,
+ );
+}
+
sub _sales_quotation_list {
my ($self, $list, %params) = @_;
);
}
+sub _gl_transaction_list {
+ my ($self, $list, %params) = @_;
+
+ return $self->record_list(
+ $list,
+ title => $::locale->text('GL Transactions'),
+ type => 'gl_transaction',
+ columns => [
+ [ $::locale->text('Transdate'), 'transdate' ],
+ [ $::locale->text('Reference'), 'reference' ],
+ [ $::locale->text('Description'), sub { $self->gl_transaction($_[0 ], display => 'table-cell') } ],
+ ],
+ %params,
+ );
+}
+
+sub _bank_transactions {
+ my ($self, $list, %params) = @_;
+
+ return $self->record_list(
+ $list,
+ title => $::locale->text('Bank transactions'),
+ type => 'bank_transactions',
+ columns => [
+ [ $::locale->text('Transdate'), 'transdate' ],
+ [ $::locale->text('Local Bank Code'), sub { $self->bank_code($_[0]->local_bank_account) } ],
+ [ $::locale->text('Local account number'), sub { $self->account_number($_[0]->local_bank_account) } ],
+ [ $::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 ($self, $list, %params) = @_;
_sepa_export_list($self, $list, %params, type => 'sepa_collection');
}
+sub _letter_list {
+ my ($self, $list, %params) = @_;
+
+ return $self->record_list(
+ $list,
+ title => $::locale->text('Letters'),
+ type => 'letter',
+ columns => [
+ [ $::locale->text('Date'), 'date' ],
+ [ $::locale->text('Letternumber'), sub { $self->letter($_[0], display => 'table-cell') } ],
+ [ $::locale->text('Customer'), 'customer' ],
+ [ $::locale->text('Reference'), 'reference' ],
+ [ $::locale->text('Subject'), 'subject' ],
+ ],
+ %params,
+ );
+}
+
1;
__END__
=item * AP transactions
+=item * GL transactions
+
=item * SEPA collections
=item * SEPA transfers