Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.77 KB | None | 0 0
  1. .fixed-table {
  2. table-layout: fixed;
  3. }
  4.  
  5. /* FOR CORPORATE DATA TABLE START */
  6. function format ( dataSource ) {
  7. var html = '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;" class="fixed-table table table-bordered">';
  8. for (var key in dataSource){
  9. html += '<tr>'+
  10. '<td>' + key +'</td>'+
  11. '<td>' + dataSource[key] +'</td>'+
  12. '</tr>';
  13. } return html += '</table>'; }
  14. var earnings_amendment_table = $('#earnings_amendment').DataTable({});
  15.  
  16. // Add event listener for opening and closing details
  17. $('#earnings_amendment').on('click', 'td.details-control', function () {
  18. var tr = $(this).closest('tr');
  19. var row = earnings_amendment_table.row(tr);
  20.  
  21. if (row.child.isShown()) {
  22. // This row is already open - close it
  23. row.child.hide();
  24. tr.removeClass('shown');
  25. } else {
  26. // Open this row
  27. row.child(format({
  28. 'Particulars : ' : tr.data('key-1'),
  29. 'Account Type : ' : tr.data('key-2'),
  30. 'Date Due : ' : tr.data('key-3')
  31. })).show();
  32. tr.addClass('shown');
  33. } });
  34. /* FOR CORPORATE DATA TABLE END */
  35.  
  36. <div class="box-body">
  37. <table id="earnings_amendment" class="fixed-table table table-bordered">
  38. <thead>
  39. <th></th>
  40. <th>Reference ID.</th>
  41. <th>Reference No.</th>
  42. <th>Employee Name</th>
  43. <th>Account Title</th>
  44. <th>Amount</th>
  45. <th>Activity</th>
  46. <th>Posted By</th>
  47. <th>Validated By</th>
  48. <th>Noted By</th>
  49. <th>Tools</th>
  50. </thead>
  51. <tbody>
  52. <?php
  53. $sql = "
  54. select earningsamendment.particulars,earningsamendment.accounttype,earningsamendment.datedue,
  55. employeemasterfile.lastname,employeemasterfile.firstname,employeemasterfile.middlename,
  56. referenceno, accounttitle, max(credit) as credit, max(debit) as debit, max(referenceid) as referenceid, earningsamendment.employeeidno,
  57. earningsamendment.postedby, approvedby, notedby
  58. from earningsamendment
  59. left join employeemasterfile on earningsamendment.employeeidno= employeemasterfile.employeeidno
  60. WHERE earningsamendment.accounttitle='$accounttitle' AND
  61. YEAR(earningsamendment.dateposted)='$year'
  62. group by referenceno, earningsamendment.employeeidno, accounttitle, earningsamendment.postedby, approvedby,
  63. notedby,employeemasterfile.lastname,employeemasterfile.firstname,employeemasterfile.middlename,
  64. earningsamendment.particulars,earningsamendment.accounttype,earningsamendment.datedue
  65. ";
  66. $query = sqlsrv_query($conn, $sql, array(), array("Scrollable" => SQLSRV_CURSOR_KEYSET));
  67. while($row = sqlsrv_fetch_array($query, SQLSRV_FETCH_ASSOC)){
  68. echo "
  69. <tr data-key-1='".$row['particulars']."' data-key-2='".$row['accounttype']."' data-key-3='".$row['datedue']."'>
  70. <td class='details-control'></td>
  71. <td>".$row['referenceid']."</td>
  72. <td>".$row['referenceno']."</td>
  73. <td>".$row['lastname']." ".$row['middlename']." ".$row['firstname']."</td>
  74. <td>".$row['accounttitle']."</td>
  75. <td>".$row['credit']."</td>
  76. <td>".(($row['debit']==$row['credit']) ? 'PAID' : 'FOR TAKE UP' )."</td>
  77. <td>".$row['postedby']."</td>
  78. <td>".$row['approvedby']."</td>
  79. <td>".$row['notedby']."</td>
  80. <td>
  81. <button class='btn btn-success btn-sm edit btn-flat' data-id='".$row['referenceid']."'><i class='fa fa-edit'></i> Preview</button>
  82.  
  83. <button class='btn btn-danger btn-sm delete btn-flat' data-id='".$row['referenceid']."'><i class='fa fa-trash'></i> Delete</button>
  84.  
  85. " ?>
  86. <?php if (empty($row['approvedby'])) { echo " <button class='btn btn-warning btn-sm approve btn-flat' data-id='".$row['referenceid']."'><i class='fa fa-check-square-o'></i> Approve</button> "; } ?>
  87.  
  88. <?php if (empty($row['notedby'])) { echo " <button class='btn btn-primary btn-sm note btn-flat' data-id='".$row['referenceid']."'><i class='fa fa-arrow-circle-right'></i> Note</button> "; } ?>
  89.  
  90. <?php "</td>
  91. </tr>
  92. ";
  93. }
  94. ?>
  95. </tbody>
  96. </table>
  97. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement