continuing changement
This commit is contained in:
commit
a965103db4
26
adm/pdf.php
26
adm/pdf.php
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@ -33,7 +33,7 @@ include(PS_ADMIN_DIR.'/../config/config.inc.php');
|
||||
$cookie = new Cookie('psAdmin');
|
||||
if (!$cookie->id_employee)
|
||||
Tools::redirectAdmin('login.php');
|
||||
|
||||
|
||||
$functionArray = array(
|
||||
'pdf' => 'generateInvoicePDF',
|
||||
'id_order_slip' => 'generateOrderSlipPDF',
|
||||
@ -109,7 +109,11 @@ function generateInvoicesPDFPrivateSales()
|
||||
if(count($orders) == 0) {
|
||||
die (Tools::displayError('No invoices found'));
|
||||
}
|
||||
PDF::multipleInvoices($orders, false, true);
|
||||
if(Tools::getValue('gift')){
|
||||
PDF::multipleInvoices($orders, false, true, false, true);
|
||||
} else {
|
||||
PDF::multipleInvoices($orders, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -179,7 +183,11 @@ function generateInvoicesPDFPrivateSalesAll()
|
||||
if(count($orders) == 0) {
|
||||
die (Tools::displayError('No invoices found'));
|
||||
}
|
||||
PDF::multipleInvoices($orders, false, true);
|
||||
if(Tools::getValue('gift')){
|
||||
PDF::multipleInvoices($orders, false, true, false, true);
|
||||
} else {
|
||||
PDF::multipleInvoices($orders, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -189,7 +197,7 @@ function generateInvoicesPDFPrivateMulti()
|
||||
if(Module::isInstalled('privatesales')) {
|
||||
include(dirname(__FILE__).'/../modules/privatesales/Sale.php');
|
||||
if($sale = new Sale((int) Tools::getValue('id_sale'))) {
|
||||
$statuts = array(17, Configuration::get('PS_OS_PAYMENT'));
|
||||
$statuts = array(17, Configuration::get('PS_OS_PAYMENT'));
|
||||
$orders = $sale->getOrdersFromSaleMulti($statuts, 2);
|
||||
if(count($orders) == 0) {
|
||||
die (Tools::displayError('No invoices found'));
|
||||
@ -248,7 +256,11 @@ function generateInvoicesPDFPrivateM2Plus()
|
||||
if(count($orders) == 0) {
|
||||
die (Tools::displayError('No invoices found'));
|
||||
}
|
||||
PDF::multipleInvoices($orders, false, true);
|
||||
if(Tools::getValue('gift')){
|
||||
PDF::multipleInvoices($orders, false, true, false, true);
|
||||
} else {
|
||||
PDF::multipleInvoices($orders, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -268,7 +280,7 @@ function generateInvoicesPDFPrivateM2Bis()
|
||||
die (Tools::displayError('Invalid from date'));
|
||||
if (!Validate::isDate(Tools::getValue('date_from')))
|
||||
die (Tools::displayError('Invalid end date'));
|
||||
|
||||
|
||||
$statuts = array(17, Configuration::get('PS_OS_PAYMENT'));
|
||||
$orders = Sale::getOrdersM3($statuts, $id_sales, Tools::getValue('date_from'), Tools::getValue('date_to'), true);
|
||||
|
||||
|
@ -151,6 +151,27 @@ class AdminInvoices extends AdminTab
|
||||
)
|
||||
);
|
||||
|
||||
$helperForm->_css .= '
|
||||
#invoices_form .table tr th {
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
}
|
||||
#invoices_form .table tr td {
|
||||
border-bottom: 1px solid #DEDEDE;
|
||||
color: #000;
|
||||
height: auto;
|
||||
padding: 5px 4px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#invoices_form .table tr td label {
|
||||
font-size: 13px;
|
||||
}
|
||||
#invoices_form input[type=checkbox],
|
||||
#invoices_form input[type=radio] {
|
||||
margin: 0;
|
||||
}
|
||||
';
|
||||
|
||||
$helperForm->_js .= '
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
@ -164,30 +185,15 @@ class AdminInvoices extends AdminTab
|
||||
$form .= $helperForm->renderStyle();
|
||||
$form .= '<div class="row">'.$helperForm->renderForm(false, NULL, NULL, true).'</div>';
|
||||
|
||||
// echo '<h2>'.$this->l('Print PDF ').'</h2>
|
||||
// <fieldset style="width:300px;margin-right: 10px;"><legend><img src="../img/admin/pdf.gif" alt="" /> '.$this->l('By date').'</legend>
|
||||
// <form action="'.$currentIndex.'&token='.$this->token.'" method="post">
|
||||
// <label style="width:90px">'.$this->l('From:').' </label>
|
||||
// <div class="margin-form" style="padding-left:100px">
|
||||
// <input type="text" size="4" maxlength="10" name="date_from" value="'.(!empty(Tools::getValue('date_from')) ? Tools::getValue('date_from') : date('Y-m-d')).'" style="width: 120px;" /> <sup>*</sup>
|
||||
// <p class="clear">'.$this->l('Format: 2007-12-31 (inclusive)').'</p>
|
||||
// </div>
|
||||
// <label style="width:90px">'.$this->l('To:').' </label>
|
||||
// <div class="margin-form" style="padding-left:100px">
|
||||
// <input type="text" size="4" maxlength="10" name="date_to" value="'.(!empty(Tools::getValue('date_to')) ? Tools::getValue('date_to') : date('Y-m-d')).'" style="width: 120px;" /> <sup>*</sup>
|
||||
// <p class="clear">'.$this->l('Format: 2008-12-31 (inclusive)').'</p>
|
||||
// </div>
|
||||
// <div class="margin-form" style="padding-left:100px">
|
||||
// <input type="submit" value="'.$this->l('Get Sales').'" name="submitGetSale" class="button" />
|
||||
// </div>
|
||||
// <div class="small"><sup>*</sup> '.$this->l('Required fields').'</div>
|
||||
// </form>
|
||||
// </fieldset>';
|
||||
|
||||
|
||||
if($this->print_sales) {
|
||||
$form .= '<form action="'.$currentIndex.'&token='.$this->token.'" method="post">
|
||||
<table class="table" style="margin-top:30px; width: 100%">';
|
||||
$form .= '<div class="panel">
|
||||
<div class="panel-title">
|
||||
<h2>Factures par vente</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<form id="invoices_form" action="'.$currentIndex.'&token='.$this->token.'" method="post">
|
||||
<table class="table table-custombordered">';
|
||||
|
||||
/*echo '
|
||||
<tr>
|
||||
@ -195,19 +201,19 @@ class AdminInvoices extends AdminTab
|
||||
<td align="center"><a id="checkm3" data-checked="0" href="#">'. $this->l('Check all') .'</a></td>
|
||||
</tr>*/
|
||||
$form .= '<tr>
|
||||
<th align="center" width="50">'.$this->l('Id Sale').'</th>
|
||||
<th colspan="2">'.$this->l('ID Sale').'</th>
|
||||
<th>'.$this->l('Name sale').'</th>
|
||||
<th align="center">'.$this->l('Date start').'</th>';
|
||||
<th>'.$this->l('Date start').'</th>';
|
||||
/*<th align="center">48h</th>';
|
||||
if ($cookie->id_employee == 1) {
|
||||
echo '<th align="center">48H bis</th>';
|
||||
}*/
|
||||
$form .= '<th align="center">M1</th>';
|
||||
/*<th align="center">M2</th>*/
|
||||
$form .= '<th align="center">M2+</th>
|
||||
<th align="center">Même marque</th>
|
||||
<th align="center">All</th>
|
||||
<th align="center">'. $this->l('Delay') .'</th>
|
||||
$form .= '<th>M1</th>';
|
||||
/*<th>M2</th>*/
|
||||
$form .= '<th>M2+</th>
|
||||
<th>Même marque</th>
|
||||
<th>All</th>
|
||||
<th>'. $this->l('Delay') .'</th>
|
||||
</tr>';
|
||||
// <th align="center">M2\'</th>
|
||||
$id_sales = unserialize(Configuration::get("ANT_CHECKED_SALES"));
|
||||
@ -220,9 +226,10 @@ class AdminInvoices extends AdminTab
|
||||
$date = DateTime::createFromFormat('Y-m-d H:i:s', $sale['date_start']);
|
||||
|
||||
$form .= '<tr class="'.$class.'">
|
||||
<td align="center">'. $sale['id_sale'] .'</td>
|
||||
<td><label for="multi_'.$sale['id_sale'].'" style="text-align: left; font-weight: normal">'. $sale['title'] .'<label></td>
|
||||
<td>'. $date->format('Y-m-d') .'</td>';
|
||||
<td></td>
|
||||
<td><label for="multi_'.$sale['id_sale'].'" style="float:none; width:auto; padding: 0; text-align: left; font-weight: normal; margin:0;">'. $sale['id_sale'] .'</label></td>
|
||||
<td><label for="multi_'.$sale['id_sale'].'" style="float:none; width:auto; padding: 0; text-align: left; font-weight: normal; margin:0;"><strong>'. $sale['title'] .'</strong></label></td>
|
||||
<td align="center"><p style="padding:0px;color: #565485;font-size:12px;">'. $date->format('Y-m-d') .'</p></td>';
|
||||
/*<td align="center">';
|
||||
if ($sale['delivery_delay'] == 2
|
||||
|| $sale['delivery_delay'] == 6) {
|
||||
@ -246,8 +253,11 @@ class AdminInvoices extends AdminTab
|
||||
echo '</td>*/
|
||||
$form .= '</td>
|
||||
<td align="center">
|
||||
<a onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printM1=1&id_sale='. $sale['id_sale'] .'&token='.$this->token.'">
|
||||
<img src="../img/admin/pdf.gif" alt="">
|
||||
<!--a title="Facture - Avec prix" onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printM1=1&id_sale='. $sale['id_sale'] .'&token='.$this->token.'">
|
||||
<span class="text-green-light anticon anticon-file-pdf" style="cursor:pointer;"></span>
|
||||
</a-->
|
||||
<a title="Facture cadeau - Sans prix" onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printM1=1&id_sale='. $sale['id_sale'] .'&gift=1&token='.$this->token.'">
|
||||
<span class="text-rose anticon anticon-file-pdf" style="cursor:pointer;"></span>
|
||||
</a>
|
||||
</td>';
|
||||
/*<td align="center">
|
||||
@ -259,147 +269,153 @@ class AdminInvoices extends AdminTab
|
||||
$form .= '<td align="center"><input id="multi_'. $sale['id_sale'].'" type="checkbox" name="multi2[]" value="'.$sale['id_sale'].'" '.(in_array((int)$sale['id_sale'], $id_sales)?'checked':'').'/></td>
|
||||
<td align="center"><input id="multi_plus_'. $sale['id_sale'].'" type="checkbox" name="multiPlus[]" value="'.$sale['id_sale'].'"/></td>
|
||||
<td align="center">
|
||||
<a onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printAll=1&id_sale='. $sale['id_sale'] .'&token='.$this->token.'">
|
||||
<img src="../img/admin/pdf.gif" alt="">
|
||||
<!--a onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printAll=1&id_sale='. $sale['id_sale'] .'&token='.$this->token.'">
|
||||
<span class="text-green-light anticon anticon-file-pdf" style="cursor:pointer;"></span>
|
||||
</a-->
|
||||
<a onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printAll=1&id_sale='. $sale['id_sale'] .'&gift=1&token='.$this->token.'">
|
||||
<span class="text-rose anticon anticon-file-pdf" style="cursor:pointer;"></span>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center" '.($sale['delivery_delay'] != 1?'style="background:#FFD3D3;"':'').'>'.(isset($sale['delivery_delay_name'])?$sale['delivery_delay_name']:'').'</td>
|
||||
<td align="center" '.($sale['delivery_delay'] != 1?'style="background:#f49ac1;"':'').'>'.(isset($sale['delivery_delay_name'])?$sale['delivery_delay_name']:'').'</td>
|
||||
</tr>';
|
||||
|
||||
}
|
||||
// <td align="center"><input id="m2_'. $sale['id_sale'].'" type="checkbox" name="m2[]" value="'.$sale['id_sale'].'" /></td>
|
||||
|
||||
$form .= '<tr>
|
||||
<td colspan="4">
|
||||
<input type="hidden" name="date_to" value="'. Tools::getValue('date_to') .'" />
|
||||
<input type="hidden" name="date_from" value="'. Tools::getValue('date_from') .'" />
|
||||
</td>';
|
||||
<td colspan="5" style="padding:5px;"></td>';
|
||||
// <td colspan="4" style="padding:5px;">
|
||||
// <input type="hidden" name="date_to" value="'. Tools::getValue('date_to') .'" />
|
||||
// <input type="hidden" name="date_from" value="'. Tools::getValue('date_from') .'" />
|
||||
// <label style="float:none;" class="text-green-light "><span class="anticon anticon-file-pdf"></span> '.$this->l('Avec prix').'</label>
|
||||
// <label style="float:none;" class="text-rose "><span class="anticon anticon-file-pdf"></span> '.$this->l('Sans prix').'</label>
|
||||
// </td>';
|
||||
/*<td align="center">
|
||||
<input type="submit" name="submitPrintM2Bis" class="button" value="'.$this->l('Print M2\'').'" />
|
||||
</td>*/
|
||||
$form .= '<td align="center">
|
||||
<input type="submit" name="submitPrintM2Plus" class="button" value="'.$this->l('Print M2+').'" />
|
||||
<input type="submit" name="resetPrintM2Plus" class="button" value="'.$this->l('Unselect all').'" />
|
||||
$form .= '<td align="center" style="padding:5px;">
|
||||
<input type="submit" name="submitPrintM2Plus" class="btn btn-default btn-xs" value="'.$this->l('Print M2+').'" />
|
||||
<input type="submit" name="resetPrintM2Plus" class="btn btn-default btn-xs" value="'.$this->l('Unselect all').'" />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="submit" name="submitPrintMPlus" class="button" value="'.$this->l('Print Même Marque').'" />
|
||||
<td align="center" style="padding:5px;">
|
||||
<input type="submit" name="submitPrintMPlus" class="btn btn-default btn-xs" value="'.$this->l('Print Même Marque').'" />
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
<p><label style="float:none;"><input type="checkbox" name="gift" value="1" /> '.$this->l('Factures Cadeaux').'</label></p>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>';
|
||||
$form .= '</table>
|
||||
</form>';
|
||||
</form>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
$form .= '<br />';
|
||||
|
||||
// echo '
|
||||
// <h2>'.$this->l('Print PDF invoices').'</h2>
|
||||
// <fieldset style="float:left;width:300px;margin-right: 10px;"><legend><img src="../img/admin/pdf.gif" alt="" /> '.$this->l('By date').'</legend>
|
||||
// <form action="'.$currentIndex.'&token='.$this->token.'" method="post">
|
||||
// <label style="width:90px">'.$this->l('From:').' </label>
|
||||
// <div class="margin-form" style="padding-left:100px">
|
||||
// <input type="text" size="4" maxlength="10" name="date_from" value="'.(date('Y-m-d')).'" style="width: 120px;" /> <sup>*</sup>
|
||||
// <p class="clear">'.$this->l('Format: 2007-12-31 (inclusive)').'</p>
|
||||
// </div>
|
||||
// <label style="width:90px">'.$this->l('To:').' </label>
|
||||
// <div class="margin-form" style="padding-left:100px">
|
||||
// <input type="text" size="4" maxlength="10" name="date_to" value="'.(date('Y-m-d')).'" style="width: 120px;" /> <sup>*</sup>
|
||||
// <p class="clear">'.$this->l('Format: 2008-12-31 (inclusive)').'</p>
|
||||
// </div>
|
||||
// <div class="margin-form" style="padding-left:100px">
|
||||
// <input type="submit" value="'.$this->l('Generate PDF file').'" name="submitPrint" class="button" />
|
||||
// </div>
|
||||
// <div class="small"><sup>*</sup> '.$this->l('Required fields').'</div>
|
||||
// </form>
|
||||
// </fieldset>';
|
||||
|
||||
$form .= '<div class="row">';
|
||||
if(Module::isInstalled('privatesales')) {
|
||||
include_once(dirname(__FILE__).'/../../modules/privatesales/Sale.php');
|
||||
$form .= '
|
||||
<fieldset style="float:left;width:450px;margin-bottom:10px;margin-right: 10px;"><legend><img src="../img/admin/pdf.gif" alt="" /> '.$this->l('By private sale').'</legend>
|
||||
<form action="'.$currentIndex.'&token='.$this->token.'" method="post">
|
||||
<div><strong>'.$this->l('Orders from a single sale').'</strong></div>
|
||||
<br />
|
||||
<label style="width:90px">'.$this->l('Select a sale:').' </label>
|
||||
<div class="margin-form" style="padding-left:100px"><br />
|
||||
<select name="id_sale">
|
||||
';
|
||||
// foreach(Sale::getSales(NULL, NULL, NULL, NULL, FALSE, FALSE, '`date_start` DESC') as $sale) {
|
||||
// echo '<option value="'.$sale->id.'">'.$sale->id.' - '.$sale->title[(int) $cookie->id_lang].'</option>';
|
||||
// }
|
||||
$form .= '</select>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="margin-form" style="padding-left:100px">
|
||||
<input type="submit" value="'.$this->l('Generate PDF file').'" name="submitPrintOneSale" class="button" />
|
||||
</div>
|
||||
$form .= '<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-title">
|
||||
<h2>'.$this->l('By private sale').'</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<form action="'.$currentIndex.'&token='.$this->token.'" method="post">
|
||||
<div><strong>'.$this->l('Orders from a single sale').'</strong></div>
|
||||
<br />
|
||||
<label style="width:90px">'.$this->l('Select a sale:').' </label>
|
||||
<div class="margin-form" style="padding-left:100px"><br />
|
||||
<select name="id_sale">
|
||||
';
|
||||
// foreach(Sale::getSales(NULL, NULL, NULL, NULL, FALSE, FALSE, '`date_start` DESC') as $sale) {
|
||||
// echo '<option value="'.$sale->id.'">'.$sale->id.' - '.$sale->title[(int) $cookie->id_lang].'</option>';
|
||||
// }
|
||||
$form .= '</select>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="margin-form" style="padding-left:100px">
|
||||
<input type="submit" value="'.$this->l('Generate PDF file').'" name="submitPrintOneSale" class="button" />
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<div><strong>'.$this->l('Orders from multiple sales').'</strong></div>
|
||||
<br />
|
||||
<label style="width:90px">'.$this->l('From:').' </label>
|
||||
<div class="margin-form" style="padding-left:100px">
|
||||
<input type="text" size="4" maxlength="10" name="date_from" value="'.(date('Y-m-d')).'" style="width: 120px;" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Format: 2007-12-31 (inclusive)').'</p>
|
||||
<div><strong>'.$this->l('Orders from multiple sales').'</strong></div>
|
||||
<br />
|
||||
<label style="width:90px">'.$this->l('From:').' </label>
|
||||
<div class="margin-form" style="padding-left:100px">
|
||||
<input type="text" size="4" maxlength="10" name="date_from" value="'.(date('Y-m-d')).'" style="width: 120px;" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Format: 2007-12-31 (inclusive)').'</p>
|
||||
</div>
|
||||
<label style="width:90px">'.$this->l('To:').' </label>
|
||||
<div class="margin-form" style="padding-left:100px">
|
||||
<input type="text" size="4" maxlength="10" name="date_to" value="'.(date('Y-m-d')).'" style="width: 120px;" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Format: 2008-12-31 (inclusive)').'</p>
|
||||
</div>
|
||||
<div class="margin-form" style="padding-left:100px">
|
||||
<input type="submit" value="'.$this->l('Generate PDF file').'" name="submitPrintMultipleSales" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required fields').'</div>
|
||||
</form>
|
||||
<br /><br />
|
||||
<div style="padding-left:100px">';
|
||||
if(Tools::getValue('check_print')) {
|
||||
$check = '';
|
||||
$token = Tools::getAdminTokenLite('AdminOrders');
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
WHERE o.`invoice_number` != 0
|
||||
AND o.`id_order` NOT IN (
|
||||
SELECT p.`id_order`
|
||||
FROM `'._DB_PREFIX_.'privatesale_printedinvoices` p
|
||||
)
|
||||
') as $not_printed) {
|
||||
$check .= '<li><a href="/adm/index.php?tab=AdminOrders&vieworder&id_order='.$not_printed['id_order'].'&token='.$token.'" onclick="window.open(this.href); return false;">'.$not_printed['id_order'].'</a></li>';
|
||||
}
|
||||
$form .= '<strong>'.$this->l('Unprinted orders:').'</strong><ul>'.$check.'</ul>';
|
||||
} else {
|
||||
$form .= '<a class="button" href="'.$_SERVER['REQUEST_URI'].'&check_print=1">'.$this->l('Display unprinted orders').'</a>';
|
||||
}
|
||||
$form .= '</div>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
<label style="width:90px">'.$this->l('To:').' </label>
|
||||
<div class="margin-form" style="padding-left:100px">
|
||||
<input type="text" size="4" maxlength="10" name="date_to" value="'.(date('Y-m-d')).'" style="width: 120px;" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Format: 2008-12-31 (inclusive)').'</p>
|
||||
</div>
|
||||
<div class="margin-form" style="padding-left:100px">
|
||||
<input type="submit" value="'.$this->l('Generate PDF file').'" name="submitPrintMultipleSales" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required fields').'</div>
|
||||
</form>
|
||||
<br /><br />
|
||||
<div style="padding-left:100px">';
|
||||
if(Tools::getValue('check_print')) {
|
||||
$check = '';
|
||||
$token = Tools::getAdminTokenLite('AdminOrders');
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
WHERE o.`invoice_number` != 0
|
||||
AND o.`id_order` NOT IN (
|
||||
SELECT p.`id_order`
|
||||
FROM `'._DB_PREFIX_.'privatesale_printedinvoices` p
|
||||
)
|
||||
') as $not_printed) {
|
||||
$check .= '<li><a href="/adm/index.php?tab=AdminOrders&vieworder&id_order='.$not_printed['id_order'].'&token='.$token.'" onclick="window.open(this.href); return false;">'.$not_printed['id_order'].'</a></li>';
|
||||
}
|
||||
$form .= '<strong>'.$this->l('Unprinted orders:').'</strong><ul>'.$check.'</ul>';
|
||||
} else {
|
||||
$form .= '<a class="button" href="'.$_SERVER['REQUEST_URI'].'&check_print=1">'.$this->l('Display unprinted orders').'</a>';
|
||||
}
|
||||
$form .= '</div>
|
||||
<br />
|
||||
</fieldset>';
|
||||
</div>';
|
||||
}
|
||||
|
||||
$form .= '<fieldset style="float:left;width: 500px;margin-left:10px"><legend><img src="../img/admin/pdf.gif" alt="" /> '.$this->l('By statuses').'</legend>
|
||||
<form action="'.$currentIndex.'&token='.$this->token.'" method="post">
|
||||
<label style="width:90px">'.$this->l('Statuses').' :</label>
|
||||
<div class="margin-form" style="padding-left:100px">
|
||||
<ul>';
|
||||
foreach ($statuses as $status)
|
||||
$form .= ' <li style="list-style: none;">
|
||||
<input type="checkbox" name="id_order_state[]" value="'.(int)$status['id_order_state'].'" id="id_order_state_'.(int)$status['id_order_state'].'">
|
||||
<label for="id_order_state_'.(int)$status['id_order_state'].'" style="float:none;'.((isset($statusStats[$status['id_order_state']]) AND $statusStats[$status['id_order_state']]) ? '' : 'font-weight:normal;').'padding:0;text-align:left;width:100%;color:#000">
|
||||
<img src="../img/admin/charged_'.($status['invoice'] ? 'ok' : 'ko').'.gif" alt="" />
|
||||
'.$status['name'].' ('.((isset($statusStats[$status['id_order_state']]) AND $statusStats[$status['id_order_state']]) ? $statusStats[$status['id_order_state']] : '0').')
|
||||
</label>
|
||||
</li>';
|
||||
$form .= ' </ul>
|
||||
<p class="clear">'.$this->l('You can also export orders which have not been charged yet.').'(<img src="../img/admin/charged_ko.gif" alt="" />)</p>
|
||||
$form .= '<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-title">
|
||||
<h2>'.$this->l('By statuses').'</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<form action="'.$currentIndex.'&token='.$this->token.'" method="post">
|
||||
<label style="width:90px">'.$this->l('Statuses').' :</label>
|
||||
<div class="margin-form" style="padding-left:100px">
|
||||
<ul>';
|
||||
foreach ($statuses as $status)
|
||||
$form .= ' <li style="list-style: none;">
|
||||
<input type="checkbox" name="id_order_state[]" value="'.(int)$status['id_order_state'].'" id="id_order_state_'.(int)$status['id_order_state'].'">
|
||||
<label for="id_order_state_'.(int)$status['id_order_state'].'" style="float:none;'.((isset($statusStats[$status['id_order_state']]) AND $statusStats[$status['id_order_state']]) ? '' : 'font-weight:normal;').'padding:0;text-align:left;width:100%;color:#000">
|
||||
<img src="../img/admin/charged_'.($status['invoice'] ? 'ok' : 'ko').'.gif" alt="" />
|
||||
'.$status['name'].' ('.((isset($statusStats[$status['id_order_state']]) AND $statusStats[$status['id_order_state']]) ? $statusStats[$status['id_order_state']] : '0').')
|
||||
</label>
|
||||
</li>';
|
||||
$form .= ' </ul>
|
||||
<p class="clear">'.$this->l('You can also export orders which have not been charged yet.').'(<img src="../img/admin/charged_ko.gif" alt="" />)</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l('Generate PDF file').'" name="submitPrint2" class="button" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l('Generate PDF file').'" name="submitPrint2" class="button" />
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>
|
||||
<div class="clear"> </div>';
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>';
|
||||
|
||||
$form .= '</div>';
|
||||
$form .= $helperForm->renderScript();
|
||||
echo $form;
|
||||
|
||||
@ -413,7 +429,6 @@ class AdminInvoices extends AdminTab
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#checkm3").on("click", function(e){
|
||||
e.preventDefault();
|
||||
if( $(this).attr("data-checked") == 0 ) {
|
||||
@ -549,7 +564,11 @@ class AdminInvoices extends AdminTab
|
||||
$statuts = array(17, Configuration::get('PS_OS_PAYMENT'));
|
||||
$orders = $sale->getOrdersFromSale($statuts, FALSE, TRUE);
|
||||
if(sizeof($orders)) {
|
||||
Tools::redirectAdmin('pdf.php?privatesalesAll&id_sale='.(int) $sale->id.'&token='.$this->token);
|
||||
if(Tools::getValue('gift') == 1) {
|
||||
Tools::redirectAdmin('pdf.php?privatesalesAll&gift=1&id_sale='.(int) $sale->id.'&token='.$this->token);
|
||||
} else {
|
||||
Tools::redirectAdmin('pdf.php?privatesalesAll&id_sale='.(int) $sale->id.'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_errors[] = $this->l('No invoice found for this sale');
|
||||
@ -562,7 +581,11 @@ class AdminInvoices extends AdminTab
|
||||
$statuts = array(17, Configuration::get('PS_OS_PAYMENT'));
|
||||
$orders = $sale->getOrdersFromSale($statuts);
|
||||
if(sizeof($orders)) {
|
||||
Tools::redirectAdmin('pdf.php?privatesales&id_sale='.(int) $sale->id.'&token='.$this->token);
|
||||
if(Tools::getValue('gift') == 1) {
|
||||
Tools::redirectAdmin('pdf.php?privatesales&gift=1&id_sale='.(int) $sale->id.'&token='.$this->token);
|
||||
} else {
|
||||
Tools::redirectAdmin('pdf.php?privatesales&id_sale='.(int) $sale->id.'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_errors[] = $this->l('No invoice found for this sale');
|
||||
@ -608,7 +631,11 @@ class AdminInvoices extends AdminTab
|
||||
$statuts = array(17, Configuration::get('PS_OS_PAYMENT'));
|
||||
$orders = Sale::getOrdersM2($statuts, $id_sales, Tools::getValue('date_from'), Tools::getValue('date_to'));
|
||||
if(sizeof($orders)) {
|
||||
Tools::redirectAdmin('pdf.php?privatesalesM2Plus&id_sale='.implode(',', $id_sales) .'&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
|
||||
if(Tools::getValue('gift') == 1) {
|
||||
Tools::redirectAdmin('pdf.php?privatesalesM2Plus&gift=1&id_sale='.implode(',', $id_sales) .'&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
|
||||
} else {
|
||||
Tools::redirectAdmin('pdf.php?privatesalesM2Plus&id_sale='.implode(',', $id_sales) .'&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
$this->_errors[] = $this->l('No invoice found for these sales');
|
||||
}
|
||||
@ -624,7 +651,11 @@ class AdminInvoices extends AdminTab
|
||||
$statuts = array(17, Configuration::get('PS_OS_PAYMENT'));
|
||||
$orders = Sale::getOrdersM2($statuts, $id_sales, Tools::getValue('date_from'), Tools::getValue('date_to'));
|
||||
if(sizeof($orders)) {
|
||||
Tools::redirectAdmin('pdf.php?privatesalesM2Plus&id_sale='.implode(',', $id_sales) .'&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
|
||||
if(Tools::getValue('gift') == 1) {
|
||||
Tools::redirectAdmin('pdf.php?privatesalesM2Plus&gift=1&id_sale='.implode(',', $id_sales) .'&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
|
||||
} else {
|
||||
Tools::redirectAdmin('pdf.php?privatesalesM2Plus&id_sale='.implode(',', $id_sales) .'&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
$this->_errors[] = $this->l('No invoice found for these sales');
|
||||
}
|
||||
|
493
classes/PDF.php
493
classes/PDF.php
@ -329,14 +329,14 @@ class PDFCore extends PDF_PageGroupCore
|
||||
$this->MultiCell(0.0, 4.0, $merchantDetailFooter, 0, 'C', 1);
|
||||
}
|
||||
|
||||
public static function multipleInvoices($invoices, $multi = false, $tri = false, $expe48 = false)
|
||||
public static function multipleInvoices($invoices, $multi = false, $tri = false, $expe48 = false, $gift = false)
|
||||
{
|
||||
$pdf = new PDF('P', 'mm', 'A4');
|
||||
foreach ($invoices AS $id_order)
|
||||
{
|
||||
$orderObj = new Order((int)$id_order);
|
||||
if (Validate::isLoadedObject($orderObj))
|
||||
PDF::invoice($orderObj, 'D', true, $pdf, false, false, $multi, $tri, $expe48);
|
||||
PDF::invoice($orderObj, 'D', true, $pdf, false, false, $multi, $tri, $expe48, $gift);
|
||||
}
|
||||
return $pdf->Output('invoices.pdf', 'D');
|
||||
}
|
||||
@ -564,7 +564,245 @@ class PDFCore extends PDF_PageGroupCore
|
||||
* @param object $order Order
|
||||
* @param string $mode Download or display (optional)
|
||||
*/
|
||||
public static function invoice($order, $mode = 'D', $multiple = false, &$pdf = NULL, $slip = false, $delivery = false, $multi = false, $tri = false, $expe48 = false)
|
||||
public static function invoice($order, $mode = 'D', $multiple = false, &$pdf = NULL, $slip = false, $delivery = false, $multi = false, $tri = false, $expe48 = false, $gift = false)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (!Validate::isLoadedObject($order) OR (!$cookie->id_employee AND (!OrderState::invoiceAvailable($order->getCurrentState()) AND !$order->invoice_number)))
|
||||
die('Invalid order or invalid order state');
|
||||
/* @Override Antadis */
|
||||
if($gift && $order->gift == 1) {
|
||||
self::invoiceWithoutPrice($order, $mode = 'D', $multiple, $pdf, $slip, $delivery, $multi, $tri, $expe48);
|
||||
} else {
|
||||
|
||||
self::$order = $order;
|
||||
self::$orderSlip = $slip;
|
||||
self::$delivery = $delivery;
|
||||
self::$_iso = strtoupper(Language::getIsoById((int)(self::$order->id_lang)));
|
||||
if ((self::$_priceDisplayMethod = $order->getTaxCalculationMethod()) === false)
|
||||
die(self::l('No price display method defined for the customer group'));
|
||||
|
||||
if (!$multiple)
|
||||
$pdf = new PDF('P', 'mm', 'A4');
|
||||
|
||||
$pdf->SetAutoPageBreak(true, 35);
|
||||
$pdf->StartPageGroup();
|
||||
|
||||
self::$currency = Currency::getCurrencyInstance((int)(self::$order->id_currency));
|
||||
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->AddPage();
|
||||
|
||||
$width = 100;
|
||||
$pdf->SetX(10);
|
||||
$pdf->SetY(25);
|
||||
$pdf->SetFont(self::fontname(), '', 12);
|
||||
$pdf->Cell($width, 10, self::l('Delivery'), 0, 'L');
|
||||
$pdf->Cell($width, 10, self::l('Invoicing'), 0, 'L');
|
||||
$pdf->Ln(5);
|
||||
$pdf->SetFont(self::fontname(), '', 9);
|
||||
|
||||
$addressType = array(
|
||||
'delivery' => array(),
|
||||
'invoice' => array(),
|
||||
);
|
||||
|
||||
$patternRules = array(
|
||||
'optional' => array(
|
||||
'address2',
|
||||
'company'),
|
||||
'avoid' => array(
|
||||
'State:iso_code'));
|
||||
|
||||
$addressType = self::generateHeaderAddresses($pdf, $order, $addressType, $patternRules, $width);
|
||||
|
||||
if (Configuration::get('VATNUMBER_MANAGEMENT') AND !empty($addressType['invoice']['addressObject']->vat_number))
|
||||
{
|
||||
$vat_delivery = '';
|
||||
if ($addressType['invoice']['addressObject']->id != $addressType['delivery']['addressObject']->id)
|
||||
$vat_delivery = $addressType['delivery']['addressObject']->vat_number;
|
||||
$pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $vat_delivery), 0, 'L');
|
||||
$pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $addressType['invoice']['addressObject']->vat_number), 0, 'L');
|
||||
$pdf->Ln(5);
|
||||
}
|
||||
|
||||
if ($addressType['invoice']['addressObject']->dni != NULL)
|
||||
$pdf->Cell($width, 10,
|
||||
self::l('Tax ID number:').' '.Tools::iconv('utf-8', self::encoding(),
|
||||
$addressType['invoice']['addressObject']->dni), 0, 'L');
|
||||
|
||||
/*
|
||||
* display order information
|
||||
*/
|
||||
$carrier = new Carrier(self::$order->id_carrier);
|
||||
if ($carrier->name == '0')
|
||||
$carrier->name = Configuration::get('PS_SHOP_NAME');
|
||||
$history = self::$order->getHistory(self::$order->id_lang);
|
||||
foreach($history as $h)
|
||||
if ($h['id_order_state'] == Configuration::get('PS_OS_SHIPPING'))
|
||||
$shipping_date = $h['date_add'];
|
||||
$pdf->Ln(12);
|
||||
$pdf->SetFillColor(240, 240, 240);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont(self::fontname(), '', 9);
|
||||
if (self::$orderSlip)
|
||||
$pdf->Cell(0, 6, self::l('SLIP #').' '.sprintf('%06d', self::$orderSlip->id).' '.self::l('from') . ' ' .Tools::displayDate(self::$orderSlip->date_upd, self::$order->id_lang), 1, 2, 'L', 1);
|
||||
elseif (self::$delivery)
|
||||
$pdf->Cell(0, 6, self::l('DELIVERY SLIP #').Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_DELIVERY_PREFIX', (int)($cookie->id_lang))).sprintf('%06d', self::$delivery).' '.self::l('from') . ' ' .Tools::displayDate(self::$order->delivery_date, self::$order->id_lang), 1, 2, 'L', 1);
|
||||
elseif ((int)self::$order->invoice_date)
|
||||
$pdf->Cell(0, 6, self::l('INVOICE #').' '.Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_INVOICE_PREFIX', (int)($cookie->id_lang))).sprintf('%06d', self::$order->invoice_number).' '.self::l('from') . ' ' .Tools::displayDate(self::$order->invoice_date, self::$order->id_lang), 1, 2, 'L', 1);
|
||||
else
|
||||
$pdf->Cell(0, 6, self::l('Invoice draft'), 1, 2, 'L', 1);
|
||||
|
||||
$pdf->Cell(55, 6, self::l('Order #').' '.sprintf('%06d', self::$order->id), 'L', 0);
|
||||
$pdf->Cell(70, 6, self::l('Carrier:'), 'L');
|
||||
$pdf->Cell(0, 6, self::l('Payment method:'), 'LR');
|
||||
$pdf->Ln(5);
|
||||
$pdf->Cell(55, 6, (isset($shipping_date) ? self::l('Shipping date:').' '.Tools::displayDate($shipping_date, self::$order->id_lang) : ' '), 'LB', 0);
|
||||
$pdf->Cell(70, 6, Tools::iconv('utf-8', self::encoding(), $carrier->name), 'LRB');
|
||||
$pdf->Cell(0, 6, Tools::iconv('utf-8', self::encoding(), $order->payment), 'LRB');
|
||||
$pdf->Ln(15);
|
||||
$pdf->ProdTab((self::$delivery ? true : ''), $tri);
|
||||
|
||||
|
||||
|
||||
/* Canada */
|
||||
$taxable_address = new Address((int)self::$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
if (!self::$delivery && strtoupper(Country::getIsoById((int)$taxable_address->id_country)) == 'CA')
|
||||
{
|
||||
$pdf->Ln(15);
|
||||
$taxToDisplay = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'order_tax WHERE id_order = '.(int)self::$order->id);
|
||||
foreach ($taxToDisplay AS $t)
|
||||
{
|
||||
$pdf->Cell(0, 6, utf8_decode($t['tax_name']).' ('.number_format($t['tax_rate'], 2, '.', '').'%) '.self::convertSign(Tools::displayPrice($t['amount'], self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(5);
|
||||
}
|
||||
}
|
||||
/* End */
|
||||
|
||||
/* Exit if delivery */
|
||||
if (!self::$delivery)
|
||||
{
|
||||
if (!self::$orderSlip)
|
||||
$pdf->DiscTab();
|
||||
$priceBreakDown = array();
|
||||
$pdf->priceBreakDownCalculation($priceBreakDown);
|
||||
|
||||
if (!self::$orderSlip OR (self::$orderSlip AND self::$orderSlip->shipping_cost))
|
||||
{
|
||||
$priceBreakDown['totalWithoutTax'] += Tools::ps_round($priceBreakDown['shippingCostWithoutTax'], 2) + Tools::ps_round($priceBreakDown['wrappingCostWithoutTax'], 2);
|
||||
$priceBreakDown['totalWithTax'] += self::$order->total_shipping + self::$order->total_wrapping;
|
||||
}
|
||||
if (!self::$orderSlip)
|
||||
{
|
||||
$taxDiscount = self::$order->getTaxesAverageUsed();
|
||||
if ($taxDiscount != 0)
|
||||
$priceBreakDown['totalWithoutTax'] -= Tools::ps_round(self::$order->total_discounts / (1 + self::$order->getTaxesAverageUsed() * 0.01), 2);
|
||||
else
|
||||
$priceBreakDown['totalWithoutTax'] -= self::$order->total_discounts;
|
||||
$priceBreakDown['totalWithTax'] -= self::$order->total_discounts;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display price summation
|
||||
*/
|
||||
if (Configuration::get('PS_TAX') OR $order->total_products_wt != $order->total_products)
|
||||
{
|
||||
$pdf->Ln(5);
|
||||
$pdf->SetFont(self::fontname(), 'B', 8);
|
||||
$width = 165;
|
||||
$pdf->Cell($width, 0, self::l('Total products (tax excl.)').' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'], self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
|
||||
$pdf->SetFont(self::fontname(), 'B', 8);
|
||||
$width = 165;
|
||||
$pdf->Cell($width, 0, self::l('Total products (tax incl.)').' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithTax'], self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->Ln(5);
|
||||
$pdf->SetFont(self::fontname(), 'B', 8);
|
||||
$width = 165;
|
||||
$pdf->Cell($width, 0, self::l('Total products ').' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'], self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
|
||||
if (!self::$orderSlip AND self::$order->total_discounts != '0.00')
|
||||
{
|
||||
$pdf->Cell($width, 0, self::l('Total discounts (tax incl.)').' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (!self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(self::$order->total_discounts, self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
|
||||
if (isset(self::$order->total_wrapping) and ((float)(self::$order->total_wrapping) > 0))
|
||||
{
|
||||
$pdf->Cell($width, 0, self::l('Total gift-wrapping').' : ', 0, 0, 'R');
|
||||
if (self::$_priceDisplayMethod == PS_TAX_EXC)
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['wrappingCostWithoutTax'], self::$currency, true)), 0, 0, 'R');
|
||||
else
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(self::$order->total_wrapping, self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
|
||||
if (self::$order->total_shipping != '0.00' AND (!self::$orderSlip OR (self::$orderSlip AND self::$orderSlip->shipping_cost)))
|
||||
{
|
||||
$pdf->Cell($width, 0, self::l('Total shipping').' : ', 0, 0, 'R');
|
||||
if (self::$_priceDisplayMethod == PS_TAX_EXC)
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(Tools::ps_round($priceBreakDown['shippingCostWithoutTax'], 2), self::$currency, true)), 0, 0, 'R');
|
||||
else
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(self::$order->total_shipping, self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
|
||||
if (Configuration::get('PS_TAX') OR $order->total_products_wt != $order->total_products)
|
||||
{
|
||||
$pdf->Cell($width, 0, self::l('Total').' '.(self::$_priceDisplayMethod == PS_TAX_EXC ? self::l(' (tax incl.)') : self::l(' (tax excl.)')).' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice((self::$_priceDisplayMethod == PS_TAX_EXC ? $priceBreakDown['totalWithTax'] : $priceBreakDown['totalWithoutTax']), self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
$pdf->Cell($width, 0, self::l('Total').' '.(self::$_priceDisplayMethod == PS_TAX_EXC ? self::l(' (tax excl.)') : self::l(' (tax incl.)')).' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice((self::$_priceDisplayMethod == PS_TAX_EXC ? $priceBreakDown['totalWithoutTax'] : $priceBreakDown['totalWithTax']), self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->Cell($width, 0, self::l('Total').' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(($priceBreakDown['totalWithoutTax']), self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
|
||||
$pdf->TaxTab($priceBreakDown);
|
||||
|
||||
if($multi) {
|
||||
$pdf->Ln(15);
|
||||
$pdf->SetFont(self::fontname(), 'B', 10);
|
||||
$pdf->Cell(190, 0, Tools::iconv('utf-8', self::encoding(), 'Commande expédiée partiellement') , 0, 0, 'C');
|
||||
}
|
||||
if ($expe48) {
|
||||
$pdf->Ln(15);
|
||||
$pdf->SetFont(self::fontname(), '', 7);
|
||||
$pdf->Cell(190, 0, Tools::iconv('utf-8', self::encoding(), 'Produit expédié sous 48h, si la commande comprend d’autres articles, ceux-ci arriveront dans les délais indiqués lors de l’achat') , 0, 0, 'L');
|
||||
}
|
||||
|
||||
}
|
||||
Hook::PDFInvoice($pdf, self::$order->id);
|
||||
|
||||
if (!$multiple)
|
||||
return $pdf->Output(sprintf('%06d', self::$order->id).'.pdf', $mode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Add Antadis
|
||||
* invoiceWithoutPrice
|
||||
*
|
||||
* @param object $order Order
|
||||
* @param string $mode Download or display (optional)
|
||||
*/
|
||||
public static function invoiceWithoutPrice($order, $mode = 'D', $multiple = false, &$pdf = NULL, $slip = false, $delivery = false, $multi = false, $tri = false, $expe48 = false)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
@ -650,16 +888,14 @@ class PDFCore extends PDF_PageGroupCore
|
||||
$pdf->Cell(0, 6, self::l('Invoice draft'), 1, 2, 'L', 1);
|
||||
|
||||
$pdf->Cell(55, 6, self::l('Order #').' '.sprintf('%06d', self::$order->id), 'L', 0);
|
||||
$pdf->Cell(70, 6, self::l('Carrier:').($order->gift ? ' '.Tools::iconv('utf-8', self::encoding(), $carrier->name) : ''), 'L');
|
||||
$pdf->Cell(70, 6, self::l('Carrier:'), 'L');
|
||||
$pdf->Cell(0, 6, self::l('Payment method:'), 'LR');
|
||||
$pdf->Ln(5);
|
||||
$pdf->Cell(55, 6, (isset($shipping_date) ? self::l('Shipping date:').' '.Tools::displayDate($shipping_date, self::$order->id_lang) : ' '), 'LB', 0);
|
||||
$pdf->Cell(70, 6, ($order->gift ? self::l('Gift-wrapped order') : Tools::iconv('utf-8', self::encoding(), $carrier->name)), 'LRB');
|
||||
$pdf->Cell(0, 6, Tools::iconv('utf-8', self::encoding(), $order->payment), 'LRB');
|
||||
$pdf->Cell(70, 6, Tools::iconv('utf-8', self::encoding(), $carrier->name), 'LRB');
|
||||
$pdf->Cell(0, 6, self::l('--'), 'LRB');
|
||||
$pdf->Ln(15);
|
||||
$pdf->ProdTab((self::$delivery ? true : ''), $tri);
|
||||
|
||||
|
||||
$pdf->ProdTab(true, $tri,true);
|
||||
|
||||
/* Canada */
|
||||
$taxable_address = new Address((int)self::$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
@ -678,99 +914,12 @@ class PDFCore extends PDF_PageGroupCore
|
||||
/* Exit if delivery */
|
||||
if (!self::$delivery)
|
||||
{
|
||||
if (!self::$orderSlip)
|
||||
$pdf->DiscTab();
|
||||
$priceBreakDown = array();
|
||||
$pdf->priceBreakDownCalculation($priceBreakDown);
|
||||
|
||||
if (!self::$orderSlip OR (self::$orderSlip AND self::$orderSlip->shipping_cost))
|
||||
{
|
||||
$priceBreakDown['totalWithoutTax'] += Tools::ps_round($priceBreakDown['shippingCostWithoutTax'], 2) + Tools::ps_round($priceBreakDown['wrappingCostWithoutTax'], 2);
|
||||
$priceBreakDown['totalWithTax'] += self::$order->total_shipping + self::$order->total_wrapping;
|
||||
/* @Override Antadis */
|
||||
if(!empty(self::$order->gift_message)) {
|
||||
$pdf->Ln(15);
|
||||
$pdf->SetFont(self::fontname(), 'B', 10);
|
||||
$pdf->Cell(190, 0, Tools::iconv('utf-8', self::encoding(), self::$order->gift_message) , 0, 0, 'C');
|
||||
}
|
||||
if (!self::$orderSlip)
|
||||
{
|
||||
$taxDiscount = self::$order->getTaxesAverageUsed();
|
||||
if ($taxDiscount != 0)
|
||||
$priceBreakDown['totalWithoutTax'] -= Tools::ps_round(self::$order->total_discounts / (1 + self::$order->getTaxesAverageUsed() * 0.01), 2);
|
||||
else
|
||||
$priceBreakDown['totalWithoutTax'] -= self::$order->total_discounts;
|
||||
$priceBreakDown['totalWithTax'] -= self::$order->total_discounts;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display price summation
|
||||
*/
|
||||
if (Configuration::get('PS_TAX') OR $order->total_products_wt != $order->total_products)
|
||||
{
|
||||
$pdf->Ln(5);
|
||||
$pdf->SetFont(self::fontname(), 'B', 8);
|
||||
$width = 165;
|
||||
$pdf->Cell($width, 0, self::l('Total products (tax excl.)').' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'], self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
|
||||
$pdf->SetFont(self::fontname(), 'B', 8);
|
||||
$width = 165;
|
||||
$pdf->Cell($width, 0, self::l('Total products (tax incl.)').' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithTax'], self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->Ln(5);
|
||||
$pdf->SetFont(self::fontname(), 'B', 8);
|
||||
$width = 165;
|
||||
$pdf->Cell($width, 0, self::l('Total products ').' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'], self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
|
||||
if (!self::$orderSlip AND self::$order->total_discounts != '0.00')
|
||||
{
|
||||
$pdf->Cell($width, 0, self::l('Total discounts (tax incl.)').' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (!self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(self::$order->total_discounts, self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
|
||||
if (isset(self::$order->total_wrapping) and ((float)(self::$order->total_wrapping) > 0))
|
||||
{
|
||||
$pdf->Cell($width, 0, self::l('Total gift-wrapping').' : ', 0, 0, 'R');
|
||||
if (self::$_priceDisplayMethod == PS_TAX_EXC)
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['wrappingCostWithoutTax'], self::$currency, true)), 0, 0, 'R');
|
||||
else
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(self::$order->total_wrapping, self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
|
||||
if (self::$order->total_shipping != '0.00' AND (!self::$orderSlip OR (self::$orderSlip AND self::$orderSlip->shipping_cost)))
|
||||
{
|
||||
$pdf->Cell($width, 0, self::l('Total shipping').' : ', 0, 0, 'R');
|
||||
if (self::$_priceDisplayMethod == PS_TAX_EXC)
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(Tools::ps_round($priceBreakDown['shippingCostWithoutTax'], 2), self::$currency, true)), 0, 0, 'R');
|
||||
else
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(self::$order->total_shipping, self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
|
||||
if (Configuration::get('PS_TAX') OR $order->total_products_wt != $order->total_products)
|
||||
{
|
||||
$pdf->Cell($width, 0, self::l('Total').' '.(self::$_priceDisplayMethod == PS_TAX_EXC ? self::l(' (tax incl.)') : self::l(' (tax excl.)')).' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice((self::$_priceDisplayMethod == PS_TAX_EXC ? $priceBreakDown['totalWithTax'] : $priceBreakDown['totalWithoutTax']), self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
$pdf->Cell($width, 0, self::l('Total').' '.(self::$_priceDisplayMethod == PS_TAX_EXC ? self::l(' (tax excl.)') : self::l(' (tax incl.)')).' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice((self::$_priceDisplayMethod == PS_TAX_EXC ? $priceBreakDown['totalWithoutTax'] : $priceBreakDown['totalWithTax']), self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->Cell($width, 0, self::l('Total').' : ', 0, 0, 'R');
|
||||
$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(($priceBreakDown['totalWithoutTax']), self::$currency, true)), 0, 0, 'R');
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
|
||||
$pdf->TaxTab($priceBreakDown);
|
||||
|
||||
if($multi) {
|
||||
$pdf->Ln(15);
|
||||
$pdf->SetFont(self::fontname(), 'B', 10);
|
||||
@ -779,9 +928,9 @@ class PDFCore extends PDF_PageGroupCore
|
||||
if ($expe48) {
|
||||
$pdf->Ln(15);
|
||||
$pdf->SetFont(self::fontname(), '', 7);
|
||||
$pdf->Cell(190, 0, Tools::iconv('utf-8', self::encoding(), 'Produit expédié sous 48h, si la commande comprend d’autres articles, ceux-ci arriveront dans les délais indiqués lors de l’achat') , 0, 0, 'L');
|
||||
$pdf->Cell(190, 0, Tools::iconv('utf-8', self::encoding(), 'Produit expédié sous 48h, si la commande comprend d’autres articles, ceux-ci arriveront dans les délais indiqués lors de l’achat') , 0, 0, 'L');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Hook::PDFInvoice($pdf, self::$order->id);
|
||||
|
||||
@ -821,25 +970,73 @@ class PDFCore extends PDF_PageGroupCore
|
||||
$this->SetFont(self::fontname(), '', 8);
|
||||
}
|
||||
|
||||
/* @Override Antadis */
|
||||
private function ProdTabHeaderWithEcotax($delivery = false)
|
||||
{
|
||||
// label, alignment (L: left, R: right, C: center)
|
||||
if (!$delivery) {
|
||||
$header = array(
|
||||
array(self::l('Description'), 'L'),
|
||||
array(self::l('Reference'), 'L'),
|
||||
array(self::l('U. price'), 'R'),
|
||||
array(self::l('Ecotax incl.'), 'R'),
|
||||
array(self::l('Qty'), 'C'),
|
||||
array(self::l('Total'), 'R')
|
||||
);
|
||||
$w = array(85, 15, 30, 30, 15, 15);
|
||||
}
|
||||
else {
|
||||
$header = array(
|
||||
array(self::l('Description'), 'L'),
|
||||
array(self::l('Reference'), 'L'),
|
||||
array(self::l('Qty'), 'C'),
|
||||
);
|
||||
$w = array(120, 30, 10);
|
||||
}
|
||||
|
||||
$this->SetFont(self::fontname(), 'B', 8);
|
||||
$this->SetFillColor(240, 240, 240);
|
||||
if ($delivery)
|
||||
$this->SetX(25);
|
||||
for ($i = 0; $i < sizeof($header); $i++) {
|
||||
$this->Cell($w[$i], 5, $header[$i][0], 'T', 0, $header[$i][1], 1);
|
||||
}
|
||||
$this->Ln();
|
||||
$this->SetFont(self::fontname(), '', 8);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Product table with price, quantities...
|
||||
*/
|
||||
public function ProdTab($delivery = false)
|
||||
public function ProdTab($delivery = false, $tri=false, $gift=false)
|
||||
{
|
||||
if (!$delivery)
|
||||
$w = array(100, 15, 30, 15, 30);
|
||||
else
|
||||
$w = array(120, 30, 10);
|
||||
self::ProdTabHeader($delivery);
|
||||
if (!self::$orderSlip)
|
||||
{
|
||||
if (isset(self::$order->products) AND sizeof(self::$order->products))
|
||||
$products = self::$order->products;
|
||||
else
|
||||
$products = self::$order->getProducts(false,false,false,true);
|
||||
$products = self::$order->getProducts(false, false, false, $tri);
|
||||
}
|
||||
else
|
||||
$products = self::$orderSlip->getOrdersSlipProducts(self::$orderSlip->id, self::$order);
|
||||
|
||||
/* @Override Antadis */
|
||||
$hasEcotax = $this->hasProductWithEcotax($products);
|
||||
if ($hasEcotax) {
|
||||
$this->ProdTabHeaderWithEcotax($delivery);
|
||||
}
|
||||
else {
|
||||
self::ProdTabHeader($delivery);
|
||||
}
|
||||
|
||||
if (!$delivery) {
|
||||
$w = $hasEcotax?array(85, 15, 30, 30, 15, 15):array(100, 15, 30, 15, 30);
|
||||
}
|
||||
else {
|
||||
$w = array(120, 30, 10);
|
||||
}
|
||||
|
||||
$customizedDatas = Product::getAllCustomizedDatas((int)(self::$order->id_cart));
|
||||
Product::addCustomizationPrice($products, $customizedDatas);
|
||||
|
||||
@ -849,8 +1046,12 @@ class PDFCore extends PDF_PageGroupCore
|
||||
$line = 0;
|
||||
|
||||
foreach($products AS $product)
|
||||
if (!$delivery OR ((int)($product['product_quantity']) - (int)($product['product_quantity_refunded']) > 0))
|
||||
if ((!$delivery || ($delivery && $gift)) || ((int)($product['product_quantity']) - (int)($product['product_quantity_refunded']) > 0))
|
||||
{
|
||||
if ($product['sended'] == 1) {
|
||||
$product['product_name'] = '* '.$product['product_name'];
|
||||
}
|
||||
|
||||
if ($counter >= $lines)
|
||||
{
|
||||
$this->AddPage();
|
||||
@ -916,15 +1117,29 @@ class PDFCore extends PDF_PageGroupCore
|
||||
if ($delivery)
|
||||
$this->SetX(25);
|
||||
$before = $this->GetY();
|
||||
|
||||
$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']).' - '.self::l('Customized')." \n".Tools::iconv('utf-8', self::encoding(), $custoLabel), 'B');
|
||||
$lineSize = $this->GetY() - $before;
|
||||
$this->SetXY($this->GetX() + $w[0] + ($delivery ? 15 : 0), $this->GetY() - $lineSize);
|
||||
$this->Cell($w[++$i], $lineSize, $product['product_reference'], 'B');
|
||||
if (!$delivery)
|
||||
if (!$delivery) {
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($unit_price, self::$currency, true)), 'B', 0, 'R');
|
||||
/* @Override Antadis */
|
||||
if ($hasEcotax) {
|
||||
if (!empty($product['ecotax']) && $product['ecotax']>0) {
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($product['ecotax'], self::$currency, true)), 'BT', 0, 'R');
|
||||
}
|
||||
else {
|
||||
$this->Cell($w[++$i], $lineSize, '-', 'BT', 0, 'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->Cell($w[++$i], $lineSize, (int)($product['customizationQuantityTotal']), 'B', 0, 'C');
|
||||
if (!$delivery)
|
||||
if (!$delivery) {
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($unit_price * (int)($product['customizationQuantityTotal']), self::$currency, true)), 'B', 0, 'R');
|
||||
}
|
||||
|
||||
$this->Ln();
|
||||
$i = -1;
|
||||
$total_with_tax = $unit_with_tax * $productQuantity;
|
||||
@ -935,15 +1150,45 @@ class PDFCore extends PDF_PageGroupCore
|
||||
if ($productQuantity)
|
||||
{
|
||||
$before = $this->GetY();
|
||||
$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']), 'B');
|
||||
$fill = false;
|
||||
if($productQuantity > 1) {
|
||||
$this->SetFont(self::fontname(), 'B', 7);
|
||||
$this->SetFillColor(240, 240, 240);
|
||||
$fill = true;
|
||||
} else {
|
||||
$this->SetFont(self::fontname(), '', 7);
|
||||
}
|
||||
|
||||
$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']), 'BT');
|
||||
$lineSize = $this->GetY() - $before;
|
||||
$this->SetXY($this->GetX() + $w[0] + ($delivery ? 15 : 0), $this->GetY() - $lineSize);
|
||||
$this->Cell($w[++$i], $lineSize, ($product['product_reference'] ? Tools::iconv('utf-8', self::encoding(), $product['product_reference']) : '--'), 'B');
|
||||
$this->Cell($w[++$i], $lineSize, ($product['product_reference'] ? Tools::iconv('utf-8', self::encoding(), $product['product_reference']) : '--'), 'BT');
|
||||
if (!$delivery) {
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($unit_price, self::$currency, true)), 'BT', 0, 'R');
|
||||
/* @Override Antadis */
|
||||
if ($hasEcotax) {
|
||||
if (!empty($product['ecotax']) && $product['ecotax']>0) {
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($product['ecotax'], self::$currency, true)), 'BT', 0, 'R');
|
||||
}
|
||||
else {
|
||||
$this->Cell($w[++$i], $lineSize, '-', 'BT', 0, 'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
/* @Override Antadis */
|
||||
if(!$delivery && !$hasEcotax) {
|
||||
global $cookie;
|
||||
error_log("logt" . serialize($cookie));
|
||||
if(method_exists($cookie, 'isLoggedBack') && $cookie->isLoggedBack()) {
|
||||
$this->Cell($w[++$i], $lineSize, $productQuantity.(self::$orderSlip? '': ($product['product_quantity_return'] > 0? ' (-'.$product['product_quantity_return'].')': ($product['product_quantity_refunded'] > 0? ' (-'.$product['product_quantity_refunded'].')': '' ))), 'BT', 0, 'C', $fill);
|
||||
} else {
|
||||
$this->Cell($w[++$i], $lineSize, $productQuantity, 'BT', 0, 'C', $fill);
|
||||
}
|
||||
}
|
||||
|
||||
$this->Cell($w[++$i], $lineSize, $productQuantity, 'BT', 0, 'C');
|
||||
if (!$delivery)
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($unit_price, self::$currency, true)), 'B', 0, 'R');
|
||||
$this->Cell($w[++$i], $lineSize, $productQuantity, 'B', 0, 'C');
|
||||
if (!$delivery)
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($final_price, self::$currency, true)), 'B', 0, 'R');
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($final_price, self::$currency, true)), 'BT', 0, 'R');
|
||||
$this->Ln();
|
||||
}
|
||||
}
|
||||
@ -1248,5 +1493,15 @@ class PDFCore extends PDF_PageGroupCore
|
||||
return $font ? $font : 'Arial';
|
||||
}
|
||||
|
||||
private function hasProductWithEcotax($products)
|
||||
{
|
||||
foreach($products as $product) {
|
||||
if (!empty($product['ecotax']) && $product['ecotax']>0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -3369,6 +3369,77 @@ a.link-anticon:hover{
|
||||
color: #483e93!important;
|
||||
}
|
||||
|
||||
/** button bootstrap */
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.42857143;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
-ms-touch-action: manipulation;
|
||||
touch-action: manipulation;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
background-image: none;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.btn.focus, .btn:focus, .btn:hover {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
}
|
||||
.btn-default {
|
||||
color: #333;
|
||||
background-color: #fff;
|
||||
border-color: #ccc;
|
||||
}
|
||||
.btn-default:hover {
|
||||
color: #333;
|
||||
background-color: #e6e6e6;
|
||||
border-color: #adadad;
|
||||
}
|
||||
.btn-default.focus,
|
||||
.btn-default:focus {
|
||||
color: #333;
|
||||
background-color: #e6e6e6;
|
||||
border-color: #8c8c8c;
|
||||
}
|
||||
.btn-bbb{
|
||||
box-shadow: none;
|
||||
text-align: center;
|
||||
color: #504d8b;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #fafafa;
|
||||
font-size: 12px;
|
||||
}
|
||||
.btn-bbb:hover {
|
||||
color: #504d8b;
|
||||
background: #f4f4f4;
|
||||
border-color: #8c8c8c;
|
||||
}
|
||||
.btn-bbb.focus,
|
||||
.btn-bbb:focus {
|
||||
color: #504d8b;
|
||||
background: #f4f4f4;
|
||||
border-color: #8c8c8c;
|
||||
}
|
||||
.btn-group-xs>.btn, .btn-xs {
|
||||
padding: 1px 5px;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
border-radius: 3px;
|
||||
}
|
||||
button.btn, html input.btn{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/** CustomerThread **/
|
||||
form.form-subject-message{
|
||||
width: 320px;
|
||||
@ -3651,7 +3722,8 @@ form.form-forward-message .button:focus{
|
||||
background-color: #F1F1F1;
|
||||
}
|
||||
#form_customer_thread table table,
|
||||
.table.customerThread-table {
|
||||
.table.customerThread-table,
|
||||
#form_admin_invoice .table {
|
||||
width: 100%;
|
||||
border: 1px solid #565485;
|
||||
background: #fff;
|
||||
@ -3670,6 +3742,7 @@ form.form-forward-message .button:focus{
|
||||
}
|
||||
#form_customer_thread table table tr th,
|
||||
.tab_customer_thread table tr th,
|
||||
#form_admin_invoice .table tr th,
|
||||
.table.customerThread-table tr th {
|
||||
background: rgba(86,84,133,0.9);
|
||||
color: #fff;
|
||||
@ -3677,6 +3750,7 @@ form.form-forward-message .button:focus{
|
||||
}
|
||||
#form_customer_thread table table tr td,
|
||||
.tab_customer_thread table tr td,
|
||||
#form_admin_invoice .table tr td,
|
||||
.table.customerThread-table tr td {
|
||||
border-bottom: 1px solid #DEDEDE;
|
||||
color: #000;
|
||||
|
@ -66,60 +66,60 @@ $(document).ready( function() {
|
||||
$('.color_pick').click(function () {
|
||||
displayExpressCheckoutShortcut();
|
||||
});
|
||||
|
||||
|
||||
{/literal}
|
||||
{if isset($paypal_authorization)}
|
||||
{literal}
|
||||
|
||||
|
||||
/* 1.5 One page checkout*/
|
||||
// var qty = $('.qty-field.cart_quantity_input').val();
|
||||
// $('.qty-field.cart_quantity_input').after(qty);
|
||||
// $('.qty-field.cart_quantity_input, .cart_total_bar, .cart_quantity_delete, #cart_voucher *').remove();
|
||||
|
||||
|
||||
var br = $('.cart > a').prev();
|
||||
br.prev().remove();
|
||||
br.remove();
|
||||
$('.cart.ui-content > a').remove();
|
||||
|
||||
|
||||
var gift_fieldset = $('#gift_div').prev();
|
||||
var gift_title = gift_fieldset.prev();
|
||||
$('#gift_div, #gift_mobile_div').remove();
|
||||
gift_fieldset.remove();
|
||||
gift_title.remove();
|
||||
|
||||
// $('#gift_div, #gift_mobile_div').remove();
|
||||
// gift_fieldset.remove();
|
||||
// gift_title.remove();
|
||||
|
||||
{/literal}
|
||||
{/if}
|
||||
{if isset($paypal_confirmation)}
|
||||
{literal}
|
||||
|
||||
|
||||
$('#container_express_checkout').hide();
|
||||
|
||||
|
||||
$('#cgv').live('click', function() {
|
||||
if ($('#cgv:checked').length != 0)
|
||||
$(location).attr('href', '{/literal}{$paypal_confirmation}{literal}');
|
||||
});
|
||||
|
||||
|
||||
// old jQuery compatibility
|
||||
$('#cgv').click(function() {
|
||||
if ($('#cgv:checked').length != 0)
|
||||
$(location).attr('href', '{/literal}{$paypal_confirmation}{literal}');
|
||||
});
|
||||
|
||||
|
||||
{/literal}
|
||||
{else if isset($paypal_order_opc)}
|
||||
{literal}
|
||||
|
||||
|
||||
$('#cgv').live('click', function() {
|
||||
if ($('#cgv:checked').length != 0)
|
||||
checkOrder();
|
||||
});
|
||||
|
||||
|
||||
// old jQuery compatibility
|
||||
$('#cgv').click(function() {
|
||||
if ($('#cgv:checked').length != 0)
|
||||
checkOrder();
|
||||
});
|
||||
|
||||
|
||||
{/literal}
|
||||
{/if}
|
||||
{literal}
|
||||
@ -135,7 +135,7 @@ $(document).ready( function() {
|
||||
{literal}
|
||||
var fullPath = baseDirPP + modulePath + subFolder;
|
||||
var confirmTimer = false;
|
||||
|
||||
|
||||
if ($('form[target="hss_iframe"]').length == 0) {
|
||||
if ($('select[name^="group_"]').length > 0)
|
||||
displayExpressCheckoutShortcut();
|
||||
|
@ -1,240 +0,0 @@
|
||||
<?php
|
||||
class PDF extends PDFCore {
|
||||
|
||||
// PDF column width for the table of ordered products
|
||||
private $cell_widths = [
|
||||
'with_ecotax' => [85, 15, 30, 30, 15, 15],
|
||||
'no_ecotax' => [100, 15, 30, 15, 30],
|
||||
'delivery' => [120, 30, 10]
|
||||
];
|
||||
|
||||
|
||||
private function hasProductWithEcotax($products)
|
||||
{
|
||||
foreach($products as $product) {
|
||||
if (!empty($product['ecotax']) && $product['ecotax']>0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function ProdTab($delivery = false, $tri = false)
|
||||
{
|
||||
if (!self::$orderSlip)
|
||||
{
|
||||
if (isset(self::$order->products) AND sizeof(self::$order->products))
|
||||
$products = self::$order->products;
|
||||
else
|
||||
$products = self::$order->getProducts(false, false, false, $tri);
|
||||
}
|
||||
else
|
||||
$products = self::$orderSlip->getOrdersSlipProducts(self::$orderSlip->id, self::$order);
|
||||
|
||||
$hasEcotax = $this->hasProductWithEcotax($products);
|
||||
|
||||
if ($hasEcotax) {
|
||||
$this->ProdTabHeaderWithEcotax($delivery);
|
||||
}
|
||||
else {
|
||||
$this->ProdTabHeader($delivery);
|
||||
}
|
||||
|
||||
if (!$delivery) {
|
||||
$w = &$this->cell_widths[$hasEcotax?'with_ecotax':'no_ecotax'];
|
||||
}
|
||||
else {
|
||||
$w = &$this->cell_widths['delivery'];
|
||||
}
|
||||
|
||||
$customizedDatas = Product::getAllCustomizedDatas((int)(self::$order->id_cart));
|
||||
Product::addCustomizationPrice($products, $customizedDatas);
|
||||
|
||||
$counter = 0;
|
||||
$lines = 25;
|
||||
$lineSize = 0;
|
||||
$line = 0;
|
||||
|
||||
foreach($products AS $product)
|
||||
if (!$delivery OR ((int)($product['product_quantity']) - (int)($product['product_quantity_refunded']) > 0))
|
||||
{
|
||||
if ($product['sended'] == 1) {
|
||||
$product['product_name'] = '* '.$product['product_name'];
|
||||
}
|
||||
|
||||
if ($counter >= $lines)
|
||||
{
|
||||
$this->AddPage();
|
||||
$this->Ln();
|
||||
self::ProdTabHeader($delivery);
|
||||
$lineSize = 0;
|
||||
$counter = 0;
|
||||
$lines = 40;
|
||||
$line++;
|
||||
}
|
||||
$counter = $counter + ($lineSize / 5) ;
|
||||
|
||||
$i = -1;
|
||||
|
||||
// Unit vars
|
||||
$unit_without_tax = $product['product_price'] + $product['ecotax'];
|
||||
$unit_with_tax = $product['product_price_wt'];
|
||||
if (self::$_priceDisplayMethod == PS_TAX_EXC)
|
||||
$unit_price = &$unit_without_tax;
|
||||
else
|
||||
$unit_price = &$unit_with_tax;
|
||||
$productQuantity = $delivery ? ((int)($product['product_quantity']) - (int)($product['product_quantity_refunded'])) : (int)($product['product_quantity']);
|
||||
|
||||
if ($productQuantity <= 0)
|
||||
continue ;
|
||||
|
||||
// Total prices
|
||||
$total_with_tax = $unit_with_tax * $productQuantity;
|
||||
$total_without_tax = $unit_without_tax * $productQuantity;
|
||||
// Spec
|
||||
if (self::$_priceDisplayMethod == PS_TAX_EXC)
|
||||
$final_price = &$total_without_tax;
|
||||
else
|
||||
$final_price = &$total_with_tax;
|
||||
// End Spec
|
||||
|
||||
if (isset($customizedDatas[$product['product_id']][$product['product_attribute_id']]))
|
||||
{
|
||||
$custoLabel = '';
|
||||
|
||||
foreach($customizedDatas[$product['product_id']][$product['product_attribute_id']] as $customizedData)
|
||||
{
|
||||
$customizationGroup = $customizedData['datas'];
|
||||
$nb_images = 0;
|
||||
|
||||
if (array_key_exists(_CUSTOMIZE_FILE_, $customizationGroup))
|
||||
$nb_images = sizeof($customizationGroup[_CUSTOMIZE_FILE_]);
|
||||
|
||||
if (array_key_exists(_CUSTOMIZE_TEXTFIELD_, $customizationGroup))
|
||||
foreach($customizationGroup[_CUSTOMIZE_TEXTFIELD_] as $customization)
|
||||
if (!empty($customization['name'])) $custoLabel .= '- '.$customization['name'].': '.$customization['value']."\n";
|
||||
|
||||
|
||||
if ($nb_images > 0)
|
||||
$custoLabel .= '- '.$nb_images. ' '. self::l('image(s)')."\n";
|
||||
|
||||
$custoLabel .= "---\n";
|
||||
}
|
||||
|
||||
$custoLabel = rtrim($custoLabel, "---\n");
|
||||
|
||||
$productQuantity = (int)($product['product_quantity']) - (int)($product['customizationQuantityTotal']);
|
||||
if ($delivery)
|
||||
$this->SetX(25);
|
||||
$before = $this->GetY();
|
||||
|
||||
$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']).' - '.self::l('Customized')." \n".Tools::iconv('utf-8', self::encoding(), $custoLabel), 'B');
|
||||
$lineSize = $this->GetY() - $before;
|
||||
$this->SetXY($this->GetX() + $w[0] + ($delivery ? 15 : 0), $this->GetY() - $lineSize);
|
||||
$this->Cell($w[++$i], $lineSize, $product['product_reference'], 'B');
|
||||
if (!$delivery) {
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($unit_price, self::$currency, true)), 'B', 0, 'R');
|
||||
|
||||
if ($hasEcotax) {
|
||||
if (!empty($product['ecotax']) && $product['ecotax']>0) {
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($product['ecotax'], self::$currency, true)), 'BT', 0, 'R');
|
||||
}
|
||||
else {
|
||||
$this->Cell($w[++$i], $lineSize, '-', 'BT', 0, 'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->Cell($w[++$i], $lineSize, (int)($product['customizationQuantityTotal']), 'B', 0, 'C');
|
||||
if (!$delivery) {
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($unit_price * (int)($product['customizationQuantityTotal']), self::$currency, true)), 'B', 0, 'R');
|
||||
|
||||
}
|
||||
$this->Ln();
|
||||
$i = -1;
|
||||
$total_with_tax = $unit_with_tax * $productQuantity;
|
||||
$total_without_tax = $unit_without_tax * $productQuantity;
|
||||
}
|
||||
if ($delivery)
|
||||
$this->SetX(25);
|
||||
if ($productQuantity)
|
||||
{
|
||||
$before = $this->GetY();
|
||||
$fill = FALSE;
|
||||
if($productQuantity > 1) {
|
||||
$this->SetFont(self::fontname(), 'B', 7);
|
||||
$this->SetFillColor(240, 240, 240);
|
||||
$fill = TRUE;
|
||||
} else {
|
||||
$this->SetFont(self::fontname(), '', 7);
|
||||
}
|
||||
|
||||
$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']), 'BT', 'L', $fill);
|
||||
$lineSize = $this->GetY() - $before;
|
||||
$this->SetXY($this->GetX() + $w[0] + ($delivery ? 15 : 0), $this->GetY() - $lineSize);
|
||||
$this->Cell($w[++$i], $lineSize, ($product['product_reference'] ? Tools::iconv('utf-8', self::encoding(), $product['product_reference']) : '--'), 'BT');
|
||||
if (!$delivery) {
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($unit_price, self::$currency, true)), 'BT', 0, 'R');
|
||||
|
||||
if ($hasEcotax) {
|
||||
if (!empty($product['ecotax']) && $product['ecotax']>0) {
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($product['ecotax'], self::$currency, true)), 'BT', 0, 'R');
|
||||
}
|
||||
else {
|
||||
$this->Cell($w[++$i], $lineSize, '-', 'BT', 0, 'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
global $cookie;
|
||||
error_log("logt" . serialize($cookie));
|
||||
if(method_exists($cookie, 'isLoggedBack') && $cookie->isLoggedBack()) {
|
||||
$this->Cell($w[++$i], $lineSize, $productQuantity.(self::$orderSlip? '': ($product['product_quantity_return'] > 0? ' (-'.$product['product_quantity_return'].')': ($product['product_quantity_refunded'] > 0? ' (-'.$product['product_quantity_refunded'].')': '' ))), 'BT', 0, 'C', $fill);
|
||||
} else {
|
||||
$this->Cell($w[++$i], $lineSize, $productQuantity, 'BT', 0, 'C', $fill);
|
||||
}
|
||||
|
||||
if (!$delivery)
|
||||
$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($final_price, self::$currency, true)), 'BT', 0, 'R');
|
||||
$this->Ln();
|
||||
}
|
||||
}
|
||||
|
||||
if (!sizeof(self::$order->getDiscounts()) AND !$delivery)
|
||||
$this->Cell(array_sum($w), 0, '');
|
||||
}
|
||||
|
||||
private function ProdTabHeaderWithEcotax($delivery = false)
|
||||
{
|
||||
// label, alignment (L: left, R: right, C: center)
|
||||
if (!$delivery) {
|
||||
$header = array(
|
||||
array(self::l('Description'), 'L'),
|
||||
array(self::l('Reference'), 'L'),
|
||||
array(self::l('U. price'), 'R'),
|
||||
array(self::l('Ecotax incl.'), 'R'),
|
||||
array(self::l('Qty'), 'C'),
|
||||
array(self::l('Total'), 'R')
|
||||
);
|
||||
$w = &$this->cell_widths['with_ecotax'];
|
||||
}
|
||||
else {
|
||||
$header = array(
|
||||
array(self::l('Description'), 'L'),
|
||||
array(self::l('Reference'), 'L'),
|
||||
array(self::l('Qty'), 'C'),
|
||||
);
|
||||
$w = &$this->cell_widths['delivery'];
|
||||
}
|
||||
|
||||
$this->SetFont(self::fontname(), 'B', 8);
|
||||
$this->SetFillColor(240, 240, 240);
|
||||
if ($delivery)
|
||||
$this->SetX(25);
|
||||
for ($i = 0; $i < sizeof($header); $i++)
|
||||
$this->Cell($w[$i], 5, $header[$i][0], 'T', 0, $header[$i][1], 1);
|
||||
$this->Ln();
|
||||
$this->SetFont(self::fontname(), '', 8);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user