| | |
| | | , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: '计éåä½', title: '计éåä½', width: 100, edit: 'text', event: "HUnitID"}//f7 |
| | | , { field: 'HQty', title: 'æ°é', width: 100, totalRow: true, edit: 'text'} |
| | | , { field: 'HPrice', title: 'åä»·', width: 100, edit: 'text', event: "HPrice" } |
| | | , { field: 'HMoney', title: 'éé¢', width: 100, totalRow: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HPrice', title: 'åä»·', width: 100, event: "HPrice", style: 'background-color:#efefef4d;' } |
| | | , { field: 'HMoney', title: 'éé¢', width: 100, totalRow: true, edit: 'text' } |
| | | , { field: 'HTaxPrice', title: 'å«ç¨åä»·', width: 100, edit: 'text', event: "HTaxPrice" } |
| | | , { field: 'HDiscountRate', title: 'ææ£ç', width: 100, edit: 'text' } |
| | | , { field: 'HRelTaxPrice', title: 'å®é
å«ç¨åä»·', width: 100, style: 'background-color:#efefef4d;' } |
| | |
| | | table.render(optionEntry); |
| | | } |
| | | function set_InitGridHaveSource() { |
| | | option = { |
| | | elem: '#mainTable' |
| | | , toolbar: '#toolbarDemo' |
| | | , totalRow: true |
| | | , limit: 500 |
| | | , height: 500 |
| | | , loading: false |
| | | , cols: [[ //å表 |
| | | { type: 'checkbox', totalRowText: 'å计è¡' } |
| | | , { type: 'numbers', title: 'åºå·', width: 100 } |
| | | , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'ç©æä»£ç ', title: 'ç©æä»£ç ', width: 150, edit: 'text', event: "HMaterID" }//f7 |
| | | , { field: 'ç©æåç§°', title: 'ç©æåç§°', width: 150, style: 'background-color:#efefef4d;' } |
| | | , { field: 'è§æ ¼åå·', title: 'è§æ ¼åå·', width: 100, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: '计éåä½', title: '计éåä½', width: 100, edit: 'text', event: "HUnitID" }//f7 |
| | | , { field: 'HQty', title: 'æ°é', width: 100, totalRow: true, style: 'background-color:#efefef4d;'} |
| | | , { field: 'HPrice', title: 'åä»·', width: 100, edit: 'text', event: "HPrice" } |
| | | , { field: 'HMoney', title: 'éé¢', width: 100, totalRow: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HTaxPrice', title: 'å«ç¨åä»·', width: 100, edit: 'text', event: "HTaxPrice" } |
| | | , { field: 'HDiscountRate', title: 'ææ£ç', width: 100, edit: 'text' } |
| | | , { field: 'HRelTaxPrice', title: 'å®é
å«ç¨åä»·', width: 100, edit: 'text' } |
| | | , { field: 'HTaxRate', title: 'ç¨ç', width: 100, edit: 'text' } |
| | | , { field: 'HTaxMoney', title: 'ç¨é¢', width: 100, totalRow: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HMoneyBB', title: 'æ¬ä½å¸éé¢', width: 100, totalRow: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HlineTotal', title: 'ä»·ç¨å计', width: 100, totalRow: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HlineTotalBB', title: 'æ¬ä½å¸ä»·ç¨å计', width: 100, totalRow: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HRemark', title: '夿³¨', width: 100, edit: 'text' } |
| | | |
| | | , { field: 'HSourceInterID', title: 'æºåå
ç ', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HSourceEntryID', title: 'æºååå
ç ', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HSourceBillNo', title: 'æºåå·', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HSourceBillType', title: 'æºåç±»å', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HRelationQty', title: 'å
³èæ°é', width: 100, totalRow: true, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HRelationMoney', title: 'å
³èéé¢', width: 100, totalRow: true, hide: true, style: 'background-color:#efefef4d;' } |
| | | |
| | | , { field: 'HPOOrderInterID', title: 'éè´è®¢åå
ç ', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HPOOrderEntryID', title: 'éè´è®¢ååå
ç ', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HPOOrderBillNo', title: 'éè´è®¢åå·', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | |
| | | , { field: 'HSeOrderTaxPrice', title: '订åå«ç¨åä»·', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HSeOrderInterID', title: 'éå®è®¢åå
ç ', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HSeOrderEntryID', title: 'éå®è®¢ååå
ç ', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { field: 'HSeOrderBillNo', title: 'éå®è®¢åå·', width: 100, hide: true, style: 'background-color:#efefef4d;' } |
| | | , { fixed: 'right', title: 'æä½', toolbar: '#barDemo', width: 70 } |
| | | ]] |
| | | //é䏿ºååæ°éä¸å¯ç¼è¾ |
| | | for (var i = 0; i < option.cols[0].length; i++) { |
| | | if (option.cols[0][i]["field"] == "HQty") { |
| | | option.cols[0][i]["edit"] = false; |
| | | } |
| | | |
| | | } |
| | | } |
| | | //#endregion |
| | |
| | | table.on('edit(mainTable)', function (obj) { |
| | | //æ°å¼æ ¼å¼æ ¡éªå·¥å
· |
| | | var ref = /^\d+(\.\d+)?$/; //éè´æ°æ£åè¡¨è¾¾å¼ |
| | | var ref1 = /^-?\d+(\.\d+)?$/; //夿å符串æ¯å¦ä¸ºæ°å(å
嫿´æ°ãæµ®ç¹æ°)ï¼æ£åè¡¨è¾¾å¼ |
| | | var temp = ""; |
| | | var Dec = getDecByMaterID(obj.data.HMaterID) //è·å精度 |
| | | var HQtyDec = (Dec["HQtyDec"] == null || Dec["HQtyDec"] == 0) ? 4 : Dec["HQtyDec"]; //æ°é精度 |
| | |
| | | case "HQty": //æ°é |
| | | //æ°æ®æ ¼å¼æ ¡éª |
| | | temp = value + ""; |
| | | if (!ref.test(temp) || temp == 0) { |
| | | if (!ref1.test(temp)) { |
| | | //æ¢å¤æ°æ®å°ç¼è¾å |
| | | obj.update({ |
| | | HQty: oldText |
| | | }); |
| | | table.render(option); |
| | | |
| | | layer.msg("æ°é请è¾å
¥å¤§äº0çæ°å!"); |
| | | layer.msg("æ°é请è¾å
¥ä¸ä¸º0çæ°å!"); |
| | | return; |
| | | } else if (temp * 1 == 0) { |
| | | //æ¢å¤æ°æ®å°ç¼è¾å |
| | | obj.update({ |
| | | HQty: oldText |
| | | }); |
| | | table.render(option); |
| | | |
| | | layer.msg("æ°é请è¾å
¥ä¸ä¸º0çæ°å!"); |
| | | return; |
| | | } |
| | | |
| | |
| | | , HlineTotalBB: HlineTotalBB |
| | | , HMoneyBB: HMoneyBB |
| | | }); |
| | | table.render(option); |
| | | //table.render(option); |
| | | break; |
| | | case "HPrice": //åä»· |
| | | //æ°æ®æ ¼å¼æ ¡éª |
| | |
| | | , HlineTotalBB: HlineTotalBB |
| | | , HMoneyBB: HMoneyBB |
| | | }); |
| | | table.render(option); |
| | | //table.render(option); |
| | | break; |
| | | case "HTaxRate": //æ°é |
| | | //æ°æ®æ ¼å¼æ ¡éª |
| | |
| | | , HlineTotalBB: HlineTotalBB |
| | | , HMoneyBB: HMoneyBB |
| | | }); |
| | | table.render(option); |
| | | //table.render(option); |
| | | break; |
| | | case "HDiscountRate": //æ°é |
| | | //æ°æ®æ ¼å¼æ ¡éª |
| | |
| | | , HDiscountRate: HDiscountRate |
| | | , HRelTaxPrice: HRelTaxPrice |
| | | }); |
| | | table.render(option); |
| | | //table.render(option); |
| | | break; |
| | | case "HTaxPrice": //åä»· |
| | | //æ°æ®æ ¼å¼æ ¡éª |
| | |
| | | , HlineTotalBB: HlineTotalBB //æ´æ°HlineTotalBBåæ®µï¼å
¶å¼æ¥èªåéHlineTotalBB |
| | | , HMoneyBB: HMoneyBB |
| | | }); |
| | | table.render(option); |
| | | //table.render(option); |
| | | break; |
| | | case "HMoney": //éé¢ |
| | | //æ°æ®æ ¼å¼æ ¡éª |
| | | temp = value + ""; |
| | | if (!ref1.test(temp)) { |
| | | //æ¢å¤æ°æ®å°ç¼è¾å |
| | | obj.update({ |
| | | HMoney: oldText |
| | | }); |
| | | table.render(option); |
| | | layer.msg("é颿æ°é请è¾å
¥å¤§äº0çæ°å!"); |
| | | return; |
| | | } else if (temp * 1 == 0) { |
| | | //æ¢å¤æ°æ®å°ç¼è¾å |
| | | obj.update({ |
| | | HMoney: oldText |
| | | }); |
| | | table.render(option); |
| | | layer.msg("é颿æ°é请è¾å
¥å¤§äº0çæ°å!"); |
| | | return; |
| | | } |
| | | |
| | | //æ°æ®æ ¡éªåæ ¼ï¼éç®è®°å½ |
| | | var HQty = obj.data.HQty * 1; //æ°é |
| | | var HMoney = value * 1; //éé¢=æ°é*åä»· |
| | | var HPrice = HMoney / HQty; |
| | | var HTaxRate = obj.data.HTaxRate * 0.01; //ç¨ç |
| | | var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4)); //ç¨é¢=éé¢*ç¨ç |
| | | var HlineTotal = HMoney + HTaxMoney; //ä»·ç¨å计=éé¢+ç¨é¢ |
| | | var HTaxPrice = Number((HPrice * (1 + HTaxRate)).toFixed(4)); //å«ç¨åä»·=åä»·*(1+ç¨ç) |
| | | var HDiscountRate = obj.data.HDiscountRate * 1; //ææ£ç |
| | | var HRelTaxPrice = Number((HTaxPrice * HDiscountRate).toFixed(4)); //å®é
å«ç¨åä»·=å«ç¨åä»·*ææ£ç |
| | | var HExRate = $("#HExRate").val(); //æ±ç |
| | | var HlineTotalBB = Number(((HMoney + HTaxMoney) * HExRate).toFixed(4)); //æ¬ä½å¸ä»·ç¨å计=(ç¨é¢+éé¢)*æ±ç |
| | | var HMoneyBB = HMoney * HExRate; |
| | | //æ°å精度 |
| | | HQty = Number(HQty.toFixed(HQtyDec)); |
| | | HPrice = Number(HPrice.toFixed(HPriceDec)); |
| | | HMoney = Number(HMoney.toFixed(HMoneyDec)); |
| | | HlineTotal = Number(HlineTotal.toFixed(HMoneyDec)); |
| | | HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec)); |
| | | HRelTaxPrice = Number(HRelTaxPrice.toFixed(HPriceDec)); |
| | | HlineTotalBB = Number(HlineTotalBB.toFixed(HMoneyDec)); |
| | | HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec)); |
| | | HMoneyBB = Number(HMoneyBB.toFixed(HMoneyDec)); |
| | | //åæ¥æ´æ°è¡¨æ ¼åç¼å对åºçå¼ |
| | | obj.update({ |
| | | HQty: HQty |
| | | , HPrice: HPrice |
| | | , HMoney: HMoney |
| | | , HTaxMoney: HTaxMoney |
| | | , HlineTotal: HlineTotal |
| | | , HTaxPrice, HTaxPrice |
| | | , HRelTaxPrice: HRelTaxPrice |
| | | , HlineTotalBB: HlineTotalBB |
| | | , HMoneyBB: HMoneyBB |
| | | }); |
| | | //table.render(option); |
| | | break; |
| | | default: |
| | | } |
| | |
| | | function AllowLoadData(data) { |
| | | //æ°å¼æ ¼å¼æ ¡éªå·¥å
· |
| | | var ref = /^\d+(\.\d+)?$/; //éè´æ°æ£åè¡¨è¾¾å¼ |
| | | var ref1 = /^-?\d+(\.\d+)?$/; //夿å符串æ¯å¦ä¸ºæ°å(å
嫿´æ°ãæµ®ç¹æ°)ï¼æ£åè¡¨è¾¾å¼ |
| | | var temp = ""; |
| | | |
| | | //#region è¡¨å¤´æ°æ®æ£éª |
| | |
| | | return false; |
| | | } |
| | | |
| | | //å®åæ°éæ ¼å¼æ ¡éª |
| | | //æ°éæ ¼å¼æ ¡éª |
| | | temp = option.data[i]["HQty"] + ""; |
| | | if (temp == "0") { |
| | | layer.msg("第" + (i + 1) + "è¡ï¼å®æ¶æ°éä¸è½ä¸º0ï¼"); |
| | | if (!ref1.test(temp)) { |
| | | layer.msg("第" + (i + 1) + "è¡ï¼æ°é请è¾å
¥ä¸ä¸º0çæ°åï¼"); |
| | | return false; |
| | | } else if (!ref.test(temp)) { |
| | | layer.msg("第" + (i + 1) + "è¡ï¼å®æ¶æ°é请è¾å
¥å¤§äº0çæ°åï¼"); |
| | | } else if (temp * 1 == 0) { |
| | | layer.msg("第" + (i + 1) + "è¡ï¼æ°é请è¾å
¥ä¸ä¸º0çæ°åï¼"); |
| | | return false; |
| | | } |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | //é颿 ¼å¼æ ¡éª |
| | | temp = option.data[i]["HMoney"] + ""; |
| | | if (temp == "0") { |
| | | layer.msg("第" + (i + 1) + "è¡ï¼éé¢ä¸è½ä¸º0ï¼"); |
| | | return false; |
| | | } else if (!ref.test(temp)) { |
| | | layer.msg("第" + (i + 1) + "è¡ï¼éé¢è¯·è¾å
¥å¤§äº0çæ°åï¼"); |
| | | return false; |
| | | } |
| | | |
| | | //ä»·ç¨åè®¡æ ¼å¼æ ¡éª |
| | | temp = option.data[i]["HTaxMoney"] + ""; |
| | | ////é颿 ¼å¼æ ¡éª |
| | | //temp = option.data[i]["HMoney"] + ""; |
| | | //if (temp == "0") { |
| | | // layer.msg("第" + (i + 1) + "è¡ï¼ä»·ç¨å计ä¸è½ä¸º0ï¼"); |
| | | // layer.msg("第" + (i + 1) + "è¡ï¼éé¢ä¸è½ä¸º0ï¼"); |
| | | // return false; |
| | | //} else |
| | | if (!ref.test(temp)) { |
| | | layer.msg("第" + (i + 1) + "è¡ï¼ç¨é¢è¯·è¾å
¥å¤§äº0çæ°åï¼"); |
| | | return false; |
| | | } |
| | | //} else if (!ref.test(temp)) { |
| | | // layer.msg("第" + (i + 1) + "è¡ï¼éé¢è¯·è¾å
¥å¤§äº0çæ°åï¼"); |
| | | // return false; |
| | | //} |
| | | |
| | | ////ä»·ç¨åè®¡æ ¼å¼æ ¡éª |
| | | //temp = option.data[i]["HTaxMoney"] + ""; |
| | | ////if (temp == "0") { |
| | | //// layer.msg("第" + (i + 1) + "è¡ï¼ä»·ç¨å计ä¸è½ä¸º0ï¼"); |
| | | //// return false; |
| | | ////} else |
| | | //if (!ref.test(temp)) { |
| | | // layer.msg("第" + (i + 1) + "è¡ï¼ç¨é¢è¯·è¾å
¥å¤§äº0çæ°åï¼"); |
| | | // return false; |
| | | //} |
| | | } |
| | | //#endregion |
| | | return true; |