mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
exportbuchhaltung added new verbindlichkeit, lieferantengutschrift
This commit is contained in:
parent
4d5b46e903
commit
c89c36e596
@ -27,6 +27,10 @@
|
|||||||
<td>{|Verbindlichkeiten:|}</td>
|
<td>{|Verbindlichkeiten:|}</td>
|
||||||
<td><input type="checkbox" name="verbindlichkeit" value="1" [VBCHECKED] /></td>
|
<td><input type="checkbox" name="verbindlichkeit" value="1" [VBCHECKED] /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{|Lieferantengutschriften:|}</td>
|
||||||
|
<td><input type="checkbox" name="lieferantengutschrift" value="1" [LGCHECKED] /></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Datum von:</td>
|
<td>Datum von:</td>
|
||||||
<td><input type="text" name="von" id="von" value="[VON]" /></td>
|
<td><input type="text" name="von" id="von" value="[VON]" /></td>
|
||||||
|
@ -77,6 +77,7 @@ class Exportbuchhaltung
|
|||||||
$rgchecked = $this->app->Secure->GetPOST("rechnung");
|
$rgchecked = $this->app->Secure->GetPOST("rechnung");
|
||||||
$gschecked = $this->app->Secure->GetPOST("gutschrift");
|
$gschecked = $this->app->Secure->GetPOST("gutschrift");
|
||||||
$vbchecked = $this->app->Secure->GetPOST("verbindlichkeit");
|
$vbchecked = $this->app->Secure->GetPOST("verbindlichkeit");
|
||||||
|
$lgchecked = $this->app->Secure->GetPOST("lieferantengutschrift");
|
||||||
$diffignore = $this->app->Secure->GetPOST("diffignore");
|
$diffignore = $this->app->Secure->GetPOST("diffignore");
|
||||||
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
|
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
|
||||||
|
|
||||||
@ -97,6 +98,7 @@ class Exportbuchhaltung
|
|||||||
$rgchecked = true;
|
$rgchecked = true;
|
||||||
$gschecked = true;
|
$gschecked = true;
|
||||||
$vbchecked = true;
|
$vbchecked = true;
|
||||||
|
$lgchecked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$missing_obligatory = array();
|
$missing_obligatory = array();
|
||||||
@ -134,7 +136,8 @@ class Exportbuchhaltung
|
|||||||
if (
|
if (
|
||||||
!$rgchecked &&
|
!$rgchecked &&
|
||||||
!$gschecked &&
|
!$gschecked &&
|
||||||
!$vbchecked
|
!$vbchecked &&
|
||||||
|
!$lgchecked
|
||||||
) {
|
) {
|
||||||
$msg = "<div class=error>Bitte mindestens eine Belegart auswählen.</div>";
|
$msg = "<div class=error>Bitte mindestens eine Belegart auswählen.</div>";
|
||||||
$dataok = false;
|
$dataok = false;
|
||||||
@ -159,7 +162,7 @@ class Exportbuchhaltung
|
|||||||
if ($dataok) {
|
if ($dataok) {
|
||||||
$filename = "EXTF_".date('Ymd') . "_Buchungsstapel_DATEV_export.csv";
|
$filename = "EXTF_".date('Ymd') . "_Buchungsstapel_DATEV_export.csv";
|
||||||
try {
|
try {
|
||||||
$csv = $this->DATEV_Buchuchungsstapel($rgchecked, $gschecked, $vbchecked, $buchhaltung_berater, $buchhaltung_mandant, $buchhaltung_wj_beginn, $buchhaltung_sachkontenlaenge, $von, $bis, $projekt, $filename, $diffignore, $sachkonto_kennung);
|
$csv = $this->DATEV_Buchuchungsstapel($rgchecked, $gschecked, $vbchecked, $lgchecked, $buchhaltung_berater, $buchhaltung_mandant, $buchhaltung_wj_beginn, $buchhaltung_sachkontenlaenge, $von, $bis, $projekt, $filename, $diffignore, $sachkonto_kennung);
|
||||||
header("Content-Disposition: attachment; filename=" . $filename);
|
header("Content-Disposition: attachment; filename=" . $filename);
|
||||||
header("Pragma: no-cache");
|
header("Pragma: no-cache");
|
||||||
header("Expires: 0");
|
header("Expires: 0");
|
||||||
@ -198,6 +201,7 @@ class Exportbuchhaltung
|
|||||||
$this->app->Tpl->SET('RGCHECKED',$rgchecked?'checked':'');
|
$this->app->Tpl->SET('RGCHECKED',$rgchecked?'checked':'');
|
||||||
$this->app->Tpl->SET('GSCHECKED',$gschecked?'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('LGCHECKED',$lgchecked?'checked':'');
|
||||||
$this->app->Tpl->SET('DIFFIGNORE',$diffignore?'checked':'');
|
$this->app->Tpl->SET('DIFFIGNORE',$diffignore?'checked':'');
|
||||||
|
|
||||||
$this->app->Tpl->SET('VON', $von_form);
|
$this->app->Tpl->SET('VON', $von_form);
|
||||||
@ -212,7 +216,7 @@ class Exportbuchhaltung
|
|||||||
* Create DATEV Buchhungsstapel
|
* Create DATEV Buchhungsstapel
|
||||||
* @throws ConsistencyException with string (list of items) if consistency check fails and no sachkonto for differences is given
|
* @throws ConsistencyException with string (list of items) if consistency check fails and no sachkonto for differences is given
|
||||||
*/
|
*/
|
||||||
function DATEV_Buchuchungsstapel(bool $rechnung, bool $gutschrift, bool $verbindlichkeit, string $berater, string $mandant, datetime $wj_beginn, int $sachkontenlaenge, datetime $von, datetime $bis, int $projekt = 0, string $filename = 'EXTF_Buchungsstapel_DATEV_export.csv', $diffignore = false, $sachkonto_differences) : string {
|
function DATEV_Buchuchungsstapel(bool $rechnung, bool $gutschrift, bool $verbindlichkeit, bool $lieferantengutschrift, string $berater, string $mandant, datetime $wj_beginn, int $sachkontenlaenge, datetime $von, datetime $bis, int $projekt = 0, string $filename = 'EXTF_Buchungsstapel_DATEV_export.csv', $diffignore = false, $sachkonto_differences) : string {
|
||||||
|
|
||||||
$datev_header_definition = array (
|
$datev_header_definition = array (
|
||||||
'1' => 'Kennzeichen',
|
'1' => 'Kennzeichen',
|
||||||
@ -479,7 +483,7 @@ class Exportbuchhaltung
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'typ' => 'verbindlichkeit',
|
'typ' => 'verbindlichkeit',
|
||||||
'subtable' => 'verbindlichkeit_kontierung',
|
'subtable' => 'verbindlichkeit_position',
|
||||||
'kennzeichen' => 'H',
|
'kennzeichen' => 'H',
|
||||||
'kennzeichen_negativ' => 'S',
|
'kennzeichen_negativ' => 'S',
|
||||||
'field_belegnr' => 'b.rechnung',
|
'field_belegnr' => 'b.rechnung',
|
||||||
@ -490,11 +494,30 @@ class Exportbuchhaltung
|
|||||||
'field_kontonummer' => 'a.lieferantennummer_buchhaltung',
|
'field_kontonummer' => 'a.lieferantennummer_buchhaltung',
|
||||||
'field_kundennummer' => 'a.lieferantennummer',
|
'field_kundennummer' => 'a.lieferantennummer',
|
||||||
'field_betrag_gesamt' => 'b.betrag',
|
'field_betrag_gesamt' => 'b.betrag',
|
||||||
'field_betrag' => 'p.betrag',
|
'field_betrag' => 'p.preis*p.menge*((100+p.steuersatz)/100)',
|
||||||
'field_gegenkonto' => 'gegenkonto',
|
'field_gegenkonto' => '(SELECT sachkonto FROM kontorahmen k WHERE k.id = p.kontorahmen)',
|
||||||
'condition_where' => '',
|
'condition_where' => ' AND b.status IN (\'freigegeben\')',
|
||||||
'Buchungstyp' => '',
|
'Buchungstyp' => '',
|
||||||
'do' => $verbindlichkeit
|
'do' => $verbindlichkeit
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'typ' => 'lieferantengutschrift',
|
||||||
|
'subtable' => 'lieferantengutschrift_position',
|
||||||
|
'kennzeichen' => 'S',
|
||||||
|
'kennzeichen_negativ' => 'H',
|
||||||
|
'field_belegnr' => 'b.rechnung',
|
||||||
|
'field_name' => 'a.name',
|
||||||
|
'field_date' => 'rechnungsdatum',
|
||||||
|
'field_auftrag' => '\'\'',
|
||||||
|
'field_zahlweise' => '\'\'',
|
||||||
|
'field_kontonummer' => 'a.lieferantennummer_buchhaltung',
|
||||||
|
'field_kundennummer' => 'a.lieferantennummer',
|
||||||
|
'field_betrag_gesamt' => 'b.betrag',
|
||||||
|
'field_betrag' => 'p.preis*p.menge*((100+p.steuersatz)/100)',
|
||||||
|
'field_gegenkonto' => '(SELECT sachkonto FROM kontorahmen k WHERE k.id = p.kontorahmen)',
|
||||||
|
'condition_where' => ' AND b.status IN (\'freigegeben\')',
|
||||||
|
'Buchungstyp' => '',
|
||||||
|
'do' => $lieferantengutschrift
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -505,19 +528,20 @@ class Exportbuchhaltung
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
|
".$typ['typ']." id,
|
||||||
".$typ['field_belegnr']." as belegnr,
|
".$typ['field_belegnr']." as belegnr,
|
||||||
".$typ['field_auftrag']." as auftrag,
|
".$typ['field_auftrag']." as auftrag,
|
||||||
".$typ['field_zahlweise']." as zahlweise,
|
".$typ['field_zahlweise']." as zahlweise,
|
||||||
if(".$typ['field_kontonummer']." <> '',".$typ['field_kontonummer'].",".$typ['field_kundennummer'].") as kundennummer,
|
if(".$typ['field_kontonummer']." <> '',".$typ['field_kontonummer'].",".$typ['field_kundennummer'].") as kundennummer,
|
||||||
".$typ['field_name']." as name,
|
".$typ['field_name']." as name,
|
||||||
b.ustid,
|
a.ustid,
|
||||||
b.".$typ['field_date']." as datum,
|
b.".$typ['field_date']." as datum,
|
||||||
p.id as pos_id,
|
p.id as pos_id,
|
||||||
".$typ['field_betrag_gesamt']." as betrag_gesamt,
|
".$typ['field_betrag_gesamt']." as betrag_gesamt,
|
||||||
b.waehrung,
|
b.waehrung,
|
||||||
ROUND(".$typ['field_betrag'].",2) as betrag,
|
ROUND(".$typ['field_betrag'].",2) as betrag,
|
||||||
".$typ['field_gegenkonto']." as gegenkonto,
|
".$typ['field_gegenkonto']." as gegenkonto,
|
||||||
p.waehrung as pos_waehrung
|
b.waehrung as pos_waehrung
|
||||||
FROM
|
FROM
|
||||||
".$typ['typ']." b
|
".$typ['typ']." b
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
@ -535,6 +559,7 @@ class Exportbuchhaltung
|
|||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
|
id,
|
||||||
belegnr,
|
belegnr,
|
||||||
datum,
|
datum,
|
||||||
betrag_gesamt,
|
betrag_gesamt,
|
||||||
@ -546,7 +571,7 @@ class Exportbuchhaltung
|
|||||||
FROM
|
FROM
|
||||||
(".$sql.") posten
|
(".$sql.") posten
|
||||||
GROUP BY
|
GROUP BY
|
||||||
belegnr
|
id
|
||||||
) summen
|
) summen
|
||||||
WHERE betrag_gesamt <> betrag_summe OR betrag_summe IS NULL";
|
WHERE betrag_gesamt <> betrag_summe OR betrag_summe IS NULL";
|
||||||
|
|
||||||
@ -619,7 +644,7 @@ class Exportbuchhaltung
|
|||||||
$data['Belegfeld 1'] = mb_strimwidth($row['belegnr'],0,12);
|
$data['Belegfeld 1'] = mb_strimwidth($row['belegnr'],0,12);
|
||||||
$data['Konto'] = $row['kundennummer']; // obligatory
|
$data['Konto'] = $row['kundennummer']; // obligatory
|
||||||
|
|
||||||
if ($typ['field_gegenkonto'] == 'gegenkonto') {
|
if (!empty($typ['field_gegenkonto'])) {
|
||||||
$data['Gegenkonto (ohne BU-Schlüssel)'] = $row['gegenkonto']; // obligatory
|
$data['Gegenkonto (ohne BU-Schlüssel)'] = $row['gegenkonto']; // obligatory
|
||||||
} else {
|
} else {
|
||||||
$data['Gegenkonto (ohne BU-Schlüssel)'] = $erloes; // obligatory
|
$data['Gegenkonto (ohne BU-Schlüssel)'] = $erloes; // obligatory
|
||||||
|
Loading…
Reference in New Issue
Block a user