X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FInvoice.pm;h=c6658413568220b28d3a3b58a34dcab42903ada5;hb=8a40e3dd0f638557b8c666fe708ccbc1ac709c4e;hp=0b7caa49d5a57ccac47f673700bf46d400a57d57;hpb=e1bf173bae820584e8bafdc01ebe2e7d7537a59c;p=kivitendo-erp.git diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 0b7caa49d..c66584135 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -15,13 +15,6 @@ use SL::DB::Helper::LinkedRecords; use SL::DB::Helper::PriceTaxCalculator; use SL::DB::Helper::PriceUpdater; use SL::DB::Helper::TransNumberGenerator; -use SL::DB::Helper::CustomVariables ( - sub_module => 'orderitems', - cvars_alias => 1, - overloads => { - parts_id => 'SL::DB::Part', - }, -); use SL::DB::AccTransaction; use SL::DB::Chart; use SL::DB::Employee; @@ -100,7 +93,7 @@ sub taxamount { my $self = shift; die 'not a setter method' if @_; - return $self->amount - $self->netamount; + return ($self->amount || 0) - ($self->netamount || 0); } __PACKAGE__->meta->make_attr_helpers(taxamount => 'numeric(15,5)'); @@ -243,6 +236,22 @@ sub _post_update_allocated { } } +sub invoice_type { + my ($self) = @_; + + return 'ar_transaction' if !$self->invoice; + return 'credit_note' if $self->type eq 'credit_note' && $self->amount < 0 && !$self->storno; + return 'invoice_storno' if $self->type ne 'credit_note' && $self->amount < 0 && $self->storno; + return 'credit_note_storno' if $self->type eq 'credit_note' && $self->amount > 0 && $self->storno; + return 'invoice'; +} + +sub displayable_state { + my $self = shift; + + return $self->closed ? $::locale->text('closed') : $::locale->text('open'); +} + 1; __END__ @@ -308,8 +317,7 @@ and recorded in C. =item 6. Items in C are updated according to their allocation status (regarding for costs of goold sold). Will only be done if -Lx-Office is not configured to use Einnahmenüberschussrechnungen -(see config/lx_office.conf, section "system", variable "eur"). +kivitendo is not configured to use Einnahmenüberschussrechnungen. =item 7. The invoice and its items are saved.