// Updating invoice status mysql_query("UPDATE `entry` " . "SET " . "`invoice_status` = '3', " . "`user_last_edit` = '" . $login['user_id'] . "', " . "`time_last_edit` = '" . time() . "', " . "`rev_num` = '{$rev_num}', " . "`invoice_exported_time` = '" . time() . "' " . " WHERE `entry_id` = '" . $entry['entry_id'] . "' LIMIT 1 ;"); $log_data = array(); if (!newEntryLog($entry['entry_id'], 'edit', 'invoice_exported', $rev_num, $log_data)) { } if (is_null($from) || $from > $entry['time_start']) { $from = $entry['time_start']; } if (is_null($to) || $to < $entry['time_end']) { $to = $entry['time_end']; } // Generate PDF data $smarty = new Smarty(); templateAssignEntry('smarty', $entry); templateAssignEntryChanges('smarty', $entry, $entry['rev_num']); templateAssignSystemvars('smarty'); $invoicedata[] = $smarty->fetch('file:fakturagrunnlag.tpl'); } if (count($entries) != 1) { $er = 'er'; } else { $er = ''; } $pdffile = 'fakturagrunnlag-' . date('Ymd-His') . '-' . count($entries) . '_booking' . $er . '.pdf'; require_once "libs/dompdf/dompdf_config.inc.php"; $dompdf = new DOMPDF(); $dompdf->set_paper('A4'); $dompdf->load_html(implode($invoicedata)); $dompdf->render(); file_put_contents($invoice_location . $pdffile, $dompdf->output()); // Update invoiced
function emailSendEntryUserDeleted($entry, $rev_num, $user_id) { global $smarty; $smarty = new Smarty(); templateAssignEntry('smarty', $entry); templateAssignSystemvars('smarty'); templateAssignEntryChanges('smarty', $entry, $rev_num); $message = $smarty->fetch('file:mail-entry-userdeleted.tpl'); $subject = "[booking]" . $entry['entry_id'] . ' ' . date('d.m.Y', $entry['time_start']) . ' Ikke lenger vert'; emailSend($user_id, $subject, $message); }
function emailSendEntryUndeleted($entry, $user_id) { global $smarty; if (!isUserDeactivated($user_id)) { $smarty = new Smarty(); templateAssignEntry('smarty', $entry); templateAssignSystemvars('smarty'); $message = $smarty->fetch('file:mail-entry-undeleted.tpl'); $subject = "[booking]" . $entry['entry_id'] . ' ' . date('d.m.Y', $entry['time_start']) . ' Gjenopprettet - ' . $entry['entry_name']; emailSend($user_id, $subject, $message); } }
function createPDF() { global $smarty; $smarty = new Smarty(); templateAssignInvoice('smarty', $this); templateAssignSystemvars('smarty'); $smarty->assign('invoice_heading', 'Faktura'); $pdf = new HTML2FPDF(); $pdf->DisplayPreferences('HideWindowUI'); $pdf->AddPage(); $pdf->WriteHTML($smarty->fetch('file:invoice.tpl')); $pdf->Output('invoice/invoice' . $this->invoice_id . '.pdf'); $smarty->assign('invoice_heading', 'Fakturakopi'); $pdf = new HTML2FPDF(); $pdf->DisplayPreferences('HideWindowUI'); $pdf->AddPage(); $pdf->WriteHTML($smarty->fetch('file:invoice.tpl')); $pdf->Output('invoice/invoice' . $this->invoice_id . '_copy.pdf'); }