init
This commit is contained in:
60
modules/EcmWorkers/Print.php
Normal file
60
modules/EcmWorkers/Print.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
if (isset ( $_REQUEST ['submit'] )) {
|
||||
|
||||
$db = $GLOBALS ['db'];
|
||||
|
||||
$query = "select name,opis from ecmworkers where deleted= 0 and print = 1";
|
||||
|
||||
$res = $db->query ( $query );
|
||||
|
||||
$workers = [ ];
|
||||
|
||||
while ( $dane = $db->fetchByAssoc ( $res ) ) {
|
||||
$workers [] = $dane;
|
||||
}
|
||||
|
||||
$ss = new Sugar_Smarty ();
|
||||
$ss->assign ( "workers", $workers );
|
||||
$ss->assign ( "time", $_REQUEST['date_from'] );
|
||||
$date = new DateTime($_REQUEST['date_from']);
|
||||
$date->modify('+1 day');
|
||||
|
||||
$ss->assign ( "time2", $date->format("d.m.Y"));
|
||||
|
||||
$content = $ss->fetch ( "modules/EcmWorkers/tpl/WydrukKartyPracy.html" );
|
||||
|
||||
include_once ("include/MPDF57/mpdf.php");
|
||||
$p = new mPDF ( '', 'A4', null, 'helvetica', 10, 10, 0, 0, 5, 5 );
|
||||
$p->WriteHTML ( $content );
|
||||
|
||||
$p->Output ('karty_pracy.pdf', 'I');
|
||||
} else {
|
||||
?>
|
||||
<h2>Drukuj karty pracy</h2>
|
||||
Podaj datę:
|
||||
<form action="index.php">
|
||||
<input type="hidden" name="module" value="EcmWorkers" /> <input
|
||||
type="hidden" name="action" value="Print" />
|
||||
<input
|
||||
type="hidden" name="to_pdf" value="1" /> <input id="date_from"
|
||||
name="date_from" type="text" maxlength="10" size="11" tabindex=""
|
||||
title="Data od" value="<?php echo date("d.m.Y");?>" required
|
||||
autocomplete="off"> <img id="date_from_trigger" border="0"
|
||||
align="absmiddle" alt="Enter Date"
|
||||
src="themes/default/images/jscalendar.gif">
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
Calendar.setup({
|
||||
inputField: "date_from",
|
||||
daFormat: "%d.%m.%Y",
|
||||
button: "date_from_trigger",
|
||||
singleClick: true,
|
||||
dateStr: "",
|
||||
step: 1
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<br> <input type="submit" name="submit" value="Generuj wydruk">
|
||||
</form>
|
||||
<?php }
|
||||
?>
|
||||
Reference in New Issue
Block a user