diff --git a/lib/NGCP/Panel/Utils/InvoiceTemplate.pm b/lib/NGCP/Panel/Utils/InvoiceTemplate.pm index e7436fe570..8e2e1d1e44 100644 --- a/lib/NGCP/Panel/Utils/InvoiceTemplate.pm +++ b/lib/NGCP/Panel/Utils/InvoiceTemplate.pm @@ -7,7 +7,7 @@ use Sipwise::Base; sub getDefaultInvoiceTemplate{ my (%in) = @_; #in future may be we will store root default in Db too, but now it is convenient to edit template as file - my $result = $in{c}->view('SVG')->getTemplateContent($in{c}, 'customer/calls_svg.tt'); + my $result = $in{c}->view('SVG')->getTemplateContent($in{c}, 'customer/calls_'.$in{type}.'.tt'); #$in{c}->log->debug("result=$result;"); diff --git a/lib/NGCP/Panel/View/SVG.pm b/lib/NGCP/Panel/View/SVG.pm index 70e4523600..5ee61f801e 100644 --- a/lib/NGCP/Panel/View/SVG.pm +++ b/lib/NGCP/Panel/View/SVG.pm @@ -20,7 +20,7 @@ __PACKAGE__->config( sub process { my ( $self, $c ) = @_; - $c->res->content_type("image/svg+xml"); + #$c->res->content_type("image/svg+xml"); if($c->stash->{VIEW_NO_TT_PROCESS}) { diff --git a/share/templates/customer/calls.tt b/share/templates/customer/calls.tt index aa1f204ed9..ba5ca81e8e 100644 --- a/share/templates/customer/calls.tt +++ b/share/templates/customer/calls.tt @@ -26,7 +26,7 @@ [%# Dumper.dump_html(zonecalls_rs.as_query)%] - [% FOR call IN zonecalls_rs.all -%] + [% FOR call IN zonecalls_rs -%] [% 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') %] @@ -115,6 +115,8 @@ function handleShowSvgParsedData(data, error) { //alert(httpResponse); var img = document.getElementById('svgpreview'); //new Image(); img.src = "data:image/svg+xml," + encodeURIComponent(httpResponse); + alert(img.outerHTML); + alert(img.html()); } ); } diff --git a/share/templates/customer/calls_html.tt b/share/templates/customer/calls_html.tt new file mode 100644 index 0000000000..0b5826dce0 --- /dev/null +++ b/share/templates/customer/calls_html.tt @@ -0,0 +1,95 @@ + + + + + + +
+ MidPage +
+
+ LastPage +
+
+ + TitlePage + + + +
+ +
address line 1
+
address line 2
+
address line 3
+
+
+
+ Zone + Number + Duration + Free time + Cost +
+ + + +
+ Example zone + 0 + 0.000 + 0.0 + 0.00 +
+ + + +
+ Total: + 0 + 0.000 + 0.0 + 0.00 +
+ + + + + +
+
+
+ Background +
+ +
{provider.company}
+
{provider.street}, Postcode {provider.postcode} {provider.city} {provider.country}
+
{provider.firstname} {provider.lastname}. Phone: {provider.phone}. Mobile: {provider.mobile}. Fax: {provider.fax}
+
Page {page}
+
+
+ + \ No newline at end of file diff --git a/share/templates/customer/calls_svg.tt b/share/templates/customer/calls_svg.tt index 7f212be157..38b2226011 100644 --- a/share/templates/customer/calls_svg.tt +++ b/share/templates/customer/calls_svg.tt @@ -1,5 +1,8 @@ - + + + + - - - - MidPage - - - LastPage - + TitlePage @@ -42,6 +39,8 @@ g { address line 3 + + Zone Number @@ -49,8 +48,8 @@ g { Free time Cost - - + + Example zone 0 @@ -59,20 +58,7 @@ g { 0.00 - - - - - - - - - - - - - - + Total: 0 @@ -82,10 +68,23 @@ g { - - + + + + + + + + + MidPage + + + + LastPage + Background @@ -96,4 +95,6 @@ g { Page {page} + \ No newline at end of file diff --git a/share/templates/customer/calls_template.tt b/share/templates/customer/calls_template.tt new file mode 100644 index 0000000000..e2e73a6918 --- /dev/null +++ b/share/templates/customer/calls_template.tt @@ -0,0 +1,30 @@ +[%MACRO adjustrow(data, rowtype, tt_type, row_vertical_interval, rownumber) BLOCK -%] + [%# USE Dumper%] + [%# Dumper.dump_html(data)%] + [%IF rowtype == 'datarow' %] + [%row = datarow(data)%] + [%ELSIF rowtype == 'totalrow' %] + [%row = totalrow(data)%] + [%END%] + [%# row = $rowtype(data) %] + [%tt_type%] + [% IF tt_type == 'svg' -%] + [% heights = row.match('(?s)(]*\s+y\s?=.*?)(\d+)(.*)' ) -%] + [%END -%] + [%row_vertical_interval%] + [% IF heights.size > 0 -%] + [% y = heights.1 + ( row_vertical_interval * ( rownumber - 1 ) ) %] + [% row = heights.0 _ y _ heights.2 %] + [%END -%] + [%row%] +[%END -%] + +[%MACRO list_calls(zonecalls_rs, rowtype, total, tt_type, row_vertical_interval) BLOCK-%] + [% FOR call IN zonecalls_rs -%] + [% 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') -%] + [% adjustrow(call, rowtype, tt_type, row_vertical_interval, loop.count) -%] + [%END -%] +[%END -%] diff --git a/share/templates/customer/details.tt b/share/templates/customer/details.tt index 728d5f6876..d71cb86101 100644 --- a/share/templates/customer/details.tt +++ b/share/templates/customer/details.tt @@ -419,7 +419,6 @@ [%END%] [% USE Dumper %] - [%# Dumper.dump(zonecalls_rs)%] [%# zonecalls_rs.size%] [% WRAPPER accordion_group id="collapse_calls" title=c.loc('Balance details') %] @@ -436,7 +435,7 @@ [%# Dumper.dump_html(zonecalls_rs.as_query)%] - [% FOR call IN zonecalls_rs.all -%] + [% FOR call IN zonecalls_rs -%] [% 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') %]