verbindlichkeit drucken

This commit is contained in:
OpenXE 2024-09-02 20:33:50 +02:00
parent 87739fccc5
commit 00da78e863
2 changed files with 30 additions and 1 deletions

View File

@ -75,8 +75,10 @@
[MANUELLFREIGABEEINKAUF]
[MANUELLFREIGABEBUCHHALTUNG]
[ALSBEZAHLTMARKIEREN]
<option value="drucken">{|drucken|}</option>
</select>
<button name="submit" value="ausfuehren" class="ui-button-icon">{|Ausf&uuml;hren|}</button>
&nbsp;{|Drucker|}: <select name="seldrucker">[SELDRUCKER]</select>&nbsp;
<button name="submit" value="ausfuehren" class="ui-button-icon">{|Ausf&uuml;hren|}</button>
</fieldset>
</form>
[TAB1NEXT]

View File

@ -502,6 +502,31 @@ class Verbindlichkeit {
}
}
break;
case 'drucken':
$drucker = $this->app->Secure->GetPOST('seldrucker');
foreach ($selectedIds as $id) {
$file_attachments = $this->app->erp->GetDateiSubjektObjekt('%','verbindlichkeit',$id);
if (!empty($file_attachments)) {
foreach ($file_attachments as $file_attachment) {
if ($this->app->erp->GetDateiEndung($file_attachment) == 'pdf') {
$file_contents = $this->app->erp->GetDatei($file_attachment);
$verbindlichkeit = $this->app->DB->SelectRow("SELECT DATE_FORMAT(rechnungsdatum, '%Y%m%d') rechnungsdatum, belegnr FROM verbindlichkeit WHERE id = ".$id." LIMIT 1");
$file_name = $verbindlichkeit['rechnungsdatum']."_VB".$verbindlichkeit['belegnr'].".pdf";
$file_path = rtrim($this->app->erp->GetTMP(),'/')."/".$file_name;
$handle = fopen ($file_path, "wb");
if ($handle)
{
fwrite($handle, $file_contents);
fclose($handle);
$this->app->printer->Drucken($drucker,$file_path);
} else {
$this->app->YUI->Message('error',"Drucken fehlgeschlagen!");
}
}
}
}
}
break;
}
}
break;
@ -530,6 +555,8 @@ class Verbindlichkeit {
$this->app->User->SetParameter('table_verbindlichkeit_list_zahlbarbis', '');
$this->app->User->SetParameter('table_verbindlichkeit_list_skontobis', '');
$this->app->Tpl->Set('SELDRUCKER', $this->app->erp->GetSelectDrucker());
$this->app->Tpl->Parse('PAGE', "verbindlichkeit_list.tpl");
}