www
/
wwwroot
/
magazinmiorita.be
/
clientarea
➕ New
📤 Upload
✎ Editing:
invoice.php
← Back
<?php ob_start(); include('../includes/inc.config.php'); include('check_session.php'); ini_set("display_errors", 0); //Set default date timezone date_default_timezone_set('Belgium/Bruxelles'); //Include Invoicr class include('invoicr.php'); //Create a new instance $invoice = new invoicr("A4","€","fr"); //Set number formattings $invoice->setNumberFormat('.',','); //Set your logo $invoice->setLogo("../images/logo.png"); //Set theme color $invoice->setColor("#82b541"); $get_orders_results = array(); $get_orders = $database->execute(" SELECT * FROM `orders` WHERE `id` = '".$_GET['id']."' "); while($row = $database->fetch($get_orders)){ //Set type $invoice->setType("Invoice"); //Set reference $invoice->setReference("#".$row['id']); //Set date $invoice->setDate(date('m.d.Y',$row['indate'])); //Set from $invoice->setFrom(array("Bravos S.C.R.I","Avenue Houba de Stropper 110","Bruxelles, Laeken","Belgium","TVA BE0842411247")); //Set to $invoice->setTo(array( ($data->client_data($row['user_id'], 'company') ? $data->client_data($row['user_id'], 'company') : $data->client_data($row['user_id'], 'fname')." ".$data->client_data($row['user_id'], 'lname')), $data->client_data($row['user_id'], 'address'), $data->client_data($row['user_id'], 'zip')." ".$data->client_data($row['user_id'], 'city'),"Belgium","")); $row['price'] = money_format('%.2n',$row['price']); $row['amount'] = money_format('%.2n',$row['amount']); $row['products'] = unserialize($row['history']); $shipp_amount = $row['shipp_amount']; $txx = array(); $get_taxes = $database->execute("SELECT * FROM `taxes`"); $totals = 0; $total_tax = 0; $tt_tax1 = 0; $tt_tax2 = 0; foreach ($row['products'] as $key => $item){ $itemdata = explode('|',$item); $ch['qt'] = $itemdata[4]; $ch['price'] = $itemdata[3]; $ch['price_tax'] = ((int)($data->tax_data($data->item_data($itemdata[0],'tax')) ? $data->tax_data($data->item_data($itemdata[0],'tax')) : '6')/100)*$itemdata[3]; $ch['type'] = $itemdata[2]; $ch['weight'] = $itemdata[1]; $ch['item_id'] = $itemdata[0]; $ch['amount'] = $itemdata[3]*$itemdata[4]; $ch['calc_total'] += $ch['amount']; $ch['chsubtotal'] = $ch['calc_total']; $ch['chtotal'] = number_format($data->vat($ch['calc_total'],$data->settings('tax')),2); $ch['ord_chtotal'] = $data->vat($ch['calc_total'],$data->settings('tax')); $ch['tax'] = ($data->tax_data($data->item_data($itemdata[0],'tax')) ? $data->tax_data($data->item_data($itemdata[0],'tax')) : '6'); if($data->item_data($itemdata[0],'tax') == 'tax_1'){ $part = $ch['tax']*$itemdata[3]; $tt_tax1 += $ch['price_tax']; }else if($data->item_data($itemdata[0],'tax') == 'tax_2'){ $part = $ch['tax']*$itemdata[3]; $tt_tax2 += $ch['price_tax']; }else{ $part = $ch['tax']*$itemdata[3]; $tt_tax1 += $ch['price_tax']; } $ch['key'] = $key; $cart_ch[] = $ch; //Add items $invoice->addItem($data->item_data($itemdata[0],'name'),false,$ch['qt'],$ch['tax']."%",$ch['price'],false,$ch['chtotal']); } $total_tax1 = $tt_tax1; $total_tax2 = $tt_tax2; $row['tax'] = $txx; $row['history'] = $cart_ch; $get_orders_results[] = $row; //Add totals $invoice->addTotal("Total",number_format(($ch['chsubtotal'] - $total_tax1 - $total_tax2),2)); $invoice->addTotal("VAT 6%",number_format($total_tax1,2)); $invoice->addTotal("VAT 21%",number_format($total_tax2,2)); $invoice->addTotal("Livraison",number_format($shipp_amount,2)); $invoice->addTotal("Total due",number_format($ch['chtotal'] + $shipp_amount,2),true); //Set badge if($row['status'] == '0'){ $invoice->addBadge("PENDING"); }else if($row['status'] == '1'){ $invoice->addBadge("PAID"); }else if($row['status'] == '2'){ $invoice->addBadge("CANCELED"); }else if($row['status'] == '3'){ $invoice->addBadge("TRANZIT"); } //Add title $invoice->addTitle("Payment information"); //Add Paragraph $invoice->addParagraph("Make all cheques payable to Bravos S.C.R.I.<br>If you have any questions concerning this invoice, contact our sales department at contact@magazinmiorita.be.<br><br>Thank you for your business."); //Set footer note $invoice->setFooternote("http://www.magazinmiorita.be"); //Render $invoice->render('Miorita.'.date('m.d.Y',$row['indate']).'.INV'.$_GET['id'].'.pdf',$_GET['out']); } ob_end_flush(); ?>
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel