mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-24 13:40:29 +01:00
Merge branch 'amperios'
This commit is contained in:
commit
bce18dcece
@ -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),
|
||||
|
@ -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";
|
||||
|
@ -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));
|
||||
|
@ -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');
|
||||
|
@ -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?"<b>":"").$beschriftung_zeile.($fett?"</b>":"");
|
||||
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);
|
||||
}
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
238
www/pages/belegevorlagen.php
Normal file
238
www/pages/belegevorlagen.php
Normal file
@ -0,0 +1,238 @@
|
||||
<?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 ****
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
class Belegevorlagen
|
||||
{
|
||||
static function TableSearch(&$app, $name, $erlaubtevars)
|
||||
{
|
||||
switch($name)
|
||||
{
|
||||
case "belegevorlagen_list":
|
||||
$heading = array('Bezeichnung','Belegtyp','Projekt','Menü');
|
||||
$width = array('40%','20%','29%','1%');
|
||||
$findcols = array('b.bezeichnung','b.belegtyp','pr.abkuerzung','b.id');
|
||||
$searchsql = array('b.bezeichnung','b.belegtyp','pr.abkuerzung');
|
||||
$menu = "<table><tr><td nowrap><a href=\"#\" onclick=\"deletevorlage(%value%);\"><img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a></td></tr></table>";
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS b.id, b.bezeichnung,CONCAT(UCASE(LEFT(b.belegtyp, 1)), SUBSTRING(b.belegtyp, 2)), pr.abkuerzung, b.id FROM belegevorlagen b LEFT JOIN projekt pr ON b.projekt = pr.id";
|
||||
$where = $app->erp->ProjektRechte('b.projekt');
|
||||
break;
|
||||
case "belegevorlagen_list2":
|
||||
$belegtyp = $app->Secure->GetGET('smodule');
|
||||
$heading = array('Bezeichnung','Projekt','Menü');
|
||||
$width = array('50%','49%','1%');
|
||||
$findcols = array('b.bezeichnung','pr.abkuerzung','b.id');
|
||||
$searchsql = array('b.bezeichnung','pr.abkuerzung');
|
||||
$menu = "<table><tr><td nowrap><a href=\"#\" onclick=\"loadbelegvorlage(%value%);\"><img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/forward.svg\" border=\"0\"></a> <a href=\"#\" onclick=\"deletevorlage(%value%);\"><img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a></td></tr></table>";
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS b.id, b.bezeichnung, pr.abkuerzung, b.id FROM belegevorlagen b LEFT JOIN projekt pr ON b.projekt = pr.id";
|
||||
$where = "belegtyp = '$belegtyp' ".$app->erp->ProjektRechte('b.projekt');
|
||||
break;
|
||||
}
|
||||
|
||||
$erg = false;
|
||||
foreach($erlaubtevars as $k => $v)
|
||||
{
|
||||
if(isset($$v))$erg[$v] = $$v;
|
||||
}
|
||||
return $erg;
|
||||
}
|
||||
function __construct(&$app, $intern = false)
|
||||
{
|
||||
$this->app=&$app;
|
||||
$this->artikel = $this->app->erp->GetKonfiguration('gesamtrabatt_artikel');
|
||||
if($intern)return;
|
||||
$this->app->ActionHandlerInit($this);
|
||||
$this->app->ActionHandler("list","BelegevorlagenList");
|
||||
$this->app->ActionHandler("einstellungen","BelegevorlagenEinstellungen");
|
||||
$this->app->DefaultActionHandler("list");
|
||||
$this->app->ActionHandlerListen($app);
|
||||
}
|
||||
|
||||
function BelegevorlagenMenu(){
|
||||
$this->app->erp->MenuEintrag("index.php?module=belegevorlagen&action=list","Übersicht");
|
||||
$this->app->erp->MenuEintrag("index.php?module=belegevorlagen&action=einstellungen","Einstellungen");
|
||||
|
||||
}
|
||||
|
||||
function BelegevorlagenList()
|
||||
{
|
||||
if($this->app->Secure->GetGET('cmd') == 'delvorlage')
|
||||
{
|
||||
$id = (int)$this->app->Secure->GetPOST('lid');
|
||||
$this->app->DB->Delete("DELETE FROM belegevorlagen WHERE id = '$id' LIMIT 1");
|
||||
echo json_encode(array('status'=>1));
|
||||
exit;
|
||||
}
|
||||
$this->BelegevorlagenMenu();
|
||||
$this->app->YUI->TableSearch('TAB1', "belegevorlagen_list", "show","","",basename(__FILE__), __CLASS__);
|
||||
$this->app->Tpl->Parse('PAGE','belegevorlagen_list.tpl');
|
||||
}
|
||||
|
||||
function BelegevorlagenEinstellungen()
|
||||
{
|
||||
$this->BelegevorlagenMenu();
|
||||
|
||||
$this->app->Tpl->Set('PREISEAKTUALISIEREN',$this->app->erp->GetKonfiguration('belegevorlagen_preiseaktualisieren')=='on'?'checked':'');
|
||||
$this->app->YUI->AutoSaveKonfiguration('preiseaktualisieren','belegevorlagen_preiseaktualisieren');
|
||||
|
||||
$this->app->Tpl->Parse('PAGE','belegevorlagen_einstellungen.tpl');
|
||||
}
|
||||
|
||||
function Install()
|
||||
{
|
||||
$this->app->erp->CheckTable('belegevorlagen');
|
||||
$this->app->erp->CheckColumn("id","int(11)","belegevorlagen","DEFAULT '0' NOT NULL AUTO_INCREMENT");
|
||||
$this->app->erp->CheckColumn("belegtyp", "varchar(255)", "belegevorlagen", "DEFAULT '' NOT NULL");
|
||||
$this->app->erp->CheckColumn("bezeichnung", "varchar(255)", "belegevorlagen", "DEFAULT '' NOT NULL");
|
||||
$this->app->erp->CheckColumn("projekt", "int(11)", "belegevorlagen", "DEFAULT '0' NOT NULL");
|
||||
$this->app->erp->CheckColumn("json", "MEDIUMTEXT", "belegevorlagen", "DEFAULT '' NOT NULL");
|
||||
$this->app->erp->CheckColumn("bearbeiter", "varchar(255)", "belegevorlagen", "DEFAULT '' NOT NULL");
|
||||
$this->app->erp->CheckColumn("zeitstempel", "timestamp", "belegevorlagen","DEFAULT CURRENT_TIMESTAMP NOT NULL");
|
||||
|
||||
$this->app->erp->RegisterHook('BelegPositionenButtons', 'belegevorlagen', 'BelegevorlagenBelegPositionenButtons');
|
||||
$this->app->erp->RegisterHook('AARLGPositionen_cmds_end', 'belegevorlagen', 'BelegevorlagenAARLGPositionen_cmds_end');
|
||||
$this->app->erp->RegisterHook('ajax_filter_hook1', 'belegevorlagen', 'Belegevorlagenajax_filter_hook1');
|
||||
}
|
||||
|
||||
function Belegevorlagenajax_filter_hook1($filtername,&$newarr, $term, $term2, $term3)
|
||||
{
|
||||
if($filtername == 'belegvorlagen')
|
||||
{
|
||||
$arr = $this->app->DB->SelectArr("SELECT CONCAT(b.id,' ',b.bezeichnung) as bezeichnung FROM belegevorlagen b
|
||||
WHERE (b.bezeichnung LIKE '%$term%') ".$this->app->erp->ProjektRechte('b.projekt'));
|
||||
if($arr)
|
||||
{
|
||||
for($i=0;$i<count($arr);$i++)
|
||||
$newarr[] = $arr[$i]['bezeichnung'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function BelegevorlagenBelegPositionenButtons($target, $module, $id)
|
||||
{
|
||||
if($module=="angebot" || $module=="auftrag" || $module=="rechnung" || $module=="lieferschein" || $module=="gutschrift" || $module=="proformarechnung")
|
||||
{
|
||||
$this->app->Tpl->Set('ID', $id);
|
||||
$this->app->Tpl->Set('MODULE', $module);
|
||||
$this->app->YUI->AutoComplete('bestehendevorlage','belegvorlagen');
|
||||
$this->app->YUI->TableSearch('BELEGEVORLAGENTABELLE', "belegevorlagen_list2", "show","","",basename(__FILE__), __CLASS__);
|
||||
$this->app->Tpl->Add($target, "<input type=\"button\" id=\"belegevorlagen\" value=\"Belegevorlagen\"> ".$this->app->Tpl->Parse($target,'belegevorlagen_widget.tpl'));
|
||||
}
|
||||
}
|
||||
|
||||
function BelegevorlagenAARLGPositionen_cmds_end($id){
|
||||
$module = $this->app->Secure->GetGET('module');
|
||||
if(!$module)return;
|
||||
|
||||
$projekt = $this->app->DB->Select("SELECT projekt FROM $module WHERE id='$id' LIMIT 1");
|
||||
if($projekt <=0) $projekt=0;
|
||||
|
||||
if($this->app->Secure->GetGET('cmd') == 'deletebelegvorlage')
|
||||
{
|
||||
$status = 1;
|
||||
$lid = (int)$this->app->Secure->GetPOST('lid');
|
||||
$this->app->DB->Delete("DELETE FROM belegevorlagen WHERE id = '$lid' AND belegtyp = '$module' LIMIT 1");
|
||||
echo json_encode(array('status'=>$status));
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->app->Secure->GetGET('cmd') == 'loadbelegvorlage')
|
||||
{
|
||||
$status = 0;
|
||||
$lid = (int)$this->app->Secure->GetPOST('lid');
|
||||
$json = (String)$this->app->DB->Select("SELECT json FROM belegevorlagen WHERE id = '$lid' AND belegtyp = '$module' LIMIT 1");
|
||||
if($json !== '')
|
||||
{
|
||||
$json = json_decode($json, true);
|
||||
$maxsort = (int)$this->app->DB->Select("SELECT max(sort) FROM $module"."_position WHERE $module = '$id' LIMIT 1");
|
||||
if(isset($json['positionen']))
|
||||
{
|
||||
foreach($json['positionen'] as $v)
|
||||
{
|
||||
$v[$module] = $id;
|
||||
if($this->app->erp->GetKonfiguration('belegevorlagen_preiseaktualisieren')=='on'){
|
||||
if($v['artikel'] != '0'){
|
||||
$v['preis'] = $this->app->erp->GetVerkaufspreis($v['artikel'],$v['menge']);
|
||||
}
|
||||
}
|
||||
$v['sort'] += $maxsort;
|
||||
$this->app->DB->Insert("INSERT INTO $module"."_position (id) VALUES ('')");
|
||||
$idnew = $this->app->DB->GetInsertID();
|
||||
$oldtonew[$v['id']] = $idnew;
|
||||
if($v['explodiert_parent'] && isset($oldtonew) && isset($oldtonew[$v['explodiert_parent']]))$v['explodiert_parent'] = $oldtonew[$v['explodiert_parent']];
|
||||
unset($v['id']);
|
||||
$this->app->DB->UpdateArr($module.'_position',$idnew,"id",$v, true);
|
||||
if(is_null($v['steuersatz']))$this->app->DB->Update("UPDATE ".$module."_position SET steuersatz = NULL WHERE id = '$idnew' LIMIT 1");
|
||||
}
|
||||
}
|
||||
if(isset($json['zwischenpositionen']))
|
||||
{
|
||||
$maxpos = $this->app->DB->SelectArr("SELECT id,sort FROM beleg_zwischenpositionen WHERE doctype = '$module' AND doctypeid = '$id' AND pos='$maxsort' ORDER BY sort DESC LIMIT 1");
|
||||
if($maxpos)
|
||||
{
|
||||
$sortoffset = 1 + $maxpos[0]['sort'];
|
||||
}else{
|
||||
$sortoffset = 0;
|
||||
}
|
||||
foreach($json['zwischenpositionen'] as $v)
|
||||
{
|
||||
if($v['pos'] == 0)$v['sort'] += $sortoffset;
|
||||
$v['doctypeid'] = $id;
|
||||
$v['pos'] += $maxsort;
|
||||
unset($v['id']);
|
||||
$this->app->DB->Insert("INSERT INTO beleg_zwischenpositionen (id) VALUES ('')");
|
||||
$idnew = $this->app->DB->GetInsertID();
|
||||
$this->app->DB->UpdateArr('beleg_zwischenpositionen',$idnew,"id",$v, true);
|
||||
}
|
||||
}
|
||||
$status = 1;
|
||||
$this->app->erp->ANABREGSNeuberechnen($id,$module);
|
||||
}
|
||||
echo json_encode(array('status'=>$status));
|
||||
exit;
|
||||
}
|
||||
if($this->app->Secure->GetGET('cmd') == 'savebelegevorlage')
|
||||
{
|
||||
$json = null;
|
||||
$status = 0;
|
||||
$bestehendevorlage = (int)reset(explode(' ',$this->app->Secure->GetPOST('bestehendevorlage')));
|
||||
$bezeichnung = (String)$this->app->Secure->GetPOST('bezeichnung');
|
||||
$vorlagetyp = $this->app->Secure->GetPOST('vorlagetyp');
|
||||
$bearbeiter = $this->app->DB->real_escape_string($this->app->User->GetName());
|
||||
$lid = null;
|
||||
if($vorlagetyp == 'neu')
|
||||
{
|
||||
if($bezeichnung !== '')
|
||||
{
|
||||
$this->app->DB->Insert("INSERT INTO belegevorlagen (bezeichnung, belegtyp, bearbeiter, zeitstempel,projekt) VALUES ('$bezeichnung','$module','$bearbeiter',now(),'$projekt')");
|
||||
$lid = $this->app->DB->GetInsertID();
|
||||
}
|
||||
}else{
|
||||
$lid = $this->app->DB->Select("SELECT id FROM belegevorlagen WHERE id = '$bestehendevorlage' LIMIT 1");
|
||||
if($lid && $bezeichnung !== '')$this->app->DB->Update("UPDATE belegevorlagen set bezeichnung = '$bezeichnung' WHERE id = '$bestehendevorlage' LIMIT 1");
|
||||
}
|
||||
if($lid)
|
||||
{
|
||||
$json['positionen'] = $this->app->DB->SelectArr("SELECT * FROM $module"."_position WHERE $module = '$id' ORDER BY sort");
|
||||
$json['zwischenpositionen'] = $this->app->DB->SelectArr("SELECT * FROM beleg_zwischenpositionen WHERE doctype = '$module' AND doctypeid = '$id' ORDER BY pos, sort");
|
||||
$json = $this->app->DB->real_escape_string(json_encode($json));
|
||||
$this->app->DB->Update("UPDATE belegevorlagen set json = '$json', zeitstempel = now(), bearbeiter = '$bearbeiter' WHERE id = '$lid' LIMIT 1");
|
||||
$status = 1;
|
||||
}
|
||||
echo json_encode(array('status'=>$status));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,20 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1"><!--[TABTEXT]--></a></li>
|
||||
</ul>
|
||||
<!-- ende gehort zu tabview -->
|
||||
|
||||
<!-- erstes tab -->
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
<fieldset>
|
||||
<legend>Einstellungen</legend>
|
||||
<input type="checkbox" name="preiseaktualisieren" id="preiseaktualisieren" [PREISEAKTUALISIEREN] /> <label for="preiseaktualisieren">Aktuelle Artikelpreise verwenden wenn Belegvorlage geladen wird.</label>
|
||||
</fieldset>
|
||||
|
||||
[TAB1]
|
||||
[TAB1NEXT]
|
||||
</div>
|
||||
|
||||
<!-- tab view schließen -->
|
||||
</div>
|
@ -0,0 +1,38 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1"><!--[TABTEXT]--></a></li>
|
||||
</ul>
|
||||
<!-- ende gehort zu tabview -->
|
||||
|
||||
<!-- erstes tab -->
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
[TAB1]
|
||||
[TAB1NEXT]
|
||||
</div>
|
||||
|
||||
<!-- tab view schließen -->
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function deletevorlage(belegid)
|
||||
{
|
||||
if(confirm('Vorlage wirklich löschen?'))
|
||||
{
|
||||
$('#belegevorlagendiv').dialog('close');
|
||||
$.ajax({
|
||||
url: 'index.php?module=belegevorlagen&action=list&cmd=delvorlage',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {lid:belegid},
|
||||
success: function(data) {
|
||||
var oTable = $('#belegevorlagen_list').DataTable( );
|
||||
oTable.ajax.reload();
|
||||
},
|
||||
beforeSend: function() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user