mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
Merge branch 'master' into onlineshops
This commit is contained in:
commit
014481d455
@ -27569,6 +27569,16 @@ function Firmendaten($field,$projekt="")
|
|||||||
return $buchstaben_anteil_string.$neue_nummer;
|
return $buchstaben_anteil_string.$neue_nummer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CalcNextArtikelNummer($nummer) {
|
||||||
|
$check = null;
|
||||||
|
do {
|
||||||
|
$nummer = $this->CalcNextNummer($nummer);
|
||||||
|
$sql = "SELECT id FROM artikel WHERE nummer = '".$nummer."'";
|
||||||
|
$check = $this->app->DB->Select($sql);
|
||||||
|
} while (!empty($check));
|
||||||
|
return ($nummer);
|
||||||
|
}
|
||||||
|
|
||||||
function GetNextNummer($type,$projekt="",$data="")
|
function GetNextNummer($type,$projekt="",$data="")
|
||||||
{
|
{
|
||||||
$doctype = $type;
|
$doctype = $type;
|
||||||
@ -28043,7 +28053,7 @@ function Firmendaten($field,$projekt="")
|
|||||||
$nurzahlen = preg_replace("/[^0-9]/","",$next_nummer_alt);
|
$nurzahlen = preg_replace("/[^0-9]/","",$next_nummer_alt);
|
||||||
$laenge = strlen($nurzahlen);
|
$laenge = strlen($nurzahlen);
|
||||||
|
|
||||||
$next_nummer = $this->CalcNextNummer($next_nummer_alt);
|
$next_nummer = $this->CalcNextArtikelNummer($next_nummer_alt);
|
||||||
//$nurbuchstaben.str_pad($nurzahlen+1, $laenge ,'0', STR_PAD_LEFT);
|
//$nurbuchstaben.str_pad($nurzahlen+1, $laenge ,'0', STR_PAD_LEFT);
|
||||||
$neue_nummer = $next_nummer;
|
$neue_nummer = $next_nummer;
|
||||||
|
|
||||||
@ -28056,12 +28066,12 @@ function Firmendaten($field,$projekt="")
|
|||||||
if($eigenernummernkreis=="1")
|
if($eigenernummernkreis=="1")
|
||||||
{
|
{
|
||||||
$neue_nummer = $this->app->DB->Select("SELECT next_artikelnummer FROM projekt WHERE id='$projekt' LIMIT 1");
|
$neue_nummer = $this->app->DB->Select("SELECT next_artikelnummer FROM projekt WHERE id='$projekt' LIMIT 1");
|
||||||
if($this->app->DB->Select("SELECT id FROM artikel WHERE nummer = '".$this->app->DB->real_escape_string($neue_nummer)."' LIMIT 1"))$neue_nummer = $this->CalcNextNummer($neue_nummer);
|
if($this->app->DB->Select("SELECT id FROM artikel WHERE nummer = '".$this->app->DB->real_escape_string($neue_nummer)."' LIMIT 1"))$neue_nummer = $this->CalcNextArtikelNummer($neue_nummer);
|
||||||
$next_nummer = $this->CalcNextNummer($neue_nummer);
|
$next_nummer = $this->CalcNextArtikelNummer($neue_nummer);
|
||||||
$this->app->DB->Update("UPDATE projekt SET next_artikelnummer='".$next_nummer."' WHERE id='$projekt' LIMIT 1");
|
$this->app->DB->Update("UPDATE projekt SET next_artikelnummer='".$next_nummer."' WHERE id='$projekt' LIMIT 1");
|
||||||
} else {
|
} else {
|
||||||
//zentraler nummernkreis mit prefix
|
//zentraler nummernkreis mit prefix
|
||||||
$next_nummer = $this->CalcNextNummer($this->Firmendaten("next_artikelnummer"));
|
$next_nummer = $this->CalcNextArtikelNummer($this->Firmendaten("next_artikelnummer"));
|
||||||
$this->FirmendatenSet("next_artikelnummer",$next_nummer);
|
$this->FirmendatenSet("next_artikelnummer",$next_nummer);
|
||||||
if($next_nummer_alt!="") $neue_nummer=$next_nummer_alt.$next_nummer;
|
if($next_nummer_alt!="") $neue_nummer=$next_nummer_alt.$next_nummer;
|
||||||
else $neue_nummer = $next_nummer;
|
else $neue_nummer = $next_nummer;
|
||||||
@ -28076,15 +28086,15 @@ function Firmendaten($field,$projekt="")
|
|||||||
if($eigenernummernkreis)
|
if($eigenernummernkreis)
|
||||||
{
|
{
|
||||||
$neue_nummer = $this->app->DB->Select("SELECT next_artikelnummer FROM projekt WHERE id='$projekt' LIMIT 1");
|
$neue_nummer = $this->app->DB->Select("SELECT next_artikelnummer FROM projekt WHERE id='$projekt' LIMIT 1");
|
||||||
if($this->app->DB->Select("SELECT id FROM artikel WHERE nummer = '".$this->app->DB->real_escape_string($neue_nummer)."' LIMIT 1"))$neue_nummer = $this->CalcNextNummer($neue_nummer);
|
if($this->app->DB->Select("SELECT id FROM artikel WHERE nummer = '".$this->app->DB->real_escape_string($neue_nummer)."' LIMIT 1"))$neue_nummer = $this->CalcNextArtikelNummer($neue_nummer);
|
||||||
$next_nummer = $this->CalcNextNummer($neue_nummer);
|
$next_nummer = $this->CalcNextArtikelNummer($neue_nummer);
|
||||||
$this->app->DB->Update("UPDATE projekt SET next_artikelnummer='".$next_nummer."' WHERE id='$projekt' LIMIT 1");
|
$this->app->DB->Update("UPDATE projekt SET next_artikelnummer='".$next_nummer."' WHERE id='$projekt' LIMIT 1");
|
||||||
}else{
|
}else{
|
||||||
$firmennummer = $this->app->erp->Firmendaten('next_artikelnummer');
|
$firmennummer = $this->app->erp->Firmendaten('next_artikelnummer');
|
||||||
if($firmennummer)
|
if($firmennummer)
|
||||||
{
|
{
|
||||||
$next_nummer = $firmennummer;
|
$next_nummer = $firmennummer;
|
||||||
$neue_nummer = $this->CalcNextNummer($next_nummer);
|
$neue_nummer = $this->CalcNextArtikelNummer($next_nummer);
|
||||||
$this->FirmendatenSet('next_artikelnummer', $neue_nummer);
|
$this->FirmendatenSet('next_artikelnummer', $neue_nummer);
|
||||||
$neue_nummer = $this->app->erp->Firmendaten('next_artikelnummer');
|
$neue_nummer = $this->app->erp->Firmendaten('next_artikelnummer');
|
||||||
} else {
|
} else {
|
||||||
@ -28106,10 +28116,11 @@ function Firmendaten($field,$projekt="")
|
|||||||
$neue_nummer = $this->app->DB->Select("SELECT MAX(CAST(nummer AS UNSIGNED)) FROM artikel WHERE nummer LIKE '1%'");
|
$neue_nummer = $this->app->DB->Select("SELECT MAX(CAST(nummer AS UNSIGNED)) FROM artikel WHERE nummer LIKE '1%'");
|
||||||
if(($neue_nummer=="" || $neue_nummer=="0")) $neue_nummer = "100000";
|
if(($neue_nummer=="" || $neue_nummer=="0")) $neue_nummer = "100000";
|
||||||
}
|
}
|
||||||
$neue_nummer = $this->CalcNextNummer($neue_nummer);//$neue_nummer + 1;
|
$neue_nummer = $this->CalcNextArtikelNummer($neue_nummer);//$neue_nummer + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->app->erp->ProzessUnlock($process_lock);
|
$this->app->erp->ProzessUnlock($process_lock);
|
||||||
$neue_nummer = str_replace('{JAHR}',date('Y'),$neue_nummer);
|
$neue_nummer = str_replace('{JAHR}',date('Y'),$neue_nummer);
|
||||||
$neue_nummer = str_replace('{MONAT}',date('m'),$neue_nummer);
|
$neue_nummer = str_replace('{MONAT}',date('m'),$neue_nummer);
|
||||||
|
@ -61,7 +61,11 @@
|
|||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
<tr>
|
||||||
|
<td>{|PDF-Dateien exportieren:|}</td>
|
||||||
|
<td><input type="checkbox" name="pdfexport" value="1" [PDFEXPORT] /></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -46,6 +46,91 @@ class Exportbuchhaltung
|
|||||||
var $belegnummer;
|
var $belegnummer;
|
||||||
var $headerwritten = false;
|
var $headerwritten = false;
|
||||||
|
|
||||||
|
function typen($rechnung, $gutschrift, $verbindlichkeit, $lieferantengutschrift) : array {
|
||||||
|
return(
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'typ' => 'rechnung',
|
||||||
|
'subtable' => 'rechnung_position',
|
||||||
|
'kennzeichen' => 'S',
|
||||||
|
'kennzeichen_negativ' => 'H',
|
||||||
|
'field_belegnr' => 'b.belegnr',
|
||||||
|
'field_name' => 'b.name',
|
||||||
|
'field_date' => 'datum',
|
||||||
|
'field_auftrag' => 'MAKE_SET(3,b.auftrag,(SELECT auftrag.internet FROM auftrag WHERE auftrag.id = auftragid))',
|
||||||
|
'field_zahlweise' => 'CONCAT(UCASE(LEFT(b.zahlungsweise, 1)),SUBSTRING(b.zahlungsweise, 2))',
|
||||||
|
'field_kontonummer' => 'a.kundennummer_buchhaltung',
|
||||||
|
'field_kundennummer' => 'b.kundennummer',
|
||||||
|
'field_betrag_gesamt' => 'b.soll',
|
||||||
|
'field_betrag' => 'p.umsatz_brutto_gesamt',
|
||||||
|
'condition_where' => ' AND b.status IN (\'freigegeben\',\'versendet\',\'storniert\')',
|
||||||
|
'Buchungstyp' => 'SR',
|
||||||
|
'do' => $rechnung,
|
||||||
|
'pdf' => 'print'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'typ' => 'gutschrift',
|
||||||
|
'subtable' => 'gutschrift_position',
|
||||||
|
'kennzeichen' => 'H',
|
||||||
|
'kennzeichen_negativ' => 'S',
|
||||||
|
'field_belegnr' => 'b.belegnr',
|
||||||
|
'field_name' => 'b.name',
|
||||||
|
'field_date' => 'datum',
|
||||||
|
'field_auftrag' => '\'\'',
|
||||||
|
'field_zahlweise' => '\'\'',
|
||||||
|
'field_kontonummer' => 'a.kundennummer_buchhaltung',
|
||||||
|
'field_kundennummer' => 'b.kundennummer',
|
||||||
|
'field_betrag_gesamt' => 'b.soll',
|
||||||
|
'field_betrag' => 'p.umsatz_brutto_gesamt',
|
||||||
|
'condition_where' => ' AND b.status IN (\'freigegeben\',\'versendet\')',
|
||||||
|
'Buchungstyp' => '',
|
||||||
|
'do' => $gutschrift,
|
||||||
|
'pdf' => 'print'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'typ' => 'verbindlichkeit',
|
||||||
|
'subtable' => 'verbindlichkeit_position',
|
||||||
|
'kennzeichen' => 'H',
|
||||||
|
'kennzeichen_negativ' => 'S',
|
||||||
|
'field_belegnr' => 'b.rechnung',
|
||||||
|
'field_name' => 'a.name',
|
||||||
|
'field_date' => 'rechnungsdatum',
|
||||||
|
'field_auftrag' => 'b.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\', \'abgeschlossen\')',
|
||||||
|
'Buchungstyp' => '',
|
||||||
|
'do' => $verbindlichkeit,
|
||||||
|
'pdf' => 'load'
|
||||||
|
),
|
||||||
|
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\', \'abgeschlossen\')',
|
||||||
|
'Buchungstyp' => '',
|
||||||
|
'do' => $lieferantengutschrift,
|
||||||
|
'pdf' => 'load'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exportbelegepositionen constructor.
|
* Exportbelegepositionen constructor.
|
||||||
*
|
*
|
||||||
@ -81,6 +166,7 @@ class Exportbuchhaltung
|
|||||||
$diffignore = $this->app->Secure->GetPOST("diffignore");
|
$diffignore = $this->app->Secure->GetPOST("diffignore");
|
||||||
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
|
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
|
||||||
$format = $this->app->Secure->GetPOST('format');
|
$format = $this->app->Secure->GetPOST('format');
|
||||||
|
$pdfexport = $this->app->Secure->GetPOST("pdfexport");
|
||||||
|
|
||||||
$account_id = null;
|
$account_id = null;
|
||||||
if (!empty($sachkonto)) {
|
if (!empty($sachkonto)) {
|
||||||
@ -161,13 +247,93 @@ class Exportbuchhaltung
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($dataok) {
|
if ($dataok) {
|
||||||
$filename = "EXTF_".date('Ymd') . "_Buchungsstapel_DATEV_export.csv";
|
$filename_csv = "EXTF_".date('Ymd') . "_Buchungsstapel_DATEV_export.csv";
|
||||||
try {
|
try {
|
||||||
$csv = $this->DATEV_Buchuchungsstapel($rgchecked, $gschecked, $vbchecked, $lgchecked, $buchhaltung_berater, $buchhaltung_mandant, $buchhaltung_wj_beginn, $buchhaltung_sachkontenlaenge, $von, $bis, $projekt, $filename, $diffignore, $sachkonto_kennung, $format);
|
$csv = $this->DATEV_Buchuchungsstapel($rgchecked, $gschecked, $vbchecked, $lgchecked, $buchhaltung_berater, $buchhaltung_mandant, $buchhaltung_wj_beginn, $buchhaltung_sachkontenlaenge, $von, $bis, $projekt, $filename_csv, $diffignore, $sachkonto_kennung, $format);
|
||||||
header("Content-Disposition: attachment; filename=" . $filename);
|
if ($pdfexport) {
|
||||||
header("Pragma: no-cache");
|
|
||||||
header("Expires: 0");
|
$dateinamezip = 'Export_Buchhaltung_'.date('Y-m-d').'.zip';
|
||||||
echo($csv);
|
|
||||||
|
$zip = new ZipArchive;
|
||||||
|
$zip->open($dateinamezip, ZipArchive::CREATE);
|
||||||
|
|
||||||
|
$zip->addFromString($typ['typ']."/".$filename_csv, $csv);
|
||||||
|
|
||||||
|
$typen = $this->typen($rgchecked, $gschecked, $vbchecked, $lgchecked);
|
||||||
|
|
||||||
|
foreach ($typen as $typ) {
|
||||||
|
$sql = "
|
||||||
|
SELECT id, ".$typ['field_belegnr']." belegnr FROM ".$typ['typ']." b
|
||||||
|
WHERE
|
||||||
|
b.".$typ['field_date']." BETWEEN '".date_format($von,"Y-m-d")."' AND '".date_format($bis,"Y-m-d")."' AND (b.projekt=$projekt OR $projekt=0)".$typ['condition_where'];
|
||||||
|
$belege = $this->app->DB->SelectArr($sql);
|
||||||
|
foreach ($belege as $beleg) {
|
||||||
|
|
||||||
|
if (!$typ['do']) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($typ['pdf']) {
|
||||||
|
case 'print':
|
||||||
|
switch ($typ['typ']) {
|
||||||
|
case 'rechnung':
|
||||||
|
if(class_exists('GutschriftPDFCustom')) {
|
||||||
|
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$Brief = new RechnungPDF($this->app,$projekt);
|
||||||
|
}
|
||||||
|
$Brief->GetRechnung($beleg['id']);
|
||||||
|
break;
|
||||||
|
case 'gutschrift':
|
||||||
|
if(class_exists('RechnungPDFCustom')) {
|
||||||
|
$Brief = new GutschriftPDFCustom($this->app,$projekt);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$Brief = new GutschriftPDF($this->app,$projekt);
|
||||||
|
}
|
||||||
|
$Brief->GetGutschrift($beleg['id']);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
exit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$tmpfile = $Brief->displayTMP();
|
||||||
|
$file_name = $beleg['belegnr'].".pdf";
|
||||||
|
$zip->addFromString($typ['typ']."/".$file_name, file_get_contents($tmpfile));
|
||||||
|
break;
|
||||||
|
case 'load':
|
||||||
|
$file_attachments = $this->app->erp->GetDateiSubjektObjekt('%',$typ['typ'],$beleg['id']);
|
||||||
|
$suffix = "";
|
||||||
|
$count = 0;
|
||||||
|
foreach ($file_attachments as $file_attachment) {
|
||||||
|
if ($this->app->erp->GetDateiEndung($file_attachment) == 'pdf') {
|
||||||
|
$file_contents = $this->app->erp->GetDatei($file_attachment);
|
||||||
|
$file_name = filter_var($beleg['belegnr'],FILTER_SANITIZE_EMAIL).$suffix.".pdf";
|
||||||
|
$zip->addFromString($typ['typ']."/".$file_name, $file_contents);
|
||||||
|
$count++;
|
||||||
|
$suffix = "_".$count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$zip->close();
|
||||||
|
|
||||||
|
// download
|
||||||
|
header('Content-Type: application/zip');
|
||||||
|
header("Content-Disposition: attachment; filename=$dateinamezip");
|
||||||
|
header('Content-Length: ' . filesize($dateinamezip));
|
||||||
|
|
||||||
|
readfile($dateinamezip);
|
||||||
|
unlink($dateinamezip);
|
||||||
|
} else {
|
||||||
|
header("Content-Disposition: attachment; filename=" . $filename_csv);
|
||||||
|
header("Pragma: no-cache");
|
||||||
|
header("Expires: 0");
|
||||||
|
echo($csv);
|
||||||
|
}
|
||||||
$this->app->ExitXentral();
|
$this->app->ExitXentral();
|
||||||
}
|
}
|
||||||
catch (ConsistencyException $e) {
|
catch (ConsistencyException $e) {
|
||||||
@ -204,6 +370,7 @@ class Exportbuchhaltung
|
|||||||
$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('LGCHECKED',$lgchecked?'checked':'');
|
||||||
$this->app->Tpl->SET('DIFFIGNORE',$diffignore?'checked':'');
|
$this->app->Tpl->SET('DIFFIGNORE',$diffignore?'checked':'');
|
||||||
|
$this->app->Tpl->SET('PDFEXPORT',$pdfexport?'checked':'');
|
||||||
|
|
||||||
$this->app->Tpl->SET('VON', $von_form);
|
$this->app->Tpl->SET('VON', $von_form);
|
||||||
$this->app->Tpl->SET('BIS', $bis_form);
|
$this->app->Tpl->SET('BIS', $bis_form);
|
||||||
@ -444,90 +611,13 @@ class Exportbuchhaltung
|
|||||||
$csv .= "\r\n";
|
$csv .= "\r\n";
|
||||||
|
|
||||||
// Collate data and transform in RAM
|
// Collate data and transform in RAM
|
||||||
$typen = array(
|
$typen = $this->typen($rechnung, $gutschrift, $verbindlichkeit, $lieferantengutschrift);
|
||||||
array(
|
|
||||||
'typ' => 'rechnung',
|
|
||||||
'subtable' => 'rechnung_position',
|
|
||||||
'kennzeichen' => 'S',
|
|
||||||
'kennzeichen_negativ' => 'H',
|
|
||||||
'field_belegnr' => 'b.belegnr',
|
|
||||||
'field_name' => 'b.name',
|
|
||||||
'field_date' => 'datum',
|
|
||||||
'field_auftrag' => 'MAKE_SET(3,b.auftrag,(SELECT auftrag.internet FROM auftrag WHERE auftrag.id = auftragid))',
|
|
||||||
'field_zahlweise' => 'CONCAT(UCASE(LEFT(b.zahlungsweise, 1)),SUBSTRING(b.zahlungsweise, 2))',
|
|
||||||
'field_kontonummer' => 'a.kundennummer_buchhaltung',
|
|
||||||
'field_kundennummer' => 'b.kundennummer',
|
|
||||||
'field_betrag_gesamt' => 'b.soll',
|
|
||||||
'field_betrag' => 'p.umsatz_brutto_gesamt',
|
|
||||||
'condition_where' => ' AND b.status IN (\'freigegeben\',\'versendet\',\'storniert\')',
|
|
||||||
'Buchungstyp' => 'SR',
|
|
||||||
'do' => $rechnung
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'typ' => 'gutschrift',
|
|
||||||
'subtable' => 'gutschrift_position',
|
|
||||||
'kennzeichen' => 'H',
|
|
||||||
'kennzeichen_negativ' => 'S',
|
|
||||||
'field_belegnr' => 'b.belegnr',
|
|
||||||
'field_name' => 'b.name',
|
|
||||||
'field_date' => 'datum',
|
|
||||||
'field_auftrag' => '\'\'',
|
|
||||||
'field_zahlweise' => '\'\'',
|
|
||||||
'field_kontonummer' => 'a.kundennummer_buchhaltung',
|
|
||||||
'field_kundennummer' => 'b.kundennummer',
|
|
||||||
'field_betrag_gesamt' => 'b.soll',
|
|
||||||
'field_betrag' => 'p.umsatz_brutto_gesamt',
|
|
||||||
'condition_where' => ' AND b.status IN (\'freigegeben\',\'versendet\')',
|
|
||||||
'Buchungstyp' => '',
|
|
||||||
'do' => $gutschrift
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'typ' => 'verbindlichkeit',
|
|
||||||
'subtable' => 'verbindlichkeit_position',
|
|
||||||
'kennzeichen' => 'H',
|
|
||||||
'kennzeichen_negativ' => 'S',
|
|
||||||
'field_belegnr' => 'b.rechnung',
|
|
||||||
'field_name' => 'a.name',
|
|
||||||
'field_date' => 'rechnungsdatum',
|
|
||||||
'field_auftrag' => 'b.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' => $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
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($typen as $typ) {
|
foreach ($typen as $typ) {
|
||||||
|
|
||||||
if (!$typ['do']) {
|
if (!$typ['do']) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!empty($typ['field_gegenkonto'])) {
|
if (!empty($typ['field_gegenkonto'])) {
|
||||||
$sql_gegenkonto = $typ['field_gegenkonto'];
|
$sql_gegenkonto = $typ['field_gegenkonto'];
|
||||||
} else
|
} else
|
||||||
|
Loading…
Reference in New Issue
Block a user