diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index d28ffd70..c0ee7779 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -25799,6 +25799,7 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p $uebersetzung['dokument_artikelnummerkunde']['deutsch'] = "Ihre Artikelnummer"; $uebersetzung['dokument_menge']['deutsch'] = "Menge"; $uebersetzung['dokument_gesamt']['deutsch'] = "Gesamt"; + $uebersetzung['dokument_gesamt_optional']['deutsch'] = "Gesamt optional"; $uebersetzung['dokument_gesamt_total']['deutsch'] = "Gesamt"; $uebersetzung['dokument_mwst']['deutsch'] = "MwSt."; $uebersetzung['dokument_zzglmwst']['deutsch'] = "zzgl. MwSt."; @@ -25816,6 +25817,7 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p $uebersetzung['dokument_ursprungsregion']['deutsch'] = "Ursprungsregion"; $uebersetzung['dokument_gewicht']['deutsch'] = "Gewicht"; $uebersetzung['dokument_gesamtnetto']['deutsch'] = "Gesamt netto"; + $uebersetzung['dokument_gesamtnetto_optional']['deutsch'] = "Gesamt netto optional"; $uebersetzung['dokument_seite']['deutsch'] = "Seite"; $uebersetzung['dokument_seitevon']['deutsch'] = "von"; $uebersetzung['dokument_datum']['deutsch'] = "Datum"; diff --git a/www/lib/dokumente/class.angebot.php b/www/lib/dokumente/class.angebot.php index 9db95733..b0160d23 100644 --- a/www/lib/dokumente/class.angebot.php +++ b/www/lib/dokumente/class.angebot.php @@ -508,22 +508,19 @@ class AngebotPDF extends BriefpapierCustom { { $netto_gesamt = round($netto_gesamt, 2); } - if($value['optional']!="1"){ + if(!isset($summen[$value['steuersatz']])) { + $summen[$value['steuersatz']] = 0; + } + if($value['optional']!="1"){ if($value['explodiert_parent'] == 0 || !$berechnen_aus_teile) { - $summe = $summe + $netto_gesamt; - if(!isset($summen[$value['steuersatz']]))$summen[$value['steuersatz']] = 0; $summen[$value['steuersatz']] += ($netto_gesamt/100)*$value['steuersatz']; + $summe = $summe + $netto_gesamt; $gesamtsteuern +=($netto_gesamt/100)*$value['steuersatz']; - } - /* - if($value['umsatzsteuer']=="" || $value['umsatzsteuer']=="normal") - { - $summeV = $summeV + (($netto_gesamt/100)*$this->app->erp->GetSteuersatzNormal(false,$id,"angebot")); - } - else { - $summeR = $summeR + (($netto_gesamt/100)*$this->app->erp->GetSteuersatzErmaessigt(false,$id,"angebot")); - }*/ + } + } else { + $summe_netto_optional += $netto_gesamt; + $steuern_optional +=($netto_gesamt/100)*$value['steuersatz']; } } @@ -545,7 +542,7 @@ class AngebotPDF extends BriefpapierCustom { if($this->app->erp->AngebotMitUmsatzeuer($id)) { - $this->setTotals(array("totalArticles"=>$summe,"total"=>$summe + $gesamtsteuern,"summen"=>$summen,"totalTaxV"=>0,"totalTaxR"=>0)); + $this->setTotals(array("totalArticles"=>$summe,"total"=>$summe + $gesamtsteuern,"summen"=>$summen,"totalTaxV"=>0,"totalTaxR"=>0,"optional"=>$summe_netto_optional+$steuern_optional,"optional_netto"=>$summe_netto_optional)); //$this->setTotals(array("totalArticles"=>$summe,"totalTaxV"=>$summeV,"totalTaxR"=>$summeR,"total"=>$summe+$summeV+$summeR)); } else { $this->setTotals(array("totalArticles"=>$summe,"total"=>$summe)); diff --git a/www/lib/dokumente/class.briefpapier.php b/www/lib/dokumente/class.briefpapier.php index 22f6f99a..519337e2 100644 --- a/www/lib/dokumente/class.briefpapier.php +++ b/www/lib/dokumente/class.briefpapier.php @@ -1775,7 +1775,12 @@ class Briefpapier extends SuperFPDF { $total=$totalFullTax=$totalReducedTax=0; $citems = !empty($this->items)?count($this->items):0; for($i=0;$i<$citems;$i++) { - $total += $this->items[$i]['tprice']; + if (!$this->items[$i]['optional']) { + $total += $this->items[$i]['tprice']; + } else { + $totalOptional += $this->items[$i]['tprice']; + } + if($this->items[$i]['tax']=="USTV") { $totalFullTax+= $this->items[$i]['tprice']*USTV; } @@ -1783,7 +1788,7 @@ class Briefpapier extends SuperFPDF { $totalReducedTax+= $this->items[$i]['tprice']*USTR; } } - return array($total,$totalFullTax,$totalReducedTax); + return array($total,$totalFullTax,$totalReducedTax,$totalOptional); } function GetFont() @@ -2498,7 +2503,6 @@ class Briefpapier extends SuperFPDF { } public function renderItems() { - $this->app->erp->RunHook('briefpapier_renderitems',1, $this); // if($this->bestellungohnepreis) $this->doctype="lieferschein"; $posWidth = $this->getStyleElement("breite_position"); @@ -2942,7 +2946,6 @@ class Briefpapier extends SuperFPDF { if($this->doctype!=='zahlungsavis') { if($item['tax']!=='hidden'){ - if($anzeigeBelegNettoAdrese){ //if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1") //&& $this->getStyleElement("immerbruttorechnungen",$projekt)!="1") @@ -3068,16 +3071,18 @@ class Briefpapier extends SuperFPDF { // && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1") { if(!$inventurohnepreis){ - $this->Cell_typed($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'); + $price_displayed = $item['ohnepreis']?'':$this->formatMoney((double)$item['tprice']); } } else{ if(!$inventurohnepreis){ - $this->Cell_typed($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'); + $price_displayed = $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']); } } - $this->Cell_typed($rabattWidth,$cellhoehe,"",0,0,'R'); + // $this->Cell_typed($rabattWidth,$cellhoehe,"",0,0,'R'); } } } @@ -3093,7 +3098,7 @@ class Briefpapier extends SuperFPDF { $this->Cell_typed($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price'] * $item['tmptax']), 0, 0, 'R'); } } - } + } //$this->Cell_typed($sumWidth,$cellhoehe,$this->formatMoney($item['tprice']).' '.$item['currency'],0,0,'R'); if($this->rabatt=='1') { @@ -3107,12 +3112,14 @@ 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_typed($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'); + $price_displayed = $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice']); } } else{ if(!$inventurohnepreis){ - $this->Cell_typed($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'); + $price_displayed = $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']); } } } @@ -3121,18 +3128,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_typed($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'); + $price_displayed = $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice']); } } else{ if(!$inventurohnepreis){ - $this->Cell_typed($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'); + $price_displayed = $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']); } } } } } + // OpenXE add price here + if (!empty($price_displayed)) { + if ($item['optional']) { + $this->Cell_typed($sumWidth, $cellhoehe, "(".$price_displayed.")", 0, 0, 'R'); + } else { + $this->Cell_typed($sumWidth, $cellhoehe, $price_displayed, 0, 0, 'R'); + } + } + } else if(($this->doctype==='lieferschein' || $this->doctype==='preisanfrage') && $this->getStyleElement('artikeleinheit')=='1') { @@ -4279,7 +4297,7 @@ class Briefpapier extends SuperFPDF { $this->Cell_typed(40,3,'',0,0,'R'); } $this->Ln(); - } + } $this->SetY($this->GetY()+2); //$this->Line(110, $this->GetY(), 190,$this->GetY()); } @@ -4320,6 +4338,16 @@ class Briefpapier extends SuperFPDF { $this->Line($differenz_wegen_abstand+5, $this->GetY(), 210-$this->getStyleElement('abstand_seitenrandrechts'),$this->GetY()); $this->Line($differenz_wegen_abstand+5, $this->GetY()+1, 210-$this->getStyleElement('abstand_seitenrandrechts'),$this->GetY()+1); } + + if(isset($this->totals['optional'])) { + $this->SetFont($this->GetFont(),'',$this->getStyleElement('schriftgroesse_gesamt')); + $this->Ln(2); + $this->Cell_typed($differenz_wegen_abstand,1,'',0); + $this->Cell_typed(30,5,"(".$this->app->erp->Beschriftung('dokument_gesamt_optional'),0,0,'L'); + $this->Cell_typed(40,5,$this->formatMoney(round($this->totals['optional'],2), 2).' '.$this->waehrung.")",0,0,'R'); + $this->Ln(); + } + $this->SetY($this->GetY()+10); }