ChargeDelayEdit.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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 ChargeDelay_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 queryChargeDelayStandard(data) {
  104. var userID = $("#UserID").combogridX("getValue");
  105. if (userID == "" || userID == "-1" || userID == null) {
  106. $("#UserName").val("");
  107. $("#Amount").val("");
  108. $("#ChargeTag").combobox("setValue", "-1");
  109. $("#ChargeAmount").val("");
  110. $("#ActualAmount").val("");
  111. $("#PaidAmount").val("");
  112. $("#PassDelayAmount").val("");
  113. $("#CanDelayAmount").val("");
  114. $("#ApplyDelayAmount").val("");
  115. return;
  116. }
  117. else {
  118. $("#UserName").val(data.UserName);
  119. }
  120. var chargeYearID = $("#ChargeYear").combogrid("getValue");
  121. if (chargeYearID == "" || chargeYearID == "-1" || chargeYearID == null) {
  122. $("#Amount").val("");
  123. $("#ChargeTag").combobox("setValue", "-1");
  124. $("#ChargeAmount").val("");
  125. $("#ActualAmount").val("");
  126. $("#PaidAmount").val("");
  127. $("#PassDelayAmount").val("");
  128. $("#CanDelayAmount").val("");
  129. $("#ApplyDelayAmount").val("");
  130. return;
  131. }
  132. var chargeProjectID = $("#ChargeProjectID").combogridX("getValue");
  133. if (chargeProjectID == "" || chargeProjectID == "-1" || chargeProjectID == null) {
  134. $("#Amount").val("");
  135. $("#ChargeTag").combobox("setValue", "-1");
  136. $("#ChargeAmount").val("");
  137. $("#ActualAmount").val("");
  138. $("#PaidAmount").val("");
  139. $("#PassDelayAmount").val("");
  140. $("#CanDelayAmount").val("");
  141. $("#ApplyDelayAmount").val("");
  142. return;
  143. }
  144. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ChargeDelay/ChargeDelayStandard', { userID: userID, chargeYearID: chargeYearID, chargeProjectID: chargeProjectID }, function (data) {
  145. if (data.IsSuccess == true) {
  146. if (data.Data != null) {
  147. $("#UserName").val(data.Data.UserName);
  148. $("#Amount").val(data.Data.Amount);
  149. $("#ChargeTag").combobox("setValue", data.Data.ChargeTag);
  150. $("#ChargeAmount").val(data.Data.ChargeAmount);
  151. $("#ActualAmount").val(data.Data.ActualAmount);
  152. $("#PaidAmount").val(data.Data.PaidAmount);
  153. $("#PassDelayAmount").val(data.Data.PassDelayAmount);
  154. $("#CanDelayAmount").val(data.Data.CanDelayAmount);
  155. $("#ApplyDelayAmount").val(data.Data.ApplyDelayAmount);
  156. }
  157. else {
  158. $("#Amount").val("");
  159. $("#ChargeTag").combobox("setValue", "-1");
  160. $("#ChargeAmount").val("");
  161. $("#ActualAmount").val("");
  162. $("#PaidAmount").val("");
  163. $("#PassDelayAmount").val("");
  164. $("#CanDelayAmount").val("");
  165. $("#ApplyDelayAmount").val("");
  166. $.messager.alert("系统提示", "对应的应收名单不存在,请核查。");
  167. }
  168. }
  169. else {
  170. $("#Amount").val("");
  171. $("#ChargeTag").combobox("setValue", "-1");
  172. $("#ChargeAmount").val("");
  173. $("#ActualAmount").val("");
  174. $("#PaidAmount").val("");
  175. $("#PassDelayAmount").val("");
  176. $("#CanDelayAmount").val("");
  177. $("#ApplyDelayAmount").val("");
  178. $.messager.alert("系统提示", data.Message);
  179. }
  180. });
  181. }