文件操作 - EditQuote.js
返回文件管理
返回主菜单
删除本文件
文件: E:\HostingSpaces\kimblycr\crm.kimbly.in\wwwroot\js\EditQuote.js
编辑文件内容
var CustomerDefaultText = "Product Code"; function ShowText(txt, event) { if (txt.value.length == 0 && event.type == "blur") { txt.style.color = "Gray"; txt.value = CustomerDefaultText; } if (txt.value == CustomerDefaultText && event.type == "focus") { txt.style.color = "Black"; txt.value = ""; } if (txt.value.length > 0 && event.type == "blur") { GetPrice(txt); } } function DeleteProduct(value) { var index1 = 0; var ID = value.id; var ind = ID.indexOf('_', 31); var ind = ind - 30; var chr1 = ID.substring(30); chr1 = chr1.slice(0, ind); var UnderscoreLastIndex = ID.lastIndexOf('_'); var chr2 = ID.substr(UnderscoreLastIndex + 1); var AutoID = $("#rptCategoryProduct_grdProduct_" + chr1 + "_hdnAutoID_" + chr2).val(); var QuoteID = document.getElementById('hdnQuoteID').value; $.ajax({ type: "POST", url: "EditQuote.aspx/DeleteQuoteDetails", data: "{'AutoID': '" + AutoID + "','QuoteID': '" + QuoteID + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { refresh(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); } function SearchLookup(prefix, table, column, control) { $("#" + control).autocomplete({ source: function (request, response) { $.ajax({ type: "POST", url: "EditQuote.aspx/SearchLookup", data: "{'prefix': '" + prefix.value + "','table': '" + table + "','column': '" + column + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { if (data.d != null) { var SearchResult = new Array(); for (var i = 0; i < data.d.length; i++) { SearchResult[i] = data.d[i].RowData; } response(SearchResult); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log('error'); } }); }, open: function (event, ui) { disable = true }, close: function (event, ui) { disable = false; $(this).focus(); } }); } function UpdateQuantity(value) { var index1 = 0; var ID = value.id; var chr1 = ID.substring(30); chr1 = chr1.slice(0, 1); var lastUnderScoreIndex = ID.lastIndexOf("_"); var chr2 = ID.substr(lastUnderScoreIndex + 1); var AutoID = $("#rptCategoryProduct_grdProduct_" + chr1 + "_hdnAutoID_" + chr2).val(); var Qty = $("#rptCategoryProduct_grdProduct_" + chr1 + "_txtQuantity_" + chr2).val(); var QuoteID = document.getElementById('hdnQuoteID').value; $.ajax({ type: "POST", url: "EditQuote.aspx/UpdateQuanity", data: "{'AutoID': '" + AutoID + "','Qty': '" + Qty + "','QuoteID': '" + QuoteID + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { refresh(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); } function UpdateSP(value) { var index1 = 0; var ID = value.id; var chr1 = ID.substring(30); chr1 = chr1.slice(0, 1); var lastUnderScoreIndex = ID.lastIndexOf("_"); var chr2 = ID.substr(lastUnderScoreIndex + 1); var AutoID = $("#rptCategoryProduct_grdProduct_" + chr1 + "_hdnAutoID_" + chr2).val(); var LP = $("#rptCategoryProduct_grdProduct_" + chr1 + "_txtListPrice_" + chr2).val(); var SP = $("#rptCategoryProduct_grdProduct_" + chr1 + "_txtSellingPrice_" + chr2).val(); var QuoteID = document.getElementById('hdnQuoteID').value; $.ajax({ type: "POST", url: "EditQuote.aspx/UpdateSP", data: "{'AutoID': '" + AutoID + "','LP': '" + LP + "','SP': '" + SP + "','QuoteID': '" + QuoteID + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { refresh(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); } function UpdateDeviation(value) { var index1 = 0; var ID = value.id; var chr1 = ID.substring(30); chr1 = chr1.slice(0, 1); var lastUnderScoreIndex = ID.lastIndexOf("_"); var chr2 = ID.substr(lastUnderScoreIndex + 1); var AutoID = $("#rptCategoryProduct_grdProduct_" + chr1 + "_hdnAutoID_" + chr2).val(); var Deviation = $("#rptCategoryProduct_grdProduct_" + chr1 + "_txtDeviation_" + chr2).val(); var QuoteID = document.getElementById('hdnQuoteID').value; $.ajax({ type: "POST", url: "EditQuote.aspx/UpdateDeviation", data: "{'AutoID': '" + AutoID + "','AdditionalDiscount': '" + Deviation + "','QuoteID': '" + QuoteID + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { refresh(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); } function UpdateDeviationPer(value) { var index1 = 0; var ID = value.id; var chr1 = ID.substring(30); chr1 = chr1.slice(0, 1); //var chr2 = ID.substr(ID.length - 1) var lastUnderScoreIndex = ID.lastIndexOf("_"); var chr2 = ID.substr(lastUnderScoreIndex + 1); var AutoID = $("#rptCategoryProduct_grdProduct_" + chr1 + "_hdnAutoID_" + chr2).val(); var ListPrice = $("#rptCategoryProduct_grdProduct_" + chr1 + "_txtListPrice_" + chr2).val(); var DeviationP = $("#rptCategoryProduct_grdProduct_" + chr1 + "_txtDeviationP_" + chr2).val(); var QuoteID = document.getElementById('hdnQuoteID').value; $.ajax({ type: "POST", url: "EditQuote.aspx/UpdateDeviationPercent", data: "{'AutoID': '" + AutoID + "','LP': '" + ListPrice + "','AdditionalDiscountPerc': '" + DeviationP + "','QuoteID': '" + QuoteID + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { refresh(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); } function UpdateLumpSumDiscount(value) { //var index1 = 0; //var ID = value.id; //var chr1 = ID.substring(30); //chr1 = chr1.slice(0, 1); //var lastUnderScoreIndex = ID.lastIndexOf("_"); //var chr2 = ID.substr(lastUnderScoreIndex + 1); var QuoteID = document.getElementById('hdnQuoteID').value; var LumpSumDiscount = $("#txtLumpsumDiscount").val(); $.ajax({ type: "POST", url: "EditQuote.aspx/UpdateLumpSumDiscount", data: "{'QuoteID': '" + QuoteID + "','LumpSumDiscount': '" + LumpSumDiscount + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { refresh(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); } function UpdateTaxes(value) { var QuoteID = document.getElementById('hdnQuoteID').value; var Taxes = $("#txtTaxes").val(); $.ajax({ type: "POST", url: "EditQuote.aspx/UpdateTaxes", data: "{'QuoteID': '" + QuoteID + "','Taxes': '" + Taxes + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { refresh(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); } function isNumber(evt) { evt = (evt) ? evt : window.event; var charCode = (evt.which) ? evt.which : evt.keyCode; if (charCode > 31 && (charCode < 48 || charCode > 57)) { return false; } return true; } function SuggestProduct(txt) { //console.log('In SuggestProduct'); $("#" + txt.id).autocomplete({ source: function (request, response) { $.ajax({ type: "POST", url: "EditQuote.aspx/LookupProducts", data: "{'prefix':'" + txt.value + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { if (data.d != null) { //console.log(data.d); var ProductResult = new Array(); for (var i = 0; i < data.d.length; i++) { ProductResult[i] = data.d[i].RowData; //console.log(data.d[i].RowData); } response(ProductResult); $("#NewFormModal").addClass('modal fade in'); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); } function GetPrice(txt) { var ProductCode = txt.value; var index = ProductCode.indexOf("#"); if (index == -1) { $('#txtProductCode').css("border-color", "red"); return; } else { $('#txtProductCode').css("border-color", "#ccc"); } var ProductID = ProductCode.substring(index + 1); $.ajax({ type: "POST", url: "EditQuote.aspx/getProductPrice", data: "{'ProductID':'" + ProductID + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { console.log(data.d); $("#txtPrice").val(data.d); }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); } function SaveItem() { var CatID = document.getElementById('CurrentPrCategory').value; var QuoteID = document.getElementById('hdnQuoteID').value; var Price = document.getElementById('txtPrice').value; var Qty = document.getElementById('txtQuantity').value; var ProductCode = document.getElementById('txtProductCode').value; var index = ProductCode.indexOf("#"); if (index == -1) { $('#txtProductCode').css("border-color", "red"); return; } else { $('#txtProductCode').css("border-color", "#ccc"); } var ProductID = ProductCode.substring(index + 1); console.log('QuoteID-' + QuoteID); console.log('CatID-' + CatID); console.log('ProductID-' + ProductID); console.log('Qty-' + Qty); $.ajax({ type: "POST", url: "EditQuote.aspx/SaveItem", data: "{'QuoteID': '" + QuoteID + "','CatID': '" + CatID + "','ProductID': '" + ProductID + "','Qty': '" + Qty + "','Price': '" + Price + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { if (data.d != null) { refresh(); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); } function refresh() { //var QuoteID = document.getElementById('hdnQuoteID').value; //window.location = "QuoteID=" + QuoteID; location.reload(); } $(document).ready(function () { LoggedInEmpID = sessionStorage.LoggedInEmpID; if (LoggedInEmpID == null) { sessionStorage.LoggedInEmpID = "1";//Temporaray Remove after login page creation //alert('Not Logged In'); } setTimeout(function () { var QID = document.getElementById('hdnQuoteID').value; console.log("QID-" + QID); }, 2000); }); function showAddItem(catid) { document.getElementById('CurrentPrCategory').value = catid; } function SuggestHeader(controlId) { $("#" + controlId.id).autocomplete({ source: function (request, response) { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "EditQuote.aspx/GetHeaderList", data: "", dataType: "json", success: function (data) { var HeaderResult = new Array(); for (var i = 0; i < data.d.length; i++) { HeaderResult[i] = data.d[i].RowData; } response(HeaderResult); }, error: function (result) { console.log('Error' + result); } }); } }); } function SaveCategory() { var CategoryName = document.getElementById('txtCategoryName').value; if (CategoryName == "") { alert('Please provide Category Name'); return; } var QuoteID = document.getElementById('hdnQuoteID').value; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "EditQuote.aspx/SaveCategory", data: "{'CategoryName': '" + CategoryName + "','QuoteID': '" + QuoteID + "'}", dataType: "json", success: function (data) { location.reload(true) }, error: function (result) { console.log('Error' + result); } }); }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件