[*] BO : you can now generate manually the invoice
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10814 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
<td style="display:none;" align="center" class="productQuantity" id="add_product_product_stock">0</td>
|
<td style="display:none;" align="center" class="productQuantity" id="add_product_product_stock">0</td>
|
||||||
<td style="display:none;" align="center" id="add_product_product_total">{displayPrice price=0 currency=$currency->id}</td>
|
<td style="display:none;" align="center" id="add_product_product_total">{displayPrice price=0 currency=$currency->id}</td>
|
||||||
<td style="display:none;" align="center" colspan="2">
|
<td style="display:none;" align="center" colspan="2">
|
||||||
{if $order->valid}
|
{if sizeof($invoices_collection)}
|
||||||
<select name="add_product[invoice]" id="add_product_product_invoice" disabled="disabled">
|
<select name="add_product[invoice]" id="add_product_product_invoice" disabled="disabled">
|
||||||
<optgroup label="{l s='Existing'}">
|
<optgroup label="{l s='Existing'}">
|
||||||
{foreach from=$invoices_collection item=invoice}
|
{foreach from=$invoices_collection item=invoice}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
<td class="partial_refund_fields" style="text-align:right;background-color:rgb(232, 237, 194);display:none"><input type="text" size="3" name="partialRefundProduct[{$k}]" /> €</td>
|
<td class="partial_refund_fields" style="text-align:right;background-color:rgb(232, 237, 194);display:none"><input type="text" size="3" name="partialRefundProduct[{$k}]" /> €</td>
|
||||||
{if $can_edit}
|
{if $can_edit}
|
||||||
<td class="product_invoice" colspan="2" style="display: none;text-align:center;">
|
<td class="product_invoice" colspan="2" style="display: none;text-align:center;">
|
||||||
{if $order->hasBeenPaid()}
|
{if sizeof($invoices_collection)}
|
||||||
<select name="product_invoice" class="edit_product_invoice">
|
<select name="product_invoice" class="edit_product_invoice">
|
||||||
{foreach from=$invoices_collection item=invoice}
|
{foreach from=$invoices_collection item=invoice}
|
||||||
<option value="{$invoice->id}" {if $invoice->id == $product['id_order_invoice']}selected="selected"{/if}>#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:$invoice->number}</option>
|
<option value="{$invoice->id}" {if $invoice->id == $product['id_order_invoice']}selected="selected"{/if}>#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:$invoice->number}</option>
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
<div style="float: right; margin: -40px 40px 10px 0;">{$HOOK_INVOICE}</div><br class="clear" />';
|
<div style="float: right; margin: -40px 40px 10px 0;">{$HOOK_INVOICE}</div><br class="clear" />';
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<fieldset style="width:100%; margin-bottom: 10px;">
|
<fieldset style="width:98%; margin-bottom: 10px;">
|
||||||
<div style="width:50%; float: left;">
|
<div style="width:50%; float: left;">
|
||||||
{if (count($invoices_collection))}
|
{if (count($invoices_collection))}
|
||||||
<a href="pdf.php?id_order={$order->id}&pdf"><img src="../img/admin/charged_ok.gif" alt="{l s='View invoice'}" /> {l s='View invoice'}</a>
|
<a href="pdf.php?id_order={$order->id}&pdf"><img src="../img/admin/charged_ok.gif" alt="{l s='View invoice'}" /> {l s='View invoice'}</a>
|
||||||
@@ -103,10 +103,11 @@
|
|||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<div style="width: 98%">
|
||||||
<!-- Left column -->
|
<!-- Left column -->
|
||||||
<div style="width: 48%; float:left;">
|
<div style="width: 48%; float:left;">
|
||||||
<!-- Change status form -->
|
<!-- Change status form -->
|
||||||
<form action="{$currentIndex}&vieworder&token={$smarty.get.token}" method="post" style="text-align:center;">
|
<form action="{$currentIndex}&viewOrder&token={$smarty.get.token}" method="post" style="text-align:center;">
|
||||||
<select name="id_order_state">
|
<select name="id_order_state">
|
||||||
{foreach from=$states item=state}
|
{foreach from=$states item=state}
|
||||||
<option onclick="{if (!$currentState->shipped && $state['shipped'])}showWarehouseList(){else}hideWarehouseList(){/if}" value="{$state['id_order_state']}" {if $state['id_order_state'] == $currentState->id}selected="selected"{/if}>{$state['name']|stripslashes}</option>
|
<option onclick="{if (!$currentState->shipped && $state['shipped'])}showWarehouseList(){else}hideWarehouseList(){/if}" value="{$state['id_order_state']}" {if $state['id_order_state'] == $currentState->id}selected="selected"{/if}>{$state['name']|stripslashes}</option>
|
||||||
@@ -217,7 +218,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{foreachelse}
|
{foreachelse}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3">{l s='No document is available'}</td>
|
<td colspan="3" class="center">
|
||||||
|
<h3>{l s='No document is available'}</h3>
|
||||||
|
<p><a class="button" href="{$currentIndex}&viewOrder&submitGenerateInvoice&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">{l s='Generate invoice'}</a></p>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -230,7 +234,7 @@
|
|||||||
<legend><img src="../img/admin/details.gif" /> {l s='Payment'}</legend>
|
<legend><img src="../img/admin/details.gif" /> {l s='Payment'}</legend>
|
||||||
|
|
||||||
{if !$order->valid}
|
{if !$order->valid}
|
||||||
<form method="post" action="{$currentIndex}&vieworder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
|
<form method="post" action="{$currentIndex}&viewOrder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
|
||||||
<p class="warn">{l s='Don\'t forget to update your conversion rate before make this change.'}</p>
|
<p class="warn">{l s='Don\'t forget to update your conversion rate before make this change.'}</p>
|
||||||
<label>{l s='Change order\'s currency to:'}</label>
|
<label>{l s='Change order\'s currency to:'}</label>
|
||||||
<select name="new_currency">
|
<select name="new_currency">
|
||||||
@@ -250,7 +254,7 @@
|
|||||||
{l s='paid instead of'} <span class="total_paid">{displayPrice price=$order->total_paid_tax_incl currency=$currency->id}</span>
|
{l s='paid instead of'} <span class="total_paid">{displayPrice price=$order->total_paid_tax_incl currency=$currency->id}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form method="post" action="{$currentIndex}&vieworder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
|
<form method="post" action="{$currentIndex}&viewOrder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
|
||||||
<table class="table" width="100%" cellspacing="0" cellpadding="0">
|
<table class="table" width="100%" cellspacing="0" cellpadding="0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -368,6 +372,7 @@
|
|||||||
{$carrierModuleCall}
|
{$carrierModuleCall}
|
||||||
{/if}
|
{/if}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
<br />
|
||||||
|
|
||||||
<!-- Return block -->
|
<!-- Return block -->
|
||||||
<fieldset style="width: 100%">
|
<fieldset style="width: 100%">
|
||||||
@@ -417,7 +422,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- END Right column -->
|
<!-- END Right column -->
|
||||||
<div class="clear" style="margin-bottom: 10px;"></div>
|
<div class="clear" style="margin-bottom: 10px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="width: 98%">
|
||||||
<!-- Addresses -->
|
<!-- Addresses -->
|
||||||
<div style="width: 48%; float:left;"></contact>
|
<div style="width: 48%; float:left;"></contact>
|
||||||
<!-- Shipping address -->
|
<!-- Shipping address -->
|
||||||
@@ -478,8 +485,9 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear" style="margin-bottom: 10px;"></div>
|
<div class="clear" style="margin-bottom: 10px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<form action="{$currentIndex}&vieworder&token={$smarty.get.token}" method="post" onsubmit="return orderDeleteProduct('{l s='Cannot return this product'}', '{l s='Quantity to cancel is greater than quantity available'}');">
|
<form style="width: 98%" action="{$currentIndex}&vieworder&token={$smarty.get.token}" method="post" onsubmit="return orderDeleteProduct('{l s='Cannot return this product'}', '{l s='Quantity to cancel is greater than quantity available'}');">
|
||||||
<input type="hidden" name="id_order" value="{$order->id}" />
|
<input type="hidden" name="id_order" value="{$order->id}" />
|
||||||
<fieldset style="width: 100%; ">
|
<fieldset style="width: 100%; ">
|
||||||
<legend><img src="../img/admin/cart.gif" alt="{l s='Products'}" />{l s='Products'}</legend>
|
<legend><img src="../img/admin/cart.gif" alt="{l s='Products'}" />{l s='Products'}</legend>
|
||||||
@@ -551,28 +559,28 @@
|
|||||||
<div style="float:right;">
|
<div style="float:right;">
|
||||||
<table class="table" width="300px;" cellspacing="0" cellpadding="0">
|
<table class="table" width="300px;" cellspacing="0" cellpadding="0">
|
||||||
<tr id="total_products">
|
<tr id="total_products">
|
||||||
<td width="150px;">{l s='Products'}</td>
|
<td width="150px;"><b>{l s='Products'}</b></td>
|
||||||
<td align="right">{displayPrice price=$order->total_products_wt currency=$currency->id}</td>
|
<td align="right">{displayPrice price=$order->total_products_wt currency=$currency->id}</td>
|
||||||
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);"> </td>
|
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="total_discounts" {if $order->total_discounts_tax_incl == 0}style="display: none;"{/if}>
|
<tr id="total_discounts" {if $order->total_discounts_tax_incl == 0}style="display: none;"{/if}>
|
||||||
<td>{l s='Discounts'}</td>
|
<td><b>{l s='Discounts'}</b></td>
|
||||||
<td align="right">-{displayPrice price=$order->total_discounts_tax_incl currency=$currency->id}</td>
|
<td align="right">-{displayPrice price=$order->total_discounts_tax_incl currency=$currency->id}</td>
|
||||||
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);"> </td>
|
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="total_wrapping" {if $order->total_wrapping_tax_incl == 0}style="display: none;"{/if}>
|
<tr id="total_wrapping" {if $order->total_wrapping_tax_incl == 0}style="display: none;"{/if}>
|
||||||
<td>{l s='Wrapping'}</td>
|
<td><b>{l s='Wrapping'}</b></td>
|
||||||
<td align="right">{displayPrice price=$order->total_wrapping_tax_incl currency=$currency->id}</td>
|
<td align="right">{displayPrice price=$order->total_wrapping_tax_incl currency=$currency->id}</td>
|
||||||
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);"> </td>
|
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="total_shipping">
|
<tr id="total_shipping">
|
||||||
<td>{l s='Shipping'}</td>
|
<td><b>{l s='Shipping'}</b></td>
|
||||||
<td align="right">{displayPrice price=$order->total_shipping_tax_incl currency=$currency->id}</td>
|
<td align="right">{displayPrice price=$order->total_shipping_tax_incl currency=$currency->id}</td>
|
||||||
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);"><input type="text" size="3" name="partialRefundShippingCost" /> €</td>
|
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);"><input type="text" size="3" name="partialRefundShippingCost" /> €</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="font-size: 20px" id="total_order">
|
<tr style="font-size: 20px" id="total_order">
|
||||||
<td>{l s='Total'}</td>
|
<td style="font-size: 20px">{l s='Total'}</td>
|
||||||
<td align="right">
|
<td style="font-size: 20px" align="right">
|
||||||
{displayPrice price=$order->total_paid_tax_incl currency=$currency->id}
|
{displayPrice price=$order->total_paid_tax_incl currency=$currency->id}
|
||||||
</td>
|
</td>
|
||||||
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);"> </td>
|
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);"> </td>
|
||||||
|
|||||||
@@ -993,7 +993,12 @@ class OrderCore extends ObjectModel
|
|||||||
');
|
');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method allows to generate first invoice of the current order
|
||||||
|
*/
|
||||||
public function setInvoice()
|
public function setInvoice()
|
||||||
|
{
|
||||||
|
if (!$this->hasInvoice())
|
||||||
{
|
{
|
||||||
$order_invoice = new OrderInvoice();
|
$order_invoice = new OrderInvoice();
|
||||||
$order_invoice->id_order = $this->id;
|
$order_invoice->id_order = $this->id;
|
||||||
@@ -1033,6 +1038,7 @@ class OrderCore extends ObjectModel
|
|||||||
$this->invoice_date = $res['invoice_date'];
|
$this->invoice_date = $res['invoice_date'];
|
||||||
$this->invoice_number = $res['invoice_number'];
|
$this->invoice_number = $res['invoice_number'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function setDelivery()
|
public function setDelivery()
|
||||||
{
|
{
|
||||||
@@ -1519,5 +1525,18 @@ class OrderCore extends ObjectModel
|
|||||||
WHERE `id_order` = '.(int)$this->id
|
WHERE `id_order` = '.(int)$this->id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Has invoice return true if this order has already an invoice
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function hasInvoice()
|
||||||
|
{
|
||||||
|
return Db::getInstance()->getValue('
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM `'._DB_PREFIX_.'order_invoice`
|
||||||
|
WHERE `id_order` = '.(int)$this->id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ class OrderInvoiceCore extends ObjectModel
|
|||||||
|
|
||||||
if ($row['reduction_amount'] != 0)
|
if ($row['reduction_amount'] != 0)
|
||||||
{
|
{
|
||||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
if ($order->getTaxCalculationMethod() == PS_TAX_EXC)
|
||||||
$row['product_price'] = ($row['product_price'] - ($tax_calculator->removeTaxes($row['reduction_amount'])));
|
$row['product_price'] = ($row['product_price'] - ($tax_calculator->removeTaxes($row['reduction_amount'])));
|
||||||
else
|
else
|
||||||
$row['product_price_wt'] = Tools::ps_round(($row['product_price_wt'] - $row['reduction_amount']), 2);
|
$row['product_price_wt'] = Tools::ps_round(($row['product_price_wt'] - $row['reduction_amount']), 2);
|
||||||
@@ -233,7 +233,7 @@ class OrderInvoiceCore extends ObjectModel
|
|||||||
|
|
||||||
if ($row['group_reduction'] > 0)
|
if ($row['group_reduction'] > 0)
|
||||||
{
|
{
|
||||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
if ($order->getTaxCalculationMethod() == PS_TAX_EXC)
|
||||||
$row['product_price'] = $row['product_price'] * $group_reduction;
|
$row['product_price'] = $row['product_price'] * $group_reduction;
|
||||||
else
|
else
|
||||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] * $group_reduction , 2);
|
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] * $group_reduction , 2);
|
||||||
|
|||||||
@@ -675,6 +675,20 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
else
|
else
|
||||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||||
}
|
}
|
||||||
|
elseif (Tools::isSubmit('submitGenerateInvoice'))
|
||||||
|
{
|
||||||
|
$order = new Order(Tools::getValue('id_order'));
|
||||||
|
if (!Validate::isLoadedObject($order))
|
||||||
|
throw new PrestashopException('Order can\'t be loaded');
|
||||||
|
|
||||||
|
if ($order->hasInvoice())
|
||||||
|
$this->_errors[] = Tools::displayError('This order has already invoice');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$order->setInvoice();
|
||||||
|
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
parent::postProcess();
|
parent::postProcess();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user