<?php 
	header('Content-Type: text/pdf; charset=UTF-8');	
	header("Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, max-age=0, post-check=0");
	
			
	function createPdf($saveTheFileTo, $pdfContent, $pdfReportName, $bonHeight=false){
		#	http://fpdf.de/funktionsreferenz/?funktion=SetDisplayMode
		require('include/fpdf.php');
		$pdfContentHead=$pdfContent[0];
		$pdfContentData=$pdfContent[1];
		$pdfContentFooter=$pdfContent[2];
		$pdfContentSummery=$pdfContent[3];
		
		$marginLR=10;
		$marginTop=10; 
		$marginBottom=10;

		if($pdfReportName == 'productReportBonPrint' || $pdfReportName == 'customerCodeReport' || $pdfReportName == 'lieferscheineReport'
						|| $pdfReportName == 'auditingReport' || ($pdfReportName == 'totalReport' && strtolower(REPORT_GESAMTREV_BONDRUCKER) == 'ja')){
			$printer=mysql_fetch_array(mysql_query("SELECT win_drucker_name, drucker_margin_pdf, zoom_factor  FROM drucker WHERE LOWER(ist_rechnungsdrucker) = 'ja' "));
			$drucker=$printer[0];
			$margin=$printer[1];
			$margins=explode(",", $margin);
		
			if(isset($margins[2]))$marginLR=preg_replace('/\D/', '', $margins[2]);
			if(isset($margins[1]))$marginBottom=preg_replace('/\D/', '', $margins[1]); 			
			if(isset($margins[0]))$marginTop=preg_replace('/\D/', '', $margins[0]);	
		}
		
		$printLength=count($pdfContentData)*5;		
		$printLength+=200+$marginBottom+$marginTop;	# zähle die zeilen um die Höhe vom productReport zu ermitteln, die 300 sind header und so zeugs
		
		if($pdfReportName == 'lieferscheineReport' && $bonHeight != false){
			$printLength=$bonHeight+200+$marginBottom+$marginTop;

		}
		else if($pdfReportName == 'productReportBonPrint' && $bonHeight != false){
			$printLength=$bonHeight+200+$marginBottom+$marginTop;

		}
		else if($pdfReportName == 'totalReport' && strtolower(REPORT_GESAMTREV_BONDRUCKER) == 'ja' && $bonHeight != false){
			$printLength=($bonHeight*3.7)+200+$marginBottom+$marginTop;

		}
		else if($pdfReportName == 'auditingReport' && $bonHeight != false){
			$printLength=$bonHeight+200+$marginBottom+$marginTop;
		}
		
		

		class sITposPDF extends FPDF { 
				public $pdfContentHead;
				public $pdfContentData;
				public $pdfContentFooter;
				public $pdfContentSummery;
				public $pdfReportName;
				public $bonHeight;
				public $pdfContent;
				public $marginBottom;
			
							
			function Header(){
					
					if($this->PageNo() != 1 && $this->pdfReportName == 'kassabuchReport2.0'){
						global $fontData;
						$fFont=$fontData[0];
						$this->SetFont($fontData[0], 'B', $fontData[1]);
						$this->SetFillColor(50, 50, 50);
						$this->SetTextColor(255, 255, 255);
						
						$printWidth=210-$this->marginLR;
						
						$cashB_rowA=$printWidth*.11; $cashB_rowB=$printWidth*.11; $cashB_rowC=$printWidth*.1; $cashB_rowD=$printWidth*.1; 
								$cashB_rowE=$printWidth*.17; $cashB_rowF=$printWidth*.17; $cashB_rowG=$printWidth*.18; 
						$pdfContentHead=$this->pdfContentHead;
						
						$this->Cell($cashB_rowA, $fontData[2],iconv('UTF-8', 'windows-1252', $pdfContentHead[8][0]),0,0,'C',true);
						$this->Cell($cashB_rowB, $fontData[2],iconv('UTF-8', 'windows-1252', $pdfContentHead[8][1]),0,0,'R', true);
						$this->Cell($cashB_rowC, $fontData[2],iconv('UTF-8', 'windows-1252', $pdfContentHead[8][2]),0,0,'R', true);
						$this->Cell($cashB_rowD, $fontData[2],iconv('UTF-8', 'windows-1252', $pdfContentHead[8][3]),0,0,'R', true);
						$this->Cell($cashB_rowE, $fontData[2],iconv('UTF-8', 'windows-1252', $pdfContentHead[8][4]),0,0,'L', true);
						$this->Cell($cashB_rowF, $fontData[2],iconv('UTF-8', 'windows-1252', $pdfContentHead[8][5]),0,0,'L', true);
						$this->Cell($cashB_rowG, $fontData[2],iconv('UTF-8', 'windows-1252', $pdfContentHead[8][6]),0,1,'L', true);
						
						
						#$this->Cell(0, $fontData[2], iconv('UTF-8', 'windows-1252', "-#-#-#-#-#-#-#-#-#-#-#".$fontData[0]." / ".$fontData[1]." / ".$fontData[2]), 0, 1,'L');
					}
			}
			
			function docData(){
				
				
				
				$pdfContentHead=$this->pdfContentHead;
				$pdfContentData=$this->pdfContentData;
				$pdfContentFooter=$this->pdfContentFooter;
				$pdfContentSummery=$this->pdfContentSummery;
				$pdfReportName=$this->pdfReportName;
				$bonHeight=$this->bonHeight;
				$pdfContent=$this->pdfContent;
				$marginBottom=$this->marginBottom;
				
				$checkData=sizeof($pdfContentData);

				
				$fontConfig=SCHRIFT_AUSDRUCK_PDF;			// wird für Ausdruck auf Bondrucker verwendet	
					if ( strpos(strtolower($fontConfig), 'arial') !== false  || strpos(strtolower($fontConfig), 'helvetica') !== false || 
								strpos(strtolower($fontConfig), 'sans serif') !== false ){ $pdfFont="Arial";  }								
					else if ( strpos(strtolower($fontConfig), 'times') !== false  || strpos(strtolower($fontConfig), 'roman') !== false ||
								(strpos(strtolower($fontConfig), 'serif') !== false &&  strpos(strtolower($fontConfig), 'sans') == false)) { $pdfFont="Times";  }
					else if (strpos(strtolower($fontConfig), 'courier') !== false ) { $pdfFont="Courier";   }
					else {$pdfFont="Arial";  }
					
					preg_match('/\d+\s*p[x | t]/', $fontConfig, $m);
					preg_match('/\d+/', $m[0], $match);
					if($match[0] == true && $match[0] > 1) $pdfFontSize=$match[0];
					else $pdfFontSize = 8;

				$fontConfigA4=SCHRIFT_AUSDRUCK_REPORTS_PDF;
				if ( strpos(strtolower($fontConfigA4), 'arial') !== false  || strpos(strtolower($fontConfigA4), 'helvetica') !== false || 
								strpos(strtolower($fontConfigA4), 'sans serif') !== false ){ $pdfFontA4="Arial";  }								
					else if ( strpos(strtolower($fontConfigA4), 'times') !== false  || strpos(strtolower($fontConfigA4), 'roman') !== false ||
								(strpos(strtolower($fontConfigA4), 'serif') !== false &&  strpos(strtolower($fontConfigA4), 'sans') == false)) { $pdfFontA4="Times";  }
					else if (strpos(strtolower($fontConfigA4), 'courier') !== false ) { $pdfFontA4="Courier";   }
					else {$pdfFontA4="Arial";  }
					
					preg_match('/\d+\s*p[x | t]/', $fontConfigA4, $m);
					preg_match('/\d+/', $m[0], $matchA4);
					
					if($match[0] == true && $match[0] > 1) $pdfFontSizeA4=$matchA4[0];
					else $pdfFontSizeA4 = 11;
					
						
				if($pdfReportName == 'customerReport'){
						$faTxt=iconv('UTF-8', 'windows-1252', $pdfContentHead[2][4])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[3][4]).
							"\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[4][4])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[5][4]);
				}
				else if($pdfReportName == 'categorieReport' || $pdfReportName == 'sellerReport' || $pdfReportName == 'productReport' 
						|| $pdfReportName == 'productReportBonPrint' || $pdfReportName == 'sellerReportPayment' 
						|| $pdfReportName == 'lieferscheineReport' ){	
						$faTxt=iconv('UTF-8', 'windows-1252', $pdfContentHead[2][3])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[3][3]).
							"\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[4][3])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[5][3]);
				}
				else if($pdfReportName == 'totalReport' ){
						$faTxt=iconv('UTF-8', 'windows-1252', $pdfContentHead[2][7])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[3][7]).
							"\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[4][7])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[5][7]);
				}
				else if($pdfReportName == 'kassabuchReport'){
					echo "bin in Kassabuch $pdfReportName";
						$faTxt=iconv('UTF-8', 'windows-1252', $pdfContentHead[2][4])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[3][4]).
							"\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[4][4])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[5][4]);
				}
				else if($pdfReportName == 'kassabuchReport2.0'){
						$faTxt=iconv('UTF-8', 'windows-1252', $pdfContentHead[2][6]."\n".$pdfContentHead[3][6].
							"\n".$pdfContentHead[4][6]."\n".$pdfContentHead[5][6]);
				}
				else if($pdfReportName == 'customerCodeReport'){
						$faTxt=iconv('UTF-8', 'windows-1252', $pdfContentHead[1][4])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[2][4]).
							"\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[3][4])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[4][4]);
				}
				else if($pdfReportName == 'gutscheinReport' ){
					$faTxt=iconv('UTF-8', 'windows-1252', $pdfContentHead[2][5])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[3][5]).
							"\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[4][5])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[5][5]);
				}
				else if($pdfReportName == 'auditingReport' ){
					$faTxt=iconv('UTF-8', 'windows-1252', $pdfContentHead[2][2])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[3][2]).
							"\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[4][2])."\n".iconv('UTF-8', 'windows-1252', $pdfContentHead[5][2]);
				}
				
				else $faTxt = "";
				
				$footerTitle="";
				
				if($pdfReportName == 'productReportBonPrint' || $pdfReportName == 'customerCodeReport' || $pdfReportName == 'sellerReportPayment'
						|| $pdfReportName == 'lieferscheineReport' || $pdfReportName == 'auditingReport' 
						|| ($pdfReportName == 'totalReport' && strtolower(REPORT_GESAMTREV_BONDRUCKER) == 'ja')){
						
					$this->SetFont($pdfFont, 'B', $pdfFontSize);
						
					$printer=mysql_fetch_array(mysql_query("SELECT win_drucker_name, drucker_margin_pdf, druckbreite  FROM drucker 
								WHERE LOWER(ist_rechnungsdrucker) = 'ja' "));
		
					if($printer['druckbreite'] == true && $printer['druckbreite'] > 35) $bonWidth = $printer['druckbreite'];
					else $bonWidth=preg_replace('/[^\d]/', '', AUSDRUCK_GESAMTE_BREITE);
						
						$custCodeCol_A=$bonWidth*.15;
						$custCodeCol_B=$bonWidth*.45;
						$custCodeCol_C=$bonWidth*.12;
						$custCodeCol_D=$bonWidth*.13;
						$custCodeCol_E=$bonWidth*.13;
						
						$sellerRepCol_A=$bonWidth*.30;
						$sellerRepCol_B=$bonWidth*.40;
						$sellerRepCol_C=$bonWidth*.30;
						
						$lsRepCol_A=$bonWidth*.25;
						$lsRepCol_B=$bonWidth*.15;
						$lsRepCol_C=$bonWidth*.60;
						
						$lineHight=$pdfFontSize*.5;
						
						$totalCol_A=$bonWidth*.18;
						$totalCol_B=$bonWidth*.18;
						$totalCol_B_2=$bonWidth*.29;
						$totalCol_C=$bonWidth*.35;
						$totalCol_D=$bonWidth;
						$totalCol_E=$bonWidth*.20;
						$totalCol_F=$bonWidth*.20;
						$totalCol_G=$bonWidth*.20;
						$totalCol_H=$bonWidth*.20;
						$totalCol_I=$bonWidth*.20;
						
						
						$this->MultiCell($bonWidth, $lineHight,$faTxt, 0,'C');
						$this->Cell($bonWidth, $lineHight,"",0,1,'C');
						$this->SetFont($pdfFont, 'B', $pdfFontSize);
						$this->MultiCell($bonWidth, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[1][0]),0,'C');
						$this->SetFont($pdfFont, '', $pdfFontSize);
						$this->Cell($bonWidth, $lineHight, "", 0, 1,'C');
						
						$n = $this->GetStringWidth( iconv('UTF-8', 'windows-1252', $pdfContentHead[2][0]) . 'm' );
						$this->Cell($n+1, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[2][0]),0,0,'L');						
						$this->Cell($bonWidth/2 , $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[2][1]),0,1,'L');
						if($pdfContentHead[4][0] != "") $this->Cell($bonWidth, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[4][0]),0,1,'L');
						
						$n = $this->GetStringWidth( iconv('UTF-8', 'windows-1252', $pdfContentHead[3][0]) . 'm' );					
						$this->Cell($n+1, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[3][0]), 0, 0, 'L');
						$this->Cell($bonWidth/2, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[3][1]), 0, 1, 'L');
						$this->Cell($bonWidth, $lineHight/2, "", 0, 1, 'C');
							
				}
				
				else if($pdfReportName == 'kassabuchReport'){
						$this->SetFont($pdfFontA4, 'B', $pdfFontSizeA4);
						$lineHight= ($pdfFontSizeA4)* .5;
						
						$this->SetXY(197- $this->marginLR, $this->marginTop);
						$this->MultiCell(100, $lineHight, $faTxt, 0, 'R');
						
						$this->SetXY($this->marginLR, $this->GetY()-$lineHight);
						$this->MultiCell(175, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[1][0]), 0, 'L');
						$headerEndY=$this->GetY();
						
				}
				else if($pdfReportName == 'kassabuchReport2.0'){
						global $fontData;
						
						
						$this->SetFont($pdfFontA4, 'B', $pdfFontSizeA4);
						$lineHight= ($pdfFontSizeA4)* .4;
						
						$fontData=array($pdfFontA4, $pdfFontSizeA4, $lineHight);
						
						$this->SetXY(125 + $this->marginLR, $this->marginTop);
						$this->MultiCell((210-($this->marginLR*2))-125, $lineHight, $faTxt, 0, 'R');
							# hier wird der Kassabuchkopf (links) geschrieben
						$this->SetXY($this->marginLR, $this->marginTop);
						$this->Cell(85, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[1][0]), 0, 1, 'L'); 
						$this->Cell(85, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[2][0]." ".$pdfContentHead[2][1].", ".$pdfContentHead[3][0]." ".$pdfContentHead[3][1]), 0, 1, 'L');

						$this->Cell(45, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[4][0]), 0, 0, 'L');
						$this->Cell(40, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[4][1]), 0, 1, 'R');
						$this->Cell(45, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[5][0]), 0, 0, 'L');
						$this->Cell(40, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[5][1]), 0, 1, 'R');
						$this->Cell(45, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[6][0]), 0, 0, 'L');
						$this->Cell(40, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[6][1]), 0, 1, 'R');
						$this->Cell(45, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[6][2]), 0, 0, 'L');
						$this->Cell(40, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[6][3]), 0, 1, 'R');
						$this->Cell(45, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[6][4]), 0, 0, 'L');
						$this->Cell(40, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[6][5]), 0, 1, 'R');
						
						$headerEndY=$this->GetY();
						
						$lineHight= ($pdfFontSizeA4)* .5;
	
				}

				
				else{
					$this->SetFont($pdfFontA4, 'B', $pdfFontSizeA4*1.2);
					$lineHight= ($pdfFontSizeA4*1.2)* .5;

					$this->SetXY(110- $this->marginLR, $this->marginTop);
					$this->MultiCell(100, $lineHight, $faTxt, 0, 'R');
					
					$this->SetXY($this->marginLR, $this->GetY()-$lineHight);
					if($pdfReportName == 'totalReport') $this->MultiCell(125, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[1][3]), 0, 'L');
					else $this->MultiCell(125, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[1][0]), 0, 'L');
					$headerEndY=$this->GetY();

				}
				
				if($pdfReportName == 'totalReport' && strtolower(REPORT_GESAMTREV_BONDRUCKER) != 'ja' ){
					$this->Cell(0,  1, "", "B", 1, 'L');
					$this->Cell(0,  2, "", 0, 1, 'L');					
					$this->Cell(150, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[2][3]), 0 , 1,'L');
					$this->Cell(70, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[4][3]),0,1,'L');
					$this->Cell(70, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[3][3]),0,1,'L');
				}
				if($pdfReportName == 'productReportBonPrint' || $pdfReportName == 'customerCodeReport' || $pdfReportName == 'sellerReportPayment' 
							|| $pdfReportName == 'lieferscheineReport' || $pdfReportName == 'auditingReport'
							|| ($pdfReportName == 'totalReport' && strtolower(REPORT_GESAMTREV_BONDRUCKER) == 'ja')){
						
				}
				else if($pdfReportName == 'kassabuchReport2.0'){
					# hat keine weitere funktion als das dass nachfolgende else nicht zum tragen kommt
				}
				else {					
						$this->Cell(0,  1, "", "B", 1, 'L');
						$this->Cell(0,  2, "", 0, 1, 'L');
						$this->Cell(150, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[2][0]." ".$pdfContentHead[2][1]), 0, 1,'L');
						$this->Cell(150, $lineHight,iconv('UTF-8', 'windows-1252', trim($pdfContentHead[4][0])), 0, 1,'L');
						$this->Cell(150, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[3][0]." ".$pdfContentHead[3][1]), 0, 1,'L');					
				}
												
				#  header end
				if ($pdfReportName == 'kassabuchReport'){
					if($pdfFontSizeA4 > 11)$this->SetFont($pdfFontA4, 'B', 11);
					
				}
				else if ($pdfReportName == 'kassabuchReport2.0'){
					if($pdfFontSizeA4 > 11)$this->SetFont($pdfFontA4, 'B', 11);
					
				}
				else $this->SetFont($pdfFont, 'B', $pdfFontSize);
				
					$this->SetFillColor(50, 50, 50);
					$this->SetTextColor(255, 255, 255);
				if($pdfReportName != 'productReportBonPrint' && $pdfReportName != 'customerCodeReport' && $pdfReportName != 'sellerReportPayment' 
								&& $pdfReportName != 'lieferscheineReport' && $pdfReportName != 'auditingReport')	$this->SetY(40);
				
						#  Report liste Kopfzeile
					if($pdfReportName == 'customerReport'){
						$this->SetY($headerEndY+($lineHight*4));
						$this->SetFont($pdfFontA4, '', $pdfFontSizeA4);
						
						$printWidth=210-$this->marginLR;
						$colA_width=$printWidth*.48; $colB_width=$printWidth*.09; $colC_width=$printWidth*.19; $colD_width=$printWidth*.19;
						
						$this->Cell($colA_width, $lineHight, $pdfContentHead[7][0]." ".$pdfContentHead[7][1],0,0,'L', true);
						$this->Cell($colB_width, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][2]),0,0,'R', true);
						$this->Cell($colC_width, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][3]),0,0,'R', true);
						$this->Cell($colD_width, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][4]),0,1,'R', true);
					}
					else if($pdfReportName == 'categorieReport' || $pdfReportName == 'sellerReport' || $pdfReportName == 'productReport'){
						$this->SetY($headerEndY+($lineHight*4));
						$this->SetFont($pdfFontA4, '', $pdfFontSizeA4);
						
						$printWidth=210-$this->marginLR;
						$colA_width=$printWidth*.432; $colB_width=$printWidth*.14; $colC_width=$printWidth*.19; $colD_width=$printWidth*.19;
						
						$this->Cell($colA_width, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[7][0]), 0, 0, 'L',true);
						$this->Cell($colB_width, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[7][1]), 0, 0, 'R', true);
						$this->Cell($colC_width, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[7][2]), 0, 0, 'R', true);
						$this->Cell($colD_width, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[7][3]), 0, 1, 'R', true);
					}
					else if($pdfReportName == 'totalReport' && strtolower(REPORT_GESAMTREV_BONDRUCKER) != 'ja'){
						$this->SetY($headerEndY+($lineHight*4));
						$this->SetFont($pdfFontA4, '', $pdfFontSizeA4);
						
						$printWidth=210-$this->marginLR;
						$colA_width=$printWidth*.053; $colB_width=$printWidth*.053; $colC_width=$printWidth*.129; $colD_width=$printWidth*.2; $colE_width=$printWidth*.08;
						$colF_width=$printWidth*.11; $colG_width=$printWidth*.085; $colH_width=$printWidth*.11; $colI_width=$printWidth*.13;
						
						$this->Cell($colA_width+12, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][0]), 0, 0, 'R',true);
						$this->Cell($colB_width+8, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][1]),0,0,'R', true);
						$this->Cell($colC_width-20, $lineHight, '', 0, 0, 'L', true);
						$this->Cell($colD_width, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][3]),0,0,'L', true);
						$this->Cell($colE_width, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][4]),0,0,'R',true);
						$this->Cell($colF_width, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][5]),0,0,'R', true);
						$this->Cell($colG_width, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][6]),0,0,'R', true);
						$this->Cell($colH_width, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][7]),0,0,'R', true);
						$this->Cell($colI_width, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][8]),0,1,'R', true);
					
					}
					else if($pdfReportName == 'totalReport' && strtolower(REPORT_GESAMTREV_BONDRUCKER) == 'ja'){							
							$this->SetTextColor(0, 0, 0);
							$this->SetFont($pdfFont, 'B', $pdfFontSize*1.2);
							$this->Cell($bonWidth, $lineHight*1.2, iconv('UTF-8', 'windows-1252', $pdfContentHead[1][3]), 0, 1, 'C');
							$this->SetFont($pdfFont, '', $pdfFontSize);
							$this->Cell($bonWidth, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[2][3]), 0, 1, 'L');
							$this->Cell($bonWidth, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[3][3]), 0, 1, 'L');
							$this->Cell($bonWidth, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[4][3]), 0, 1, 'L');
							$this->SetFillColor(235, 235, 235);
							#$this->SetTextColor(250, 250, 250);
							$this->SetFont($pdfFont, 'B', $pdfFontSize);
							$this->Cell($totalCol_A, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][0]), 0, 0, 'L', true);
							$this->Cell($totalCol_B, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][1]), 0, 0, 'R', true);
							$this->Cell($totalCol_B_2, $lineHight, "", 0, 0, 'R', true);
							$this->Cell($totalCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][2]), 0, 1, 'R', true);
							$this->Cell($totalCol_D, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][3]), 0, 1, 'L', true);
							$this->Cell($totalCol_E, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[8][4]), "B", 0, 'R', true);
							$this->Cell($totalCol_F, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[8][5]), "B", 0, 'R', true);
							$this->Cell($totalCol_G, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[8][6]), "B", 0, 'R', true);
							$this->Cell($totalCol_H, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[8][7]), "B", 0, 'R', true);
							$this->Cell($totalCol_I, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[8][8]), "B", 1, 'R', true);
							$this->SetFillColor(255, 255, 255);
							$this->SetTextColor(0, 0, 0);
							
					
					}
					else if($pdfReportName == 'auditingReport'){
							$this->SetTextColor(0, 0, 0);
							$this->SetFont($pdfFont, 'B', $pdfFontSize*1.2);
							#$this->Cell($bonWidth, $lineHight*1.2, iconv('UTF-8', 'windows-1252', $pdfContentHead[1][0]), 0, 1, 'C');
							$this->SetFont($pdfFont, '', $pdfFontSize);
							#$this->Cell($bonWidth, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[2][2]), 0, 1, 'L');
							#$this->Cell($bonWidth, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[3][2]), 0, 1, 'L');
							#$this->Cell($bonWidth, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[4][2]), 0, 1, 'L');
							#$this->SetFillColor(235, 235, 235);
							#$this->Cell($totalCol_A, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][0]), 0, 0, 'L', true);
					
					
					}
					else if ($pdfReportName == 'kassabuchReport'){
						$this->SetY($headerEndY+($lineHight*4));
						$printWidth=297-$this->marginLR;
						
						if(count($pdfContentHead[8]) > 11){												
							$cashB_rowA=$printWidth*.045; $cashB_rowB=$printWidth*.08; $cashB_rowC=$printWidth*.045; $cashB_rowD=$printWidth*.175; 
								$cashB_rowE=$printWidth*.083; $cashB_rowF=$printWidth*.083; $cashB_rowZA=$printWidth*.075; 
						}
						else{
							$cashB_rowA=$printWidth*.05; $cashB_rowB=$printWidth*.09; $cashB_rowC=$printWidth*.05; $cashB_rowD=$printWidth*.184; 
								$cashB_rowE=$printWidth*.083; $cashB_rowF=$printWidth*.083; $cashB_rowZA=$printWidth*.085; 
						}
						$this->Cell($cashB_rowA, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][0]),0,0,'R',true);
						$this->Cell($cashB_rowB, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][1]),0,0,'C', true);
						$this->Cell($cashB_rowC, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][2]),0,0,'R', true);
						$this->Cell($cashB_rowD, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][3]),0,0,'L', true);
						$this->Cell($cashB_rowE, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][4]),0,0,'R', true);
						$this->Cell($cashB_rowF, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][5]),0,0,'R', true);
						for ($j=6; $j<count($pdfContentHead[8]); $j++) {
							$this->Cell($cashB_rowZA, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][$j]),0,0,'R', true);
						}
						$this->Cell(.1, $lineHight, "", 0, 1, 'R'); //nächste Zeile anfangen
					}
					else if ($pdfReportName == 'kassabuchReport2.0'){
		
						$this->SetY($headerEndY+($lineHight/3));
						$printWidth=210-$this->marginLR;
						
						$cashB_rowA=$printWidth*.11; $cashB_rowB=$printWidth*.11; $cashB_rowC=$printWidth*.1; $cashB_rowD=$printWidth*.1; 
								$cashB_rowE=$printWidth*.17; $cashB_rowF=$printWidth*.17; $cashB_rowG=$printWidth*.18; 

						$this->Cell($cashB_rowA, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][0]),0,0,'C',true);
						$this->Cell($cashB_rowB, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][1]),0,0,'R', true);
						$this->Cell($cashB_rowC, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][2]),0,0,'R', true);
						$this->Cell($cashB_rowD, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][3]),0,0,'R', true);
						$this->Cell($cashB_rowE, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][4]),0,0,'L', true);
						$this->Cell($cashB_rowF, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][5]),0,0,'L', true);
						$this->Cell($cashB_rowG, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentHead[8][6]),0,1,'L', true);
					}
					else if ($pdfReportName == 'customerCodeReport'){					# report product header, black background
							$this->SetFillColor(255, 255, 255);
							$this->SetTextColor(0, 0, 0);
							$this->SetFont($pdfFont, 'B', $pdfFontSize);
							$this->Cell($custCodeCol_A, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[6][0]), "B", 0,'L',true);
							$this->Cell($custCodeCol_B, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[6][1]), "B", 0, 'L', true);
							$this->Cell($custCodeCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[6][2]), "B", 0, 'R', true);
							$this->Cell($custCodeCol_D, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[6][3]), "B", 0, 'R', true);
							$this->Cell($custCodeCol_E, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[6][4]), "B", 1, 'R', true);
														
					}
					else if ($pdfReportName == 'sellerReportPayment'){	
							$this->SetFillColor(255, 255, 255);
							$this->SetTextColor(0, 0, 0);
							$this->SetFont($pdfFont, 'B', $pdfFontSize);
							$this->Cell($sellerRepCol_A, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][0]), "B", 0, 'L', true);
							$this->Cell($sellerRepCol_B, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][1]), "B", 0, 'L', true);
							$this->Cell($sellerRepCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][2]), "B", 1, 'L', true);
					
					}
					else if ($pdfReportName == 'gutscheinReport' ){
							$this->SetY($headerEndY+($lineHight*4));
							$this->SetFont($pdfFontA4, '', $pdfFontSizeA4);
						
							$printWidth=210-$this->marginLR;
							$gsRepCol_A=$printWidth*.065; $gsRepCol_B=$printWidth*.12; $gsRepCol_C=$printWidth*.065; $gsRepCol_D=$printWidth*.08; 
							$gsRepCol_E=$printWidth*.17; $gsRepCol_F=$printWidth*.30; $gsRepCol_G=$printWidth*.30; $gsRepCol_H=$printWidth*.11; 
						
							$this->SetFont($pdfFont, 'B', $pdfFontSize);
							$this->Cell($gsRepCol_A, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][0]), "B", 0, 'R', true);
							$this->Cell($gsRepCol_B, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][1]), "B", 0, 'R', true);
							$this->Cell($gsRepCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][2]), "B", 0, 'R', true);
							$this->Cell($gsRepCol_D, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][3]), "B", 0, 'R', true);
							$this->Cell($gsRepCol_E, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][4]), "B", 0, 'C', true);
							$this->Cell($gsRepCol_F, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][5]), "B", 0, 'L', true);
							$this->Cell($gsRepCol_G, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][6]), "B", 1, 'L', true);
					}
					else if($pdfReportName == 'gutscheinReportShort'){
							$this->SetY($headerEndY+($lineHight*4));
							$this->SetFont($pdfFontA4, '', $pdfFontSizeA4);
						
							$printWidth=210-$this->marginLR;
							$gsRepCol_A=$printWidth*.17; $gsRepCol_B=$printWidth*.1; $gsRepCol_C=$printWidth*.1; $gsRepCol_D=$printWidth*.15; 
							$gsRepCol_E=$printWidth*.22; $gsRepCol_F=$printWidth*.21;
							
							$this->SetFont($pdfFont, 'B', $pdfFontSize);
							$this->Cell($gsRepCol_A, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][0]), "B", 0, 'R', true);
							$this->Cell($gsRepCol_B, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][1]), "B", 0, 'R', true);
							$this->Cell($gsRepCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][2]), "B", 0, 'R', true);
							$this->Cell($gsRepCol_D, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][3]), "B", 0, 'C', true);
							$this->Cell($gsRepCol_E, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][4]), "B", 0, 'L', true);
							$this->Cell($gsRepCol_F, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][5]), "B", 1, 'L', true);
					
					}
					else if ($pdfReportName == 'lieferscheineReport'){	
							$this->SetFillColor(255, 255, 255);
							$this->SetTextColor(0, 0, 0);
							$this->SetFont($pdfFont, 'B', $pdfFontSize);
							$this->Cell($lsRepCol_A, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][0]), "B", 0, 'L', true);
							$this->Cell($lsRepCol_B, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][1]), "B", 0, 'L', true);
							$this->Cell($lsRepCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentHead[7][2]), "B", 1, 'L', true);
					
					}
					
					$this->SetFont($pdfFont, '', $pdfFontSize);
					$this->SetFillColor(255, 255, 255);
					$this->SetTextColor(10, 10, 10);
					
					for($i=0; $i < sizeof($pdfContentData); $i++ ){
						if($i % 2 == 0)$this->SetFillColor(240, 240, 2240);
						else $this->SetFillColor(255, 255, 255);
						if($pdfReportName == 'customerReport'){	
						//	$this->Cell(94,6,iconv('UTF-8', 'windows-1252', $pdfContentData[$i][0]),0,0,'L', true);			// iconv('UTF-8','iso-8859-15', $nachname_dkj); 
							$this->SetFont($pdfFontA4, '', $pdfFontSizeA4);
							$this->Cell($colA_width, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentData[$i][0]),0,0,'L', true);
							$this->Cell($colB_width, $lineHight,$pdfContentData[$i][1],0,0,'R', true);
							$this->Cell($colC_width, $lineHight,$pdfContentData[$i][2],0,0,'R', true);
							$this->Cell($colD_width, $lineHight,$pdfContentData[$i][3],0,1,'R', true);
						}
						else if($pdfReportName == 'categorieReport' || $pdfReportName == 'sellerReport'  || $pdfReportName == 'productReport' ){
							$this->SetFont($pdfFontA4, '', $pdfFontSizeA4);
							$this->Cell($colA_width, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentData[$i][0]),0,0,'L', true);
							$this->Cell($colB_width, $lineHight,$pdfContentData[$i][1],0,0,'R', true);
							$this->Cell($colC_width, $lineHight,$pdfContentData[$i][2],0,0,'R', true);
							$this->Cell($colD_width, $lineHight,$pdfContentData[$i][3],0,1,'R', true);
						}
						else if($pdfReportName == 'totalReport' && strtolower(REPORT_GESAMTREV_BONDRUCKER) != 'ja'){
								$this->SetFont($pdfFontA4, '', $pdfFontSizeA4*.9);
							$this->Cell($colA_width+12, $lineHight, $pdfContentData[$i][0],0,0,'R', true);
							$this->Cell($colB_width+8, $lineHight, $pdfContentData[$i][1],0,0,'R', true);
							$dDate = strtotime( $pdfContentData[$i][2] );
							$datetime = date( 'j.n.Y H:i', $dDate );
								# Report freie Artikel wird zweizeilig ausgeführt
							if(isset($pdfContentData[$i][9]) && count($pdfContentData[$i][9]) > 0){
								$this->Cell(($colC_width-20)+$colD_width, $lineHight, $datetime, 0, 0, 'L', true);
							}
							else{
								$this->SetFont($pdfFontA4, '', $pdfFontSizeA4*.8);
								$this->Cell($colC_width-20, $lineHight, $datetime, 0, 0, 'L', true);
								$this->Cell($colD_width, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][3]),0,0,'L', true);
							}
								$this->SetFont($pdfFontA4, '', $pdfFontSizeA4);
							$this->Cell($colE_width, $lineHight, $pdfContentData[$i][4],0,0,'R', true);
							$this->Cell($colF_width, $lineHight, $pdfContentData[$i][5],0,0,'R', true);
							$this->Cell($colG_width, $lineHight, $pdfContentData[$i][6],0,0,'R', true);
							$this->Cell($colH_width, $lineHight, $pdfContentData[$i][7],0,0,'R', true);
							$this->Cell($colI_width, $lineHight, $pdfContentData[$i][8],0,1,'R', true);
							if(isset($pdfContentData[$i][9]) && count($pdfContentData[$i][9]) > 0 && !isset($pdfContentData[$i][10])){
								$this->Cell($colA_width+$colB_width+$colC_width, $lineHight, "",0,0,'L', true);
								$this->Cell($colD_width+$colE_width+$colF_width, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][3]),0,0,'L', true);
								$this->Cell($colG_width+$colH_width+$colI_width, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][9]),0,1,'L', true);
							}
							else if(isset($pdfContentData[$i][9]) && count($pdfContentData[$i][9]) > 0 && isset($pdfContentData[$i][10])){
								$this->Cell($colA_width+$colB_width+$colC_width, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][9]),0,0,'L', true);
								$this->Cell($colD_width+$colE_width+$colF_width, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][3]),0,0,'L', true);
								$this->Cell($colG_width+$colH_width+$colI_width, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][10]),0,1,'R', true);
							}
							else if((!isset($pdfContentData[$i][9]) || count($pdfContentData[$i][9]) <= 0) && isset($pdfContentData[$i][10])){
								$this->Cell($colA_width+$colB_width+$colC_width, $lineHight, "", 0, 0, 'L', true);
								$this->Cell($colD_width+$colE_width+$colF_width, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][3]),0,0,'L', true);
								$this->Cell($colG_width+$colH_width+$colI_width, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][10]),0,1,'L', true);
							}
						}
						else if($pdfReportName == 'totalReport' && strtolower(REPORT_GESAMTREV_BONDRUCKER) == 'ja'){
								# hier wird auch der Report freie Artikle erstellt, der hat ein 9. Arrayelement, Tischname
							$this->Cell($totalCol_A, $lineHight, $pdfContentData[$i][0],0,0,'L');
							$this->Cell($totalCol_B, $lineHight, $pdfContentData[$i][1],0,0,'R');
							$this->Cell($totalCol_B_2, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][9]),0,0,'L');
							$dDate = strtotime( $pdfContentData[$i][2] );
							$datetime = date( 'j.n.Y H:i', $dDate );
							$this->Cell($totalCol_C, $lineHight, $datetime,0,1,'R');
							
							if(isset($pdfContentData[$i][9]) && count($pdfContentData[$i][9]) > 0 && !isset($pdfContentData[$i][10])){
								$this->Cell($totalCol_D*.7, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][3]),0,1,'L');
								#$this->Cell($totalCol_D*.3, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][9]),0,1,'R');
							}
							else if(isset($pdfContentData[$i][9]) && count($pdfContentData[$i][9]) > 0 && isset($pdfContentData[$i][10])){
								$this->Cell($totalCol_D*.6, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][3]),0,0,'L');
								#$this->Cell($totalCol_D*.2, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][9]),0,0,'R');
								$this->Cell($totalCol_D*.4, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][10]),0,1,'R');
							}
							else $this->Cell($totalCol_D, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][3]),0,1,'L');

							$this->Cell($totalCol_E, $lineHight, $pdfContentData[$i][4],0,0,'R');
							$this->Cell($totalCol_F, $lineHight, $pdfContentData[$i][5],0,0,'R');
							$this->Cell($totalCol_G, $lineHight, $pdfContentData[$i][6],0,0,'R');
							$this->Cell($totalCol_H, $lineHight, $pdfContentData[$i][7],0,0,'R');
							$this->Cell($totalCol_I, $lineHight, $pdfContentData[$i][8],0,1,'R');
							$this->Cell($bonWidth, $lineHight/2, '',"T",1,'C');
						}
						else if ($pdfReportName == 'kassabuchReport'){
							$this->SetFont($pdfFontA4, '', $pdfFontSizeA4);
							$this->SetFillColor(255);
							$this->SetTextColor(0);
							
							$this->Cell($cashB_rowA, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][0]),0,0,'R', true );
							$this->Cell($cashB_rowB, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][1]),0,0,'C', true  );
							$this->Cell($cashB_rowC, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][2]),0,0,'R', true  );
							$this->Cell($cashB_rowD, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][3]),0,0,'L', true  );
							$this->Cell($cashB_rowE, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][4]),0,0,'R', true  );
							$this->Cell($cashB_rowF, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][5]),0,0,'R', true  );
							for ($j=6; $j<count($pdfContentData[$i]); $j++){
								$this->Cell($cashB_rowZA, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][$j]),0,0,'R', true);
							}
							$this->Cell(.1, $lineHight, "", 0, 1, 'C'); //nächste Zeile anfangen
							// Keine Striche mehr im Kassabuch anzeigen - weil sonst schaut das blöd ausgeführt
							// seit ich auf Querformat umgestellt habe
							//$this->Cell(0, 1, "", "T", 1, 'C');
						}
						else if ($pdfReportName == 'kassabuchReport2.0'){
							$this->SetFont($pdfFontA4, '', $pdfFontSizeA4*.6);
							$this->SetFillColor(255);
							$this->SetTextColor(0);
		
							$dDate = strtotime($pdfContentData[$i]['datum']);
							$datetime = date( 'j.n.Y', $dDate );
							
							$this->Cell($cashB_rowA, $lineHight, $datetime,0,0,'C', true );
							$this->Cell($cashB_rowB, $lineHight, number_format($pdfContentData[$i]['betrag'],2,",","."), 0,0,'R', true  );
							$this->Cell($cashB_rowC, $lineHight, number_format($pdfContentData[$i]['ust'],2,",","."), 0,0,'R', true  );
							$this->Cell($cashB_rowD, $lineHight, number_format($pdfContentData[$i]['vorst'],2,",","."), 0,0,'R', true  );
							$this->Cell($cashB_rowE, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i]['zahlart']),0,0,'L', false  );
							$this->Cell($cashB_rowF, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i]['titel']),0,0,'L', false  );
							if($this->GetStringWidth( iconv('UTF-8', 'windows-1252', $pdfContentData[$i]['bemerkung']) . 'm' ) > $cashB_rowG){
								$this->MultiCell($cashB_rowG, $lineHight*.7, iconv('UTF-8', 'windows-1252', $pdfContentData[$i]['bemerkung']), 0, 'L', false);
							}
							else $this->Cell($cashB_rowG, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i]['bemerkung']),0,1,'L', false);
							#$this->Cell(.1, $lineHight, "", 0, 1, 'C'); //nächste Zeile anfangen
							$this->Cell(0, 1, "", "T", 1, 'C');
					
						}
						else if ($pdfReportName == 'customerCodeReport'){
							$this->SetFont($pdfFont, '', $pdfFontSize);
							$this->Cell($custCodeCol_A, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][0]), 0, 0, 'L', true);
							$this->Cell($custCodeCol_B, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentData[$i][1]),0,0,'L', true);
							$this->Cell($custCodeCol_C, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentData[$i][2]),0,0,'R', true);
							$this->Cell($custCodeCol_D, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentData[$i][3]),0,0,'R', true);
							$this->Cell($custCodeCol_E, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentData[$i][4]),0,1,'R', true);

						
						}
						else if ($pdfReportName == 'gutscheinReport' ){
							$this->SetFont($pdfFont, '', $pdfFontSize);
							$this->Cell($gsRepCol_A, $lineHight, $pdfContentData[$i][0], 0, 0, 'R', true);
							$this->Cell($gsRepCol_B, $lineHight, $pdfContentData[$i][1], 0, 0, 'R', true);
							$this->Cell($gsRepCol_C, $lineHight, $pdfContentData[$i][2], 0, 0, 'R', true);
							$this->Cell($gsRepCol_D, $lineHight, $pdfContentData[$i][3], 0, 0, 'R', true);
							$this->Cell($gsRepCol_E, $lineHight, $pdfContentData[$i][4], 0, 0, 'C', true);
							$this->Cell($gsRepCol_F, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][5]), 0, 0, 'L', true);
							$this->Cell($gsRepCol_F, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][6]), 0, 1, 'L', true);
						
						}
						else if($pdfReportName == 'gutscheinReportShort'){
							$this->SetFont($pdfFont, '', $pdfFontSize);
							$dDate = strtotime( $pdfContentData[$i][3] );
							$initDate = date( 'j.n.Y', $dDate );
							$cust=$pdfContentData[$i][4];
							if($cust == '&nbsp;') $cust='';
							
							$this->Cell($gsRepCol_A, $lineHight, $pdfContentData[$i][0], 0, 0, 'R', true);
							$this->Cell($gsRepCol_B, $lineHight, number_format($pdfContentData[$i][1], 2, ",", "."), 0, 0, 'R', true);
							$this->Cell($gsRepCol_C, $lineHight, number_format($pdfContentData[$i][2], 2, ",", "."), 0, 0, 'R', true);
							$this->Cell($gsRepCol_D, $lineHight, $initDate, 0, 0, 'C', true);
							$this->Cell($gsRepCol_E, $lineHight, iconv('UTF-8', 'windows-1252', $cust), 0, 0, 'L', true);
							$this->Cell($gsRepCol_F, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][5]), 0, 1, 'L', true);
						}

						else if ($pdfReportName == 'productReportBonPrint' ){
							$this->SetFont($pdfFont, '', $pdfFontSize);
							$n = $this->GetStringWidth( iconv('UTF-8', 'windows-1252', $pdfContentData[$i][0]) . 'm' );

								$this->Cell($bonWidth*.428, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][0]), 0, 0, 'L', true);
								$this->Cell($bonWidth*.175, $lineHight,$pdfContentData[$i][1], 0,0,'R', true);
								$this->Cell($bonWidth*.175, $lineHight,$pdfContentData[$i][2], 0, 0,'R', true);
								$this->Cell($bonWidth*.175, $lineHight,$pdfContentData[$i][3], 0, 1,'R', true);
						}
						else if ( $pdfReportName == 'sellerReportPayment' ){
								$this->SetFont($pdfFont, '', $pdfFontSize);
								
								$this->Cell($sellerRepCol_A, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][0]), 0, 0, 'L', true);
								$this->Cell($sellerRepCol_B, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][1]), 0, 0, 'L', true);
								$this->Cell($sellerRepCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][2]), 0, 1, 'R', true);
						}
						else if ( $pdfReportName == 'lieferscheineReport'){
								$this->SetFont($pdfFont, 'B', $pdfFontSize);
								$this->Cell($lsRepCol_A, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][0]), 0, 0, 'L', false);
								$this->Cell($lsRepCol_B, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][1]), 0, 0, 'C', false);
									$this->SetFont($pdfFont, '', $pdfFontSize);								
								$this->Cell($lsRepCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][2]), 0, 1, 'L', false);
								$this->Cell($bonWidth, 1, '', 'T', 1, 'C');
								## prod loop
								$zuz=count($pdfContentData[$i][3]);
								for($z=0; $z < $zuz; $z++){

									$this->Cell($bonWidth*.13, $lineHight, $pdfContentData[$i][3][$z][0], 0, 0, 'R');
									$this->Cell($bonWidth*.67, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][3][$z][1]), 0, 0, 'L');
									$this->Cell($bonWidth*.2, $lineHight, $pdfContentData[$i][3][$z][2], 0, 1, 'R');
									

								}
								$this->SetFont($pdfFont, 'B', $pdfFontSize);
								$this->Cell($bonWidth*.5, $lineHight, "Lieferschein Summe", "T", 0, 'L');
								$this->Cell($bonWidth*.5, $lineHight, $pdfContentData[$i][4], "T", 1, 'R');
								$this->Cell($bonWidth, $lineHight/2, "", 0, 1, 'C');
								
						}
						else if ( $pdfReportName == 'auditingReport'){
								$this->SetFont($pdfFont, '', $pdfFontSize);
								$this->Cell($bonWidth*.5, $lineHight, $pdfContentData[$i][0], 0, 0, 'L', false);
								$this->Cell($bonWidth*.5, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][1]), 0, 1, 'L', false);
								$this->MultiCell($bonWidth, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][2]), 0, 'L');
								$this->Cell($bonWidth, $lineHight*.3, "", "T", 1, 'C', false);
								
								
								
								#$this->Cell($sellerRepCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentData[$i][2]), 0, 1, 'R', true);
						}
						else {
							for($j=0; $j < sizeof($pdfContentData[$i]); $j++){
									$this->Cell(70, $lineHight,$pdfContentData[$i][$j]."**",0,0,'L');	
							}
							$this->Cell(1,5,'',0,1,'L');
						}
					}
					
					##    Report gesamt summe 
					
					if($pdfReportName == 'categorieReport' || $pdfReportName == 'sellerReport'){
							$this->SetFillColor(50, 50, 50);
							$this->SetTextColor(250, 250, 255);
							$this->Cell($colA_width, $lineHight, "Gesamt", 0, 0, 'L', true);
							$this->Cell($colB_width, $lineHight, $pdfContentSummery[0],0,0,'R', true);
							$this->Cell($colC_width, $lineHight, $pdfContentSummery[1],0,0,'R', true);
							$this->Cell($colD_width, $lineHight, $pdfContentSummery[2],0,1,'R', true);
					}
					else if( $pdfReportName == 'customerReport'){
							$this->SetFillColor(50, 50, 50);
							$this->SetTextColor(250, 250, 255);
							$this->Cell($colA_width, $lineHight, "Gesamt", 0, 0, 'L', true);
							$this->Cell($colB_width, $lineHight, $pdfContentSummery[0],0,0,'R', true);
							$this->Cell($colC_width, $lineHight, $pdfContentSummery[1],0,0,'R', true);
							$this->Cell($colD_width, $lineHight, $pdfContentSummery[2],0,1,'R', true);
					
					}
					
					else if($pdfReportName == 'totalReport'  && strtolower(REPORT_GESAMTREV_BONDRUCKER) != 'ja'){
							$this->SetFillColor(50, 50, 50);
							$this->SetTextColor(250, 250, 255);
							
					#	$colD_width=$printWidth*.2; $colE_width=$printWidth*.08;
					#	$colF_width=$printWidth*.11; $colG_width=$printWidth*.085; $colH_width=$printWidth*.11; $colI_width=$printWidth*.13;
							$colAx=$colA_width+$colB_width+$colC_width+$colD_width;
							$colBx=$colE_width;
							$colCx=$colF_width+$colG_width;
							$colDx=$colH_width+$colI_width;
							$this->Cell($colAx, $lineHight, "Gesamt" ,0, 0, 'L', true);
							$this->Cell($colBx, $lineHight, $pdfContentSummery[0] ,0, 0, 'R', true);
							$this->Cell($colCx, $lineHight, "",0,0,'R', true);
							$this->Cell($colDx, $lineHight, $pdfContentSummery[2], 0, 1, 'R', true);
					}
					
	
					else if ($pdfReportName == 'productReportBonPrint'){
							$this->SetFillColor(255, 255, 255);
							$this->SetTextColor(0, 0, 0);
							$this->Cell($bonWidth*.428 , $lineHight, iconv('UTF-8', 'windows-1252', 'Gesamt'), "T", 0, 'L', true);
							$this->Cell($bonWidth*.175, $lineHight, $pdfContentSummery[0], "T",0,'R', true);
							$this->Cell($bonWidth*.175, $lineHight,$pdfContentSummery[1], "T", 0,'R', true);
							$this->Cell($bonWidth*.175, $lineHight,$pdfContentSummery[2], "T", 1,'R', true);
									#	$this->Cell($bonWidth , $lineHight, "#########".$pdfContentSummery[0],0,0,'R', true);
	
							$this->Cell($bonWidth, 20, "", 0 ,1 ,'C');  # platzschaffen, damit der Bon nicht zu knapp schneidet !!!!!
							if($marginBottom > 0){
									$this->SetTextColor(255, 255, 255);
									$this->Cell($bonWidth, $marginBottom, "-", 0, 0 , 'C');
									$this->SetTextColor(0, 0, 0);
							}
					}
					
					else if ($pdfReportName == 'lieferscheineReport'){
							$this->SetFillColor(255, 255, 255);
							$this->SetTextColor(0, 0, 0);
							$this->Cell($bonWidth*.65 , $lineHight, iconv('UTF-8', 'windows-1252', 'Lieferscheine Gesamt Summe'), "T", 0, 'L', true);
							$this->Cell($bonWidth*.35, $lineHight, $pdfContentSummery[0], "T", 1, 'R', true);
					}
					
					else if ($pdfReportName == 'customerCodeReport'){
							$this->SetFillColor(255, 255, 255);
							$this->SetTextColor(0, 0, 0);
							$this->Cell($custCodeCol_A+$custCodeCol_B, $lineHight, iconv('UTF-8', 'windows-1252', 'Gesamt'), "T", 0, 'L', true);
							$this->Cell($custCodeCol_C, $lineHight, $pdfContentSummery[0], "T", 0, 'R', true);
							$this->Cell($custCodeCol_D+$custCodeCol_E, $lineHight, $pdfContentSummery[2], "T", 0, 'R', true);
					}
					
					else if ($pdfReportName == 'gutscheinReport'){
							$this->SetFillColor(50, 50, 50);
							$this->SetTextColor(250, 250, 250);
							$this->Cell(0, .5, "", 0, 1, false);
							$this->Cell($gsRepCol_A+$gsRepCol_B+$gsRepCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentSummery[0]), "T", 0, 'L', true);
							$this->Cell($gsRepCol_D, $lineHight, $pdfContentSummery[1], "T", 0, 'R', true);
							$this->Cell($gsRepCol_E+$gsRepCol_F, $lineHight, "", "T", 1, 'C', true);
							$this->Cell(0, .5, "", 0, 1, false);
							$this->Cell($gsRepCol_A+$gsRepCol_B+$gsRepCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentSummery[4]), "T", 0, 'L', true);
							$this->Cell($gsRepCol_D, $lineHight, $pdfContentSummery[5], "T", 0, 'R', true);
							$this->Cell($gsRepCol_E+$gsRepCol_F, $lineHight, "", "T", 1, 'C', true);
							$this->Cell(0, .5, "", 0, 1, false);
							$this->Cell($gsRepCol_A+$gsRepCol_B+$gsRepCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentSummery[6]), "T", 0, 'L', true);
							$this->Cell($gsRepCol_D, $lineHight, $pdfContentSummery[7], "T", 0, 'R', true);
							$this->Cell($gsRepCol_E+$gsRepCol_F, $lineHight, "", "T", 1, 'C', true);													
							$this->Cell(0, .5, "", 0, 1, false);
							$this->Cell($gsRepCol_A+$gsRepCol_B+$gsRepCol_C, $lineHight, iconv('UTF-8', 'windows-1252', $pdfContentSummery[2]), "T", 0, 'L', true);
							$this->Cell($gsRepCol_D, $lineHight, $pdfContentSummery[3], "T", 0, 'R', true);
							$this->Cell($gsRepCol_E+$gsRepCol_F, $lineHight, "", "T", 1, 'C', true);
							
							
					}
					else if ($pdfReportName == 'gutscheinReportShort'){
							$this->SetFillColor(50, 50, 50);
							$this->SetTextColor(250, 250, 250);
							$this->Cell(0, .5, "", 0, 1, false);
							$this->Cell($gsRepCol_A, $lineHight, "", "T", 0, 'L', true);					
							$this->Cell($gsRepCol_B, $lineHight, number_format($pdfContentSummery[0], 2, ",", "."), "T", 0, 'R', true);
							$this->Cell($gsRepCol_C, $lineHight, number_format($pdfContentSummery[1], 2, ",", "."), "T", 0, 'R', true);
							$this->Cell($gsRepCol_D, $lineHight, "", "T", 0, 'C', true);
							$this->Cell($gsRepCol_E+$gsRepCol_F, $lineHight, "Gesamt offen: ".number_format($pdfContentSummery[2], 2, ",", "."), "T", 1, 'L', true);
					
					
					}
					
					if ($pdfReportName == 'kassabuchReport'){
							$this->SetFillColor(50, 50, 50);
							$this->SetTextColor(250, 250, 255);
							$this->Cell($cashB_rowA+$cashB_rowB, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentFooter[0].$pdfContentFooter[1]),0,0,'L',true);
							$this->Cell($cashB_rowC, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentFooter[2]), 0, 0, 'R', true);
							$this->Cell($cashB_rowD, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentFooter[3]), 0, 0, 'L', true);
							$this->Cell($cashB_rowE, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentFooter[4]), 0, 0, 'R', true);
							$this->Cell($cashB_rowF, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentFooter[5]), 0, 0, 'R', true);
							for ($j=6;$j<count($pdfContentFooter);$j++)
							{
								$this->Cell($cashB_rowZA, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentFooter[$j]), 0, 0, 'R', true);
							}
							$this->Cell(1, $lineHight,"", 0, 1, 'R', true); //nächste Zeile anfangen
					}
					if ($pdfReportName == 'kassabuchReport2.0'){
							$this->SetFillColor(50, 50, 50);
							$this->SetTextColor(250, 250, 255);
							for ($j=6;$j<count($pdfContentFooter);$j++)
							{
								$this->Cell($cashB_rowZA, $lineHight,iconv('UTF-8', 'windows-1252', $pdfContentFooter[$j]), 0, 0, 'R', true);
							}
							$this->Cell(1, $lineHight,"", 0, 1, 'R', true); //nächste Zeile anfangen
					}

					#	$this->SetFont('Arial','',11);
						
			}
		
	
				// Überlagerung der Footer() Methode

				function Footer(){ 					
						global $lineHight;
						
						$this->SetY(-15); 														// Über dem unteren Seitenrand positionieren 
						$this->SetFont('Arial','B',10); 										// Schriftart festlegen						
						$this->SetTextColor(0,0,0);
						if ($this->pdfReportName == 'kassabuchReport2.0'){ $reportFootTxt="sITpos Kassabuch"; }
						else { $reportFootTxt="sITpos Report"; }
						if($this->pdfReportName	!=	'productReportBonPrint'){
							$this->Cell(105-$this->marginLR, $lineHight , $reportFootTxt,0,0,'L'); 
							$this->Cell(105-$this->marginLR, $lineHight , 'Seite '.$this->PageNo().'/{nb}',0,1,'R'); 
						}
						
				} 

		} 
			
			//if ($pdfReportName == 'kassabuchReport'){
			//	$pdf=new sITposPDF('L','mm','A4');		
			//	$pdf->SetMargins($marginLR, $marginTop);
			//}
			if ($pdfReportName == 'kassabuchReport2.0'){
				$pdf=new sITposPDF('P','mm','A4');		
				$pdf->SetMargins($marginLR, $marginTop);
			}
			else if ($pdfReportName == 'productReportBonPrint' || $pdfReportName == 'customerCodeReport' 
						|| $pdfReportName == 'lieferscheineReport' || $pdfReportName == 'auditingReport'
						|| ($pdfReportName == 'totalReport'  && strtolower(REPORT_GESAMTREV_BONDRUCKER) == 'ja')){
	

				$pdf=new sITposPDF('P', 'mm', array(210, $printLength));	
				$pdf->SetMargins($marginLR, $marginTop);
			}
			else if ($pdfReportName=='kassabuchReport') {
				$pdf=new sITposPDF('L','mm','A4');		
				$pdf->SetMargins($marginLR, $marginTop);					#  left, top, right (optional)
			}
			else {
				$pdf=new sITposPDF('P','mm','A4');		

				$pdf->SetMargins($marginLR, $marginTop);					#  left, top, right (optional)
			}
			$pdf->SetAuthor("Author / sITpos");
			$pdf->SetDisplayMode( 'fullpage', 'continuous');
			$pdf->AliasNbPages();
					#$pdf->SetAutoPageBreak(true);   # wenn das gesetzt ist wird der seiteninhalt bis 
				# die als parma übergebenen arrays werden hier der class übergeben
			$pdf->pdfContentHead=$pdfContentHead; 
			$pdf->pdfContentData=$pdfContentData; 
			$pdf->pdfContentFooter=$pdfContentFooter; 
			$pdf->pdfContentSummery=$pdfContentSummery;
			$pdf->pdfReportName=$pdfReportName;
			$pdf->pdfContent=$pdfContent;
			$pdf->bonHeight=$bonHeight;
			$pdf->marginTop=$marginTop;
			$pdf->marginBottom=$marginBottom;
			$pdf->marginLR=$marginLR;
			
			$pdf->AddPage();
			$pdf->docData();
			
			
		$pdf->Output($saveTheFileTo, "F");
		return $saveTheFileTo;
	
	}
		

	










?>