// management of discount addition when no invoice on current order

// update the discount form when new invoice is created
This commit is contained in:
aFolletete
2011-12-19 18:24:03 +00:00
parent e97baff814
commit f6d29cc757
7 changed files with 139 additions and 108 deletions
@@ -0,0 +1,52 @@
<form method="POST" action="{$currentIndex}&viewOrder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
<label>{l s='Name'}</label>
<div class="margin-form">
<input type="text" name="discount_name" value="" />
</div>
<label>{l s='Type'}</label>
<div class="margin-form">
<select name="discount_type" id="discount_type">
<option value="1">{l s='Percent'}</option>
<option value="2">{l s='Amount'}</option>
<option value="3">{l s='Free shipping'}</option>
</select>
</div>
<div id="discount_value_field">
<label>{l s='Value'}</label>
<div class="margin-form">
{if ($currency->format % 2)}
<span id="discount_currency_sign" style="display: none;">{$currency->sign}</span>
{/if}
<input type="text" name="discount_value" size="3" />
{if !($currency->format % 2)}
<span id="discount_currency_sign" style="display: none;">{$currency->sign}</span>
{/if}
<span id="discount_percent_symbol">%</span>
<p class="preference_description" id="discount_value_help" style="width: 95%;display: none;">
{l s='This value must be taxes included.'}
</p>
</div>
</div>
{if $order->hasInvoice()}
<label>{l s='Invoice'}</label>
<div class="margin-form">
<select name="discount_invoice">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}" selected="selected">{$invoice->getInvoiceNumberFormatted($current_id_lang)} - {displayPrice price=$invoice->total_paid_tax_incl currency=$order->id_currency}</option>
{/foreach}
</select><br />
<input type="checkbox" name="discount_all_invoices" id="discount_all_invoices" value="1" /> <label class="t" for="discount_all_invoices">{l s='Apply on all invoices'}</label>
<p class="preference_description" style="width: 95%">
{l s='If you select to create this discount for all invoices, one discount will be created per order invoice.'}
</p>
</div>
{/if}
<p class="center">
<input class="button" type="submit" name="submitNewVoucher" value="{l s='Add'}" />&nbsp;
<a href="#" id="cancel_add_voucher">{l s='Cancel'}</a>
</p>
</form>
@@ -15,7 +15,7 @@
{*/if*}
<td class="document_date">{dateFormat date=$document->date_add}</td>
<td class="document_type">Invoice</td>
<td class="document_number"><a href="pdf.php?pdf&id_order_invoice={$document->id}">#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:$document->number}</a></td>
<td class="document_number"><a href="pdf.php?pdf&id_order_invoice={$document->id}">{$document->getInvoiceNumberFormatted($current_id_lang)}</a></td>
<td class="document_amount">
{*if TYPE DOCUMENT = INVOICE *}
{displayPrice price=$document->total_paid_tax_incl currency=$currency->id}&nbsp;
@@ -24,7 +24,7 @@
<select name="add_product[invoice]" id="add_product_product_invoice" disabled="disabled">
<optgroup class="existing" label="{l s='Existing'}">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}">#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:$invoice->number}</option>
<option value="{$invoice->id}">{$invoice->getInvoiceNumberFormatted($current_id_lang)}</option>
{/foreach}
</optgroup>
<optgroup label="{l s='New'}">
+3 -52
View File
@@ -231,7 +231,7 @@
<td>{displayPrice price=$payment->amount currency=$payment->id_currency}</td>
<td>
{if $payment->id_order_invoice}
#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:OrderInvoice::retrieveOneById($payment->id_order_invoice)->number}
{OrderInvoice::retrieveOneById($payment->id_order_invoice)->getInvoiceNumberFormatted($current_id_lang)}
{else}
{l s='No invoice'}
{/if}
@@ -270,7 +270,7 @@
<td>
<select name="payment_invoice" id="payment_invoice">
{foreach from=$not_paid_invoices_collection item=invoice}
<option value="{$invoice->id}" selected="selected">#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:$invoice->number}</option>
<option value="{$invoice->id}" selected="selected">{$invoice->getInvoiceNumberFormatted($current_id_lang)}</option>
{/foreach}
</select>
</td>
@@ -570,56 +570,7 @@
</tr>
<tr style="display: none" >
<td colspan="3" class="current-edit" id="voucher_form">
<form method="POST" action="{$currentIndex}&viewOrder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
<label>{l s='Name'}</label>
<div class="margin-form">
<input type="text" name="discount_name" value="" />
</div>
<label>{l s='Type'}</label>
<div class="margin-form">
<select name="discount_type" id="discount_type">
<option value="1">{l s='Percent'}</option>
<option value="2">{l s='Amount'}</option>
<option value="3">{l s='Free shipping'}</option>
</select>
</div>
<div id="discount_value_field">
<label>{l s='Value'}</label>
<div class="margin-form">
{if ($currency->format % 2)}
<span id="discount_currency_sign" style="display: none;">{$currency->sign}</span>
{/if}
<input type="text" name="discount_value" size="3" />
{if !($currency->format % 2)}
<span id="discount_currency_sign" style="display: none;">{$currency->sign}</span>
{/if}
<span id="discount_percent_symbol">%</span>
<p class="preference_description" id="discount_value_help" style="width: 95%;display: none;">
{l s='This value must be taxes included.'}
</p>
</div>
</div>
<label>{l s='Invoice'}</label>
<div class="margin-form">
<select name="discount_invoice">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}" selected="selected">#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:$invoice->number} - {displayPrice price=$invoice->total_paid_tax_incl currency=$order->id_currency}</option>
{/foreach}
</select><br />
<input type="checkbox" name="discount_all_invoices" id="discount_all_invoices" value="1" /> <label class="t" for="discount_all_invoices">{l s='Apply on all invoices'}</label>
<p class="preference_description" style="width: 95%">
{l s='If you select to create this discount for all invoices, one discount will be created per order invoice.'}
</p>
</div>
<p class="center">
<input class="button" type="submit" name="submitNewVoucher" value="{l s='Add'}" />&nbsp;
<a href="#" id="cancel_add_voucher">{l s='Cancel'}</a>
</p>
</form>
{include file='orders/_discount_form.tpl'}
</td>
</tr>
{/if}