/* JOBS */ /* HISTORY - Phone checked */ // configuration starts here...... var emailDestination = ""; /// ends here ............... var poundchar = '£'; /*================================================================*/ // GLOBAL DATA var update = ''; var Upd8 = new Object; // stock level var Stock = new Object; // stock level var Data = new Object; // price list info var Txlate = new Object; // exceptions var DataMessage = ''; var RData = new Object; // price list info var List = new Array(); // items bought var ListIndex = 0; var IcodeList = new Array(); // items in search list var IcodeListIndex = 0; var MembershipSet = false; // timerval can be (is) over-ridden by html file var timerval = 2000; // for delay after entry of last char in search text var delindex = '999'; // row to be deleted var timeout = null; // timeout id of search box timer, to allow clearing var tmflag=0; var codescovered=''; // for computing category coverage var searchcountmax=200; // max number of items returned (needs to be limited for performance var searchcount = 0; var stocktake=false; var tilltype = ""; var oldsearch= ''; var tillonweb = 0; // set to true if ipswichripplefoodcooperative is the URL var POR_display = 0; // set to true when displayinf POR in central region var orderlet_qty = 0; var orderlet_price = 0; var orderlet_set = 0; var my_ItemList = ''; function clearRoundTrail( input_price) { return trailzeros(roundPrice(clean_number(input_price))); } function do_itemList() { my_ItemList = 'Order for '+ document.getElementById('Name').value + ' ' +document.getElementById('Phone').value + '%0d%0a'; my_ItemList += '%0d%0a%0d%0aItems:%0d%0a'; var my_Items = document.getElementById('Items').value.split('%0d%0a'); for (itemno = 0; my_Items[itemno] != '';itemno++) { my_ItemList = my_ItemList + my_Items[itemno].split(',')[6] + ' x ' + my_Items[itemno].split(',')[0] + ' ' + my_Items[itemno].split(',')[1] + ' ' + my_Items[itemno].split(',')[2] + ' ' + poundchar + clean_number(my_Items[itemno].split(',')[3]) + ' ' + 'VAT ' + my_Items[itemno].split(',')[4] + ' ' + // poundchar + clearRoundTrail(my_Items[itemno].split(',')[8]) + ' ' + poundchar + clearRoundTrail(my_Items[itemno].split(',')[9]) + ' ' + // poundchar + clearRoundTrail(my_Items[itemno].split(',')[10]) + '%0d%0a'; } my_ItemList = my_ItemList + '%0d%0aSubTotal : ' + poundchar + clearRoundTrail(document.getElementById('SubTotal').value) + '%0d%0a' + 'incVAT : ' + poundchar + clearRoundTrail(document.getElementById('incVAT').value) + '%0d%0a' + 'Markup (5%) : ' + poundchar + clearRoundTrail(document.getElementById('Markup').value) + '%0d%0a' + 'Total : ' + poundchar + clearRoundTrail(document.getElementById('Total').value) + '%0d%0a' + 'Notes : ' + document.getElementById('TotalNotes').value + '%0d%0a' ; } function printText(elem) { popup = window.open('','popup','toolbar=no,menubar=yes,width=600,height=500'); popup.document.open(); popup.document.write(""); popup.document.write(elem); popup.document.write(""); popup.document.close(); } function printFriendly(List) { var pb = '
'; document.getElementById('friendlypanel').style.top = 0; document.getElementById('friendlycontents').innerHTML = List + pb; } function hide_POR_friendly(){ document.getElementById('friendlypanel').style.top = -1000; } function checkForm() { return formCheckPO(); } function submitForm() { if(formCheckPO() != false) { do_itemList() my_ItemList = my_ItemList.replace(/%0d%0a/g,"
"); my_ItemList = my_ItemList.replace(/%a3/g,"£"); printFriendly(my_ItemList); // emailForm(); } return false; } function emailForm() { var email = emailDestination; // whom to send it to... // email="fred@stie.com"; var subject = "Food Order from \"" + document.getElementById('Customer').value + "\"" ; var body_message = ""; do_itemList() var body_message = body_message + my_ItemList ; var mailto_link = 'mailto:'+email+'?subject='+subject+'&body='+body_message; win = window.open(mailto_link,'emailWindow'); if (win && win.open &&!win.closed) win.close(); } //================================================================ function poUpd8(code,collected,paid,notes) { var oldstring = Data[code]; //alert('poUpd8(' + code + ',' + collected + ',' + paid + ',\'' + notes + '\')' ); if ( (oldstring != undefined) && (oldstring != '') ) { if (code.indexOf('POR') == 0) { var alreadycollect = clean_number(oldstring.split(',')[5]) + clean_number(collected); var alreadypaid = clean_number(oldstring.split(',')[6]) + clean_number(paid); var oldnotes = oldstring.split(',')[7]; Data[code] = oldstring.split(',')[0] + ',' + // date oldstring.split(',')[1] + ',' + // name oldstring.split(',')[2] + ',' + // code oldstring.split(',')[3] + ',' + // items oldstring.split(',')[4] + ',' + // cost alreadycollect + ',' + // collected alreadypaid + ',' + // paid oldnotes + ' ' + notes + ',' + // notes oldstring.split(',')[8]; // filename //alert('Updated ' + code + ' ' + oldstring + ' ' + Data[code]); if ( (alreadycollect >= oldstring.split(',')[3] ) && (alreadypaid >= oldstring.split(',')[4]) ) { Data[code] = ',,,,,,,,,,'; // delete POR //alert(code + ' is now completed. It has been deleted from the till'); } } // POR stuff - whole POR //================================================================ //Data['JU508-POR0740-1'] = '1 ,Helen Milne- BIONA,JU508-POR0740-1,Cranberry Juice 100% Pure,£25.323,per 6 x 330ml,,pk,0' var PORpos = code.indexOf('-POR'); if (PORpos != -1) { var ParPOR = code.substring(PORpos+1,PORpos+8); //alert('updating ' + code); //alert('Parent ' + ParPOR); var newcollected = clean_number(oldstring.split(',')[6]) + collected; var colltd = ''; if (newcollected >= 1) { newcollected = 1; colltd = '(collected)'; } var newprice = trailzeros(roundPrice(clean_number(oldstring.split(',')[4]) - clean_number(paid))); var paidtd = ''; //alert( 'coll' + newcollected + '/£' + newprice); if (clean_number('' +newprice) <= 0) { paidtd = '(paid)'} var oldnotes = oldstring.split(',')[7]; if (oldnotes == 'pk') {oldnotes= ''; } Data[code] = oldstring.split(',')[0] + ',' + // table oldstring.split(',')[1] + ',' + // name - brand oldstring.split(',')[2] + ',' + // code oldstring.split(',')[3]+ colltd + paidtd + ',' + // product '£' + newprice + ',' + // cost oldstring.split(',')[5] + ',' + // product newcollected + ',' + // new collected oldnotes + notes ; // notes //alert('Updated ' + code + ' ' + oldstring + ' ' + Data[code]); if ((newprice == 0 ) && (newcollected >= 1 ) ){ Data[code] = ',,,,,,,,,,'; // delete POR //alert(code + ' is now completed. It has been deleted from the till'); } poUpd8(ParPOR,''+collected,''+paid,'%0a'+code +' '+notes); // apply to parent } // POR stuff - orderlet } } /*================================================================*/ function writeFeedbackLink() { // writes feedback link including own filename..... var ModPosition; // the position of "M275" in the path var fileName; // the name of the file from M275 rightwards. var fullPath, lcPath; fullPath=document.URL; lcPath = fullPath.toLowerCase(); lcPath=lcPath.replace(/\\/g,"/"); ModPosition = lcPath.lastIndexOf("bugg"); fileName = fullPath.substring(ModPosition,fullPath.length); document.write('   Feedback'); // if (tillonweb == 1) { // document.write(' email'); // } } /* ================================================================ */ function AddToList() { if (document.getElementById('F_Product').value == '') { alert('No product to add'); //document.getElementById('F_Product').focus(); return false; } if ( (POR_display != 0) && (document.getElementById('F_Qty').value == '')) { alert('Please set the No. of items being collected ( ' + PORItems + ' for whole order)'); document.getElementById('F_Qty').focus(); return false; } var listitem = ""; listitem += document.getElementById('F_Code').value + ','; // [0] - code listitem += document.getElementById('F_Brand').value + ','; // [1] - brand listitem += document.getElementById('F_Product').value + ','; // [2] - product listitem += document.getElementById('F_Price').value + ','; // [3] - price listitem += document.getElementById('F_Size').value + ','; // [4] - size if (document.getElementById('F_Code').value.substring(0,3) != 'POR') { var clean_qty = clean_number(document.getElementById('F_Qty').value); listitem += roundPrice3(clean_qty) + ','; // [5] - qty } else { var clean_qty = clean_number(document.getElementById('F_Qty').value); if ( document.getElementById('F_Qty').value.substr(0,1).toLowerCase() == 'y'){ clean_qty = 1; } if ( document.getElementById('F_Qty').value.substr(0,1).toLowerCase() == 'n'){ clean_qty = 0; } listitem += clean_qty + ','; // [5] - collected } listitem += document.getElementById('F_Cost').value + ','; // [6] - cost if (document.getElementById('F_Code').value.substring(0,3) == 'POR') { hide_POR_notes(); var myRegExp = /,/g; var string = document.getElementById('notescontents').value; string = string.replace(myRegExp , '%2c'); var myRegExp = /\n/g; string = string.replace(myRegExp , '%0a'); var myRegExp = /\'/g; string = string.replace(myRegExp , ''); //alert(string); document.getElementById('F_Pricekg').value = string; } listitem += document.getElementById('F_Pricekg').value ; // [7] - price / kg / notes List[ListIndex] = listitem ; ListIndex++; if (!stocktake) { if (document.getElementById('F_Code').value.indexOf('-PO') == -1) { new_search();change_help(); } } else { document.getElementById('SearchResults').focus(); my_focus='search';change_help(); } // clear qty form. if (document.getElementById('F_Code').value.indexOf('-PO') == -1) { document.getElementById('qtyform').reset(); } return true; } /* ================================================================ */ function roundPrice(num) { var result = Math.round(num*100)/100; return result; } /* ================================================================ */ function roundPrice(num) { var result = Math.round(num*100)/100; return result; } /* ================================================================ */ function roundPrice3(num) { var result = Math.round(num*1000)/1000; return result; } /* ================================================================ */ function rowselect(index) { if (delindex == index) { delindex = '999'; document.getElementById('linetodel').innerHTML = ' '; } else { delindex=index; document.getElementById('linetodel').innerHTML = 'Delete (' + List[index].split(',')[0] + ' ' + List[index].split(',')[6] + ')'; proddata = List[index]; document.getElementById('F_Code').value = proddata.split(',')[0]; document.getElementById('F_Brand').value = proddata.split(',')[1]; document.getElementById('F_Product').value = proddata.split(',')[2]; document.getElementById('F_Price').value = proddata.split(',')[3]; document.getElementById('F_Pricekg').value = proddata.split(',')[7]; document.getElementById('F_Size').value = proddata.split(',')[4]; document.getElementById('F_Qty').value = proddata.split(',')[5]; document.getElementById('F_Cost').value = proddata.split(',')[6]; if (proddata.split(',')[4].indexOf('loose') != -1) { producttype = 'Loose commodity'; } else { producttype = 'Packaged Item'; } if (document.getElementById('F_Code').value.substring(0,3) == 'POR') { producttype = 'Personal Order'; set_POR(1); show_POR_notes(); var myRegExp = /%2c/g; var string = document.getElementById('F_Pricekg').value; string = string.replace(myRegExp , ','); var myRegExp = /%0a/g; string = string.replace(myRegExp , '\n'); //alert(string); document.getElementById('notescontents').value = string; document.getElementById('NotesLink').innerHTML = 'Original order' ; } else { set_POR(0); } document.getElementById('ProductType').innerHTML = producttype; } } /* ================================================================ */ function delline() { if (delindex == '999') return; if (confirm('Delete item: ' + List[delindex].split(',')[0] + ' ' + List[delindex].split(',')[6] )) { List.splice(delindex,1); ListIndex--; } delindex = '999'; DisplayList(); document.getElementById('linetodel').innerHTML = ''; } /* ================================================================ */ function unselect() { tmflag=0; if (delindex == '999') return; delindex = '999'; DisplayList(); document.getElementById('linetodel').innerHTML = ''; } /* ================================================================ */ function DisplayList() { var SubTotal = 0; var PersOrd = 0; var Items = ""; var html = ''; for (var index in List) { if (index == delindex) { html += ''; /* alert('adding ' + clean_number(List[index].sp(',')[6])); */ var my_notes = '' + List[index].split(',')[7]; //alert(my_notes); if (my_notes.indexOf('Cancelled') == -1) { if (List[index].split(',')[0].substring(0,3) != 'POR') { SubTotal = parseFloat(SubTotal) + parseFloat(clean_number(List[index].split(',')[6])); } else { PersOrd = parseFloat(PersOrd) + parseFloat(clean_number(List[index].split(',')[6])); } } } html += '
'; document.getElementById('list').innerHTML = html; document.getElementById('Items').value = Items; document.getElementById('SubTotal').value = '£' + trailzeros(roundPrice(SubTotal)); document.getElementById('POColl').value = '£' + trailzeros(roundPrice(PersOrd)); document.getElementById('ListIndex').innerHTML = ListIndex; do_discount(); if (!stocktake){ if (document.getElementById('F_Code').value.indexOf('-PO') == -1) { new_search(); } } } function new_search(){ document.getElementById('F_searchtext').value=''; document.getElementById('F_searchtext').focus(); document.getElementById('SearchResults').innerHTML = "Enter new search text ..."; document.getElementById('B_searchtext').style.background = "#80ff80"; document.getElementById('B1_Qty').style.background="#ffffff"; document.getElementById('B_Qty').style.background="#ffffff"; searchhl = 0; old_searchhl=0; updowncode = ''; IcodeListIndex = 0; ignorecr=0; } /* ================================================================ */ function my_setsearch(searchtext) { document.getElementById('F_searchtext').value = searchtext ; my_search(); } /* ================================================================ */ function my_search () { document.getElementById('Searchcount').innerHTML = 'Searching..'; if (timeout == null ) { do_search(); // timeout=setTimeout("do_search();",timerval); return; } clearTimeout(timeout); do_search(); // timeout=setTimeout("do_search();",timerval); } /* ================================================================ */ var searchhl = 0; var old_searchhl=0; var updowncode = ''; var ignorecr=0; var my_focus=''; //================================================================ function my_onload() { new_search(); data_message() if (tilltype == "Stock Take") { // document.getElementById('Member').checked = true; // woodbr } if ((tilltype == "Checkout") ||(tilltype == "Personal Orders")) { helpDisplayed = readCookie('helpDisplayed'); if ((helpDisplayed == 1)||(helpDisplayed == '')) { openHelp(); } else { closeHelp(); } document.getElementById('qtyform').reset(); document.getElementById('purchase_form').reset(); if (tilltype == "Checkout") { if (readCookie('show_change') == 'false') { show_change = false; } else { show_change = true; } document.getElementById('sh_change').checked = show_change; } } } //================================================================ function set_sh_change(obj) { show_change = obj.checked; createCookie('show_change',show_change,300); if (show_change) { alert('Change Calculator ON'); } else { alert('Disabling Change Calculator'); } } //================================================================ // called from items for cafe checkbox. function set_cafe(obj) { // woodbr. return; if (obj.checked) { alert('Goods will be used for cafe'); document.getElementById('Member').checked = 1; document.getElementById('Helper').checked = 1; set_member(); document.getElementById('MembNo').value="Cafe"; obj.checked= 1; } else { //alert('Goods will NOT be used for cafe'); document.getElementById('Member').checked = 0; document.getElementById('Helper').checked = 0; document.getElementById('NonMember').checked = 0; document.getElementById('MemberCell').style.backgroundColor ="#FFFFFF"; document.getElementById('NonMemberCell').style.backgroundColor ="#FFFFFF"; document.getElementById('MembNo').value=""; } } //================================================================ function clear_results() { searchhl = 0; old_searchhl=0; updowncode = ''; ignorecr=0; IcodeListIndex = 0; ignorecr=0; if (DataMessage == undefined){ document.getElementById('SearchResults').innerHTML =''; } else { if (oldsearch != "") { if (document.getElementById('SearchResults').innerHTML != 'No items found') { //alert(document.getElementById('SearchResults').innerHTML); document.getElementById('SearchResults').innerHTML ='New search'; } }else { data_message(); } } document.getElementById('B_searchtext').style.background = "#80ff80"; document.getElementById('Searchcount').innerHTML = ' '; } //================================================================ function data_message() { cashier = readCookie('cashier'); if ((cashier == null) || (cashier == "")) { cashier = "a.n.other"; } if (DataMessage == undefined){ } else { DataMessage =DataMessage.replace(/%Month%/g,Data['DateMonth']).replace(/,/g,""); if (tilltype == 'Price Editor') { document.getElementById('SearchResults').innerHTML ='
Cashier:' + cashier + ' Chg

'+tilltype+'

' + 'If you\'re adding a SUMA item, use the normal search method
' + 'else fill in the Code and all the other details below manually.

'+ 'Hover over each item to see what is required.' ; } else { if (tilltype == "Personal Orders") { // document.getElementById('SearchResults').innerHTML ='
Cashier:' + // cashier + ' Chg

New Personal Order

' + DataMessage + ''; document.getElementById('SearchResults').innerHTML ='

New Personal Order

' + DataMessage + ''; } else { document.getElementById('SearchResults').innerHTML ='
Cashier:' + cashier + ' Chg

'+tilltype+'

' + DataMessage + ''; } } } } //================================================================ function get_cashier() { var typed; typed = prompt("Please enter name of cashier",cashier); if (typed != null){ cashier = typed; createCookie('cashier',cashier,300); } data_message(); } //================================================================ // goes up and down section area in response to arrows. function disp_search() { var icode = IcodeList[searchhl]; // if (Data[IcodeList[old_searchhl]].split(',')[8] != 'stk') { // pers orders if (IcodeList[old_searchhl].substring(0,3) != 'POR'){ document.getElementById('SR_' + old_searchhl).style.background = "#66CCFF"; } else { document.getElementById('SR_' + old_searchhl).style.background = "#d080c0"; } // } document.getElementById('SR_' + searchhl).style.background = "#80ff80"; old_searchhl = searchhl; updowncode = IcodeList[searchhl] if (Stock[icode] != undefined) { var notes_text = Stock[icode].split(',')[3]; var stocklevel = parseInt(Stock[icode].split(',')[0]); if (Upd8[icode] != undefined) { update = parseInt(Upd8[icode]); stocklevel += update; } notes_text = notes_text.replace(/\%2d/g,","); notes_text = notes_text.replace(/\%99/g,'\''); notes_text = notes_text.replace(/\//g," - "); if (tilltype == "Checkout") { window.status = icode + ': Stock level =' + stocklevel + ' Today:' + update + ' Notes:' + notes_text; } } else { if (tilltype == "Checkout") { if (icode.indexOf('-PO') != -1) { window.status = '' + icode + ': ' + Data[icode].split(',')[7]; // notes } else { window.status = 'No stock info on this product'; } } } } //================================================================ function adjUpd8(code,qty) { if (Upd8[code] == undefined){ Upd8[code] = -qty; }else{ Upd8[code] -= qty; } } //================================================================ function do_search() { var tcode; old_searchhl=0; searchcount = 0; timeout = null; var myhtml = ""; var mygrep = document.getElementById('F_searchtext').value.toLowerCase(); if (mygrep.length < 2) { document.getElementById('SearchResults').innerHTML = "Waiting for more characters to search on '" + mygrep + "'...."; return; } document.getElementById('SearchResults').focus(); for (var tcode in Txlate) { var lctcode = tcode.toLowerCase(); /* alert(mygrep + ' ' +lctcode);*/ if (mygrep == lctcode) { /* alert (mygrep + ' has been replaced by ' + Txlate[tcode]); */ mygrep = Txlate[tcode].toLowerCase(); } } document.getElementById('SearchResults').innerHTML = "Searching for " + mygrep + "...."; mygrep = mygrep.replace(/ /,'.*'); mygrep = mygrep.replace(/ /,'.*'); mygrep = mygrep.replace(/ /,'.*'); try { var regex = new RegExp(mygrep); } catch(err) { document.getElementById('SearchResults').innerHTML = "Invalid regular expression '" + mygrep + "'.

If in doubt: avoid punctuation, \/ \\ etc.
" ; return; } document.getElementById('B_searchtext').style.background = "#ffffff"; myhtml += ''; IcodeListIndex = 0; var chosen= ''; /* ================================================================ fields in Data[icode]: [0] = table , loose , VAT [1] = * Brand [2] = * Code [3] = * Product descr. [4] = price [5] = * per xx [6] = notes [7] = & pack type [8] = price per kg or if POR [0] = date [1] = * Name [2] = * Code [3] = * No. of items [4] = Cost [5] = * items collected [6] = Amnt paid [7] = * notes [8] = dir/filename ================================================================ */ for (var icode in Data) { var found = 0; if (icode.substring(0,3) == 'POR') { var record = Data[icode].split(',')[1] + Data[icode].split(',')[2] + Data[icode].split(',')[3] + Data[icode].split(',')[5]; var recordlc = record.toLowerCase(); }else { var record = Data[icode].split(',')[1] + Data[icode].split(',')[2] + Data[icode].split(',')[3] + Data[icode].split(',')[5] + Data[icode].split(',')[7]; var recordlc = record.toLowerCase(); } matches = regex.exec(recordlc); if (matches != null) { found = 1;} var loose = 'pk'; if (Data[icode].split(',')[7] == 'var') { loose = 'loose'} if (found == 1 && searchcount < searchcountmax ) { /* codescovered += icode + '
' ; */ chosen = icode; IcodeList[IcodeListIndex]= icode; var background = ''; if (RData === undefined) { /* I think rdata is a hang-over from Ripple */ } else { if (RData[icode]) { background = 'background-color:#80ff80;'; } } // if (Data[icode].split(',')[8] == 'stk') { // background = 'background-color:#80ff80;'; // } if ( icode.substring(0,3) == 'POR') { background = 'background-color:#d080c0;'; } var stocklevel = '??'; var notes_text = ''; var stocktitle = ' title="Stock level= ??" '; if (Stock[icode] != undefined) { stocklevel = parseInt(Stock[icode].split(',')[0]); update = 0; if (Upd8[icode] != undefined) { update = parseInt(Upd8[icode]); stocklevel += update; } //INSIDE function do_search() notes_text = Stock[icode].split(',')[3]; notes_text = notes_text.replace(/\//g,"\n"); notes_text = notes_text.replace(/\%2d/g,","); notes_text = notes_text.replace(/\%99/g,'\''); stocktitle = ' title="Stock level =' + stocklevel + '\n Today:' + update + '\n Notes:\n' + notes_text + ' " '; } if ( icode.substring(0,3) == 'POR') { stocktitle= ' title="Please select items individually"'; } if ( icode.indexOf('-POR') != -1) { stocktitle= Data[icode].split(',')[7]; if (stocktitle == 'pk') {stocktitle='To be collected and paid for.'; } stocktitle= ' title="' + stocktitle+ '"'; // alert('Title "' + stocktitle +'"'); //alert('Title ' + icode + ' ' + Data[icode].split(',')[7]); } myhtml += ''; myhtml += ''; myhtml += ''; if (searchhl == (IcodeListIndex)) { myhtml += ''; if ( icode.substring(0,3) == 'POR') { var amnttopay = trailzeros(roundPrice(Data[icode].split(',')[4] - Data[icode].split(',')[6])); if (amnttopay > 0.01) { myhtml += ''; myhtml += ''; myhtml += ''; searchcount ++; IcodeListIndex++; if (searchcount>= searchcountmax) {break;} } } myhtml += '
'; if (icode.indexOf('-PO') != -1) {myhtml += ' ' + icode + ''; }else { myhtml += icode;} myhtml += ' '; if ( icode.substring(0,3) == 'POR') { myhtml += prettydate2(Data[icode].split(',')[0]); }else { myhtml += Data[icode].split(',')[1]; } myhtml += ' '; updowncode = icode; if (tilltype == "Checkout") { window.status = icode + ': Stock level =' + stocklevel + ' Today:' + update + ' Notes:' + notes_text; } } else { myhtml += ''; } if ( icode.substring(0,3) == 'POR') { myhtml += Data[icode].split(',')[1]; } else { myhtml += Data[icode].split(',')[3]; } myhtml += ' '; } else { myhtml += ' '; } myhtml += '£' + amnttopay; } else { myhtml += ' '; myhtml += Data[icode].split(',')[4]; } myhtml += ' '; if (wholesale) { var fred = Data[icode].split(',')[5]; myhtml += fred.substring(4); } else { if (icode.substring(0,3) != 'POR') { if ((icode.indexOf('-PO') != -1) && (Data[icode].split(',')[5].substring(0,4) == 'per ') ) { myhtml += ' ' + Data[icode].split(',')[5].substring(4) + ''; }else { myhtml += Data[icode].split(',')[5];} } else { myhtml += 'see'; } } myhtml += ' '; myhtml += loose; if (tilltype == "Checkout") { notes_text = notes_text.replace(/\'/g,"\\'"); notes_text = notes_text.replace(/^\n/,""); notes_text = notes_text.replace(/\n/g,"\\n"); myhtml += ' '; //if (loose == 'pk') { //alert('icode=' + icode ); if (icode.indexOf('-PO') != -1) { var buttonText = 'Add'; if (clean_number(Data[icode].split(',')[4]) <= 0) { buttonText='Coll';} if (Data[icode].split(',')[6] >= 1) { buttonText='Pay';} myhtml += '' ; } else { myhtml += '' + stocklevel + ''; } } myhtml += '
'; if (searchcount== searchcountmax) { myhtml = "Search truncated at " + searchcountmax + " items
" + myhtml + "
Search truncated at " + searchcountmax + " items"; } document.getElementById('SearchResults').innerHTML = myhtml ; if (searchcount ==0 ) { document.getElementById('SearchResults').innerHTML = 'No items found'; document.getElementById('Searchcount').innerHTML = ' '; }else if (searchcount ==1) { document.getElementById('Searchcount').innerHTML = ' ' + searchcount + ' item found'; my_choose(chosen); } else if (searchcount >=searchcountmax) { document.getElementById('Searchcount').innerHTML = ' >= ' + searchcount + ' items found'; return; } else { document.getElementById('Searchcount').innerHTML = ' ' + searchcount + ' items found'; } /* document.getElementById('list').innerHTML = codescovered; */ return 0; } /*================================================================ */ function do_Orderlet(code) { // code here to quiz operator // for collected // for payment (indicate full member cost and list cost) my_choose(code); var already = ''; if (document.getElementById('F_Qty').value > 0 ) { orderlet_qty = prompt("Please enter 1 if item collected, \n - or 999 to delete this order item.","1"); if (orderlet_qty == null) { return false; } if (orderlet_qty == 999) { orderlet_price = document.getElementById('F_Price').value; alert(document.getElementById('F_Code').value + ' = ' + document.getElementById('F_Product').value + ' will be cancelled'); orderlet_set = 1; return true; } } else { already = 'Item already collected\n'; orderlet_qty = 0; } if (clean_number(document.getElementById('F_Price').value) <= 0) { alert('Already paid');orderlet_price = '£0.00'; } else { orderlet_price = prompt(already + "Please enter amount to be paid",document.getElementById('F_Price').value); if (orderlet_price == null) { return false; } } orderlet_set = 1; //alert(' please set qty to 1 if collected') //alert(' please set price to amount paid') } /* ================================================================ */ function set_POR(state) { if (state == 0) { if (POR_display != 0) { POR_display = 0; document.getElementById('F_Code').size = 6; document.getElementById('F_Brand').size = 20; document.getElementById('F_Product').size = 30; document.getElementById('F_Price').size = 5; document.getElementById('F_Size').size = 15; document.getElementById('F_Qty').size = 6; document.getElementById('F_Cost').size = 5; document.getElementById('L_Code').innerHTML = 'Code'; document.getElementById('L_Brand').innerHTML = 'Brand'; document.getElementById('L_Product').innerHTML = 'Product'; document.getElementById('L_Price').innerHTML = 'Price'; document.getElementById('L_Size').innerHTML = 'Size'; document.getElementById('B1_Qty').innerHTML = 'Qty'; document.getElementById('L_Cost').innerHTML = 'Cost'; document.getElementById('arrows').style.visibility = "visible"; document.getElementById('halfprice').style.visibility = "visible"; document.getElementById('F_Cost').style.fontSize='20pt'; } } else { if (POR_display == 0) { POR_display = 1; document.getElementById('F_Code').size = 7; document.getElementById('F_Brand').size = 8; document.getElementById('F_Product').size = 30; document.getElementById('F_Price').size = 5; document.getElementById('F_Size').size = 5; document.getElementById('F_Qty').size = 5; document.getElementById('F_Cost').size = 6; document.getElementById('L_Code').innerHTML = 'Code'; document.getElementById('L_Brand').innerHTML = 'Date'; document.getElementById('L_Product').innerHTML = 'Person (Items,Cost)'; document.getElementById('L_Price').innerHTML = 'Alrdy. Coll'; document.getElementById('L_Size').innerHTML = 'Paid'; document.getElementById('B1_Qty').innerHTML = 'Collecting now'; document.getElementById('L_Cost').innerHTML = 'To Pay now'; document.getElementById('arrows').style.visibility = "hidden"; document.getElementById('halfprice').style.visibility = "hidden"; //document.getElementById('F_Cost').style.fontSize='12pt'; } } } function load_checkout_notes() { var myRegExp = /%2c/g; var string = document.getElementById('TotalNotes').value; string = string.replace(myRegExp , ','); var myRegExp = /%0d%0a/g; string = string.replace(myRegExp , '\n'); var myRegExp = /\n\n/g; string = string.replace(myRegExp , '\n'); //alert(string); document.getElementById('notescontents').value = string; } function save_checkout_notes() { if (document.getElementById('notesTitle').innerHTML.indexOf('Checkout') != -1) { var myRegExp = /,/g; var string = document.getElementById('notescontents').value; string = string.replace(myRegExp , '%2c'); var myRegExp = /\n/g; string = string.replace(myRegExp , '%0d%0a'); var myRegExp = /\'/g; string = string.replace(myRegExp , ''); //alert(string); document.getElementById('TotalNotes').value = string; } } // called from close button in notes panel function hide_POR_notes(){ document.getElementById('notespanel').style.top = "-1000px"; save_checkout_notes(); } function show_POR_notes(){ save_checkout_notes(); document.getElementById('notesTitle').innerHTML = "Personal Order Notes"; document.getElementById('notespanel').style.top = "680px"; } // called from notes buton function toggle_notes(){ var np = document.getElementById('notespanel'); //alert(np.style.top); if ((np.style.top =='') ||(parseInt(np.style.top) < 0)) { np.style.top = "680px"; load_checkout_notes(); } else { np.style.top = "-1000px"; save_checkout_notes(); } document.getElementById('notesTitle').innerHTML = "Checkout Notes"; } function my_choose_POR(prodcode){ var proddata = Data[prodcode]; set_POR(1); producttype = 'Personal Order'; var datestr = proddata.split(',')[0]; document.getElementById('F_Code').value = prodcode; document.getElementById('F_Brand').value = datestr.substring(6,8)+ '/' + datestr.substring(4,6)+ '/' + datestr.substring(2,4); // date document.getElementById('F_Product').value = proddata.split(',')[1].substring(0,15) + '(' + // person + items + cost proddata.split(',')[3] + ' £' + proddata.split(',')[4]+')' ; PORItems = proddata.split(',')[3]; document.getElementById('F_Price').value = proddata.split(',')[5]; // 'Already Collected' document.getElementById('F_Size').value = proddata.split(',')[6]; // 'Already Paid' document.getElementById('F_Qty').value = ''; document.getElementById('F_Cost').value = '£' + trailzeros(roundPrice(clean_number(proddata.split(',')[4]) - clean_number(proddata.split(',')[6]))); if ( (clean_number(proddata.split(',')[4]) - clean_number(proddata.split(',')[6])) < 0) { document.getElementById('L_Cost').innerHTML = 'Refund'; } else { document.getElementById('L_Cost').innerHTML = 'To Pay now'; } document.getElementById('F_Pricekg').value = proddata.split(',')[7] show_POR_notes(); document.getElementById('notescontents').value = document.getElementById('F_Pricekg').value; var myRegExp = /\%0a/g; document.getElementById('notescontents').value = document.getElementById('notescontents').value.replace(myRegExp , '\n'); var myRegExp = /\%2c/g; document.getElementById('notescontents').value = document.getElementById('notescontents').value.replace(myRegExp , ','); document.getElementById('ProductType').innerHTML = producttype; //producttype; //alert('setting link'); document.getElementById('NotesLink').innerHTML = 'Original order' ; if (orderlet_set){ document.getElementById('F_Qty').value = orderlet_qty; if (orderlet_qty == 999) { document.getElementById('F_Product').value = document.getElementById('F_Product').value + " - Cancelled "; } document.getElementById('F_Cost').value = orderlet_price; orderlet_set = 0; } } function my_choose(prodcode) { var proddata = Data[prodcode]; if (wholesale) { return my_choose_wsl(proddata)} if (prodcode.substring(0,3) == 'POR') { document.getElementById('qtyform').reset(); // new 15/10/09 document.getElementById('F_Pricekg').value = proddata.split(',')[7] if ( document.getElementById('F_Pricekg').value != '') { show_POR_notes(); document.getElementById('notescontents').value = document.getElementById('F_Pricekg').value; var myRegExp = /\%0a/g; document.getElementById('notescontents').value = document.getElementById('notescontents').value.replace(myRegExp , '\n'); var myRegExp = /\%2c/g; document.getElementById('notescontents').value = document.getElementById('notescontents').value.replace(myRegExp , ','); } else { hide_POR_notes(); } return; // new 15/10/09 return my_choose_POR(prodcode); } var producttype= ''; var proddata = Data[prodcode]; document.getElementById('F_Code').value = prodcode; document.getElementById('F_Brand').value = proddata.split(',')[1]; document.getElementById('F_Product').value = proddata.split(',')[3]; document.getElementById('F_Price').value = proddata.split(',')[4]; document.getElementById('F_Pricekg').value = proddata.split(',')[8]; if (proddata.split(',')[7] == 'var') { document.getElementById('F_Size').value = proddata.split(',')[5] + ' (loose)'; document.getElementById('F_Size').value = document.getElementById('F_Size').value.replace(/per /,""); document.getElementById('F_Qty').value = '500'; document.getElementById('F_Cost').value = '£' + trailzeros(clean_number(proddata.split(',')[4])); if (proddata.split(',')[5].indexOf('l') == -1 ) { producttype = 'Loose commodity - Dry'; } else { producttype = 'Loose commodity - Liquid'; } } else { document.getElementById('F_Size').value = proddata.split(',')[5] + ' ' + proddata.split(',')[7]; document.getElementById('F_Size').value = document.getElementById('F_Size').value.replace(/per /,""); document.getElementById('F_Qty').value = '1'; document.getElementById('F_Cost').value = '£' + trailzeros(clean_number(proddata.split(',')[4])); producttype = 'Packaged Item'; } document.getElementById('ProductType').innerHTML = producttype; //producttype; set_POR(0); hide_POR_notes(); if (orderlet_set){ if(orderlet_qty == 999) { document.getElementById('F_Pricekg').value = 'Cancelled'; document.getElementById('F_Product').value += " - Cancelled"; } document.getElementById('F_Qty').value = orderlet_qty; document.getElementById('F_Cost').value = orderlet_price; AddToList();DisplayList(); orderlet_set = 0; } if (prodcode.indexOf('-PO') != -1) { document.getElementById('F_Qty').value = 1 - proddata.split(',')[6]; } // document.getElementById('F_Qty').focus(); } //================================================================ function halfpriceButton() { var prodcode = document.getElementById('F_Code').value; if ( (prodcode == '') || clean_number(document.getElementById('F_Price').value)== 0) { return; } if (prodcode.indexOf('-PO') != -1) { return;} if (prodcode.substring(prodcode.length-1) == 'A') { alert('Price already halved'); return; } var proddata = Data[prodcode]; alert('Halving price for product:' + prodcode + ' ' + document.getElementById('F_Product').value); document.getElementById('F_Product').value += ' (Old stock)'; document.getElementById('F_Price').value = clean_number(proddata.split(',')[4]) /2 ; if (document.getElementById('F_Size').value.indexOf('loose')!= -1 ){ //alert('Setting price per kg'); document.getElementById('F_Pricekg').value = clean_number(proddata.split(',')[8]) / 2; } document.getElementById('F_Code').value = prodcode + 'A'; price_item(); } /* ================================================================ */ function price_item_price() { if (document.getElementById('F_Size').value.indexOf('loose')!= -1 ){ document.getElementById('F_Pricekg').value = clean_number(document.getElementById('F_Price').value) * 2; } price_item(); } /* ================================================================ */ function price_item() { var cost; if (document.getElementById('F_Code').value.substring(0,3) != 'POR') { if (document.getElementById('F_Size').value.indexOf('loose')!= -1 ){ cost = 50 * clean_number(document.getElementById('F_Pricekg').value) * clean_number(document.getElementById('F_Qty').value) / clean_number(document.getElementById('F_Size').value) ; } else { cost = 100* clean_number(document.getElementById('F_Price').value) * clean_number(document.getElementById('F_Qty').value); } } else { //personal order xyzzy var proddata = Data[document.getElementById('F_Code').value]; var orig_cost = clean_number(proddata.split(',')[4]);// var alr_paid = clean_number(document.getElementById('F_Size').value); //alert(orig_cost +' '+ alr_paid); cost = 100* (orig_cost - alr_paid); } if (document.getElementById('F_Code').value.indexOf('-POR') == -1) { // only update if not orderlet document.getElementById('F_Cost').value = '£' + trailzeros(Math.round(cost)/100); } } /* ================================================================ */ function clean_number(inputstr) { var my_string = inputstr; //alert('cleaning "' + my_string + '"'); if ((my_string == undefined) || (my_string == '')) { return (0); } myRegExp = /[£a-z \(\)]/g; myRegExp = /[^0-9\.\/\-\+\*]/g; my_string=my_string.replace(myRegExp , ''); // if (my_string.indexOf('/') != -1) { var newnum; try{ eval('newnum = ' + my_string); } catch(err) { newnum = 0; } my_string =newnum; // } return my_string; } /* ================================================================ */ function incr(field,inc) { var increment = inc; var value; var suffix = ''; var prefix = ''; var fieldobj = document.getElementById(field); if (fieldobj.value.indexOf('£')!= -1 ){ var prefix = '£'; } if (fieldobj.value.indexOf('loose')!= -1 ){ increment = inc + '0'; suffix = ' (loose)'; } else { if (document.getElementById('F_Size').value.indexOf('loose')!= -1 ){ increment = parseFloat(inc) * 50; } } if (fieldobj.value == ''){fieldobj.value = 0;} var oldvalue = fieldobj.value; value = parseFloat(clean_number(fieldobj.value)) + parseFloat(increment); if ((oldvalue != 0)||(increment >0)) {fieldobj.value = prefix + value + suffix;} } /* ================================================================ */ function set_member(){ return ; // woodbr //alert('set_member()'); if (document.getElementById('Member').checked) { /* alert('Member -> checked'); */ document.getElementById('NonMember').checked = 0; document.getElementById('NonMemberCell').style.backgroundColor ="#FFFFFF"; document.getElementById('MemberCell').style.backgroundColor ="#80FF80"; } else { document.getElementById('MemberCell').style.backgroundColor ="#FFFFFF"; } // unset for cafe // document.getElementById('is_cafe').checked = 0; do_discount(); } /* ================================================================ */ function set_nonmember(){ // woodbr return; if (document.getElementById('NonMember').checked ) { /* alert('MonMember -> checked'); */ document.getElementById('Member').checked = 0; document.getElementById('Helper').checked = 0; document.getElementById('MemberCell').style.backgroundColor ="#FFFFFF"; document.getElementById('NonMemberCell').style.backgroundColor ="#FF8080"; } else { document.getElementById('NonMemberCell').style.backgroundColor ="#FFFFFF"; } // document.getElementById('is_cafe').checked = 0; do_discount(); } /* ================================================================ */ function do_discount() { /* if (document.getElementById('Member').checked) { document.getElementById('Discount').value = '£0.00'; if (document.getElementById('Helper').checked) { document.getElementById('Discount').value = '£' + trailzeros(roundPrice(clean_number(document.getElementById('SubTotal').value)/8)); } if (!MembershipSet) { document.getElementById('Membership').value = '£0.00'; } } else { document.getElementById('Discount').value = '£0.00'; if (!MembershipSet) { document.getElementById('Membership').value = '£1.00'; } } //woodbr */ do_total(); } /* ================================================================ */ function do_total() { // if (document.getElementById('Member').checked || document.getElementById('NonMember').checked) { var my_total = clean_number(document.getElementById('SubTotal').value) - clean_number(document.getElementById('Discount').value); document.getElementById('Total').value = '£' + roundPrice(my_total); my_total = roundPrice(my_total) + roundPrice(clean_number(document.getElementById('Membership').value)) + roundPrice(clean_number(document.getElementById('POColl').value)); document.getElementById('Total').value = '£' + trailzeros(roundPrice(my_total)); // } else { // document.getElementById('Total').value = 'Memb?'; // } } /* ================================================================ */ function do_change() { // if (document.getElementById('F_Tendered').value.indexOf('£') != 0) { // document.getElementById('F_Tendered').value = '£' + document.getElementById('F_Tendered').value; // } // if (document.getElementById('F_cheque').value.indexOf('£') != 0) { // document.getElementById('F_cheque').value = '£' + document.getElementById('F_cheque').value; // } var my_change = clean_number(document.getElementById('F_Tendered').value) + clean_number(document.getElementById('F_cheque').value) - clean_number(document.getElementById('F_Cost_C').value); if (my_change >=0) { document.getElementById('F_Change').value = trailzeros(roundPrice(my_change)); } else { document.getElementById('F_Change').value = ""; } } /* ================================================================ */ function trailzeros(input) { var inp = new String(input); if (inp.indexOf('.') == -1) { return(inp + '.00'); } if (inp.indexOf('.') == (inp.length - 2)) { return(inp + '0'); } return(inp); } //================================================================ function formCheckPO() { document.getElementById('Operator').value = cashier; var name=""; document.getElementById('Customer').value = document.getElementById('Name').value; hide_POR_notes(); if (document.getElementById('notesTitle').innerHTML.indexOf('Checkout') != -1) { var myRegExp = /,/g; var string = document.getElementById('notescontents').value; string = string.replace(myRegExp , '%2c'); var myRegExp = /\n/g; string = string.replace(myRegExp , '%0d%0a'); var myRegExp = /\'/g; string = string.replace(myRegExp , ''); //alert(string); document.getElementById('TotalNotes').value = string; } if (document.getElementById('Name').value == '') { alert("Please fill in your name "); return false; } if (document.getElementById('Phone').value == '') { alert("Please fill in your Phone No. "); return false; } var myRegExp = /[^a-zA-Z0-9.£()\- ]/; // alert('hello'); if (myRegExp.exec(document.getElementById('Name').value)!= null) { alert("Please use just A-z, 0-9 for your name"); return false; } document.getElementById('TOW').value = tillonweb; if (document.getElementById('Total').value == 'Memb?') { alert('Please say whether a member or not'); return false; } if ((document.getElementById('Total').value == '') || (ListIndex == 0)) { alert('Please add items to the list'); return false; } return true; } //================================================================ function formCheck() { document.getElementById('Operator').value = cashier; document.getElementById('TOW').value = tillonweb; if (document.getElementById('notesTitle').innerHTML.indexOf('Checkout') != -1) { var myRegExp = /,/g; var string = document.getElementById('notescontents').value; string = string.replace(myRegExp , '%2c'); var myRegExp = /\n/g; string = string.replace(myRegExp , '%0a'); var myRegExp = /\'/g; string = string.replace(myRegExp , ''); //alert(string); document.getElementById('TotalNotes').value = string; } //alert('Cashier:' + cashier); //alert('Cashier:' + document.getElementById('Operator').value); //alert('Notes:"' + string +'"'); hide_POR_notes(); //alert("TOW="+document.getElementById('TOW').value); if (document.getElementById('Total').value == 'Memb?') { alert('Please say whether a member or not.'); return false; } if (document.getElementById('Total').value == '') { alert('Please add items to the list'); return false; } if ((ListIndex == 0) && (document.getElementById('F_Code').value.substring(0,3) == 'POR')) { alert('Please add the personal order item to the list'); return false; } //function formCheck() { if (change_ok) { document.getElementById('Tendered').value = document.getElementById('F_Tendered').value; document.getElementById('Change').value= document.getElementById('F_Change').value; document.getElementById('Cheque').value= document.getElementById('F_cheque').value; document.getElementById('Paid').value = '£' + trailzeros(roundPrice( clean_number(document.getElementById('F_Tendered').value) + clean_number(document.getElementById('F_cheque').value) - clean_number(document.getElementById('F_Change').value) )); //openwait(); return true; } // if(document.getElementById('Member').checked == true && document.getElementById('MembNo').value=='') { //if (!confirm("No membership number. Continue?")) { // return false; //} // } //alert (show_change); if (show_change) { fn_show_change(); return false; } if(document.getElementById('Paid').value == '') { alert('Please enter the amount paid'); document.getElementById('Paid').focus(); return false; } openwait(); return true; }//function formCheck() { //================================================================ function write_form() { write_form_po(); } //================================================================ function write_form_po() { var URL= new String(window.location); var pos2= URL.indexOf('redpepper'); var pos1= URL.indexOf('http:'); // document.write('
'); document.write(''); } //================================================================ function getparam (name) { var URL= new String(window.location); var match1 = '&' + name + '='; var match2 = '?' + name + '='; var pos1= URL.indexOf(match1); var pos2= URL.indexOf(match2); // alert(name + ' pos1 = ' + pos1 + ' pos2 = ' + pos2 ); if ( (pos1 == -1) && (pos2 == -1) ) return(''); if (pos1 != -1) { URL = URL.substring(pos1+1);} if (pos2 != -1) { URL = URL.substring(pos2+1);} // alert(URL); var pos=URL.indexOf('='); var posand = URL.indexOf('&'); if (posand == -1) { URL = URL.substring(pos+1); } else { URL = URL.substring(pos+1,posand); } // alert( name + '=\'' + URL + '\''); URL = URL.replace(/\+/g," "); return unescape(URL); } //Sat Dec 13 18:08:06 2008 //================================================================ // This array should be set up as required for YOUR web page. var keyActions = new Array (); keyActions [0] = {character: "2", actionType: "link", param: "till.html"}; keyActions [1] = {character: "L", actionType: "code", param: "alert('hello');"}; // End of user defined array function hotKeys (event) { var keycode; if (window.event) keycode = window.event.keyCode; else if (event) keycode = event.which; // alert("keycode: " + keycode); // Get details of the event dependent upon browser event = (event) ? event : ((window.event) ? event : null); // We have found the event. if (event) { var charCode = (event.charCode) ? event.charCode : ((event.which) ? event.which : event.keyCode); // if (charCode == 42) {new_search(); return false; } // Hotkeys require that either the control key or the alt key is being held down if (event.ctrlKey || event.altKey || event.metaKey) { // Pick up the Unicode value of the character of the depressed key. charCode = (event.charCode) ? event.charCode : ((event.which) ? event.which : event.keyCode); // Convert Unicode character to its lowercase ASCII equivalent var myChar = String.fromCharCode (charCode).toLowerCase(); // alert(myChar); // Convert it back into uppercase if the shift key is being held down if (event.shiftKey) {myChar = myChar.toUpperCase();} // Now scan through the user-defined array to see if character has been defined. for (var i = 0; i < keyActions.length; i++) { // See if the next array element contains the Hotkey character if (keyActions[i].character == myChar) { // Yes - pick up the action from the table var action; // If the action is a hyperlink, create JavaScript instruction in an anonymous function if (keyActions[i].actionType.toLowerCase() == "link") { action = new Function ('location.href ="' + keyActions[i].param + '"'); } // If the action is JavaScript, embed it in an anonymous function else if (keyActions[i].actionType.toLowerCase() == "code") { action = new Function (keyActions[i].param); } // Error - unrecognised action. else { alert ('Hotkey Function Error: Action should be "link" or "code"'); break; } // At last perform the required action from within an anonymous function. action (); // Hotkey actioned - exit from the for loop. break; } } } } } /*============================================================================*/ function thisdate() { var myDate=new Date(); var dd = myDate.getDate(); var mm = myDate.getMonth() + 1; var ccyy = myDate.getFullYear(); if (dd < 10) { dd = '0' + dd; } if (mm < 10) { mm = '0' + mm; } /* return (dd + '/' + mm +'/'+ ccyy); */ return ('' + ccyy + mm + dd); } function closeHelp() { document.getElementById('helppanel').style.top = "-1000px"; helpDisplayed = false; createCookie('helpDisplayed',0,'300') } function openHelp() { if (helpDisplayed) { return(closeHelp()); } var y=0; if (self.pageYOffset || self.pageYOffset === 0) // all except Explorer { y = self.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop) // Explorer 6 Strict { y = document.documentElement.scrollTop; } else if (document.body) // all other Explorers { y = document.body.clientHeight; } y+=420; //position helppanel document.getElementById('helppanel').style.top = y + "px"; // document.getElementById('helppanel').style.backgroundColor = "#fcfcfc"; helpDisplayed = true; createCookie('helpDisplayed',1,'300'); change_help(); helpLeft = readCookie('helpLeft'); if (helpLeft != '') { helpTop = readCookie('helpTop'); document.getElementById('helppanel').style.top = helpTop; document.getElementById('helppanel').style.left = helpLeft; } else { createCookie('helpLeft',document.getElementById('helppanel').style.left,'300') createCookie('helpTop',document.getElementById('helppanel').style.top,'300') } } function set_help(txt) { document.getElementById('helpcontents').innerHTML = txt; } //================================================================ function change_help() { if (my_focus == 'search') { if (IcodeListIndex > 0) { if (IcodeListIndex ==1 ) { set_help('Confirm item
Press Enter to select this product
' + ' - if it\'s the one you wanted.

Press Esc to cancel and start again.'); } else { set_help('Choose item
Select which product matching "' + document.getElementById('F_searchtext').value + '" you want:
- use the Up/Down Arrows to select product
' + ' and then press Enter (or click on it in the list above).
' + '
Press Esc to cancel and start again.'); } } else { if (tilltype == "Checkout") { if (document.getElementById('SearchResults').innerHTML != 'No items found') { set_help('Next item (use F7 to get back here)' + '
Type the search text for the product, or its code
and then press Enter (or click "Go").
' + '
Example: \"wa up\" for washing up liquid.' + '
or try using the last 3 digits of the code.' ); } else { set_help('Not Found
No products matching "' + document.getElementById('F_searchtext').value + '" can be found.
If you want to search the whole SUMA catalogue,
' + 'use the personal Orders screen'); } } else { if (document.getElementById('SearchResults').innerHTML != 'No items found') { set_help('Next item (use F7 to get back here)' + '
Type the search text for the product, or its code
and then press Enter (or click "Go").
' + '
Example: \"wa up\" for washing up liquid.' ); } else { set_help('Not Found
No products matching "' + document.getElementById('F_searchtext').value + '" can be found. '); } } } } if (my_focus == 'lookup') { set_help('Which member?
Type the person\'s name and then press Enter
' + '(or click "Fwd")

Example: \"Jo Fi\" for John Fisher.

' + 'Press Esc to cancel and close the membership lookup window.'); } if (my_focus == 'lookedup') { if (document.getElementById('memno').innerHTML =='??') { set_help('Unknown:
' + 'Maybe they\'re a new member. Click here for entry screen'); } else { set_help('Use result:
Press Enter to use the membership number (' + document.getElementById('memno').innerHTML + ')
or down arrow for next match (or click the Fwd/Back butons)

press ESC to cancel'); } } if (my_focus == 'qty') { if (tilltype == "Checkout") { set_help('Now set the quantity
' + 'Type in the amount and then press Enter
  (or click "Add to list").' + '
Or - use up/down arrows to increase/decrease quantity\n then press Enter.
' + '(remember you can use negative numbers for returns)
' + '
Press Esc to cancel and start again.'); } else { set_help('Now set the quantity
' + 'Type in the quantity and then press Enter
(or click "Add to list").
' + '
Or - use up/down arrows to increase/decrease quantity\n then press Enter.
' + 'Note you can use decimals on some products. e.g. 0.34
' + '
Press Esc to cancel and start again.'); } } } function openwait() { document.getElementById('pleasewait').style.top = 300; document.getElementById('pleasewait').style.left = 300; } /*============================================================================*/ function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } //================================================================ function fn_show_change(){ document.getElementById('changepanel').style.top = "370px"; document.getElementById('F_Cost_C').value = trailzeros(clean_number(document.getElementById('Total').value)); document.getElementById('F_Tendered').value = ""; document.getElementById('F_cheque').value = ""; document.getElementById('F_Change').value = ""; document.getElementById('F_Tendered').focus(); my_focus='change'; if (clean_number(document.getElementById('F_Cost_C').value) < 0) { document.getElementById('F_Change').value = '£' + trailzeros(0 - clean_number(document.getElementById('F_Cost_C').value)); } } function hide_change(){ document.getElementById('changepanel').style.top = "-1000px"; }