StudentChargeEdit.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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 reload() {
  73. $("#dgStudentChargeList").cmsXDataTable("load", $.getDataGridParams("dgStudentChargeList"));
  74. }
  75. //保存
  76. function StudentCharge_Save() {
  77. var amount = $("#Amount").val();
  78. if (amount == "" || amount == null) {
  79. $.messager.alert("系统提示", "应收金额不能为空,请核对对应的收费标准。");
  80. return;
  81. }
  82. $(document.forms[0]).submit();
  83. }
  84. //缓交申请确定
  85. function ChangeDelay_Apply() {
  86. //缓交金额
  87. var delayAmount = $("#DelayAmount").val();
  88. //缓交百分比
  89. var delayPercent = $("#DelayPercent").val();
  90. if ((delayAmount == null || delayAmount == "") && (delayPercent == null || delayPercent == "")) {
  91. $.messager.alert("系统提示", "请输入缓交金额或缓交百分比。");
  92. return;
  93. }
  94. if (delayPercent != null && delayPercent != "") {
  95. if (parseInt(delayPercent) > 100 || parseInt(delayPercent) <= 0) {
  96. $.messager.alert("系统提示", "缓缴百分比必须在1-100之间");
  97. return;
  98. }
  99. }
  100. //可缓交金额
  101. var canDelayAmount = $("#CanDelayAmount").val();
  102. //缓交金额在可缓交金额范围内
  103. if (parseFloat(delayAmount) > parseFloat(canDelayAmount)) {
  104. $.messager.alert("系统提示", "缓交金额不能大于可缓交金额。");
  105. $("#DelayAmount").val("");
  106. $("#DelayPercent").val("");
  107. return;
  108. }
  109. $("#DelayAmount").attr("disabled", false);
  110. $("#DelayPercent").attr("disabled", false);
  111. $(document.forms[0]).submit();
  112. }
  113. //费用调整确定
  114. function StudentCharge_PayEdit() {
  115. $(document.forms[0]).submit();
  116. }
  117. //获取收费标准应收金额
  118. function queryStudentChargeAmount(data) {
  119. var userID = $("#UserID").combogridX("getValue");
  120. if (userID == "" || userID == "-1" || userID == null) {
  121. $("#Amount").val("");
  122. return;
  123. }
  124. var chargeYearID = $("#ChargeYear").combogrid("getValue");
  125. if (chargeYearID == "" || chargeYearID == "-1" || chargeYearID == null) {
  126. $("#Amount").val("");
  127. return;
  128. }
  129. var chargeProjectID = $("#ChargeProjectID").combogridX("getValue");
  130. if (chargeProjectID == "" || chargeProjectID == "-1" || chargeProjectID == null) {
  131. $("#Amount").val("");
  132. return;
  133. }
  134. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentCharge/StudentChargeStandard', { userID: userID, chargeYearID: chargeYearID, chargeProjectID: chargeProjectID }, function (data) {
  135. if (data.IsSuccess == true) {
  136. $("#Amount").val(data.Message);
  137. }
  138. else {
  139. $("#Amount").val("");
  140. }
  141. });
  142. reload();
  143. }