shop-old/themes/admin/templates/admin_incomming_goods_view.tpl
2026-04-20 01:03:43 +02:00

507 lines
18 KiB
Smarty

<br />
<div style="background:#eeeeee;padding:10px;">
<br />
<form method="post" action="" id="table_incomming_goods">
<table border="0" cellpadding="2" cellspacing="1" style="border:1px solid #aaaaaa;background:#cccccc;width:930px;">
<tr>
<td colspan="10" style="text-align:center;background:#ffffff;">
<table border="0" cellpadding="4" cellspacing="2" width="100%">
<tr style="background:#dddddd;">
<td colspan="2" style="text-align:center;background:#dddddd;font-weight:bold;">Bestelldaten</td>
<td colspan="2" style="text-align:center;background:#dddddd;font-weight:bold;">Warenwert</td>
</tr>
<tr style="background:#dddddd;">
<td style="font-weight:bold;text-align:left;">Lieferant:</td>
<td style="text-align:right;">
<select name="vendor_id">
<option value="0">-</option>
{foreach from=$form_data->vendors item=vendor}
<option value="{$vendor->vendor_id}" {if $form_data->vendor_id == $vendor->vendor_id}selected{/if}>{$vendor->vendor_name}</option>
{/foreach}
</select>
</td>
<td style="font-weight:bold;text-align:left;">Warenwert (netto):</td>
<td style="text-align:right;">{$form_data->price_sum_netto|number_format:"2":",":"."} &euro;</td>
</tr>
<tr style="background:#dddddd;">
<td style="font-weight:bold;text-align:left;">Rechnungsnummer:</td>
<td style="text-align:right;"><input style="text-align:right;" type="text" id="number" name="number" value="{$form_data->number}"></td>
<td style="font-weight:bold;text-align:left;">Warenbezugskosten (netto):</td>
{if $form_data->conversion_price > 0}
<td style="text-align:right;">
<input style="width:70px;" type="text" id="currency_cost_sum" name="currency_cost_sum" value="" /> {$form_data->currency} =&gt; <input style="width:70px;background:transparent;border:1px solid #aaaaaa;" readonly type="text" id="warenbezugskosten" name="cost_sum" value="{$form_data->cost_sum|number_format:"2":",":""}"> &euro;</td>
{else}
<td style="text-align:right;"><input style="text-align:right;" type="text" id="warenbezugskosten" name="cost_sum" value="{$form_data->cost_sum|number_format:"2":",":""}"> &euro;</td>
{/if}
</tr>
<tr style="background:#dddddd;">
<td style="font-weight:bold;text-align:left;">Datum:</td>
<td style="text-align:right;"><input style="text-align:right;" type="text" id="incomming_date" name="date" value="{$form_data->formated_date}"></td>
<td style="font-weight:bold;text-align:left;">7% Umsatzsteuer:</td>
<td style="text-align:right;">{$form_data->tax_7|number_format:"2":",":"."} &euro;</td>
</tr>
<tr style="background:#dddddd;">
<td style="font-weight:bold;text-align:left;">EG-Nr:</td>
<td style="text-align:right;"><input style="text-align:right;" type="text" id="eg_nr" name="eg_nr" value="{$form_data->eg_nr}"></td>
<td style="font-weight:bold;text-align:left;">19% Umsatzsteuer:</td>
<td style="text-align:right;">{$form_data->tax_19|number_format:"2":",":"."} &euro;</td>
</tr>
<tr style="background:#dddddd;">
<td style="font-weight:bold;text-align:left;">Herkunft:</td>
<td style="text-align:right;">
<select name="import">
<option value="0">Inland</option>
<option value="1" {if $form_data->import}selected{/if}>Import</option>
</select>
</td>
<td style="font-weight:bold;text-align:left;">Warenwert (brutto):</td>
<td style="text-align:right;">{$form_data->price_sum_brutto|number_format:"2":",":"."} &euro;</td>
</tr>
<tr style="background:#dddddd;">
<td style="font-weight:bold;text-align:left;">Rechnung:</td>
<td style="text-align:right;">
{if $form_data->id}
{if $form_data->bill_file != ''}
<a style="text-decoration:none;" href="{$SHOP_DIR}documents/incomming_goods_bill/{$form_data->bill_file}" target="_blank">{$form_data->bill_file}</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a title="löschen" style="position:relative;top:3px;" id="delete_bill_file" href="./index.php?admin_modul=admin_incomming_goods_editor&id={$form_data->id}&action=delete_bill_file" ><img src="./themes/admin/media/images/delete.png" alt="Löschen" border="0" /></a>
{else}
<input id="file_upload" name="uploading_file" type="file" />
{/if}
{else}
Es kann erst nach dem Speichern eine Datei hinzugefügt werden!
{/if}
</td>
<td style="font-weight:bold;text-align:left;">Skonto:</td>
<td style="text-align:right;"><input style="text-align:right;width:60px;" type="text" id="skonto" name="skonto" value="{$form_data->skonto}">%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {$form_data->skonto_sum|number_format:"2":",":"."} &euro;</td>
</tr>
<tr style="background:#dddddd;">
<td colspan="2"></td>
<td style="font-weight:bold;text-align:left;">zu bezahlender Betrag:</td>
<td style="text-align:right;">{$form_data->cash_sum|number_format:"2":",":"."} &euro;</td>
</tr>
<tr style="background:#dddddd;">
<td style="text-align:right;" colspan="4"></td>
</tr>
<tr style="background:#dddddd;">
<td style="background:#F4A460;font-weight:bold;text-align:left;">Eingabewährung (z.B. USD, CHF...):</td>
<td style="background:#F4A460;text-align:right;"><input style="text-align:right;" type="text" id="currency" name="currency" value="{$form_data->currency}"></td>
<td style="background:#F4A460;font-weight:bold;text-align:left;">Umrechnungskurs in EURO:</td>
<td style="background:#F4A460;text-align:right;"><input style="text-align:right;" type="text" id="conversion_price" name="conversion_price" value="{$form_data->conversion_price}"></td>
</tr>
</table>
</td>
</tr>
{if $form_data->id}
<input type="hidden" id="field_incomming_goods_id" name="id" value="{$form_data->id}" />
<tr>
<td colspan="10" style="text-align:center;background:#ff9900;">
<table border="0" cellpadding="6" cellspacing="0">
<tr>
<td style="text-align:left;text-align:left;height:60px;">
<label>Artikel (Bezeichnung, Nummer oder EAN):</label><br />
<input type="hidden" id="item_search_id" value="0" /><input type="text" id="item_search" style="width:250px;" autocomplete="off" />
<div id="item_search_results" class="search_results hidden" style="position:absolute;width:280px;"></div>
<span id="item_search_hits"></span>
</td>
<td style="text-align:left;background:#ff9900;"><label>Lager</label><br /><input style="width:50px;background:transparent;border:0px;" type="text" id="item_inventory" name="item_inventory" readonly value="" /></td>
<td style="text-align:left;background:#ff9900;"><label>St&uuml;ck</label><br /><input style="width:50px;" type="text" id="new_item_amount" name="new_item_amount" value="" /></td>
{if $form_data->conversion_price > 0}
<td style="text-align:left;background:#ff9900;" colspan="2"><label>Warenwert</label><br /><input style="width:70px;" type="text" id="currency_price" name="currency_price" value="" /> {$form_data->currency} / St.</td>
<td style="text-align:left;background:#ff9900;" colspan="2"><label></label><br /> =&gt; <input style="width:70px;background:transparent;border:1px solid #aaaaaa;" readonly type="text" id="new_item_price_sum" name="new_item_price_sum" value="" /> &euro; / St.</td>
{else}
<td style="text-align:left;background:#ff9900;" colspan="2"><label>Warenwert</label><br /><input style="width:70px;" type="text" id="new_item_price_sum" name="new_item_price_sum" value="" /> &euro; / St.</td>
{/if}
<td style="text-align:center;background:#ff9900;" colspan="6"><input type="button" style="position:relative;top:10px;" id="add_item" name="add_item" value="Artikel hinzufügen" /></td>
</tr>
</table>
</td>
</tr>
{/if}
<tr>
<td style="text-align:center;background:#dddddd;font-weight:bold;">Art.-Nr.</td>
<td style="text-align:center;background:#dddddd;font-weight:bold;">Bezeichnung</td>
<td style="text-align:center;background:#dddddd;font-weight:bold;width:70px;height:30px;">Menge</td>
<td style="text-align:center;background:#dddddd;font-weight:bold;width:100px;text-align:right;">Warenwert&nbsp;</td>
<td style="text-align:center;background:#dddddd;font-weight:bold;text-align:right;">Besch.Kosten&nbsp;</td>
<td style="text-align:center;background:#dddddd;font-weight:bold;text-align:right;">EK St&uuml;ckpreis&nbsp;</td>
<td style="text-align:center;background:#dddddd;font-weight:bold;">MwSt. %</td>
<td style="text-align:center;background:#dddddd;font-weight:bold;">&nbsp;</td>
</tr>
{foreach item=article from=$form_data->item_list}
<input type="hidden" name="item_id[]" value="{$article->id}" />
<tr style="background:#eeeeee;border: 1px solid #ffffff;">
<td style="text-align:center;background:#ffffff;text-align:left;">{$article->item_number}</td>
<td style="text-align:center;background:#ffffff;text-align:left;">{$article->item_name}</td>
<td style="text-align:center;background:#ffffff;" class="field_amount">
<div class="amount_edit" style="display:none;"><input type="text" name="item_amount[]" style="width:50px;text-align:center;border:0px;height:15px;" value="{$article->amount}" /></div>
<div class="amount_show">{$article->amount}</div>
</td>
<td style="background:#ffffff;text-align:right;" class="field_price_sum">
<div class="price_sum_edit" style="display:none;"><input type="text" style="width:80px;border:0px;height:15px;text-align:right;" name="item_price_sum[]" value="{$article->price_sum|number_format:"2":",":""}" /> &euro;&nbsp;</div>
<div class="price_sum_show">{$article->price_sum|number_format:"2":",":"."} &euro; / St.&nbsp;</div>
</td>
<td style="text-align:center;background:#ffffff;text-align:right;">{$article->item_beschaffungskosten|number_format:"2":",":"."} &euro;&nbsp;</td>
<td style="text-align:center;background:#ffffff;text-align:right;">{$article->item_price_ek|number_format:"2":",":"."} &euro;&nbsp;</td>
<td style="text-align:center;background:#ffffff;">{$article->item_tax}</td>
<td style="text-align:center;background:#ffffff;">
<a class="delete_item" rel="{$article->id}" href="#" title="L&ouml;schen">
<img src="{$info->base_url}/themes/admin/media/images/delete.png" alt="L&ouml;schen" />
</a>
</td>
</tr>
{/foreach}
<tr>
<td style="text-align:center;background:#dddddd;"></td>
<td style="text-align:center;background:#dddddd;"></td>
<td style="text-align:center;background:#dddddd;"></td>
<td style="text-align:center;background:#dddddd;"></td>
<td style="text-align:center;background:#dddddd;"></td>
<td style="text-align:center;background:#dddddd;font-weight:bold;text-align:right;"></td>
<td style="text-align:center;background:#dddddd;font-weight:bold;text-align:right;"></td>
<td style="text-align:center;background:#dddddd;"></td>
</tr>
</table>
<br />
<input type="button" id="save_form" value="Speichern">
</form>
<br />
<script>
$(document).ready(function() {
// calc curency price
$('#currency_price').live('keyup', function(e) {
e.preventDefault();
var price = $(this).val();
var new_price = 0;
var conversion_price = $('#conversion_price').val();
price = price.replace(',','.');
//price = parseFloat(price);
if (isNaN(price)) {
$(this).css('background', '#ff0000');
}
else {
$(this).css('background', '#ffffff');
}
new_price = price * conversion_price;
$('#new_item_price_sum').val(new_price);
});
$('#currency_cost_sum').live('keyup', function(e) {
e.preventDefault();
var price = $(this).val();
var new_price = 0;
var conversion_price = $('#conversion_price').val();
price = price.replace(',','.');
//price = parseFloat(price);
if (isNaN(price)) {
$(this).css('background', '#ff0000');
}
else {
$(this).css('background', '#ffffff');
}
new_price = price * conversion_price;
$('#warenbezugskosten').val(new_price);
});
// save ec sum
$('#save_form').click(function() {
var jqxhr;
var form_data;
form_data = $('#table_incomming_goods').serialize();
jqxhr = $.ajax({
'url' : './index.php?admin_modul=admin_incomming_goods_editor&action=update',
'dataType' : 'JSON',
'type' : 'POST',
'data' : form_data
});
jqxhr.success(function(data) {
if (data.status == 'success') {
$('#incomming_goods_id').val(data.id);
$('#admin_incomming_goods_edit').submit();
} else {
alert('Error!');
}
});
});
// save new item
$('#add_item').click(function() {
var jqxhr;
jqxhr = $.ajax({
'url' : './index.php?admin_modul=admin_incomming_goods_editor',
'dataType' : 'JSON',
'type' : 'POST',
'data' : {
'action' : 'add_item',
'id' : $('#incomming_goods_id').val(),
'item_id' : $('#item_search_id').val(),
'amount' : $('#new_item_amount').val(),
'price_sum' : $('#new_item_price_sum').val()
}
});
jqxhr.success(function(data) {
if (data.status == 'success') {
$('#admin_incomming_goods_edit').submit();
} else {
alert('Error!');
}
});
});
// item search code
$('#item_search').live('keyup', function(e) {
e.preventDefault();
if($(this).val().length >= 3) {
var jqxhr = $.ajax({
'url': './index.php?admin_modul=admin_item&mod=json&action=get_by_string&data=' + $(this).val()
});
jqxhr.success(function(data) {
try {
var data = $.parseJSON(data);
$('#item_search_hits').text(data.hits + " Ergebnisse");
if (data.hits >= 1) {
$('#item_search_results').removeClass('hidden');
} else {
$('#item_search_results').addClass('hidden');
}
$('#item_search_results').html('');
$.each(data.data , function(index, value) {
var outstring = value.name;
if (value.manufacturer) {
outstring += ', ' + value.manufacturer
}
outstring += ', ' + value.number;
$('#item_search_results').append('<div class="item_search_selectable" rel="' + outstring + '" att_price="' + value.base_price + '" inventory="' + value.inventory + '" title="' + value.id + '">' + outstring + '</div>');
});
} catch(e) {
bend.dialogs.confirmationDialog({
confirmation: 'Ok',
showDenial: false,
heading: 'ERROR',
message: 'item search code JSON Error'
});
}
});
jqxhr.error(function() {
bend.dialogs.confirmationDialog({
confirmation: 'Ok',
showDenial: false,
heading: 'ERROR',
message: 'item search code URL Error'
});
});
} else {
$('#item_search_hits').text('');
$('#item_search_results').html('');
$('#item_search_results').addClass('hidden');
}
});
// click on item results
$('.item_search_selectable').live('click', function(e) {
var itemId = $(this).attr('title');
$('#item_search_hits').text('');
$('#item_search_results').html('');
$('#item_search_results').addClass('hidden');
$('#item_search').val('');
$('#item_search_id').val(itemId);
$('#new_item_price_sum').val($(this).attr('att_price'));
$('#item_inventory').val($(this).attr('inventory'));
item_name = $(this).attr('rel')
$('#item_search').val(item_name);
});
// save new item
$('.delete_item').click(function(e) {
e.preventDefault();
confirmed = confirm('Wollen Sie den Artikel wirklich löschen?');
if(confirmed) {
var jqxhr;
jqxhr = $.ajax({
'url' : './index.php?admin_modul=admin_incomming_goods_editor',
'dataType' : 'JSON',
'type' : 'POST',
'data' : {
'id' : $('#incomming_goods_id').val(),
'action' : 'delete_item',
'item_id' : $(this).attr('rel')
}
});
jqxhr.success(function(data) {
if (data.status == 'success') {
$('#admin_incomming_goods_edit').submit();
} else {
alert('Error!');
}
});
}
});
$('.field_amount, .field_price_sum').hover(
function() {
$(this).css({
'border': '1px solid #999999'
});
},
function() {
$(this).css({
'border': '0px solid #000000'
});
}
);
$('.field_amount').click(function(e) {
e.preventDefault();
$(this).css({
'background-color': '#ff9900'
});
$('.amount_edit',this).css({
'display': 'inline'
});
$('.amount_show',this).css({
'display': 'none'
});
});
$('.field_price_sum').click(function(e) {
e.preventDefault();
$(this).css({
'background-color': '#ff9900'
});
$('.price_sum_edit',this).css({
'display': 'inline'
});
$('.price_sum_show',this).css({
'display': 'none'
});
});
$('#incomming_date').datepicker({
dateFormat: 'dd.mm.yy',
beforeShow: function() {
$('#bodycontainer').css('zIndex', 2);
},
onClose: function() {
$('#bodycontainer').css('zIndex', 'auto');
}
});
var incomming_goods_id = $('#field_incomming_goods_id').val();
$('#incomming_goods_id').val(incomming_goods_id);
$('#file_upload').uploadify({
'uploader' : '../../../../libs/uploadify/uploadify.swf',
'script' : './index.php?admin_modul=admin_incomming_goods_editor',
'cancelImg' : '../../../../libs/uploadify/cancel.png',
'folder' : '../../../../libs/uploads',
'scriptData': {
'action': 'upload_bill',
'id' : $('#incomming_goods_id').val()
},
'fileDesc' : 'PDF Files',
'buttonText': 'Rechnung',
'auto' : true,
'multi' : false,
'onComplete': function(event, ID, fileObj, response, data) {
try {
var mydata = $.parseJSON(response);
if (mydata.status == 'success') {
window.location.href = './index.php?admin_modul=admin_incomming_goods_editor&id=' + $('#incomming_goods_id').val();
} else {
$().easywayShopMessageDialog("ERROR: can't save", {}, function(){
$().easywayShopMessageDialog(mydata.data, {}, function(){});
});
}
} catch(e) {
$().easywayShopMessageDialog("ERROR: can't upload", {}, function(){});
}
}
});
$('#delete_bill_file').click(function(e) {
e.preventDefault();
var url = $(this).attr('href');
var jqxhr = $.ajax({
'url': url
});
jqxhr.success(function(data) {
try {
data = $.parseJSON(data);
if (data.status == 'success') {
window.location.reload();
} else {
$().easywayShopMessageDialog("ERROR: no save'", {}, function(){});
}
} catch(e) {
$().easywayShopMessageDialog("ERROR: wrong answer", {}, function(){});
}
});
jqxhr.error(function() {
$().easywayShopMessageDialog("ERROR", {}, function(){});
});
});
});
</script>