MT#5879 Align invoice template to clean db schema

mr3.3.1
Andreas Granig 12 years ago
parent fef92c26a0
commit 5cbb82747a

@ -278,8 +278,8 @@ sub get_content_ajax :Chained('base') :PathPart('editcontent/get/ajax') :Args(0)
my $tmpl = $c->stash->{tmpl};
my $content;
if($tmpl->base64_saved) {
$content = $tmpl->base64_saved;
if($tmpl->data) {
$content = $tmpl->data;
} else {
my $default = 'invoice/default/invoice_template_svg.tt';
my $t = NGCP::Panel::Utils::InvoiceTemplate::get_tt();
@ -321,8 +321,7 @@ sub set_content_ajax :Chained('base') :PathPart('editcontent/set/ajax') :Args(0)
try {
$tmpl->update({
base64_saved => $content,
base64_previewed => undef,
data => $content,
});
} catch($e) {
@ -344,7 +343,7 @@ sub preview_content :Chained('base') :PathPart('editcontent/preview') :Args(0) {
my ($self, $c, @args) = @_;
my $tmpl = $c->stash->{tmpl};
my $svg = $tmpl->base64_saved;
my $svg = $tmpl->data;
unless(defined $svg) {
NGCP::Panel::Utils::Message->error(

@ -17,7 +17,9 @@ has_block 'fields' => (
tag => 'div',
class => [qw/modal-body/],
render_list => [qw/reseller firstname lastname email company street postcode city
country iban bic vatnum comregnum phonenumber mobilenumber faxnumber/],
country iban bic bankname vatnum comregnum phonenumber mobilenumber faxnumber
gpp0 gpp1 gpp2 gpp3 gpp4 gpp5 gpp6 gpp7 gpp8 gpp9
/],
);
1;

@ -108,6 +108,16 @@ has_field 'bic' => (
},
);
has_field 'bankname' => (
type => 'Text',
maxlength => 255,
label => 'Bank Name',
element_attr => {
rel => ['tooltip'],
title => ['The bank name of the contact bank details.']
},
);
has_field 'vatnum' => (
type => 'Text',
label => 'VAT Number',
@ -158,6 +168,106 @@ has_field 'faxnumber' => (
},
);
has_field 'gpp0' => (
type => 'Text',
maxlength => 255,
label => 'General Purpose 0',
element_attr => {
rel => ['tooltip'],
title => ['A general purpose field for fee use.']
},
);
has_field 'gpp1' => (
type => 'Text',
maxlength => 255,
label => 'General Purpose 1',
element_attr => {
rel => ['tooltip'],
title => ['A general purpose field for fee use.']
},
);
has_field 'gpp2' => (
type => 'Text',
maxlength => 255,
label => 'General Purpose 2',
element_attr => {
rel => ['tooltip'],
title => ['A general purpose field for fee use.']
},
);
has_field 'gpp3' => (
type => 'Text',
maxlength => 255,
label => 'General Purpose 3',
element_attr => {
rel => ['tooltip'],
title => ['A general purpose field for fee use.']
},
);
has_field 'gpp4' => (
type => 'Text',
maxlength => 255,
label => 'General Purpose 4',
element_attr => {
rel => ['tooltip'],
title => ['A general purpose field for fee use.']
},
);
has_field 'gpp5' => (
type => 'Text',
maxlength => 255,
label => 'General Purpose 5',
element_attr => {
rel => ['tooltip'],
title => ['A general purpose field for fee use.']
},
);
has_field 'gpp6' => (
type => 'Text',
maxlength => 255,
label => 'General Purpose 6',
element_attr => {
rel => ['tooltip'],
title => ['A general purpose field for fee use.']
},
);
has_field 'gpp7' => (
type => 'Text',
maxlength => 255,
label => 'General Purpose 7',
element_attr => {
rel => ['tooltip'],
title => ['A general purpose field for fee use.']
},
);
has_field 'gpp8' => (
type => 'Text',
maxlength => 255,
label => 'General Purpose 8',
element_attr => {
rel => ['tooltip'],
title => ['A general purpose field for fee use.']
},
);
has_field 'gpp9' => (
type => 'Text',
maxlength => 255,
label => 'General Purpose 9',
element_attr => {
rel => ['tooltip'],
title => ['A general purpose field for fee use.']
},
);
has_field 'save' => (
type => 'Submit',
value => 'Save',
@ -169,7 +279,9 @@ has_block 'fields' => (
tag => 'div',
class => [qw/modal-body/],
render_list => [qw/firstname lastname email company street postcode city
country iban bic vatnum comregnum phonenumber mobilenumber faxnumber/],
country iban bic bankname vatnum comregnum phonenumber mobilenumber faxnumber
gpp0 gpp1 gpp2 gpp3 gpp4 gpp5 gpp6 gpp7 gpp8 gpp9
/],
);
has_block 'actions' => (

@ -24,20 +24,15 @@ sub svg_pdf {
my $pagefile = "$tempdir/$pagenum.svg";
push @pagefiles, $pagefile;
print ">>>>>>>>>>>>>>>>>> processing $pagefile\n";
my $xp = XML::XPath->new($page);
my $g = $xp->find('//g[contains(@class,"firsty-") and contains(@class,"lasty")]');
foreach my $node($g->get_nodelist) {
my $class = $node->getAttribute('class');
print ">>>>>>>>>>>>>>>>>> got class $class\n";
my $firsty = $class; my $lasty = $class;
$firsty =~ s/^.+firsty\-(\d+).*$/$1/;
$lasty =~ s/^.+lasty\-(\d+).*$/$1/;
if(length($firsty) && length($lasty)) {
print ">>>>>>>>>>>> we got firsty=$firsty and lasty=$lasty\n";
process_child_nodes($node, $firsty, $lasty);
}
}
@ -124,7 +119,6 @@ sub process_child_nodes {
my $delta = $a - $firsty;
my $newy = $y + $delta;
print ">>>>>>>>>>>>>> attr=$attr, firsty=$firsty, a=$a, delta=$delta, new=$newy\n";
$node->removeAttribute($attr);
$node->appendAttribute(XML::XPath::Node::Attribute->new($attr, $newy."mm"));
}
@ -189,12 +183,12 @@ sub get_dummy_data {
vat_included => 0,
},
invoice => {
year => '2014',
month => '01',
period_start => time - 2592000,
period_end => time,
serial => '1234567',
total_net => 12345,
vat => 12345*0.2,
total => 12345+(12345*0.2),
amount_net => 12345,
amount_vat => 12345*0.2,
amount_total => 12345+(12345*0.2),
},
calls => [
map {{

@ -6,10 +6,13 @@
money_format(amount=(billprof.interval_charge * 100), comma='.'); fixfee = aux.val;
money_format(amount=(zones.totalcost), comma='.'); zonefee = aux.val;
money_format(amount=(invoice.total_net), comma='.'); netfee = aux.val;
money_format(amount=(invoice.vat), comma='.'); vatfee = aux.val;
money_format(amount=(invoice.total), comma='.'); allfee = aux.val;
money_format(amount=(invoice.amount_net), comma='.'); netfee = aux.val;
money_format(amount=(invoice.amount_vat), comma='.'); vatfee = aux.val;
money_format(amount=(invoice.amount_total), comma='.'); allfee = aux.val;
cur = billprof.currency;
p_start = date.format(invoice.period_start, '%Y-%m-%d');
p_end = date.format(invoice.period_end, '%Y-%m-%d');
-%]
}-->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="210mm" height="297mm">
@ -57,7 +60,7 @@
<tspan x="190mm" dy="4mm" font-weight="bold">Customer Nr.</tspan>
<tspan x="190mm" dy="4mm">[% customer.external_id %]</tspan>
<tspan x="190mm" dy="4mm" font-weight="bold">Invoice Period</tspan>
<tspan x="190mm" dy="4mm">[% invoice.year %]-[% invoice.month %]</tspan>
<tspan x="190mm" dy="4mm">[% p_start %] - [% p_end %]</tspan>
<tspan x="190mm" dy="4mm" font-weight="bold">Date</tspan>
<tspan x="190mm" dy="4mm">[% date_now(f='%Y-%m-%d') %]</tspan>
</text>
@ -66,7 +69,7 @@
<text x="20mm" y="110mm" font-family="Verdana" font-size="8pt">
<tspan x="20mm" dy="0mm">Dear Customer,</tspan>
<tspan x="20mm" dy="8mm">For our services provided in the month of [%invoice.year%]-[%invoice.month%], we invoice the following items:</tspan>
<tspan x="20mm" dy="8mm">For our services provided in the period of [% p_start %] to [% p_end %], we invoice the following items:</tspan>
</text>

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

@ -28,6 +28,7 @@
<li><a href="[% c.uri_for('/subscriber') %]">[% c.loc('Subscribers') %]</a></li>
<li><a href="[% c.uri_for('/subscriberprofile') %]">[% c.loc('Subscriber Profiles') %]</a></li>
<li><a href="[% c.uri_for('/billing') %]">[% c.loc('Billing') %]</a></li>
<li><a href="[% c.uri_for('/invoicetemplate') %]">[% c.loc('Invoice Templates') %]</a></li>
<li><a href="[% c.uri_for('/peering') %]">[% c.loc('Peerings') %]</a></li>
<li><a href="[% c.uri_for('/rewrite') %]">[% c.loc('Rewrite Rule Sets') %]</a></li>
<li><a href="[% c.uri_for('/ncos') %]">[% c.loc('NCOS Levels') %]</a></li>

@ -13,6 +13,7 @@
<li><a href="[% c.uri_for('/subscriber') %]">[% c.loc('Subscribers') %]</a></li>
<li><a href="[% c.uri_for('/subscriberprofile') %]">[% c.loc('Subscriber Profiles') %]</a></li>
<li><a href="[% c.uri_for('/billing') %]">[% c.loc('Billing') %]</a></li>
<li><a href="[% c.uri_for('/invoicetemplate') %]">[% c.loc('Invoice Templates') %]</a></li>
<li><a href="[% c.uri_for('/rewrite') %]">[% c.loc('Rewrite Rule Sets') %]</a></li>
<li><a href="[% c.uri_for('/ncos') %]">[% c.loc('NCOS Levels') %]</a></li>
<li><a href="[% c.uri_for('/sound') %]">[% c.loc('Sound Sets') %]</a></li>

Loading…
Cancel
Save