Merge remote-tracking branch 'upstream/master' into sendcloud

This commit is contained in:
Andreas Palm
2023-01-29 23:37:48 +01:00
78 changed files with 126995 additions and 23607 deletions
+111 -5363
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -43,7 +43,7 @@ class AuftragPDF extends BriefpapierCustom {
{
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
$check = $this->app->erp->SteuerAusBeleg($this->doctype,$id);
if(count($check)>1)$this->ust_spalteausblende=false;
if(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false;
else $this->ust_spalteausblende=true;
}
+173 -166
View File
@@ -54,6 +54,11 @@ class Briefpapier extends SuperFPDF {
/** @var array **/
private $styleData;
// Typed variables to get rid of the typos, $border omitted intenionally
function Cell_typed(int $w, int $h = 0, string $txt = '', $border = 0, int $ln = 0, string $align = '', bool $fill = false, string $link = '') {
return($this->Cell($w,$h,$txt,$border,$ln,$align,$fill,$link));
}
/**
* Briefpapier constructor.
*
@@ -1006,9 +1011,9 @@ class Briefpapier extends SuperFPDF {
$this->cMargin=-3;
if($this->getStyleElement("seite_belegnr"))
$this->Cell(0,8,$this->app->erp->Beschriftung("dokument_seite").' '.$this->PageNo().' '.$this->app->erp->Beschriftung("dokument_seitevon").' {nb} '.$this->zusatzfooter,0,0,$this->seite_von_ausrichtung);
$this->Cell_typed(0,8,$this->app->erp->Beschriftung("dokument_seite").' '.$this->PageNo().' '.$this->app->erp->Beschriftung("dokument_seitevon").' {nb} '.$this->zusatzfooter,0,0,$this->seite_von_ausrichtung);
else
$this->Cell(0,8,$this->app->erp->Beschriftung("dokument_seite").' '.$this->PageNo().' '.$this->app->erp->Beschriftung("dokument_seitevon").' {nb}',0,0,$this->seite_von_ausrichtung);
$this->Cell_typed(0,8,$this->app->erp->Beschriftung("dokument_seite").' '.$this->PageNo().' '.$this->app->erp->Beschriftung("dokument_seitevon").' {nb}',0,0,$this->seite_von_ausrichtung);
$this->cMargin = $tmpc;
@@ -1836,8 +1841,10 @@ class Briefpapier extends SuperFPDF {
//$this->setStationery("/home/eproo/eproo-master/app/main/www/lib/dokumente/demo.pdf");
$this->SetDisplayMode("real","single");
/*
if($this->getStyleElement("abstand_seitenrandrechts")=="")
$this->getStyleElementSet("abstand_seitenrandrechts",$this->getStyleElement("abstand_seitenrandlinks"));
*/
$this->SetMargins($this->getStyleElement("abstand_seitenrandlinks"),50,$this->getStyleElement("abstand_seitenrandrechts"));
$this->SetAutoPageBreak(true,$this->getStyleElement("abstand_umbruchunten"));
@@ -1886,7 +1893,7 @@ class Briefpapier extends SuperFPDF {
$this->SetTextColor(0,0,0);
if($this->doctype!="lieferschein" && $this->doctype!="preisanfrage" && !$this->nichtsichtbar_summe) {
$this->renderTotals();
} else $this->Cell(1,5,'',0);
} else $this->Cell_typed(1,5,'',0);
}
$this->renderFooter();
$this->logofile = "";
@@ -1928,7 +1935,7 @@ class Briefpapier extends SuperFPDF {
if($this->recipient['anrede']!="" && $this->getStyleElement('typimdokument'))
{
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
$this->Cell(80,5,$this->recipient['anrede'],0,1);
$this->Cell_typed(80,5,$this->recipient['anrede'],0,1);
}
$this->SetMargins($this->getStyleElement("abstand_adresszeilelinks"),50);
@@ -1940,10 +1947,10 @@ class Briefpapier extends SuperFPDF {
$array = explode( "\n", wordwrap($this->recipient['enterprise'], $charlimit));
foreach($array as $row)
{
$this->Cell(80,5,$this->app->erp->ReadyForPDF($row),0,1);
$this->Cell_typed(80,5,$this->app->erp->ReadyForPDF($row),0,1);
}
} else {
$this->Cell(80,5,$this->app->erp->ReadyForPDF($this->recipient['enterprise']),0,1);
$this->Cell_typed(80,5,$this->app->erp->ReadyForPDF($this->recipient['enterprise']),0,1);
}
}
@@ -1952,30 +1959,30 @@ class Briefpapier extends SuperFPDF {
if($this->recipient['firstname']!="")
{
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
$this->Cell(80,5,$this->recipient['firstname'],0,1);
$this->Cell_typed(80,5,$this->recipient['firstname'],0,1);
}
if($this->recipient['address2']!="") {
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
$this->Cell(80,5,$this->recipient['address2'],0,1);
$this->Cell_typed(80,5,$this->recipient['address2'],0,1);
}
if($this->recipient['address3']!="")
{
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
$this->Cell(80,5,$this->recipient['address3'],0,1);
$this->Cell_typed(80,5,$this->recipient['address3'],0,1);
}
if($this->recipient['address4']!="")
{
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
$this->Cell(80,5,$this->recipient['address4'],0,1);
$this->Cell_typed(80,5,$this->recipient['address4'],0,1);
}
//$this->Cell(80,5,$this->recipient['firstname']." ".$this->recipient['familyname'],0,1);
//$this->Cell_typed(80,5,$this->recipient['firstname']." ".$this->recipient['familyname'],0,1);
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
$this->Cell(80,5,$this->recipient['address1'],0,1);
$this->Cell_typed(80,5,$this->recipient['address1'],0,1);
$this->SetFont($this->GetFont(),'',10);
@@ -1987,22 +1994,22 @@ class Briefpapier extends SuperFPDF {
$inland = $this->getStyleElement("land");
if($this->recipient['country']!=$inland)
{
//$this->Cell(80,5,$this->recipient['country']."-".$this->recipient['areacode']." ".$this->recipient['city'],0,1);
//$this->Cell_typed(80,5,$this->recipient['country']."-".$this->recipient['areacode']." ".$this->recipient['city'],0,1);
if(function_exists('mb_strtoupper'))
$this->Cell(80,5,mb_strtoupper($this->recipient['areacode']." ".$this->recipient['city'],"UTF-8"),0,1);
$this->Cell_typed(80,5,mb_strtoupper($this->recipient['areacode']." ".$this->recipient['city'],"UTF-8"),0,1);
else
$this->Cell(80,5,strtoupper($this->recipient['areacode']." ".$this->recipient['city']),0,1);
$this->Cell_typed(80,5,strtoupper($this->recipient['areacode']." ".$this->recipient['city']),0,1);
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
$this->Cell(80,5,strtoupper($this->app->erp->UmlauteEntfernen($this->app->GetLandLang($this->recipient['country'],$this->sprache))),0,1);
$this->Cell_typed(80,5,strtoupper($this->app->erp->UmlauteEntfernen($this->app->GetLandLang($this->recipient['country'],$this->sprache))),0,1);
}
else {
$this->Cell(80,5,$this->recipient['areacode']." ".$this->recipient['city'],0,1);
$this->Cell_typed(80,5,$this->recipient['areacode']." ".$this->recipient['city'],0,1);
}
//$this->SetFont($this->GetFont(),'',9);
//if(isset($this->recipient['country'])) $this->Cell(80,5,$this->recipient['country'],0,1);
//if(isset($this->recipient['country'])) $this->Cell_typed(80,5,$this->recipient['country'],0,1);
//FREITEXT1
@@ -2074,9 +2081,9 @@ class Briefpapier extends SuperFPDF {
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
if($this->getStyleElement("absenderunterstrichen")=="1")
$this->Cell($this->GetStringWidth($cellStr)+2,5,$cellStr,'B');
$this->Cell_typed($this->GetStringWidth($cellStr)+2,5,$cellStr,'B');
else
$this->Cell($this->GetStringWidth($cellStr)+2,5,$cellStr,'');
$this->Cell_typed($this->GetStringWidth($cellStr)+2,5,$cellStr,'');
}
if($this->nichtsichtbar_rechtsoben!=true)
@@ -2088,70 +2095,70 @@ class Briefpapier extends SuperFPDF {
$this->SetXY($xOffset,10);
$this->SetFont($this->GetFont(),'',9);
$this->Cell(30,$lineHeight,"Name der Gesellschaft: ",0,0,'R');
$this->Cell_typed(30,$lineHeight,"Name der Gesellschaft: ",0,0,'R');
$this->SetFont($this->GetFont(),'B',9);
$this->Cell(60,$lineHeight,$this->sender['enterprise'],0,2);
$this->Cell_typed(60,$lineHeight,$this->sender['enterprise'],0,2);
if(isset($this->sender['enterprise2']))
$this->Cell(60,$lineHeight,$this->sender['enterprise2'],0,2);
$this->Cell_typed(60,$lineHeight,$this->sender['enterprise2'],0,2);
$this->SetXY($xOffset,$this->GetY());
$this->SetFont($this->GetFont(),'',9);
$this->Cell(30,$lineHeight,"Sitz der Gesellschaft: ",0,0,'R');
$this->Cell_typed(30,$lineHeight,"Sitz der Gesellschaft: ",0,0,'R');
$this->SetFont($this->GetFont(),'B',9);
$this->Cell(60,$lineHeight,$this->sender['address1'],0,2);
$this->Cell_typed(60,$lineHeight,$this->sender['address1'],0,2);
if(isset($this->sender['address2']))
$this->Cell(60,$lineHeight,$this->sender['address2'],0,2);
$this->Cell(60,$lineHeight,$this->sender['areacode']." ".$this->sender['city'],0,2);
$this->Cell_typed(60,$lineHeight,$this->sender['address2'],0,2);
$this->Cell_typed(60,$lineHeight,$this->sender['areacode']." ".$this->sender['city'],0,2);
$this->SetXY($xOffset,$this->GetY()+$absatz); //abstand
$this->SetFont($this->GetFont(),'',9);
if(isset($this->sender['phone1'])) {
$this->Cell(30,$lineHeight,"Fon: ",0,0,'R');
$this->Cell(60,$lineHeight,$this->sender['phone1'],0,2);
$this->Cell_typed(30,$lineHeight,"Fon: ",0,0,'R');
$this->Cell_typed(60,$lineHeight,$this->sender['phone1'],0,2);
}
if(isset($this->sender['fax'])) {
$this->SetXY($xOffset,$this->GetY());
$this->Cell(30,$lineHeight,"Fax: ",0,0,'R');
$this->Cell(60,$lineHeight,$this->sender['fax'],0,2);
$this->Cell_typed(30,$lineHeight,"Fax: ",0,0,'R');
$this->Cell_typed(60,$lineHeight,$this->sender['fax'],0,2);
}
$this->SetXY($xOffset, $this->GetY()+$absatz); //abstand
if(isset($this->sender['email'])) {
$this->Cell(30,$lineHeight,"Mail: ",0,0,'R');
$this->Cell(60,$lineHeight,$this->sender['email'],0,2);
$this->Cell_typed(30,$lineHeight,"Mail: ",0,0,'R');
$this->Cell_typed(60,$lineHeight,$this->sender['email'],0,2);
}
if(isset($this->sender['web'])) {
$this->SetXY($xOffset,$this->GetY());
$this->Cell(30,$lineHeight,"Web: ",0,0,'R');
$this->Cell(60,$lineHeight,$this->sender['web'],0,2);
$this->Cell_typed(30,$lineHeight,"Web: ",0,0,'R');
$this->Cell_typed(60,$lineHeight,$this->sender['web'],0,2);
}
$this->SetXY($xOffset, $this->GetY()+$absatz); //abstand
if(isset($this->sender['ustid'])) {
$this->Cell(30,$lineHeight,"UST-ID: ",0,0,'R');
$this->Cell(60,$lineHeight,$this->sender['ustid'],0,2);
$this->Cell_typed(30,$lineHeight,"UST-ID: ",0,0,'R');
$this->Cell_typed(60,$lineHeight,$this->sender['ustid'],0,2);
}
if(isset($this->sender['taxnr'])) {
$this->SetXY($xOffset,$this->GetY());
$this->Cell(30,$lineHeight,"Steuer-Nr.: ",0,0,'R');
$this->Cell(60,$lineHeight,$this->sender['taxnr'],0,2);
$this->Cell_typed(30,$lineHeight,"Steuer-Nr.: ",0,0,'R');
$this->Cell_typed(60,$lineHeight,$this->sender['taxnr'],0,2);
}
if(isset($this->sender['hreg'])) {
$this->SetXY($xOffset,$this->GetY());
$this->Cell(30,$lineHeight,"Handelsregister: ",0,0,'R');
$this->Cell(60,$lineHeight,$this->sender['hreg'],0,2);
$this->Cell_typed(30,$lineHeight,"Handelsregister: ",0,0,'R');
$this->Cell_typed(60,$lineHeight,$this->sender['hreg'],0,2);
}
$this->SetXY($xOffset,$this->GetY());
$this->Cell(30,$lineHeight,utf8_encode("Gesch�ftsf�hrung: "),0,0,'R');
$this->Cell(60,$lineHeight,$this->sender['firstname'].' '.$this->sender['familyname'],0,2);
$this->Cell_typed(30,$lineHeight,utf8_encode("Gesch�ftsf�hrung: "),0,0,'R');
$this->Cell_typed(60,$lineHeight,$this->sender['firstname'].' '.$this->sender['familyname'],0,2);
//$this->SetXY($xOffset, $this->GetY()+$absatz+2); //abstand
//$this->Cell(30,$lineHeight,"Datum: ",0,0,'R');
//$this->Cell(60,$lineHeight,utf8_encode($date),0,2);
//$this->Cell_typed(30,$lineHeight,"Datum: ",0,0,'R');
//$this->Cell_typed(60,$lineHeight,utf8_encode($date),0,2);
}
}
@@ -2270,7 +2277,7 @@ class Briefpapier extends SuperFPDF {
$this->SetFont($this->GetFont(),'B',$betreffszeile);
$this->SetY($this->GetY()+$this->abstand_betreffzeileoben);
//$this->Cell(85,6,$this->doctypeOrig);
//$this->Cell_typed(85,6,$this->doctypeOrig);
$this->MultiCell(210-83+$this->abstand_boxrechtsoben_lr-$this->getStyleElement("abstand_seitenrandlinks")-5,6,html_entity_decode($this->doctypeOrig,ENT_QUOTES),0,'L');
$this->SetY($this->GetY()-$this->abstand_betreffzeileoben);
@@ -2593,76 +2600,76 @@ class Briefpapier extends SuperFPDF {
$this->SetX($this->getStyleElement('abstand_seitenrandlinks')+1); // eventuell einstellbar per GUI
$this->SetFont($this->GetFont(),'B',$tabellenbeschriftung);
$this->Cell($posWidth,6,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_position'),0,0,'C'));
$this->Cell_typed($posWidth,6,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_position'),0,0,'C'));
if($this->doctype!='arbeitsnachweis')
{
if($this->doctype=='zahlungsavis')
{
$this->Cell($itemNoWidth,6,'Nummer');
$this->Cell($descWidth-$einheitWidth+$taxWidth+$priceWidth+$rabattWidth,6,'Beleg');
$this->Cell_typed($itemNoWidth,6,'Nummer');
$this->Cell_typed($descWidth-$einheitWidth+$taxWidth+$priceWidth+$rabattWidth,6,'Beleg');
$this->Cell($amWidth,6,'',0,0,'R');
$this->Cell_typed($amWidth,6,'',0,0,'R');
}
else {
$this->Cell($itemNoWidth,6,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_artikelnummer')));
$this->Cell_typed($itemNoWidth,6,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_artikelnummer')));
if($this->getStyleElement('artikeleinheit')=='1'){
$this->Cell($descWidth - $einheitWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_artikel')));
$this->Cell_typed($descWidth - $einheitWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_artikel')));
}
else{
$this->Cell($descWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_artikel')));
$this->Cell_typed($descWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_artikel')));
}
$this->Cell($amWidth,6,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_menge')),0,0,'R');
$this->Cell_typed($amWidth,6,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_menge')),0,0,'R');
}
} else {
$this->Cell($taxWidth,6,'Mitarbeiter');
$this->Cell($itemNoWidth,6,'Ort');
$this->Cell($descWidth,6,'Tätigkeit');
$this->Cell($amWidth,6,'Stunden',0,0,'R');
$this->Cell_typed($taxWidth,6,'Mitarbeiter');
$this->Cell_typed($itemNoWidth,6,'Ort');
$this->Cell_typed($descWidth,6,'Tätigkeit');
$this->Cell_typed($amWidth,6,'Stunden',0,0,'R');
}
if($this->doctype!='lieferschein' && $this->doctype!='arbeitsnachweis' && $this->doctype!='produktion' && $this->doctype!='zahlungsavis' && $this->doctype!='preisanfrage'){
if($this->getStyleElement('artikeleinheit')=='1'){
$this->Cell($einheitWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_einheit')), 0, 0, 'R');
$this->Cell_typed($einheitWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_einheit')), 0, 0, 'R');
}
if($this->ust_spalteausblende){
$this->Cell($taxWidth, 6, '', 0, 0, 'R');
$this->Cell_typed($taxWidth, 6, '', 0, 0, 'R');
}
else{
$this->Cell($taxWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_mwst')), 0, 0, 'R');
$this->Cell_typed($taxWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_mwst')), 0, 0, 'R');
}
if($this->getStyleElement('artikeleinheit')=='1'){
if(!$inventurohnepreis){
$this->Cell($priceWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_einzel')), 0, 0, 'R');
$this->Cell_typed($priceWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_einzel')), 0, 0, 'R');
}
}
else{
if(!$inventurohnepreis){
$this->Cell($priceWidth, 6, $this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_stueck'))), 0, 0, 'R');
$this->Cell_typed($priceWidth, 6, $this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_stueck'))), 0, 0, 'R');
}
}
if($this->rabatt=='1') {
if(!$inventurohnepreis){
$this->Cell($rabattWidth,6,$this->app->erp->Beschriftung('dokument_rabatt'),0,0,'R');
$this->Cell($sumWidth,6,$this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_gesamt'))),0,0,'R');
$this->Cell_typed($rabattWidth,6,$this->app->erp->Beschriftung('dokument_rabatt'),0,0,'R');
$this->Cell_typed($sumWidth,6,$this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_gesamt'))),0,0,'R');
}
} else {
if(!$inventurohnepreis){
$this->Cell($sumWidth,6,$this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_gesamt'))),0,0,'R');
$this->Cell_typed($sumWidth,6,$this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_gesamt'))),0,0,'R');
}
}
}
else if ($this->doctype=='lieferschein' || $this->doctype=='preisanfrage')
{
if($this->getStyleElement("artikeleinheit")=='1'){
$this->Cell($einheitWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_einheit')), 0, 0, 'R');
$this->Cell_typed($einheitWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_einheit')), 0, 0, 'R');
}
}
else if ($this->doctype=='zahlungsavis')
{
$this->Cell($sumWidth,6,$this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_gesamt'))),0,0,'R');
$this->Cell_typed($sumWidth,6,$this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_gesamt'))),0,0,'R');
}
$this->Ln();
@@ -2748,7 +2755,7 @@ class Briefpapier extends SuperFPDF {
$posWidthold = $posWidth;
if($belege_stuecklisteneinrueckenmm && $newlvl > 0)
{
$this->Cell($belege_stuecklisteneinrueckenmm * $newlvl,$cellhoehe,'');
$this->Cell_typed($belege_stuecklisteneinrueckenmm * $newlvl,$cellhoehe,'');
$posWidth -= $belege_stuecklisteneinrueckenmm * $newlvl;
if($posWidth < 2* strlen($posstr))
{
@@ -2760,11 +2767,11 @@ class Briefpapier extends SuperFPDF {
if($belege_subpositionenstuecklisten)$posstr = $this->CalcPosString($posstr,$oldpostr, $hauptnummer, $oldlvl, $newlvl);
$oldpostr = $posstr;
$oldlvl = isset($item['lvl'])?(int)$item['lvl']:0;
$this->Cell($posWidth,$cellhoehe,$posstr,0,0,$belege_stuecklisteneinrueckenmm?'':'C');
$this->Cell_typed($posWidth,$cellhoehe,$posstr,0,0,$belege_stuecklisteneinrueckenmm?'':'C');
//artikelnummer
if($this->doctype==='arbeitsnachweis')
{
$this->Cell($taxWidth,$cellhoehe,trim($item['person']),0);
$this->Cell_typed($taxWidth,$cellhoehe,trim($item['person']),0);
$zeilenuntertext = $this->getStyleElement('zeilenuntertext');
$this->SetFont($this->GetFont(),'',$zeilenuntertext);
@@ -2785,10 +2792,10 @@ class Briefpapier extends SuperFPDF {
$this->SetFont($this->GetFont(), '', $tabelleninhalt);
}
if(isset($item['itemno'])) {
$this->Cell($itemNoWidth,$cellhoehe,$item['itemno'],0);
$this->Cell_typed($itemNoWidth,$cellhoehe,$item['itemno'],0);
}
else {
$this->Cell($itemNoWidth);
$this->Cell_typed($itemNoWidth);
}
$this->SetFont($this->GetFont(),'',$tabelleninhalt);
}
@@ -2837,10 +2844,10 @@ class Briefpapier extends SuperFPDF {
// Menge
if($this->doctype==='zahlungsavis'){
$this->Cell($amWidth, $cellhoehe, '', 0, 0, 'R');
$this->Cell_typed($amWidth, $cellhoehe, '', 0, 0, 'R');
}
else{
$this->Cell($amWidth, $cellhoehe, $item['amount'], 0, 0, 'R');
$this->Cell_typed($amWidth, $cellhoehe, $item['amount'], 0, 0, 'R');
}
if($this->doctype!=='lieferschein' && $this->doctype!=='arbeitsnachweis' && $this->doctype!=='produktion' && $this->doctype!=='preisanfrage') {
@@ -2877,7 +2884,7 @@ class Briefpapier extends SuperFPDF {
}
}
$this->Cell($einheitWidth,$cellhoehe,$this->app->erp->ReadyForPDF($einheit),0,0,'R');
$this->Cell_typed($einheitWidth,$cellhoehe,$this->app->erp->ReadyForPDF($einheit),0,0,'R');
}
// if($item['tax']=="hidden") $item['tax']=="hidden";
@@ -2905,21 +2912,21 @@ class Briefpapier extends SuperFPDF {
// standard anzeige mit steuer
if(!$this->ust_spalteausblende){
if($item['tax']==='hidden'){
$this->Cell($taxWidth,$cellhoehe,"",0,0,'R');
$this->Cell_typed($taxWidth,$cellhoehe,"",0,0,'R');
} else {
$tax = $item['tax']; //= $tax; //="USTV"?0.19:0.07;
$tax *= 100; $tax = $tax.'%';
if($this->doctype==='zahlungsavis'){
$this->Cell($taxWidth,$cellhoehe,"",0,0,'R');
$this->Cell_typed($taxWidth,$cellhoehe,"",0,0,'R');
}
else{
$this->Cell($taxWidth, $cellhoehe, $item['ohnepreis'] ? '' : $tax, 0, 0, 'R');
$this->Cell_typed($taxWidth, $cellhoehe, $item['ohnepreis'] ? '' : $tax, 0, 0, 'R');
}
}
} else {
//kleinunternehmer
$this->Cell($taxWidth,$cellhoehe,"",0,0,'R');
$this->Cell_typed($taxWidth,$cellhoehe,"",0,0,'R');
}
if($this->doctype!=='lieferschein' && $this->doctype!=='produktion' && $this->doctype!=='preisanfrage') {
@@ -2933,29 +2940,29 @@ class Briefpapier extends SuperFPDF {
//if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
//&& $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
if(!$inventurohnepreis){
$this->Cell($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price']), 0, 0, 'R');
$this->Cell_typed($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price']), 0, 0, 'R');
}
}
else{
if(!$inventurohnepreis){
$this->Cell($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price'] * $item['tmptax']), 0, 0, 'R');
$this->Cell_typed($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price'] * $item['tmptax']), 0, 0, 'R');
}
}
} else
{
if($item['ohnepreis']==2) {
if(!$inventurohnepreis){
$this->Cell($priceWidth,$cellhoehe,$item['price'],0,0,'R');
$this->Cell_typed($priceWidth,$cellhoehe,$item['price'],0,0,'R');
}
} // text alternativ zu preis
else {
if(!$inventurohnepreis){
$this->Cell($priceWidth,$cellhoehe,$item['ohnepreis']?'':$this->formatMoney((double)$item['price']),0,0,'R');
$this->Cell_typed($priceWidth,$cellhoehe,$item['ohnepreis']?'':$this->formatMoney((double)$item['price']),0,0,'R');
}
}
}
} else {
$this->Cell($priceWidth,$cellhoehe,"",0,0,'R');
$this->Cell_typed($priceWidth,$cellhoehe,"",0,0,'R');
}
// zentale rabatt spalte
@@ -3023,7 +3030,7 @@ class Briefpapier extends SuperFPDF {
} else {
if($item['rabatt']<>0){
// && $item['keinrabatterlaubt']!="1")
$this->Cell($rabattWidth, $cellhoehe, $item['ohnepreis'] ? '' : $item['rabatt'] . " %", 0, 0, 'R');
$this->Cell_typed($rabattWidth, $cellhoehe, $item['ohnepreis'] ? '' : $item['rabatt'] . " %", 0, 0, 'R');
}
else
{
@@ -3032,13 +3039,13 @@ class Briefpapier extends SuperFPDF {
$rabatt_or_porto = $this->app->DB->Select("SELECT id FROM artikel WHERE
nummer='".$item['itemno']."' AND (porto='1' OR rabatt='1') LIMIT 1");
if($rabatt_or_porto){
$this->Cell($rabattWidth, $cellhoehe, '', 0, 0, 'R');
$this->Cell_typed($rabattWidth, $cellhoehe, '', 0, 0, 'R');
}
else{
$this->Cell($rabattWidth, $cellhoehe, 'SNP', 0, 0, 'R');
$this->Cell_typed($rabattWidth, $cellhoehe, 'SNP', 0, 0, 'R');
}
} else {
$this->Cell($rabattWidth,$cellhoehe,"",0,0,'R');
$this->Cell_typed($rabattWidth,$cellhoehe,"",0,0,'R');
}
}
}
@@ -3046,7 +3053,7 @@ class Briefpapier extends SuperFPDF {
else {
// anzeige ohne zentrale rabatt spalte
if ($item['tax']==="hidden"){
$this->Cell($priceWidth,$cellhoehe,"",0,0,'R');
$this->Cell_typed($priceWidth,$cellhoehe,"",0,0,'R');
}
else {
if($anzeigeBelegNettoAdrese)
@@ -3054,16 +3061,16 @@ class Briefpapier extends SuperFPDF {
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
{
if(!$inventurohnepreis){
$this->Cell($priceWidth,$cellhoehe,$item['ohnepreis']?'':$this->formatMoney((double)$item['tprice']),0,0,'R');
$this->Cell_typed($priceWidth,$cellhoehe,$item['ohnepreis']?'':$this->formatMoney((double)$item['tprice']),0,0,'R');
}
}
else{
if(!$inventurohnepreis){
$this->Cell($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']), 0, 0, 'R');
$this->Cell_typed($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']), 0, 0, 'R');
}
}
$this->Cell($rabattWidth,$cellhoehe,"",0,0,'R');
$this->Cell_typed($rabattWidth,$cellhoehe,"",0,0,'R');
}
}
}
@@ -3072,20 +3079,20 @@ class Briefpapier extends SuperFPDF {
// if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
if(!$inventurohnepreis){
$this->Cell($priceWidth,$cellhoehe,$item['ohnepreis']?'':$this->formatMoney((double)$item['price']),0,0,'R');
$this->Cell_typed($priceWidth,$cellhoehe,$item['ohnepreis']?'':$this->formatMoney((double)$item['price']),0,0,'R');
}
else{
if(!$inventurohnepreis){
$this->Cell($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price'] * $item['tmptax']), 0, 0, 'R');
$this->Cell_typed($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price'] * $item['tmptax']), 0, 0, 'R');
}
}
}
//$this->Cell($sumWidth,$cellhoehe,$this->formatMoney($item['tprice']).' '.$item['currency'],0,0,'R');
//$this->Cell_typed($sumWidth,$cellhoehe,$this->formatMoney($item['tprice']).' '.$item['currency'],0,0,'R');
if($this->rabatt=='1')
{
//gesamt preis
if ($item['tax']==='hidden'){
$this->Cell($priceWidth,$cellhoehe,'',0,0,'R');
$this->Cell_typed($priceWidth,$cellhoehe,'',0,0,'R');
}
else {
if($this->rabatt=='1'){
@@ -3093,12 +3100,12 @@ class Briefpapier extends SuperFPDF {
//if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
if(!$inventurohnepreis){
$this->Cell($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice']), 0, 0, 'R');
$this->Cell_typed($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice']), 0, 0, 'R');
}
}
else{
if(!$inventurohnepreis){
$this->Cell($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']), 0, 0, 'R');
$this->Cell_typed($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']), 0, 0, 'R');
}
}
}
@@ -3107,12 +3114,12 @@ class Briefpapier extends SuperFPDF {
// if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
if(!$inventurohnepreis){
$this->Cell($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice']), 0, 0, 'R');
$this->Cell_typed($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice']), 0, 0, 'R');
}
}
else{
if(!$inventurohnepreis){
$this->Cell($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']), 0, 0, 'R');
$this->Cell_typed($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']), 0, 0, 'R');
}
}
}
@@ -3148,7 +3155,7 @@ class Briefpapier extends SuperFPDF {
}
}
$this->Cell($einheitWidth,$cellhoehe,$this->app->erp->ReadyForPDF($einheit),0,0,'R');
$this->Cell_typed($einheitWidth,$cellhoehe,$this->app->erp->ReadyForPDF($einheit),0,0,'R');
}
$this->Ln();
@@ -3298,12 +3305,12 @@ class Briefpapier extends SuperFPDF {
$yBeforeDescription = $this->GetY();
$this->SetFont($this->GetFont(),'',$zeilenuntertext);
if($belege_stuecklisteneinrueckenmm && $newlvl > 0){
$this->Cell($belege_stuecklisteneinrueckenmm * $newlvl, $cellhoehe, '');
$this->Cell_typed($belege_stuecklisteneinrueckenmm * $newlvl, $cellhoehe, '');
}
$this->Cell($posWidth);
$this->Cell($itemNoWidth);
$this->Cell_typed($posWidth);
$this->Cell_typed($itemNoWidth);
if($this->doctype==='arbeitsnachweis') {
$this->Cell($taxWidth);
$this->Cell_typed($taxWidth);
}
if($this->doctype==='lieferschein' && $this->getStyleElement('modul_verband')=='1'){
@@ -3392,17 +3399,17 @@ class Briefpapier extends SuperFPDF {
}
}
$this->Cell($taxWidth);
$this->Cell($amWidth);
$this->Cell_typed($taxWidth);
$this->Cell_typed($amWidth);
$this->Ln();
$this->SetFont($this->GetFont(),'',$tabelleninhalt);
$zeilenuntertext = $this->getStyleElement('zeilenuntertext');
$this->SetFont($this->GetFont(),'',$zeilenuntertext);
$this->Cell($posWidth);
$this->Cell($itemNoWidth);
$this->Cell_typed($posWidth);
$this->Cell_typed($itemNoWidth);
if($this->doctype==='arbeitsnachweis') {
$this->Cell($taxWidth);
$this->Cell_typed($taxWidth);
}
if($this->getStyleElement('artikeleinheit')=='1'){
$this->MultiCell($descWidth - $einheitWidth, 4, '', 0); // 4 = abstand zwischen Artikeln
@@ -3410,8 +3417,8 @@ class Briefpapier extends SuperFPDF {
else{
$this->MultiCell($descWidth, 4, '', 0); // 4 = abstand zwischen Artikeln
}
$this->Cell($taxWidth);
$this->Cell($amWidth);
$this->Cell_typed($taxWidth);
$this->Cell_typed($amWidth);
$this->Ln();
$this->SetFont($this->GetFont(),'',$tabelleninhalt);
$yAfterDescription = $this->GetY();
@@ -3421,11 +3428,11 @@ class Briefpapier extends SuperFPDF {
$this->SetY($position_y_end_name);
$yBeforeDescription = $this->GetY();
$this->SetFont($this->GetFont(),'',$zeilenuntertext);
$this->Cell($posWidth);
$this->Cell($itemNoWidth);
$this->Cell_typed($posWidth);
$this->Cell_typed($itemNoWidth);
if($this->doctype==='arbeitsnachweis')
{
$this->Cell($taxWidth);
$this->Cell_typed($taxWidth);
}
if($this->getStyleElement('artikeleinheit')=='1')
{
@@ -3450,8 +3457,8 @@ class Briefpapier extends SuperFPDF {
$this->MultiCell($posWidth+$itemNoWidth+$descWidth+$amWidth+$taxWidth+$sumWidth+$priceWidth,($zeilenuntertext/2),trim($staffelpreistext),0,'R');
}
$this->Cell($taxWidth);
$this->Cell($amWidth);
$this->Cell_typed($taxWidth);
$this->Cell_typed($amWidth);
$this->Ln();
$this->SetFont($this->GetFont(),'',$tabelleninhalt);
$yAfterDescription = $this->GetY();
@@ -3805,7 +3812,7 @@ class Briefpapier extends SuperFPDF {
$this->Image($dateiname, $this->GetX(), $this->GetY(),$width / 10, $hoehe / 10, 'jpg');
if($nochtext == '')
{
$this->Cell($picwidth,6,'',0,0,'C');
$this->Cell_typed($picwidth,6,'',0,0,'C');
}
$this->SetXY($this->GetX(), $y + $height / 10 + ($nochtext == ''?5:0));
}
@@ -4016,7 +4023,7 @@ class Briefpapier extends SuperFPDF {
}
$this->SetX($x+$abstand_links);
$this->Cell($descWidth,4,$this->WriteHTML($html));
$this->Cell_typed($descWidth,4,$this->WriteHTML($html));
$this->SetX($x+$abstand_links+$descWidth);
//$this->SetX($x);
@@ -4050,7 +4057,7 @@ class Briefpapier extends SuperFPDF {
{
$ausrichtung = $data['Text_Ausrichtung'];
}
$this->Cell($priceWidth+$amWidth+$taxWidth+$priceWidth,4,$summe,$rahmen,0,$ausrichtung);
$this->Cell_typed($priceWidth+$amWidth+$taxWidth+$priceWidth,4,$summe,$rahmen,0,$ausrichtung);
if(!empty($data['Abstand_Unten']))
{
$this->Ln((int)$data['Abstand_Unten']);
@@ -4098,19 +4105,19 @@ class Briefpapier extends SuperFPDF {
//$this->Line(110, $this->GetY(), 190, $this->GetY());
$this->Ln(1);
$this->SetFont($this->GetFont(),'',$this->getStyleElement('schriftgroesse_gesamt'));
$this->Cell($differenz_wegen_abstand,2,'',0);
$this->Cell_typed($differenz_wegen_abstand,2,'',0);
if($this->getStyleElement('kleinunternehmer')!='1' && $this->doctype!='zahlungsavis'){
$nettoText = $this->app->erp->Beschriftung('dokument_gesamtnetto');
$nettoAmount = $this->formatMoney(round((double)$this->totals['totalArticles'], 2), 2).' '.$this->waehrung;
$doctype = $this->doctype;
$doctypeid = !empty($this->doctypeid)?$this->doctypeid: $this->id;
$this->app->erp->RunHook('class_briefpapier_render_netto', 4, $doctype, $doctypeid, $nettoText, $nettoAmount);
$this->Cell(30,5,$nettoText,0,0,'L');
$this->Cell(40,5,$nettoAmount,0,'L','R');
$this->Cell_typed(30,5,$nettoText,0,0,'L');
$this->Cell_typed(40,5,$nettoAmount,0,0,'R');
} else {
//kleinunzernehmer
$this->Cell(30,5,'',0,0,'L');
$this->Cell(40,5,'',0,'L','R');
$this->Cell_typed(30,5,'',0,0,'L');
$this->Cell_typed(40,5,'',0,0,'R');
}
$this->Ln();
@@ -4121,16 +4128,16 @@ class Briefpapier extends SuperFPDF {
$versand = 'Versandkosten: ';
}
if(isset($this->totals['priceOfDispatch'])) {
$this->Cell($differenz_wegen_abstand,2,'',0);
$this->Cell(30,5,$versand,0,'L','L');
$this->Cell(40,5,$this->formatMoney((double)$this->totals['priceOfDispatch'], 2).' '.$this->waehrung,0,'L','R');
$this->Cell_typed($differenz_wegen_abstand,2,'',0);
$this->Cell_typed(30,5,$versand,0,'L','L');
$this->Cell_typed(40,5,$this->formatMoney((double)$this->totals['priceOfDispatch'], 2).' '.$this->waehrung,0,0,'R');
}
//$this->Ln();
if(isset($this->totals['priceOfPayment']) && $this->totals['priceOfPayment']!='0.00'){
$this->Cell($differenz_wegen_abstand,2,'',0);
$this->Cell(30,5,$this->totals['modeOfPayment'],0,'L','L');
$this->Cell(40,5,$this->formatMoney((double)$this->totals['priceOfPayment'], 2).' '.$this->waehrung,0,'L','R');
$this->Cell_typed($differenz_wegen_abstand,2,'',0);
$this->Cell_typed(30,5,$this->totals['modeOfPayment'],0,'L','L');
$this->Cell_typed(40,5,$this->formatMoney((double)$this->totals['priceOfPayment'], 2).' '.$this->waehrung,0,0,'R');
$this->Ln();
}
@@ -4139,7 +4146,7 @@ class Briefpapier extends SuperFPDF {
if(isset($this->totals['totalTaxV']) && $this->totals['totalTaxV']!="0.00"){
$this->Cell($differenz_wegen_abstand,1,'',0);
$this->Cell_typed($differenz_wegen_abstand,1,'',0);
if($this->getStyleElement('kleinunternehmer')!='1'){
if(!empty($this->doctype) && !empty($this->id) && is_numeric($this->id)){
@@ -4154,23 +4161,23 @@ class Briefpapier extends SuperFPDF {
//if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
{
$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$this->app->erp->GetSteuersatzNormal(false,$this->id,$this->table).' %',0,'L','L'); //1
$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$this->app->erp->GetSteuersatzNormal(false,$this->id,$this->table).' %',0,0,'L'); //1
}
else {
$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_inklmwst').' '.$this->app->erp->GetSteuersatzNormal(false,$this->id,$this->table).' %',0,'L','L');
$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_inklmwst').' '.$this->app->erp->GetSteuersatzNormal(false,$this->id,$this->table).' %',0,0,'L');
}
$this->Cell(40,3,$this->formatMoney((double)$this->totals['totalTaxV'], 2).' '.$this->waehrung,0,'L','R');
$this->Cell_typed(40,3,$this->formatMoney((double)$this->totals['totalTaxV'], 2).' '.$this->waehrung,0,0,'R');
} else {
//kleinunternehmer
$this->Cell(30,3,'',0,'L','L');
$this->Cell(40,3,'',0,'L','R');
$this->Cell_typed(30,3,'',0,0,'L');
$this->Cell_typed(40,3,'',0,0,'R');
}
$this->Ln();
}
$projekt = $this->projekt;
$adresse = $this->app->DB->Select("SELECT adresse FROM ".($this->table?$this->table:$this->doctype)." WHERE id = '".$this->id."' LIMIT 1");
if(!empty($this->totals['totalTaxR']) && $this->totals['totalTaxR']!='0.00'){
$this->Cell($differenz_wegen_abstand,1,'',0);
$this->Cell_typed($differenz_wegen_abstand,1,'',0);
if($this->getStyleElement('kleinunternehmer')!='1'){
@@ -4178,17 +4185,17 @@ class Briefpapier extends SuperFPDF {
//if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
{
$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$this->app->erp->GetSteuersatzErmaessigt(false,$this->id,$this->table).' %',0,'L','L'); //1
$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$this->app->erp->GetSteuersatzErmaessigt(false,$this->id,$this->table).' %',0,0,'L'); //1
}
else {
$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_inklmwst').' '.$this->app->erp->GetSteuersatzErmaessigt(false,$this->id,$this->table).' %',0,'L','L');
$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_inklmwst').' '.$this->app->erp->GetSteuersatzErmaessigt(false,$this->id,$this->table).' %',0,0,'L');
}
$this->Cell(40,3,$this->formatMoney(round((double)$this->totals['totalTaxR'],2), 2).' '.$this->waehrung,0,'L','R');
$this->Cell_typed(40,3,$this->formatMoney(round((double)$this->totals['totalTaxR'],2), 2).' '.$this->waehrung,0,0,'R');
} else {
//kleinunternehmer
$this->Cell(30,3,'',0,'L','L');
$this->Cell(40,3,"",0,'L','R');
$this->Cell_typed(30,3,'',0,0,'L');
$this->Cell_typed(40,3,"",0,0,'R');
}
$this->Ln();
@@ -4203,24 +4210,24 @@ class Briefpapier extends SuperFPDF {
{
continue;
}
$this->Cell($differenz_wegen_abstand,1,'',0);
$this->Cell_typed($differenz_wegen_abstand,1,'',0);
if($this->getStyleElement('kleinunternehmer')!='1'){
if($this->app->erp->AnzeigeBelegNettoAdresse($this->anrede, $this->doctype, $projekt, $adresse,$this->id))
//if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
{
$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$k.' %',0,'L','L'); //1
$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$k.' %',0,0,'L'); //1
}else {
//$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_inklmwst').' '.$k.' %',0,'L','L'); 09.12.2018 ab heute auskommentiert wegen 829087
$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$k.' %',0,'L','L');
//$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_inklmwst').' '.$k.' %',0,'L','L'); 09.12.2018 ab heute auskommentiert wegen 829087
$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$k.' %',0,0,'L');
}
$this->Cell(40,3,$this->formatMoney(round($value,2), 2).' '.$this->waehrung,0,'L','R');
$this->Cell_typed(40,3,$this->formatMoney(round($value,2), 2).' '.$this->waehrung,0,0,'R');
} else {
//kleinunternehmer
$this->Cell(30,3,'',0,'L','L');
$this->Cell(40,3,"",0,'L','R');
$this->Cell_typed(30,3,'',0,0,'L');
$this->Cell_typed(40,3,"",0,0,'R');
}
$this->Ln();
@@ -4231,7 +4238,7 @@ class Briefpapier extends SuperFPDF {
if(!isset($this->totals['totalTaxR']) && !isset($this->totals['totalTaxV']) && !isset($this->totals['summen']) && $this->doctype!="zahlungsavis")
{
$this->Cell($differenz_wegen_abstand,3,'',0);
$this->Cell_typed($differenz_wegen_abstand,3,'',0);
if($this->getStyleElement('kleinunternehmer')!='1')
{
@@ -4241,24 +4248,24 @@ class Briefpapier extends SuperFPDF {
{
if(!($this->ust_befreit==3 && $this->getStyleElement('steuerfrei_inland_ausblenden')=='1')) //steuerfrei inland
{
$this->Cell(30, 3, $this->app->erp->Beschriftung('dokument_zzglmwst') . ' 0.00 %', 0, 'L', 'L'); //1
$this->Cell_typed(30, 3, $this->app->erp->Beschriftung('dokument_zzglmwst') . ' 0.00 %', 0, 0, 'L'); //1
}
}
else {
if(!($this->ust_befreit==3 && $this->getStyleElement('steuerfrei_inland_ausblenden')=='1')) //steuerfrei inland
{
$this->Cell(30, 3, $this->app->erp->Beschriftung('dokument_inklmwst') . ' 0.00 %', 0, 'L', 'L');
$this->Cell_typed(30, 3, $this->app->erp->Beschriftung('dokument_inklmwst') . ' 0.00 %', 0, 0, 'L');
}
}
if(!($this->ust_befreit==3 && $this->getStyleElement('steuerfrei_inland_ausblenden')=='1')) //steuerfrei inland
{
$this->Cell(40, 3, '0,00 ' . $this->waehrung, 0, 'L', 'R');
$this->Cell_typed(40, 3, '0,00 ' . $this->waehrung, 0, 0, 'R');
}
} else {
//kleinunternehmer
$this->Cell(30,3,'',0,'L','L');
$this->Cell(40,3,'',0,'L','R');
$this->Cell_typed(30,3,'',0,0,'L');
$this->Cell_typed(40,3,'',0,0,'R');
}
$this->Ln();
}
@@ -4267,32 +4274,32 @@ class Briefpapier extends SuperFPDF {
}
$this->SetFont($this->GetFont(),'B',$this->getStyleElement('schriftgroesse_gesamt'));
$this->Cell($differenz_wegen_abstand,5,'',0);
$this->Cell_typed($differenz_wegen_abstand,5,'',0);
if($this->doctype=='offer'){
$this->Cell(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 'L', 'L');
$this->Cell_typed(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 0, 'L');
}
elseif($this->doctype=='creditnote'){
$this->Cell(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 'L', 'L');
$this->Cell_typed(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 0, 'L');
}
else if($this->doctype=='arbeitsnachweis'){
$this->Cell(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 'L', 'L');
$this->Cell_typed(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 0, 'L');
}
else if($this->doctype=='zahlungsavis'){
$this->Cell(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 'L', 'L');
$this->Cell_typed(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 0, 'L');
}
else{
$this->Cell(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 'L', 'L');
$this->Cell_typed(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 0, 'L');
}
if($this->doctype=='arbeitsnachweis'){
$this->Cell(40, 5, $this->totals['total'] . ' ', 0, 'L', 'R');
$this->Cell_typed(40, 5, $this->totals['total'] . ' ', 0, 0, 'R');
}
else {
if($this->getStyleElement('kleinunternehmer')!='1'){
$this->Cell(40, 5, $this->formatMoney(round((double)$this->totals['total'], 2), 2) . ' ' . $this->waehrung, 0, 'L', 'R');
$this->Cell_typed(40, 5, $this->formatMoney(round((double)$this->totals['total'], 2), 2) . ' ' . $this->waehrung, 0, 0, 'R');
}
else{
$this->Cell(40, 5, $this->formatMoney(round((double)$this->totals['totalArticles'], 2), 2) . ' ' . $this->waehrung, 0, 'L', 'R');
$this->Cell_typed(40, 5, $this->formatMoney(round((double)$this->totals['totalArticles'], 2), 2) . ' ' . $this->waehrung, 0, 0, 'R');
}
}
+488 -488
View File
@@ -1,491 +1,491 @@
<?php
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*/
?>
<?php
if(!class_exists('BriefpapierCustom'))
{
class BriefpapierCustom extends Briefpapier
{
}
}
class GutschriftPDF extends BriefpapierCustom {
public $doctype;
function __construct($app,$projekt="")
{
$this->app=$app;
//parent::Briefpapier();
$this->doctype="gutschrift";
$this->doctypeOrig="Gutschrift";
parent::__construct($this->app,$projekt);
}
function GetGutschrift($id)
{
$this->doctypeid = $id;
if($this->app->erp->Firmendaten("steuerspalteausblenden")=="1")
{
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
$check = $this->app->erp->SteuerAusBeleg($this->doctype,$id);
if(count($check)>1)$this->ust_spalteausblende=false;
else $this->ust_spalteausblende=true;
}
$briefpapier_bearbeiter_ausblenden = $this->app->erp->Firmendaten('briefpapier_bearbeiter_ausblenden');
$briefpapier_vertrieb_ausblenden = $this->app->erp->Firmendaten('briefpapier_vertrieb_ausblenden');
//$this->setRecipientDB($adresse);
$this->setRecipientLieferadresse($id,"gutschrift");
$data = $this->app->DB->SelectRow(
"SELECT adresse,kundennummer, sprache, rechnungid, buchhaltung, bearbeiter, vertrieb,
lieferschein AS lieferscheinid, DATE_FORMAT(datum,'%d.%m.%Y') AS datum,
DATE_FORMAT(lieferdatum,'%d.%m.%Y') AS lieferdatum, belegnr, freitext, ustid, ust_befreit,
stornorechnung, keinsteuersatz, land, typ, zahlungsweise, zahlungsstatus, zahlungszieltage,
zahlungszielskonto, projekt, waehrung, bodyzusatz,
DATE_FORMAT(DATE_ADD(datum, INTERVAL zahlungszieltage DAY),'%d.%m.%Y') AS zahlungsdatum,
ohne_briefpapier, ihrebestellnummer,DATE_FORMAT(datum,'%Y%m%d') as datum2, email, telefon
FROM gutschrift WHERE id='$id' LIMIT 1"
);
extract($data,EXTR_OVERWRITE);
$adresse = $data['adresse'];
$kundennummer = $data['kundennummer'];
$sprache = $data['sprache'];
$rechnungid = $data['rechnungid'];
$buchhaltung = $data['buchhaltung'];
$email = $data['email'];
$telefon = $data['telefon'];
$bearbeiter = $data['bearbeiter'];
$vertrieb = $data['vertrieb'];
$lieferscheinid = $data['lieferscheinid'];
$datum = $data['datum'];
$lieferdatum = $data['lieferdatum'];
$belegnr = $data['belegnr'];
$freitext = $data['freitext'];
$ustid = $data['ustid'];
$ust_befreit = $data['ust_befreit'];
$stornorechnung = $data['stornorechnung'];
$keinsteuersatz = $data['keinsteuersatz'];
$land = $data['land'];
$typ = $data['typ'];
$zahlungsweise = $data['zahlungsweise'];
$zahlungszieltage = $data['zahlungszieltage'];
$zahlungszielskonto = $data['zahlungszielskonto'];
$projekt = $data['projekt'];
$waehrung = $data['waehrung'];
$bodyzusatz = $data['bodyzusatz'];
$zahlungsdatum = $data['zahlungsdatum'];
$ohne_briefpapier = $data['ohne_briefpapier'];
$ihrebestellnummer = $data['ihrebestellnummer'];
$datum2 = $data['datum2'];
$projektabkuerzung = $this->app->DB->Select(sprintf('SELECT abkuerzung FROM projekt WHERE id = %d', $projekt));
$kundennummer = $this->app->DB->Select("SELECT kundennummer FROM adresse WHERE id='$adresse' LIMIT 1");
if(empty($sprache)){
$sprache = $this->app->DB->Select("SELECT sprache FROM adresse WHERE id='$adresse' LIMIT 1");
}
$lieferschein = $this->app->DB->Select("SELECT belegnr FROM lieferschein WHERE id='$lieferscheinid' LIMIT 1");
$lieferscheindatum = $this->app->DB->Select("SELECT DATE_FORMAT(datum, '%d.%m.%Y') AS datum FROM lieferschein WHERE id = '$lieferscheinid' LIMIT 1");
$rechnung = $this->app->DB->Select("SELECT belegnr FROM rechnung WHERE id='$rechnungid' LIMIT 1");
$rechnungsdatum = $this->app->DB->Select("SELECT DATE_FORMAT(datum, '%d.%m.%Y') AS datum FROM rechnung WHERE id = '$rechnungid' LIMIT 1");
$auftrag = $this->app->DB->Select("SELECT auftrag FROM rechnung WHERE id = '$rechnungid' LIMIT 1");
$ihrebestellnummer = $this->app->erp->ReadyForPDF($ihrebestellnummer);
$bearbeiter = $this->app->erp->ReadyForPDF($bearbeiter);
$vertrieb = $this->app->erp->ReadyForPDF($vertrieb);
$this->app->erp->BeschriftungSprache($sprache);
if($waehrung)$this->waehrung = $waehrung;
$this->sprache = $sprache;
$this->projekt = $projekt;
$this->anrede = $typ;
if($vertrieb==$bearbeiter && (!$briefpapier_bearbeiter_ausblenden && !$briefpapier_vertrieb_ausblenden)) $vertrieb="";
if($ohne_briefpapier=="1")
{
$this->logofile = "";
$this->briefpapier="";
$this->briefpapier2="";
}
// $zahlungsweise = strtolower($zahlungsweise);
if($zahlungsweise=="lastschrift" || $zahlungsweise=="einzugsermaechtigung")
{
$zahlungsweisetext = "\n".$this->app->erp->Beschriftung("dokument_offene_lastschriften");
}
//if($zahlungszielskonto>0) $zahlungsweisetext .= "\n".$this->app->erp->Beschriftung("dokument_skonto")." $zahlungszielskonto% ".$this->app->erp->Beschriftung("dokument_auszahlungskonditionen");
if($zahlungszielskonto!=0)
$zahlungsweisetext .="\r\n".$this->app->erp->Beschriftung("dokument_skontoanderezahlungsweisen");
$zahlungsweisetext = str_replace('{ZAHLUNGSZIELSKONTO}',number_format($zahlungszielskonto,2,',','.'),$zahlungsweisetext);
if($belegnr=="" || $belegnr=="0") $belegnr = "- ".$this->app->erp->Beschriftung("dokument_entwurf");
if($stornorechnung)
$this->doctypeOrig=$this->app->erp->Beschriftung("bezeichnungstornorechnung")." $belegnr";
else
$this->doctypeOrig=$this->app->erp->Beschriftung("dokument_gutschrift")." $belegnr";
if($gutschrift=="") $gutschrift = "-";
if($kundennummer=="") $kundennummer= "-";
if($auftrag=="0") $auftrag = "-";
if($lieferschein=="0") $lieferschein= "-";
$bearbeiteremail = $this->app->DB->Select("SELECT b.email FROM gutschrift g LEFT JOIN adresse b ON b.id=g.bearbeiterid WHERE g.id='$id' LIMIT 1");
$bearbeitertelefon = $this->app->DB->Select("SELECT b.telefon FROM gutschrift g LEFT JOIN adresse b ON b.id=g.bearbeiterid WHERE g.id='$id' LIMIT 1");
/** @var \Xentral\Modules\Company\Service\DocumentCustomizationService $service */
$service = $this->app->Container->get('DocumentCustomizationService');
if($block = $service->findActiveBlock('corr', 'credit_note', $projekt)) {
$sCD = $service->parseBlockAsArray($this->getLanguageCodeFrom($this->sprache),'corr', 'credit_note',[
'GUTSCHRIFTSNUMMER' => $belegnr,
'DATUM' => $datum,
'RECHNUNGSNUMMER' => $rechnung,
'RECHNUNGSDATUM' => $rechnungsdatum,
'KUNDENNUMMER' => $kundennummer,
'BEARBEITER' => $bearbeiter,
'BEARBEITEREMAIL' => $bearbeiteremail,
'BEARBEITERTELEFON' => $bearbeitertelefon,
'VERTRIEB' => $vertrieb,
'PROJEKT' => $projektabkuerzung,
'AUFTRAGSNUMMER' => $auftrag,
'LIEFERSCHEINNUMMER' => $lieferschein,
'LIEFERSCHEINDATUM' => $lieferscheindatum,
'EMAIL' => $email,
'TELEFON' => $telefon
], $projekt);
if(!empty($sCD)) {
switch($block['fontstyle']) {
case 'f':
$this->setBoldCorrDetails($sCD);
break;
case 'i':
$this->setItalicCorrDetails($sCD);
break;
case 'fi':
$this->setItalicBoldCorrDetails($sCD);
break;
default:
$this->setCorrDetails($sCD, true);
break;
}
}
}
else{
//$this->setCorrDetails(array("Auftrag"=>$auftrag,"Datum"=>$datum,"Ihre Kunden-Nr."=>$kundennummer,"Lieferschein"=>$lieferschein,"Buchhaltung"=>$buchhaltung));
if($briefpapier_bearbeiter_ausblenden || $briefpapier_vertrieb_ausblenden){
if($rechnung != ""){
$sCD = array($this->app->erp->Beschriftung("dokument_rechnung") => $rechnung, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer, $this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer);
}else{
$sCD = array($this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer);
//$this->setCorrDetails(array($this->app->erp->Beschriftung("dokument_datum")=>$datum,$this->app->erp->Beschriftung("bezeichnungkundennummer")=>$kundennummer,$this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer")=>$ihrebestellnummer));
}
if(!$briefpapier_bearbeiter_ausblenden){
if($bearbeiter) $sCD[$this->app->erp->Beschriftung("auftrag_bezeichnung_bearbeiter")] = $bearbeiter;
}elseif(!$briefpapier_vertrieb_ausblenden){
if($vertrieb) $sCD[$this->app->erp->Beschriftung("auftrag_bezeichnung_vertrieb")] = $vertrieb;
}
}else{
if($rechnung != "")
$sCD = array($this->app->erp->Beschriftung("dokument_rechnung") => $rechnung, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer, $this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bearbeiter") => $bearbeiter, $this->app->erp->Beschriftung("auftrag_bezeichnung_vertrieb") => $vertrieb);
else
$sCD = array($this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bearbeiter") => $bearbeiter, $this->app->erp->Beschriftung("auftrag_bezeichnung_vertrieb") => $vertrieb);
}
if($lieferdatum != "00.00.0000")
$sCD[$this->app->erp->Beschriftung("dokument_lieferdatum")] = $lieferdatum;
$this->setCorrDetails($sCD);
}
if($keinsteuersatz!="1")
{
if($ust_befreit==2)//$this->app->erp->Export($land))
$steuer = $this->app->erp->Beschriftung("export_lieferung_vermerk");
else {
if($ust_befreit==1 && $ustid!="")//$this->app->erp->IstEU($land))
$steuer = $this->app->erp->Beschriftung("eu_lieferung_vermerk");
}
$steuer = str_replace('{USTID}',$ustid,$steuer);
$steuer = str_replace('{LAND}',$land,$steuer);
}
$gutschrift_header=$this->app->erp->Beschriftung("gutschrift_header");
if($bodyzusatz!="") $gutschrift_header=$gutschrift_header."\r\n".$bodyzusatz;
if($stornorechnung)
{
$gutschrift_header = str_replace('{ART}',$this->app->erp->Beschriftung("bezeichnungstornorechnung"),$gutschrift_header);
} else {
$gutschrift_header = str_replace('{ART}',$this->app->erp->Beschriftung("dokument_gutschrift"),$gutschrift_header);
}
$gutschrift_header = $this->app->erp->ParseUserVars("gutschrift",$id,$gutschrift_header);
if($this->app->erp->Firmendaten("footer_reihenfolge_gutschrift_aktivieren")=="1") {
$footervorlage = $this->app->erp->Firmendaten("footer_reihenfolge_gutschrift");
if($footervorlage=="")
$footervorlage = "{FOOTERFREITEXT}\r\n{FOOTERTEXTVORLAGEGUTSCHRIFT}\r\n{FOOTERSTEUER}\r\n{FOOTERZAHLUNGSWEISETEXT}";
$footervorlage = str_replace('{FOOTERFREITEXT}',$freitext,$footervorlage);
$footervorlage = str_replace('{FOOTERTEXTVORLAGEGUTSCHRIFT}',$this->app->erp->Beschriftung("gutschrift_footer"),$footervorlage);
$footervorlage = str_replace('{FOOTERSTEUER}',$steuer,$footervorlage);
$footervorlage = str_replace('{FOOTERZAHLUNGSWEISETEXT}',$zahlungsweisetext,$footervorlage);
$footervorlage = $this->app->erp->ParseUserVars("gutschrift",$id,$footervorlage);
$footer = $footervorlage;
} else {
$footer = "$freitext"."\r\n".$this->app->erp->ParseUserVars("gutschrift",$id,$this->app->erp->Beschriftung("gutschrift_footer"))."\r\n$zahlungsweisetext\r\n$steuer";
}
$this->setTextDetails(array(
"body"=>$gutschrift_header,
"footer"=>$footer));
$artikel = $this->app->DB->SelectArr("SELECT * FROM gutschrift_position WHERE gutschrift='$id' ORDER By sort");
if(!$this->app->erp->GutschriftMitUmsatzeuer($id)) $this->ust_befreit=true;
$summe_rabatt = $this->app->DB->Select("SELECT SUM(rabatt) FROM gutschrift_position WHERE gutschrift='$id'");
if($summe_rabatt <> 0) $this->rabatt=1;
if($this->app->erp->Firmendaten("modul_verband")=="1") $this->rabatt=1;
//$waehrung = $this->app->DB->Select("SELECT waehrung FROM gutschrift_position WHERE gutschrift='$id' LIMIT 1");
$steuersatzV = $this->app->erp->GetSteuersatzNormal(false,$id,"gutschrift");
$steuersatzR = $this->app->erp->GetSteuersatzErmaessigt(false,$id,"gutschrift");
$gesamtsteuern = 0;
$mitumsatzsteuer = $this->app->erp->GutschriftMitUmsatzeuer($id);
$belege_subpositionenstuecklisten = $this->app->erp->Firmendaten('belege_subpositionenstuecklisten');
$belege_stuecklisteneinrueckenmm = $this->app->erp->Firmendaten('belege_stuecklisteneinrueckenmm');
//$positionenkaufmaenischrunden = $this->app->erp->Firmendaten('positionenkaufmaenischrunden');
$positionenkaufmaenischrunden = $this->app->erp->Projektdaten($projekt,"preisberechnung");
$viernachkommastellen_belege = $this->app->erp->Firmendaten('viernachkommastellen_belege');
foreach($artikel as $key=>$value)
{
if($value['umsatzsteuer'] != "ermaessigt" && $value['umsatzsteuer'] != "befreit") $value['umsatzsteuer'] = "normal";
$tmpsteuersatz = null;
$tmpsteuertext = null;
$this->app->erp->GetSteuerPosition('gutschrift', $value['id'],$tmpsteuersatz, $tmpsteuertext);
if(is_null($value['steuersatz']) || $value['steuersatz'] < 0)
{
if($value['umsatzsteuer'] == "ermaessigt")
{
$value['steuersatz'] = $steuersatzR;
}elseif($value['umsatzsteuer'] == "befreit")
{
$value['steuersatz'] = $steuersatzR;
}else{
$value['steuersatz'] = $steuersatzV;
}
if(!is_null($tmpsteuersatz))$value['steuersatz'] = $tmpsteuersatz;
}
if($tmpsteuertext && !$value['steuertext'])$value['steuertext'] = $tmpsteuertext;
if(!$mitumsatzsteuer)$value['steuersatz'] = 0;
// negative Darstellung bei Stornorechnung
if($stornorechnung) $value['preis'] = $value['preis'] *-1;
if(!$this->app->erp->Export($land))
{
$value['zolltarifnummer']="";
$value['herkunftsland']="";
}
$value = $this->CheckPosition($value,"gutschrift",$this->doctypeid,$value['id']);
$value['menge'] = floatval($value['menge']);
if($value['explodiert_parent_artikel'] > 0)
{
if($belege_subpositionenstuecklisten || $belege_stuecklisteneinrueckenmm)$value['bezeichnung'] = ltrim(ltrim($value['bezeichnung'],'*'));
if(isset($lvl) && isset($lvl[$value['explodiert_parent_artikel']]))
{
$value['lvl'] = $lvl[$value['explodiert_parent_artikel']] + 1;
}else{
$value['lvl'] = 1;
}
$lvl[$value['artikel']] = $value['lvl'];
$check_ausblenden = $this->app->DB->Select("SELECT keineeinzelartikelanzeigen FROM artikel WHERE id='".$value['explodiert_parent_artikel']."' LIMIT 1");
if(!$check_ausblenden && isset($ausblenden) && in_array($value['explodiert_parent_artikel'], $ausblenden))
{
$check_ausblenden = true;
}
if($check_ausblenden)
{
$ausblenden[] = $value['artikel'];
}
} else
{
$check_ausblenden=0;
$lvl[$value['artikel']] = 0;
$value['lvl'] = 0;
}
if($value['ausblenden_im_pdf']) $check_ausblenden=1;
$ohne_artikeltext = $this->app->DB->Select("SELECT ohne_artikeltext FROM ".$this->table." WHERE id='".$this->id."' LIMIT 1");
if($ohne_artikeltext=="1") $value['beschreibung']="";
if($check_ausblenden!=1)
{
$this->addItem(array('currency'=>$value['waehrung'],'lvl'=>isset($value['lvl'])?$value['lvl']:0,
'amount'=>$value['menge'],
'price'=>$value['preis'],
'tax'=>$value['umsatzsteuer'],
'steuersatz'=>$value['steuersatz'],
'steuertext'=>$value['steuertext'],
'itemno'=>$value['nummer'],
'artikel'=>$value['artikel'],
'unit'=>$value['einheit'],
'desc'=>$value['beschreibung'],
"name"=>ltrim($value['bezeichnung']),
'artikelnummerkunde'=>$value['artikelnummerkunde'],
'lieferdatum'=>$value['lieferdatum'],
'lieferdatumkw'=>$value['lieferdatumkw'],
'zolltarifnummer'=>$value['zolltarifnummer'],
'herkunftsland'=>$value['herkunftsland'],
'ohnepreis'=>$value['ohnepreis'],
'grundrabatt'=>$value['grundrabatt'],
'rabatt1'=>$value['rabatt1'],
'rabatt2'=>$value['rabatt2'],
'rabatt3'=>$value['rabatt3'],
'rabatt4'=>$value['rabatt4'],
'rabatt5'=>$value['rabatt5'],
'freifeld1'=>$value['freifeld1'],
'freifeld2'=>$value['freifeld2'],
'freifeld3'=>$value['freifeld3'],
'freifeld4'=>$value['freifeld4'],
'freifeld5'=>$value['freifeld5'],
'freifeld6'=>$value['freifeld6'],
'freifeld7'=>$value['freifeld7'],
'freifeld8'=>$value['freifeld8'],
'freifeld9'=>$value['freifeld9'],
'freifeld10'=>$value['freifeld10'],
'freifeld11'=>$value['freifeld11'],
'freifeld12'=>$value['freifeld12'],
'freifeld13'=>$value['freifeld13'],
'freifeld14'=>$value['freifeld14'],
'freifeld15'=>$value['freifeld15'],
'freifeld16'=>$value['freifeld16'],
'freifeld17'=>$value['freifeld17'],
'freifeld18'=>$value['freifeld18'],
'freifeld19'=>$value['freifeld19'],
'freifeld20'=>$value['freifeld20'],
'freifeld21'=>$value['freifeld21'],
'freifeld22'=>$value['freifeld22'],
'freifeld23'=>$value['freifeld23'],
'freifeld24'=>$value['freifeld24'],
'freifeld25'=>$value['freifeld25'],
'freifeld26'=>$value['freifeld26'],
'freifeld27'=>$value['freifeld27'],
'freifeld28'=>$value['freifeld28'],
'freifeld29'=>$value['freifeld29'],
'freifeld30'=>$value['freifeld30'],
'freifeld31'=>$value['freifeld31'],
'freifeld32'=>$value['freifeld32'],
'freifeld33'=>$value['freifeld33'],
'freifeld34'=>$value['freifeld34'],
'freifeld35'=>$value['freifeld35'],
'freifeld36'=>$value['freifeld36'],
'freifeld37'=>$value['freifeld37'],
'freifeld38'=>$value['freifeld38'],
'freifeld39'=>$value['freifeld39'],
'freifeld40'=>$value['freifeld40'],
"keinrabatterlaubt"=>$value['keinrabatterlaubt'],
"rabatt"=>$value['rabatt']));
}
if($positionenkaufmaenischrunden == 3){
$netto_gesamt = $value['menge'] * round($value['preis'] - ($value['preis'] / 100 * $value['rabatt']),2);
}else{
$netto_gesamt = $value['menge'] * ($value['preis'] - ($value['preis'] / 100 * $value['rabatt']));
}
if($positionenkaufmaenischrunden)
{
$netto_gesamt = round($netto_gesamt, 2);
}
$summe = $summe + $netto_gesamt;
if(!isset($summen[$value['steuersatz']]))$summen[$value['steuersatz']] = 0;
$summen[$value['steuersatz']] += ($netto_gesamt/100)*$value['steuersatz'];
$gesamtsteuern +=($netto_gesamt/100)*$value['steuersatz'];
/*
if($value['umsatzsteuer']=="" || $value['umsatzsteuer']=="normal")
{
$summeV = $summeV + (($netto_gesamt/100)*$this->app->erp->GetSteuersatzNormal(false,$id,"gutschrift"));
}
else {
$summeR = $summeR + (($netto_gesamt/100)*$this->app->erp->GetSteuersatzErmaessigt(false,$id,"gutschrift"));
}*/
}
if($positionenkaufmaenischrunden && isset($summen) && is_array($summen))
{
$gesamtsteuern = 0;
foreach($summen as $k => $v)
{
$summen[$k] = round($v, 2);
$gesamtsteuern += round($v, 2);
}
}
if($positionenkaufmaenischrunden)
{
list($summe,$gesamtsumme, $summen) = $this->app->erp->steuerAusBelegPDF($this->table, $this->id);
$gesamtsteuern = $gesamtsumme - $summe;
}
/*
$summe = $this->app->DB->Select("SELECT SUM(menge*preis) FROM gutschrift_position WHERE gutschrift='$id'");
$summeV = $this->app->DB->Select("SELECT SUM(menge*preis) FROM gutschrift_position WHERE gutschrift='$id' AND (umsatzsteuer='normal' or umsatzsteuer='')")/100 * 19;
$summeR = $this->app->DB->Select("SELECT SUM(menge*preis) FROM gutschrift_position WHERE gutschrift='$id' AND umsatzsteuer='ermaessigt'")/100 * 7;
*/
if($this->app->erp->GutschriftMitUmsatzeuer($id))
{
$this->setTotals(array("totalArticles"=>$summe,"total"=>$summe + $gesamtsteuern,"summen"=>$summen,"totalTaxV"=>0,"totalTaxR"=>0));
//$this->setTotals(array("totalArticles"=>$summe,"total"=>$summe + $summeV + $summeR,"totalTaxV"=>$summeV,"totalTaxR"=>$summeR));
} else
$this->setTotals(array("totalArticles"=>$summe,"total"=>$summe));
/* Dateiname */
$tmp_name = str_replace(' ','',trim($this->recipient['enterprise']));
$tmp_name = str_replace('.','',$tmp_name);
if($stornorechnung)
$this->filename = $datum2."_STORNO_".$belegnr.".pdf";
else
$this->filename = $datum2."_GS".$belegnr.".pdf";
$this->setBarcode($belegnr);
}
}
<?php
if(!class_exists('BriefpapierCustom'))
{
class BriefpapierCustom extends Briefpapier
{
}
}
class GutschriftPDF extends BriefpapierCustom {
public $doctype;
function __construct($app,$projekt="")
{
$this->app=$app;
//parent::Briefpapier();
$this->doctype="gutschrift";
$this->doctypeOrig="Gutschrift";
parent::__construct($this->app,$projekt);
}
function GetGutschrift($id)
{
$this->doctypeid = $id;
if($this->app->erp->Firmendaten("steuerspalteausblenden")=="1")
{
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
$check = $this->app->erp->SteuerAusBeleg($this->doctype,$id);
if(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false;
else $this->ust_spalteausblende=true;
}
$briefpapier_bearbeiter_ausblenden = $this->app->erp->Firmendaten('briefpapier_bearbeiter_ausblenden');
$briefpapier_vertrieb_ausblenden = $this->app->erp->Firmendaten('briefpapier_vertrieb_ausblenden');
//$this->setRecipientDB($adresse);
$this->setRecipientLieferadresse($id,"gutschrift");
$data = $this->app->DB->SelectRow(
"SELECT adresse,kundennummer, sprache, rechnungid, buchhaltung, bearbeiter, vertrieb,
lieferschein AS lieferscheinid, DATE_FORMAT(datum,'%d.%m.%Y') AS datum,
DATE_FORMAT(lieferdatum,'%d.%m.%Y') AS lieferdatum, belegnr, freitext, ustid, ust_befreit,
stornorechnung, keinsteuersatz, land, typ, zahlungsweise, zahlungsstatus, zahlungszieltage,
zahlungszielskonto, projekt, waehrung, bodyzusatz,
DATE_FORMAT(DATE_ADD(datum, INTERVAL zahlungszieltage DAY),'%d.%m.%Y') AS zahlungsdatum,
ohne_briefpapier, ihrebestellnummer,DATE_FORMAT(datum,'%Y%m%d') as datum2, email, telefon
FROM gutschrift WHERE id='$id' LIMIT 1"
);
extract($data,EXTR_OVERWRITE);
$adresse = $data['adresse'];
$kundennummer = $data['kundennummer'];
$sprache = $data['sprache'];
$rechnungid = $data['rechnungid'];
$buchhaltung = $data['buchhaltung'];
$email = $data['email'];
$telefon = $data['telefon'];
$bearbeiter = $data['bearbeiter'];
$vertrieb = $data['vertrieb'];
$lieferscheinid = $data['lieferscheinid'];
$datum = $data['datum'];
$lieferdatum = $data['lieferdatum'];
$belegnr = $data['belegnr'];
$freitext = $data['freitext'];
$ustid = $data['ustid'];
$ust_befreit = $data['ust_befreit'];
$stornorechnung = $data['stornorechnung'];
$keinsteuersatz = $data['keinsteuersatz'];
$land = $data['land'];
$typ = $data['typ'];
$zahlungsweise = $data['zahlungsweise'];
$zahlungszieltage = $data['zahlungszieltage'];
$zahlungszielskonto = $data['zahlungszielskonto'];
$projekt = $data['projekt'];
$waehrung = $data['waehrung'];
$bodyzusatz = $data['bodyzusatz'];
$zahlungsdatum = $data['zahlungsdatum'];
$ohne_briefpapier = $data['ohne_briefpapier'];
$ihrebestellnummer = $data['ihrebestellnummer'];
$datum2 = $data['datum2'];
$projektabkuerzung = $this->app->DB->Select(sprintf('SELECT abkuerzung FROM projekt WHERE id = %d', $projekt));
$kundennummer = $this->app->DB->Select("SELECT kundennummer FROM adresse WHERE id='$adresse' LIMIT 1");
if(empty($sprache)){
$sprache = $this->app->DB->Select("SELECT sprache FROM adresse WHERE id='$adresse' LIMIT 1");
}
$lieferschein = $this->app->DB->Select("SELECT belegnr FROM lieferschein WHERE id='$lieferscheinid' LIMIT 1");
$lieferscheindatum = $this->app->DB->Select("SELECT DATE_FORMAT(datum, '%d.%m.%Y') AS datum FROM lieferschein WHERE id = '$lieferscheinid' LIMIT 1");
$rechnung = $this->app->DB->Select("SELECT belegnr FROM rechnung WHERE id='$rechnungid' LIMIT 1");
$rechnungsdatum = $this->app->DB->Select("SELECT DATE_FORMAT(datum, '%d.%m.%Y') AS datum FROM rechnung WHERE id = '$rechnungid' LIMIT 1");
$auftrag = $this->app->DB->Select("SELECT auftrag FROM rechnung WHERE id = '$rechnungid' LIMIT 1");
$ihrebestellnummer = $this->app->erp->ReadyForPDF($ihrebestellnummer);
$bearbeiter = $this->app->erp->ReadyForPDF($bearbeiter);
$vertrieb = $this->app->erp->ReadyForPDF($vertrieb);
$this->app->erp->BeschriftungSprache($sprache);
if($waehrung)$this->waehrung = $waehrung;
$this->sprache = $sprache;
$this->projekt = $projekt;
$this->anrede = $typ;
if($vertrieb==$bearbeiter && (!$briefpapier_bearbeiter_ausblenden && !$briefpapier_vertrieb_ausblenden)) $vertrieb="";
if($ohne_briefpapier=="1")
{
$this->logofile = "";
$this->briefpapier="";
$this->briefpapier2="";
}
// $zahlungsweise = strtolower($zahlungsweise);
if($zahlungsweise=="lastschrift" || $zahlungsweise=="einzugsermaechtigung")
{
$zahlungsweisetext = "\n".$this->app->erp->Beschriftung("dokument_offene_lastschriften");
}
//if($zahlungszielskonto>0) $zahlungsweisetext .= "\n".$this->app->erp->Beschriftung("dokument_skonto")." $zahlungszielskonto% ".$this->app->erp->Beschriftung("dokument_auszahlungskonditionen");
if($zahlungszielskonto!=0)
$zahlungsweisetext .="\r\n".$this->app->erp->Beschriftung("dokument_skontoanderezahlungsweisen");
$zahlungsweisetext = str_replace('{ZAHLUNGSZIELSKONTO}',number_format($zahlungszielskonto,2,',','.'),$zahlungsweisetext);
if($belegnr=="" || $belegnr=="0") $belegnr = "- ".$this->app->erp->Beschriftung("dokument_entwurf");
if($stornorechnung)
$this->doctypeOrig=$this->app->erp->Beschriftung("bezeichnungstornorechnung")." $belegnr";
else
$this->doctypeOrig=$this->app->erp->Beschriftung("dokument_gutschrift")." $belegnr";
if($gutschrift=="") $gutschrift = "-";
if($kundennummer=="") $kundennummer= "-";
if($auftrag=="0") $auftrag = "-";
if($lieferschein=="0") $lieferschein= "-";
$bearbeiteremail = $this->app->DB->Select("SELECT b.email FROM gutschrift g LEFT JOIN adresse b ON b.id=g.bearbeiterid WHERE g.id='$id' LIMIT 1");
$bearbeitertelefon = $this->app->DB->Select("SELECT b.telefon FROM gutschrift g LEFT JOIN adresse b ON b.id=g.bearbeiterid WHERE g.id='$id' LIMIT 1");
/** @var \Xentral\Modules\Company\Service\DocumentCustomizationService $service */
$service = $this->app->Container->get('DocumentCustomizationService');
if($block = $service->findActiveBlock('corr', 'credit_note', $projekt)) {
$sCD = $service->parseBlockAsArray($this->getLanguageCodeFrom($this->sprache),'corr', 'credit_note',[
'GUTSCHRIFTSNUMMER' => $belegnr,
'DATUM' => $datum,
'RECHNUNGSNUMMER' => $rechnung,
'RECHNUNGSDATUM' => $rechnungsdatum,
'KUNDENNUMMER' => $kundennummer,
'BEARBEITER' => $bearbeiter,
'BEARBEITEREMAIL' => $bearbeiteremail,
'BEARBEITERTELEFON' => $bearbeitertelefon,
'VERTRIEB' => $vertrieb,
'PROJEKT' => $projektabkuerzung,
'AUFTRAGSNUMMER' => $auftrag,
'LIEFERSCHEINNUMMER' => $lieferschein,
'LIEFERSCHEINDATUM' => $lieferscheindatum,
'EMAIL' => $email,
'TELEFON' => $telefon
], $projekt);
if(!empty($sCD)) {
switch($block['fontstyle']) {
case 'f':
$this->setBoldCorrDetails($sCD);
break;
case 'i':
$this->setItalicCorrDetails($sCD);
break;
case 'fi':
$this->setItalicBoldCorrDetails($sCD);
break;
default:
$this->setCorrDetails($sCD, true);
break;
}
}
}
else{
//$this->setCorrDetails(array("Auftrag"=>$auftrag,"Datum"=>$datum,"Ihre Kunden-Nr."=>$kundennummer,"Lieferschein"=>$lieferschein,"Buchhaltung"=>$buchhaltung));
if($briefpapier_bearbeiter_ausblenden || $briefpapier_vertrieb_ausblenden){
if($rechnung != ""){
$sCD = array($this->app->erp->Beschriftung("dokument_rechnung") => $rechnung, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer, $this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer);
}else{
$sCD = array($this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer);
//$this->setCorrDetails(array($this->app->erp->Beschriftung("dokument_datum")=>$datum,$this->app->erp->Beschriftung("bezeichnungkundennummer")=>$kundennummer,$this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer")=>$ihrebestellnummer));
}
if(!$briefpapier_bearbeiter_ausblenden){
if($bearbeiter) $sCD[$this->app->erp->Beschriftung("auftrag_bezeichnung_bearbeiter")] = $bearbeiter;
}elseif(!$briefpapier_vertrieb_ausblenden){
if($vertrieb) $sCD[$this->app->erp->Beschriftung("auftrag_bezeichnung_vertrieb")] = $vertrieb;
}
}else{
if($rechnung != "")
$sCD = array($this->app->erp->Beschriftung("dokument_rechnung") => $rechnung, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer, $this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bearbeiter") => $bearbeiter, $this->app->erp->Beschriftung("auftrag_bezeichnung_vertrieb") => $vertrieb);
else
$sCD = array($this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bearbeiter") => $bearbeiter, $this->app->erp->Beschriftung("auftrag_bezeichnung_vertrieb") => $vertrieb);
}
if($lieferdatum != "00.00.0000")
$sCD[$this->app->erp->Beschriftung("dokument_lieferdatum")] = $lieferdatum;
$this->setCorrDetails($sCD);
}
if($keinsteuersatz!="1")
{
if($ust_befreit==2)//$this->app->erp->Export($land))
$steuer = $this->app->erp->Beschriftung("export_lieferung_vermerk");
else {
if($ust_befreit==1 && $ustid!="")//$this->app->erp->IstEU($land))
$steuer = $this->app->erp->Beschriftung("eu_lieferung_vermerk");
}
$steuer = str_replace('{USTID}',$ustid,$steuer);
$steuer = str_replace('{LAND}',$land,$steuer);
}
$gutschrift_header=$this->app->erp->Beschriftung("gutschrift_header");
if($bodyzusatz!="") $gutschrift_header=$gutschrift_header."\r\n".$bodyzusatz;
if($stornorechnung)
{
$gutschrift_header = str_replace('{ART}',$this->app->erp->Beschriftung("bezeichnungstornorechnung"),$gutschrift_header);
} else {
$gutschrift_header = str_replace('{ART}',$this->app->erp->Beschriftung("dokument_gutschrift"),$gutschrift_header);
}
$gutschrift_header = $this->app->erp->ParseUserVars("gutschrift",$id,$gutschrift_header);
if($this->app->erp->Firmendaten("footer_reihenfolge_gutschrift_aktivieren")=="1") {
$footervorlage = $this->app->erp->Firmendaten("footer_reihenfolge_gutschrift");
if($footervorlage=="")
$footervorlage = "{FOOTERFREITEXT}\r\n{FOOTERTEXTVORLAGEGUTSCHRIFT}\r\n{FOOTERSTEUER}\r\n{FOOTERZAHLUNGSWEISETEXT}";
$footervorlage = str_replace('{FOOTERFREITEXT}',$freitext,$footervorlage);
$footervorlage = str_replace('{FOOTERTEXTVORLAGEGUTSCHRIFT}',$this->app->erp->Beschriftung("gutschrift_footer"),$footervorlage);
$footervorlage = str_replace('{FOOTERSTEUER}',$steuer,$footervorlage);
$footervorlage = str_replace('{FOOTERZAHLUNGSWEISETEXT}',$zahlungsweisetext,$footervorlage);
$footervorlage = $this->app->erp->ParseUserVars("gutschrift",$id,$footervorlage);
$footer = $footervorlage;
} else {
$footer = "$freitext"."\r\n".$this->app->erp->ParseUserVars("gutschrift",$id,$this->app->erp->Beschriftung("gutschrift_footer"))."\r\n$zahlungsweisetext\r\n$steuer";
}
$this->setTextDetails(array(
"body"=>$gutschrift_header,
"footer"=>$footer));
$artikel = $this->app->DB->SelectArr("SELECT * FROM gutschrift_position WHERE gutschrift='$id' ORDER By sort");
if(!$this->app->erp->GutschriftMitUmsatzeuer($id)) $this->ust_befreit=true;
$summe_rabatt = $this->app->DB->Select("SELECT SUM(rabatt) FROM gutschrift_position WHERE gutschrift='$id'");
if($summe_rabatt <> 0) $this->rabatt=1;
if($this->app->erp->Firmendaten("modul_verband")=="1") $this->rabatt=1;
//$waehrung = $this->app->DB->Select("SELECT waehrung FROM gutschrift_position WHERE gutschrift='$id' LIMIT 1");
$steuersatzV = $this->app->erp->GetSteuersatzNormal(false,$id,"gutschrift");
$steuersatzR = $this->app->erp->GetSteuersatzErmaessigt(false,$id,"gutschrift");
$gesamtsteuern = 0;
$mitumsatzsteuer = $this->app->erp->GutschriftMitUmsatzeuer($id);
$belege_subpositionenstuecklisten = $this->app->erp->Firmendaten('belege_subpositionenstuecklisten');
$belege_stuecklisteneinrueckenmm = $this->app->erp->Firmendaten('belege_stuecklisteneinrueckenmm');
//$positionenkaufmaenischrunden = $this->app->erp->Firmendaten('positionenkaufmaenischrunden');
$positionenkaufmaenischrunden = $this->app->erp->Projektdaten($projekt,"preisberechnung");
$viernachkommastellen_belege = $this->app->erp->Firmendaten('viernachkommastellen_belege');
foreach($artikel as $key=>$value)
{
if($value['umsatzsteuer'] != "ermaessigt" && $value['umsatzsteuer'] != "befreit") $value['umsatzsteuer'] = "normal";
$tmpsteuersatz = null;
$tmpsteuertext = null;
$this->app->erp->GetSteuerPosition('gutschrift', $value['id'],$tmpsteuersatz, $tmpsteuertext);
if(is_null($value['steuersatz']) || $value['steuersatz'] < 0)
{
if($value['umsatzsteuer'] == "ermaessigt")
{
$value['steuersatz'] = $steuersatzR;
}elseif($value['umsatzsteuer'] == "befreit")
{
$value['steuersatz'] = $steuersatzR;
}else{
$value['steuersatz'] = $steuersatzV;
}
if(!is_null($tmpsteuersatz))$value['steuersatz'] = $tmpsteuersatz;
}
if($tmpsteuertext && !$value['steuertext'])$value['steuertext'] = $tmpsteuertext;
if(!$mitumsatzsteuer)$value['steuersatz'] = 0;
// negative Darstellung bei Stornorechnung
if($stornorechnung) $value['preis'] = $value['preis'] *-1;
if(!$this->app->erp->Export($land))
{
$value['zolltarifnummer']="";
$value['herkunftsland']="";
}
$value = $this->CheckPosition($value,"gutschrift",$this->doctypeid,$value['id']);
$value['menge'] = floatval($value['menge']);
if($value['explodiert_parent_artikel'] > 0)
{
if($belege_subpositionenstuecklisten || $belege_stuecklisteneinrueckenmm)$value['bezeichnung'] = ltrim(ltrim($value['bezeichnung'],'*'));
if(isset($lvl) && isset($lvl[$value['explodiert_parent_artikel']]))
{
$value['lvl'] = $lvl[$value['explodiert_parent_artikel']] + 1;
}else{
$value['lvl'] = 1;
}
$lvl[$value['artikel']] = $value['lvl'];
$check_ausblenden = $this->app->DB->Select("SELECT keineeinzelartikelanzeigen FROM artikel WHERE id='".$value['explodiert_parent_artikel']."' LIMIT 1");
if(!$check_ausblenden && isset($ausblenden) && in_array($value['explodiert_parent_artikel'], $ausblenden))
{
$check_ausblenden = true;
}
if($check_ausblenden)
{
$ausblenden[] = $value['artikel'];
}
} else
{
$check_ausblenden=0;
$lvl[$value['artikel']] = 0;
$value['lvl'] = 0;
}
if($value['ausblenden_im_pdf']) $check_ausblenden=1;
$ohne_artikeltext = $this->app->DB->Select("SELECT ohne_artikeltext FROM ".$this->table." WHERE id='".$this->id."' LIMIT 1");
if($ohne_artikeltext=="1") $value['beschreibung']="";
if($check_ausblenden!=1)
{
$this->addItem(array('currency'=>$value['waehrung'],'lvl'=>isset($value['lvl'])?$value['lvl']:0,
'amount'=>$value['menge'],
'price'=>$value['preis'],
'tax'=>$value['umsatzsteuer'],
'steuersatz'=>$value['steuersatz'],
'steuertext'=>$value['steuertext'],
'itemno'=>$value['nummer'],
'artikel'=>$value['artikel'],
'unit'=>$value['einheit'],
'desc'=>$value['beschreibung'],
"name"=>ltrim($value['bezeichnung']),
'artikelnummerkunde'=>$value['artikelnummerkunde'],
'lieferdatum'=>$value['lieferdatum'],
'lieferdatumkw'=>$value['lieferdatumkw'],
'zolltarifnummer'=>$value['zolltarifnummer'],
'herkunftsland'=>$value['herkunftsland'],
'ohnepreis'=>$value['ohnepreis'],
'grundrabatt'=>$value['grundrabatt'],
'rabatt1'=>$value['rabatt1'],
'rabatt2'=>$value['rabatt2'],
'rabatt3'=>$value['rabatt3'],
'rabatt4'=>$value['rabatt4'],
'rabatt5'=>$value['rabatt5'],
'freifeld1'=>$value['freifeld1'],
'freifeld2'=>$value['freifeld2'],
'freifeld3'=>$value['freifeld3'],
'freifeld4'=>$value['freifeld4'],
'freifeld5'=>$value['freifeld5'],
'freifeld6'=>$value['freifeld6'],
'freifeld7'=>$value['freifeld7'],
'freifeld8'=>$value['freifeld8'],
'freifeld9'=>$value['freifeld9'],
'freifeld10'=>$value['freifeld10'],
'freifeld11'=>$value['freifeld11'],
'freifeld12'=>$value['freifeld12'],
'freifeld13'=>$value['freifeld13'],
'freifeld14'=>$value['freifeld14'],
'freifeld15'=>$value['freifeld15'],
'freifeld16'=>$value['freifeld16'],
'freifeld17'=>$value['freifeld17'],
'freifeld18'=>$value['freifeld18'],
'freifeld19'=>$value['freifeld19'],
'freifeld20'=>$value['freifeld20'],
'freifeld21'=>$value['freifeld21'],
'freifeld22'=>$value['freifeld22'],
'freifeld23'=>$value['freifeld23'],
'freifeld24'=>$value['freifeld24'],
'freifeld25'=>$value['freifeld25'],
'freifeld26'=>$value['freifeld26'],
'freifeld27'=>$value['freifeld27'],
'freifeld28'=>$value['freifeld28'],
'freifeld29'=>$value['freifeld29'],
'freifeld30'=>$value['freifeld30'],
'freifeld31'=>$value['freifeld31'],
'freifeld32'=>$value['freifeld32'],
'freifeld33'=>$value['freifeld33'],
'freifeld34'=>$value['freifeld34'],
'freifeld35'=>$value['freifeld35'],
'freifeld36'=>$value['freifeld36'],
'freifeld37'=>$value['freifeld37'],
'freifeld38'=>$value['freifeld38'],
'freifeld39'=>$value['freifeld39'],
'freifeld40'=>$value['freifeld40'],
"keinrabatterlaubt"=>$value['keinrabatterlaubt'],
"rabatt"=>$value['rabatt']));
}
if($positionenkaufmaenischrunden == 3){
$netto_gesamt = $value['menge'] * round($value['preis'] - ($value['preis'] / 100 * $value['rabatt']),2);
}else{
$netto_gesamt = $value['menge'] * ($value['preis'] - ($value['preis'] / 100 * $value['rabatt']));
}
if($positionenkaufmaenischrunden)
{
$netto_gesamt = round($netto_gesamt, 2);
}
$summe = $summe + $netto_gesamt;
if(!isset($summen[$value['steuersatz']]))$summen[$value['steuersatz']] = 0;
$summen[$value['steuersatz']] += ($netto_gesamt/100)*$value['steuersatz'];
$gesamtsteuern +=($netto_gesamt/100)*$value['steuersatz'];
/*
if($value['umsatzsteuer']=="" || $value['umsatzsteuer']=="normal")
{
$summeV = $summeV + (($netto_gesamt/100)*$this->app->erp->GetSteuersatzNormal(false,$id,"gutschrift"));
}
else {
$summeR = $summeR + (($netto_gesamt/100)*$this->app->erp->GetSteuersatzErmaessigt(false,$id,"gutschrift"));
}*/
}
if($positionenkaufmaenischrunden && isset($summen) && is_array($summen))
{
$gesamtsteuern = 0;
foreach($summen as $k => $v)
{
$summen[$k] = round($v, 2);
$gesamtsteuern += round($v, 2);
}
}
if($positionenkaufmaenischrunden)
{
list($summe,$gesamtsumme, $summen) = $this->app->erp->steuerAusBelegPDF($this->table, $this->id);
$gesamtsteuern = $gesamtsumme - $summe;
}
/*
$summe = $this->app->DB->Select("SELECT SUM(menge*preis) FROM gutschrift_position WHERE gutschrift='$id'");
$summeV = $this->app->DB->Select("SELECT SUM(menge*preis) FROM gutschrift_position WHERE gutschrift='$id' AND (umsatzsteuer='normal' or umsatzsteuer='')")/100 * 19;
$summeR = $this->app->DB->Select("SELECT SUM(menge*preis) FROM gutschrift_position WHERE gutschrift='$id' AND umsatzsteuer='ermaessigt'")/100 * 7;
*/
if($this->app->erp->GutschriftMitUmsatzeuer($id))
{
$this->setTotals(array("totalArticles"=>$summe,"total"=>$summe + $gesamtsteuern,"summen"=>$summen,"totalTaxV"=>0,"totalTaxR"=>0));
//$this->setTotals(array("totalArticles"=>$summe,"total"=>$summe + $summeV + $summeR,"totalTaxV"=>$summeV,"totalTaxR"=>$summeR));
} else
$this->setTotals(array("totalArticles"=>$summe,"total"=>$summe));
/* Dateiname */
$tmp_name = str_replace(' ','',trim($this->recipient['enterprise']));
$tmp_name = str_replace('.','',$tmp_name);
if($stornorechnung)
$this->filename = $datum2."_STORNO_".$belegnr.".pdf";
else
$this->filename = $datum2."_GS".$belegnr.".pdf";
$this->setBarcode($belegnr);
}
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -50,7 +50,7 @@ class RechnungPDF extends BriefpapierCustom {
{
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
$check = $this->app->erp->SteuerAusBeleg($this->doctype,$id);
if(count($check)>1)$this->ust_spalteausblende=false;
if(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false;
else $this->ust_spalteausblende=true;
}
$lvl = null;