//----------------------- // Notation: //----------------------- // po_ : pre order // cr_ : criteria // de_ : detail // sv_ : seller view // sl_ : slot // _sh_: shipping // _wh_: warehousing // _mu : markup // _mrk: markup var weightRange = 0; var rate = 0; var perKg = 0; var totcost = 0; var wh_rate = 0; var perslot = 0; var wh_totcost = 0; var tabs = $('.nav-tabs'); var tabContent = $('.tab-pane'); var sqlresult = []; var country_array = []; var defaultweightposition = 0; var sh_weight = 0; var bsOffcanvas = new bootstrap.Offcanvas(selectlistmodal);bsOffcanvas.show();const listArray = [{"name":"Gahez","listcode":"D0GHZ-001","dest":"D0GHZ-001"},{"name":"Gahez","listcode":"D0GHZ-002","dest":"D0GHZ-002"},{"name":"Moody","listcode":"D0MOO-001","dest":"D0MOO-001"},{"name":"Moody","listcode":"D0MOO-002","dest":"D0MOO-002"},{"name":"Moody","listcode":"D0MOO-003","dest":"D0MOO-003"},{"name":"Moody","listcode":"D0MOO-004","dest":"D0MOO-004"},{"name":"Moody","listcode":"D0MOO-005","dest":"D0MOO-005"},{"name":"Moody","listcode":"D0MOO-006","dest":"D0MOO-006"},{"name":"Moody","listcode":"D0MOO-007","dest":"D0MOO-007"},{"name":"Moody","listcode":"D0MOO-008","dest":"D0MOO-008"},{"name":"Moody","listcode":"D0MOO-009","dest":"D0MOO-009"},{"name":"Moody","listcode":"D0MOO-010","dest":"D0MOO-010"},{"name":"Moody","listcode":"D0MOO-011","dest":"D0MOO-011"},{"name":"Moody","listcode":"D0MOO-012","dest":"D0MOO-012"},{"name":"Moody","listcode":"D0MOO-013","dest":"D0MOO-013"},{"name":"Moody","listcode":"D0MOO-014","dest":"D0MOO-014"},{"name":"Moody","listcode":"D0MOO-015","dest":"D0MOO-015"},{"name":"Moody","listcode":"D0MOO-016","dest":"D0MOO-016"},{"name":"Moody","listcode":"D0MOO-017","dest":"D0MOO-017"},{"name":"Champs Land","listcode":"D0ITH-001","dest":"D0ITH-001"},{"name":"Heba Linen","listcode":"DHBLN-001","dest":"DHBLN-001"},{"name":"Heba Linen","listcode":"DHBLN-002","dest":"DHBLN-002"},{"name":"Heba Linen","listcode":"DHBLN-003","dest":"DHBLN-003"},{"name":"Heba Linen","listcode":"DHBLN-004","dest":"DHBLN-004"},{"name":"Arij","listcode":"","dest":""},{"name":"Eftekassat","listcode":"","dest":""},{"name":"bruz","listcode":"","dest":""},{"name":"Leo Rugs","listcode":"","dest":""},{"name":"File","listcode":"Pilot 3 - 20% off seller price - 2024-05-26","dest":"pricing-4"},{"name":"File","listcode":"Pilot 3 - approved item pricing - 2024-05-26","dest":"pricing-3"},{"name":"File","listcode":"Pilot 3 - approved items - adjusted qty - 2024-05-26","dest":"pricing-2"}]; const sellerArray = [{"name":"Gahez", "code":"D0GHZ", "nextlistcode":"D0GHZ-003", "listnumber":3},{"name":"Moody", "code":"D0MOO", "nextlistcode":"D0MOO-018", "listnumber":18},{"name":"Champs Land", "code":"D0ITH", "nextlistcode":"D0ITH-002", "listnumber":2},{"name":"Heba Linen", "code":"DHBLN", "nextlistcode":"DHBLN-005", "listnumber":5},{"name":"Arij", "code":"D0ARJ", "nextlistcode":"D0ARJ-001", "listnumber":1},{"name":"Eftekassat", "code":"DFKST", "nextlistcode":"DFKST-001", "listnumber":1},{"name":"bruz", "code":"DBRUZ", "nextlistcode":"DBRUZ-001", "listnumber":1},{"name":"Leo Rugs", "code":"DSGDA", "nextlistcode":"DSGDA-001", "listnumber":1},{"name":"File", "code":"Pricing", "nextlistcode":"Pricing-001", "listnumber":1}]; var newlistname = ''; var sellercode = ''; var listnumber = 0; var selectedlistcode = ''; var takeRateTable = []; var takeRateRule = "itemCategory"; // fixedCategory var countryShort = ''; // ----------------------------------------------------------------------------------------------------------- // Show list codes // ----------------------------------------------------------------------------------------------------------- function showlistcodes() { //var selectBox = document.getElementById("selectBox"); //var selectedValue = selectBox.options[selectBox.selectedIndex].value; var sellerName = $("#seller-selector option:selected" ).text(); $('#list-selector').html(''); for(let x=0; x < sellerArray.length; x++){ if(sellerArray[x]['name']==sellerName && sellerName!="File") { $('#list-selector').append(''); newlistname = sellerArray[x]['nextlistcode']; sellercode = sellerArray[x]['code']; listnumber = sellerArray[x]['listnumber']; } } for(let x=0; x < listArray.length; x++){ if(listArray[x]['name']==sellerName) $('#list-selector').append(''); } // Imported from origianl uploadlist.php on /internal { selectedseller = sellerName; selectedlistcode = newlistname; //alert(selectedseller+" - "+selectedlistcode); $('#seller').attr('value',sellercode); $('#listnumber').attr('value',listnumber); $('#listcode').attr('value',selectedlistcode); } } // End of Show list codes // ----------------------------------------------------------------------------------------------------------- // Start pricing // ----------------------------------------------------------------------------------------------------------- function startpricing(){ if($("#list-selector option:selected").text()=="Select list") { $("#listformsubmit").attr("disabled", "disabled"); $("#listformsubmit").css('visibility', 'hidden'); $("#listformcancel").css('visibility', 'hidden'); $("#upload-form").css('visibility', 'hidden'); } else{ if($("#list-selector option:selected").val()=="add"){ //alert("upload file"); $("#upload-form").css('visibility', 'visible'); $("#listformsubmit").css('visibility', 'hidden'); $("#listformcancel").css('visibility', 'hidden'); } else { $("#upload-form").css('visibility', 'hidden'); $("#listformsubmit").css('visibility', 'visible'); $("#listformcancel").css('visibility', 'visible'); $("#listformsubmit").removeAttr("disabled"); } } } // End of Start pricing // ----------------------------------------------------------------------------------------------------------- // Go to pricing page // ----------------------------------------------------------------------------------------------------------- function gotopricing(){ window.location.href = 'pricing.php?listid='+selectedlistcode; //window.location.href = 'pricing.php?'+selectedlistcode; } // ----------------------------------------------------------------------------------------------------------- // Caclulate the detailed pricing sheet // ----------------------------------------------------------------------------------------------------------- function de_calculate() { returnedarray = sqlresult; de_table = $('#dataTable6').DataTable(); sh_mrk = po_shipping_mu; wh_mrk = po_warehousing_mu; sl_mrk = po_slot_mu; catErrorCount = 0; for(let n=1; n<=0; n++) { // get item specific markups for selected country / list //-------------------------------------------------------- de_table.cell($('#de_sh_cost'+n)).data((parseFloat($('#de_weight'+n).html())*perKg).toFixed(2)); de_table.cell($('#de_sh_mu'+n)).data(sh_mrk); de_table.cell($('#de_sh_price'+n)).data((parseFloat($('#de_sh_cost'+n).html())+parseFloat($('#de_sh_mu'+n).html())).toFixed(2)); wh_itemcost = $("#de_CBM"+n).html()*wh_rate; wh_itemcost += $("#de_slots"+n).html()*perSlot; de_table.cell($('#de_wh_cost'+n)).data(wh_itemcost.toFixed(2)); de_table.cell($('#de_wh_mu'+n)).data((parseFloat(wh_mrk)+parseFloat(sl_mrk)*parseFloat($('#de_slots'+n).html())).toFixed(2)); de_table.cell($('#de_wh_price'+n)).data((parseFloat($('#de_wh_cost'+n).html())+parseFloat($('#de_wh_mu'+n).html())).toFixed(2)); de_table.cell($('#de_total_cost'+n)).data((parseFloat($('#de_sh_cost'+n).html())+parseFloat($('#de_wh_cost'+n).html())).toFixed(2)); de_table.cell($('#de_total_mu'+n)).data((parseFloat($('#de_sh_mu'+n).html())+parseFloat($('#de_wh_mu'+n).html())).toFixed(2)); de_table.cell($('#de_total_price'+n)).data((parseFloat($('#de_sh_price'+n).html())+parseFloat($('#de_wh_price'+n).html())).toFixed(2)); //Pre customs price //----------------------------------- pre_customs_price = parseFloat($('#de_item_price_usd'+n).html())+parseFloat($('#de_sh_price'+n).html())+parseFloat($('#de_wh_price'+n).html()); //customs value in USD //----------------------------------- de_table.cell($('#de_customs'+n)).data((pre_customs_price*customs).toFixed(2)); //Pre_VAT_price //----------------------------------- de_table.cell($('#de_fulfillment'+n)).data(1.5); //de_table.cell($('#de_lm_add'+n)).data(parseFloat($('#cr_lastmilecost'+n).html()).toFixed(2)); de_table.cell($('#de_lm_add'+n)).data(1); de_table.cell($('#de_ff_mu'+n)).data(1.5); pre_vat_price = (pre_customs_price + parseFloat($('#de_customs'+n).html())+parseFloat($('#de_fulfillment'+n).html())+parseFloat($('#de_lm_add'+n).html())+parseFloat($('#de_ff_mu'+n).html())).toFixed(2); //VAT Value in USD //----------------------------------- de_table.cell($('#de_vat'+n)).data((pre_vat_price*vat).toFixed(2)); //Pre takerate //----------------------------------- pre_takerate = parseFloat(pre_vat_price)+parseFloat($('#de_vat'+n).html()); takeRateToUse = 0; categoryFound = false; if (takeRateRule=="itemCategory") { for(let i = 0;i < takeRateTable.length; i++){ // Had to use encodeURI to safeguard the special characters like % and & if(encodeURI($('#de_diatomCategory'+n).text())==encodeURI(takeRateTable[i]['Category'])){ takeRateToUse = parseFloat(takeRateTable[i]['TakeRate']); categoryFound = true; break; } } if(!categoryFound){ // Not yet decided what can we do if there are errors in diatom categories catErrorCount++; } } else takeRateToUse = takerate; de_table.cell($('#de_takerate'+n)).data((pre_takerate*takeRateToUse).toFixed(2)); de_table.cell($('#de_online_price'+n)).data((parseFloat(pre_takerate)+parseFloat($('#de_takerate'+n).html())).toFixed(2)); de_table.cell($('#de_online_price_local'+n)).data((parseFloat($('#de_online_price'+n).html())*exchangerate).toFixed(2)); if(parseFloat($('#de_item_price_usd'+n).html())==0) { de_table.cell($('#de_partner_share'+n)).data('NA'); de_table.cell($('#de_item_price_fz'+n)).data('('+$('#de_total_price'+n).html()+')') de_table.cell($('#de_ff_partner_share'+n)).data('NA'); de_table.cell($('#de_ff_diatom_share'+n)).data('NA'); de_table.cell($('#de_lm_add_share'+n)).data('NA'); de_table.cell($('#de_gr_margin'+n)).data('NA'); } else { de_table.cell($('#de_partner_share'+n)).data(''+((parseFloat($('#de_total_cost'+n).html())/parseFloat($('#de_item_price_usd'+n).html()))*100).toFixed(2)+'%'); de_table.cell($('#de_item_price_fz'+n)).data((parseFloat($('#de_total_price'+n).html())+parseFloat($('#de_item_price_usd'+n).html())).toFixed(2)); de_table.cell($('#de_ff_partner_share'+n)).data(''+((parseFloat($('#de_fulfillment'+n).html())/parseFloat($('#de_item_price_usd'+n).html()))*100).toFixed(2)+'%'); de_table.cell($('#de_ff_diatom_share'+n)).data(''+((parseFloat($('#de_ff_mu'+n).html())/parseFloat($('#de_item_price_usd'+n).html()))*100).toFixed(2)+'%'); de_table.cell($('#de_lm_add_share'+n)).data(''+((parseFloat($('#de_lm_add'+n).html())/parseFloat($('#de_item_price_usd'+n).html()))*100).toFixed(2)+'%'); de_table.cell($('#de_gr_margin'+n)).data(((parseFloat($('#de_total_mu'+n).html())/parseFloat($('#de_item_price_usd'+n).html()))*100).toFixed(1)+"%"); } $('#de_ol_price_dom').html('Online price '+currency); $('#de_ol_price_dom').prop('title','Fully loaded price in target country local currency (1 USD = '+exchangerate+' '+currency+')'); } //Enable tabs //----------------------------------- $('#pricing-tab').attr('disabled',false); $('#details-tab').attr('disabled',false); $('#pr_markup_btn').css('display','block'); $('#pr_edit_btn').css('display','block'); $('#pr_save_btn').css('display','block'); } // End of detailed pricing sheet // ----------------------------------------------------------------------------------------------------------- // Caclulate the seller view sheet // ----------------------------------------------------------------------------------------------------------- function sv_calculate() { returnedarray = sqlresult; sv_table = $('#dataTable5').DataTable(); for(let n=1; n<=0; n++) { sv_table.cell($('#sv_item_price_usd'+n)).data($('#de_item_price_usd'+n).html()); sv_table.cell($('#sv_item_cost_fz'+n)).data((parseFloat($('#de_item_price_fz'+n).html())-parseFloat($('#de_item_price_usd'+n).html())).toFixed(2)); //customs value in USD //----------------------------------- sv_table.cell($('#sv_customs'+n)).data($('#de_customs'+n).html()); //sv_table.cell($('#sv_item_price_usd'+n)).data($('#de_item_price_usd'+n).html()); //Pre_VAT_price //----------------------------------- sv_table.cell($('#sv_fulfillment'+n)).data(parseFloat($('#de_fulfillment'+n).html())+parseFloat($('#de_ff_mu'+n).html())); //sv_table.cell($('#sv_lm_add'+n)).data(parseFloat($('#cr_lastmilecost'+n).html()).toFixed(2)); sv_table.cell($('#sv_lm_add'+n)).data($('#de_lm_add'+n).html()); //sv_table.cell($('#sv_ff_mu'+n)).data($('#de_ff_mu'+n).html()); //VAT Value in USD //----------------------------------- sv_table.cell($('#sv_vat'+n)).data($('#de_vat'+n).html()); //Pre takerate //----------------------------------- sv_table.cell($('#sv_takerate'+n)).data($('#de_takerate'+n).html()); sv_table.cell($('#sv_online_price'+n)).data($('#de_online_price'+n).html()); sv_table.cell($('#sv_online_price_local'+n)).data($('#de_online_price_local'+n).html()); sv_table.cell($('#sv_item_price_fz'+n)).data($('#de_item_price_fz'+n).html()); sv_table.cell($('#sv_online_price_local'+n)).data($('#de_online_price_local'+n).html()); } $('#sv_ol_price_dom').html('Online price '+currency); $('#sv_ol_price_dom').prop('title','Fully loaded price in target country local currency (1 USD = '+exchangerate+' '+currency+')'); } // End of seller view sheet // ----------------------------------------------------------------------------------------------------------- // sql request, general use sql handler. Not used here // ----------------------------------------------------------------------------------------------------------- function sqlrequest(sqlstatement) { $.ajax({ type: "POST", url: "sqlrequest.php", contentType: "application/json", data: JSON.stringify({ sql: sqlstatement}), success: function (response) { sqlresult = response; console.log(response); } }); } // ----------------------------------------------------------------------------------------------------------- // Hilight related cells in a table // ----------------------------------------------------------------------------------------------------------- function hilight(cellarray) { cellarray.forEach((element) => { $('#'+element).css({"background-color":"#f6c23e80","border":"1px solid red"}); }); } function dehilight(cellarray) { cellarray.forEach((element) => { $('#'+element).css({"background-color":"","border":""}); }); } // ----------------------------------------------------------------------------------------------------------- // Set criteria parameters // ----------------------------------------------------------------------------------------------------------- function setCrParams(cr_country, cr_short, cr_zone, cr_vat, cr_customs, cr_tax1, cr_shipper, cr_warehouse, cr_shippingtype, cr_shippingrate, cr_whtype, cr_currency, cr_curr_rate, selection) { country = cr_country; countryShort = cr_short; countryzone = cr_zone; vat = cr_vat; customs = cr_customs; tax1 = cr_tax1; $('#markupcountry').val(countryShort); $('#cr_country').html(cr_country+' ('+cr_short+')'); $('#cr_zone').html(cr_zone); $('#cr_customs').html((parseFloat(cr_customs)*100).toFixed(1)+'%'); $('#cr_vat').html((parseFloat(cr_vat)*100).toFixed(1)+'%'); $('#cr_tax1').html((parseFloat(cr_tax1)*100).toFixed(1)+'%'); //-------------------------------------------------- // Show default attributes for the selected country //-------------------------------------------------- po_list = 'default'; vendor = cr_shipper; //'DHL'; type = cr_shippingtype; //'B2B'; zone = cr_zone; //'Zone 1'; sh_weight = cr_shippingrate //70; wh_vendor = cr_warehouse //'FB'; wh_type = cr_whtype //'Volume'; currency = cr_currency; //AED; exchangerate = cr_curr_rate; //4.0; country_array = []; var i = 0; while(country_array[i][6]=="") i++; defaultweightposition = i; //rate = ; //To get it from initial sql //perKg = ; //To get it from initial sql //perSlot = ; //wh_rate = ; rate = country_array[selection][0]; perKg = country_array[selection][1]; perSlot = country_array[selection][2]; wh_rate = country_array[selection][3]; $("#cr_currency").html("USD / "+currency+" rate"); $("#cr_curr_rate").html(exchangerate.toFixed(2)); //default weight is sent in the parameters, stored in sh_weight //weight_used = country_array[selection][4]; //alert('rate: '+ rate+', perKg: '+perKg+', perSlot: '+perSlot+', wh_rate: '+wh_rate); // This is V1 of markeup setup 'default' values po_shipping_mu = 1.500; po_warehousing_mu = 1.500; po_slot_mu = 0.180; use_item_mrk = false; use_list_mrk = false; use_general_mrk = true; // Override the above values with conditional markup scheme gen_shipping_mu = 1.50;gen_warehousing_mu = 1.50;gen_slot_mu = 0.18; if (countryShort=='' && 'General'=='') { if(''=='') { //alert('country-list specific markup found - '+countryShort+' '); use_list_mrk = true; use_general_mrk = false; po_shipping_mu = 1.50; po_warehousing_mu = 1.50; po_slot_mu = 0.18; } else { //alert('country-list-item specific markup found - '+countryShort+' '); use_item_mrk = true; } } if(use_general_mrk==true) { po_shipping_mu = gen_shipping_mu; po_warehousing_mu = gen_warehousing_mu; po_slot_mu = gen_slot_mu; //alert('Using general markup scheme'); } if(use_list_mrk==true) { //alert('Using country-list specific markup - '+countryShort+' '); } $('#cr_shipper').html(''); $('#cr_warehouse').html(wh_vendor); $('#wh_vendor_title').html(wh_vendor); $('#po_markup_title').html('Default Markup Values'); $('#cr_lastmile').html(wh_vendor); $('#cr_lastmilecost').html('1 USD'); //send xmlhttp to get marketplaces from database var xhttp; xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { let obj = JSON.parse(xhttp.responseText); $('#cr_mp_dropdownMenuItems').html(''); //for(var i in obj) i=0; { $('#cr_mp_dropdownMenuItems').append(''+obj[i].Name+''); } }; } xhttp.open('GET', 'https://diatomcbt.com/internal/getmarketplace.php?country='+cr_short, true); xhttp.send(); //function_delay(); $("#cr_co_dropdownMenuButton").html(cr_country); //wh_calculate(); //po_calculate(); $('#cr_mp_dropdownMenuButton').removeAttr('disabled'); } function showSpinner(){ $("#w_spinner").css('display','inline-block'); $("#closespinner").css('display','inline-block'); } function hideSpinner(){ $("#w_spinner").css('display','none'); $("#closespinner").css('display','none'); de_calculate(); sv_calculate(); } initialspinvalue=0; function changeWeight(spinvalue){ //increment = spinvalue-initialspinvalue; //initialspinvalue += increment; //shpwt = parseFloat($("#shpwt").html()); //$("#shpwt").html(shpwt+increment); increment = spinvalue-initialspinvalue; initialspinvalue += increment; //shpwt = parseFloat($("#shpwt").html()); $("#shpwt").html(country_array[defaultweightposition+parseInt(spinvalue)][4]); sh_weight = country_array[defaultweightposition+parseInt(spinvalue)][4]; rate = country_array[defaultweightposition+parseInt(spinvalue)][0]; perKg = country_array[defaultweightposition+parseInt(spinvalue)][1]; console.log("weight: "+ sh_weight + ", rate: "+ rate+", perKg: "+perKg); } // ----------------------------------------------------------------------------------------------------------- // Set marketplace parameters // ----------------------------------------------------------------------------------------------------------- function setMpParams(mp) { marketplace = mp; $('#cr_marketplace').html(mp); var xhttp; xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { let obj = JSON.parse(xhttp.responseText); takeRateTable = obj; $('#cr_cat_dropdownMenuItems').html('Mixed (0)'); for(var i in obj) //i=0; { //alert(obj[i].Category); if(obj[i].leafNode==false) $('#cr_cat_dropdownMenuItems').append(''+obj[i].Category+''); } }; } xhttp.open('GET', 'https://diatomcbt.com/internal/getcategories.php?marketplace='+mp+'&country='+countryShort, true); xhttp.send(); //function_delay(); //alert(obj); //if (marketplace=='') // alert('marketplace specific markup found - '+marketplace); $("#cr_mp_dropdownMenuButton").html(mp); $('#cr_cat_dropdownMenuButton').removeAttr('disabled'); } // ----------------------------------------------------------------------------------------------------------- // Set category // ----------------------------------------------------------------------------------------------------------- function setCategory(cat, cr_tr) { category = cat catnote = ""; takerate = cr_tr; if(cat.substring(0,5)=="Mixed") { catnote = ' - following item category'; takeRateRule = 'itemCategory'; } else takeRateRule = "fixedCategory"; $('#cr_category').html(cat+catnote); $('#cr_takerate').html((parseFloat(cr_tr,3)*100)+'%'); $("#cr_cat_dropdownMenuButton").html(cat); de_calculate(); sv_calculate(); } // ----------------------------------------------------------------------------------------------------------- // Listen for the show event // ----------------------------------------------------------------------------------------------------------- tabs.on('click', function(event) { // Get the current and previous tabs var currentTab = $(event.target); var previousTab = $(event.relatedTarget); var prevTab = tabs.tab('show'); var currentContent = $(currentTab.attr("data-bs-target")); var prevContent = $(prevTab.attr("data-bs-target")); // Hide and unselect last tab and its contents prevTab.removeClass('active'); prevTab.removeClass('show'); tabContent.removeClass('active'); tabContent.removeClass('show'); // Show and select active tab and its content currentTab.addClass('active'); currentTab.addClass('show'); currentContent.addClass('active'); currentContent.addClass('show'); //if(currentTab.attr("data-bs-target")=="#details") // de_calculate(); }); function function_delay(){ // Because you are MOHAZZA2 ! setTimeout(() => { //hahaha }, 500); } //+ Imported from upload.js on /internal //--------------------------------------- var form = document.getElementById("upload-form"); var fileInput = document.getElementById("file-input"); var fileLabel = document.getElementById("file-label"); // ----------------------------------------------------------------------------------------------------------- // When the user selects a file, display it in the input field // ----------------------------------------------------------------------------------------------------------- fileInput.addEventListener("change", function() { var file = fileInput.files[0]; if (file) { // Set the text of the file label to the name of the file fileLabel.textContent = file.name; } else { // Set the text of the file label to "Choose file" fileLabel.textContent = "Choose file"; } }); // ----------------------------------------------------------------------------------------------------------- // Add an event listener to handle the submit event of the form // ----------------------------------------------------------------------------------------------------------- form.addEventListener("submit", function(event) { // alert(event); // Prevent the default behavior of the form event.preventDefault(); // Get the file object from the input element var file = fileInput.files[0]; // Check if the file is selected if (file) { // Create a new FormData object to store the file data var formData = new FormData(); // Append the file to the formData object with a key of "file" formData.append("file", file); formData.append("seller",$('#seller').val()); formData.append("listnumber",$('#listnumber').val()); formData.append("listcode",$('#listcode').val()); // Create a new XMLHttpRequest object to send the request to the server var xhr = new XMLHttpRequest(); // Set the request method to POST and the url to "upload.php" //alert('upload called in pricing_js'); xhr.open("POST", "https://diatomcbt.com/internal/upload2.php"); // Add an event listener to handle the load event of the request xhr.addEventListener("load", function() { // Check if the request status is 200 (OK) if (xhr.status === 200) { // Display a success message using jquery //alert(xhr.statusText); $("#upload-form").prepend("