StudentChargeDelayEdit.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. //加载
  2. $(function () {
  3. //缓交金额
  4. $("#DelayAmount").blur(function () {
  5. //可缓交金额
  6. var canDelayAmount = $("#CanDelayAmount").val();
  7. //缓交金额
  8. var delayAmount = $("#DelayAmount").val();
  9. if (delayAmount != null && delayAmount != "") {
  10. //正浮点数(/^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$/)
  11. var reg = /^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$/;
  12. if (!reg.test(delayAmount)) {
  13. $("#DelayAmount").val("");
  14. $("#DelayPercent").val("");
  15. $.messager.alert("系统提示", "请输入金额。");
  16. return;
  17. }
  18. $("#DelayPercent").attr("disabled", true);
  19. if (parseFloat(delayAmount) <= parseFloat(canDelayAmount)) {
  20. var delayPercent = Math.round((delayAmount / canDelayAmount).toFixed(2) * 100) > 0
  21. ? Math.round((delayAmount / canDelayAmount).toFixed(2) * 100) : 1;
  22. //缓交百分比
  23. $("#DelayPercent").val(delayPercent);
  24. }
  25. else {
  26. $("#DelayAmount").val("");
  27. $("#DelayPercent").attr("disabled", false);
  28. $("#DelayPercent").val("");
  29. $.messager.alert("系统提示", "缓交金额不能大于可缓交金额。");
  30. }
  31. }
  32. else {
  33. $("#DelayPercent").attr("disabled", false);
  34. $("#DelayPercent").val("");
  35. }
  36. });
  37. //缓交百分比
  38. $("#DelayPercent").blur(function () {
  39. //可缓交金额
  40. var canDelayAmount = $("#CanDelayAmount").val();
  41. //缓交百分比
  42. var delayPercent = $("#DelayPercent").val();
  43. if (delayPercent != null && delayPercent != "") {
  44. //正整数(/^[0-9]*[1-9][0-9]*$/)
  45. var reg = /^[0-9]*[1-9][0-9]*$/;
  46. if (!reg.test(delayPercent)) {
  47. $("#DelayPercent").val("");
  48. $("#DelayAmount").val("");
  49. $.messager.alert("系统提示", "请输入数字。");
  50. return;
  51. }
  52. $("#DelayAmount").attr("disabled", true);
  53. if (parseInt(delayPercent) > 100 || parseInt(delayPercent) <= 0) {
  54. $("#DelayPercent").val("");
  55. $("#DelayAmount").attr("disabled", false);
  56. $("#DelayAmount").val("");
  57. $.messager.alert("系统提示", "缓缴百分比必须在1-100之间");
  58. }
  59. else {
  60. var delayAmount = ((canDelayAmount * (delayPercent / 100).toFixed(2))).toFixed(1);
  61. //缓交金额
  62. $("#DelayAmount").val(delayAmount);
  63. }
  64. }
  65. else {
  66. $("#DelayAmount").attr("disabled", false);
  67. $("#DelayAmount").val("");
  68. }
  69. });
  70. })
  71. //确定(申请)
  72. function StudentChargeDelay_Save() {
  73. //缓交金额
  74. var delayAmount = $("#DelayAmount").val();
  75. //缓交百分比
  76. var delayPercent = $("#DelayPercent").val();
  77. if ((delayAmount == null || delayAmount == "") && (delayPercent == null || delayPercent == "")) {
  78. $.messager.alert("系统提示", "请输入缓交金额或缓交百分比。");
  79. return;
  80. }
  81. if (delayPercent != null && delayPercent != "") {
  82. if (parseInt(delayPercent) > 100 || parseInt(delayPercent) <= 0) {
  83. $.messager.alert("系统提示", "缓缴百分比必须在1-100之间");
  84. return;
  85. }
  86. }
  87. //可缓交金额
  88. var canDelayAmount = $("#CanDelayAmount").val();
  89. //缓交金额在可缓交金额范围内
  90. if (parseFloat(delayAmount) > parseFloat(canDelayAmount)) {
  91. $.messager.alert("系统提示", "缓交金额不能大于可缓交金额。");
  92. $("#DelayAmount").val("");
  93. $("#DelayPercent").val("");
  94. return;
  95. }
  96. $("#DelayAmount").attr("disabled", false);
  97. $("#DelayPercent").attr("disabled", false);
  98. //可缓交金额
  99. $("#CanDelayAmount").attr("disabled", false);
  100. $(document.forms[0]).submit();
  101. }
  102. //获取收费标准应收金额
  103. function queryStudentChargeDelayStandard(data) {
  104. var userID = $("#UserID").val();
  105. if (userID == "" || userID == "-1" || userID == null) {
  106. $("#Amount").val("");
  107. $("#ChargeTag").combobox("setValue", "-1");
  108. $("#ChargeAmount").val("");
  109. $("#ActualAmount").val("");
  110. $("#PaidAmount").val("");
  111. $("#PassDelayAmount").val("");
  112. $("#CanDelayAmount").val("");
  113. $("#ApplyDelayAmount").val("");
  114. return;
  115. }
  116. var chargeYearID = $("#ChargeYear").combogrid("getValue");
  117. if (chargeYearID == "" || chargeYearID == "-1" || chargeYearID == null) {
  118. $("#Amount").val("");
  119. $("#ChargeTag").combobox("setValue", "-1");
  120. $("#ChargeAmount").val("");
  121. $("#ActualAmount").val("");
  122. $("#PaidAmount").val("");
  123. $("#PassDelayAmount").val("");
  124. $("#CanDelayAmount").val("");
  125. $("#ApplyDelayAmount").val("");
  126. return;
  127. }
  128. var chargeProjectID = $("#ChargeProjectID").combogridX("getValue");
  129. if (chargeProjectID == "" || chargeProjectID == "-1" || chargeProjectID == null) {
  130. $("#Amount").val("");
  131. $("#ChargeTag").combobox("setValue", "-1");
  132. $("#ChargeAmount").val("");
  133. $("#ActualAmount").val("");
  134. $("#PaidAmount").val("");
  135. $("#PassDelayAmount").val("");
  136. $("#CanDelayAmount").val("");
  137. $("#ApplyDelayAmount").val("");
  138. return;
  139. }
  140. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ChargeDelay/ChargeDelayStandard', { userID: userID, chargeYearID: chargeYearID, chargeProjectID: chargeProjectID }, function (data) {
  141. if (data.IsSuccess == true) {
  142. if (data.Data != null) {
  143. $("#Amount").val(data.Data.Amount);
  144. $("#ChargeTag").combobox("setValue", data.Data.ChargeTag);
  145. $("#ChargeAmount").val(data.Data.ChargeAmount);
  146. $("#ActualAmount").val(data.Data.ActualAmount);
  147. $("#PaidAmount").val(data.Data.PaidAmount);
  148. $("#PassDelayAmount").val(data.Data.PassDelayAmount);
  149. $("#CanDelayAmount").val(data.Data.CanDelayAmount);
  150. $("#ApplyDelayAmount").val(data.Data.ApplyDelayAmount);
  151. }
  152. else {
  153. $("#Amount").val("");
  154. $("#ChargeTag").combobox("setValue", "-1");
  155. $("#ChargeAmount").val("");
  156. $("#ActualAmount").val("");
  157. $("#PaidAmount").val("");
  158. $("#PassDelayAmount").val("");
  159. $("#CanDelayAmount").val("");
  160. $("#ApplyDelayAmount").val("");
  161. $.messager.alert("系统提示", "对应的应收名单不存在,请核查。");
  162. }
  163. }
  164. else {
  165. $("#Amount").val("");
  166. $("#ChargeTag").combobox("setValue", "-1");
  167. $("#ChargeAmount").val("");
  168. $("#ActualAmount").val("");
  169. $("#PaidAmount").val("");
  170. $("#PassDelayAmount").val("");
  171. $("#CanDelayAmount").val("");
  172. $("#ApplyDelayAmount").val("");
  173. $.messager.alert("系统提示", data.Message);
  174. }
  175. });
  176. }