function toPage(page,action,hidname) { if(typeof action != "undefined") { document.mainform.action = action; } if(hidname && hidname != ""){ document.getElementById(hidname).value = page; } else{ document.mainform.p.value = page; } if( document.mainform.searchFlag ) document.mainform.searchFlag.value="page"; document.mainform.target="_self"; document.mainform.submit(); } function toSub(id,mode,page,action){ if(mode=="DELETE" || mode=="DELETESUPPLIER" || mode=="DELETEALLSUPPLIER" || mode=="PFDELETE" || mode=="PCDELETE"|| mode=="DELETEOVER" || mode=="PDELETE"){ if(!confirm("削除してもよろしいですか?")) return false; } if(typeof action != "undefined") { document.mainform.action = action; } if(document.mainform.id) document.mainform.id.value = id; document.mainform.mode.value = mode; if(document.mainform.p && page != undefined){ document.mainform.p.value = page; } document.mainform.submit(); } function confirmToSub(id,mode,page,action, message){ // 入力済みであればポップアップを出さない var ep = $("[name=" + id + "_expected_price]"); var rp = $("[name=" + id + "_reference_price]"); if(ep && rp){ if(ep.attr('type') == 'hidden' && rp.attr('type') == 'hidden'){ message = null; } } if(message){ var confirm_prices = $("[data-itemname=confirm_price]"); if(confirm_prices){ $.each($(confirm_prices), function(i, item){ var price = $(item).prev().val(); price = price.replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,'); $(item).val(price); $(item).prev().hide(); $(item).show(); }); } var select_bid_id = $("[data-itemname=selectBidId]"); if(select_bid_id){ select_bid_id.val(id); } setTimeout(function(){ if(!confirm(message)){ if(confirm_prices){ $.each($(confirm_prices), function(i, item){ $(item).prev().show(); $(item).hide(); }); } return false; } else { if(confirm_prices){ $.each($(confirm_prices), function(i, item){ $(item).prev().show(); $(item).hide(); }); } } toSub(id,mode,page,action); }, 300); }else{ toSub(id,mode,page,action); } } function checkBid(id,mode,count){ var obj=document.getElementsByName('check[]'); var c=0; for(var i=0;i0){ var name="落札数量が<{1}>足りませんが、よろしいですか?"; name=name.replace("<{1}>",c); if(!confirm(name)) return false; } toSub(id,mode); } function toAccept(id,mode){ if(mode=="ACCEPT"){ if(!confirm("承認してよろしいですか?")) return false; } if(mode=="UNACCEPT"){ if(!confirm("承認しない”でよろしいですか?")) return false; } document.mainform.id.value = id; document.mainform.mode.value = mode; document.mainform.submit(); } function toOrderBy(mode,orderfield,ordersort){ document.mainform.mode.value = mode; document.mainform.orderfield.value = orderfield; document.mainform.ordersort.value = ordersort; document.mainform.submit(); } function doCheck(id,obj){ var checkString=document.getElementById("checkString").value; var str1=""; var str2=""; if(obj.name=="check1"){ str1="check"; str2="check2"; }else if(obj.name=="check2"){ str1="check"; str2="check1"; }else{ str1="check1"; str2="check2"; } obj1=document.getElementById(str1+id); obj2=document.getElementById(str2+id); if(obj.checked){ if(obj1) obj1.checked=true; if(obj2) obj2.checked=true; checkString=myReplace(checkString,id); if(checkString==""){ checkString=id; }else{ checkString+=","+id; } }else{ if(obj1) obj1.checked=false; if(obj2) obj2.checked=false; checkString=myReplace(checkString,id); } document.getElementById("checkString").value=checkString; } function myReplace(str,id){ str=str.replace(id+",",""); str=str.replace(","+id,""); str=str.replace(id,""); return str; } function changeOrderby(id,flag){ document.mainform.flag.value = flag; toSub(id,'CHANGEORDERBY'); } function showfavoritelist(str){ var url='buyer_admin.php?mode=SHOWFAVORITELIST&supplierflag='+str; var dialog = art.dialog({ id: 'ajaxdiv', title: "主要サプライヤー一覧" }); $.ajax({ type: 'POST', url: url, success: function (data) {dialog.content(data);showfavoritecheck();}, cache: false }); } function showfavoritecheck(){ var checkString2=document.getElementById("checkString").value; document.getElementById("checkString2").value=checkString2; var objArr=document.getElementsByTagName("input"); for(var i=0;i= 0 ) objArr[i].checked=true; } } } function selectAllSupplier(flag){ var obj=document.getElementsByName('check[]'); for(var i=0;i=0;i--){ if(flag=='3'){ insertSmallRow3(obj[i].id,tbl,index,""+obj[i].supplier_name+"("+obj[i].name+")"); }else if(flag=='2'){ if(supplierflag=='1'){ insertSmallRow4(obj[i].id,tbl,index,""+obj[i].supplier_name+"("+obj[i].name+")"); }else{ var ck=""; if(checkString2.indexOf(obj[i].dept) >= 0 ) ck="checked"; insertSmallRow2(obj[i].id,tbl,index,"",""+obj[i].supplier_name+"("+obj[i].name+")"); } }else{ insertSmallRow(obj[i].id,tbl,index,""+obj[i].supplier_name+"("+obj[i].name+")","","",""); } } } sym.innerHTML="-"; } function addMainType(){ removeAddRow(); var tbl=document.getElementById('tbl'); insertMainRow(tbl,1,"","","","",""); } function addSubType(id){ removeAddRow(); showfavorite('',id,true); var tbl=document.getElementById('tbl'); var current_tr=document.getElementById('tr'+id); var index=current_tr.rowIndex+1; insertSubRow(id,tbl,index,"","","","",""); } function checkType(id,mode){ if(document.getElementById('addBox'+id).value==""){ alert("名称を入力してください。"); return ; } toSub(id,mode); } function editMainType(id){ var tbl=document.getElementById('tbl'); var editButton=document.getElementById('editButton'+id); var titleSpan=document.getElementById('title'+id); var nameSpan=document.getElementById('name'+id); var editorSpan=document.getElementById('editor'+id); var editBox=document.getElementById('editBox'+id); var titleSpan2=document.getElementById('title2'+id); var editorSpan2=document.getElementById('editor2'+id); var textBox=document.getElementById('textBox'+id); if(titleSpan.style.display=="none") { if(editBox.value==""){ alert("名称を入力してください。"); return ; } titleSpan.style.display=""; editorSpan.style.display="none"; titleSpan2.style.display="inline-block"; editorSpan2.style.display="none"; nameSpan.innerHTML=editBox.value; titleSpan2.innerHTML=textBox.value; editButton.value="編集"; jQuery.post('buyer_admin.php',{mode:"EDITMAINTYPE",id:id,name:editBox.value,text:textBox.value}); } else { titleSpan.style.display="none"; editorSpan.style.display=""; titleSpan2.style.display="none"; editorSpan2.style.display=""; editBox.value=nameSpan.innerHTML.replace("<","<").replace(">",">").replace("&","&"); textBox.value=titleSpan2.innerHTML.replace("<","<").replace(">",">").replace("&","&"); editButton.value="更新"; } } function deleteMainType(id,flag){ if(!confirm("削除してもよろしいですか?")) return false; var tbl=document.getElementById('tbl'); var current_tr=document.getElementById('tr'+id); var index=current_tr.rowIndex+1; while(true) { var nexttr = tbl.rows[index]; if(nexttr==undefined || nexttr.className=="title01" || (flag=='1' && nexttr.className=="title02")) { break; } tbl.deleteRow(index); } tbl.deleteRow(index-1); jQuery.post('buyer_admin.php',{mode:"DELETEMAINTYPE",id:id,flag:flag}); } function deleteSmallType(id){ if(!confirm("削除してもよろしいですか?")) return false; var current_tr=document.getElementById('tr'+id); tbl.deleteRow(current_tr.rowIndex); jQuery.post('buyer_admin.php',{mode:"DELETEFAVORITE",id:id}); } function removeAddRow(){ var addBox=document.getElementById('addBox'); if(addBox!=undefined) { var tbl=document.getElementById('tbl'); var editRow=addBox.parentNode.parentNode; var index=editRow.rowIndex; tbl.deleteRow(index); } } function insertMainRow(tbl,index,cell1,cell2,cell3,cell4,cell5) { var newtr = tbl.insertRow(index); var th1=document.createElement("th"); var th2=document.createElement("th"); var th3=document.createElement("th"); var th4=document.createElement("th"); var th5=document.createElement("th"); newtr.appendChild(th1); newtr.appendChild(th2); newtr.appendChild(th3); newtr.appendChild(th4); newtr.appendChild(th5); newtr.className="title01"; th3.className="buttonCell"; th4.className="buttonCell"; th5.className="buttonCell"; th1.innerHTML=cell1; th2.innerHTML=cell2; th3.innerHTML=cell3; th4.innerHTML=cell4; th5.innerHTML=cell5; } function insertSubRow(id,tbl,index,cell1,cell2,cell3,cell4,cell5) { var newtr = tbl.insertRow(index); newtr.setAttribute("id","tr"+id); var th1=document.createElement("th"); var th2=document.createElement("th"); var th3=document.createElement("th"); var th4=document.createElement("th"); var th5=document.createElement("th"); newtr.appendChild(th1); newtr.appendChild(th2); newtr.appendChild(th3); newtr.appendChild(th4); newtr.appendChild(th5); newtr.className="title02"; th2.className="buttonCell"; th3.className="buttonCell"; th4.className="buttonCell"; th5.className="buttonCell"; th1.innerHTML=cell1; th2.innerHTML=cell2; th3.innerHTML=cell3; th4.innerHTML=cell4; th5.innerHTML=cell5; } function insertSubRow2(id,tbl,index,cell1,cell2) { var newtr = tbl.insertRow(index); newtr.setAttribute("id","tr"+id); var th1=document.createElement("th"); var th2=document.createElement("th"); newtr.appendChild(th1); newtr.appendChild(th2); newtr.className="title02"; th1.className="textACenter"; th1.innerHTML=cell1; th2.innerHTML=cell2; } function insertSubRow3(id,tbl,index,cell1,cell2) { var newtr = tbl.insertRow(index); newtr.setAttribute("id","tr"+id); var th1=document.createElement("th"); var th2=document.createElement("th"); newtr.appendChild(th1); newtr.appendChild(th2); newtr.className="title02"; th2.className="buttonCell"; th1.innerHTML=cell1; th2.innerHTML=cell2; } function insertSmallRow(id,tbl,index,cell1,cell2,cell3,cell4) { var newtr = tbl.insertRow(index); newtr.setAttribute("id","tr"+id); var td1=document.createElement("td"); var td2=document.createElement("td"); var td3=document.createElement("td"); var td4=document.createElement("td"); td1.colSpan="2"; newtr.appendChild(td1); newtr.appendChild(td2); newtr.appendChild(td3); newtr.appendChild(td4); td2.className="buttonCell"; td3.className="buttonCell"; td4.className="buttonCell"; td1.innerHTML=cell1; td2.innerHTML=cell2; td3.innerHTML=cell3; td4.innerHTML=cell4; } function insertSmallRow2(id,tbl,index,cell1,cell2) { var newtr = tbl.insertRow(index); newtr.setAttribute("id","tr"+id); var td1=document.createElement("td"); var td2=document.createElement("td"); td2.colSpan="3"; newtr.appendChild(td1); newtr.appendChild(td2); td1.className="textACenter"; td1.innerHTML=cell1; td2.innerHTML=cell2; } function insertSmallRow4(id,tbl,index,cell1) { var newtr = tbl.insertRow(index); newtr.setAttribute("id","tr"+id); var td1=document.createElement("td"); td1.colSpan="3"; newtr.appendChild(td1); td1.innerHTML=cell1; } function insertSmallRow3(id,tbl,index,cell1) { var newtr = tbl.insertRow(index); newtr.setAttribute("id","tr"+id); var td1=document.createElement("td"); td1.colSpan="3"; newtr.appendChild(td1); td1.innerHTML=cell1; } function showSupplierDept(id,flag,id2){ var url='addnew.php?mode=SUPPLIERDEPT&id='+id+'&flag='+flag+'&id2='+id2; var dialog = art.dialog({ id: 'supplier', title: "サプライヤー情報" }); $.ajax({ type: 'POST', url: url, success: function (data) {dialog.content(data);}, cache: false }); } function showPassOrFail(id,id2,id3,menuchecked){ document.mainform.mode="PASSORFAIL"; document.mainform.id=id; var elm_id2 = document.createElement("input"); elm_id2.setAttribute("type", "hidden"); elm_id2.setAttribute("name", "id2"); elm_id2.setAttribute("value", id2); document.mainform.appendChild(elm_id2); var elm_id3 = document.createElement("input"); elm_id3.setAttribute("type", "hidden"); elm_id3.setAttribute("name", "id3"); elm_id3.setAttribute("value", id3); document.mainform.appendChild(elm_id3); document.mainform.submit(); /* var url='addnew.php?mode=PASSORFAIL&id='+id+'&id2='+id2+'&id3='+id3+'&menuchecked='+menuchecked; var dialog = art.dialog({ id: 'passorfail', title: "合否メール送信" }); $.ajax({ type: 'POST', url: url, success: function (data) {dialog.content(data);}, cache: false }); */ } function submitPassOrFail(e) { var form = document.mainform; /* $(".error").css({"margin-left": "3px", "font-size": "14px", "font-weight": "bold", "color": "#f00"}); var checked, radio=form.propriety; for (var i=0; i",document.getElementById("message1").value); }else if(str=="mailtext2"){ text=text.replace("<{MESSAGE}>",document.getElementById("message2").value); }else if(str=="mailtext3"){ text=text.replace("<{MESSAGE}>",document.getElementById("message2").value); text=text.replace("<{MESSAGE1}>",document.getElementById("message1").value); }else if(str=="mailtext"){ if(document.getElementById("message")){ text=text.replace("<{MESSAGE}>",document.getElementById("message").value); } } text=text.replace(/\n/g,"
"); var dialog = art.dialog({ id: 'mail', title: text2 }); dialog.content("

"+text+"

"); } function toAjaxSort(sortby,mode) { jQuery.post('addnew.php',{mode:mode,id:document.mainform.id.value,sortby:sortby},function(data,text){art.dialog({id:'ajaxdiv'}).content(data);}); } function toAjaxBidDelete(bid_id) { if(!confirm("削除してもよろしいですか?")) return false; jQuery.post('addnew.php',{mode:'SHOWBIDLIST',delete_bid_id:bid_id,id:document.mainform.id.value,sortby:document.popform.sortby.value},function(data,text){art.dialog({id:'ajaxdiv'}).content(data);}); } function toSort(sortby,mode) { if(document.getElementById("mode") && mode != undefined){ document.getElementById("mode").value = mode; } document.mainform.sortby.value=sortby; document.mainform.submit(); } function sumbitApplication(mode,choose) { if(choose != undefined){ document.mainform.choose.value = choose; } document.mainform.mode.value = mode; document.mainform.submit(); } function submitDetail() { document.getElementById('iDBody1').style.display = "none"; document.getElementById('iDBody2').style.display = "block"; } function submitList() { document.getElementById('iDBody1').style.display = "block"; document.getElementById('iDBody2').style.display = "none"; } function setresult(display){ var idx=""; if(display.length>11){ idx=display.replace("displaydiv_",""); } if(document.getElementById("btn"+idx)) document.getElementById("btn"+idx).style.display=""; if(document.getElementById("tbtn"+idx)) document.getElementById("tbtn"+idx).style.display=""; if(document.getElementById("sbtn"+idx)) document.getElementById("sbtn"+idx).style.display="none"; if(document.getElementById("spanslp"+idx)) document.getElementById("spanslp"+idx).style.display="none"; } function grouptimer(display,nowtime,endtime,refresh_flg) { var _day = "日"; var _hour = "時間"; var _minute = "分"; var _second = "秒"; var _end = "終了しました"; var hourZero = ""; var minuteZero = ""; var secondZero = ""; var Temp = ""; var now = new Date(); var sectime = parseInt((startTime - now.getTime()) / 1000) +(endtime - nowtime); if(sectime <= 0 ) { if(document.getElementById("chat")) { $("#chat").hide(); $("#new_chat").hide(); } document.getElementById(display).innerHTML = _end; setresult(display); if(typeof(timerID) != "undefined") { clearTimeout(timerID); } return false; } else { dateLeft = parseInt(sectime / 86400); sectime = sectime - dateLeft * 86400; hourLeft = parseInt(sectime / 3600); sectime= sectime - hourLeft * 3600; minuteLeft = parseInt(sectime / 60); secondLeft = sectime - minuteLeft * 60; } if (hourLeft < 10) { hourZero = '0'; } if (minuteLeft < 10) { minuteZero = '0'; } if (secondLeft < 10) { secondZero = '0'; } if (dateLeft > 0) { Temp = dateLeft + _day + hourZero + hourLeft + _hour + minuteZero + minuteLeft + _minute + secondZero + secondLeft + _second; } else { if (hourLeft > 0) { Temp = hourLeft + _hour + minuteZero + minuteLeft + _minute + secondZero + secondLeft + _second; } else { if (minuteLeft > 0) { Temp = minuteLeft + _minute + secondZero + secondLeft + _second; } else { if (secondLeft > 0) { Temp = secondLeft + _second; } else { Temp = ''; } } } } if(Temp == ''){ if(document.getElementById("chat")) { $("#chat").hide(); $("#new_chat").hide(); } document.getElementById(display).innerHTML = _end; setresult(display); if(typeof(timerID) != "undefined") { clearTimeout(timerID); } return false; } else { document.getElementById(display).innerHTML = Temp; } if(typeof(refresh_flg) != "undefined" && typeof(timerID) != "undefined" && refresh_flg=="1") { clearTimeout(timerID); } timerID = setTimeout("grouptimer('"+display+"',"+(nowtime)+","+endtime+",'1')", 1000); } function grouptimer2(display1,nowtime,endtime,refresh_flg) { var _day = "日"; var _hour = "時間"; var _minute = "分"; var _second = "秒"; var _end = "終了しました"; var hourZero = ""; var minuteZero = ""; var secondZero = ""; var Temp = ""; var now = new Date(); for(var i=0;i 0) { Temp = dateLeft + _day + hourZero + hourLeft + _hour + minuteZero + minuteLeft + _minute + secondZero + secondLeft + _second; } else { if (hourLeft > 0) { Temp = hourLeft + _hour + minuteZero + minuteLeft + _minute + secondZero + secondLeft + _second; } else { if (minuteLeft > 0) { Temp = minuteLeft + _minute + secondZero + secondLeft + _second; } else { if (secondLeft > 0) { Temp = secondLeft + _second; } else { Temp = ''; } } } } if(Temp == ''){ document.getElementById(display).innerHTML = _end; setresult(display); continue; //return false; } else { document.getElementById(display).innerHTML = Temp; } } if(typeof(refresh_flg) != "undefined" && typeof(timerID) != "undefined") { clearTimeout(timerID); } timerID = setTimeout("grouptimer2('"+display1+"',"+(nowtime)+","+endtime+")", 1000); } function addlang() { var name=document.getElementById('name'); if(name.value !=""){ var sel=document.getElementsByName('lang')[0]; var selvalue= sel.options[sel.options.selectedIndex].value; var tr=document.getElementById(selvalue); var td=document.getElementById(selvalue+"_text"); var input=document.getElementById(selvalue+"_input"); if(tr.style.display=="none") { tr.style.display=""; td.innerHTML=name.value; input.value=name.value; tr.parentNode.parentNode.parentNode.style.display="block"; }else{ alert("その言語を登録済みです。"); } }else{ alert("値を入力してください。"); } } function changelang(name) { var sel=document.getElementsByName('lang')[0]; var selvalue= sel.options[sel.options.selectedIndex].value; var tr=document.getElementById(selvalue); var td=document.getElementById(selvalue+"_text"); var input=document.getElementById(selvalue+"_input"); tr.parentNode.parentNode.parentNode.style.display="block"; if(tr.style.display=="") { td.innerHTML=name.value; input.value=name.value; } } function adddefault() { var name=document.getElementById('name_default'); if(name.value !=""){ var sel=document.getElementsByName('lang_default')[0]; var selvalue= sel.options[sel.options.selectedIndex].value; var show=document.getElementById(selvalue); var tr=document.getElementById(selvalue+"_default"); var td=document.getElementById(selvalue+"_text_default"); var input=document.getElementById(selvalue+"_input_default"); if(tr.style.display=="none") { tr.style.display=""; td.innerHTML=name.value; input.value=name.value; tr.parentNode.parentNode.parentNode.style.display="block"; }else{ alert("その言語を登録済みです。"); } }else{ alert("値を入力してください。"); } } function select(name) { var selvalue= name.options[name.options.selectedIndex].value; var input=document.getElementById(selvalue+"_input"); document.getElementById("name").value=input.value; } function changedefault(name) { var sel=document.getElementsByName('lang_default')[0]; var selvalue= sel.options[sel.options.selectedIndex].value; var tr=document.getElementById(selvalue); var td=document.getElementById(selvalue+"_text_default"); var input=document.getElementById(selvalue+"_input_default"); if(tr.style.display=="") { td.innerHTML=name.value; input.value=name.value; } } function selectdefault(name) { var selvalue= name.options[name.options.selectedIndex].value; var input=document.getElementById(selvalue+"_input_default"); document.getElementById("name_default").value=input.value; } function addoption() { var url='admin_format.php?mode=SELECTOPTION'; var dialog = art.dialog({ id: 'selectoption', title: "追加" }); $.ajax({ type: 'POST', url: url, success: function (data) {dialog.content(data);getoption(document.getElementById("default").value);}, cache: false }); } function addoptiondefault () { var sel=document.getElementsByName('lang_default')[0]; var selvalue= sel.options[sel.options.selectedIndex].value; var url='admin_format.php?mode=SELECTOPTION&lang='+selvalue; var dialog = art.dialog({ id: 'selectoption', title: "追加" }); $.ajax({ type: 'POST', url: url, success: function (data) {dialog.content(data);getoption(document.getElementById(selvalue+"_input_default").value);}, cache: false }); } function getoption(defaultvalue) { if(defaultvalue!=""){ var sel=document.getElementsByName('select2')[0]; var ch = new Array; ch = defaultvalue.split(",:,"); for(i=0;i