426 lines
18 KiB
Smarty
426 lines
18 KiB
Smarty
{extends "../window.tpl"}
|
|
|
|
{block tabs}
|
|
{if $body.data.id_index == 'future'}
|
|
{windowTab id='titleFuture'}
|
|
{else}
|
|
{windowTab id='title'}
|
|
{/if}
|
|
{/block}
|
|
|
|
{block title}
|
|
{if $body.data.id_index == 'future'}
|
|
{if $body.acn == "add"}
|
|
{'titleAddFuture'|translate}
|
|
{else}
|
|
{'titleEditFuture'|translate}
|
|
{/if}
|
|
{elseif $body.data.id_index == 'preorder'}
|
|
{if $body.acn == "add"}
|
|
{'titleAddPreorder'|translate}
|
|
{else}
|
|
{'titleEditPreorder'|translate}
|
|
{/if}
|
|
{else}
|
|
{$smarty.block.parent}
|
|
{/if}
|
|
{/block}
|
|
|
|
{block size}
|
|
width = 1280;
|
|
{/block}
|
|
|
|
{block tabsContent}
|
|
<div id="title" class="tab-pane fade active in boxStatic box">
|
|
{if $body.data.data.parent_stock_in}
|
|
<div class="alert alert-warning">
|
|
<strong>
|
|
{'autoCreatedFromIncomplete'|translate}
|
|
<a href="javascript:nw('stockIn', '{$body.data.data.parent_stock_in.id}');">{$body.suppliers[$body.data.id_supplier]} - {$body.data.data.parent_stock_in.number}</a>
|
|
</strong>
|
|
</div>
|
|
{/if}
|
|
|
|
<div class="form-group">
|
|
<div class="col-md-2 control-label"><label>ID</label></div>
|
|
<div class="col-md-3">
|
|
<input type="text" class="form-control input-sm" value="{$body.data.number}" disabled="disabled"/>
|
|
</div>
|
|
<div class="col-md-2 control-label"><label>{'priceType'|translate}</label></div>
|
|
<div class="col-md-3">
|
|
{if $body.data.multiplier != 1}
|
|
{$body.data.data.vatDisplay=3}
|
|
{/if}
|
|
{print_select name="data[data][vatDisplay]" var=$body.paid selected=$body.data.data.vatDisplay}
|
|
<script type="text/javascript">
|
|
{* Musim to tu nechat kvuli zpetne kompatibilite :( *}
|
|
{if empty($body.data.data.vatDisplay)}
|
|
$(document).ready(function () {
|
|
var value = localStorage.getItem('stockIn-vatDisplay-{$body.data.id}');
|
|
if (value || value == 0) {
|
|
unstyleFormInputs('#title');
|
|
$("select[name='data[data][vatDisplay]']").val(value).change();
|
|
styleFormInputs('#title');
|
|
}
|
|
|
|
$("select[name='data[data][vatDisplay]']").change(function () {
|
|
var value = $(this).val();
|
|
localStorage.setItem('stockIn-vatDisplay-{$body.data.id}', value);
|
|
});
|
|
});
|
|
{/if}
|
|
|
|
$("select[name='data[data][vatDisplay]']").change(function(event){
|
|
var $inputVat = $('.inputVat'),
|
|
$inputWOVat = $('.inputWOVat'),
|
|
$inputRate = $('.inputRate');
|
|
|
|
$inputVat.show();
|
|
$inputWOVat.show();
|
|
$inputRate.hide();
|
|
|
|
switch($(event.target).val())
|
|
{
|
|
case '2':
|
|
$inputVat.hide();
|
|
break;
|
|
case '1':
|
|
$inputWOVat.hide();
|
|
break;
|
|
case '0':
|
|
$inputWOVat.filter('.switch').hide();
|
|
break;
|
|
case '3':
|
|
$inputRate.show();
|
|
$inputVat.hide();
|
|
$inputWOVat.hide();
|
|
break;
|
|
}
|
|
});
|
|
</script>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-md-2 control-label"><label>{'supplier'|translate}</label></div>
|
|
<div class="col-md-3">
|
|
{print_select name="data[id_supplier]" var=$body.suppliers selected=$body.data.id_supplier}
|
|
</div>
|
|
<div class="col-md-2 control-label"><label>{'paymentType'|translate}</label></div>
|
|
<div class="col-md-3">
|
|
{print_select name="data[payment_method]" var=$body.paymentMethods selected=$body.data.payment_method}
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-md-2 control-label"><label>{'invoiceNumber'|translate}</label></div>
|
|
<div class="col-md-3">
|
|
<input type="text" class="form-control input-sm" name="data[code]" value="{$body.data.code}" />
|
|
</div>
|
|
{*
|
|
<div class="col-md-2 control-label"><label>Indexová řada</label></div>
|
|
<div class="col-md-3">
|
|
{if $body.acn == "add"}
|
|
{print_select name="data[id_index]" var=$body.indexes selected=$body.data.id_index}
|
|
{else}
|
|
<input type="hidden" name="data[id_index]" value="{$body.data.id_index}">
|
|
<input type="text" class="form-control input-sm" value="{$body.data.index_name}" disabled="disabled"/>
|
|
{/if}
|
|
</div>
|
|
*}
|
|
<div class="col-md-2 control-label"><label>{'currencyRate'|translate}</label></div>
|
|
<div class="col-md-1">
|
|
<input type="text" class="form-control input-sm" name="data[multiplier]" value="{$body.data.multiplier}" />
|
|
</div>
|
|
<div class="col-md-1 control-label"><label>{'foreignCurrency'|translate}</label></div>
|
|
<div class="col-md-1">
|
|
<input type="text" class="form-control input-sm" name="data[data][currency_symbol]" value="{$body.data.currency_symbol}" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-md-2 control-label"><label>{if $body.data.id_index == 'future'}{'dateStockIn'|translate}{else}{'dateIssued'|translate}{/if}</label></div>
|
|
<div class="col-md-3">
|
|
<input type="hidden" class="form-control input-sm" name="data[date_created]" value="{$body.data.date_created}">
|
|
<input type="text" class="form-control input-sm" name="data[date_issued]" id="date_issued" value="{$body.data.date_issued|format_date:'admin'}" autocomplete="off" />
|
|
{insert_calendar selector='#date_issued' format='date'}
|
|
</div>
|
|
<div class="col-md-2 control-label"><label>{'paid'|translate}</label></div>
|
|
<div class="col-md-3">
|
|
{print_select name="data[paid]" var=$body.paid2 selected=$body.data.paid}
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-md-2 control-label"><label>{'dateExpiration'|translate}</label></div>
|
|
<div class="col-md-3">
|
|
<input type="text" class="form-control input-sm" name="data[date_expiration]" id="date_expiration" maxlength="100" value="{$body.data.date_expiration|format_date:'admin'}" autocomplete="off"/>
|
|
{insert_calendar selector='#date_expiration' format='date'}
|
|
</div>
|
|
|
|
<div class="col-md-2 control-label"><label>{'note'|translate}</label></div>
|
|
<div class="col-md-3">
|
|
<input type="text" class="form-control input-sm" name="data[note]" maxlength="100" value="{$body.data.note}" />
|
|
</div>
|
|
</div>
|
|
{ifmodule STORES}
|
|
<div class="form-group">
|
|
<div class="col-md-2 control-label"><label>{'store'|translate}</label></div>
|
|
<div class="col-md-3">
|
|
{print_select name="data[data][id_store]" var=$body.stores selected=$body.data.data.id_store}
|
|
</div>
|
|
</div>
|
|
{/ifmodule}
|
|
|
|
{if $body.acn == "add"}
|
|
<div class="alert alert-{if $body.data.id_index == 'future'}warning{elseif $body.data.id_index == 'preorder'}info{else}success{/if}"><strong>Vytváříte {if $body.data.id_index == 'future'}budoucí {elseif $body.data.id_index == 'preorder'}předobjednávkovou{else}příjmovou{/if} fakturu</strong></div>
|
|
<input type="hidden" name="data[id_index]" value="{$body.data.id_index}">
|
|
{/if}
|
|
{if $body.acn != "add"}
|
|
<div class="panel-group panel-group-lists" id="stockin">
|
|
{include "window/stockIn.items.tpl"}
|
|
</div>
|
|
|
|
<h1 class="h4 main-panel-title">{'totalPrice'|translate}</h1>
|
|
<div class="form-group" data-calculate="wrap">
|
|
<div class="col-md-2 control-label"><label>{'deliveryPrice'|translate}</label></div>
|
|
<span class="inputWOVat">
|
|
<div class="col-md-1">
|
|
<p class="input-height">
|
|
{'withoutTax'|translate:'choice'}
|
|
</p>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="input-group">
|
|
<input type="text" class="form-control input-sm" name="data[transport_price]" id="transport_price" data-calculate="piece_price" maxlength="100" value="{$body.data.transport_price}" />
|
|
<span class="input-group-addon">{$dbcfg.currency}</span>
|
|
</div>
|
|
</div>
|
|
</span>
|
|
<span class="inputVat">
|
|
<div class="col-md-1">
|
|
<p class="input-height">
|
|
{'withTax'|translate:'choice'}
|
|
</p>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="input-group">
|
|
<input type="text" class="form-control input-sm" name="data[transport_price_vat]" id="transport_price_vat" data-calculate="piece_price_vat" maxlength="100" value="{($body.data.transport_price * (100+$body.data.transportVat)/100)|round:2}" />
|
|
<span class="input-group-addon">{$dbcfg.currency}</span>
|
|
</div>
|
|
</div>
|
|
</span>
|
|
<span class="inputRate">
|
|
<div class="col-md-2">
|
|
<div class="input-group">
|
|
<input type="text" class="form-control input-sm" name="data[transport_price_rate]" id="transport_price_rate" data-calculate="piece_price_rate" maxlength="100" value="{($body.data.transport_price / $body.data.multiplier)}" />
|
|
<span class="input-group-addon">{$body.data.currency_symbol}</span>
|
|
</div>
|
|
</div>
|
|
</span>
|
|
<input type="hidden" value="{$body.data.transportVat}" name="data[transportVat]" data-calculate="vat">
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group" data-calculate="wrap">
|
|
<div class="col-md-2 control-label"><label>{'discount'|translate}</label></div>
|
|
<span class="inputWOVat">
|
|
<div class="col-md-1">
|
|
<p class="input-height">
|
|
{'withoutTax'|translate:'choice'}
|
|
</p>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="input-group">
|
|
<input type="text" class="form-control input-sm" name="data[discount]" data-calculate="piece_price" maxlength="100" value="{$body.data.discount|round:2}" />
|
|
<span class="input-group-addon">{$dbcfg.currency}</span>
|
|
</div>
|
|
</div>
|
|
</span>
|
|
<span class="inputVat">
|
|
<div class="col-md-1">
|
|
<p class="input-height">
|
|
{'withTax'|translate:'choice'}
|
|
</p>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="input-group">
|
|
<input type="text" class="form-control input-sm" name="data[discount_withvat]" data-calculate="piece_price_vat" maxlength="100" value="{($body.data.discount * (1+$body.data.transportVat/100.))|round:2}" />
|
|
<span class="input-group-addon">{$dbcfg.currency}</span>
|
|
</div>
|
|
</div>
|
|
</span>
|
|
<span class="inputRate">
|
|
<div class="col-md-2">
|
|
<div class="input-group">
|
|
<input type="text" class="form-control input-sm" name="data[discount_rate]" data-calculate="piece_price_rate" maxlength="100" value="{(($body.data.discount) / $body.data.multiplier)|round:2}" />
|
|
<span class="input-group-addon">{$body.data.currency_symbol}</span>
|
|
</div>
|
|
</div>
|
|
</span>
|
|
<input type="hidden" value="{$body.data.transportVat}" data-calculate="vat">
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
calcPrices({ selector:'[data-calculate=wrap]', multiplier:$.dataField('multiplier') });
|
|
</script>
|
|
<div class="form-group">
|
|
<div class="col-md-2 control-label"><label>{'totalPriceWithoutVat'|translate}</label></div>
|
|
<div class="col-md-2">
|
|
<p class="input-height">
|
|
{$body.data.total_price|format_price:"ceil=no"}
|
|
</p>
|
|
</div>
|
|
<div class="col-md-2 control-label"><label>{'totalPriceWithVat'|translate}</label></div>
|
|
<div class="col-md-2">
|
|
<p class="input-height">
|
|
{$body.data.total_price_vat|format_price:"ceil=no"}
|
|
</p>
|
|
</div>
|
|
{if $body.data.multiplier != 1}
|
|
<div class="col-md-2 control-label"><label>{'totalPrice'|translate} {$body.data.currency_symbol}</label></div>
|
|
<div class="col-md-2">
|
|
<p class="input-height">
|
|
{{$body.data.total_price/$body.data.multiplier}|round:2} {$body.data.currency_symbol}
|
|
</p>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<div class="col-md-2 control-label">
|
|
<label>{'totalQuantity'|translate}</label>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<p class="input-height">
|
|
{$body.totalQuantity}
|
|
</p>
|
|
</div>
|
|
<div class="col-md-2 control-label">
|
|
<label>{'itemsCount'|translate}</label>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<p class="input-height">
|
|
{$body.itemsCount}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
{/if}
|
|
</div>
|
|
{/block}
|
|
{block actionMenuButtons}
|
|
{if $body.data.id_index == 'future' && $body.acn == 'edit'}
|
|
<li role="separator" class="divider"></li>
|
|
{if ($module.WAREHOUSE || $module.CHECK_APP) && !$body.data.isExternalStore}
|
|
<li><a href="javascript:nw('stockInCheck', {$body.data.id});closeWindow();" >
|
|
<span class="glyphicon glyphicon-list-alt text-danger"></span> Vstupní kontrola</a></li>
|
|
{else}
|
|
<li><button name="Submit" id='receivedButton' class="btn btn-block btn-danger" value="recieved">
|
|
Přijato</button></li>
|
|
{/if}
|
|
{/if}
|
|
{/block}
|
|
|
|
<script type="text/javascript">
|
|
{block onready append}
|
|
calcPrices({ selector:'#addItem', multiplier:$.dataField('multiplier') });
|
|
|
|
$("select[name='data[data][vatDisplay]']").change();
|
|
|
|
initForm({
|
|
selector: '#stockin',
|
|
beforeAdd: function(original){
|
|
var $form = original();
|
|
createAutocomplete($form);
|
|
}
|
|
});
|
|
|
|
function printCodes(){
|
|
data = [
|
|
{foreach $body.items as $key => $item}
|
|
{
|
|
idv: "{$item.id_variation}",
|
|
idp: "{$item.id_product}",
|
|
pcs: "{$item.quantity}"
|
|
}{if !$item@last},{/if}
|
|
{/foreach}
|
|
];
|
|
$.redirectPost({ url:"launch.php?s=printCenter.php&type=product&", data: { JSON_IDs: JSON.stringify(data)}, target:"Vytisknutí štítků" });
|
|
}
|
|
|
|
function createAutocomplete($form)
|
|
{
|
|
function disableCalculateFields(disable)
|
|
{
|
|
if (disable) {
|
|
$form.find('[data-calculate]').prop('disabled', disable);
|
|
$form.find('[data-calculate]').prop('title', 'Vyberte variantu!');
|
|
|
|
$form.find('[data-calculate=pieces]').prop('disabled', !disable);
|
|
$form.find('[data-calculate=pieces]').removeAttr('title');
|
|
} else {
|
|
$form.find('[data-calculate]').prop('disabled', disable);
|
|
$form.find('[data-calculate]').removeAttr('title');
|
|
}
|
|
}
|
|
|
|
function selectVariation(id_product, id_variation)
|
|
{
|
|
if (id_variation == -1) {
|
|
disableCalculateFields(true);
|
|
} else {
|
|
disableCalculateFields(false);
|
|
}
|
|
|
|
$.getJSON('launch.php?s=ajax.php&type=product_of_suppliers_info&id_product='+id_product+"&id_variation="+id_variation+"&id_supplier={$body.data.id_supplier}", function(data) {
|
|
console.log(data);
|
|
if(data.length > 0)
|
|
data = data[0];
|
|
else
|
|
data = { 'code': '' };
|
|
$form.find(':input[name*=supplier_code]').val(data['code']);
|
|
});
|
|
|
|
$.getJSON('launch.php?s=ajax.php&type=product_info&id_product=' +id_product+ '&id_variation=' +id_variation, function (data) {
|
|
if(data.length > 0)
|
|
data = data[0];
|
|
else
|
|
data = { 'price': '0' };
|
|
|
|
var vat = Number(data['vat']),
|
|
price = Number(data['price']*((100 + vat) / 100));
|
|
$form.find('[data-web-price]').text(roundPrice(price) + ' Kč');
|
|
});
|
|
}
|
|
{block 'autocomplete-js'}
|
|
new $.wpjAutoCompleteVariation({
|
|
inputProduct: $form.find(":input[name*=id_product]"),
|
|
inputVariation: $form.find(":input[name*=id_variation]"),
|
|
inputFields: {
|
|
'vat': $form.find(":input.vat"),
|
|
'price_buy': $form.find(":input.piece_price"),
|
|
'price_buy_with_vat': $form.find(":input.piece_price_with_vat")
|
|
},
|
|
callbacks: {
|
|
'selectVariation': selectVariation
|
|
},
|
|
productOptions: {
|
|
params: '&supplier={$body.data.id_supplier}&visible=0'
|
|
}
|
|
});
|
|
|
|
$form.find(":input[name*=id_product_text]").focus();
|
|
{/block}
|
|
}
|
|
|
|
$('.doubleVal').keyup(function(event){
|
|
$(event.target).val($(event.target).val().replace(",", "."));
|
|
});
|
|
|
|
$(function() {
|
|
UnsavedOff();
|
|
$('[data-form-add]').click();
|
|
UnsavedOn();
|
|
});
|
|
{/block}
|
|
</script>
|