Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .fixed-table {
- table-layout: fixed;
- }
- /* FOR CORPORATE DATA TABLE START */
- function format ( dataSource ) {
- var html = '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;" class="fixed-table table table-bordered">';
- for (var key in dataSource){
- html += '<tr>'+
- '<td>' + key +'</td>'+
- '<td>' + dataSource[key] +'</td>'+
- '</tr>';
- } return html += '</table>'; }
- var earnings_amendment_table = $('#earnings_amendment').DataTable({});
- // Add event listener for opening and closing details
- $('#earnings_amendment').on('click', 'td.details-control', function () {
- var tr = $(this).closest('tr');
- var row = earnings_amendment_table.row(tr);
- if (row.child.isShown()) {
- // This row is already open - close it
- row.child.hide();
- tr.removeClass('shown');
- } else {
- // Open this row
- row.child(format({
- 'Particulars : ' : tr.data('key-1'),
- 'Account Type : ' : tr.data('key-2'),
- 'Date Due : ' : tr.data('key-3')
- })).show();
- tr.addClass('shown');
- } });
- /* FOR CORPORATE DATA TABLE END */
- <div class="box-body">
- <table id="earnings_amendment" class="fixed-table table table-bordered">
- <thead>
- <th></th>
- <th>Reference ID.</th>
- <th>Reference No.</th>
- <th>Employee Name</th>
- <th>Account Title</th>
- <th>Amount</th>
- <th>Activity</th>
- <th>Posted By</th>
- <th>Validated By</th>
- <th>Noted By</th>
- <th>Tools</th>
- </thead>
- <tbody>
- <?php
- $sql = "
- select earningsamendment.particulars,earningsamendment.accounttype,earningsamendment.datedue,
- employeemasterfile.lastname,employeemasterfile.firstname,employeemasterfile.middlename,
- referenceno, accounttitle, max(credit) as credit, max(debit) as debit, max(referenceid) as referenceid, earningsamendment.employeeidno,
- earningsamendment.postedby, approvedby, notedby
- from earningsamendment
- left join employeemasterfile on earningsamendment.employeeidno= employeemasterfile.employeeidno
- WHERE earningsamendment.accounttitle='$accounttitle' AND
- YEAR(earningsamendment.dateposted)='$year'
- group by referenceno, earningsamendment.employeeidno, accounttitle, earningsamendment.postedby, approvedby,
- notedby,employeemasterfile.lastname,employeemasterfile.firstname,employeemasterfile.middlename,
- earningsamendment.particulars,earningsamendment.accounttype,earningsamendment.datedue
- ";
- $query = sqlsrv_query($conn, $sql, array(), array("Scrollable" => SQLSRV_CURSOR_KEYSET));
- while($row = sqlsrv_fetch_array($query, SQLSRV_FETCH_ASSOC)){
- echo "
- <tr data-key-1='".$row['particulars']."' data-key-2='".$row['accounttype']."' data-key-3='".$row['datedue']."'>
- <td class='details-control'></td>
- <td>".$row['referenceid']."</td>
- <td>".$row['referenceno']."</td>
- <td>".$row['lastname']." ".$row['middlename']." ".$row['firstname']."</td>
- <td>".$row['accounttitle']."</td>
- <td>".$row['credit']."</td>
- <td>".(($row['debit']==$row['credit']) ? 'PAID' : 'FOR TAKE UP' )."</td>
- <td>".$row['postedby']."</td>
- <td>".$row['approvedby']."</td>
- <td>".$row['notedby']."</td>
- <td>
- <button class='btn btn-success btn-sm edit btn-flat' data-id='".$row['referenceid']."'><i class='fa fa-edit'></i> Preview</button>
- <button class='btn btn-danger btn-sm delete btn-flat' data-id='".$row['referenceid']."'><i class='fa fa-trash'></i> Delete</button>
- " ?>
- <?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> "; } ?>
- <?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> "; } ?>
- <?php "</td>
- </tr>
- ";
- }
- ?>
- </tbody>
- </table>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement