$Invoice->setSent($id_new_invoice); break; } // Process direct debit invoices if ($invoice->payment_method == 'direct_debit') { $new_invoice = $Invoice->getInfos($id_new_invoice); $send_mail_direct_debit = true; $url = "https://webfinance.isvtec.com/prospection/edit_facture.php?id_facture={$new_invoice->id_facture}"; # Set invoice as paid $Invoice->setPaid($id_new_invoice); # Plan the invoice to be debited mysql_query('INSERT INTO direct_debit_row ' . "SET invoice_id = {$id_new_invoice}, " . " state='todo'") or die(mysql_error()); } // Process paypal invoices if ($invoice->payment_method == 'paypal') { $Invoice->SendPaymentRequest($id_new_invoice); } // Update deadline mysql_query('UPDATE webfinance_invoices ' . "SET periodic_next_deadline='{$next_deadline}' " . "WHERE id_facture = {$id_invoice}") or die(mysql_error()); } $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; if ($send_mail_print_invoice) { $mail->From = '*****@*****.**'; $mail->FromName = 'ISVTEC invoices'; $mail->ClearAddresses(); $mail->AddAddress('*****@*****.**'); $mail->Subject = 'Invoices to print and mail'; $mail->Body = 'Print the invoices and send them to clients'; foreach ($attachments as $attachment) { $mail->AddAttachment($attachment, basename($attachment), 'base64', 'application/pdf');
include "../inc/main.php"; include "../inc/Encryption.php"; $roles = 'manager,employee'; include "../top.php"; include "nav.php"; $Invoice = new Facture(); $invoice = $Invoice->getInfos($_GET['id_invoice']); $client = new Client($invoice->id_client); $societe = GetCompanyInfo(); if (empty($client->email)) { echo "<br /><h2>This client has no email... :-(</h2><br />You must add an email for this client before."; include "../bottom.php"; exit; } if (isset($_GET['action']) and $_GET['action'] == 'send') { $link = $Invoice->SendPaymentRequest($_GET['id_invoice']); echo "<br /><h2>Invoice and payment link has been sent.</h2><br />FYI Payment link: <a href=\"{$link}\">{$link}</a>"; include "../bottom.php"; exit; } ?> <br/> <h2>Request a PayPal payment</h2> <br/> <form action="paypal.php" onsubmit="return confirm('Are you sure you want to process the payment request?')"> <table width="300" border="0" cellspacing="0" cellpadding="2"> <tr><td>Type</td><td><?php echo $invoice->type_doc; ?> </td></tr>