diff --git a/phpwf/htmltags/class.form.php b/phpwf/htmltags/class.form.php index b4795197..221a477c 100644 --- a/phpwf/htmltags/class.form.php +++ b/phpwf/htmltags/class.form.php @@ -1,361 +1,361 @@ -action=$action; - $this->name=$name; - $this->method=$method; - $this->id=$id; - } - - function Set($value) - { - } - - function Get() - { - - } - - function GetClose() - { - } -} - - - -class HTMLTextarea -{ - var $name; - var $rows; - var $value; - var $cols; - var $id=""; - var $readonly=""; - var $disabled=""; - var $class; - - function __construct($name,$rows,$cols,$defvalue="",$id="",$readonly="",$disabled="",$class="") - { - $this->name = $name; - $this->rows = $rows; - $this->cols = $cols; - $this->class = $class; - $this->value = $defvalue; - $this->id = $id; - - if($id=="") - $this->id = $name; - - $this->readonly = $readonly; - $this->disabled = $disabled; - } - - function Get() - { - // TEMP ACHTUNG HIER IST MIST!!! - $value = $this->value; -/* - if(!defined('WFHTMLTextareabr') || !WFHTMLTextareabr)$value = preg_replace('//i', "\n", $value); - */ - // $value = str_replace("\\r\\n","\n",$value); - - $html = ""; - return $html; - } - - function GetClose() - { - } -} - - -/// fuer Datenfelder die mit in die Datenbank o.ae. kommen sollen, aber nicht durch den -/// user in irgendeiner art und weise gesehen und manipuliert werden koennen - -class BlindField -{ - var $name; - var $value; - - function __construct($name,$value) - { - $this->name = $name; - $this->value = $value; - } - function Get(){} - function GetClose(){} -} - - -class HTMLInput -{ - var $name; - var $type; - var $value; - var $dbvalue; - var $checkvalue; - var $onchange; - var $onclick; - var $defvalue; - var $size; - var $maxlength; - var $tabindex; - var $id=""; - var $readonly=""; - var $disabled=""; - var $placeholder=""; - var $class; - var $checked; - - function __construct($name,$type,$value,$size="",$maxlength="",$id="",$defvalue="",$checked="",$readonly="",$disabled="",$class="",$onclick="",$tabindex="",$placeholder="") - { - $this->name = $name; - $this->type = $type; - $this->value = $value; - $this->size = $size; - $this->maxlength = $maxlength; - $this->id = $id; - $this->readonly = $readonly; - $this->disabled = $disabled; - $this->class=$class; - $this->checked=$checked; - $this->tabindex=$tabindex; - $this->placeholder=$placeholder; - $this->defvalue=$defvalue; // if value is empty use this - $this->onclick=$onclick; - - } - - function Get() - { - if($this->id=="") $this->id = $this->name; - - switch($this->type) - { - case "text": - $html = "type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\" - name=\"{$this->name}\" value=\"".preg_replace("/\"/",""",$this->value)."\" size=\"{$this->size}\" placeholder=\"{$this->placeholder}\" - maxlength=\"{$this->maxlength}\" {$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>"; - break; - case "password": - $html = "type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\" - name=\"{$this->name}\" value=\"{$this->value}\" size=\"{$this->size}\" - maxlength=\"{$this->maxlength}\" {$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>"; - break; - case "checkbox": - $html = "type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\" - name=\"{$this->name}\" value=\"{$this->value}\" {$this->checked} onchange=\"{$this->onchange}\" onclick=\"{$this->onclick}\" - {$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>"; - break; - case "radio": - - if($this->value==$this->defvalue) $this->checked="checked"; - - $tmpname = str_replace('_'.$this->defvalue,'',$this->name); - - $html = "type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\" - name=\"{$tmpname}\" value=\"{$this->defvalue}\" {$this->checked} onchange=\"{$this->onchange}\" - {$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>"; - break; - case "submit": - $html = "type}\" id=\"{$this->id}\" class=\"{$this->class}\" - name=\"{$this->name}\" value=\"{$this->value}\" - {$this->readonly} {$this->disabled}>"; - break; - case "hidden": - $html = "type}\" id=\"{$this->id}\" class=\"{$this->class}\" - name=\"{$this->name}\" value=\"{$this->value}\" size=\"{$this->size}\" - maxlength=\"{$this->maxlength}\" {$this->readonly} {$this->disabled}>"; - break; - } - - return $html; - } - - function GetClose() - { - } -} - - - -class HTMLCheckbox extends HTMLInput -{ - function __construct($name,$value,$defvalue,$checkvalue="",$onclick="",$tabindex="") - { - - if($checkvalue!="") - $this->checkvalue=$checkvalue; - else - $this->checkvalue=$value; - - $this->name = $name; - $this->type = "checkbox"; - $this->checkradiovalue = isset($okvalue)?$okvalue:null; - $this->defvalue = $defvalue; - $this->value = $value; - $this->onclick= $onclick; - $this->tabindex= $tabindex; - $this->orgvalue = $value; - } - - - function Get() - { - if(($this->value=="" && $this->defvalue==$this->checkvalue)) { - } - if($this->checkvalue==$this->value) { - $this->checked="checked"; - } - if($this->value=="" && $this->defvalue!=$this->checkvalue) - $this->checked=""; - - $this->value = $this->checkvalue; - //$this->value=1; - return parent::Get(); - } - - function GetClose() - { - } - -}; - -class HTMLSelect -{ - var $name; - var $size; - var $id; - var $readonly; - var $disabled; - - var $options; - var $onchange; - var $selected; - var $tabindex; - - var $class; - - function __construct($name,$size,$id="",$readonly=false,$disabled=false,$tabindex="") - { - $this->name=$name; - $this->size=$size; - $this->id=$id; - $this->readonly=$readonly; - $this->disabled=$disabled; - $this->tabindex=$tabindex; - $this->class=""; - - if($id=="") - $this->id = $name; - } - - function AddOption($option,$value) - { - $this->options[] = array($option,$value); - } - - function AddOptionsDimensionalArray($values) - { - foreach($values as $key=>$value) - { - $this->options[] = array($value[wert],$value[schluessel]); - } - } - - - function AddOptionsAsocSimpleArray($values) - { - foreach($values as $key=>$value) - $this->options[] = array($value,$key); - } - - function AddOptionsSimpleArray($values) - { - if(is_array($values)) - { - foreach($values as $key=>$value) - { - if(!is_numeric($key)) - $this->options[] = array($value,$key); - else - $this->options[] = array($value,$value); - } - } - } - - function AddOptions($values) - { - $number=0; - if(count($values)>0) - { - foreach($values as $key=>$row) - foreach($row as $value) - { - if($number==0){ - $option=$value; - $number=1; - } - else { - $this->options[] = array($option,$value); - $number=0; - $option=""; - } - } - } - - } - - function Get() - { - $html = ""; - return $html; - } - - function GetClose() - { - } - -} - +action=$action; + $this->name=$name; + $this->method=$method; + $this->id=$id; + } + + function Set($value) + { + } + + function Get() + { + + } + + function GetClose() + { + } +} + + + +class HTMLTextarea +{ + var $name; + var $rows; + var $value; + var $cols; + var $id=""; + var $readonly=""; + var $disabled=""; + var $class; + + function __construct($name,$rows,$cols,$defvalue="",$id="",$readonly="",$disabled="",$class="") + { + $this->name = $name; + $this->rows = $rows; + $this->cols = $cols; + $this->class = $class; + $this->value = $defvalue; + $this->id = $id; + + if($id=="") + $this->id = $name; + + $this->readonly = $readonly; + $this->disabled = $disabled; + } + + function Get() + { + // TEMP ACHTUNG HIER IST MIST!!! + $value = $this->value; +/* + if(!defined('WFHTMLTextareabr') || !WFHTMLTextareabr)$value = preg_replace('//i', "\n", $value); + */ + // $value = str_replace("\\r\\n","\n",$value); + + $html = ""; + return $html; + } + + function GetClose() + { + } +} + + +/// fuer Datenfelder die mit in die Datenbank o.ae. kommen sollen, aber nicht durch den +/// user in irgendeiner art und weise gesehen und manipuliert werden koennen + +class BlindField +{ + var $name; + var $value; + + function __construct($name,$value) + { + $this->name = $name; + $this->value = $value; + } + function Get(){} + function GetClose(){} +} + + +class HTMLInput +{ + var $name; + var $type; + var $value; + var $dbvalue; + var $checkvalue; + var $onchange; + var $onclick; + var $defvalue; + var $size; + var $maxlength; + var $tabindex; + var $id=""; + var $readonly=""; + var $disabled=""; + var $placeholder=""; + var $class; + var $checked; + + function __construct($name,$type,$value,$size="",$maxlength="",$id="",$defvalue="",$checked="",$readonly="",$disabled="",$class="",$onclick="",$tabindex="",$placeholder="") + { + $this->name = $name; + $this->type = $type; + $this->value = $value; + $this->size = $size; + $this->maxlength = $maxlength; + $this->id = $id; + $this->readonly = $readonly; + $this->disabled = $disabled; + $this->class=$class; + $this->checked=$checked; + $this->tabindex=$tabindex; + $this->placeholder=$placeholder; + $this->defvalue=$defvalue; // if value is empty use this + $this->onclick=$onclick; + + } + + function Get() + { + if($this->id=="") $this->id = $this->name; + + switch($this->type) + { + case "text": + $html = "type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\" + name=\"{$this->name}\" value=\"".preg_replace("/\"/",""",$this->value)."\" size=\"{$this->size}\" placeholder=\"{$this->placeholder}\" + maxlength=\"{$this->maxlength}\" {$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>"; + break; + case "password": + $html = "type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\" + name=\"{$this->name}\" value=\"{$this->value}\" size=\"{$this->size}\" + maxlength=\"{$this->maxlength}\" {$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>"; + break; + case "checkbox": + $html = "type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\" + name=\"{$this->name}\" value=\"{$this->value}\" {$this->checked} onchange=\"{$this->onchange}\" onclick=\"{$this->onclick}\" + {$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>"; + break; + case "radio": + + if($this->value==$this->defvalue) $this->checked="checked"; + + $tmpname = str_replace('_'.$this->defvalue,'',$this->name); + + $html = "type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\" + name=\"{$tmpname}\" value=\"{$this->defvalue}\" {$this->checked} onchange=\"{$this->onchange}\" + {$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>"; + break; + case "submit": + $html = "type}\" id=\"{$this->id}\" class=\"{$this->class}\" + name=\"{$this->name}\" value=\"{$this->value}\" + {$this->readonly} {$this->disabled}>"; + break; + case "hidden": + $html = "type}\" id=\"{$this->id}\" class=\"{$this->class}\" + name=\"{$this->name}\" value=\"{$this->value}\" size=\"{$this->size}\" + maxlength=\"{$this->maxlength}\" {$this->readonly} {$this->disabled}>"; + break; + } + + return $html; + } + + function GetClose() + { + } +} + + + +class HTMLCheckbox extends HTMLInput +{ + function __construct($name,$value,$defvalue,$checkvalue="",$onclick="",$tabindex="") + { + + if($checkvalue!="") + $this->checkvalue=$checkvalue; + else + $this->checkvalue=$value; + + $this->name = $name; + $this->type = "checkbox"; + $this->checkradiovalue = isset($okvalue)?$okvalue:null; + $this->defvalue = $defvalue; + $this->value = $value; + $this->onclick= $onclick; + $this->tabindex= $tabindex; + $this->orgvalue = $value; + } + + + function Get() + { + if(($this->value=="" && $this->defvalue==$this->checkvalue)) { + } + if($this->checkvalue==$this->value) { + $this->checked="checked"; + } + if($this->value=="" && $this->defvalue!=$this->checkvalue) + $this->checked=""; + + $this->value = $this->checkvalue; + //$this->value=1; + return parent::Get(); + } + + function GetClose() + { + } + +}; + +class HTMLSelect +{ + var $name; + var $size; + var $id; + var $readonly; + var $disabled; + + var $options; + var $onchange; + var $selected; + var $tabindex; + + var $class; + + function __construct($name,$size,$id="",$readonly=false,$disabled=false,$tabindex="") + { + $this->name=$name; + $this->size=$size; + $this->id=$id; + $this->readonly=$readonly; + $this->disabled=$disabled; + $this->tabindex=$tabindex; + $this->class=""; + + if($id=="") + $this->id = $name; + } + + function AddOption($option,$value) + { + $this->options[] = array($option,$value); + } + + function AddOptionsDimensionalArray($values) + { + foreach($values as $key=>$value) + { + $this->options[] = array($value[wert],$value[schluessel]); + } + } + + + function AddOptionsAsocSimpleArray($values) + { + foreach($values as $key=>$value) + $this->options[] = array($value,$key); + } + + function AddOptionsSimpleArray($values) + { + if(is_array($values)) + { + foreach($values as $key=>$value) + { + if(!is_numeric($key)) + $this->options[] = array($value,$key); + else + $this->options[] = array($value,$value); + } + } + } + + function AddOptions($values) + { + $number=0; + if(count($values)>0) + { + foreach($values as $key=>$row) + foreach($row as $value) + { + if($number==0){ + $option=$value; + $number=1; + } + else { + $this->options[] = array($option,$value); + $number=0; + $option=""; + } + } + } + + } + + function Get() + { + $html = ""; + return $html; + } + + function GetClose() + { + } + +} + diff --git a/phpwf/plugins/class.yui.php b/phpwf/plugins/class.yui.php index 5cf512ef..d01d209c 100644 --- a/phpwf/plugins/class.yui.php +++ b/phpwf/plugins/class.yui.php @@ -2855,16 +2855,60 @@ class YUI { } else if ($module == "verbindlichkeit") // OpenXE - { - $sql = "SELECT $sortcol, if(b.beschreibung!='', - if(CHAR_LENGTH(b.bezeichnung)>" . $this->app->erp->MaxArtikelbezeichnung() . ",CONCAT(SUBSTR(CONCAT(b.bezeichnung,' *'),1," . $this->app->erp->MaxArtikelbezeichnung() . "),'...'),CONCAT(b.bezeichnung,' *')), - if(CHAR_LENGTH(b.bezeichnung)>" . $this->app->erp->MaxArtikelbezeichnung() . ",CONCAT(SUBSTR(b.bezeichnung,1," . $this->app->erp->MaxArtikelbezeichnung() . "),'...'),b.bezeichnung)) - as Artikel, - p.abkuerzung as projekt, a.nummer as nummer, b.nummer as nummer, DATE_FORMAT(lieferdatum,'%d.%m.%Y') as lieferdatum, trim(b.menge)+0 as menge, " . $this->FormatPreis($preiscell) . " as preis, CONCAT(k.sachkonto,' - ',k.beschriftung) AS sachkonto, b.id as id - FROM $table b - LEFT JOIN artikel a ON a.id=b.artikel LEFT JOIN projekt p ON b.projekt=p.id - LEFT JOIN kontorahmen k ON k.id = b.sachkonto - WHERE b.$module='$id'"; + { + $sql = " + SELECT + $sortcol, + IF( + b.beschreibung != '', + IF( + CHAR_LENGTH(b.bezeichnung) > " . $this->app->erp->MaxArtikelbezeichnung() . ", + CONCAT( + SUBSTR( + CONCAT(b.bezeichnung, ' *'), + 1, + " . $this->app->erp->MaxArtikelbezeichnung() . " + ), + '...' + ), + CONCAT(b.bezeichnung, ' *') + ), + IF( + CHAR_LENGTH(b.bezeichnung) > " . $this->app->erp->MaxArtikelbezeichnung() . ", + CONCAT( + SUBSTR( + b.bezeichnung, + 1, + " . $this->app->erp->MaxArtikelbezeichnung() . " + ), + '...' + ), + b.bezeichnung + ) + ) AS Artikel, + p.abkuerzung AS projekt, + a.nummer, + ".$this->app->erp->FormatDate('lieferdatum')." AS lieferdatum, + TRIM(b.menge) +0 AS menge, + " . $this->FormatPreis($preiscell) . " AS preis, + " . $this->FormatPreis($preiscell."*menge") . " AS Betrag, + CONCAT( + k.sachkonto, + ' - ', + k.beschriftung + ) AS sachkonto, + b.id AS id + FROM + $table b + LEFT JOIN artikel a ON + a.id = b.artikel + LEFT JOIN projekt p ON + b.projekt = p.id + LEFT JOIN kontorahmen k ON + k.id = b.sachkonto + WHERE + b.$module = '$id' + "; } else { $sql = null; @@ -14875,8 +14919,6 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl $table->headings[4] = 'Abr. bei Kd'; $table->headings[5] = 'sonst. MwSt'; // kann man auch umbenennen in Keine - - $table->headings[6] = 'MwSt'; $table->headings[7] = 'Kommentar'; $table->headings[8] = 'Bezahlt'; diff --git a/upgrade/data/db_schema.json b/upgrade/data/db_schema.json index 0cdae6d1..28e41a5b 100644 --- a/upgrade/data/db_schema.json +++ b/upgrade/data/db_schema.json @@ -52371,6 +52371,17 @@ "Privileges": "select,insert,update,references", "Comment": "" }, + { + "Field": "nummer", + "Type": "int(11)", + "Collation": null, + "Null": "NO", + "Key": "PRI", + "Default": null, + "Extra": "", + "Privileges": "select,insert,update,references", + "Comment": "" + }, { "Field": "bezeichnung", "Type": "varchar(255)", @@ -52382,6 +52393,17 @@ "Privileges": "select,insert,update,references", "Comment": "" }, + { + "Field": "beschreibung", + "Type": "varchar(255)", + "Collation": "utf8mb3_general_ci", + "Null": "NO", + "Key": "", + "Default": null, + "Extra": "", + "Privileges": "select,insert,update,references", + "Comment": "" + }, { "Field": "projekt", "Type": "varchar(255)", @@ -108959,6 +108981,17 @@ "Privileges": "select,insert,update,references", "Comment": "" }, + { + "Field": "datum", + "Type": "date", + "Collation": null, + "Null": "YES", + "Key": "", + "Default": null, + "Extra": "", + "Privileges": "select,insert,update,references", + "Comment": "" + }, { "Field": "status_beleg", "Type": "varchar(64)", @@ -110685,6 +110718,39 @@ "Extra": "", "Privileges": "select,insert,update,references", "Comment": "" + }, + { + "Field": "steuersatz_normal", + "Type": "decimal(5,2)", + "Collation": null, + "Null": "NO", + "Key": "", + "Default": "0", + "Extra": "", + "Privileges": "select,insert,update,references", + "Comment": "" + }, + { + "Field": "steuersatz_ermaessigt", + "Type": "decimal(5,2)", + "Collation": null, + "Null": "NO", + "Key": "", + "Default": "0", + "Extra": "", + "Privileges": "select,insert,update,references", + "Comment": "" + }, + { + "Field": "ust_befreit", + "Type": "int(1)", + "Collation": null, + "Null": "NO", + "Key": "", + "Default": "0", + "Extra": "", + "Privileges": "select,insert,update,references", + "Comment": "" } ], "keys": [ diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index b26ef436..cf79da0d 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -35375,6 +35375,7 @@ function Firmendaten($field,$projekt="") { case 'bestellung': case 'anfrage': + case 'verbindlichkeit': $aufwendung = true; break; } diff --git a/www/pages/content/verbindlichkeit_edit.tpl b/www/pages/content/verbindlichkeit_edit.tpl index 83562c18..005111c2 100644 --- a/www/pages/content/verbindlichkeit_edit.tpl +++ b/www/pages/content/verbindlichkeit_edit.tpl @@ -9,16 +9,19 @@ [FORMHANDLEREVENT]
-
+
-
+
{|Verbindlichkeit [BELEGNR] Lf-Nr. [LIEFERANTENNUMMER]|} - [STATUSICONS] -
+ [STATUSICONS] +
+
+ +
@@ -27,14 +30,22 @@
-
+
+ + + + @@ -42,7 +53,7 @@ {|Rechnung|}: @@ -50,26 +61,82 @@ {|Rechnungsdatum|}: + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
+ {|Status|}: + + +
{|Adresse|}: - +
- +
- +
+ {|Eingangsdatum|}: + + +
{|Betrag|}: - - + +
+ {|Betrag netto|}: + + +
{|Zahlbarbis|}: - + +
+ {|Skonto %|}: + +
+ {|Skontobis|}: + + +
+ {|Waren-/Leistungsprüfung (Einkauf)|}: + + +
+ {|Rechnungseingangsprüfung (Buchhaltung)|}: + + +
+ {|Bezahlt|}: + + +
{|Projekt|}: @@ -78,38 +145,6 @@
- {|Eingangsdatum|}: - - -
- {|Zahlungsweise|}: - - -
- {|Skonto|}: - - -
- {|Skontobis|}: - - -
{|Kostenstelle|}: @@ -117,45 +152,13 @@
- {|Sachkonto|}: - - -
- {|Waren-/Leistungsprüfung (Einkauf)|}: - - -
- {|Rechnungseingangsprüfung (Buchhaltung)|}: - - -
- {|Bezahlt|}: - - -
{|Internebemerkung|}: - +
@@ -166,7 +169,7 @@
-
+
{|Vorschau|} @@ -176,7 +179,6 @@
-
diff --git a/www/pages/verbindlichkeit.php b/www/pages/verbindlichkeit.php index ac4de5e3..a0d39f3e 100644 --- a/www/pages/verbindlichkeit.php +++ b/www/pages/verbindlichkeit.php @@ -1,7 +1,8 @@ app->ActionHandler("dateien", "verbindlichkeit_dateien"); $this->app->ActionHandler("inlinepdf", "verbindlichkeit_inlinepdf"); $this->app->ActionHandler("positioneneditpopup", "verbindlichkeit_positioneneditpopup"); + $this->app->ActionHandler("freigabe", "verbindlichkeit_freigabe"); $this->app->DefaultActionHandler("list"); $this->app->ActionHandlerListen($app); @@ -35,7 +37,7 @@ class Verbindlichkeit { switch ($name) { case "verbindlichkeit_list": $allowed['verbindlichkeit_list'] = array('list'); - $heading = array('','','Belegnr','Adresse', 'Lieferant', 'RE-Nr', 'RE-Datum', 'Betrag (brutto)', 'Währung', 'Ziel','Skontoziel','Skonto','Monitor', 'Menü'); + $heading = array('','','Belegnr','Adresse', 'Lieferant', 'RE-Nr', 'RE-Datum', 'Betrag (brutto)', 'Währung', 'Ziel','Skontoziel','Skonto','Status','Monitor', 'Menü'); $width = array('1%','1%','10%'); // Fill out manually later // columns that are aligned right (numbers etc) @@ -54,6 +56,7 @@ class Verbindlichkeit { 'v.zahlbarbis', 'v.skontobis', 'v.skonto', + 'v.status', 'v.status_beleg', 'v.id' ); @@ -91,6 +94,7 @@ class Verbindlichkeit { ".$app->erp->FormatDate("v.zahlbarbis").", IF(v.skonto <> 0,".$app->erp->FormatDate("v.skontobis").",''), IF(v.skonto <> 0,CONCAT(".$app->erp->FormatMenge('v.skonto',0).",'%'),''), + v.status, ".$app->YUI->IconsSQLVerbindlichkeit().", v.id FROM verbindlichkeit v LEFT JOIN adresse a ON v.adresse = a.id @@ -159,17 +163,30 @@ class Verbindlichkeit { if (empty($id)) { // New item $id = 'NULL'; + $input['status'] = 'angelegt'; } if ($submit != '') { - // Write to database - + // Write to database // Add checks here + $status = $this->app->DB->Select("SELECT status FROM verbindlichkeit WHERE id =".$id); - // $input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true); // Parameters: Target db?, value, from form? - $input['adresse'] = $this->app->erp->ReplaceAdresse(true,$input['adresse'],true); // Parameters: Target db?, value, from form? + if ($status != 'angelegt' && $id != 'NULL') { + $internebemerkung = $input['internebemerkung']; + unset($input); + $input['internebemerkung'] = $internebemerkung; + } else { + $input['adresse'] = $this->app->erp->ReplaceAdresse(true,$input['adresse'],true); // Parameters: Target db?, value, from form? + $input['rechnungsdatum'] = $this->app->erp->ReplaceDatum(true,$input['rechnungsdatum'],true); // Parameters: Target db?, value, from form? + $input['eingangsdatum'] = $this->app->erp->ReplaceDatum(true,$input['eingangsdatum'],true); // Parameters: Target db?, value, from form? + $input['skontobis'] = $this->app->erp->ReplaceDatum(true,$input['skontobis'],true); // Parameters: Target db?, value, from form? + $input['zahlbarbis'] = $this->app->erp->ReplaceDatum(true,$input['zahlbarbis'],true); // Parameters: Target db?, value, from form? + $input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true); + $input['kostenstelle'] = $this->app->erp->ReplaceKostenstelle(true,$input['kostenstelle'],true); + $input['sachkonto'] = $this->app->erp->ReplaceKontorahmen(true,$input['sachkonto'],true); + } $columns = "id, "; $values = "$id, "; @@ -196,8 +213,9 @@ class Verbindlichkeit { $this->app->DB->Update($sql); if ($id == 'NULL') { + $id = $this->app->DB->GetInsertID(); $msg = $this->app->erp->base64_url_encode("
Das Element wurde erfolgreich angelegt.
"); - header("Location: index.php?module=verbindlichkeit&action=list&msg=$msg"); + header("Location: index.php?module=verbindlichkeit&action=edit&id=$id&msg=$msg"); } else { $this->app->Tpl->Set('MESSAGE', "
Die Einstellungen wurden erfolgreich übernommen.
"); } @@ -216,6 +234,49 @@ class Verbindlichkeit { $verbindlichkeit_from_db = $result[0]; } + // Summarize positions + + $sql = "SELECT * FROM verbindlichkeit_position WHERE verbindlichkeit = ".$id; + $positionen = $this->app->DB->SelectArr($sql); + + if (!empty($positionen)) { + $betrag_netto = 0; + $betrag_brutto = 0; + $steuer_normal = 0; + $steuer_ermaessigt = 0; + + /* + Normal: umsatzsteuer leer, steuersatz = leer + Ermäßigt: umsatzsteuer ermaessigt, steuersatz = -1 + Befreit: umsatzsteuer befreit, steursatz = -1 + Individuell: umsatzsteuer leer, steuersatz = wert + */ + + foreach ($positionen as $position) { + + $tmpsteuersatz = null; + $tmpsteuertext = null; + $erloes = null; + + // function GetSteuerPosition($typ, $posid,&$tmpsteuersatz = null, &$tmpsteuertext = null, &$erloes = null) + + $this->app->erp->GetSteuerPosition("verbindlichkeit",$position['id'],$tmpsteuersatz,$tmpsteuertext,$erloes); + + $position['steuersatz_berechnet'] = $tmpsteuersatz; + $position['steuertext_berechnet'] = $tmpsteuertext; + $position['steuererloes_berechnet'] = $erloes; + + $betrag_netto += ($position['menge']*$position['preis']); + $betrag_brutto += ($position['menge']*$position['preis'])*(1+($tmpsteuersatz/100)); + + } + + $this->app->Tpl->Set('BETRAGNETTO', $betrag_netto); + $this->app->Tpl->Set('BETRAGBRUTTO', round($betrag_brutto,2)); + + $this->app->Tpl->Set('BETRAGDISABLED', 'disabled'); + + } /* * Add displayed items later @@ -228,6 +289,23 @@ class Verbindlichkeit { */ + if ($verbindlichkeit_from_db['status'] != 'angelegt' && $id != 'NULL') { + $this->app->Tpl->Set('SAVEDISABLED','disabled'); + } + + $this->app->Tpl->Set('FREIGABECHECKED', $verbindlichkeit_from_db['freigabe']==1?"checked":""); + $this->app->Tpl->Set('RECHNUNGSFREIGABECHECKED', $verbindlichkeit_from_db['rechnungsfreigabe']==1?"checked":""); + $this->app->Tpl->Set('BEZAHLTCHECKED', $verbindlichkeit_from_db['bezahlt']==1?"checked":""); + + $this->app->Tpl->Set('RECHNUNGSDATUM',$this->app->erp->ReplaceDatum(false,$verbindlichkeit_from_db['rechnungsdatum'],false)); + $this->app->YUI->DatePicker("rechnungsdatum"); + $this->app->Tpl->Set('EINGANGSDATUM',$this->app->erp->ReplaceDatum(false,$verbindlichkeit_from_db['eingangsdatum'],false)); + $this->app->YUI->DatePicker("eingangsdatum"); + $this->app->Tpl->Set('SKONTOBIS',$this->app->erp->ReplaceDatum(false,$verbindlichkeit_from_db['skontobis'],false)); + $this->app->YUI->DatePicker("skontobis"); + $this->app->Tpl->Set('ZAHLBARBIS',$this->app->erp->ReplaceDatum(false,$verbindlichkeit_from_db['zahlbarbis'],false)); + $this->app->YUI->DatePicker("zahlbarbis"); + $this->app->Tpl->Add('KURZUEBERSCHRIFT2', $verbindlichkeit_from_db['adresse_name']." ".$verbindlichkeit_from_db['rechnung']); $sql = "SELECT " . $this->app->YUI->IconsSQLVerbindlichkeit() . " AS `icons` FROM verbindlichkeit v WHERE id=$id"; @@ -235,6 +313,12 @@ class Verbindlichkeit { $this->app->Tpl->Add('STATUSICONS', $icons[0]['icons']); $this->app->YUI->AutoComplete("adresse", "adresse"); + $this->app->YUI->AutoComplete("projekt", "projektname", 1); + $this->app->Tpl->Set('PROJEKT',$this->app->erp->ReplaceProjekt(false,$verbindlichkeit_from_db['projekt'],false)); + $this->app->YUI->AutoComplete("kostenstelle", "kostenstelle", 1); + $this->app->Tpl->Set('KOSTENSTELLE',$this->app->erp->ReplaceKostenstelle(false,$verbindlichkeit_from_db['kostenstelle'],false)); + $this->app->YUI->AutoComplete("sachkonto","sachkonto_aufwendungen",1); + $this->app->Tpl->Set('SACHKONTO',$this->app->erp->ReplaceKontorahmen(false,$verbindlichkeit_from_db['sachkonto'],false)); $waehrungenselect = $this->app->erp->GetSelect($this->app->erp->GetWaehrung(), $verbindlichkeit_from_db['waehrung']); $this->app->Tpl->Set('WAEHRUNG', $waehrungenselect); @@ -243,11 +327,17 @@ class Verbindlichkeit { $this->app->Tpl->Set('ADRESSE', $this->app->erp->ReplaceAdresse(false,$verbindlichkeit_from_db['adresse'],false)); // Convert ID to form display - $file = urlencode("../../../../index.php?module=verbindlichkeit&action=inlinepdf&id=$id"); - $iframe = ""; - $this->app->Tpl->Set('INLINEPDF', $iframe); + $anzahldateien = $this->app->erp->AnzahlDateien("verbindlichkeit",$id); + if ($anzahldateien > 0) { + $file = urlencode("../../../../index.php?module=verbindlichkeit&action=inlinepdf&id=$id"); + $iframe = ""; + $this->app->Tpl->Set('INLINEPDF', $iframe); + } else { + $this->app->Tpl->Set('INLINEPDF', 'Keine Dateien vorhanden.'); + } $this->app->Tpl->Parse('PAGE', "verbindlichkeit_edit.tpl"); + } /** @@ -263,12 +353,12 @@ class Verbindlichkeit { $input['skonto'] = $this->app->Secure->GetPOST('skonto'); $input['skontobis'] = $this->app->Secure->GetPOST('skontobis'); $input['projekt'] = $this->app->Secure->GetPOST('projekt'); - $input['bezahlt'] = $this->app->Secure->GetPOST('bezahlt'); + $input['bezahlt'] = $this->app->Secure->GetPOST('bezahlt')?'1':'0';; $input['zahlungsweise'] = $this->app->Secure->GetPOST('zahlungsweise'); $input['eingangsdatum'] = $this->app->Secure->GetPOST('eingangsdatum'); $input['rechnungsdatum'] = $this->app->Secure->GetPOST('rechnungsdatum'); - $input['freigabe'] = $this->app->Secure->GetPOST('freigabe'); - $input['rechnungsfreigabe'] = $this->app->Secure->GetPOST('rechnungsfreigabe'); + $input['freigabe'] = $this->app->Secure->GetPOST('freigabe')?'1':'0'; + $input['rechnungsfreigabe'] = $this->app->Secure->GetPOST('rechnungsfreigabe')?'1':'0'; $input['kostenstelle'] = $this->app->Secure->GetPOST('kostenstelle'); $input['sachkonto'] = $this->app->Secure->GetPOST('sachkonto'); $input['internebemerkung'] = $this->app->Secure->GetPOST('internebemerkung'); @@ -283,9 +373,25 @@ class Verbindlichkeit { } else { $anzahldateien=""; } + + if ($id != 'NULL') { + $this->app->erp->MenuEintrag("index.php?module=verbindlichkeit&action=dateien&id=$id", "Dateien".$anzahldateien); + } + $this->app->erp->MenuEintrag("index.php?module=verbindlichkeit&action=edit&id=$id", "Details"); $this->app->erp->MenuEintrag("index.php?module=verbindlichkeit&action=list", "Zurück zur Übersicht"); - $this->app->erp->MenuEintrag("index.php?module=verbindlichkeit&action=dateien&id=$id", "Dateien".$anzahldateien); + + $invoiceArr = $this->app->DB->SelectRow("SELECT v.belegnr, a.name, v.status FROM verbindlichkeit v LEFT JOIN adresse a ON v.adresse = a.id WHERE v.id='$id' LIMIT 1"); + $belegnr = $invoiceArr['belegnr']; + $name = $invoiceArr['name']; + if($belegnr=='0' || $belegnr=='') { + $belegnr ='(Entwurf)'; + } + $this->app->Tpl->Set('KURZUEBERSCHRIFT2',"$name Rechnung $belegnr"); + $status = $invoiceArr['status']; + if ($status==='angelegt') { + $this->app->erp->MenuEintrag("index.php?module=verbindlichkeit&action=freigabe&id=$id",'Freigabe'); + } } function verbindlichkeit_dateien() @@ -402,4 +508,12 @@ class Verbindlichkeit { $this->app->BuildNavigation=false; } + function verbindlichkeit_freigabe() + { + $id = $this->app->Secure->GetGET('id'); + $this->app->erp->BelegFreigabe('verbindlichkeit',$id); + $this->verbindlichkeit_edit(); + } + + } diff --git a/www/widgets/_gen/widget.gen.verbindlichkeit_position.php b/www/widgets/_gen/widget.gen.verbindlichkeit_position.php index 8fe52cc0..71b00ae7 100644 --- a/www/widgets/_gen/widget.gen.verbindlichkeit_position.php +++ b/www/widgets/_gen/widget.gen.verbindlichkeit_position.php @@ -85,10 +85,7 @@ class WidgetGenverbindlichkeit_position $this->form->NewField($field); $this->form->AddMandatory("menge","notempty","Pflichtfeld!","MSGMENGE"); - $field = new HTMLInput("preis","text","","50","","","","","","","","0","",""); - $this->form->NewField($field); - - $field = new HTMLInput("waehrung","text","","15","","","","","","","","0","",""); + $field = new HTMLInput("preis","text","","40","","","","","","","","0","",""); $this->form->NewField($field); $field = new HTMLSelect("umsatzsteuer",0,"umsatzsteuer","","","0"); diff --git a/www/widgets/templates/_gen/verbindlichkeit_position.tpl b/www/widgets/templates/_gen/verbindlichkeit_position.tpl index 24c4ac26..a8923644 100644 --- a/www/widgets/templates/_gen/verbindlichkeit_position.tpl +++ b/www/widgets/templates/_gen/verbindlichkeit_position.tpl @@ -36,8 +36,8 @@ $('#anderersteuersatz').click(function() { if (!$(this).is(':checked')) { {|Artikel-Nr|}:[NUMMER][MSGNUMMER] {|Beschreibung|}:[BESCHREIBUNG][MSGBESCHREIBUNG] {|Menge|}:[MENGE][MSGMENGE] - {|Preis|}:[PREIS][MSGPREIS] - {|Währung|}:[WAEHRUNG][MSGWAEHRUNG] [WAEHRUNGSBUTTON] + {|Preis|}:[PREIS][MSGPREIS][WAEHRUNG] + {|Steuersatz|}:[UMSATZSTEUER][MSGUMSATZSTEUER]  [ANDERERSTEUERSATZ][MSGANDERERSTEUERSATZ] individuellen Steuersatz verwenden