| function openQuoteExcelImport(e) { | 
|     //openPopup('/apex/QuoteExcelImport', 'doc', 450, 210, 'width=450,height=210,scrollbars=yes,toolbar=no,status=no,directories=no,menubar=no,resizable=1', true); | 
|     if ( openQuoteExcelImportWindow == null || openQuoteExcelImportWindow.closed) { | 
|         openQuoteExcelImportWindow = window.open('/apex/QuoteExcelImport', 'xlsdoc', 'width=450,height=210'); | 
|     } | 
|     else { | 
|         openQuoteExcelImportWindow.focus(); | 
|     } | 
| } | 
|   | 
| function copyToClipboard( event, displayCost, quoid, currencyName) { | 
|     //alert( 'copyToClipboard() executed!!'); | 
|     //alert( event); | 
|     //alert( displayCost); | 
|     //alert( quoid); | 
|     //var hiddenQuoid = j$(escapeVfId( 'Page:mainForm:hiddenQuoid')).text(); | 
|     //alert( hiddenQuoid); | 
|      | 
|     if ( quoid == null || quoid == '') { | 
|         alert( Message_Please_Save_Quote); | 
|         return null; | 
|     } | 
|      | 
|     var records; | 
|     try { | 
|         sforce.connection.sessionId = Session_ID; | 
|         records = sforce.apex.execute("NewQuoteEntryWebService","getQuoteLineItem",{quoId:quoid}); | 
|     } | 
|     catch(e){ | 
|         alert( e.faultcode + ',' + e.faultstring); | 
|     } | 
|      | 
|     var x; | 
|     // CHAN-BHNBX6 保修年限 2019/11/20 START  | 
|     var targetString = 'No.\t编码\t状态\t名称\tListPrice\t数量\t保修年限\t单价\t单位\tTotal\t商品成本\t通货'; | 
|   | 
|     for ( var i = 0; i < records.length; i++) { | 
|         x = records[i]; | 
| //      targetString += '\r\n' + (i+1) + '\t' + x.ProductCode__c + '\t' + x.SFDA_Status__c + '\t' + x.Name__c + '\t' + toNumComma( x.ListPrice__c) + '\t' + x.Quantity + '\t' + toNumComma( x.UnitPrice__c) + '\t' + x.Qty_Unit__c + '\t' + toNumComma( x.Subtotal__c); | 
|         targetString += '\r\n' + (i+1) + '\t' + '=MID(( "_" & "' + x.ProductCode__c + '"),2,LEN("' + '_' + x.ProductCode__c + '")-1)' + '\t' + x.SFDA_Status__c + '\t' + x.Name__c + '\t' + toNumComma( x.ListPrice__c) + '\t' + x.Quantity+ '\t' + x.GuaranteePeriod + '\t' + toNumComma( x.UnitPrice__c) + '\t' + ( x.Qty_Unit__c == null ? '' : x.Qty_Unit__c) + '\t' + toNumComma(x.UnitPrice__c * x.Quantity); | 
|         if ( displayCost == 'true') { | 
|             targetString += '\t' + toNumComma( x.Cost__c) + '\t' + currencyName; | 
|         } | 
|     } | 
|     // CHAN-BHNBX6 保修年限 2019/11/20 END | 
|     try { | 
|         clipboardData.setData( "Text", targetString); | 
|         alert( Message_Check_Your_Clipboard); | 
|     } | 
|     catch ( e) { | 
|         alert( e); | 
|     } | 
| } | 
|   | 
| var searchSetProductWindow = null; | 
|   | 
| function searchSetProduct(){ | 
|     //openPopup('/apex/SearchSetProduct', 'search', 950, 450, 'width=950,height=450,scrollbars=yes,toolbar=no,status=no,directories=no,menubar=no,resizable=1', true); | 
|     if ( searchSetProductWindow == null || searchSetProductWindow.closed) { | 
|         searchSetProductWindow = window.open('/apex/SearchSetProduct', 'SearchSetProduct', 'width=950,height=450'); | 
|     } | 
|     else { | 
|     searchSetProductWindow.focus(); | 
|     } | 
| } | 
| function searchProduct(i,str){ | 
|     // CNY USDを取得 | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Assert')).attr('readonly',true); | 
| //    var trade = j$(escapeVfId("Page:mainForm:block:CurrencyIsoCode")).value(); | 
| //    openPopup('/apex/SearchProduct?trade=' + trade + '&lineno=' + i + '&val=' + str, 'setsearch', 950, 450, 'width=950,height=450,scrollbars=yes,toolbar=no,status=no,directories=no,menubar=no,resizable=1', true); | 
|     openPopup('/apex/SearchProductIrai?lineno=' + i + '&val=' + str, 'setsearch', 950, 450, 'width=950,height=450,scrollbars=yes,toolbar=no,status=no,directories=no,menubar=no,resizable=1', true); | 
|     //var w = openPopup('/apex/SearchProduct?trade=' + trade + '&lineno=' + i + '&val=' + str, 'search','width=950,height=450'); | 
|     //w.focus(); | 
| } | 
|   | 
| function openQuotePage(b,b2,b3) { | 
|     quoid = b3; | 
|     if (b2 == 'true'){ | 
|   | 
|     }else{ | 
|         if (b=='true'){ | 
|             //openPopup('/apex/contractdetailpdf?id=quoid'); | 
|             window.open('/apex/contractdetailpdf?id=' + quoid,'Contract'); | 
|         } | 
|         else { | 
|             //openPopup('/apex/quotepdf?id=quoid'); | 
|             window.open('/apex/quotepdf?id=' + quoid,'Quote'); | 
|         } | 
|     } | 
| } | 
| jQuery(function() { | 
|   | 
| }); | 
| function reSet(){ | 
| } | 
| function calonLoad(){ | 
|     EstimationListPrice.call(); | 
|     // CHAN-BJQ4VZ 精琢技术 2019/12/10 Start  | 
|      EstimationListPrice2.call(); | 
|      updateNoDiscountPricetotal.call(); | 
|     // CHAN-BJQ4VZ 精琢技术 2019/12/10 End | 
|     calUnitPriceTotal.call(); | 
|     quoteTotalPrice.call(); | 
|     setOCMAmount.call(); | 
|     checkProductStatusValidPeriod(); | 
| } | 
| function number_format() { | 
|     for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|         var a = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Assert')).value(); | 
|         if (a!=''){ | 
|             var x = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPricetext')).text(); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPricetext')).text(toNumComma(x)); | 
|             var y = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPricetext')).text(); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':TotalPrice')).text(toNumComma(y)); | 
|         } | 
|     } | 
| } | 
| function calUnitPriceTotal() { | 
|     j$(escapeVfId( 'ListPriceTotal')).val(0); | 
|     j$(escapeVfId( 'UnitPriceTotal')).val(0); | 
|     var ListPriceTotal = 0.0, listPrice = 0.0; | 
|     var unitPriceTotal = 0.0, unitPrice = 0.0; | 
|     for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|         listPrice = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':ListPrice')).value(); | 
|   | 
|         unitPrice = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':UnitPrice')).value(); | 
|         ListPriceTotal += localParseFloat( listPrice); | 
|         unitPriceTotal += localParseFloat( unitPrice); | 
|     } | 
|     j$(escapeVfId( 'ListPriceTotal')).val(ListPriceTotal); | 
|     j$(escapeVfId( 'UnitPriceTotal')).val(unitPriceTotal); | 
| } | 
| function calPrice(i){ | 
|     var x,y,z,c,d,e; | 
|     x = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Quantity')).value(); | 
|     y = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':UnitPrice')).value(); | 
|     c = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Cost')).value(); | 
|     d = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPrice')).value(); | 
|     // CHAN-BHNBX6 NoDiscount小计 2019/11/20 START | 
|     e = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscount')).value(); | 
|     x = localParseInt( x); | 
|     y = localParseFloat( y); | 
|     c = localParseFloat( c); | 
|     d = localParseFloat( d); | 
|     e = localParseFloat( e); | 
|   | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Quantity')).val(x); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':UnitPrice')).val(toNumComma(y)); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Cost')).val(toNum(c)); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPrice')).val(toNum(d)); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscount')).val(toNum(e)); | 
|   | 
|     z = x * y; | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':TotalPrice')).text(toNumComma(z)); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Subtotal__c')).val(toNum(z)); | 
|   | 
|     z = x * c; | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':CostSubTotal')).val(toNum(z)); | 
|      | 
|     z = x * d; | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPriceTotalText')).text(toNumComma(z)); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPriceTotal')).val(toNum(z)); | 
|   | 
|     z = x * e; | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscountTotalText')).text(toNumComma(z)); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscountTotal')).val(toNum(z)); | 
|     // CHAN-BHNBX6 NoDiscount小计 2019/11/20 END | 
|     EstimationListPrice.call(); | 
|     calUnitPriceTotal.call(); | 
|     quoteTotalPrice.call(); | 
|     // CHAN-BJQ4VZ 精琢技术 2019/12/10 Start  | 
|     updateNoDiscountPricetotal.call(); | 
|     EstimationListPrice2.call(); | 
|     // CHAN-BJQ4VZ 精琢技术 2019/12/10 End | 
| } | 
|   | 
| function calPriceAll(){ | 
|     var x,y,z,c,d,e; | 
|     for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|         x = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Quantity')).value(); | 
|         x = localParseInt( x); | 
|         if ( x > 0){ | 
|             y = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':UnitPrice')).value(); | 
|             c = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Cost')).value(); | 
|             d = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPrice')).value(); | 
|             // CHAN-BHNBX6 NoDiscount小计 2019/11/20 START | 
|             e = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscount')).value(); | 
|             y = localParseFloat( y); | 
|             c = localParseFloat( c); | 
|             d = localParseFloat( d); | 
|             e = localParseFloat( e); | 
|   | 
|             z = x * y; | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':TotalPrice')).text(toNumComma(z)); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Subtotal__c')).val(toNum(z)); | 
|   | 
|             z = x * d; | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPriceTotalText')).text(toNumComma(z)); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPriceTotal')).val(toNum(z)); | 
|   | 
|             z = x * e; | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscountTotalText')).text(toNumComma(z)); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscountTotal')).val(toNum(z)); | 
|             // CHAN-BHNBX6 NoDiscount小计 2019/11/20 END | 
|             z = x * c; | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':CostSubTotal')).val(toNum(z)); | 
|         } | 
|     } | 
|     EstimationListPrice.call(); | 
|     calUnitPriceTotal.call(); | 
|     quoteTotalPrice.call(); | 
|     // CHAN-BJQ4VZ 精琢技术 2019/12/10 Start  | 
|     updateNoDiscountPricetotal.call(); | 
|     EstimationListPrice2.call(); | 
|     // CHAN-BJQ4VZ 精琢技术 2019/12/10 End | 
| } | 
|   | 
| // 计算总计 总额 | 
| function EstimationListPrice() { | 
|     var x,y,z; | 
|     x = 0; | 
|     y = 0; | 
|     z = 0; | 
|     for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|         x = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':ListPrice')).value(); | 
|         y = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':Quantity')).value(); | 
|         x = localParseFloat(x); | 
|         y = localParseFloat(y); | 
|         z = z + (x * y); | 
|     } | 
|   | 
|     j$(escapeVfId('Page:mainForm:block:hidden_Estimation_List')).val(toNum(z)); | 
|     j$(escapeVfId('Page:mainForm:block:Estimation_List_Price')).text(toNumComma(z)); | 
| } | 
| //计算报价总额 | 
| function EstimationListPrice2() { | 
|     var x,y,z,n; | 
|     x = 0; | 
|     y = 0; | 
|     z = 0; | 
|     for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|         x = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':ListPrice')).value(); | 
|         y = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':Quantity')).value(); | 
|         n = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':NoDiscountTotal')).value(); | 
|         x = localParseFloat(x); | 
|         y = localParseFloat(y); | 
|         n = localParseFloat(n); | 
|         z = z + (x * y)+n; | 
|     } | 
|     j$(escapeVfId('Page:mainForm:block:hidden_quoTotalPrice')).val(toNum(z)); | 
|     j$(escapeVfId('Page:mainForm:block:quoTotalPrice')).text(toNumComma(z)); | 
|      | 
| } | 
| //计算产品标准定价总额 | 
| function quoteTotalPrice() { | 
|     var x = 0; | 
|     var y = 0; | 
|     for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|         // x = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':SubtoTal__c')).value(); | 
|         x = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':ListPriceTotal')).value(); | 
|         x = localParseFloat(x); | 
|         y = y + localParseFloat(x); | 
|     } | 
|     j$(escapeVfId('Page:mainForm:block:hidden_Estimation')).val(toNum(y)); | 
|     j$(escapeVfId('Page:mainForm:block:Estimation_Price')).text(toNumComma(y)); | 
|   | 
|     DisCalculation.call(); | 
|     DisAmount.call(); | 
|     QuoteAdjust.call(); | 
|     salesProfit1.call(); | 
|     salesProfit2.call(); | 
|     setCostTatal.call(); | 
| } | 
| function quoteTotalPriceAction() { | 
|     //var t = 0; | 
|     var s = 0; | 
|     var x = 0; | 
|     var y = 0; | 
|     var yy = 0; | 
|     var z = j$(escapeVfId('Page:mainForm:block:quoTotalPrice')).value(); | 
|     var zz = 0; | 
|     z = localParseFloat( z); | 
|     for ( var i=0; i < QuoteEntryMaxLine; i++) { | 
|         x = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':Subtotal__c')).value(); | 
|         x = localParseFloat(x); | 
|         y = y + x; | 
|     } | 
|     //t = z / y; | 
| //alert( "z=" + z + ", y=" + y + ", z / y = " + (z / y)); | 
|   | 
|     for(var i=0; i<QuoteEntryMaxLine;i++){ | 
|         s = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':Quantity')).value(); | 
|         s = localParseInt(s); | 
|         x = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':Subtotal__c')).value(); | 
|         x = localParseFloat(x); | 
|         if ((s==0) || (x==0)){ | 
|             //処理なし | 
|         }else{ | 
|             //yy = Math.round(x * t); | 
| //alert( "x=" + x + ", z=" + z + ", y=" + y); | 
|             yy = localParseFloat(x * z / y); | 
| //alert( "yy=" + yy); | 
|             //if (isNaN(x)==false){ | 
|                 j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':Subtotal__c')).val(toNum(yy)); | 
|                 j$(escapeVfId('Page:mainForm:block:lists:' + i + ':TotalPrice')).text(toNumComma(yy)); | 
|                 j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':UnitPrice')).val(toNumComma(yy / s)); | 
|                 zz = zz + yy; | 
|             //} | 
| //alert( "zz=" + zz); | 
|         } | 
|     } | 
|     j$(escapeVfId('Page:mainForm:block:quoTotalPrice')).val(toNumComma(zz)); | 
|   | 
|     calUnitPriceTotal.call(); | 
|     QuoteAdjust.call(); | 
|     DisCalculation.call(); | 
|     DisAmount.call(); | 
| } | 
| // CHAN-BJQ4VZ 精琢技术 2019/12/11 Start | 
| // 计算 No Discount Price合计 | 
| function updateNoDiscountPricetotal(){ | 
|     var noDiscountPriceTotal = 0; | 
|     for ( var i=0; i < QuoteEntryMaxLine; i++) { | 
|         //行项目 no discount price: | 
|         var  noDiscountPrice  = | 
|         j$(escapeVfId('Page:mainForm:block:lists:'+i+':NoDiscountTotal')).val(); | 
|         noDiscountPrice = localParseFloat( noDiscountPrice ); | 
|         // 数量 | 
|         var Quantity =  | 
|             j$(escapeVfId('Page:mainForm:block:lists:'+i+':Quantity')).value(); | 
|         Quantity = localParseFloat( Quantity ); | 
|         noDiscountPriceTotal = noDiscountPriceTotal +  noDiscountPrice ; | 
|         // var index = j$(escapeVfId('Page:mainForm:block:lists:'+ i + ':indexNo')).text(); | 
|         // if(document.getElementById( 'Page:mainForm:block:lists:'+ i + ':warranty2:NoDiscountTotal') != null | 
|         //     && i + 1 == index){ | 
|         //     document.getElementById( 'Page:mainForm:block:lists:'+ i  | 
|         //         + ':warranty2:NoDiscountTotal').value =  | 
|         //     toNumComma(noDiscountPrice * Quantity); | 
|         } | 
|      | 
|     // 设置多年保修价格合计 | 
|     j$(escapeVfId('Page:mainForm:block:hidden_MultiYearWarrantyTotalPrice_out')).val(noDiscountPriceTotal); | 
|     j$(escapeVfId('Page:mainForm:block:MultiYearWarrantyTotalPrice_out')).text( | 
|         toNumComma(noDiscountPriceTotal)); | 
| } | 
| // CHAN-BJQ4VZ 精琢技术 2019/12/11 End | 
| function calFromQuoAmont() { | 
|     var x = 0, y = 0; | 
|   | 
|     x = j$(escapeVfId('Page:mainForm:block:hidden_Estimation_List')).value(); | 
|     x = localParseFloat(x); | 
|   | 
|     y = j$(escapeVfId('Page:mainForm:block:QuoAmount')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:QuoAmount')).val(toNumComma(y)); | 
|     y = localParseFloat(y); | 
|   | 
|     j$(escapeVfId('Page:mainForm:block:quoTotalPrice')).val(toNumComma( y + x)); | 
|     if (y == 0) { | 
|         j$(escapeVfId('Page:mainForm:block:QuoCalculation')).val(0); | 
|         UnitPriceUpdate.call(); | 
|     } else { | 
|         quoteTotalPriceAction.call(); | 
|     } | 
| } | 
| function calFromContactPrice() { | 
|     var x = 0; | 
|     x = j$(escapeVfId('Page:mainForm:block:Dealer_Final_Price')).value(); | 
|     x = localParseFloat( x); | 
|     j$(escapeVfId('Page:mainForm:block:Dealer_Final_Price')).val(toNumComma(x)); | 
|   | 
|     //quoteTotalPrice.call(); | 
|     DisCalculation.call(); | 
|     DisAmount.call(); | 
|     salesProfit1.call(); | 
|     salesProfit2.call(); | 
|     setCostTatal.call(); | 
| } | 
| function radioChecker2(str){ | 
|     j$(escapeVfId("Page:mainForm:block:Btn_RowDelete")).attr("disabled", true); | 
|     j$(escapeVfId("Page:mainForm:block:Btn_RowUp")).attr("disabled", true); | 
|     j$(escapeVfId("Page:mainForm:block:Btn_RowDown")).attr("disabled", true); | 
|   | 
|     //error初期化 | 
|     replaceErrorClass.call(); | 
|     var lastLineNoNext = getLastLineNoNext(document); | 
|     try { | 
|         var hasCheckedCnt = 0; | 
|         for(var i=0; i<lastLineNoNext; i++){ | 
|             var iChecked = document.forms['Page:mainForm']['checklist'][i].checked; | 
|             if (iChecked) { | 
|                 hasCheckedCnt++; | 
|                 if (hasCheckedCnt > 1) { | 
|                     // 複数件チェックされているか、わかればbreak; | 
|                     break; | 
|                 } | 
|             } | 
|         } | 
|         if (hasCheckedCnt == 0) { | 
|             throw Error_Message34; | 
|         } | 
|          | 
|         var hasCheckedCnt1 = 0;                      // 実際変更できた件数 | 
|         if (str=='up'){ | 
|             for(var i=0; i<lastLineNoNext; i++){ | 
|                 var iChecked = document.forms['Page:mainForm']['checklist'][i].checked; | 
|                 if (!iChecked) { continue; } | 
|                 if (i==0){ | 
|                     throw Error_Message35; | 
|                 } else { | 
|                     if (setlists(str,i)) { | 
|                         hasCheckedCnt1++; | 
|                     } else { | 
|                         if (hasCheckedCnt1 == 0) { | 
|                             // 移動できない | 
|                             throw Error_Message35; | 
|                         } | 
|                     } | 
|                 } | 
|             } | 
|         }else if(str=='down'){ | 
|             for(var i=lastLineNoNext-1; i>=0; i--){ | 
|                 var iChecked = document.forms['Page:mainForm']['checklist'][i].checked; | 
|                 if (!iChecked) { continue; } | 
|                 if (i==149 && iChecked){ | 
|                     throw Error_Message36; | 
|                 }else{ | 
|                     if (setlists(str,i)) { | 
|                         hasCheckedCnt1++; | 
|                     } else { | 
|                         if (hasCheckedCnt1 == 0) { | 
|                             // 移動できない | 
|                             throw Error_Message36; | 
|                         } | 
|                     } | 
|                 } | 
|             } | 
|         }else if(str=='del'){ | 
|             for(var i=lastLineNoNext-1; i>=0; i--){ | 
|                 var iChecked = document.forms['Page:mainForm']['checklist'][i].checked; | 
|                 if (iChecked) { | 
|                     hasCheckedCnt1++; | 
|                     deletelist(i, document); | 
|                 } | 
|             } | 
|         }else{ | 
|             throw 'Unknow Operation'; | 
|         } | 
|         if (hasCheckedCnt1 > 0) { | 
|             if (str=='del'){ | 
|                 calPriceAll.call(); | 
|             } | 
|         } | 
|         if (str=='del') { | 
|             // 複数選択して削除した場合、削除後チェックを外す | 
|             if (hasCheckedCnt > 1) { | 
|                 for(var i = 0; i < lastLineNoNext; i++) { | 
|                     document.forms['Page:mainForm']['checklist'][i].checked = false; | 
|                 } | 
|             } else { | 
|                 // lastLineNoNextの行も外す | 
|                 document.forms['Page:mainForm']['checklist'][lastLineNoNext - 1].checked = false; | 
|             } | 
|         } | 
|     } catch(e) { | 
|         alert(e); | 
|     } | 
|     document.getElementById("Page:mainForm:block:Btn_RowDelete").disabled = false; | 
|     document.getElementById("Page:mainForm:block:Btn_RowUp").disabled = false; | 
|     document.getElementById("Page:mainForm:block:Btn_RowDown").disabled = false; | 
|     return true; | 
| } | 
| function productCompare(){ | 
|   | 
|     try{ | 
|   | 
|         sforce.connection.sessionId = Session_ID; | 
|         var b = true; | 
|         var t = j$(escapeVfId('Page:mainForm:block:Trade')).value(); | 
|         var ids = new Array(); | 
|         for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|             var id = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Id')).value(); | 
|             if (id != ''){ | 
|                 ids.push(j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Id')).value()); | 
|             } | 
|         } | 
|          | 
|         var results = sforce.apex.execute("NewQuoteEntryWebService","getProduct2",{id:ids}); | 
|         var id2Product = new Object(); | 
|         for(var j=0; j<results.length; j++){ | 
|             id2Product[results[j].Id] = results[j]; | 
|         } | 
|          | 
|         for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|             var a = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Id')).value(); | 
|             if (a != ''){ | 
|                 if (t=='外貿'){ | 
|                     var recordTypeRecord = id2Product[a]; | 
|                     var y1 = recordTypeRecord.Name; | 
|                     var y2 = recordTypeRecord.Foreign_Trade_List_US__c; | 
|                     var y3 = recordTypeRecord.Foreign_Trade_Cost_US__c; | 
|                 }else{ | 
|                     var recordTypeRecord = id2Product[a]; | 
|                     var y1 = recordTypeRecord.Name; | 
|                     var y2 = recordTypeRecord.Intra_Trade_List_RMB__c; | 
|                     var y3 = recordTypeRecord.Intra_Trade_Cost_RMB__c; | 
|                 } | 
|                 var y4 = recordTypeRecord.SFDA_Status__c; | 
|                  | 
|                 var x1 = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Name__c')).value(); | 
|                 var x2 = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPrice')).value(); | 
|                 var x3 = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Cost')).value(); | 
|                 var x4 = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':SFDA')).value(); | 
|   | 
|                 //連続半角スペース対応 | 
|                 y1 = y1.replace(/\s+/g," "); | 
|                 // FIXME katsu localParseFloat | 
|                 x2 = localParseFloat( x2); | 
|                 x3 = localParseFloat( x3); | 
|                 y2 = localParseFloat( y2); | 
|                 y3 = localParseFloat( y3); | 
|                 if ((x1==y1) && (x2==y2) && (x3==y3) && (x4==y4)){ | 
|   | 
|                 }else{ | 
|                     b=false; | 
|                 } | 
|   | 
| //                j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Name')).val(recordTypeRecord[0].Name); | 
|                 j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Name')).val(recordTypeRecord.Name); | 
|                 j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_ListPrice')).val(y2); | 
|                 j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Cost')).val(y3); | 
|                 j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_SFDA')).val(y4); | 
|   | 
|             } | 
|         } | 
|         if (b == false){ | 
|             if(window.confirm(Message_001)){ | 
|                 PriceStatusUpdate.call(); | 
|                 blockme(); | 
|                 j$(escapeVfId('Page:mainForm:productStatusUpdated')).val('true'); | 
|                 return true; | 
|             }else{ | 
|                 return false; | 
|             } | 
|         }else{ | 
|             alert("价格状态没有变化。"); | 
|             j$(escapeVfId('Page:mainForm:productStatusUpdated')).val('true'); | 
|             return false; | 
|         } | 
|     } | 
|     catch(e){ | 
|         alert(e); | 
|     } | 
|   | 
| } | 
| function addFigure(str) { | 
|     var num = new String(str).replace(/,/g, ""); | 
|     while(num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2"))); | 
|     return num; | 
| } | 
| function UnitPriceUpdate() { | 
|   | 
|     var num; | 
|     num = j$(escapeVfId('Page:mainForm:block:QuoCalculation')).value(); | 
|     num = localParseFloat( num); | 
|     j$(escapeVfId('Page:mainForm:block:QuoCalculation')).val(toNumComma(num)); | 
|   | 
|     num = (100 + num) / 100; | 
|   | 
|     var price = 0; | 
|     for ( var i = 0 ; i < QuoteEntryMaxLine; i++) { | 
|         price = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPrice')).value(); | 
|         price = localParseFloat( price); | 
|         if (price != ''){ | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':UnitPrice')).val(toNumComma(price * num)); | 
|         } | 
|     } | 
|   | 
|     Subtotalupdate.call(); | 
|     calUnitPriceTotal.call(); | 
|     quoteTotalPrice.call(); | 
| } | 
| function Subtotalupdate(){ | 
|    var x,y,z; | 
|     z=0; | 
|     for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|         x = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Quantity')).value(); | 
|         x = localParseInt( x); | 
|         y = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':UnitPrice')).value(); | 
|         y = localParseFloat( y); | 
|         z = x * y; | 
|         if ( j$(escapeVfId('Page:mainForm:block:lists:' + i + ':UnitPrice')).value() != "") { | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':TotalPrice')).text(toNumComma(z)); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Subtotal__c')).val(toNum(z)); | 
|         } | 
|     } | 
| } | 
| function getId1() { | 
|     var s = j$(escapeVfId('Page:mainForm:block:SalesName1')).value(); | 
|     if ((s!=null) && (s!='')){ | 
|         var x = j$(escapeVfId('Page:mainForm:block:SalesName1_lkid')).value(); | 
|         getSalesId1.call(x,x); | 
|     }else{ | 
|         j$(escapeVfId('Page:mainForm:block:SalesShopClass1')).text(''); | 
|         //j$(escapeVfId('Page:mainForm:block:SalesAmount1')).val(''); | 
|         //j$(escapeVfId('Page:mainForm:block:Salesprofit1')).text(''); | 
|         //j$(escapeVfId('Page:mainForm:block:SalesCalculation1')).text(''); | 
|     } | 
| } | 
| function getId2() { | 
|     var s = j$(escapeVfId('Page:mainForm:block:SalesName2')).value(); | 
|     if ((s!=null) && (s!='')){ | 
|         var x = j$(escapeVfId('Page:mainForm:block:SalesName2_lkid')).value(); | 
|         getSalesId2.call(x,x); | 
|     }else{ | 
|         j$(escapeVfId('Page:mainForm:block:SalesShopClass2')).text(''); | 
|         //j$(escapeVfId('Page:mainForm:block:SalesAmount2')).val(''); | 
|         //j$(escapeVfId('Page:mainForm:block:Salesprofit2')).text(''); | 
|         //j$(escapeVfId('Page:mainForm:block:SalesCalculation2')).text(''); | 
|     } | 
| } | 
| function DisCalculation() { | 
|     var x = j$(escapeVfId('Page:mainForm:block:hidden_DisAmountvalue')).value(); | 
|     x = localParseFloat( x); | 
|   | 
|     var y = j$(escapeVfId('Page:mainForm:block:quoTotalPrice')).value(); | 
|     y = localParseFloat( y); | 
|   | 
|   | 
|     if ((y==0)){ | 
|         j$(escapeVfId('Page:mainForm:block:DisCalculationvalue')).val(''); | 
|         j$(escapeVfId('Page:mainForm:block:DisCalculation')).text(''); | 
|     }else{ | 
|         var z = 0; | 
|         z = x / y * 100; | 
|         z = z.toFixed(2); | 
|   | 
|         j$(escapeVfId('Page:mainForm:block:DisCalculationvalue')).val(toNum(z)); | 
|         j$(escapeVfId('Page:mainForm:block:DisCalculation')).text(toNumComma(z)); | 
|     } | 
| } | 
| function DisAmount() { | 
|     var x = j$(escapeVfId('Page:mainForm:block:quoTotalPrice')).value(); | 
|     x = localParseFloat( x); | 
|   | 
|     var y = j$(escapeVfId('Page:mainForm:block:Dealer_Final_Price')).value(); | 
|     y = localParseFloat( y); | 
|   | 
|    j$(escapeVfId('Page:mainForm:block:hidden_DisAmountvalue')).val(toNum( x - y)); | 
|    j$(escapeVfId('Page:mainForm:block:DisAmount')).text(toNumComma( x - y)); | 
|    DisCalculation.call(); | 
| } | 
| function QuoteAdjust() { | 
|     var x = j$(escapeVfId('Page:mainForm:block:quoTotalPrice')).value(); | 
|     x = localParseFloat( x); | 
|     var y = j$(escapeVfId('Page:mainForm:block:hidden_Estimation_List')).value(); | 
|     y = localParseFloat( y); | 
|   | 
|     var z = j$(escapeVfId( 'ListPriceTotal')).value(); | 
|     z = localParseFloat( z); | 
|   | 
|     var zz = j$(escapeVfId( 'UnitPriceTotal')).value(); | 
|     zz = localParseFloat( zz); | 
|   | 
| //alert( "x(見積金額合計)=" + x + ", y(標準定価合計)=" + y + ", z(ListPrice合計)=" + z + ", zz=(現在単価合計)=" + zz); | 
|     j$(escapeVfId('Page:mainForm:block:QuoAmount')).val(toNumComma( x - y)); | 
|     if( z == 0){ | 
|         //TODO QuoCalculationでgrepして、toNumComma->toNum | 
|         j$(escapeVfId('Page:mainForm:block:QuoCalculation')).val(toNumComma(0)); | 
|     }else{ | 
|         //var tnum =  (zz - z) / z *100 ; | 
|         //j$(escapeVfId('Page:mainForm:block:QuoCalculation')).val(Math.floor(tnum * 100) / 100); | 
|   | 
|         j$(escapeVfId('Page:mainForm:block:QuoCalculation')).val(toNumComma((zz - z) / z *100)); | 
|     } | 
| } | 
|   | 
| function salesProfit1() { | 
|     var x = j$(escapeVfId('Page:mainForm:block:Dealer_Final_Price')).value(); | 
|     var y = j$(escapeVfId('Page:mainForm:block:SalesAmount1')).value(); | 
|     y = y.replace(/ /g, ""); | 
|   | 
|     if ( y.length == 0) { | 
|         var z = j$(escapeVfId('Page:mainForm:block:SalesAmount2')).value(); | 
|         z = z.replace(/ /g, ""); | 
|         if ( z.length == 0) { | 
|             j$(escapeVfId('Page:mainForm:block:SalesAmount1')).val(''); | 
|             j$(escapeVfId('Page:mainForm:block:Salesprofit1value')).val(''); | 
|             j$(escapeVfId('Page:mainForm:block:Salesprofit1')).text(''); | 
|         }else { | 
|             j$(escapeVfId('Page:mainForm:block:SalesAmount1')).val(toNumComma(0)); | 
|             j$(escapeVfId('Page:mainForm:block:Salesprofit1value')).val(toNum(0)); | 
|             j$(escapeVfId('Page:mainForm:block:Salesprofit1')).text(toNumComma(0)); | 
|         } | 
|     }else{ | 
|         j$(escapeVfId('Page:mainForm:block:SalesAmount1')).val(toNumComma(y)); | 
|         x = localParseFloat( x); | 
|         y = localParseFloat( y); | 
|         var t = j$(escapeVfId('Page:mainForm:block:SalesAmount2')).value(); | 
|         if ( t.length == 0) { | 
|             j$(escapeVfId('Page:mainForm:block:Salesprofit1value')).val(toNum(x - y)); | 
|             j$(escapeVfId('Page:mainForm:block:Salesprofit1')).text(toNumComma(x - y)); | 
|         }else{ | 
|             t = localParseFloat( t); | 
|             j$(escapeVfId('Page:mainForm:block:Salesprofit1value')).val(toNum(t - y)); | 
|             j$(escapeVfId('Page:mainForm:block:Salesprofit1')).text(toNumComma(t - y)); | 
|         } | 
|     } | 
|     salesCalculation1.call(); | 
| } | 
|   | 
| function salesProfit2() { | 
|   | 
|     var x = j$(escapeVfId('Page:mainForm:block:Dealer_Final_Price')).value(); | 
|     var y = j$(escapeVfId('Page:mainForm:block:SalesAmount2')).value(); | 
|     y = y.replace(/ /g, ""); | 
|   | 
|     if ( y.length == 0) { | 
|         j$(escapeVfId('Page:mainForm:block:SalesAmount2')).val(''); | 
|         j$(escapeVfId('Page:mainForm:block:Salesprofit2value')).val(''); | 
|         j$(escapeVfId('Page:mainForm:block:Salesprofit2')).text(''); | 
|     } | 
|     else { | 
|         x = localParseFloat( x); | 
|         y = localParseFloat( y); | 
|         j$(escapeVfId('Page:mainForm:block:SalesAmount2')).val(toNumComma(y)); | 
|         j$(escapeVfId('Page:mainForm:block:Salesprofit2value')).val(toNum(x - y)); | 
|         j$(escapeVfId('Page:mainForm:block:Salesprofit2')).text(toNumComma(x - y)); | 
|     } | 
|   | 
|     salesCalculation2.call(); | 
|     salesProfit1(); | 
|   | 
| } | 
|   | 
| function salesCalculation1() { | 
|   | 
|     var w = j$(escapeVfId('Page:mainForm:block:SalesAmount1')).value(); | 
|     w = w.replace(/ /g, ''); | 
|     var x = j$(escapeVfId('Page:mainForm:block:Salesprofit1value')).value(); | 
|     var y = j$(escapeVfId('Page:mainForm:block:Dealer_Final_Price')).value(); | 
|     var z = j$(escapeVfId('Page:mainForm:block:SalesAmount2')).value(); | 
|     z = z.replace(/ /g, ''); | 
|   | 
|     if ( w.length == 0) { | 
|         j$(escapeVfId('Page:mainForm:block:SalesCalculation1value')).val(''); | 
|         j$(escapeVfId('Page:mainForm:block:SalesCalculation1')).text(''); | 
|     } | 
|     else { | 
|         x = localParseFloat( x); | 
|         var t = 0; | 
|         if ( z.length == 0) { | 
|             y = localParseFloat( y); | 
|             t = x / y * 100; | 
|         } | 
|         else { | 
|             z = localParseFloat( z); | 
|             t = x / z * 100; | 
|         } | 
|         j$(escapeVfId('Page:mainForm:block:SalesCalculation1value')).val(toNum(t)); | 
|         j$(escapeVfId('Page:mainForm:block:SalesCalculation1')).text(toNumComma(t)); | 
|     } | 
|   | 
| } | 
|   | 
| function salesCalculation2() { | 
|   | 
|     var w = j$(escapeVfId('Page:mainForm:block:SalesAmount2')).value(); | 
|     w = w.replace(/ /g, ''); | 
|     var x = j$(escapeVfId('Page:mainForm:block:Salesprofit2value')).value(); | 
|     var y = j$(escapeVfId('Page:mainForm:block:Dealer_Final_Price')).value(); | 
|   | 
|     if ( w.length == 0) { | 
|         j$(escapeVfId('Page:mainForm:block:SalesCalculation2value')).val(''); | 
|         j$(escapeVfId('Page:mainForm:block:SalesCalculation2')).text(''); | 
|     } | 
|     else { | 
|         x = localParseFloat( x); | 
|         y = localParseFloat( y); | 
|         if((y==0)){ | 
|             j$(escapeVfId('Page:mainForm:block:SalesCalculation2value')).val(toNum(0)); | 
|             j$(escapeVfId('Page:mainForm:block:SalesCalculation2')).text(toNumComma(0)); | 
|         }else{ | 
|             var z = x / y * 100; | 
|             j$(escapeVfId('Page:mainForm:block:SalesCalculation2value')).val(toNum(z)); | 
|             j$(escapeVfId('Page:mainForm:block:SalesCalculation2')).text(toNumComma(z)); | 
|         } | 
|     } | 
| } | 
| function setlistFocus(i){ | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Quantity')).focus(); | 
| } | 
| function setCostTatal(){ | 
|     var z = 0; | 
|      | 
|     for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|         var s = 0; | 
|         s = eval(j$(escapeVfId('Page:mainForm:block:lists:' + i + ':CostSubTotal')).value()); | 
|         if (isNaN(s)==false){ | 
|             z = z + s; | 
|         } | 
|     } | 
|     j$(escapeVfId('Page:mainForm:block:hidden_Stocking_Price')).val(toNum(z)); | 
|     if (displayCost == 'true') { | 
|         j$(escapeVfId('Page:mainForm:block:Stocking_Price')).text(toNumComma(z)); | 
|     } | 
| } | 
| function setOCMAmount(){ | 
|     var s,t; | 
|     s = j$(escapeVfId('Page:mainForm:block:SalesRoot_Flg')).value(); | 
|     if (s=='true'){ | 
|         t = j$(escapeVfId('Page:mainForm:block:SalesAmount1')).value(); | 
|     }else{ | 
|         t = j$(escapeVfId('Page:mainForm:block:Dealer_Final_Price')).value(); | 
|     } | 
|     t = localParseFloat( t); | 
|     j$(escapeVfId('Page:mainForm:block:hidden_Wholesale_Price')).val(toNum(t)); | 
|     j$(escapeVfId('Page:mainForm:block:Wholesale_Price')).text(toNumComma(t)); | 
| } | 
|   | 
| function decision2btn(){ | 
|     checkchangedAfterPrint(); | 
|     var changedAfterPrint = j$(escapeVfId('Page:mainForm:changedAfterPrint')).value(); | 
|     if (changedAfterPrint == 'true') { | 
|         if (confirm(Confirm_ChangedAfterPrint)) { | 
|             return chkSalesPossibilityDecision(); | 
|         } | 
|     } else { | 
|         return chkSalesPossibilityDecision(); | 
|     } | 
| } | 
| function chkSalesPossibilityDecision(){ | 
|     try{ | 
|         sforce.connection.sessionId = Session_ID; | 
|         var b = true; | 
|         var ids = new Array();         | 
|         for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|             var id = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Id')).value(); | 
|             if (id != ''){ | 
|                 ids.push(id); | 
|             } | 
|         } | 
|          | 
|         var results = sforce.apex.execute("NewQuoteEntryWebService","getProduct2",{id:ids}); | 
|         var id2Product = new Object(); | 
|         for(var j=0; j<results.length; j++){ | 
|             id2Product[results[j].Id] = results[j]; | 
|         } | 
|          | 
|         for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|             var a = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Id')).value(); | 
|             if (a != ''){ | 
|                 var recordTypeRecord = id2Product[a]; | 
|                 var x = recordTypeRecord.Sales_Possibility__c; | 
|                 if (x == '△'){ | 
|                     b = false; | 
|                 } | 
|             } | 
|         } | 
|         if (b == false){ | 
|             if(window.confirm(Error_Message11)){ | 
|                 QuoteDecision.call(); | 
|                 blockme(); | 
|                 return true; | 
|             }else{ | 
|                 return false; | 
|             } | 
|         }else{ | 
|             QuoteDecision.call(); | 
|             blockme(); | 
|             return true;                // by katsu なぜ return false? return true に変更した! | 
|   | 
|         } | 
|     } | 
|     catch(e){ | 
|         alert(e); | 
|     } | 
| } | 
|   | 
| // 読んだ後にchangedAfterPrintに値がセットされます。 | 
| // 処理ない場合、途中returnしています。 | 
| function checkchangedAfterPrint() { | 
|     sforce.connection.sessionId = Session_ID; | 
|   | 
|     // 明細変更があるかの比較 | 
|     var id = document.getElementById( 'Page:mainForm:hiddenQuoid').innerHTML; | 
|     j$(escapeVfId('Page:mainForm:changedAfterPrint')).val('false'); | 
|     var changedAfterPrint = 'false'; | 
|     if (id==null || id==''){ | 
|         return; | 
|     } | 
|     var activities = []; | 
|     for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|         var lineId = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':PricebookEntryId')).value(); | 
|         if (lineId != ''){ | 
|             var item = new Object(); | 
|             item.PricebookEntryId = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':PricebookEntryId')).value(); | 
|             item.SFDA_Status__c = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':SFDA')).value(); | 
|             item.UnitPrice__c = localParseFloat(j$(escapeVfId('Page:mainForm:block:lists:' + i + ':UnitPrice')).value()); | 
|             item.ListPrice__c = localParseFloat(j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPrice')).value()); | 
|             item.Quantity = localParseInt(j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Quantity')).value()); | 
|             // item.GuaranteePeriod = localParseInt(j$(escapeVfId('Page:mainForm:block:lists:' + i + ':itemGuaranteePeriod')).value()); | 
|             activities.push(item); | 
|         } | 
|     } | 
|     var results = sforce.apex.execute("NewQuoteEntryWebService","getQuoteLineItem",{quoId:id}); | 
|     var quote_Date__c = null; | 
|     if (results.length > 0) {     | 
|         quote_Date__c = results[0]['Quote']['Quote_Date__c']; | 
|         if(!quote_Date__c) { | 
|             return; | 
|         } | 
|     } else { | 
|         return; | 
|     } | 
|     if (changedAfterPrint == 'false') { | 
|         if (activities.length != results.length) { | 
|             changedAfterPrint = 'true'; | 
|         } | 
|     } | 
|     if (changedAfterPrint == 'false') { | 
|         for(var j=0; j<results.length; j++){ | 
|             if (results[j].PricebookEntryId != activities[j].PricebookEntryId | 
|                 || results[j].SFDA_Status__c != activities[j].SFDA_Status__c | 
|                 || results[j].UnitPrice__c != activities[j].UnitPrice__c | 
|                 || results[j].ListPrice__c != activities[j].ListPrice__c | 
|                 || results[j].Quantity != activities[j].Quantity | 
|             ) { | 
|                 changedAfterPrint = 'true'; | 
|                 break; | 
|             } | 
|         } | 
|     } | 
|     j$(escapeVfId('Page:mainForm:changedAfterPrint')).val(changedAfterPrint); | 
|     return; | 
| } | 
|   | 
| // 90日以上更新してないとfalse | 
| function checkProductStatusValidPeriod() { | 
|     var period = j$(escapeVfId('Page:mainForm:block:hidden_PriceRefreshPeriod')).value(); | 
|     if (parseInt(period) > parseInt(Price_Valid_Period)) { | 
|         if (confirm(Confirm_PriceRefresh)) { | 
|             productCompare(); | 
|             return true; | 
|         } else { | 
|             return false; | 
|         } | 
|     } | 
|     return true; | 
| } | 
|   | 
| function print2btn() { | 
|     var id = document.getElementById( 'Page:mainForm:hiddenQuoid').innerHTML; | 
|   | 
|     if (id==null || id==''){ | 
|         alert(Error_Message33); | 
|         unblockUI(); | 
|         return false; | 
|     } | 
|      | 
|     if (checkProductStatusValidPeriod() == false) { | 
|         unblockUI(); | 
|         return false; | 
|     } | 
|     checkchangedAfterPrint(); | 
|     var changedAfterPrint = j$(escapeVfId('Page:mainForm:changedAfterPrint')).value(); | 
|     if (changedAfterPrint == 'true') { | 
|         if (confirm(Confirm_ChangedAfterPrint)) { | 
|             return chkEstimation_Entry_Possibility(id); | 
|         } | 
|     } else { | 
|         return chkEstimation_Entry_Possibility(id); | 
|     } | 
| } | 
| function chkEstimation_Entry_Possibility(q){ | 
|     var id = q; | 
|   | 
|     if (id==null || id==''){ | 
|         alert(Error_Message33); | 
|         unblockUI(); | 
|         return false; | 
|     } | 
|   | 
|   | 
|     try{ | 
|         sforce.connection.sessionId = Session_ID; | 
|         var b = true; | 
|         var ids = new Array(); | 
|          | 
|         for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|             var id = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Id')).value(); | 
|             if (id != ''){ | 
|                 ids.push(j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Id')).value()); | 
|             } | 
|         } | 
|          | 
|         var results = sforce.apex.execute("NewQuoteEntryWebService","getProduct2",{id:ids}); | 
|         var id2Product = new Object(); | 
|         for(var j=0; j<results.length; j++){ | 
|             id2Product[results[j].Id] = results[j]; | 
|         } | 
|          | 
|         for(var i=0; i<QuoteEntryMaxLine; i++){ | 
|             var a = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Id')).value(); | 
|             if (a != ''){ | 
|   | 
|                 var recordTypeRecord = id2Product[a]; | 
|                 var x = recordTypeRecord.Estimation_Entry_Possibility__c; | 
|                  | 
|                 if (x==null || x != '○'){ | 
|   | 
|                     b = false; | 
|                 } | 
|             } | 
|         } | 
|         if (b == false){ | 
|             alert(Error_Message29); | 
|             return false; | 
|   | 
|         }else{ | 
|             blockme(); | 
|             Print.call(); | 
|             return true; | 
|         } | 
|     } | 
|     catch(e){ | 
|         alert(e); | 
|     } | 
| } | 
| function save2btn() { | 
|     checkchangedAfterPrint(); | 
|     var changedAfterPrint = j$(escapeVfId('Page:mainForm:changedAfterPrint')).value(); | 
|     if (changedAfterPrint == 'true') { | 
|         if (confirm(Confirm_ChangedAfterPrint)) { | 
|             Save.call(); | 
|             return true; | 
|         } else { | 
|             unblockUI(); | 
|         } | 
|     } else { | 
|         var username = j$(escapeVfId("Page:mainForm:block:IraiUser")).val(); | 
|         var userid = j$(escapeVfId("Page:mainForm:block:IraiUser_lkid")).val(); | 
|         if (userid != null && userid != '000000000000000' && userid.length > 0) { | 
|             if (confirm(Confirm_saveBtn)) { | 
|                 Save.call(); | 
|                 return true; | 
|             } else { | 
|                 unblockUI(); | 
|             } | 
|         } else if(username == null || username == '' || username.length == 0) { | 
|             Save.call(); | 
|             return true; | 
|         } else { | 
|             unblockUI(); | 
|         } | 
|     } | 
| } | 
| function oppReflection2btn() { | 
|     checkchangedAfterPrint(); | 
|     var changedAfterPrint = j$(escapeVfId('Page:mainForm:changedAfterPrint')).value(); | 
|     if (changedAfterPrint == 'true') { | 
|         if (confirm(Confirm_ChangedAfterPrint)) { | 
|             blockme(); | 
|             OppReflection.call(); | 
|             return true; | 
|         } | 
|     } else { | 
|         blockme();   | 
|         OppReflection.call(); | 
|         return true; | 
|     } | 
| } | 
| function replaceErrorClass(){ | 
|   | 
|     var div=document.getElementsByTagName('div'); | 
|     for(var e in div){ | 
|         if(div[e].className=='errorMsg'){ | 
|             div[e].className = 'dataCell'; | 
|             //div[e].innerHTML=div[e].innerHTML.replace(/Error_Message40/g,''); | 
|             div[e].innerHTML=div[e].innerHTML.replace(Error_Message40,''); | 
|             //div[e].innerHTML=div[e].innerHTML.replace(/Error_Message3/g,''); | 
|             div[e].innerHTML=div[e].innerHTML.replace(Error_Message3,''); | 
|         } | 
|     } | 
|     var input=document.getElementsByTagName('input'); | 
|     for(var i in input){ | 
|         if(input[i].className=='error'){ | 
|             input[i].className = 'dataCell'; | 
|         } | 
|     } | 
|   | 
| } | 
| function setlists(str, i){ | 
|   | 
|     var iChecked = document.forms['Page:mainForm']['checklist'][i].checked; | 
|     if (!iChecked) { | 
|         return false; | 
|     } | 
|     var j = 0; | 
|     if (str=='up'){ | 
|         //up | 
|         j = parseInt(i) - 1; | 
|         var b = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Assert')).value(); | 
|         if (b==null || b==''){ | 
|             return false; | 
|         } | 
|     }else{ | 
|         //down | 
|         j = parseInt(i) + 1; | 
|         var b = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Assert')).value(); | 
|         if (b==null || b==''){ | 
|             return false; | 
|         } | 
|     } | 
|     var jChecked = j$(escapeVfId('checklist')[j]).checked; | 
|     //var jChecked = document.forms['Page:mainForm']['checklist'][j].checked; | 
|     //製品番号 | 
|     var assetdown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Assert')).value(); | 
|     var assetup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Assert')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Assert')).val(assetup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Assert')).val(assetdown); | 
|     //SFDAステータス | 
|     var sfdadown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Status__c')).text(); | 
|     var sfdaup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Status__c')).text(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Status__c')).text(sfdaup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Status__c')).text(sfdadown); | 
|     //SFDA | 
|     var sfdadown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':SFDA')).value(); | 
|     var sfdaup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':SFDA')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':SFDA')).val(sfdaup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':SFDA')).val(sfdadown); | 
|     //Id | 
|     var iddown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_Id')).value(); | 
|     var idup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Id')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_Id')).val(idup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Id')).val(iddown); | 
|     //品目名 | 
|     var namedown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Name__c')).value(); | 
|     var nameup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Name__c')).value(); | 
|     var nameLinkdown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NameLink')).html(); | 
|     var nameLinkup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NameLink')).html(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Name__c')).val(nameup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NameLink')).html(nameLinkup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Name__c')).val(namedown); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NameLink')).html(nameLinkdown); | 
|     //ListPrice | 
|     var lpdown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':ListPrice')).value(); | 
|     var lpup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPrice')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':ListPrice')).val(lpup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':ListPricetext')).text(toNumComma(lpup)); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPrice')).val(lpdown); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPricetext')).text(toNumComma(lpdown)); | 
|     //数量 | 
|     var Quantitydown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Quantity')).value(); | 
|     var Quantityup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Quantity')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Quantity')).val(Quantityup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Quantity')).val(Quantitydown); | 
|   | 
|     // CHAN-BHNBX6 保修年限 2019/11/20 START | 
|     var GuaranteePerioddown =j$(escapeVfId('Page:mainForm:block:lists:' + j + ':itemGuaranteePeriod')).value(); | 
|     var GuaranteePeriodup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':itemGuaranteePeriod')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':itemGuaranteePeriod')).text(GuaranteePeriodup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':itemGuaranteePeriod')).text(GuaranteePerioddown); | 
|     // CHAN-BHNBX6 保修年限 2019/11/20 END | 
|     //価格 | 
|     var UnitPricedown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':UnitPrice')).value(); | 
|     var UnitPriceup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':UnitPrice')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':UnitPrice')).val(UnitPriceup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':UnitPrice')).val(UnitPricedown); | 
|     //単位 | 
|     //var Qtydown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Qty_Unit')).value(); | 
|     //var Qtyup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Qty_Unit')).value(); | 
|     //j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Qty_Unit')).val(Qtyup); | 
|     //j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Qty')).text(Qtyup); | 
|     //j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Qty_Unit')).val(Qtydown); | 
|     //j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Qty')).text(Qtydown); | 
|     //小計lw | 
|     var ListPriceTotaldown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':ListPriceTotal')).value(); | 
|     var ListPriceTotalup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPriceTotal')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':ListPriceTotal')).val(ListPriceTotalup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':ListPriceTotalText')).text(toNumComma(ListPriceTotalup)); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPriceTotal')).val(ListPriceTotaldown); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPriceTotalText')).text(toNumComma(ListPriceTotaldown)); | 
|      | 
|     // CHAN-BHNBX6 NoDiscount 2019/11/20 START | 
|     var nddown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NoDiscount')).value(); | 
|     var ndup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscount')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NoDiscount')).val(ndup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscount')).val(nddown); | 
|   | 
|     var NoDiscountTotaldown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NoDiscountTotal')).value(); | 
|     var NoDiscountTotalup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscountTotal')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NoDiscountTotal')).val(NoDiscountTotalup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NoDiscountTotalText')).text(toNumComma(NoDiscountTotalup)); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscountTotal')).val(NoDiscountTotaldown); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscountTotalText')).text(toNumComma(NoDiscountTotaldown)); | 
|     // CHAN-BHNBX6 NoDiscount 2019/11/20 END | 
|     //小計 | 
|     var Subtotaldown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Subtotal__c')).value(); | 
|     var Subtotalup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Subtotal__c')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Subtotal__c')).val(Subtotalup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':TotalPrice')).text(toNumComma(Subtotalup)); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Subtotal__c')).val(Subtotaldown); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':TotalPrice')).text(toNumComma(Subtotaldown)); | 
|     //Product_SFDA | 
|     var Product_SFDAdown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_SFDA')).value(); | 
|     var Product_SFDAup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_SFDA')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_SFDA')).val(Product_SFDAup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_SFDA')).val(Product_SFDAdown); | 
|     //NameCode | 
|     var NameCodedown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NameCode')).value(); | 
|     var NameCodeup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NameCode')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NameCode')).val(NameCodeup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NameCode')).val(NameCodedown); | 
|     //Product_Name | 
|     var Product_Namedown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_Name')).value(); | 
|     var Product_Nameup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Name')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_Name')).val(Product_Nameup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Name')).val(Product_Namedown); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NameCode')).val(NameCodedown); | 
|     //Product_ListPrice | 
|     var Product_ListPricedown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_ListPrice')).value(); | 
|     var Product_ListPriceup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_ListPrice')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_ListPrice')).val(Product_ListPriceup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_ListPrice')).val(Product_ListPricedown); | 
|     //Product_Cost | 
|     var Product_Costdown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_Cost')).value(); | 
|     var Product_Costup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Cost')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_Cost')).val(Product_Costup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Cost')).val(Product_Costdown); | 
|     //Sales_Possibility | 
|     var Sales_Possibilitydown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Sales_Possibility')).value(); | 
|     var Sales_Possibilityup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Sales_Possibility')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Sales_Possibility')).val(Sales_Possibilityup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Sales_Possibility')).val(Sales_Possibilitydown); | 
|     //Cost | 
|     var Costdown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Cost')).value(); | 
|     var Costup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Cost')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Cost')).val(Costup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Cost')).val(Costdown); | 
|     //CostSubTotal | 
|     var CostSubTotaldown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':CostSubTotal')).value(); | 
|     var CostSubTotalup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':CostSubTotal')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':CostSubTotal')).val(CostSubTotalup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':CostSubTotal')).val(CostSubTotaldown); | 
|     //Bsscategory | 
|     var Bsscategorydown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Bsscategory')).value(); | 
|     var Bsscategoryup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Bsscategory')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Bsscategory')).val(Bsscategoryup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Bsscategory')).val(Bsscategorydown); | 
|     //PricebookEntryId | 
|     var PricebookEntryIddown = j$(escapeVfId('Page:mainForm:block:lists:' + j + ':PricebookEntryId')).value(); | 
|     var PricebookEntryIdup = j$(escapeVfId('Page:mainForm:block:lists:' + i + ':PricebookEntryId')).value(); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + j + ':PricebookEntryId')).val(PricebookEntryIdup); | 
|     j$(escapeVfId('Page:mainForm:block:lists:' + i + ':PricebookEntryId')).val(PricebookEntryIddown); | 
|     //radio Refresh | 
|     document.forms['Page:mainForm']['checklist'][i].checked=jChecked; | 
|     document.forms['Page:mainForm']['checklist'][j].checked=true; | 
|      | 
|     return true; | 
| } | 
|   | 
| // 真ん中の空行を削除、最後一行のデータ次の行 | 
| function getLastLineNoNext(doc) { | 
|     var hasRecordFlg = false; | 
|     var lastLineNo = 0; | 
|     for(var i=149; i>=0; i--){ | 
|         if (j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Assert')).value() != ''){ | 
|             if (!hasRecordFlg) { | 
|                 lastLineNo = i; | 
|             } | 
|             hasRecordFlg = true; | 
|         } | 
|         if (hasRecordFlg == true) { | 
|             if (j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Assert')).value() == ''){ | 
|                 var moveCheckbox = true; | 
|                 deletelist(i, doc, moveCheckbox); | 
|                 lastLineNo = i; | 
|             } | 
|         } | 
|     } | 
|     if (hasRecordFlg) { | 
|         lastLineNo = lastLineNo + 1; | 
|     } | 
|     return lastLineNo; | 
| } | 
|   | 
| function deletelist(k, doc, moveCheckbox){ | 
|     var j = 0; | 
|     for(var i=k; i<QuoteEntryMaxLine; i++){ | 
|         j = parseInt(i)+1; | 
|         if (j<QuoteEntryMaxLine){ | 
|             if (moveCheckbox) { | 
|                 doc.forms['Page:mainForm']['checklist'][i].checked = doc.forms['Page:mainForm']['checklist'][j].checked; | 
|             } | 
|             //製品番号 | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Assert')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Assert')).value()); | 
|             //LineNo | 
|             if (j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Assert')).value() == ''){ | 
|                 j$(escapeVfId('Page:mainForm:block:lists:' + i + ':indexNo')).text(''); | 
|             }else{ | 
|                 j$(escapeVfId('Page:mainForm:block:lists:' + i + ':indexNo')).text(j); | 
|             } | 
|             //SFDA | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':SFDA')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':SFDA')).value()); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Status__c')).text(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Status__c')).text()); | 
|             //Id | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Id')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_Id')).value()); | 
|             //品目名 | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Name__c')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Name__c')).value()); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NameLink')).html(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NameLink')).html()); | 
|             //ListPrice | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPrice')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':ListPrice')).value()); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPricetext')).text(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':ListPricetext')).text()); | 
|             //数量 | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Quantity')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Quantity')).value()); | 
|             // CHAN-BHNBX6 保修年限 2019/11/20 START | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':itemGuaranteePeriod')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':itemGuaranteePeriod')).value()); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':itemGuaranteePeriod')).text(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':itemGuaranteePeriod')).text()); | 
|             // CHAN-BHNBX6 保修年限 2019/11/20 END | 
|             //価格 | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':UnitPrice')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':UnitPrice')).value()); | 
|             //単位 | 
|             //j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Qty')).text(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Qty')).text()); | 
|             //j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Qty_Unit')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Qty_Unit')).value()); | 
|             //小計 | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Subtotal__c')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Subtotal__c')).value()); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':TotalPrice')).text(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':TotalPrice')).text()); | 
|             //小計lw | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPriceTotal')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':ListPriceTotal')).value()); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPriceTotalText')).text(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':ListPriceTotalText')).text()); | 
|             // CHAN-BHNBX6 nodiscount 小计 2019/11/20 START | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscount')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NoDiscount')).value()); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscountTotal')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NoDiscountTotal')).value()); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscountTotalText')).text(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NoDiscountTotalText')).text()); | 
|             // CHAN-BHNBX6 nodiscount 小计 2019/11/20  END | 
|             //Product_SFDA | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_SFDA')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_SFDA')).value()); | 
|             //NameCode | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NameCode')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':NameCode')).value()); | 
|             //Product_Name | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Name')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_Name')).value()); | 
|             //Product_ListPrice | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_ListPrice')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_ListPrice')).value()); | 
|             //Product_Cost | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Cost')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Product_Cost')).value()); | 
|             //Sales_Possibility | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Sales_Possibility')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Sales_Possibility')).value()); | 
|             //Cost | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Cost')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Cost')).value()); | 
|             //CostSubTotal | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':CostSubTotal')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':CostSubTotal')).value()); | 
|             //Bsscategory | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Bsscategory')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':Bsscategory')).value()); | 
|             //PricebookEntryId | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':PricebookEntryId')).val(j$(escapeVfId('Page:mainForm:block:lists:' + j + ':PricebookEntryId')).value()); | 
|         }else{ | 
|             //製品番号 | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Assert')).val(''); | 
|             //LineNo | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':indexNo')).text(''); | 
|             //SFDA | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':SFDA')).val(''); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Status__c')).text(''); | 
|             //Id | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Id')).val(''); | 
|             //品目名 | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Name__c')).val(''); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Nametext1')).text(''); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Nametext1')).attr('href', '#'); | 
|             //ListPrice | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPrice')).val(''); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPricetext')).text(''); | 
|             // CHAN-BHNBX6  nodiscount 小计 2019/11/20 START | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscount')).val(''); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscountTotal')).val(''); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NoDiscountTotalText')).text(''); | 
|             // CHAN-BHNBX6  nodiscount 小计 2019/11/20 END | 
|             //数量 | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Quantity')).val(''); | 
|             // CHAN-BHNBX6 保修年限 2019/11/20 START | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':itemGuaranteePeriod')).val(''); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':itemGuaranteePeriod')).text(''); | 
|             // CHAN-BHNBX6 保修年限 2019/11/20 END | 
|             //価格 | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':UnitPrice')).val(''); | 
|             //単位 | 
|             //j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Qty')).text(''); | 
|             //j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Qty_Unit')).val(''); | 
|             //小計 | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Subtotal__c')).val(''); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':TotalPrice')).text(''); | 
|             //小計lw | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPriceTotal')).val(''); | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':ListPriceTotalText')).text(''); | 
|             //Product_SFDA | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_SFDA')).val(''); | 
|             //NameCode | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':NameCode')).val(''); | 
|             //Product_Name | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Name')).val(''); | 
|             //Product_ListPrice | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_ListPrice')).val(''); | 
|             //Product_Cost | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Product_Cost')).val(''); | 
|             //Sales_Possibility | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Sales_Possibility')).val(''); | 
|             //Cost | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Cost')).val(''); | 
|             //CostSubTotal | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':CostSubTotal')).val(''); | 
|             //Bsscategory | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Bsscategory')).val(''); | 
|             //PricebookEntryId | 
|             j$(escapeVfId('Page:mainForm:block:lists:' + i + ':PricebookEntryId')).val(''); | 
|         } | 
|     } | 
|     return true; | 
| } | 
|   | 
| function setProductEntryGateway(str) { | 
|     blockme(); | 
|     setProductEntry(str); | 
| } | 
| function excelImportGateway(str) { | 
|     blockme(); | 
|     excelImport(str); | 
| } |