diff --git a/application/Invoice/InvoiceController.php b/application/Invoice/InvoiceController.php index 3cbc18800..76b2bdfde 100644 --- a/application/Invoice/InvoiceController.php +++ b/application/Invoice/InvoiceController.php @@ -786,9 +786,9 @@ class InvoiceController extends mfBaseController { } //var_dump($this->request->get()); - $csv_header = "\u{FEFF}satzart;konto;gkonto;belegnr;belegdatum;zziel;skontopz;skontotage;buchsymbol;buchcode;prozent;steuercode;betrag;steuer;text;"; + $csv_header = "\u{FEFF}satzart;konto;belegnr;belegdatum;zziel;skontopz;skontotage;buchsymbol;buchcode;prozent;steuercode;betrag;steuer;text;"; $csv_header .= "bank-iban-nr;bank-swiftcode;bank-mandatsid;bank-mandatsdatum;bank-mandatskz;bank-letztereinzug;zvsperre;bankeinzug;"; - $csv_header .= "kost;kobetrag"; + $csv_header .= "gkonto;kobetrag"; $csv_out = ""; @@ -831,8 +831,8 @@ class InvoiceController extends mfBaseController { //var_dump($invoice->getProperty("positions")); //$vat_total_gross = 0; foreach($invoice->getProperty("positions") as $position) { - if(!array_key_exists($position->position_group, $kostentraeger)) { - $kostentraeger[$position->position_group] = 0; + if(!array_key_exists($position->fibu_cost_account, $kostentraeger)) { + $kostentraeger[$position->fibu_cost_account] = 0; } //$kostentraeger[$position->position_group] += $position->price_gross; //$vat_total_gross += $position->price_gross - $position->price_total; @@ -841,21 +841,21 @@ class InvoiceController extends mfBaseController { /*if($position->discount) { $price -= ($price / 100) * $position->discount; }*/ - if($invoice->gesamtrabatt) { - $price -= ($price / 100) * $invoice->gesamtrabatt; + if($invoice->total_discount) { + $price -= ($price / 100) * $invoice->total_discount; } - $kostentraeger[$position->position_group] += $price; + $kostentraeger[$position->fibu_cost_account] += $price; } $total_gross = $invoice->total_gross; - /*if($invoice->gesamtrabatt) { - $total_gross -= round(($total_gross / 100) * $invoice->gesamtrabatt, 4); + /*if($invoice->total_discount) { + $total_gross -= round(($total_gross / 100) * $invoice->total_discount, 4); }*/ $total = $invoice->total; - /*if($invoice->gesamtrabatt) { - $total -= round(($total / 100) * $invoice->gesamtrabatt, 4); + /*if($invoice->total_discount) { + $total -= round(($total / 100) * $invoice->total_discount, 4); }*/ if($invoice->total_gross) { @@ -934,7 +934,7 @@ class InvoiceController extends mfBaseController { $csv_out .= "0;"; $csv_out .= $fibu_account.";"; - $csv_out .= $invoice->fibu_cost_account.";"; + //$csv_out .= $invoice->fibu_cost_account.";"; $csv_out .= $invoice->invoice_number.";"; $csv_out .= date("d.m.Y", $invoice->invoice_date).";"; $csv_out .= ($invoice->fibu_payment_due === null) ? ";" : $invoice->fibu_payment_due.";"; @@ -959,9 +959,9 @@ class InvoiceController extends mfBaseController { if(count($kostentraeger) >= 2) { - foreach($kostentraeger as $kostelle => $kobetrag) { + foreach($kostentraeger as $gkonto_num => $kobetrag) { $kobetrag_text = number_format($kobetrag, 2, ",", ""); - $csv_out .= "\n1;;;;;;;;;;;;;;;;;;;;;;;$kostelle;$kobetrag_text;"; + $csv_out .= "\n1;;;;;;;;;;;;;;;;;;;;;;$gkonto_num;$kobetrag_text;"; } }