mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
bugfix exportbuchhaltung date of differences
This commit is contained in:
parent
88e1e2ebc2
commit
5ca3a7297b
@ -76,14 +76,14 @@ class Exportbuchhaltung
|
||||
|
||||
$rgchecked = $this->app->Secure->GetPOST("rechnung");
|
||||
$gschecked = $this->app->Secure->GetPOST("gutschrift");
|
||||
$vbchecked = $this->app->Secure->GetPOST("verbindlichkeit");
|
||||
$diffignore = $this->app->Secure->GetPOST("diffignore");
|
||||
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
|
||||
|
||||
$account_id = null;
|
||||
if (!empty($sachkonto)) {
|
||||
$sachkonto_kennung = explode(' ',$sachkonto)[0];
|
||||
$account_id = $this->app->DB->SelectArr("SELECT id from kontorahmen WHERE sachkonto = '".$sachkonto_kennung."'")[0]['id'];
|
||||
$vbchecked = $this->app->Secure->GetPOST("verbindlichkeit");
|
||||
$diffignore = $this->app->Secure->GetPOST("diffignore");
|
||||
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
|
||||
|
||||
$account_id = null;
|
||||
if (!empty($sachkonto)) {
|
||||
$sachkonto_kennung = explode(' ',$sachkonto)[0];
|
||||
$account_id = $this->app->DB->SelectArr("SELECT id from kontorahmen WHERE sachkonto = '".$sachkonto_kennung."'")[0]['id'];
|
||||
}
|
||||
|
||||
$msg = "";
|
||||
@ -190,19 +190,19 @@ class Exportbuchhaltung
|
||||
$this->app->erp->MenuEintrag("index.php?module=importvorlage&action=uebersicht", "Zurück");
|
||||
$this->app->YUI->AutoComplete("projekt", "projektname", 1);
|
||||
$this->app->YUI->DatePicker("von");
|
||||
$this->app->YUI->DatePicker("bis");
|
||||
$this->app->YUI->DatePicker("bis");
|
||||
$this->app->YUI->AutoComplete('sachkonto', 'sachkonto');
|
||||
|
||||
$this->app->Tpl->SET('MESSAGE', $msg);
|
||||
|
||||
$this->app->Tpl->SET('RGCHECKED',$rgchecked?'checked':'');
|
||||
$this->app->Tpl->SET('GSCHECKED',$gschecked?'checked':'');
|
||||
$this->app->Tpl->SET('VBCHECKED',$vbchecked?'checked':'');
|
||||
$this->app->Tpl->SET('VBCHECKED',$vbchecked?'checked':'');
|
||||
$this->app->Tpl->SET('DIFFIGNORE',$diffignore?'checked':'');
|
||||
|
||||
$this->app->Tpl->SET('VON', $von_form);
|
||||
$this->app->Tpl->SET('BIS', $bis_form);
|
||||
$this->app->Tpl->SET('PROJEKT', $projektkuerzel);
|
||||
$this->app->Tpl->SET('PROJEKT', $projektkuerzel);
|
||||
$this->app->Tpl->SET('SACHKONTO', $sachkonto);
|
||||
|
||||
$this->app->Tpl->Parse('PAGE', "exportbuchhaltung_export.tpl");
|
||||
@ -509,7 +509,7 @@ class Exportbuchhaltung
|
||||
b.ustid,
|
||||
b.".$typ['field_date']." as datum,
|
||||
p.id as pos_id,
|
||||
".$typ['field_betrag_gesamt']." as betrag_gesamt,
|
||||
".$typ['field_betrag_gesamt']." as betrag_gesamt,
|
||||
b.waehrung,
|
||||
ROUND(".$typ['field_betrag'].",2) as betrag,
|
||||
".$typ['field_gegenkonto']." as gegenkonto,
|
||||
@ -532,11 +532,12 @@ class Exportbuchhaltung
|
||||
(
|
||||
SELECT
|
||||
belegnr,
|
||||
datum,
|
||||
betrag_gesamt,
|
||||
ROUND(SUM(betrag),2) AS betrag_summe,
|
||||
waehrung,
|
||||
kundennummer,
|
||||
ustid,
|
||||
ROUND(SUM(betrag),2) AS betrag_summe,
|
||||
waehrung,
|
||||
kundennummer,
|
||||
ustid,
|
||||
auftrag
|
||||
FROM
|
||||
(".$sql.") posten
|
||||
@ -546,43 +547,43 @@ class Exportbuchhaltung
|
||||
WHERE betrag_gesamt <> betrag_summe OR betrag_summe IS NULL";
|
||||
|
||||
$result = $this->app->DB->SelectArr($sql_check);
|
||||
if (!empty($result)) {
|
||||
|
||||
if (!empty($result)) {
|
||||
|
||||
if (!$sachkonto_differences) {
|
||||
$e = new ConsistencyException(ucfirst($typ['typ']),$result);
|
||||
throw $e;
|
||||
} else {
|
||||
// Create differences entries
|
||||
foreach ($result as $row) {
|
||||
|
||||
throw $e;
|
||||
} else {
|
||||
// Create differences entries
|
||||
foreach ($result as $row) {
|
||||
|
||||
$posid = $row['pos_id'];
|
||||
$tmpsteuersatz = 0;
|
||||
$tmpsteuertext = '';
|
||||
$erloes = '';
|
||||
$result = array();
|
||||
$this->app->erp->GetSteuerPosition($typ['typ'], $posid, $tmpsteuersatz, $tmpsteuertext, $erloes);
|
||||
|
||||
$data = array();
|
||||
|
||||
$difference = $row['betrag_gesamt']-$row['betrag_summe'];
|
||||
|
||||
$data['Umsatz'] = number_format(abs($difference), 2, ',', ''); // obligatory
|
||||
$this->app->erp->GetSteuerPosition($typ['typ'], $posid, $tmpsteuersatz, $tmpsteuertext, $erloes);
|
||||
|
||||
$data = array();
|
||||
|
||||
$difference = $row['betrag_gesamt']-$row['betrag_summe'];
|
||||
|
||||
$data['Umsatz'] = number_format(abs($difference), 2, ',', ''); // obligatory
|
||||
$data['EU-Steuersatz (Bestimmung)'] = 0;
|
||||
$data['WKZ Umsatz'] = $row['waehrung'];
|
||||
$data['Belegfeld 1'] = mb_strimwidth($row['belegnr'],0,12);
|
||||
$data['Konto'] = $row['kundennummer'];
|
||||
$data['Soll-/Haben-Kennzeichen'] = ($difference < 0)?'S':'H'; // obligatory
|
||||
$data['Soll-/Haben-Kennzeichen'] = ($difference < 0)?'S':'H'; // obligatory
|
||||
|
||||
$data['Gegenkonto (ohne BU-Schlüssel)'] = $sachkonto_differences; // obligatory
|
||||
|
||||
$data['Belegdatum'] = date_format(date_create($row['datum']),"dm"); // obligatory
|
||||
|
||||
$data['Belegdatum'] = date_format(date_create($row['datum']),"dm"); // obligatory
|
||||
$data['Buchungstext'] = "Differenz";
|
||||
$data['EU-Mitgliedstaat u. UStID (Bestimmung)'] = $row['ustid'];
|
||||
$data['Auftragsnummer'] = $row['auftrag'];
|
||||
$csv .= $this->create_line($datev_buchungsstapel_definition,$data);
|
||||
}
|
||||
$data['Auftragsnummer'] = $row['auftrag'];
|
||||
$csv .= $this->create_line($datev_buchungsstapel_definition,$data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // diffignore
|
||||
|
||||
// Query position data
|
||||
@ -622,7 +623,7 @@ class Exportbuchhaltung
|
||||
$data['Belegdatum'] = date_format(date_create($row['datum']),"dm"); // obligatory
|
||||
$data['Buchungstext'] = mb_strimwidth($row['name'],0,60);
|
||||
$data['EU-Mitgliedstaat u. UStID (Bestimmung)'] = $row['ustid'];
|
||||
|
||||
|
||||
$data['Auftragsnummer'] = ($row['auftrag']!=0)?$row['auftrag']:'';
|
||||
|
||||
$csv .= $this->create_line($datev_buchungsstapel_definition,$data);
|
||||
@ -633,11 +634,11 @@ class Exportbuchhaltung
|
||||
|
||||
$csv = mb_convert_encoding($csv, "ISO-8859-1", "UTF-8");
|
||||
return($csv);
|
||||
}
|
||||
|
||||
function create_line($definition, $data) : string {
|
||||
$csv = "";
|
||||
$comma = "";
|
||||
}
|
||||
|
||||
function create_line($definition, $data) : string {
|
||||
$csv = "";
|
||||
$comma = "";
|
||||
foreach ($definition as $key => $value) {
|
||||
if (!isset($data[$value])) {
|
||||
$data[$value] = '';
|
||||
@ -645,9 +646,9 @@ class Exportbuchhaltung
|
||||
$csv .= $comma.'"'.$data[$value].'"';
|
||||
$comma = ";";
|
||||
}
|
||||
$csv .= "\r\n";
|
||||
return($csv);
|
||||
}
|
||||
$csv .= "\r\n";
|
||||
return($csv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user