mode_tuihuo.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //流程模块【tuihuo.退货单】下录入页面自定义js页面,初始函数
  2. function initbodys(){
  3. c.onselectdataall=function(fid,seld,sna,sid){
  4. if(fid.substr(0,8)=='temp_aid'){
  5. this.setrowval(fid,{
  6. 'unit':seld.unit,
  7. 'price':seld.price,
  8. });
  9. }
  10. }
  11. if(form('custractid'))$(form('custractid')).change(function(){
  12. var val = this.value,txt='';
  13. custractidchange(val);
  14. });
  15. }
  16. function custractidchange(v){
  17. if(v=='' || v=='0'){
  18. form('custid').value='';
  19. form('custname').value='';
  20. return;
  21. }
  22. js.ajax(geturlact('ractchange'),{ractid:v},function(a){
  23. form('custid').value=a.custid;
  24. form('custname').value=a.custname;
  25. form('money').value=a.money;
  26. form('discount').value=a.discount;
  27. var ret = a.zbarr;
  28. for(var i=0;i<ret.length;i++){
  29. if(i==0){
  30. c.setrowdata(0,0,ret[i]);
  31. }else{
  32. c.insertrow(0,ret[i],true);
  33. }
  34. }
  35. },'get,json');
  36. }
  37. function changesubmit(){
  38. if(get('tablesub0')){
  39. var da = c.getsubdata(0),d1;
  40. for(var i=0;i<da.length;i++){
  41. d1 = da[i];
  42. if(!d1.aid)return '行['+(i+1)+']必须选择物品';
  43. if(d1.count<=0)return '行['+(i+1)+']数量必须大于0';
  44. }
  45. }
  46. }