diff --git a/tools/module_creator/module_creator_php_template.txt b/tools/module_creator/module_creator_php_template.txt index 693723a0..51402e00 100644 --- a/tools/module_creator/module_creator_php_template.txt +++ b/tools/module_creator/module_creator_php_template.txt @@ -41,6 +41,10 @@ class PLACEHOLDER_MODULECLASSNAME { $defaultorder = 1; $defaultorderdesc = 0; + $aligncenter = array(); + $alignright = array(); + $numbercols = array(); + $sumcol = array(); $dropnbox = "PLACEHOLDER_DROPNBOX"; @@ -159,11 +163,17 @@ class PLACEHOLDER_MODULECLASSNAME { // Load values again from database $dropnbox = "PLACEHOLDER_DROPNBOX"; - $result = $this->app->DB->SelectArr("PLACEHOLDER_SQL_LIST"." WHERE id=$id"); + $result = $this->app->DB->SelectArr("PLACEHOLDER_SQL_LIST"." WHERE id=$id"); foreach ($result[0] as $key => $value) { $this->app->Tpl->Set(strtoupper($key), $value); } + + if (!empty($result)) { + $PLACEHOLDER_MODULENAME_from_db = $result[0]; + } else { + return; + } /* * Add displayed items later @@ -177,7 +187,6 @@ class PLACEHOLDER_MODULECLASSNAME { */ -// $this->SetInput($input); $this->app->Tpl->Parse('PAGE', "PLACEHOLDER_MODULENAME_edit.tpl"); } diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index 22adef90..b26ef436 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -2676,7 +2676,7 @@ public function NavigationHooks(&$menu) // @refactor in Dateien Modul function AnzahlDateien($objekt,$id) { - return $this->app->DB->Select("SELECT COUNT(id) FROM datei_stichwoerter WHERE objekt='$objekt' AND parameter='$id'"); + return $this->app->DB->Select("SELECT COUNT(ds.id) FROM datei_stichwoerter ds INNER JOIN datei d ON d.id = ds.datei WHERE ds.objekt='$objekt' AND ds.parameter='$id' AND d.geloescht <> 1"); } @@ -37298,7 +37298,7 @@ function Firmendaten($field,$projekt="") function GetDateiSubjektObjekt($subjekt,$objekt,$parameter) { - $dateien = $this->app->DB->SelectArr("SELECT datei FROM datei_stichwoerter WHERE subjekt LIKE '$subjekt' AND objekt LIKE '$objekt' AND parameter='$parameter' GROUP by datei"); + $dateien = $this->app->DB->SelectArr("SELECT datei FROM datei_stichwoerter INNER JOIN datei d on d.id = datei WHERE subjekt LIKE '$subjekt' AND objekt LIKE '$objekt' AND parameter='$parameter' AND d.geloescht <> 1 GROUP by datei"); if(empty($dateien)) { return null; } diff --git a/www/pages/_gen/adresse.php b/www/pages/_gen/adresse.php index 1dbb44b8..bf3fe3f9 100644 --- a/www/pages/_gen/adresse.php +++ b/www/pages/_gen/adresse.php @@ -1,59 +1,59 @@ -app=&$app; - $this->app->ActionHandlerInit($this); - - $this->app->ActionHandler("create","AdresseCreate"); - $this->app->ActionHandler("edit","AdresseEdit"); - $this->app->ActionHandler("copy","AdresseCopy"); - $this->app->ActionHandler("list","AdresseList"); - $this->app->ActionHandler("delete","AdresseDelete"); - - $this->app->Tpl->Set("HEADING","Adresse"); //$this->app->ActionHandlerListen($app); - } - - function AdresseCreate(){ - $this->app->Tpl->Set("HEADING","Adresse (Anlegen)"); - $this->app->PageBuilder->CreateGen("adresse_create.tpl"); - } - - function AdresseEdit(){ - $this->app->Tpl->Set("HEADING","Adresse (Bearbeiten)"); - $this->app->PageBuilder->CreateGen("adresse_edit.tpl"); - } - - function AdresseCopy(){ - $this->app->Tpl->Set("HEADING","Adresse (Kopieren)"); - $this->app->PageBuilder->CreateGen("adresse_copy.tpl"); - } - - function AdresseDelete(){ - $this->app->Tpl->Set("HEADING","Adresse (Löschen)"); - $this->app->PageBuilder->CreateGen("adresse_delete.tpl"); - } - - function AdresseList(){ - $this->app->Tpl->Set("HEADING","Adresse (Übersicht)"); - $this->app->PageBuilder->CreateGen("adresse_list.tpl"); - } - -} -?> \ No newline at end of file +app=&$app; + $this->app->ActionHandlerInit($this); + + $this->app->ActionHandler("create","AdresseCreate"); + $this->app->ActionHandler("edit","AdresseEdit"); + $this->app->ActionHandler("copy","AdresseCopy"); + $this->app->ActionHandler("list","AdresseList"); + $this->app->ActionHandler("delete","AdresseDelete"); + + $this->app->Tpl->Set("HEADING","Adresse"); //$this->app->ActionHandlerListen($app); + } + + function AdresseCreate(){ + $this->app->Tpl->Set("HEADING","Adresse (Anlegen)"); + $this->app->PageBuilder->CreateGen("adresse_create.tpl"); + } + + function AdresseEdit(){ + $this->app->Tpl->Set("HEADING","Adresse (Bearbeiten)"); + $this->app->PageBuilder->CreateGen("adresse_edit.tpl"); + } + + function AdresseCopy(){ + $this->app->Tpl->Set("HEADING","Adresse (Kopieren)"); + $this->app->PageBuilder->CreateGen("adresse_copy.tpl"); + } + + function AdresseDelete(){ + $this->app->Tpl->Set("HEADING","Adresse (Löschen)"); + $this->app->PageBuilder->CreateGen("adresse_delete.tpl"); + } + + function AdresseList(){ + $this->app->Tpl->Set("HEADING","Adresse (Übersicht)"); + $this->app->PageBuilder->CreateGen("adresse_list.tpl"); + } + +} +?> diff --git a/www/pages/ajax.php b/www/pages/ajax.php index 7c9ae905..6eda4979 100644 --- a/www/pages/ajax.php +++ b/www/pages/ajax.php @@ -674,6 +674,7 @@ class Ajax { echo $str; exit; } + if(!empty($datei['parameter'])) { if($cmd === 'projekt') { if(!$this->app->erp->UserProjektRecht($datei['parameter'])) { @@ -707,8 +708,7 @@ class Ajax { } } } - //Rechte prüfen - + //Rechte prüfen $userdata = isset($this->app->Conf->WFuserdata) ?$this->app->Conf->WFuserdata :(str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']).'../userdata'); @@ -746,34 +746,17 @@ class Ajax { exit; break; case 'application/pdf': - $str = file_get_contents(dirname(__DIR__) . '/themes/new/images/pdf.svg'); + $str = file_get_contents(dirname(__DIR__) . '/themes/new/images/pdf.png'); header('Content-type: image/png'); echo $str; exit; break; - default: - $str = file_get_contents(dirname(__DIR__) . '/themes/new/images/pdf.svg'); - if(substr(strtolower($datei['dateiname']),-4) === '.gif'){ - header('Content-type: image/gif'); - echo $str; - exit; - } - if(substr(strtolower($datei['dateiname']),-4) === '.png'){ - header('Content-type: image/png'); - echo $str; - exit; - } - if(substr(strtolower($datei['dateiname']),-4) === '.jpg' - || substr(strtolower($datei['dateiname']),-4) === 'jpeg'){ - header('Content-type: image/jpg'); - echo $str; - exit; - } + default: break; } } } - + if(file_exists($cachefolder.'/'.$datei['id'].'_100_100')) { $type = is_file($path.'/'.$datei['id'])? false : mime_content_type($path.'/'.$datei['id']); if($type === false) { diff --git a/www/pages/content/verbindlichkeit_edit.tpl b/www/pages/content/verbindlichkeit_edit.tpl new file mode 100644 index 00000000..5490fa4d --- /dev/null +++ b/www/pages/content/verbindlichkeit_edit.tpl @@ -0,0 +1,188 @@ +
+ + +
+ [MESSAGE] +
+ [FORMHANDLEREVENT] +
+
+
+
+
+
+
+
+
+ {|Verbindlichkeit [BELEGNR] Lf-Nr. [LIEFERANTENNUMMER]|} + [STATUSICONS] +
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {|Adresse|}: + + +
+ {|Rechnung|}: + + +
+ {|Rechnungsdatum|}: + + +
+ {|Betrag|}: + + + +
+ {|Zahlbarbis|}: + + +
+ {|Projekt|}: + + +
+ {|Eingangsdatum|}: + + +
+ {|Zahlungsweise|}: + + +
+ {|Skonto|}: + + +
+ {|Skontobis|}: + + +
+ {|Kostenstelle|}: + + +
+ {|Sachkonto|}: + + +
+ {|Waren-/Leistungsprüfung (Einkauf)|}: + + +
+ {|Rechnungseingangsprüfung (Buchhaltung)|}: + + +
+ {|Bezahlt|}: + + +
+ {|Internebemerkung|}: + + +
+
+
+
+
+
+
+
+
+
+
+ {|Vorschau|} + [INLINEPDF] +
+
+
+
+
+ +
+
+
+ diff --git a/www/pages/verbindlichkeit.php b/www/pages/verbindlichkeit.php index bcddb1f3..290b8231 100644 --- a/www/pages/verbindlichkeit.php +++ b/www/pages/verbindlichkeit.php @@ -18,6 +18,8 @@ class Verbindlichkeit { $this->app->ActionHandler("create", "verbindlichkeit_edit"); // This automatically adds a "New" button $this->app->ActionHandler("edit", "verbindlichkeit_edit"); $this->app->ActionHandler("delete", "verbindlichkeit_delete"); + $this->app->ActionHandler("dateien", "verbindlichkeit_dateien"); + $this->app->ActionHandler("inlinepdf", "verbindlichkeit_inlinepdf"); $this->app->DefaultActionHandler("list"); $this->app->ActionHandlerListen($app); } @@ -63,6 +65,7 @@ class Verbindlichkeit { $defaultorder = 1; $defaultorderdesc = 0; $alignright = array(8); + $sumcol = array(8); $dropnbox = "'' AS `open`, CONCAT('') AS `auswahl`"; @@ -143,9 +146,8 @@ class Verbindlichkeit { $this->app->Tpl->Set('ID', $id); - $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"); - $id = $this->app->Secure->GetGET('id'); + $this->verbindlichkeit_menu($id); + $input = $this->GetInput(); $submit = $this->app->Secure->GetPOST('submit'); @@ -162,6 +164,7 @@ class Verbindlichkeit { // Add checks here // $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? $columns = "id, "; $values = "$id, "; @@ -198,12 +201,17 @@ class Verbindlichkeit { // Load values again from database $dropnbox = "'' AS `open`, CONCAT('') AS `auswahl`"; - $result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS v.id, $dropnbox, v.belegnr, v.status_beleg, v.schreibschutz, v.rechnung, v.zahlbarbis, v.betrag, v.umsatzsteuer, v.ustid, v.summenormal, v.summeermaessigt, v.summesatz3, v.summesatz4, v.steuersatzname3, v.steuersatzname4, v.skonto, v.skontobis, v.skontofestsetzen, v.freigabe, v.freigabemitarbeiter, v.bestellung, v.adresse, v.projekt, v.teilprojekt, v.auftrag, v.status, v.bezahlt, v.kontoauszuege, v.firma, v.logdatei, v.bestellung1, v.bestellung1betrag, v.bestellung1bemerkung, v.bestellung1projekt, v.bestellung1kostenstelle, v.bestellung1auftrag, v.bestellung2, v.bestellung2betrag, v.bestellung2bemerkung, v.bestellung2kostenstelle, v.bestellung2auftrag, v.bestellung2projekt, v.bestellung3, v.bestellung3betrag, v.bestellung3bemerkung, v.bestellung3kostenstelle, v.bestellung3auftrag, v.bestellung3projekt, v.bestellung4, v.bestellung4betrag, v.bestellung4bemerkung, v.bestellung4kostenstelle, v.bestellung4auftrag, v.bestellung4projekt, v.bestellung5, v.bestellung5betrag, v.bestellung5bemerkung, v.bestellung5kostenstelle, v.bestellung5auftrag, v.bestellung5projekt, v.bestellung6, v.bestellung6betrag, v.bestellung6bemerkung, v.bestellung6kostenstelle, v.bestellung6auftrag, v.bestellung6projekt, v.bestellung7, v.bestellung7betrag, v.bestellung7bemerkung, v.bestellung7kostenstelle, v.bestellung7auftrag, v.bestellung7projekt, v.bestellung8, v.bestellung8betrag, v.bestellung8bemerkung, v.bestellung8kostenstelle, v.bestellung8auftrag, v.bestellung8projekt, v.bestellung9, v.bestellung9betrag, v.bestellung9bemerkung, v.bestellung9kostenstelle, v.bestellung9auftrag, v.bestellung9projekt, v.bestellung10, v.bestellung10betrag, v.bestellung10bemerkung, v.bestellung10kostenstelle, v.bestellung10auftrag, v.bestellung10projekt, v.bestellung11, v.bestellung11betrag, v.bestellung11bemerkung, v.bestellung11kostenstelle, v.bestellung11auftrag, v.bestellung11projekt, v.bestellung12, v.bestellung12betrag, v.bestellung12bemerkung, v.bestellung12projekt, v.bestellung12kostenstelle, v.bestellung12auftrag, v.bestellung13, v.bestellung13betrag, v.bestellung13bemerkung, v.bestellung13kostenstelle, v.bestellung13auftrag, v.bestellung13projekt, v.bestellung14, v.bestellung14betrag, v.bestellung14bemerkung, v.bestellung14kostenstelle, v.bestellung14auftrag, v.bestellung14projekt, v.bestellung15, v.bestellung15betrag, v.bestellung15bemerkung, v.bestellung15kostenstelle, v.bestellung15auftrag, v.bestellung15projekt, v.waehrung, v.zahlungsweise, v.eingangsdatum, v.buha_konto1, v.buha_belegfeld1, v.buha_betrag1, v.buha_konto2, v.buha_belegfeld2, v.buha_betrag2, v.buha_konto3, v.buha_belegfeld3, v.buha_betrag3, v.buha_konto4, v.buha_belegfeld4, v.buha_betrag4, v.buha_konto5, v.buha_belegfeld5, v.buha_betrag5, v.rechnungsdatum, v.rechnungsfreigabe, v.kostenstelle, v.beschreibung, v.sachkonto, v.art, v.verwendungszweck, v.dta_datei, v.frachtkosten, v.internebemerkung, v.ustnormal, v.ustermaessigt, v.uststuer3, v.uststuer4, v.betragbezahlt, v.bezahltam, v.klaerfall, v.klaergrund, v.skonto_erhalten, v.kurs, v.sprache, v.id FROM verbindlichkeit v"." WHERE id=$id"); + $result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS v.id, $dropnbox, v.belegnr, v.status_beleg, v.schreibschutz, v.rechnung, v.zahlbarbis, v.betrag, v.umsatzsteuer, v.ustid, v.summenormal, v.summeermaessigt, v.summesatz3, v.summesatz4, v.steuersatzname3, v.steuersatzname4, v.skonto, v.skontobis, v.skontofestsetzen, v.freigabe, v.freigabemitarbeiter, v.bestellung, v.adresse, v.projekt, v.teilprojekt, v.auftrag, v.status, v.bezahlt, v.kontoauszuege, v.firma, v.logdatei, v.bestellung1, v.bestellung1betrag, v.bestellung1bemerkung, v.bestellung1projekt, v.bestellung1kostenstelle, v.bestellung1auftrag, v.bestellung2, v.bestellung2betrag, v.bestellung2bemerkung, v.bestellung2kostenstelle, v.bestellung2auftrag, v.bestellung2projekt, v.bestellung3, v.bestellung3betrag, v.bestellung3bemerkung, v.bestellung3kostenstelle, v.bestellung3auftrag, v.bestellung3projekt, v.bestellung4, v.bestellung4betrag, v.bestellung4bemerkung, v.bestellung4kostenstelle, v.bestellung4auftrag, v.bestellung4projekt, v.bestellung5, v.bestellung5betrag, v.bestellung5bemerkung, v.bestellung5kostenstelle, v.bestellung5auftrag, v.bestellung5projekt, v.bestellung6, v.bestellung6betrag, v.bestellung6bemerkung, v.bestellung6kostenstelle, v.bestellung6auftrag, v.bestellung6projekt, v.bestellung7, v.bestellung7betrag, v.bestellung7bemerkung, v.bestellung7kostenstelle, v.bestellung7auftrag, v.bestellung7projekt, v.bestellung8, v.bestellung8betrag, v.bestellung8bemerkung, v.bestellung8kostenstelle, v.bestellung8auftrag, v.bestellung8projekt, v.bestellung9, v.bestellung9betrag, v.bestellung9bemerkung, v.bestellung9kostenstelle, v.bestellung9auftrag, v.bestellung9projekt, v.bestellung10, v.bestellung10betrag, v.bestellung10bemerkung, v.bestellung10kostenstelle, v.bestellung10auftrag, v.bestellung10projekt, v.bestellung11, v.bestellung11betrag, v.bestellung11bemerkung, v.bestellung11kostenstelle, v.bestellung11auftrag, v.bestellung11projekt, v.bestellung12, v.bestellung12betrag, v.bestellung12bemerkung, v.bestellung12projekt, v.bestellung12kostenstelle, v.bestellung12auftrag, v.bestellung13, v.bestellung13betrag, v.bestellung13bemerkung, v.bestellung13kostenstelle, v.bestellung13auftrag, v.bestellung13projekt, v.bestellung14, v.bestellung14betrag, v.bestellung14bemerkung, v.bestellung14kostenstelle, v.bestellung14auftrag, v.bestellung14projekt, v.bestellung15, v.bestellung15betrag, v.bestellung15bemerkung, v.bestellung15kostenstelle, v.bestellung15auftrag, v.bestellung15projekt, v.waehrung, v.zahlungsweise, v.eingangsdatum, v.buha_konto1, v.buha_belegfeld1, v.buha_betrag1, v.buha_konto2, v.buha_belegfeld2, v.buha_betrag2, v.buha_konto3, v.buha_belegfeld3, v.buha_betrag3, v.buha_konto4, v.buha_belegfeld4, v.buha_betrag4, v.buha_konto5, v.buha_belegfeld5, v.buha_betrag5, v.rechnungsdatum, v.rechnungsfreigabe, v.kostenstelle, v.beschreibung, v.sachkonto, v.art, v.verwendungszweck, v.dta_datei, v.frachtkosten, v.internebemerkung, v.ustnormal, v.ustermaessigt, v.uststuer3, v.uststuer4, v.betragbezahlt, v.bezahltam, v.klaerfall, v.klaergrund, v.skonto_erhalten, v.kurs, v.sprache, v.id, a.lieferantennummer, a.name AS adresse_name FROM verbindlichkeit v LEFT JOIN adresse a ON a.id = v.adresse"." WHERE v.id=$id"); foreach ($result[0] as $key => $value) { $this->app->Tpl->Set(strtoupper($key), $value); } - + + if (!empty($result[0])) { + $verbindlichkeit_from_db = $result[0]; + } + + /* * Add displayed items later * @@ -211,12 +219,29 @@ class Verbindlichkeit { $this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email); $this->app->Tpl->Add('EMAIL', $email); $this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername); - $this->app->YUI->AutoComplete("artikel", "artikelnummer"); */ -// $this->SetInput($input); + $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"; + $icons = $this->app->DB->SelectArr($sql); + $this->app->Tpl->Add('STATUSICONS', $icons[0]['icons']); + + $this->app->YUI->AutoComplete("adresse", "adresse"); + + $waehrungenselect = $this->app->erp->GetSelect($this->app->erp->GetWaehrung(), $verbindlichkeit_from_db['waehrung']); + $this->app->Tpl->Set('WAEHRUNG', $waehrungenselect); + + $this->app->Tpl->Set('ADRESSE_ID', $verbindlichkeit_from_db['adresse']); + + $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); + $this->app->Tpl->Parse('PAGE', "verbindlichkeit_edit.tpl"); } @@ -225,168 +250,84 @@ class Verbindlichkeit { */ public function GetInput(): array { $input = array(); - //$input['EMAIL'] = $this->app->Secure->GetPOST('email'); - - $input['belegnr'] = $this->app->Secure->GetPOST('belegnr'); - $input['status_beleg'] = $this->app->Secure->GetPOST('status_beleg'); - $input['schreibschutz'] = $this->app->Secure->GetPOST('schreibschutz'); - $input['rechnung'] = $this->app->Secure->GetPOST('rechnung'); - $input['zahlbarbis'] = $this->app->Secure->GetPOST('zahlbarbis'); - $input['betrag'] = $this->app->Secure->GetPOST('betrag'); - $input['umsatzsteuer'] = $this->app->Secure->GetPOST('umsatzsteuer'); - $input['ustid'] = $this->app->Secure->GetPOST('ustid'); - $input['summenormal'] = $this->app->Secure->GetPOST('summenormal'); - $input['summeermaessigt'] = $this->app->Secure->GetPOST('summeermaessigt'); - $input['summesatz3'] = $this->app->Secure->GetPOST('summesatz3'); - $input['summesatz4'] = $this->app->Secure->GetPOST('summesatz4'); - $input['steuersatzname3'] = $this->app->Secure->GetPOST('steuersatzname3'); - $input['steuersatzname4'] = $this->app->Secure->GetPOST('steuersatzname4'); - $input['skonto'] = $this->app->Secure->GetPOST('skonto'); - $input['skontobis'] = $this->app->Secure->GetPOST('skontobis'); - $input['skontofestsetzen'] = $this->app->Secure->GetPOST('skontofestsetzen'); - $input['freigabe'] = $this->app->Secure->GetPOST('freigabe'); - $input['freigabemitarbeiter'] = $this->app->Secure->GetPOST('freigabemitarbeiter'); - $input['bestellung'] = $this->app->Secure->GetPOST('bestellung'); - $input['adresse'] = $this->app->Secure->GetPOST('adresse'); - $input['projekt'] = $this->app->Secure->GetPOST('projekt'); - $input['teilprojekt'] = $this->app->Secure->GetPOST('teilprojekt'); - $input['auftrag'] = $this->app->Secure->GetPOST('auftrag'); - $input['status'] = $this->app->Secure->GetPOST('status'); - $input['bezahlt'] = $this->app->Secure->GetPOST('bezahlt'); - $input['kontoauszuege'] = $this->app->Secure->GetPOST('kontoauszuege'); - $input['firma'] = $this->app->Secure->GetPOST('firma'); - $input['logdatei'] = $this->app->Secure->GetPOST('logdatei'); - $input['bestellung1'] = $this->app->Secure->GetPOST('bestellung1'); - $input['bestellung1betrag'] = $this->app->Secure->GetPOST('bestellung1betrag'); - $input['bestellung1bemerkung'] = $this->app->Secure->GetPOST('bestellung1bemerkung'); - $input['bestellung1projekt'] = $this->app->Secure->GetPOST('bestellung1projekt'); - $input['bestellung1kostenstelle'] = $this->app->Secure->GetPOST('bestellung1kostenstelle'); - $input['bestellung1auftrag'] = $this->app->Secure->GetPOST('bestellung1auftrag'); - $input['bestellung2'] = $this->app->Secure->GetPOST('bestellung2'); - $input['bestellung2betrag'] = $this->app->Secure->GetPOST('bestellung2betrag'); - $input['bestellung2bemerkung'] = $this->app->Secure->GetPOST('bestellung2bemerkung'); - $input['bestellung2kostenstelle'] = $this->app->Secure->GetPOST('bestellung2kostenstelle'); - $input['bestellung2auftrag'] = $this->app->Secure->GetPOST('bestellung2auftrag'); - $input['bestellung2projekt'] = $this->app->Secure->GetPOST('bestellung2projekt'); - $input['bestellung3'] = $this->app->Secure->GetPOST('bestellung3'); - $input['bestellung3betrag'] = $this->app->Secure->GetPOST('bestellung3betrag'); - $input['bestellung3bemerkung'] = $this->app->Secure->GetPOST('bestellung3bemerkung'); - $input['bestellung3kostenstelle'] = $this->app->Secure->GetPOST('bestellung3kostenstelle'); - $input['bestellung3auftrag'] = $this->app->Secure->GetPOST('bestellung3auftrag'); - $input['bestellung3projekt'] = $this->app->Secure->GetPOST('bestellung3projekt'); - $input['bestellung4'] = $this->app->Secure->GetPOST('bestellung4'); - $input['bestellung4betrag'] = $this->app->Secure->GetPOST('bestellung4betrag'); - $input['bestellung4bemerkung'] = $this->app->Secure->GetPOST('bestellung4bemerkung'); - $input['bestellung4kostenstelle'] = $this->app->Secure->GetPOST('bestellung4kostenstelle'); - $input['bestellung4auftrag'] = $this->app->Secure->GetPOST('bestellung4auftrag'); - $input['bestellung4projekt'] = $this->app->Secure->GetPOST('bestellung4projekt'); - $input['bestellung5'] = $this->app->Secure->GetPOST('bestellung5'); - $input['bestellung5betrag'] = $this->app->Secure->GetPOST('bestellung5betrag'); - $input['bestellung5bemerkung'] = $this->app->Secure->GetPOST('bestellung5bemerkung'); - $input['bestellung5kostenstelle'] = $this->app->Secure->GetPOST('bestellung5kostenstelle'); - $input['bestellung5auftrag'] = $this->app->Secure->GetPOST('bestellung5auftrag'); - $input['bestellung5projekt'] = $this->app->Secure->GetPOST('bestellung5projekt'); - $input['bestellung6'] = $this->app->Secure->GetPOST('bestellung6'); - $input['bestellung6betrag'] = $this->app->Secure->GetPOST('bestellung6betrag'); - $input['bestellung6bemerkung'] = $this->app->Secure->GetPOST('bestellung6bemerkung'); - $input['bestellung6kostenstelle'] = $this->app->Secure->GetPOST('bestellung6kostenstelle'); - $input['bestellung6auftrag'] = $this->app->Secure->GetPOST('bestellung6auftrag'); - $input['bestellung6projekt'] = $this->app->Secure->GetPOST('bestellung6projekt'); - $input['bestellung7'] = $this->app->Secure->GetPOST('bestellung7'); - $input['bestellung7betrag'] = $this->app->Secure->GetPOST('bestellung7betrag'); - $input['bestellung7bemerkung'] = $this->app->Secure->GetPOST('bestellung7bemerkung'); - $input['bestellung7kostenstelle'] = $this->app->Secure->GetPOST('bestellung7kostenstelle'); - $input['bestellung7auftrag'] = $this->app->Secure->GetPOST('bestellung7auftrag'); - $input['bestellung7projekt'] = $this->app->Secure->GetPOST('bestellung7projekt'); - $input['bestellung8'] = $this->app->Secure->GetPOST('bestellung8'); - $input['bestellung8betrag'] = $this->app->Secure->GetPOST('bestellung8betrag'); - $input['bestellung8bemerkung'] = $this->app->Secure->GetPOST('bestellung8bemerkung'); - $input['bestellung8kostenstelle'] = $this->app->Secure->GetPOST('bestellung8kostenstelle'); - $input['bestellung8auftrag'] = $this->app->Secure->GetPOST('bestellung8auftrag'); - $input['bestellung8projekt'] = $this->app->Secure->GetPOST('bestellung8projekt'); - $input['bestellung9'] = $this->app->Secure->GetPOST('bestellung9'); - $input['bestellung9betrag'] = $this->app->Secure->GetPOST('bestellung9betrag'); - $input['bestellung9bemerkung'] = $this->app->Secure->GetPOST('bestellung9bemerkung'); - $input['bestellung9kostenstelle'] = $this->app->Secure->GetPOST('bestellung9kostenstelle'); - $input['bestellung9auftrag'] = $this->app->Secure->GetPOST('bestellung9auftrag'); - $input['bestellung9projekt'] = $this->app->Secure->GetPOST('bestellung9projekt'); - $input['bestellung10'] = $this->app->Secure->GetPOST('bestellung10'); - $input['bestellung10betrag'] = $this->app->Secure->GetPOST('bestellung10betrag'); - $input['bestellung10bemerkung'] = $this->app->Secure->GetPOST('bestellung10bemerkung'); - $input['bestellung10kostenstelle'] = $this->app->Secure->GetPOST('bestellung10kostenstelle'); - $input['bestellung10auftrag'] = $this->app->Secure->GetPOST('bestellung10auftrag'); - $input['bestellung10projekt'] = $this->app->Secure->GetPOST('bestellung10projekt'); - $input['bestellung11'] = $this->app->Secure->GetPOST('bestellung11'); - $input['bestellung11betrag'] = $this->app->Secure->GetPOST('bestellung11betrag'); - $input['bestellung11bemerkung'] = $this->app->Secure->GetPOST('bestellung11bemerkung'); - $input['bestellung11kostenstelle'] = $this->app->Secure->GetPOST('bestellung11kostenstelle'); - $input['bestellung11auftrag'] = $this->app->Secure->GetPOST('bestellung11auftrag'); - $input['bestellung11projekt'] = $this->app->Secure->GetPOST('bestellung11projekt'); - $input['bestellung12'] = $this->app->Secure->GetPOST('bestellung12'); - $input['bestellung12betrag'] = $this->app->Secure->GetPOST('bestellung12betrag'); - $input['bestellung12bemerkung'] = $this->app->Secure->GetPOST('bestellung12bemerkung'); - $input['bestellung12projekt'] = $this->app->Secure->GetPOST('bestellung12projekt'); - $input['bestellung12kostenstelle'] = $this->app->Secure->GetPOST('bestellung12kostenstelle'); - $input['bestellung12auftrag'] = $this->app->Secure->GetPOST('bestellung12auftrag'); - $input['bestellung13'] = $this->app->Secure->GetPOST('bestellung13'); - $input['bestellung13betrag'] = $this->app->Secure->GetPOST('bestellung13betrag'); - $input['bestellung13bemerkung'] = $this->app->Secure->GetPOST('bestellung13bemerkung'); - $input['bestellung13kostenstelle'] = $this->app->Secure->GetPOST('bestellung13kostenstelle'); - $input['bestellung13auftrag'] = $this->app->Secure->GetPOST('bestellung13auftrag'); - $input['bestellung13projekt'] = $this->app->Secure->GetPOST('bestellung13projekt'); - $input['bestellung14'] = $this->app->Secure->GetPOST('bestellung14'); - $input['bestellung14betrag'] = $this->app->Secure->GetPOST('bestellung14betrag'); - $input['bestellung14bemerkung'] = $this->app->Secure->GetPOST('bestellung14bemerkung'); - $input['bestellung14kostenstelle'] = $this->app->Secure->GetPOST('bestellung14kostenstelle'); - $input['bestellung14auftrag'] = $this->app->Secure->GetPOST('bestellung14auftrag'); - $input['bestellung14projekt'] = $this->app->Secure->GetPOST('bestellung14projekt'); - $input['bestellung15'] = $this->app->Secure->GetPOST('bestellung15'); - $input['bestellung15betrag'] = $this->app->Secure->GetPOST('bestellung15betrag'); - $input['bestellung15bemerkung'] = $this->app->Secure->GetPOST('bestellung15bemerkung'); - $input['bestellung15kostenstelle'] = $this->app->Secure->GetPOST('bestellung15kostenstelle'); - $input['bestellung15auftrag'] = $this->app->Secure->GetPOST('bestellung15auftrag'); - $input['bestellung15projekt'] = $this->app->Secure->GetPOST('bestellung15projekt'); - $input['waehrung'] = $this->app->Secure->GetPOST('waehrung'); - $input['zahlungsweise'] = $this->app->Secure->GetPOST('zahlungsweise'); - $input['eingangsdatum'] = $this->app->Secure->GetPOST('eingangsdatum'); - $input['buha_konto1'] = $this->app->Secure->GetPOST('buha_konto1'); - $input['buha_belegfeld1'] = $this->app->Secure->GetPOST('buha_belegfeld1'); - $input['buha_betrag1'] = $this->app->Secure->GetPOST('buha_betrag1'); - $input['buha_konto2'] = $this->app->Secure->GetPOST('buha_konto2'); - $input['buha_belegfeld2'] = $this->app->Secure->GetPOST('buha_belegfeld2'); - $input['buha_betrag2'] = $this->app->Secure->GetPOST('buha_betrag2'); - $input['buha_konto3'] = $this->app->Secure->GetPOST('buha_konto3'); - $input['buha_belegfeld3'] = $this->app->Secure->GetPOST('buha_belegfeld3'); - $input['buha_betrag3'] = $this->app->Secure->GetPOST('buha_betrag3'); - $input['buha_konto4'] = $this->app->Secure->GetPOST('buha_konto4'); - $input['buha_belegfeld4'] = $this->app->Secure->GetPOST('buha_belegfeld4'); - $input['buha_betrag4'] = $this->app->Secure->GetPOST('buha_betrag4'); - $input['buha_konto5'] = $this->app->Secure->GetPOST('buha_konto5'); - $input['buha_belegfeld5'] = $this->app->Secure->GetPOST('buha_belegfeld5'); - $input['buha_betrag5'] = $this->app->Secure->GetPOST('buha_betrag5'); - $input['rechnungsdatum'] = $this->app->Secure->GetPOST('rechnungsdatum'); - $input['rechnungsfreigabe'] = $this->app->Secure->GetPOST('rechnungsfreigabe'); - $input['kostenstelle'] = $this->app->Secure->GetPOST('kostenstelle'); - $input['beschreibung'] = $this->app->Secure->GetPOST('beschreibung'); - $input['sachkonto'] = $this->app->Secure->GetPOST('sachkonto'); - $input['art'] = $this->app->Secure->GetPOST('art'); - $input['verwendungszweck'] = $this->app->Secure->GetPOST('verwendungszweck'); - $input['dta_datei'] = $this->app->Secure->GetPOST('dta_datei'); - $input['frachtkosten'] = $this->app->Secure->GetPOST('frachtkosten'); - $input['internebemerkung'] = $this->app->Secure->GetPOST('internebemerkung'); - $input['ustnormal'] = $this->app->Secure->GetPOST('ustnormal'); - $input['ustermaessigt'] = $this->app->Secure->GetPOST('ustermaessigt'); - $input['uststuer3'] = $this->app->Secure->GetPOST('uststuer3'); - $input['uststuer4'] = $this->app->Secure->GetPOST('uststuer4'); - $input['betragbezahlt'] = $this->app->Secure->GetPOST('betragbezahlt'); - $input['bezahltam'] = $this->app->Secure->GetPOST('bezahltam'); - $input['klaerfall'] = $this->app->Secure->GetPOST('klaerfall'); - $input['klaergrund'] = $this->app->Secure->GetPOST('klaergrund'); - $input['skonto_erhalten'] = $this->app->Secure->GetPOST('skonto_erhalten'); - $input['kurs'] = $this->app->Secure->GetPOST('kurs'); - $input['sprache'] = $this->app->Secure->GetPOST('sprache'); - - + $input['adresse'] = $this->app->Secure->GetPOST('adresse'); + $input['rechnung'] = $this->app->Secure->GetPOST('rechnung'); + $input['zahlbarbis'] = $this->app->Secure->GetPOST('zahlbarbis'); + $input['betrag'] = $this->app->Secure->GetPOST('betrag'); + $input['waehrung'] = $this->app->Secure->GetPOST('waehrung'); + $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['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['kostenstelle'] = $this->app->Secure->GetPOST('kostenstelle'); + $input['sachkonto'] = $this->app->Secure->GetPOST('sachkonto'); + $input['internebemerkung'] = $this->app->Secure->GetPOST('internebemerkung'); return $input; } - } + + function verbindlichkeit_menu($id) { + + $anzahldateien = $this->app->erp->AnzahlDateien("verbindlichkeit",$id); + if ($anzahldateien > 0) { + $anzahldateien = " (".$anzahldateien.")"; + } else { + $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); + } + + function verbindlichkeit_dateien() + { + $id = $this->app->Secure->GetGET("id"); + $this->verbindlichkeit_menu($id); + $this->app->Tpl->Add('UEBERSCHRIFT'," (Dateien)"); + $this->app->YUI->DateiUpload('PAGE',"verbindlichkeit",$id); + } + + function verbindlichkeit_inlinepdf() { + $id = $this->app->Secure->GetGET('id'); + + $file_attachments = $this->app->erp->GetDateiSubjektObjekt('%','verbindlichkeit',$id); + + if (!empty($file_attachments)) { + +// print_r($file_attachments); + + // Try to merge all PDFs + $file_paths = array(); + foreach ($file_attachments as $file_attachment) { + if ($this->app->erp->GetDateiEndung($file_attachment) == 'pdf') { + $file_paths[] = $this->app->erp->GetDateiPfad($file_attachment); + } + } + $pdfMerger = $this->app->Container->get('PdfMerger'); + $mergeOutputPath = realpath($this->app->erp->GetTMP()) . '/' . uniqid('sammelpdf_', true) . '.pdf'; + try { + $pdfMerger->merge($file_paths, $mergeOutputPath); + header('Content-type:application/pdf'); + header('Content-Disposition: attachment;filename='.md5(microtime(true)).'.pdf'); + readfile($mergeOutputPath); + $this->app->ExitXentral(); + } catch (\Xentral\Components\Pdf\Exception\PdfComponentExceptionInterface $exception) { + // Just the first PDF + foreach ($file_attachments as $file_attachment) { + if ($this->app->erp->GetDateiEndung($file_attachment) == 'pdf') { + $file_contents = $this->app->erp->GetDatei($file_attachment); + header('Content-type:application/pdf'); + header('Content-Disposition: attachment;filename=verbindlichkeit_'.$id.'.pdf'); + echo($file_contents); + $this->app->ExitXentral(); + } + } + } + } + $this->app->ExitXentral(); + } +}