From a88724c0c496b9dbf5b6c4b3eaed1798020040fe Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Mon, 2 Jun 2014 18:34:35 +0200 Subject: [PATCH] MT#5879 Cleanup invoice template editing. WIP. Fetching default template from file works. TBD: saving, viewing from saved, previewing PDF. --- lib/NGCP/Panel/Controller/InvoiceTemplate.pm | 39 ++- lib/NGCP/Panel/Form/Invoice/Basic.pm | 85 ----- lib/NGCP/Panel/Form/Invoice/Generate.pm | 119 ------- lib/NGCP/Panel/Form/Invoice/Send.pm | 59 ---- lib/NGCP/Panel/Form/Invoice/Template.pm | 129 -------- .../{ => default}/invoice_template_aux.tt | 0 .../{ => default}/invoice_template_lorem.tt | 51 +-- .../{ => default}/invoice_template_svg.tt | 29 +- .../invoice/invoice_details_calls_list.tt | 41 --- .../invoice/invoice_details_zones_list.tt | 42 --- .../invoice/invoice_generate_form.tt | 2 - share/templates/invoice/invoice_list.tt | 45 --- share/templates/invoice/invoice_send_form.tt | 2 - .../invoice/invoice_template_svg_alt.tt | 229 ------------- share/templates/invoice/list.tt | 305 ------------------ share/templates/invoice/template.tt | 85 ++--- share/templates/invoice/template_alt.tt | 49 --- .../invoice/template_editor_aux_embedimage.tt | 9 - .../templates/invoice/template_editor_form.tt | 132 ++++++-- .../invoice/template_editor_form_alt.tt | 179 ---------- share/templates/invoice/template_info_form.tt | 2 - share/templates/invoice/template_list_alt.tt | 54 ---- share/templates/invoice/uri_wrapper_js.tt | 25 +- 23 files changed, 194 insertions(+), 1518 deletions(-) delete mode 100644 lib/NGCP/Panel/Form/Invoice/Basic.pm delete mode 100644 lib/NGCP/Panel/Form/Invoice/Generate.pm delete mode 100644 lib/NGCP/Panel/Form/Invoice/Send.pm delete mode 100644 lib/NGCP/Panel/Form/Invoice/Template.pm rename share/templates/invoice/{ => default}/invoice_template_aux.tt (100%) rename share/templates/invoice/{ => default}/invoice_template_lorem.tt (80%) rename share/templates/invoice/{ => default}/invoice_template_svg.tt (95%) delete mode 100644 share/templates/invoice/invoice_details_calls_list.tt delete mode 100644 share/templates/invoice/invoice_details_zones_list.tt delete mode 100644 share/templates/invoice/invoice_generate_form.tt delete mode 100644 share/templates/invoice/invoice_list.tt delete mode 100644 share/templates/invoice/invoice_send_form.tt delete mode 100644 share/templates/invoice/invoice_template_svg_alt.tt delete mode 100644 share/templates/invoice/list.tt delete mode 100644 share/templates/invoice/template_alt.tt delete mode 100644 share/templates/invoice/template_editor_aux_embedimage.tt delete mode 100644 share/templates/invoice/template_editor_form_alt.tt delete mode 100644 share/templates/invoice/template_info_form.tt delete mode 100644 share/templates/invoice/template_list_alt.tt diff --git a/lib/NGCP/Panel/Controller/InvoiceTemplate.pm b/lib/NGCP/Panel/Controller/InvoiceTemplate.pm index 5dd16d78ae..5cd2f1d8ac 100644 --- a/lib/NGCP/Panel/Controller/InvoiceTemplate.pm +++ b/lib/NGCP/Panel/Controller/InvoiceTemplate.pm @@ -32,7 +32,7 @@ sub template_list :Chained('/') :PathPart('invoicetemplate') :CaptureArgs(0) :Do { name => 'is_active', search => 1, title => $c->loc('Active') }, ]); - $c->stash->{template} = 'invoice/template_list.tt'; + $c->stash(template => 'invoice/template_list.tt'); } sub root :Chained('template_list') :PathPart('') :Args(0) { @@ -253,6 +253,43 @@ sub delete :Chained('base') :PathPart('delete') { NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/invoicetemplate')); } +sub edit_content :Chained('base') :PathPart('editcontent') :Args(0) { + my ($self, $c) = @_; + + $c->stash(template => 'invoice/template.tt'); +} + +sub get_content_ajax :Chained('base') :PathPart('editcontent/get/ajax') :Args(0) { + my ($self, $c, @args) = @_; + my $tmpl = $c->stash->{tmpl}; + + my $content; + if($tmpl->base64_saved) { + $content = $tmpl->base64_saved; + } else { + my $default = 'invoice/default/invoice_template_svg.tt'; + my $t = Template->new({ + ENCODING => 'UTF-8', + RELATIVE => 1, + INCLUDE_PATH => './share/templates:/usr/share/ngcp-panel/templates', + }); + + try { + $content = $t->context->insert($default); + } catch($e) { + # TODO: handle error! + $c->log->error("failed to load default invoice template: $e"); + return; + } + } + + $c->response->content_type('text/html'); + $c->response->body($content); +} + + + + __PACKAGE__->meta->make_immutable; 1; diff --git a/lib/NGCP/Panel/Form/Invoice/Basic.pm b/lib/NGCP/Panel/Form/Invoice/Basic.pm deleted file mode 100644 index 6e190231c2..0000000000 --- a/lib/NGCP/Panel/Form/Invoice/Basic.pm +++ /dev/null @@ -1,85 +0,0 @@ -package NGCP::Panel::Form::Invoice::Basic; - -use Sipwise::Base; -use HTML::FormHandler::Moose; -#extends qw/HTML::FormHandler NGCP::Panel::Form::ValidatorBase/; -extends 'NGCP::Panel::Form::ValidatorBase'; -use Moose::Util::TypeConstraints; - -use DateTime; -use DateTime::Format::Strptime; - -has_field 'submitid' => ( type => 'Hidden' ); -sub build_render_list {[qw/submitid fields actions/]} -sub build_form_element_class { [qw/form-horizontal/] } - - -has_field 'submitid' => ( type => 'Hidden' ); - -#has_field 'contract.id' => ( -# type => '+NGCP::Panel::Field::DataTable', -# label => 'Client', -# do_label => 0, -# do_wrapper => 0, -# required => 1, -# template => 'helpers/datatables_field.tt', -# ajax_src => '/contact/ajax_noreseller', -# table_titles => ['#', 'First Name', 'Last Name', 'Email'], -# table_fields => ['id', 'firstname', 'lastname', 'email'], -#); -has_field 'invoice_id' => ( - type => 'Integer', - required => 0, -); -has_field 'save' => ( - type => 'Button', - value => 'Generate', - element_class => [qw/btn btn-primary/], - do_label => 0, -); - -has_field 'client_contract_id' => ( - type => 'Hidden', - required => 0, -); - -has_block 'fields' => ( - tag => 'div', - class => [qw/modal-body/], - render_list => [qw/invoice_id client_contract_id/], -); - -has_block 'actions' => ( - tag => 'div', - class => [qw/modal-footer/], - render_list => [qw/save/], -); - -sub validate { - my $self = shift; -} - -1; - -=head1 NAME - -NGCP::Panel::Form::InvoiceTemplate - -=head1 DESCRIPTION - -Form to modify an invoice template. - -=head1 METHODS - -=head1 AUTHOR - -Irina Peshinskaya - -=head1 LICENSE - -This library is free software. You can redistribute it and/or modify -it under the same terms as Perl itself. - -=cut - -# vim: set tabstop=4 expandtab: diff --git a/lib/NGCP/Panel/Form/Invoice/Generate.pm b/lib/NGCP/Panel/Form/Invoice/Generate.pm deleted file mode 100644 index 0de3091386..0000000000 --- a/lib/NGCP/Panel/Form/Invoice/Generate.pm +++ /dev/null @@ -1,119 +0,0 @@ -package NGCP::Panel::Form::Invoice::Generate; - -use HTML::FormHandler::Moose; -extends 'NGCP::Panel::Form::ValidatorBase'; - -use DateTime; -use DateTime::Format::Strptime; -use NGCP::Panel::Utils::DateTime; - -has_field 'submitid' => ( type => 'Hidden' ); -has '+widget_wrapper' => ( default => 'Bootstrap' ); -sub build_render_list {[qw/submitid fields actions/]} -sub build_form_element_class { [qw/form-horizontal/] } - -has_field 'client_contract_id' => ( - is => 'rw', - type => '+NGCP::Panel::Field::DataTable', - label => 'Contract', - #name => 'client_contract_id', - do_label => 0, - do_wrapper => 0, - required => 1, - template => 'helpers/datatables_field.tt', - #we will set it in controller - #ajax_src => $c->uri_for_action( '/invoice/ajax_datatables_data', [ $self->provider_id, 'invoice_list_data' ], - ajax_src => '', - table_titles => ['Contract Id', 'First Name', 'Last Name', 'Email'], - table_fields => ['contracts.id', 'firstname', 'lastname', 'email'], -); - -has_field 'start' => ( - type => '+NGCP::Panel::Field::DatePicker', - label => 'Start Date', - default => NGCP::Panel::Utils::DateTime::current_local()->truncate(to => 'month')->ymd, - required => 1, -); - -has_field 'end' => ( - type => '+NGCP::Panel::Field::DatePicker', - label => 'End Date', - default => NGCP::Panel::Utils::DateTime::current_local()->truncate(to => 'month')->add( months => 1)->subtract(seconds=>1)->ymd, - required => 1, -); - -has_field 'save' => ( - type => 'Button', - value => 'Generate', - element_class => [qw/btn btn-primary/], - do_label => 0, -); - -#has_field 'client_contract_id_hidden' => ( -# type => 'Hidden', -# required => 1, -#); - -has_block 'fields' => ( - tag => 'div', - class => [qw/modal-body/], - render_list => [qw/start end client_contract_id/], -); - -has_block 'actions' => ( - tag => 'div', - class => [qw/modal-footer/], - render_list => [qw/save/], -); - -sub validate { - my $self = shift; - my $start = $self->field('start'); - my $end = $self->field('end'); - my $parser = DateTime::Format::Strptime->new( - #pattern => '%Y-%m-%d %H:%M:%S', - pattern => '%Y-%m-%d', - ); - - my $sdate = $parser->parse_datetime($start->value); - unless($sdate) { - $start->add_error("Invalid date format, must be YYYY-MM-DD hh:mm:ss"); - } - my $edate = $parser->parse_datetime($end->value); - unless($edate) { - $end->add_error("Invalid date format, must be YYYY-MM-DD hh:mm:ss"); - } - - #unless(DateTime->compare($sdate, $edate) == -1) { - # my $err_msg = 'End time must be later than start time'; - # $start->add_error($err_msg); - # $end->add_error($err_msg); - #} - #if(!$self->backend->checkSipPbxAccount()){ - #} -} - -1; - -=head1 NAME - -NGCP::Panel::Form::InvoiceTemplate - -=head1 DESCRIPTION - -Form to modify an invoice template. - -=head1 METHODS - -=head1 AUTHOR - -Irina Peshinskaya - -=head1 LICENSE - -This library is free software. You can redistribute it and/or modify -it under the same terms as Perl itself. - -=cut - -# vim: set tabstop=4 expandtab: diff --git a/lib/NGCP/Panel/Form/Invoice/Send.pm b/lib/NGCP/Panel/Form/Invoice/Send.pm deleted file mode 100644 index 53abd77a43..0000000000 --- a/lib/NGCP/Panel/Form/Invoice/Send.pm +++ /dev/null @@ -1,59 +0,0 @@ -package NGCP::Panel::Form::Invoice::Send; - -use HTML::FormHandler::Moose; -extends 'NGCP::Panel::Form::ValidatorBase'; - -has_field 'submitid' => ( type => 'Hidden' ); -has '+widget_wrapper' => ( default => 'Bootstrap' ); -sub build_render_list {[qw/submitid fields actions/]} -sub build_form_element_class { [qw/form-horizontal/] } - -has_field 'email' => ( - type => 'Text', - label => 'Emails', - required => 1, -); - -has_field 'save' => ( - type => 'Button', - value => 'Send', - element_class => [qw/btn btn-primary/], - do_label => 0, -); - -has_block 'fields' => ( - tag => 'div', - class => [qw/modal-body/], - render_list => [qw/email/], -); - -has_block 'actions' => ( - tag => 'div', - class => [qw/modal-footer/], - render_list => [qw/save/], -); - -1; - -=head1 NAME - -NGCP::Panel::Form::InvoiceTemplate - -=head1 DESCRIPTION - -Form to modify an invoice template. - -=head1 METHODS - -=head1 AUTHOR - -Irina Peshinskaya - -=head1 LICENSE - -This library is free software. You can redistribute it and/or modify -it under the same terms as Perl itself. - -=cut - -# vim: set tabstop=4 expandtab: diff --git a/lib/NGCP/Panel/Form/Invoice/Template.pm b/lib/NGCP/Panel/Form/Invoice/Template.pm deleted file mode 100644 index 661d1c7835..0000000000 --- a/lib/NGCP/Panel/Form/Invoice/Template.pm +++ /dev/null @@ -1,129 +0,0 @@ -package NGCP::Panel::Form::Invoice::Template; - -use HTML::FormHandler::Moose; -extends 'NGCP::Panel::Form::ValidatorBase'; - -use Moose::Util::TypeConstraints; -use HTML::FormHandler::Widget::Block::Bootstrap; -enum 'TemplateType' => [ qw/svg html/ ];#html -enum 'TemplateTypeOutput' => [ qw/svg html pdf json svgzip htmlzip pdfzip/ ];#html -enum 'TemplateViewMode' => [ qw/raw parsed both/ ]; -enum 'TemplateSourceState' => [ qw/saved previewed default/ ]; -#no Moose::Util::TypeConstraints; - -has '+widget_wrapper' => ( default => 'Bootstrap' ); -has '+use_fields_for_input_without_param' => ( default => 1 ); -sub build_render_list {[qw/fields actions/]} -sub build_form_element_class { [qw/form-horizontal/] } - -has_field 'submitid' => ( type => 'Hidden' ); -has_field 'tt_type' => ( - type => 'Text', - required => 1, - default => 'svg', - apply => [ - { type => 'TemplateType' }, - ], -); - -has_field 'tt_output_type' => ( - type => 'Text', - required => 1, - default => 'svg', - apply => [ - { type => 'TemplateTypeOutput' }, - ], -); - -has_field 'tt_viewmode' => ( - type => 'Text', - required => 0, - apply => [ 'TemplateViewMode' ], - #check => [ qw/raw parsed/ ], - default => 'parsed', -); - -has_field 'tt_sourcestate' => ( - type => 'Text', - required => 1, - default => 'saved', - apply => [ 'TemplateSourceState' ], - #check => [ qw/saved previewed/ ], -); - -has_field 'tt_string' => ( - type => 'Text', - #default => \& - #apply => [ { check => \&validate_tt_string } ], - required => 0, -); - -has_field 'provider_id' => ( - type => 'Hidden', - #default => \& - #apply => [ { check => \&validate_tt_string } ], - required => 1, -); - -has_field 'tt_id' => ( - type => 'Hidden', - #default => \& - #apply => [ { check => \&validate_tt_string } ], - required => 0, -); -has_field 'name' => ( - type => 'Text', - #default => '', - #apply => [ { check => \&validate_tt_string } ], - required => 1, -); -has_field 'is_active' => ( - type => 'Checkbox', - default => '0', - #apply => [ { check => \&validate_tt_string } ], - required => 0, -); - -has_field 'save' => ( - type => 'Button', - value => 'Save', - element_class => [qw/btn btn-primary/], - label => '', -); - -has_block 'fields' => ( - tag => 'div', - class => [qw/modal-body/], - render_list => [qw/name tt_id is_active submitid provider_id/], -); - -has_block 'actions' => ( - tag => 'div', - class => [qw/modal-footer/], - render_list => [qw/save/], -); - -1; - -=head1 NAME - -NGCP::Panel::Form::InvoiceTemplate - -=head1 DESCRIPTION - -Form to modify an invoice template. - -=head1 METHODS - -=head1 AUTHOR - -Irina Peshinskaya - -=head1 LICENSE - -This library is free software. You can redistribute it and/or modify -it under the same terms as Perl itself. - -=cut - -# vim: set tabstop=4 expandtab: diff --git a/share/templates/invoice/invoice_template_aux.tt b/share/templates/invoice/default/invoice_template_aux.tt similarity index 100% rename from share/templates/invoice/invoice_template_aux.tt rename to share/templates/invoice/default/invoice_template_aux.tt diff --git a/share/templates/invoice/invoice_template_lorem.tt b/share/templates/invoice/default/invoice_template_lorem.tt similarity index 80% rename from share/templates/invoice/invoice_template_lorem.tt rename to share/templates/invoice/default/invoice_template_lorem.tt index d884368b14..b24a11f01a 100644 --- a/share/templates/invoice/invoice_template_lorem.tt +++ b/share/templates/invoice/default/invoice_template_lorem.tt @@ -38,20 +38,20 @@ template_variables.description.import({ }); IF 1 || !provider; - DEFAULT provider.company='Providercompany Inc'; - DEFAULT provider.street='Providerstreet 99'; - DEFAULT provider.city='Providercity'; - DEFAULT provider.postcode='12345'; - DEFAULT provider.country='Providercountry'; - DEFAULT provider.comregnum='12345'; - DEFAULT provider.iban='1234567890ABC'; DEFAULT provider.bic='ABCDEFG1234'; - DEFAULT provider.vat='XY1234567'; - DEFAULT provider.email='provider@example.org'; - DEFAULT provider.phone='+1 234 567890'; - DEFAULT provider.mobile='+1 234 567890'; - DEFAULT provider.faxnumber='+1 234 567890'; + DEFAULT provider.city='Provider City'; + DEFAULT provider.company='Provider Gmbh.'; + DEFAULT provider.country='Provider-Country'; + DEFAULT provider.email='office@provider.com'; + DEFAULT provider.fax='+1 650 1234566'; + DEFAULT provider.fn='305595'; + DEFAULT provider.iban='1234567890ABC'; + DEFAULT provider.mobile='+1 650 1234568'; + DEFAULT provider.phone='+1 650 1234567'; + DEFAULT provider.postcode='65104'; + DEFAULT provider.street='Provider Street'; DEFAULT provider.url='http://www.provider.com/'; + DEFAULT provider.vat='UATAA1234AA1234'; ELSE; FOREACH i in ['bic','city','company','country','email','fax','fn','iban','mobile','phone','postcode','street','url','vat']; TRY; @@ -73,15 +73,16 @@ template_variables.description.import({ }); IF !client.id; -DEFAULT client.firstname='Firstname'; -DEFAULT client.lastname='Lastname'; -DEFAULT client.street='Clientstreet 12/3/45'; -DEFAULT client.city='Clientcity'; -DEFAULT client.postcode='98765'; -DEFAULT client.country='Clientcountry'; -DEFAULT client.id=Math.int(Math.rand(999999))|format('%06d'); -DEFAULT client.iban='AT1234567890'; DEFAULT client.bic='ABCDEFG1234'; +DEFAULT client.city='Client City'; +DEFAULT client.country='Client-Country'; +DEFAULT client.title='Herr Dipl. Ing (FH)'; +DEFAULT client.firstname='Client Firstname'; +DEFAULT client.id=Math.int(Math.rand(999999))|format('%06d'); +DEFAULT client.lastname='Client-Lastname Sr.'; +DEFAULT client.postcode='65104'; +DEFAULT client.sepa='AT1234567890'; +DEFAULT client.street='Client Street'; DEFAULT client.vatid='AA1234'; END; @@ -89,7 +90,7 @@ END; template_variables.description.import({ bp => { 'name' => 'Billing Profile name', - 'interval_charge' => 'Recurring fee for invoice period', + 'interval_charge' => 'Constant fee for invoice period.', } }); @@ -109,9 +110,9 @@ DEFAULT bp.fraud_interval_notify = ''; DEFAULT bp.fraud_daily_limit = ''; DEFAULT bp.fraud_daily_lock = ''; DEFAULT bp.fraud_daily_notify = ''; -DEFAULT bp.currency = 'USD'; -DEFAULT bp.vat_rate = '20'; -DEFAULT bp.vat_included = 0; +DEFAULT bp.currency = ''; +DEFAULT bp.vat_rate = ''; +DEFAULT bp.vat_included = ''; END; invoice_details_zones = []; @@ -158,4 +159,4 @@ IF !invoice_details_zones.size(); i = i + 1; END; END; -%] +%] \ No newline at end of file diff --git a/share/templates/invoice/invoice_template_svg.tt b/share/templates/invoice/default/invoice_template_svg.tt similarity index 95% rename from share/templates/invoice/invoice_template_svg.tt rename to share/templates/invoice/default/invoice_template_svg.tt index bb105f1101..5dd0818eb8 100644 --- a/share/templates/invoice/invoice_template_svg.tt +++ b/share/templates/invoice/default/invoice_template_svg.tt @@ -1,5 +1,5 @@ - - + + @@ -34,17 +34,13 @@ TitlePage_1 -[%provider.company%], [%provider.street%], [%provider.postcode%] [% provider.city%], [%provider.country%] - -[% IF client.company -%] -[%client.company%] -[% ELSE -%] +[%provider.company%][%if(', ', provider.postcode _ ' ' _ provider.city ) %][%if(', ', provider.street )%] +[%client.title%] [%client.firstname%] [%client.lastname%] -[% END -%] [%client.street%] [%client.postcode%] [%client.city%] [%client.country%] -Contract Owner: [% client.company ? client.company : client.firstname _ ' ' _ client.lastname%] +Anschlussinhaber: [%client.firstname%] [%client.lastname%] Rechnung Rechnungsnummer @@ -299,21 +295,6 @@ - - - Background_Data - - - [%client.title%] - [%client.firstname%] [%client.lastname%] - [%client.street%] - [%client.postcode%] [%client.city%] - Kunde [%client.id%] - Seite [%page%] - Datum [%date.format(datenow.value,'%d.%m.%Y')%] - - - Background diff --git a/share/templates/invoice/invoice_details_calls_list.tt b/share/templates/invoice/invoice_details_calls_list.tt deleted file mode 100644 index 4fab71f731..0000000000 --- a/share/templates/invoice/invoice_details_calls_list.tt +++ /dev/null @@ -1,41 +0,0 @@ -[%# USE Dumper %] -[% USE date %] -[% USE Math %] -[%# Dumper.dump(invoice_details_zones)%] -[%# invoice_details_zones.size%] - - - - - - - - - - - - - - - [%# Dumper.dump_html(invoice_details_zones.as_query)%] - [% FOR call IN invoice_details_calls -%] - [%IF call.1; row_number = call.0; call = call.1; END%] - [% total_duration = total_duration + call.get_column('duration') %] - [% total_cost = total_cost + call.get_column('source_customer_cost') / 100 %] - - - - - - - - - - [%END%] - - - - - - -
[% c.loc('Num') %][% c.loc('Start time') %][% c.loc('Duration') %][% c.loc('Destination') %][% c.loc('Type') %][% c.loc('Zone/Details') %][% c.loc('Cash') %]
[% row_number %]
[% date.format(Math.int(call.get_column('start_time')),'%Y-%m-%d %H:%M:%S') %]
[% call.get_column('duration')|format('%.3f') %]
[% call.get_column('destination_user_in').replace('(.*?)\d{4}$','$1****') %][%#to mscro or view .replace('(.*?)\d{4}$','$1****') %]
[% call.get_column('call_type') %]
[% call.get_column('zone') _ '/' _ call.get_column('zone_detail') %]
[% money_format( call.get_column('source_customer_cost') / 100 ) %]
[% c.loc('Total') %]
[% total_duration | format('%.3f') %]
[% money_format( total_cost ) %]
diff --git a/share/templates/invoice/invoice_details_zones_list.tt b/share/templates/invoice/invoice_details_zones_list.tt deleted file mode 100644 index afa3354a25..0000000000 --- a/share/templates/invoice/invoice_details_zones_list.tt +++ /dev/null @@ -1,42 +0,0 @@ -[%# USE Dumper %] -[%# Dumper.dump(invoice_details_zones)%] -[%# invoice_details_zones.size%] - - - - - - - - - - - - - - - [%# Dumper.dump_html(invoice_details_zones.as_query)%] - [% FOR call IN invoice_details_zones -%] - [%IF call.1; row_number = call.0; call = call.1; END%] - [% total_number = total_number + call.get_column('number') %] - [% total_duration = total_duration + call.get_column('duration') %] - [% total_free_time = total_free_time + call.get_column('free_time') %] - [% total_cost = total_cost + call.get_column('cost') %] - - - - - - - - - [%END%] - - - - - - - - -
[% c.loc('Num') %][% c.loc('Zone/Details') %][% c.loc('Calls') %][% c.loc('Usage') %][% c.loc('Free time') %][% c.loc('Cash') %]
[% row_number %][% call.get_column('zone') _ '/' _ call.get_column('zone_detail') %]
[% call.get_column('number') %]
[% call.get_column('duration')|format('%.3f') %]
[% call.get_column('free_time')|format('%d') %]
[% money_format( call.get_column('cost') / 100 ) %]
[% c.loc('Total') %]
[% total_number %]
[% total_duration | format('%.3f') %]
[% total_free_time | format('%d')%]
[% money_format( total_cost / 100 ) %]
diff --git a/share/templates/invoice/invoice_generate_form.tt b/share/templates/invoice/invoice_generate_form.tt deleted file mode 100644 index c4c6a79fee..0000000000 --- a/share/templates/invoice/invoice_generate_form.tt +++ /dev/null @@ -1,2 +0,0 @@ -[%m.name = "Invoice Generation"%] -[%PROCESS 'helpers/ajax_form_modal.tt'-%] diff --git a/share/templates/invoice/invoice_list.tt b/share/templates/invoice/invoice_list.tt deleted file mode 100644 index 75885b0beb..0000000000 --- a/share/templates/invoice/invoice_list.tt +++ /dev/null @@ -1,45 +0,0 @@ - - - - [%#0 - now interface suppose preselected reseller%] - [%IF 0 && c.user.roles == 'admin' %] - - [%END%] - - - - - - - - - - - [%# Dumper.dump_html(invoice_details_zones.as_query)%] - [%FOREACH invoice IN invoice_list -%] - - [%IF 0 && c.user.roles == 'admin' %] - - [%END%] - - - - - - - - - [%END%] - -
[% c.loc('Reseller') %][% c.loc('Customer #') %][% c.loc('Serial') %][% c.loc('Start') %][% c.loc('End') %][% c.loc('Cache Balance') %][% c.loc('Free time balance') %]
#[% invoice.get_column('reseller_id') %] [% invoice.get_column('reseller_name') %]#[% invoice.get_column('client_contact_id') %]
[% invoice.get_column('serial')|format('%06d') %]
[% invoice.get_column('contract_balance_start') %][% invoice.get_column('contract_balance_end') %]
[% invoice.get_column('cash_balance') %]
[% invoice.get_column('free_time_balance') %]
- - - - - - - - \ No newline at end of file diff --git a/share/templates/invoice/invoice_send_form.tt b/share/templates/invoice/invoice_send_form.tt deleted file mode 100644 index eac3a1634e..0000000000 --- a/share/templates/invoice/invoice_send_form.tt +++ /dev/null @@ -1,2 +0,0 @@ -[%m.name = "Send Invoice"%] -[%PROCESS 'helpers/ajax_form_modal.tt'-%] diff --git a/share/templates/invoice/invoice_template_svg_alt.tt b/share/templates/invoice/invoice_template_svg_alt.tt deleted file mode 100644 index fb9f21a05e..0000000000 --- a/share/templates/invoice/invoice_template_svg_alt.tt +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - - - - - - - - - - -[%provider.company%][%if(', ', provider.postcode _ ' ' _ provider.city ) %][%if(', ', provider.street )%] -[%client.title%] -[%client.firstname%] [%client.lastname%] -[%client.street%] -[%client.postcode%] [%client.city%] -[%client.country%] -Anschlussinhaber: [%client.firstname%] [%client.lastname%] -[%provider.company%] - Ihre Abrechnung -Sehr geehrter Kunde, -für die von uns erbrachten Leistungen im Zeitraum vom 01.03.2014 bis 30.04.2014 erlauben wir uns -Folgendes in Rechnung zu stellen: -Rechnung -Rechnungsnummer -[%invoice.serial%] -Kundennummer -[%client.id%] -UID-Nummer: -[% client.uid %] -Zeitraum -[%invoice.month%] [%invoice.year%] -Datum -[%date.format(datenow.value,'%d.%m.%Y')%] - - - - - - - -Serviceleistungen - -Bezeichnung -Anzahl -Einzelpreis -Betrag in EUR - -Monatliche Grundentgelte - -NeoTel Business Phone ISDN 01.03.2014 - 31.03.2014 -1 -50,00 -50,00 - -NeoTel Business Phone ISDN 01.04.2014 - 30.04.2014 -1 -50,00 -50,00 - -Summe -100,00 - - - - - - - -Gesamtsumme der Serviceleistungen -100,00 - - - - - - - -Verbindungsentgelte -Zone -Anzahl -Nutzung -Betrag in EUR -Für Rufnummer 01/30123 NeoTel Business Phone -Österreich Festnetz GZ -1 -00:01:36 -0,04 -Österreich Festnetz FZ -9 -01:50:35 -2,21 -Verbindungsentgelte 01/30123 -2,25 - - - - - - -Gesamtsumme der Verbindungsentgelte -2,25 - - - - - - - -Rabatte -Bezeichnung -Anzahl -Einzelpreis -Betrag in EUR -Rabatte NeoTel Business Phone -Grundgebühren Rabatt 01.03.2014 - 31.03.2014 -1 --35,00 --35,00 -Grundgebühren Rabatt 01.04.2014 - 30.04.2014 -1 --35,00 --35,00 -Summe --70,00 - - - - - - - - - - - - - - -Gesamtsumme der Rabatte --70,00 - - -Summe Entgelte: -32,25 - - - - - -Umsatzsteuer (20%): -6,45 -Zahlungsbetrag -38,70 - - -Der Rechnungsbetrag wird 14 Tage nach Rechnungsdatum fällig und wird gemäß vorliegendem -Abbuchungsauftrag von Ihrem Konto IBAN , BIC abgebucht. - -Mit freundlichen Grüßen -Ihr NeoTel Service Team -Etwaige Einwände gegen die vorliegende Rechnung müssen innerhalb von 30 Tagen ab Zustellungsdatum schriftlich erhoben werden, andernfalls gilt -die Forderung als anerkannt. - - - - - - - - Background - - - [%provider.company%] - [%provider.postcode %] [% provider.city %] - [%provider.url%] - E-Mail : [%provider.email%] - Tel: [% provider.mobile %] - Fax: [% provider.fax %] - DVR-Nr.: [% provider.dvr %] UID-Nr.: [% provider.uid %] - IBAN: [% provider.iban %] BIC: [% provider.bic %] - FN:[% provider.fn %] - Firmensitz: [%provider.postcode %] [% provider.city %] - Konto-Nr.: [% provider.bankaccount %] BLZ [% provider.blz %], - [% provider.bank %] - - - - [%date_format(datenow.value)%] - Page [%page%] - - - - - - - - - - - - - - - - - - diff --git a/share/templates/invoice/list.tt b/share/templates/invoice/list.tt deleted file mode 100644 index e5c332fefc..0000000000 --- a/share/templates/invoice/list.tt +++ /dev/null @@ -1,305 +0,0 @@ -[% USE Dumper %] -[% USE format %] -[% money_format = format('%.2f') %] -[% write_access = 1 %] - -[%PROCESS 'helpers/datatables_vars.tt' - no_auto_helper = 1 --%] -[%PROCESS 'helpers/modal.tt' -%] -[%mf_helper = { - ajax_load => 1, - ajax_callback => 'refreshInvoicesTable();' -}%] -[%modal_script( m = mf_helper )%] - -[% site_config.title = c.loc('Invoices for [_1]', provider.name ) -%] - - - - - -[% IF reseller.first.status != "active" -%] - [%messages.unshift( c.loc('Reseller is [_1]', reseller.first.status) ); %] -[% END -%] -
-[%#here can be just initial messages state, but now it is the same with ajax messages, so there is no sense in repetition-%] -[%PROCESS 'helpers/ajax_messages.tt' -%] -
- - -
-[% back_created = 1 -%] - - - - - - - -[%#, title => c.loc('Reseller #')%] -[%#, title => c.loc('Reseller name')%] -[%#Dumper.dump_html(invoice_list_ajax)%] -[% - clearHelper(); - helper.name_single = c.loc('Invoices'); - helper.name = c.loc('Invoices'); - helper.identifier = 'invoice_list_data_ajax'; - helper.dt_columns = [ - { name => 'contract_balances.contract.contact.reseller_id'}, - { name => 'contract_balances.contract.contact.reseller.name'}, - { name => 'contract_balances.contract.contact.id', title => c.loc('Customer'), search => 1}, - { name => 'contract_balances.contract.id', title => c.loc('Contract'), search => 1}, - { name => 'contract_balances.invoice_id', title => c.loc('Invoice Id'), search => 1}, - { name => 'contract_balances.invoice.serial', title => c.loc('Invoice #'), search => 1}, - { name => 'contract_balances.start', title => c.loc('Period Start'), search_from_epoch => 1, search_to_epoch => 1, search_use_datetime => 1 }, - { name => 'contract_balances.end', title => c.loc('Period End')}, - { name => 'contract_balances.cash_balance', title => c.loc('Cash balance')}, - { name => 'contract_balances.free_time_balance', title => c.loc('Free Time balance')}, - ]; - helper.dt_buttons = [ - { - name = c.loc('View invoice PDF'), - uri = "javascript:window.open(\\'" _ c.uri_for_action('/invoice/invoice_data', [ provider.id ] ) _ "/' + full.contract_balances_invoice_id + '\\',\\'_blank\\');void(0);", - class = 'btn-small btn-primary', - icon = 'icon-edit' - }, - { - name = c.loc('Send invoice'), - uri => 'javascript:void(0);', - onclick => "sendInvoiceForm('+full.contract_balances_invoice_id+');void(0);", - class => 'btn-small btn-primary', - icon => 'icon-star' - attributes= ' cancel-hide="1"' - }, - { - name = c.loc('Delete'), - uri = "javascript:deleteInvoice(\\''+full.contract_balances_invoice_id+'\\',\\'" _ helper.identifier _ "_table\\');void(0);", - class = 'btn-small btn-secondary', - icon = 'icon-trash', - attributes= ' cancel-hide="1"' - }, - ]; - helper.ajax_uri = c.uri_for_action( '/invoice/ajax_datatables_data', [ provider.id, 'invoice_list_data' ] ) ; - initHelperAuto(); - PROCESS 'helpers/datatables.tt'; - datatables.invoices = {helper => {}}; - datatables.invoices.helper.import(helper); --%] -[%#PROCESS 'invoice/invoice_list.tt' %] - - - - - - -
-
- -
-
- diff --git a/share/templates/invoice/template.tt b/share/templates/invoice/template.tt index 30017f3ce3..dc8da99354 100644 --- a/share/templates/invoice/template.tt +++ b/share/templates/invoice/template.tt @@ -1,19 +1,20 @@ -[% USE Dumper %] -[% USE format %] -[% money_format = format('%.2f') %] -[% write_access = 1 %] +[% + USE format; + money_format = format('%.2f'); + write_access = 1; +%] -[%PROCESS 'helpers/datatables_vars.tt' - no_auto_helper = 1 --%] +[% PROCESS 'helpers/datatables_vars.tt' no_auto_helper = 1 -%] [%PROCESS 'helpers/modal.tt' -%] -[%mf_helper = { - ajax_load => 1, - ajax_list_refresh => 'template', - }%] -[%modal_script( m = mf_helper )%] +[% + mf_helper = { + ajax_load => 1, + ajax_list_refresh => 'template', + } +%] +[% modal_script( m = mf_helper ) %] -[% site_config.title = c.loc('Invoice template for [_1]', provider.name ) -%] +[% site_config.title = c.loc('Invoice template [_1]', tmpl.name ) -%] @@ -22,54 +23,13 @@ - + +[% PROCESS "invoice/uri_wrapper_js.tt" %] [% IF reseller.first.status != "active" -%] @@ -79,20 +39,11 @@ var uriForAction = function( data, type ){ [%PROCESS 'helpers/ajax_messages.tt' -%] -
[% back_created = 1 -%] -
-[%PROCESS 'invoice/template_list.tt' %] -
- - - - - \ No newline at end of file + diff --git a/share/templates/invoice/template_editor_form_alt.tt b/share/templates/invoice/template_editor_form_alt.tt deleted file mode 100644 index 15c1ac256a..0000000000 --- a/share/templates/invoice/template_editor_form_alt.tt +++ /dev/null @@ -1,179 +0,0 @@ -[%# USE FillInForm %] - -
- - - - [% c.loc('Preview')%] - - - [% c.loc('Discard Changes')%] - - - [% c.loc('Save template')%] - - - -
- - [% c.loc('Show template variables')%] - - - - - -[%IF viewmode == 'development' %] -
- - [% c.loc('Load default')%] - - - -
- - [% c.loc('Previewed SVG')%] - - - [% c.loc('Saved SVG')%] - - - [% c.loc('Saved PDF')%] - -[%END%] -[%initial = 'saved'%] -
- - -
\ No newline at end of file diff --git a/share/templates/invoice/template_info_form.tt b/share/templates/invoice/template_info_form.tt deleted file mode 100644 index 37fcd66ed5..0000000000 --- a/share/templates/invoice/template_info_form.tt +++ /dev/null @@ -1,2 +0,0 @@ -[%m.name = "Invoice Template"%] -[%PROCESS 'helpers/ajax_form_modal.tt'-%] diff --git a/share/templates/invoice/template_list_alt.tt b/share/templates/invoice/template_list_alt.tt deleted file mode 100644 index c148278714..0000000000 --- a/share/templates/invoice/template_list_alt.tt +++ /dev/null @@ -1,54 +0,0 @@ -[% USE Dumper %] -[% USE format %] -[% money_format = format('%.2f') %] -[% IF !c.user.read_only && (c.user.roles == 'admin' || c.user.roles == 'reseller') -%] -[% write_access = 1 %] -[%END%] - -[%IF template_list.size %] - - - - - - - - - - - - [% FOR template IN template_list -%] - [%# Dumper.dump_html(template_list.as_query)%] - [%# Dumper.dump_html(template)%] - - - - - - - - [%END%] - -
[% c.loc('Active') %][% c.loc('Id') %][% c.loc('Name') %][% c.loc('Type') %]
[%IF template.get_column('is_active') > 0; '✓'; END%][% template.get_column('id') %][% template.get_column('name') %][% template.get_column('type') %] - -
-[%END%] - - \ No newline at end of file diff --git a/share/templates/invoice/uri_wrapper_js.tt b/share/templates/invoice/uri_wrapper_js.tt index 4a607dd754..a1b18741b8 100644 --- a/share/templates/invoice/uri_wrapper_js.tt +++ b/share/templates/invoice/uri_wrapper_js.tt @@ -1,38 +1,25 @@ +[% # vim: set tabstop=4 syntax=html expandtab: -%]