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/share/templates/customer/calls.tt b/share/templates/customer/calls.tt index 24086a723b..ba5ca81e8e 100644 --- a/share/templates/customer/calls.tt +++ b/share/templates/customer/calls.tt @@ -27,7 +27,6 @@ [%# Dumper.dump_html(zonecalls_rs.as_query)%] [% FOR call IN zonecalls_rs -%] - [%IF call.1; 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') %] @@ -116,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_svg.tt b/share/templates/customer/calls_svg.tt index 745d0fed3e..f4c25c76db 100644 --- a/share/templates/customer/calls_svg.tt +++ b/share/templates/customer/calls_svg.tt @@ -1,561 +1,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/share/templates/customer/calls_template.tt b/share/templates/customer/calls_template.tt index 7db7bba5b7..e2e73a6918 100644 --- a/share/templates/customer/calls_template.tt +++ b/share/templates/customer/calls_template.tt @@ -1,72 +1,26 @@ -[%USE Dumper%] -[%USE Math%] - -[%MACRO row_y_re(tt_type) BLOCK -%] - [% IF tt_type == 'svg' -%] - [% y_re = '(?s)(]*\s+y\s?=.*?)(\d+)(.*)' -%] - [%END%] - [%y_re%] -[%END%] - -[%MACRO page_rows_re(tt_type) BLOCK -%] - [% IF tt_type == 'svg' -%] - [%# page_rows_re = '(?si)]*(?:\s+rows\s*=.*?(\d+))?[^>]*\s+id\s*=.*?(?:page_invoicedetails)[^>]*(?:\s+rows\s*=.*?(\d+))?[^>]*>' -%] - [% page_rows_re = 'rows="([0-9]+)"' -%] - [%END%] - [%page_rows_re%] -[%END%] - -[%MACRO page_g_y_and_height_re(tt_type) BLOCK -%] -[%#macro intended to be used when no rows specified in data table grouping g %] -[%#all 0 -%] - [% y = matches.1 + ( row_vertical_interval * ( rownumber - 1 ) ) %] - [% row = matches.0 _ y _ matches.2 %] + [% 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(callsdata, rowtype, total, tt_type, row_vertical_interval) BLOCK-%] - [% FOR call IN callsdata -%][%#zonecalls_rs%] +[%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') -%] @@ -74,67 +28,3 @@ [% adjustrow(call, rowtype, tt_type, row_vertical_interval, loop.count) -%] [%END -%] [%END -%] - -[%MACRO get_page_rows_number(pagetype, tt_type, row_vertical_interval) BLOCK-%] - [%#doesn't work %] - [% page_rows_re = page_rows_re(tt_type) %] - - [% IF tt_type == 'svg' -%] - [%# page_rows_re = '(?si)]*(?:\s+rows\s*=.*?(\d+))?[^>]*\s+id\s*=.*?(?:page_invoicedetails)[^>]*(?:\s+rows\s*=.*?(\d+))?[^>]*>' -%] - [% page_rows_re = 'rows="([0-9]+)"' -%] - [%END%] - - [% page = get_page(pagetype) %] - [% matches = page.match( page_rows_re ) -%] - - [%#page=Dumper.dump(page)%] - [%#page_rows_re=Dumper.dump(page_rows_re)%] - [%#matches=Dumper.dump(matches)%] - - [% rows = matches.0 || matches.1 %] - [%#IF !rows%] - [%# all_g_y_re = page_y_re(tt_type) %] - [%# matches = page.match( page_rows_re ) -%] - [%#END%] - [%#IF ! rows %][%# rows = 10%][%#END%] - [%rows = Math.int(rows)%] - [%rows%] -[%END -%] - -[%MACRO show_pages(zonecalls_rs, pagetype, pagenum_in) BLOCK-%] - [% allrowsnumber = zonecalls_rs.size() %] - [% titlerows = get_page_rows_number('titlepage','svg') %] - [%IF titlerows== 0 ; titlerows = 10; END%] - [% midrows = get_page_rows_number('midpage','svg') %] - [%IF midrows == 0 ; midrows = 30 ; END%] - [% allmidpages = ( (allrowsnumber - titlerows) / midrows )|format('%d') %] - [% allmidrows = allmidpages * midrows %] - [% lastrows = allrowsnumber - allmidrows - titlerows %] - - [%IF ( pagetype == 'title' || pagetype=='all') %] - [% pagenum = 1%] - [% document_header()%] - [% titlepage( zonecalls_rs.slice(0, ( titlerows - 1 ) ), pagenum) -%] - [% bgpage(pagenum) -%] - [% document_footer()%] - [%END-%] - [%IF ( pagetype == 'mid' || pagetype=='all' ) && allmidrows %] - [% pages = pagenum_in ? [ pagenum_in ] : [ 1 .. allmidpages ] %] - [%FOREACH pagenum IN pages %] - [% pagerowsstart = titlerows + midrows * ( pagenum - 1 )%] - [% pagerowsend = titlerows + midrows * pagenum - 1 %] - [% document_header()%] - [% midpage( zonecalls_rs.slice( pagerowsstart, pagerowsend ), pagenum + 1 ) -%] - [% bgpage(pagenum + 1s) -%] - [% document_footer()%] - [%END-%] - [%END-%] - [%IF ( pagetype == 'last' || pagetype=='all' )%] - [% pagenum = 2 + allmidpages%] - [%#2 because midpages started from 1, but we need add 1 for titlepage %] - [% document_header()%] - [% lastpage( zonecalls_rs.slice( allrowsnumber - lastrows, allrowsnumber ), pagenum ) -%] - [% bgpage(pagenum) -%] - [% document_footer()%] - [%END-%] -[%END-%]