diff --git a/lib/NGCP/Panel/Controller/Subscriber.pm b/lib/NGCP/Panel/Controller/Subscriber.pm index e9baaf8406..437d41c7f3 100644 --- a/lib/NGCP/Panel/Controller/Subscriber.pm +++ b/lib/NGCP/Panel/Controller/Subscriber.pm @@ -2751,7 +2751,7 @@ sub calllist_master :Chained('base') :PathPart('calls') :CaptureArgs(0) :Allowed ) if($c->user->roles eq "admin" || $c->user->roles eq "reseller"); my $vat_factor = $c->config->{appearance}{cdr_apply_vat} && $c->stash->{subscriber}->contract->add_vat - ? "* " . (1 + $c->stash->{subscriber}->contract->vat_rate / 100) + ? "* " . (1 + $c->stash->{subscriber}->contract->vat_rate / 100.0) : ""; $c->log->debug("using vat_factor '$vat_factor'"); diff --git a/lib/NGCP/Panel/Form/Contract/Base.pm b/lib/NGCP/Panel/Form/Contract/Base.pm index b293b88d47..70769f4aaf 100644 --- a/lib/NGCP/Panel/Form/Contract/Base.pm +++ b/lib/NGCP/Panel/Form/Contract/Base.pm @@ -158,11 +158,13 @@ has_field 'invoice_template' => ( ); has_field 'vat_rate' => ( - type => 'Integer', + type => 'Float', + size => 15, + precision => 14, label => 'VAT Rate', - range_start => 0, - range_end => 100, - default => 0, + range_start => 0.0, + range_end => 100.0, + default => 0.0, element_attr => { rel => ['tooltip'], title => ['The VAT rate in percentage (e.g. 20).'] diff --git a/lib/NGCP/Panel/Form/Contract/CustomerAPI.pm b/lib/NGCP/Panel/Form/Contract/CustomerAPI.pm index 12f2785522..23cc8bee52 100644 --- a/lib/NGCP/Panel/Form/Contract/CustomerAPI.pm +++ b/lib/NGCP/Panel/Form/Contract/CustomerAPI.pm @@ -91,10 +91,12 @@ has_field 'invoice_template_id' => ( ); has_field 'vat_rate' => ( - type => 'Integer', - range_start => 0, - range_end => 100, - default => 0, + type => 'Float', + size => 15, + precision => 14, + range_start => 0.0, + range_end => 100.0, + default => 0.0, element_attr => { rel => ['tooltip'], title => ['The VAT rate in percentage (e.g. 20).'] diff --git a/lib/NGCP/Panel/Utils/Invoice.pm b/lib/NGCP/Panel/Utils/Invoice.pm index ec25bb67db..9d6a27124d 100644 --- a/lib/NGCP/Panel/Utils/Invoice.pm +++ b/lib/NGCP/Panel/Utils/Invoice.pm @@ -17,15 +17,15 @@ sub get_invoice_amounts{ my $invoice = {}; $contract_balance->{cash_balance_interval} //= 0; $billing_profile->{interval_charge} //= 0; - $customer_contract->{vat_rate} //= 0; + $customer_contract->{vat_rate} //= 0.0; #use Data::Dumper; #print Dumper [$contract_balance,$billing_profile]; $invoice->{amount_net} = $contract_balance->{cash_balance_interval} / 100 + $billing_profile->{interval_charge}; $invoice->{amount_vat} = $customer_contract->{add_vat} ? - $invoice->{amount_net} * ($customer_contract->{vat_rate}/100) - : 0; + $invoice->{amount_net} * ($customer_contract->{vat_rate} / 100.0) + : 0.0; $invoice->{amount_total} = $invoice->{amount_net} + $invoice->{amount_vat}; return $invoice; } diff --git a/lib/NGCP/Panel/Utils/InvoiceTemplate.pm b/lib/NGCP/Panel/Utils/InvoiceTemplate.pm index 5314603bc8..4e7a7e75aa 100644 --- a/lib/NGCP/Panel/Utils/InvoiceTemplate.pm +++ b/lib/NGCP/Panel/Utils/InvoiceTemplate.pm @@ -234,7 +234,7 @@ sub get_dummy_data { customer => { id => int(rand(10000))+10000, external_id => 'Resext1234567890', - vat_rate => 20, + vat_rate => 20.0, add_vat => 0, }, custcontact => {