invoice.validator.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. function invoiceShow(){
  2. var chkRadio = $('input:radio[name="invoiceType"]:checked').val();
  3. if (chkRadio == null) {
  4. alert("没有选中项");
  5. return false;
  6. } else if(chkRadio==1) {
  7. $('#plainInvoice_box').hide();
  8. $('#specialInvoice_box').show();
  9. }else if(chkRadio==0){
  10. $('#plainInvoice_box').show();
  11. $('#specialInvoice_box').hide();
  12. }
  13. }
  14. function settlementTypeShow(){
  15. var chkRadio = $('input:radio[name="settlementType"]:checked').val();
  16. if (chkRadio == null) {
  17. alert("没有选中项");
  18. return false;
  19. } else if(chkRadio=='TRAINING') {
  20. $('#trainingSelect').show();
  21. }else if(chkRadio=='SOFTWARE'){
  22. $('#trainingSelect').hide();
  23. }
  24. }
  25. function mailShow(){
  26. var chkRadio = $('input:radio[name="doPost"]:checked').val();
  27. if (chkRadio == null) {
  28. alert("没有选中项");
  29. return false;
  30. } else if(chkRadio==1) {
  31. $('#mail_box').show();
  32. }else if(chkRadio==0){
  33. $('#mail_box').hide();
  34. }
  35. }
  36. $(function () {
  37. $('#invoiceReceivablesRefund').validator({
  38. timely: 3,
  39. focusCleanup: true,
  40. fields: {///ajaxCheckInvoicePrice, iidKey:#inKey
  41. refundCompany: 'required;'
  42. ,refundNumber: 'required;'
  43. ,refundPrice: 'required;remote[/ajaxCheckInvoiceReceivablesRefund, iridKey:#iridKey]'
  44. }
  45. });
  46. $('#invoice').validator({
  47. // timely: 3,
  48. // focusCleanup: true,
  49. rules: {
  50. invoiceTitle: function() {
  51. return $('#invoicePlain').prop('checked');
  52. },
  53. invoiceCompany: function() {
  54. return $('#invoiceSpecial').prop('checked');
  55. }
  56. ,isMail: function() {
  57. return $('#isMail').prop('checked');
  58. }
  59. ,isSettlementType: function() {
  60. return $('#settlementType').prop('checked');
  61. }
  62. // ,isInvoicePrice: function() {
  63. // var invoicePrice=$('#isInvoicePrice').val();
  64. // console.log(invoicePrice);
  65. // if(invoicePrice>10000){
  66. // return false;
  67. // }
  68. // //return $('#isMail').prop('checked');
  69. // }
  70. },
  71. fields: {//tel(invoiceCompany);digits(invoiceCompany)
  72. invoiceTitle: 'required(invoiceTitle);',
  73. invoiceCompany:'required(invoiceCompany);',
  74. TIN:'required(invoiceCompany);',
  75. address:'required(invoiceCompany);',
  76. phone:'required(invoiceCompany);',//mobile|tel;
  77. bank:'required(invoiceCompany);',
  78. bankAccount:'required(invoiceCompany);'
  79. ,invoicePrice: 'match(lte, 100001)'
  80. ,invoiceQuantity: ' required;'
  81. ,invoiceUnitPrice: 'required;'
  82. ,trainId:'required(isSettlementType); '
  83. // ,items: 'required(isItems); '
  84. // ,tx: 'required;'
  85. ,invoiceType: 'required'
  86. ,recipients: 'required(isMail); '
  87. ,recipientsPhone: 'required(isMail); '//digits(isMail);
  88. ,recipientsAddress: 'required(isMail); '
  89. }
  90. });
  91. $("form[name='invoiceApproval']").validator({
  92. timely: 3,
  93. focusCleanup: true,
  94. theme:"yellow_top",
  95. fields: {
  96. //'opinion': 'required; '
  97. }
  98. });
  99. $("form[name='invoicePrint']").validator({
  100. timely: 3,
  101. focusCleanup: true,
  102. theme:"yellow_top",
  103. fields: {
  104. 'invoiceNo': 'required;remote[/ajaxCheckInvoiceNoUniqueness]'
  105. }
  106. });
  107. $("form[name='invoiceExpress']").validator({
  108. timely: 3,
  109. focusCleanup: true,
  110. theme:"yellow_top",
  111. fields: {
  112. 'actualItems': 'required; ',
  113. 'nu': 'required; ',
  114. 'express': 'required; '
  115. }
  116. });
  117. $("form[name='untreadInvoice']").validator({
  118. timely: 3,
  119. focusCleanup: true,
  120. rules: {
  121. isUntread: function() {
  122. return $("input[node-untread='post']").prop('checked');
  123. }
  124. },
  125. fields: {
  126. untreadReason: 'required; '
  127. ,untreadPost: 'required; '
  128. ,untreadCompany: 'required(isUntread); '
  129. ,untreadNumber: 'required(isUntread); '
  130. ,untreadItems: 'required(isUntread); '
  131. }
  132. });
  133. //培训班添加
  134. $("form[name='invoiceTraining']").validator({
  135. timely: 3,
  136. focusCleanup: true,
  137. fields: {//remote[/ajaxCheckInvoicePrice]
  138. trainName: 'required;'
  139. ,trainDate: 'required; '
  140. }
  141. });
  142. //收款录入
  143. $("form[name='receivablesInvoice']").validator({
  144. timely: 3,
  145. focusCleanup: true,
  146. fields: {//remote[/ajaxCheckInvoicePrice]
  147. receivablesPrice: 'required;'
  148. ,receivablesMessage: 'required; '
  149. ,receivablesBank: 'required '
  150. ,receivablesDate: 'required '
  151. ,receivablesCategory: 'required '
  152. ,receivablesStaff: 'required '
  153. }
  154. });
  155. //入账
  156. $("form[name='receivablesInvoiceBind']").validator({
  157. // dataFilter: function(data) {
  158. // console.log(data);
  159. // return "ddd";
  160. //// if (data.status === 200) return "2333";
  161. //// else return data.msg;
  162. // },
  163. timely: 3,
  164. focusCleanup: true,
  165. fields: {//remote(/ajaxCheckInvoicePrice, iidKey:#inKey);
  166. receivablesPrice: 'required;'
  167. ,receivablesMessage: 'required; '
  168. ,receivablesBank: 'required '
  169. ,receivablesDate: 'required '
  170. ,receivablesCategory: 'required '
  171. ,receivablesStaff: 'required '
  172. }
  173. });
  174. $("input[checkInvoicePrice=true]").on('input',function(e){
  175. var inKey=$('#inKey').val();
  176. var receivablesPrice=$(this).val();
  177. var url = "/ajaxCheckInvoicePrice";
  178. $.ajax({
  179. url : url,
  180. type : "post",
  181. cache : false,
  182. dataType : "json",
  183. data : {
  184. iidKey : inKey,
  185. receivablesPrice:receivablesPrice
  186. },
  187. global : true,
  188. success : function(data) {
  189. if(data!=null)
  190. $('span[checkInvoicePrice=msg]').html(data.error);
  191. else
  192. $('span[checkInvoicePrice=msg]').html('');
  193. },
  194. error : function(err) {
  195. }
  196. });
  197. });
  198. $("form[name='receivablesAscription']").validator({
  199. timely: 3,
  200. focusCleanup: true,
  201. fields: {
  202. recepitTitleMark: 'required '
  203. }
  204. });
  205. $("#IPA").validator({
  206. timely: 3,
  207. focusCleanup: true,
  208. fields: {
  209. invoiceCode: 'required;',
  210. invoiceNoStart: 'required;digits; ',
  211. invoiceNoTotal: 'required;digits; ',
  212. }
  213. });
  214. $('#invoiceQuantity').on('input',function(e) {
  215. var invoiceUnitPrice=$('#invoiceUnitPrice').val();
  216. var invoiceQuantity=$(this).val();
  217. var tp=invoiceUnitPrice*invoiceQuantity;
  218. $("#tp").html('¥'+tp);
  219. });
  220. $('#invoiceUnitPrice').on('input',function(e) {
  221. var invoiceUnitPrice=$('#invoiceQuantity').val();
  222. var invoiceQuantity=$(this).val();
  223. var tp=invoiceUnitPrice*invoiceQuantity;
  224. $("#tp").html('¥'+tp);
  225. });
  226. })