If further information is required for the stationery, such as, for example, the weight or height of an article, you can create your own letterhead for loading.
The file that should load the stationery must be called class.briefpapier_custom.php. This file has to be uploaded in the Xentral folder to www/lib/dokumente and is then valid for all documents.
Tip
You can get the source code from the file in the Open source version.
In the following example, the weight as well as the height, width, length, and region of origin of the item are to be added to the item description of an item.
There is no custom stationery yet, so for the time being the stationery look is set in the default settings:

The first thing to do is to create the class.briefpapier_custom.php file. The basic structure for the custom stationery looks like this:
?php include_once "class.briefpapier.php"; class BriefpapierCustom extends Briefpapier { function __construct(&$app) { $this->app = $app; parent::__construct($app); } } ?>
Next, open the file class.briefpapier.php, which is currently responsible for the layout of the stationery and pick out the function that is to be loaded, copy and paste it under the function "construct". In this case, the function renderItems is to be copied, since this is responsible for the rendering of the item positions. Since the function renderItems function is quite long, this example only shows how the code of class.briefpapier_custom.php then looks like.
?php include_once "class.briefpapier.php"; class BriefpapierCustom extends Briefpapier { function __construct(&$app) { $this->app = $app; parent::__construct($app); } public function renderItems() { $posWidth = $this->app->erp->Firmendaten("breite_position"); $amWidth = $this->app->erp->Firmendaten("breite_menge"); $itemNoWidth = $this->app->erp->Firmendaten("breite_nummer"); ... ... ... } } ?>
Below
if($item['ean']!="" && $item['ean']!="0"){ if($item['desc']!=""){ $item['desc']=$item['desc']."\r\n".$this->app->erp->Beschriftung("dokument_ean").": ".$item['ean']; }else{ $item['desc']=$this->app->erp->Beschriftung("dokument_ean").": ".$item['ean']; } }
the size, height, width, length, and region of origin of the item will be added to the variable $item['desc'], because this variable contains the description text to which further values are added.
The finished section will look like this:
if($item['ean']!="" && $item['ean']!="0"){ if($item['desc']!=""){ $item['desc']=$item['desc']."\r\n".$this->app->erp->Beschriftung("dokument_ean").": ".$item['ean']; }else{ $item['desc']=$this->app->erp->Beschriftung("dokument_ean").": ".$item['ean']; } } $daten = $this->app->DB->SelectArr("SELECT gewicht, laenge, breite, hoehe, ursprungsregion FROM artikel WHERE id = '".$item['artikel']."'"); $daten = reset($daten); if($item['desc'] != ""){ if($daten['gewicht'] != "" AND $daten['gewicht'] > 0){ $item['desc'] = $item['desc']."\r\n"."Gewicht: ".$daten['gewicht']." kg"; } }else{ if($daten['gewicht'] != "" AND $daten['gewicht'] > 0){ $item['desc'] = $item['desc']."Gewicht: ".$daten['gewicht']." kg"; } } if($item['desc'] != ""){ if($daten['laenge'] != "" AND $daten['laenge'] > 0){ $item['desc'] = $item['desc']."\r\n"."Länge: ".$daten['laenge']." cm"; } }else{ if($daten['laenge'] != "" AND $daten['laenge'] > 0){ $item['desc'] = $item['desc']."Länge: ".$daten['laenge']." cm"; } } if($item['desc'] != ""){ if($daten['breite'] != "" AND $daten['breite'] > 0){ $item['desc'] = $item['desc']."\r\n"."Breite: ".$daten['breite']." cm"; } }else{ if($daten['breite'] != "" AND $daten['breite'] > 0){ $item['desc'] = $item['desc']."Breite: ".$daten['breite']." cm"; } } if($item['desc'] != ""){ if($daten['hoehe'] != "" AND $daten['hoehe'] > 0){ $item['desc'] = $item['desc']."\r\n"."Höhe: ".$daten['hoehe']." cm"; } }else{ if($daten['hoehe'] != "" AND $daten['hoehe' > 0]){ $item['desc'] = $item['desc']."Höhe: ".$daten['hoehe']." cm"; } } $ursprungsregion = ""; switch($daten['ursprungsregion']){ case "01": $ursprungsregion = "Schleswig-Holstein"; break; case "02": $ursprungsregion = "Hamburg"; break; case "03": $ursprungsregion = "Niedersachsen"; break; case "04": $ursprungsregion = "Bremen"; break; case "05": $ursprungsregion = "Nordrhein-Westfalen"; break; case "06": $ursprungsregion = "Hessen"; break; case "07": $ursprungsregion = "Rheinland-Pfalz"; break; case "08": $ursprungsregion = "Baden-Württemberg"; break; case "09": $ursprungsregion = "Bayern"; break; case "10": $ursprungsregion = "Saarland"; break; case "11": $ursprungsregion = "Berlin"; break; case "12": $ursprungsregion = "Brandenburg"; break; case "13": $ursprungsregion = "Mecklenburg-Vorpommern"; break; case "14": $ursprungsregion = "Sachsen"; break; case "15": $ursprungsregion = "Sachsen-Anhalt"; break; case "16": $ursprungsregion = "Thüringen"; break; case "99": $ursprungsregion = "ausländischer Ursprung"; break; } if($item['desc'] != ""){ if($ursprungsregion != ""){ $item['desc'] = $item['desc']."\r\n"."Ursprungsregion: ".$ursprungsregion; } }else{ if($ursprungsregion != ""){ $item['desc'] = $item['desc']."Ursprungsregion: ".$ursprungsregion; } }
The result now looks like this:

Furthermore, there is the possibility to overload only certain documents. In the following example, the next, i.e. smallest, best-before date from the warehouse for an item is to be added to the item description, expiration date from the warehouse for this article is to be displayed on a picking. For this purpose, the delivery bill must be loaded, because the pick note is also created with the class.lieferschein.php. To load the class.lieferschein.php file, a file named class.lieferschein_custom.php has to be created and put it into the xentralsordner after www/lib/dokumente. Up to now, there is no class.lieferschein_custom.php file, so the picking note looks like this:

The basic structure of the file looks like this:
?php if(!class_exists('BriefpapierCustom')) { class BriefpapierCustom extends Briefpapier { } } class LieferscheinPDFCustom extends BriefpapierCustom { public $doctype; function __construct($app,$projekt="") { $this->app=&$app; //parent::Briefpapier(); $this->doctype="lieferschein"; $this->doctypeOrig="Lieferschein"; parent::__construct($this->app,$projekt); } } ?>
Next, find the appropriate function to load in class.lieferschein.php. In this case, it is the function GetLieferschein. This function is copied and pasted under the constructor "construct". Because the GetLieferschein function is quite long, we will only show here what the file currently looks like:
?php if(!class_exists('BriefpapierCustom')) { class BriefpapierCustom extends Briefpapier { } } class LieferscheinPDFCustom extends BriefpapierCustom { public $doctype; function __construct($app,$projekt="") { $this->app=&$app; //parent::Briefpapier(); $this->doctype="lieferschein"; $this->doctypeOrig="Lieferschein"; parent::__construct($this->app,$projekt); } function GetLieferschein($id,$info="",$extrafreitext="") { $this->doctypeid = $id; if(method_exists($this->app->erp,'LieferscheinSeriennummernberechnen'))$this->app->erp->LieferscheinSeriennummernberechnen($id); $briefpapier_bearbeiter_ausblenden = $this->app->erp->Firmendaten('briefpapier_bearbeiter_ausblenden'); $briefpapier_vertrieb_ausblenden = $this->app->erp->Firmendaten('briefpapier_vertrieb_ausblenden'); $adresse = $this->app->DB->Select("SELECT adresse FROM lieferschein WHERE id='$id' LIMIT 1"); ... ... ... } } ?>
Now the adjustments are made in the code. If these would now simply be added these would be valid for delivery bills and picking bills. However, here only the picking slips are to be adjusted, which is why it is checked beforehand with an if statement, whether it is a pick ticket or not. The changes are made under
/* if(!empty($chargen)){ foreach($chargen as $chargen=>$charge){ $chargenliste = $chargenliste.$charge['charge'].";"; } $chargenliste=substr($chargenliste, 0, -1); $value['chargen'] = $this->app->DB->Select("SELECT chargenverwaltung FROM artikel WHERE id='".$value[artikel]."' LIMIT 1"); if($value['chargen']=="0"){ $value['beschreibung'] = $value['beschreibung']; }else{ $value['beschreibung'] = $value['beschreibung']."\r\n".$this->app->erp->Beschriftung("dokument_charge").": ". $chargenliste; } } */
added. The whole thing will look like this:
if($info=="kommissionierschein"){ if($value['freifeld1']!=""){ //$value['beschreibung'] .= "\r\n"."Bitte folgendes MHD wählen: ".$value['freifeld1']; }else{ $mhd=$this->app->DB->Select("SELECT MIN(mhddatum) FROM lager_mindesthaltbarkeitsdatum WHERE artikel= '".$value['artikel']."' AND mhddatum > CURDATE()"); $value['beschreibung'].="\r\n"."Kleinstes MHD im Lager: ".$mhd; } }
Final result:
