171 lines
5.0 KiB
PHP
171 lines
5.0 KiB
PHP
|
|
$("#reset-summary-flag-dialog").dialog({
|
|
autoOpen: false,
|
|
minWidth: 300,
|
|
minHeight: 200,
|
|
modal: true,
|
|
position: { my: 'center', at: 'center' }
|
|
});
|
|
|
|
// Copy a product
|
|
$(document).on('click', '.copy-product', function(e) {
|
|
e.preventDefault();
|
|
|
|
var rnum = $(this).attr('rnum');
|
|
var data = "product_num="+rnum;
|
|
|
|
$.getJSON( "ajax.SupplierProduct.copy.php",data,
|
|
function(results) {
|
|
if (results.product_num > 0) {
|
|
loadData(custom_data);
|
|
editData(results.product_num);
|
|
}
|
|
else {
|
|
alert("<?php displayLanguageText('ERRORMSG-ERROR-COPYING-DATA'); ?>");
|
|
}
|
|
}
|
|
);
|
|
});
|
|
|
|
function reloadProductImages() {
|
|
|
|
$.getJSON("ajax.ProductImages.php",
|
|
function(results) {
|
|
var files = results.files;
|
|
|
|
$("#dialog_image").empty();
|
|
$("#dialog_image").append($("<option></option>").attr("value","").text(""));
|
|
|
|
$.each(files, function(key, entry) {
|
|
$("#dialog_image").append($("<option></option>").attr("value",entry).text(entry));
|
|
});
|
|
|
|
var file_name = $("#uploaded_file_name").val();
|
|
$("#dialog_image").val(file_name);
|
|
}
|
|
);
|
|
}
|
|
|
|
$(document).on('change', '.supplier_product_field', function() {
|
|
var fid = $(this).attr('id');
|
|
var fname = $(this).attr('name');
|
|
var rnum = $(this).attr('rnum');
|
|
var snum = $(this).attr('snum');
|
|
var fvalue = $(this).val();
|
|
|
|
var ftype = 'dollar';
|
|
if (fname == 'package_qty') ftype = 'numeric';
|
|
if (fname == 'label_name') ftype = 'text';
|
|
if (fname == 'product_description') ftype = 'text';
|
|
if (fname == 'product_name') ftype = 'text';
|
|
|
|
$.ajax({
|
|
url: 'ajax.UpdateDBField.php',
|
|
data: {
|
|
table_name: 'supplier_products',
|
|
field_name: fname,
|
|
field_value: fvalue,
|
|
field_type: ftype,
|
|
supplier_num: snum,
|
|
record_num: rnum
|
|
},
|
|
dataType: 'json'
|
|
}).done(function(results) {
|
|
$("#"+fid).val(results.new_value);
|
|
});
|
|
|
|
});
|
|
|
|
$(document).on('click', '.sales-summary-item-span', function() {
|
|
var record_num = $(this).attr('rnum');
|
|
var fname = 'sales_summary_item';
|
|
var spanID = $(this);
|
|
var flag = $(this).html();
|
|
var new_flag = 'Y';
|
|
|
|
if (flag == 'Y') new_flag = 'N';
|
|
|
|
$.ajax({
|
|
url: 'ajax.UpdateDBField.php',
|
|
data: {
|
|
table_name: 'supplier_products',
|
|
field_name: fname,
|
|
field_value: new_flag,
|
|
field_type: 'string',
|
|
record_num: record_num
|
|
},
|
|
dataType: 'json'
|
|
}).done(function(results) {
|
|
$(spanID).html(new_flag);
|
|
});
|
|
});
|
|
|
|
$(document).on('click', '#reset-sales-summary', function() {
|
|
var supplier_num = $(this).attr('supplier-num');
|
|
|
|
if (supplier_num == 0) {
|
|
alert("<?php displayLanguageText('MESSAGE-ONLY-POSSIBLE-WHEN-SUPPLIER-SELECTED') ?>");
|
|
return;
|
|
}
|
|
|
|
$("#supplier-num").val(supplier_num);
|
|
$("#reset-summary-flag-dialog").dialog('open');
|
|
});
|
|
|
|
$(".resetSummaryBtn").click(function() {
|
|
var set = $(this).attr('set');
|
|
var supplier_num = $("#supplier-num").val();
|
|
var data = "supplier_num="+supplier_num+"&flag="+set;
|
|
|
|
$.getJSON( "ajax.SupplierProduct.SummaryUpdate.php",data,
|
|
function(results) {
|
|
loadData(custom_data+"&set=Active");
|
|
$("#reset-summary-flag-dialog").dialog('close');
|
|
}
|
|
);
|
|
});
|
|
|
|
$("#resetSummaryCloseBtn").click(function() {
|
|
$("#reset-summary-flag-dialog").dialog('close');
|
|
});
|
|
|
|
|
|
$("#view-active-products").click(function(e) {
|
|
e.preventDefault();
|
|
|
|
loadData(custom_data+"&set=Active");
|
|
});
|
|
|
|
$("#view-all-products").click(function(e) {
|
|
e.preventDefault();
|
|
|
|
loadData(custom_data+"&set=All");
|
|
});
|
|
|
|
$("#edit-special-prices").click(function(e) {
|
|
e.preventDefault();
|
|
|
|
loadData(custom_data+"&set=Special");
|
|
});
|
|
|
|
$("#edit-description").click(function(e) {
|
|
e.preventDefault();
|
|
|
|
loadData(custom_data+"&set=Description");
|
|
});
|
|
|
|
$("#post-to-menu").click(function(e) {
|
|
e.preventDefault();
|
|
|
|
location.href = "?action=supplier-products-post&selected_supplier="+supplier_num;
|
|
});
|
|
|
|
$("#supplier-products-report").click(function(e) {
|
|
location.href = "?action=supplier-products-print&selected_supplier="+supplier_num;
|
|
});
|
|
|
|
<?php if ($numInactive == 0) { ?>
|
|
$("#inactive-button").hide();
|
|
<?php } ?>
|
|
|