// Update Supply Order Form (PDF)
This commit is contained in:
@@ -44,20 +44,20 @@ class HTMLTemplateSupplyOrderForm extends HTMLTemplate
|
|||||||
$this->address_warehouse = new Address($this->warehouse->id_address);
|
$this->address_warehouse = new Address($this->warehouse->id_address);
|
||||||
|
|
||||||
// header informations
|
// header informations
|
||||||
$this->date = Tools::displayDate($supply_order->date_add, (int)$this->context->language->id);
|
$this->date = Tools::displayDate($supply_order->date_add, (int)$this->supply_order->id_lang);
|
||||||
$this->title = self::l('Supply order form').sprintf(' #%s', $supply_order->reference);
|
$this->title = self::l('Supply order form').sprintf(' #%s', $supply_order->reference);
|
||||||
|
|
||||||
// footer informations : displays the address of the warehouse
|
|
||||||
$this->address = $this->address_warehouse;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the template's HTML content
|
* @see HTMLTemplate::getContent()
|
||||||
* @return string HTML content
|
|
||||||
*/
|
*/
|
||||||
public function getContent()
|
public function getContent()
|
||||||
{
|
{
|
||||||
$supply_order_details = $this->supply_order->getEntriesCollection($this->context->language->id);
|
$supply_order_details = $this->supply_order->getEntriesCollection($this->supply_order->id_lang);
|
||||||
|
$this->roundSupplyOrderDetails($supply_order_details);
|
||||||
|
|
||||||
|
$this->roundSupplyOrder($this->supply_order);
|
||||||
|
|
||||||
$tax_order_summary = $this->getTaxOrderSummary();
|
$tax_order_summary = $this->getTaxOrderSummary();
|
||||||
$currency = new Currency($this->supply_order->id_currency);
|
$currency = new Currency($this->supply_order->id_currency);
|
||||||
|
|
||||||
@@ -73,8 +73,7 @@ class HTMLTemplateSupplyOrderForm extends HTMLTemplate
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the template filename when using bulk rendering
|
* @see HTMLTemplate::getBulkFilename()
|
||||||
* @return string filename
|
|
||||||
*/
|
*/
|
||||||
public function getBulkFilename()
|
public function getBulkFilename()
|
||||||
{
|
{
|
||||||
@@ -82,8 +81,7 @@ class HTMLTemplateSupplyOrderForm extends HTMLTemplate
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the template filename
|
* @see HTMLTemplate::getFileName()
|
||||||
* @return string filename
|
|
||||||
*/
|
*/
|
||||||
public function getFilename()
|
public function getFilename()
|
||||||
{
|
{
|
||||||
@@ -103,6 +101,67 @@ class HTMLTemplateSupplyOrderForm extends HTMLTemplate
|
|||||||
$query->groupBy('tax_rate');
|
$query->groupBy('tax_rate');
|
||||||
|
|
||||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||||
|
|
||||||
|
foreach ($results as &$result)
|
||||||
|
{
|
||||||
|
$result['base_te'] = Tools::ps_round($result['base_te'], 2);
|
||||||
|
$result['tax_rate'] = Tools::ps_round($result['tax_rate'], 2);
|
||||||
|
$result['total_tax_value'] = Tools::ps_round($result['total_tax_value'], 2);
|
||||||
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see HTMLTemplate::getFooter()
|
||||||
|
*/
|
||||||
|
public function getFooter()
|
||||||
|
{
|
||||||
|
$this->address = $this->address_warehouse;
|
||||||
|
$shop_address = '';
|
||||||
|
if (isset($this->address) && $this->address instanceof Address)
|
||||||
|
$shop_address = AddressFormat::generateAddress($this->address, array(), ' - ', ' ');
|
||||||
|
|
||||||
|
$free_text = $this->l('DE: Discount excluded ');
|
||||||
|
$free_text .= $this->l(' DI: Discount included');
|
||||||
|
|
||||||
|
$this->smarty->assign(array(
|
||||||
|
'shop_address' => $shop_address,
|
||||||
|
'shop_fax' => Configuration::get('PS_SHOP_FAX'),
|
||||||
|
'shop_phone' => Configuration::get('PS_SHOP_PHONE'),
|
||||||
|
'shop_details' => Configuration::get('PS_SHOP_DETAILS'),
|
||||||
|
'free_text' => $free_text,
|
||||||
|
));
|
||||||
|
return $this->smarty->fetch(_PS_THEME_DIR_.'/pdf/supply-order-footer.tpl');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rounds values of a SupplyOrderDetail object
|
||||||
|
* @param array $collection
|
||||||
|
*/
|
||||||
|
protected function roundSupplyOrderDetails(&$collection)
|
||||||
|
{
|
||||||
|
foreach ($collection as $supply_order_detail)
|
||||||
|
{
|
||||||
|
$supply_order_detail->unit_price_te = Tools::ps_round($supply_order_detail->unit_price_te, 2);
|
||||||
|
$supply_order_detail->price_te = Tools::ps_round($supply_order_detail->price_te, 2);
|
||||||
|
$supply_order_detail->discount_rate = Tools::ps_round($supply_order_detail->discount_rate, 2);
|
||||||
|
$supply_order_detail->price_with_discount_te = Tools::ps_round($supply_order_detail->price_with_discount_te, 2);
|
||||||
|
$supply_order_detail->tax_rate = Tools::ps_round($supply_order_detail->tax_rate, 2);
|
||||||
|
$supply_order_detail->price_ti = Tools::ps_round($supply_order_detail->price_ti, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rounds values of a SupplyOrder object
|
||||||
|
* @param SupplyOrder $supply_order
|
||||||
|
*/
|
||||||
|
protected function roundSupplyOrder(SupplyOrder &$supply_order)
|
||||||
|
{
|
||||||
|
$supply_order->total_te = Tools::ps_round($supply_order->total_te, 2);
|
||||||
|
$supply_order->discount_value_te = Tools::ps_round($supply_order->discount_value_te, 2);
|
||||||
|
$supply_order->total_with_discount_te = Tools::ps_round($supply_order->total_with_discount_te, 2);
|
||||||
|
$supply_order->total_tax = Tools::ps_round($supply_order->total_tax, 2);
|
||||||
|
$supply_order->total_ti = Tools::ps_round($supply_order->total_ti, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+53
@@ -0,0 +1,53 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Open Software License (OSL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/osl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision$
|
||||||
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center; font-size: 6pt; color: #444">
|
||||||
|
{$shop_address|escape:'htmlall':'UTF-8'}<br />
|
||||||
|
|
||||||
|
{if !empty($shop_phone) OR !empty($shop_fax)}
|
||||||
|
{l s='For more assistance, contact Support:' pdf='true'}<br />
|
||||||
|
{if !empty($shop_phone)}
|
||||||
|
Tel: {$shop_phone|escape:'htmlall':'UTF-8'}
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{if !empty($shop_fax)}
|
||||||
|
Fax: {$shop_fax|escape:'htmlall':'UTF-8'}
|
||||||
|
{/if}
|
||||||
|
<br />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{if isset($shop_details)}
|
||||||
|
{$shop_details|escape:'htmlall':'UTF-8'}<br />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{if isset($free_text)}
|
||||||
|
{$free_text|escape:'htmlall':'UTF-8'}<br />
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
@@ -61,19 +61,19 @@
|
|||||||
<tr><td style="line-height: 8px"> </td></tr>
|
<tr><td style="line-height: 8px"> </td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{l s='Products to order:'}
|
{l s='Products ordered:'}
|
||||||
<!-- PRODUCTS -->
|
<!-- PRODUCTS -->
|
||||||
<div style="font-size: 6pt;">
|
<div style="font-size: 6pt;">
|
||||||
<table style="width: 100%;">
|
<table style="width: 100%;">
|
||||||
<tr style="line-height:6px; border: none">
|
<tr style="line-height:6px; border: none">
|
||||||
<td style="width: 8%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Reference'}</td>
|
<td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Reference'}</td>
|
||||||
<td style="width: 34%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Designation'}</td>
|
<td style="width: 31%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Designation'}</td>
|
||||||
<td style="width: 3%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Qty'}</td>
|
<td style="width: 4%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Qty'}</td>
|
||||||
<td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Unit Price TE'}</td>
|
<td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Unit Price TE'}</td>
|
||||||
<td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE BD'}</td>
|
<td style="width: 11%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE (DE)'}</td>
|
||||||
<td style="width: 10%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Discount Rate'}</td>
|
<td style="width: 10%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Discount Rate'}</td>
|
||||||
<td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE AD'}</td>
|
<td style="width: 10%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE (DI)'}</td>
|
||||||
<td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Tax rate'}</td>
|
<td style="width: 7%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Tax rate'}</td>
|
||||||
<td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TI'}</td>
|
<td style="width: 9%; text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TI'}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{* for each product ordered *}
|
{* for each product ordered *}
|
||||||
@@ -82,12 +82,12 @@
|
|||||||
<td>{$supply_order_detail->supplier_reference}</td>
|
<td>{$supply_order_detail->supplier_reference}</td>
|
||||||
<td>{$supply_order_detail->name}</td>
|
<td>{$supply_order_detail->name}</td>
|
||||||
<td>{$supply_order_detail->quantity_expected}</td>
|
<td>{$supply_order_detail->quantity_expected}</td>
|
||||||
<td>{$supply_order_detail->unit_price_te}</td>
|
<td>{$currency->prefix} {$supply_order_detail->unit_price_te} {$currency->suffix}</td>
|
||||||
<td>{$supply_order_detail->price_te}</td>
|
<td>{$currency->prefix} {$supply_order_detail->price_te} {$currency->suffix}</td>
|
||||||
<td>{$supply_order_detail->discount_rate}</td>
|
<td>{$supply_order_detail->discount_rate}</td>
|
||||||
<td>{$supply_order_detail->price_with_discount_te}</td>
|
<td>{$currency->prefix} {$supply_order_detail->price_with_discount_te} {$currency->suffix}</td>
|
||||||
<td>{$supply_order_detail->tax_rate}</td>
|
<td>{$supply_order_detail->tax_rate}</td>
|
||||||
<td>{$supply_order_detail->price_ti}</td>
|
<td>{$currency->prefix} {$supply_order_detail->price_ti} {$currency->suffix}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</table>
|
</table>
|
||||||
@@ -109,9 +109,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{foreach $tax_order_summary as $entry}
|
{foreach $tax_order_summary as $entry}
|
||||||
<tr style="line-height:6px; border: none">
|
<tr style="line-height:6px; border: none">
|
||||||
<td>{$entry['base_te']}</td>
|
<td>{$currency->prefix} {$entry['base_te']} {$currency->suffix}</td>
|
||||||
<td>{$entry['tax_rate']}</td>
|
<td>{$entry['tax_rate']}</td>
|
||||||
<td>{$entry['total_tax_value']}</td>
|
<td>{$currency->prefix} {$entry['total_tax_value']} {$currency->suffix}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</table>
|
</table>
|
||||||
@@ -127,24 +127,24 @@
|
|||||||
<div style="font-size: 6pt;">
|
<div style="font-size: 6pt;">
|
||||||
<table style="width: 30%;">
|
<table style="width: 30%;">
|
||||||
<tr style="line-height:6px; border: none">
|
<tr style="line-height:6px; border: none">
|
||||||
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE'}</td>
|
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE (DE)'}</td>
|
||||||
<td>{$supply_order->total_te}</td>
|
<td>{$currency->prefix} {$supply_order->total_te} {$currency->suffix}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="line-height:6px; border: none">
|
<tr style="line-height:6px; border: none">
|
||||||
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Order Discount'}</td>
|
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Order Discount'}</td>
|
||||||
<td>{$supply_order->discount_value_te}</td>
|
<td>{$currency->prefix} {$supply_order->discount_value_te} {$currency->suffix}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="line-height:6px; border: none">
|
<tr style="line-height:6px; border: none">
|
||||||
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total AD TE'}</td>
|
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TE (DI)'}</td>
|
||||||
<td>{$supply_order->total_with_discount_te}</td>
|
<td>{$currency->prefix} {$supply_order->total_with_discount_te} {$currency->suffix}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="line-height:6px; border: none">
|
<tr style="line-height:6px; border: none">
|
||||||
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Tax value'}</td>
|
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Tax value'}</td>
|
||||||
<td>{$supply_order->total_tax}</td>
|
<td>{$currency->prefix} {$supply_order->total_tax} {$currency->suffix}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="line-height:6px; border: none">
|
<tr style="line-height:6px; border: none">
|
||||||
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TI'}</td>
|
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='Total TI'}</td>
|
||||||
<td>{$supply_order->total_ti}</td>
|
<td>{$currency->prefix} {$supply_order->total_ti} {$currency->suffix}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="line-height:6px; border: none">
|
<tr style="line-height:6px; border: none">
|
||||||
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='TOTAL TO PAY'}</td>
|
<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 5px; font-weight: bold;">{l s='TOTAL TO PAY'}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user