You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

757 lines
29 KiB

1 year ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/head-admin :: head}"></head>
  4. <style>
  5. .card-body table {
  6. width: 100%;
  7. padding: 100px;
  8. }
  9. .card-body th,
  10. td {
  11. padding: 8px;
  12. text-align: left;
  13. }
  14. .amount-cell {
  15. text-align: right;
  16. padding-right: 1rem;
  17. /* Adjust padding as needed */
  18. }
  19. .table {
  20. width: 100% !important;
  21. }
  22. </style>
  23. <body>
  24. <!-- Page Container -->
  25. <div id="page-container"
  26. class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
  27. <!-- Sidebar Nav-->
  28. <nav th:replace="~{fragments/nav-admin :: nav}"></nav>
  29. <!-- END Sidebar -->
  30. <!-- Header -->
  31. <header th:replace="~{fragments/header-admin :: header}"></header>
  32. <!-- END Header -->
  33. <!-- Main Container -->
  34. <main id="main-container">
  35. <div class="block-header block-header-default">
  36. <h3 class="block-title"> List of Settlement Rejected</h3>
  37. </div>
  38. <div class="block-content p-0">
  39. <div class="p-sm-4 p-0">
  40. <div class="table-responsive">
  41. <table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="rejectedsettlementlist">
  42. <thead class="thead-light">
  43. <tr>
  44. <th>S.no</th>
  45. <th>Zone</th>
  46. <th>Division</th>
  47. <th>Hall Name</th>
  48. <th>Booking Id</th>
  49. <th>Booking Date</th>
  50. <th>Settlement Id</th>
  51. <th>Settlement Rejected Date</th>
  52. <th>Deposit Amount</th>
  53. <th>Collection Amount</th>
  54. <th>Refunded Amount</th>
  55. <th>Status</th>
  56. <th>Action</th>
  57. </tr>
  58. </thead>
  59. <tbody>
  60. <!--<tbody th:each="registration, i : ${registrations}">-->
  61. <!--<tr>-->
  62. <tr th:each="settlement, rowStat : ${rejectSettlementlist}">
  63. <!--<td class="text-center" th:text="${i.index + 1}"></td>-->
  64. <td class="text-center" th:text="${rowStat.index + 1}"></td>
  65. <td class="text-center" th:text="${settlement.hallDetails.zone}"></td>
  66. <td class="text-center" th:text="${settlement.hallDetails.division}"></td>
  67. <td class="text-center" th:text="${settlement.hallDetails.hallName}"></td>
  68. <td class="text-center" th:text="${settlement.bookingId}"></td>
  69. <td class="text-center" th:text="${settlement.bookingDate}"></td>
  70. <td class="text-center" th:text="${settlement.settlement.settlementId}"></td>
  71. <td class="text-center" th:text="${settlement.settlement.updatedDate}"></td>
  72. <td class="text-center" th:text="${settlement.depositAmount}"></td>
  73. <td class="text-center" th:text="${settlement.settlement.collectionPending}"></td>
  74. <td class="text-center" th:text="${settlement.settlement.refundedAmount}"></td>
  75. <td class="text-center" th:text="${settlement.refundStatus}"></td>
  76. <td>
  77. <p>
  78. <span class="badge bg-warning" style="cursor: pointer;"
  79. th:onclick="rejected([[${settlement.settlement.settlementId}]])">View</span>
  80. </p>
  81. </td>
  82. </tr>
  83. </tbody>
  84. </table>
  85. </div>
  86. </div>
  87. </div>
  88. </main>
  89. <!--modal for Rejected-->
  90. <div class="modal fade backdrop" id="rejectSettlementForm" data-backdrop="static" tabindex="-1" role="dialog"
  91. aria-labelledby="staticBackdropLabel" aria-hidden="true">
  92. <div class="modal-dialog modal-lg" role="document">
  93. <div class="modal-content">
  94. <form id="ownform" onsubmit="return rejectsubmit();">
  95. <div class="block block-rounded block-themed block-transparent mb-0">
  96. <div class="block-header bg-primary-dark">
  97. <h3 class="block-title" id="2mtitle">Settlement Information</h3>
  98. <div class="block-options">
  99. <button type="button" class="btn-block-option" data-bs-dismiss="modal"
  100. aria-label="Close">
  101. <i class="fa fa-fw fa-times"></i>
  102. </button>
  103. </div>
  104. </div>
  105. <div class="block-content row">
  106. <div class="col-md-12 col-lg-12 col-sm-12">
  107. <input type="hidden" class="form-control text-center" name="settlementid"
  108. id="settlementid" disabled />
  109. <div class="card-body">
  110. <table>
  111. <tr>
  112. <th colspan="10" style="background-color: #f2f2f2;">User Details</th>
  113. </tr>
  114. <tr>
  115. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Name:
  116. </th>
  117. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  118. id="td_userName"></td>
  119. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Mobile Number:
  120. </th>
  121. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  122. id="td_mobileNumber"></td>
  123. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Type:
  124. </th>
  125. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  126. id="td_usertype"></td>
  127. </tr>
  128. <tr>
  129. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Address:
  130. </th>
  131. <td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  132. id="td_useraddress"></td>
  133. </tr>
  134. <input type="hidden" class="form-control text-center" name="bookingid"
  135. id="bookingid" disabled />
  136. <tr>
  137. <th colspan="10" style="background-color: #f2f2f2;">Hall Details</th>
  138. </tr>
  139. <tr>
  140. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Hall Name:
  141. </th>
  142. <td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  143. id="td_hallName"></td>
  144. </tr>
  145. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Hall Address:</th>
  146. <td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  147. id="td_halladdress"></td>
  148. </tr>
  149. <tr>
  150. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Caretaker
  151. Name:</th>
  152. <td colspan="2" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  153. id="td_caretakername"></td>
  154. <th style="padding: 0.45rem 0.45rem;font-weight: normal;">Caretaker
  155. Mobile Number:</th>
  156. <td colspan="2" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  157. id="td_caretakermobileNumber"></td>
  158. </tr>
  159. </table>
  160. </div>
  161. </div>
  162. <div class="col-md-12 col-lg-12 col-sm-12">
  163. <input type="hidden" class="form-control text-center" name="settlementid"
  164. id="settlementid" disabled />
  165. <div class="card-body">
  166. <table>
  167. <tr>
  168. <th colspan="4" style="background-color: #f2f2f2;">Booking
  169. Details (Booking Id:-<span id="booking_id"
  170. style="color:blue"></span>)</th>
  171. </tr>
  172. <tr>
  173. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Booking Date:
  174. </th>
  175. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  176. id="td_bookingDate"></td>
  177. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit Amout:
  178. </th>
  179. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  180. id="td_depositeAmount"></td>
  181. </tr>
  182. <tr>
  183. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Date:
  184. </th>
  185. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  186. id="td_startDate"></td>
  187. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Hall Amount:
  188. </th>
  189. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  190. id="td_hallAmount"></td>
  191. </tr>
  192. <tr>
  193. <th style="padding: 0.45rem 0.45rem;font-weight: normal">END
  194. Date:</th>
  195. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  196. id="td_endDate"></td>
  197. <th style="padding: 0.45rem 0.45rem;font-weight: normal">GST @18%:</th>
  198. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  199. id="td_gst"></td>
  200. </tr>
  201. <tr>
  202. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Starting Slot:
  203. </th>
  204. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  205. id="td_startingSlot"></td>
  206. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Total Amount:
  207. </th>
  208. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  209. id="td_totalAmount"></td>
  210. </tr>
  211. <tr>
  212. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Ending Slot:
  213. </th>
  214. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
  215. id="td_endingSlot"></td>
  216. </tr>
  217. <tr>
  218. <th colspan="4" style="background-color: #f2f2f2;">EB
  219. Details</th>
  220. </tr>
  221. <tr>
  222. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:</th>
  223. <td class="fw-semibold"
  224. style="padding: 0.45rem 0.45rem;text-align:center" id="td_EBNumber">
  225. </td>
  226. <th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per
  227. Unit:</th>
  228. <td class="fw-semibold"
  229. style="padding: 0.45rem 0.45rem;text-align:right;"
  230. id="td_ebamountperunit"></td>
  231. </tr>
  232. <tr>
  233. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:
  234. </th>
  235. <td class="fw-semibold"
  236. style="padding: 0.45rem 0.45rem;text-align:center;"
  237. id="td_startingReading"></td>
  238. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:
  239. </th>
  240. <td class="fw-semibold"
  241. style="padding: 0.45rem 0.45rem;text-align:right;" id="td_usedunit">
  242. </td>
  243. </tr>
  244. <tr>
  245. <th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:
  246. </th>
  247. <td class="fw-semibold"
  248. style="padding: 0.45rem 0.45rem;text-align:center;"
  249. id="td_endingReading"></td>
  250. <th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount:</th>
  251. <td class="fw-semibold"
  252. style="padding: 0.45rem 0.45rem;text-align:right;"
  253. id="td_electricityamount"></td>
  254. </tr>
  255. </table>
  256. </div>
  257. </div>
  258. <div id="damageDetails" style="margin-bottom:-17px"></div>
  259. <div class="col-md-12 col-lg-12 col-sm-12">
  260. <div class="card-body">
  261. <table>
  262. <tr>
  263. <th colspan="2" style="background-color: #f2f2f2;font-weight: normal">
  264. Amount to be Refunded</th>
  265. </tr>
  266. <tr>
  267. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit
  268. Amount:</th>
  269. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  270. id="td_depositeamountforrefund">0</td>
  271. </tr>
  272. <tr>
  273. <th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount:</th>
  274. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  275. id="td_ebAmount"></td>
  276. </tr>
  277. <tr>
  278. <th style="padding: 0.45rem 0.45rem;font-weight: normal">Damage Amount:
  279. </th>
  280. <td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
  281. id="td_damage"></td>
  282. </tr>
  283. <tr id="pendingcolumn">
  284. <th id="th_settel_label"
  285. style="padding: 0.45rem 0.45rem; background-color: #f2f2f2;font-weight: normal">
  286. Collection Pending Amount:</th>
  287. <td class="fw-semibold amount-cell"
  288. style="padding: 0.45rem 0.45rem; color: green;" id="td_pending_amt">
  289. 0</td>
  290. </tr>
  291. <tr>
  292. <th
  293. style="padding: 0.45rem 0.45rem; background-color: #f2f2f2;font-weight: normal">
  294. Actual refundable Amount:</th>
  295. <td class="fw-semibold amount-cell"
  296. style="padding: 0.45rem 0.45rem; color: green;" id="td_settel_amt">0
  297. </td>
  298. </tr>
  299. </table>
  300. </div>
  301. </div>
  302. <!-- DD detail -->
  303. <div id="ddTableContainer"></div>
  304. </div>
  305. <div class="block-content block-content-full text-end bg-body" id="mbutton2">
  306. <button type="button" class="btn btn-sm btn-alt-secondary"
  307. data-bs-dismiss="modal">Close</button>
  308. </div>
  309. </div>
  310. </form>
  311. </div>
  312. </div>
  313. </div>
  314. <div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
  315. aria-hidden="true">
  316. <div class="modal-dialog modal-lg" role="document">
  317. <div class="modal-content">
  318. <div class="modal-header">
  319. <h5 class="modal-title" id="fileModalLabel">File Preview</h5>
  320. <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
  321. <span aria-hidden="true">&times;</span>
  322. </button>
  323. </div>
  324. <div class="modal-body">
  325. <embed id="filePreview" src="" width="100%" height="600px">
  326. </div>
  327. <div class="modal-footer">
  328. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
  329. </div>
  330. </div>
  331. </div>
  332. </div>
  333. <!-- Footer -->
  334. <footer th:replace="~{fragments/footer2 :: footer}"></footer>
  335. <!-- END Footer -->
  336. </div>
  337. <!-- Scripts -->
  338. <div th:replace="~{fragments/resetpassword :: div}"></div>
  339. <script th:replace="~{fragments/loginscript :: script}"></script>
  340. <script>
  341. //script to open pending form
  342. $(document).ready(function () {
  343. // DataTables buttons configuration
  344. var buttons = [
  345. {
  346. extend: 'pageLength',
  347. className: 'btn btn-primary'
  348. },
  349. {
  350. title: 'Data export',
  351. extend: 'copyHtml5',
  352. text: 'Copy',
  353. className: 'btn btn-primary',
  354. id: 'copyBtn'
  355. },
  356. {
  357. extend: 'excelHtml5',
  358. text: 'Excel',
  359. className: 'btn btn-primary',
  360. id: 'excelBtn'
  361. },
  362. {
  363. extend: 'csvHtml5',
  364. text: 'CSV',
  365. className: 'btn btn-primary',
  366. id: 'csvBtn'
  367. },
  368. {
  369. extend: 'pdfHtml5',
  370. text: 'PDF',
  371. className: 'btn btn-primary',
  372. id: 'pdfBtn'
  373. }
  374. ];
  375. // Initialize DataTable for each tab on tab shown event
  376. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  377. var targetTable = $(e.target).attr('href'); // activated tab
  378. $(targetTable).find('.dataTable').DataTable().columns.adjust();
  379. });
  380. // Initialize DataTable for Settlement Approved tab
  381. $('#rejectedsettlementlist').DataTable({
  382. dom: 'Bftip',
  383. columnDefs: [
  384. {targets: 'no-sort', orderable: false}
  385. ],
  386. lengthMenu: [
  387. [50, 100, 200, 500, -1],
  388. ['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
  389. ],
  390. buttons: buttons,
  391. responsive: true,
  392. searching: true,
  393. select: false,
  394. processing: false,
  395. // Set width to 100%
  396. "autoWidth": true
  397. });
  398. });
  399. function rejected(settlementId) {
  400. $.ajax({
  401. type: "GET",
  402. url: '/communityhall/api/officer/getSettlementList',
  403. data: {
  404. 'settlementsid': settlementId
  405. },
  406. success: function (x) {
  407. // console.log(x);
  408. showSettlementInfo(x)
  409. showDamageDetails(x);
  410. }
  411. });
  412. }
  413. function showSettlementInfo(list) {
  414. // console.log(list); // Log the damageList array
  415. // console.log(list.damageList[0]);
  416. $('#rejectSettlementForm').modal({
  417. backdrop: 'static',
  418. keyboard: false
  419. });
  420. $('#rejectSettlementForm').modal('show');
  421. document.getElementById("settlementid").value = list.settlement.settlementId;
  422. document.getElementById("td_userName").innerHTML = list.users.name;
  423. document.getElementById("td_mobileNumber").innerHTML = list.users.mobileNo;
  424. document.getElementById("td_usertype").innerHTML = list.users.usertype;
  425. var userDetails = list.users;
  426. var userDetailsString =
  427. userDetails.doorNo + ", " +
  428. userDetails.street + ", " +
  429. userDetails.area + ", " +
  430. userDetails.location + " ,Chennai- " +
  431. userDetails.pinCode;
  432. document.getElementById("td_useraddress").innerHTML = userDetailsString;
  433. document.getElementById("td_hallName").innerHTML = list.hallDetails.hallName;
  434. var hallDetails = list.hallDetails;
  435. var hallDetailsString =
  436. hallDetails.doorNo + ", " +
  437. hallDetails.street + ", " +
  438. hallDetails.area + ", " +
  439. hallDetails.city + "- " +
  440. hallDetails.pinCode;
  441. document.getElementById("td_halladdress").innerHTML = hallDetailsString;
  442. document.getElementById("td_caretakername").innerHTML = list.hallDetails.hallInchargeName;
  443. document.getElementById("td_caretakermobileNumber").innerHTML = list.hallDetails.hallInchargeMobno;
  444. document.getElementById("td_bookingDate").innerHTML = list.bookingDate;
  445. document.getElementById("td_depositeAmount").innerHTML = '₹ ' + parseFloat(list.depositAmount).toFixed(2);
  446. document.getElementById("td_hallAmount").innerHTML = '₹ ' + parseFloat(list.hallAmount).toFixed(2);
  447. // Calculate GST and total amount
  448. var gstAmount = (parseFloat(list.hallAmount) * (list.hallDetails.gst/100)).toFixed(2);
  449. var totalAmount = parseFloat(list.amountReceived).toFixed(2);
  450. document.getElementById("td_gst").innerHTML = '₹ ' + gstAmount;
  451. document.getElementById("td_totalAmount").innerHTML = '₹ ' + totalAmount;
  452. document.getElementById("td_startDate").innerHTML = list.startDate;
  453. document.getElementById("td_endDate").innerHTML = list.endDate;
  454. document.getElementById("booking_id").innerHTML = list.bookingId;
  455. function getTimeSlot(slotValue) {
  456. var timeSlot;
  457. var trimmedSlotValue = String(slotValue).trim(); // Convert to string and then trim
  458. if (trimmedSlotValue === '1') {
  459. timeSlot = 'Morning';
  460. } else if (trimmedSlotValue === '2') {
  461. timeSlot = 'Evening';
  462. } else {
  463. timeSlot = 'Unknown';
  464. }
  465. return timeSlot;
  466. }
  467. document.getElementById("td_startingSlot").innerHTML = getTimeSlot(list.startingSlot);
  468. document.getElementById("td_endingSlot").innerHTML = getTimeSlot(list.endingSlot);
  469. document.getElementById("td_EBNumber").innerHTML = list.hallDetails.ebNumber;
  470. document.getElementById("td_startingReading").innerHTML = list.ebDetails.startingReading;
  471. document.getElementById("td_endingReading").innerHTML = list.ebDetails.endingReading;
  472. document.getElementById("td_usedunit").innerHTML = list.ebDetails.usedUnit;
  473. document.getElementById("td_ebamountperunit").innerHTML = '₹ ' + parseFloat(list.hallDetails.ebCostPerUnit).toFixed(2);
  474. document.getElementById("td_depositeamountforrefund").innerHTML = '₹ ' + parseFloat(list.depositAmount).toFixed(2);
  475. document.getElementById("td_electricityamount").innerHTML = '₹ ' + parseFloat(list.ebDetails.ebAmount).toFixed(2);
  476. document.getElementById("td_ebAmount").innerHTML = '₹ ' + parseFloat(list.ebDetails.ebAmount).toFixed(2);
  477. document.getElementById("td_damage").innerHTML = '₹ ' + parseFloat(list.settlement.damageAmount).toFixed(2);
  478. var eb_amt = parseFloat(list.ebDetails.ebAmount).toFixed(2);
  479. var deposit_amt = parseFloat(list.depositAmount).toFixed(2);
  480. var tem_total = (deposit_amt - eb_amt).toFixed(2);
  481. $("#td_settel_amt").html(tem_total);
  482. }
  483. function showDamageDetails(data) {
  484. var damageFieldContainer = $('#damageDetails');
  485. damageFieldContainer.empty();
  486. // Create a div for table responsiveness
  487. var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '0px');
  488. // Create table with similar classes and styles to the modal table
  489. var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '97%', 'border-color': 'black', 'border-top-color': 'white'});
  490. var thead = $('<thead>').addClass('thead-light');
  491. var tbody = $('<tbody>');
  492. // Create Damage Details header row
  493. var headerRow = $('<tr>').appendTo(thead);
  494. $('<th>').attr('colspan', '6').text('Damage Details (if any)').css({
  495. 'padding': '0.45rem 0.45rem',
  496. 'background-color': '#f2f2f2',
  497. 'font-weight': 'bold',
  498. 'color': 'black',
  499. }).appendTo(headerRow);
  500. // Create table header row
  501. var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
  502. $('<th>').text('S.No').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  503. $('<th>').text('Asset Name').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  504. $('<th>').text('Damage Img').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  505. $('<th>').text('Cost').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  506. $('<th>').text('Qty').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  507. $('<th>').text('Amount').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
  508. var totalAmount = 0;
  509. if (data.damageList.length === 0) {
  510. var row = $('<tr>').appendTo(tbody);
  511. $('<td>').attr('colspan', '6').text('No Damaged Items').css({
  512. 'padding': '0.45rem 0.45rem',
  513. 'text-align': 'center',
  514. 'font-weight': 'bold',
  515. 'background-color': '#f2f2f2'
  516. }).appendTo(row);
  517. } else {
  518. $.each(data.damageList, function (index, detail) {
  519. var row = $('<tr>').appendTo(tbody);
  520. $('<td>').text(index + 1).css({
  521. 'padding': '0.45rem 0.45rem',
  522. 'text-align': 'center'
  523. }).appendTo(row);
  524. $('<td>').text(detail.assetName).css({
  525. 'padding': '0.45rem 0.45rem',
  526. 'text-align': 'center'
  527. }).appendTo(row);
  528. var viewLink = $('<a>').attr('href', 'javascript:void(0)').text('View').on('click', function () {
  529. showDamageImage(detail.damageImageUrl);
  530. });
  531. $('<td>').css({
  532. 'padding': '0.45rem 0.45rem',
  533. 'text-align': 'center'
  534. }).append(viewLink).appendTo(row);
  535. var assetamt = (detail.assetAmount / detail.quantity).toFixed(2);
  536. $('<td>').text('₹ ' + assetamt).css({
  537. 'padding': '0.45rem 0.45rem',
  538. 'text-align': 'center'
  539. }).appendTo(row);
  540. $('<td>').text(detail.quantity).css({
  541. 'padding': '0.45rem 0.45rem',
  542. 'text-align': 'center'
  543. }).appendTo(row);
  544. var amount = detail.assetAmount;
  545. totalAmount += amount;
  546. $('<td>').text('₹ ' + amount.toFixed(2)).css({
  547. 'padding': '0.45rem 0.45rem',
  548. 'text-align': 'right'
  549. }).appendTo(row);
  550. });
  551. // Add row for total amount
  552. var totalRow = $('<tr>').appendTo(tbody);
  553. $('<td>').attr('colspan', '5').text('Total Amount').css({
  554. 'padding': '0.45rem 0.45rem',
  555. 'font-weight': 'bold',
  556. 'background-color': '#f2f2f2'
  557. }).appendTo(totalRow);
  558. $('<td>').text('₹ ' + totalAmount.toFixed(2)).css({
  559. 'padding': '0.45rem 0.45rem',
  560. 'text-align': 'right'
  561. }).appendTo(totalRow);
  562. $("#td_dam_amt").html('₹ ' + totalAmount.toFixed(2));
  563. }
  564. // Append the table elements to the container div
  565. table.append(thead, tbody);
  566. tableResponsiveDiv.append(table);
  567. damageFieldContainer.append(tableResponsiveDiv);
  568. var temp_total = parseFloat($("#td_settel_amt").html());
  569. var settleAmount = temp_total - totalAmount;
  570. var refundStatus = data.refundStatus;
  571. if (settleAmount < 0) {
  572. // console.log(settleAmount);
  573. $("#td_settel_amt").html(0.00);
  574. $("#pendingcolumn").show();
  575. $("#td_pending_amt").html('₹ ' + Math.abs(settleAmount).toFixed(2));
  576. $("#td_pending_amt").css("color", "red");
  577. $("#generatechallon").show();
  578. $("#uploadchallon").show();
  579. $("#approvebutton").prop("disabled", true);
  580. $("#rejectbutton").show();
  581. } else {
  582. $("#td_settel_amt").html('₹ ' + settleAmount.toFixed(2));
  583. $("#pendingcolumn").hide();
  584. $("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
  585. $("#generatechallon").hide();
  586. $("#uploadchallon").hide();
  587. }
  588. if (data.settlement.challonamount) {
  589. // Show the table containing ddnumber and challan image
  590. var challonTableContainer = $("#challonTableContainer"); // Assuming you have a div with this ID for the table
  591. challonTableContainer.empty(); // Clear any existing content
  592. challonTableContainer.show(); // Ensure the container is visible
  593. var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '-24px');
  594. // Create table with similar classes and styles to the modal table
  595. var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '100%', 'border-color': 'black', 'border-top-color': 'white'});
  596. var thead = $('<thead>').addClass('thead-light');
  597. var tbody = $('<tbody>');
  598. var headerRow = $('<tr>').appendTo(thead);
  599. $('<th>').attr('colspan', '6').text('Challan Details').css({
  600. 'padding': '0.45rem 0.45rem',
  601. 'background-color': '#f2f2f2',
  602. 'font-weight': 'bold',
  603. 'color': 'black',
  604. }).appendTo(headerRow);
  605. var columnRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
  606. //$('<th>').text('DD Number').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
  607. //$('<th>').text('DD Date').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
  608. $('<th>').text('Challan Number').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
  609. $('<th>').text('Challan Date').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
  610. $('<th>').text('Challan Image').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
  611. var row = $('<tr>').appendTo(tbody);
  612. //$('<td>').text(data.settlement.ddnumber).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
  613. //$('<td>').text(data.settlement.ddnumber).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
  614. $('<td>').text(data.settlement.challonnumber).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
  615. $('<td>').text(data.settlement.challonamount).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
  616. //$('<td>').text(data.settlement.dddate).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
  617. var challanImgLink = $('<a>').attr('href', 'javascript:void(0)').text('View Image').on('click', function () {
  618. showchallonimage(data.settlement.challon);
  619. });
  620. $('<td>').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).append(challanImgLink).appendTo(row);
  621. table.append(thead, tbody);
  622. challonTableContainer.append(table);
  623. // Hide all buttons
  624. $("#generatechallon").hide();
  625. $("#uploadchallon").hide();
  626. $("#approvebutton").prop("disabled", false);
  627. } else {
  628. // Hide the ddTableContainer if ddnumber is not present
  629. $("#challonTableContainer").hide();
  630. }
  631. if (data.settlement.ddnumber) {
  632. // Show the table containing ddnumber and challan image
  633. var ddTableContainer = $("#ddTableContainer"); // Assuming you have a div with this ID for the table
  634. ddTableContainer.empty(); // Clear any existing content
  635. ddTableContainer.show(); // Ensure the container is visible
  636. var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '-24px');
  637. // Create table with similar classes and styles to the modal table
  638. var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '100%', 'border-color': 'black', 'border-top-color': 'white'});
  639. var thead = $('<thead>').addClass('thead-light');
  640. var tbody = $('<tbody>');
  641. var headerRow = $('<tr>').appendTo(thead);
  642. $('<th>').attr('colspan', '6').text('DD Details').css({
  643. 'padding': '0.45rem 0.45rem',
  644. 'background-color': '#f2f2f2',
  645. 'font-weight': 'bold',
  646. 'color': 'black',
  647. }).appendTo(headerRow);
  648. var columnRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
  649. $('<th>').text('DD Number').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
  650. $('<th>').text('DD Date').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
  651. $('<th>').text('DD Amount').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
  652. var row = $('<tr>').appendTo(tbody);
  653. $('<td>').text(data.settlement.ddnumber).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
  654. $('<td>').text(data.settlement.ddamount).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
  655. $('<td>').text(data.settlement.dddate).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
  656. table.append(thead, tbody);
  657. ddTableContainer.append(table);
  658. // Hide all buttons
  659. $("#generatechallon").hide();
  660. $("#uploadchallon").hide();
  661. $("#approvebutton").prop("disabled", false);
  662. } else {
  663. // Hide the ddTableContainer if ddnumber is not present
  664. $("#ddTableContainer").hide();
  665. }
  666. }
  667. function showDamageImage(damageImageUrl) {
  668. document.getElementById('filePreview').src = damageImageUrl;
  669. $('#fileModal').modal('show');
  670. }
  671. function showchallonimage(challanImgLink){
  672. document.getElementById('filePreview').src = challanImgLink;
  673. $('#fileModal').modal('show');
  674. }
  675. </script>
  676. </body>
  677. </html>