diff --git a/database/struktur.sql b/database/struktur.sql index 5836a35d..ddf8f438 100755 --- a/database/struktur.sql +++ b/database/struktur.sql @@ -16769,6 +16769,26 @@ INSERT INTO `hook_register` (`hook_action`, `function`, `aktiv`, `position`, `ho (0, 'DatatablelabelsTransferDocumentIncomming', 1, 1, (SELECT id FROM hook WHERE name = 'transfer_document_incoming'), 'Datatablelabels', 0); /* OpenXE 2024-01-24 für datatablelabel */ +/* OpenXE 2024-02-03 für belegvorlagen */ +INSERT INTO `hook` (`name`, `aktiv`, `parametercount`, `alias`, `description`) VALUES +('BelegPositionenButtons', 1, 3, '', ''), +('AARLGPositionen_cmds_end', 1, 1, '', ''), +('ajax_filter_hook1', 1, 1, '', ''); + +INSERT INTO `hook_register` (`hook_action`, `function`, `aktiv`, `position`, `hook`, `module`, `module_parameter`) VALUES +(0, 'BelegevorlagenAARLGPositionen_cmds_end', 1, 2, (SELECT id FROM hook WHERE name = 'AARLGPositionen_cmds_end' LIMIT 1), 'belegevorlagen', 0), +(0, 'Belegevorlagenajax_filter_hook1', 1, 2, (SELECT id FROM hook WHERE name = 'ajax_filter_hook1' LIMIT 1), 'belegevorlagen', 0), +(0, 'BelegevorlagenBelegPositionenButtons', 1, 2, (SELECT id FROM hook WHERE name = 'BelegPositionenButtons' LIMIT 1), 'belegevorlagen', 0) +; +/* OpenXE 2024-02-03 für belegvorlagen */ + +/* +BelegPositionenButtons + +Id,Hook_action,Function,Aktiv,Position,Hook,Module,Module_parameter +20,0,BelegevorlagenBelegPositionenButtons,1,2,16,belegevorlagen,0 +*/ + INSERT INTO `hook_menu` (`id`, `module`, `aktiv`) VALUES (1, 'artikel', 1), (2, 'provisionenartikel', 1), diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index 1b4b23ae..21a5ab90 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -25810,6 +25810,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."; @@ -25827,6 +25828,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 abb92ce7..b0160d23 100644 --- a/www/lib/dokumente/class.angebot.php +++ b/www/lib/dokumente/class.angebot.php @@ -41,8 +41,15 @@ class AngebotPDF 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(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false; - else $this->ust_spalteausblende=true; + + $this->ust_spalteausblende=false; + + if(!empty($check)) { + if (count($check) == 1) { + $this->ust_spalteausblende=true; + } + } + } $briefpapier_bearbeiter_ausblenden = $this->app->erp->Firmendaten('briefpapier_bearbeiter_ausblenden'); @@ -491,30 +498,29 @@ class AngebotPDF extends BriefpapierCustom { "rabatt"=>$value['rabatt'], "steuertext"=>$value['steuertext'])); if($positionenkaufmaenischrunden == 3){ - $netto_gesamt = $value['menge'] * round($value['preis'] - ($value['preis'] / 100 * $value['rabatt']),2); - }else{ + if (!$value['nicht_einrechnen']) { + $netto_gesamt = $value['menge'] * round($value['preis'] - ($value['preis'] / 100 * $value['rabatt']),2); + } + }else if (!$value['nicht_einrechnen']) { $netto_gesamt = $value['menge'] * ($value['preis'] - ($value['preis'] / 100 * $value['rabatt'])); } if($positionenkaufmaenischrunden) { $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']; } } @@ -536,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.auftrag.php b/www/lib/dokumente/class.auftrag.php index 00f43182..ac6273eb 100644 --- a/www/lib/dokumente/class.auftrag.php +++ b/www/lib/dokumente/class.auftrag.php @@ -43,8 +43,13 @@ 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(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false; - else $this->ust_spalteausblende=true; + $this->ust_spalteausblende=false; + + if(!empty($check)) { + if (count($check) == 1) { + $this->ust_spalteausblende=true; + } + } } $briefpapier_bearbeiter_ausblenden = $this->app->erp->Firmendaten('briefpapier_bearbeiter_ausblenden'); diff --git a/www/lib/dokumente/class.briefpapier.php b/www/lib/dokumente/class.briefpapier.php index cfa6a08b..519337e2 100644 --- a/www/lib/dokumente/class.briefpapier.php +++ b/www/lib/dokumente/class.briefpapier.php @@ -658,7 +658,7 @@ class Briefpapier extends SuperFPDF { public function addItem($rdata){ // add rabatt - if($rdata['price']!='-'){ + if($rdata['price']!='-' && is_numeric($rdata['price'])){ if($rdata['rabatt'] == 100){ $rdata['tprice'] = round($rdata['amount'] * ((double)$rdata['price'] - (double)($rdata['price'] / 100.00 * (double)$rdata['rabatt'])), 13); }else{ @@ -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') { @@ -4008,7 +4026,7 @@ class Briefpapier extends SuperFPDF { } $beschriftung_zeile = ucfirst($zwischenpositionen[$i]['postype']); - + if($data['name']=="") $html = ($fett?"":"").$beschriftung_zeile.($fett?"":""); else @@ -4029,10 +4047,10 @@ class Briefpapier extends SuperFPDF { $abstand_links = $posWidth +$itemNoWidth; } - $this->SetX($x+$abstand_links); - - $text = $this->WriteHTML($html); - $text = empty($text)?"":$text; + $this->SetX($x+$abstand_links); + + $text = $this->WriteHTML($html); + $text = empty($text)?"":$text; $this->Cell_typed($descWidth,4,); $this->SetX($x+$abstand_links+$descWidth); @@ -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); } diff --git a/www/lib/dokumente/class.gutschrift.php b/www/lib/dokumente/class.gutschrift.php index b81d3afc..ba321e3d 100644 --- a/www/lib/dokumente/class.gutschrift.php +++ b/www/lib/dokumente/class.gutschrift.php @@ -43,8 +43,13 @@ class GutschriftPDF 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(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false; - else $this->ust_spalteausblende=true; + $this->ust_spalteausblende=false; + + if(!empty($check)) { + if (count($check) == 1) { + $this->ust_spalteausblende=true; + } + } } $briefpapier_bearbeiter_ausblenden = $this->app->erp->Firmendaten('briefpapier_bearbeiter_ausblenden'); diff --git a/www/lib/dokumente/class.rechnung.php b/www/lib/dokumente/class.rechnung.php index c02c6c10..4fd98786 100644 --- a/www/lib/dokumente/class.rechnung.php +++ b/www/lib/dokumente/class.rechnung.php @@ -50,8 +50,13 @@ 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(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false; - else $this->ust_spalteausblende=true; + $this->ust_spalteausblende=false; + + if(!empty($check)) { + if (count($check) == 1) { + $this->ust_spalteausblende=true; + } + } } $lvl = null; $briefpapier_bearbeiter_ausblenden = $this->app->erp->Firmendaten('briefpapier_bearbeiter_ausblenden'); diff --git a/www/pages/belegevorlagen.php b/www/pages/belegevorlagen.php new file mode 100644 index 00000000..cc37a5e4 --- /dev/null +++ b/www/pages/belegevorlagen.php @@ -0,0 +1,238 @@ + +