Editando: project_tran_reports.php
<?php $page = 'Transaction Reports'; $page_icon = ""; $account = "active"; include("check.php"); include 'header.php'; $project_id = @$_REQUEST['pid']; $project_name = @$_REQUEST['name']; ?> <!-- PAGE CONTENT WRAPPER --> <div class="page-content-wrap"> <div class="row"> <div class="col-md-12"> <!-- START DEFAULT DATATABLE --> <div class="panel panel-colorful"> <div class="panel-heading ui-draggable-handle modal-header"> <h3 class="panel-title"> <a href="javascript:void(0)" onclick="history.back(-1)" class="btn btn-primary" style="background-color: #000; color: #fff;"> <span class="fa fa-arrow-left"></span> </a> Project Wise Transaction Reports- <b style="text-transform: uppercase"> <?php echo $project_name; ?></b></h3> <!-- <div class="pull-right"> <a href="javascript:void(0)" data-toggle="modal" data-target="#modal_addaccountform" class="btn btn-primary"><i class="fa fa-plus"></i> Add Account</a> </div>--> <!-- <ul class="panel-controls" style="margin-right: 5px;"> <li><a href="javascript:void(0);" class="panel-refresh"><span class="fa fa-refresh"></span></a></li> </ul>--> <div class="btn-group pull-right"> <button class="btn btn-danger dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bars"></i> Export Data</button> <ul class="dropdown-menu"> <li><a href="#" onClick ="$('#project_transaction').tableExport({type: 'csv', escape: 'false'});"><img src='img/icons/csv.png' width="24"/> CSV</a></li> <li><a href="#" onClick ="$('#project_transaction').tableExport({type: 'txt', escape: 'false'});"><img src='img/icons/txt.png' width="24"/> TXT</a></li> <li class="divider"></li> <li><a href="#" onClick ="$('#project_transaction').tableExport({type: 'excel', escape: 'false'});"><img src='img/icons/xls.png' width="24"/> XLS</a></li> <li><a href="#" onClick ="$('#project_transaction').tableExport({type: 'doc', escape: 'false'});"><img src='img/icons/word.png' width="24"/> Word</a></li> <!--<li><a href="#" onClick ="$('#emp_account').tableExport({type: 'powerpoint', escape: 'false'});"><img src='img/icons/ppt.png' width="24"/> PowerPoint</a></li>--> <li class="divider"></li> <li><a href="#" onClick ="$('#project_transaction').tableExport({type: 'png', escape: 'false'});"><img src='img/icons/png.png' width="24"/> PNG</a></li> <!--<li><a href="#" onClick ="$('#emp_account').tableExport({type: 'pdf', escape: 'false'});"><img src='img/icons/pdf.png' width="24"/> PDF</a></li>--> </ul> </div> </div> <div class="panel-body"> <table id="project_transaction" class="table datatable table-hover table-striped"> <thead> <tr> <th style="width: 50px;">#</th> <th style="width: 90px">Date</th> <th>Project Name</th> <th>Remark</th> <th>Title</th> <th>Title | Sub | Emp</th> <th>Payment Method</th> <th style="width: 90px">Debit</th> <th style="width: 90px">Credit</th> <th style="width: 90px">Balance</th> </tr> </thead> <tbody> <?php $i = 1; $grand_debit_total=0; $grand_credit_total=0; // $result = mysql_query("select c.name as c_name, s.name as s_name, p.* FROM product_master as p LEFT JOIN category as c ON p.cat_id = c.cat_id LEFT JOIN sub_category as s ON c.cat_id = s.cat_id where (p.name LIKE '$search%') or (c.name LIKE '$search%') ORDER BY p.pid DESC"); $total = 0; if($project_name=='all'){ $str = "(SELECT ecid as id,amounts,narration,status,payment_date,eid as estatus,p_method as pmothod, title_material as title,pid as pid_view,'0' as supplier_id FROM emp_accounts where `status`='Debit') UNION " . "(SELECT c.cid as id,c.amounts,c.narration,c.status,c.payment_date,em.emp_sub_conta as estatus,c.p_method as pmothod,c.status as title,c.pid as pid_view,s.name as supplier_id FROM co_accounts as c LEFT JOIN supplier as s ON s.supplier_id=c.supplier_id LEFT JOIN employees as em ON em.eid=c.eid where c.other!='company') ORDER BY payment_date DESC,id DESC"; }else{ $str = "(SELECT ecid as id,amounts,narration,status,payment_date,eid as estatus,p_method as pmothod, title_material as title,pid as pid_view,'0' as supplier_id FROM emp_accounts where `status`='Debit' and `pid`='$project_id') UNION " . "(SELECT c.cid as id,c.amounts,c.narration,c.status,c.payment_date,em.emp_sub_conta as estatus,c.p_method as pmothod,c.status as title,c.pid as pid_view,s.name as supplier_id FROM co_accounts as c LEFT JOIN supplier as s ON s.supplier_id=c.supplier_id LEFT JOIN employees as em ON em.eid=c.eid where c.other!='company' and (c.pid='$project_id')) ORDER BY payment_date DESC,id DESC"; } // $str2 = "SELECT * FROM `co_accounts` where `pid`='$project_id'"; // $select_ac = mysql_query("select a.* from emp_accounts as a FULL JOIN co_accounts as ca ON ca.pid = a.pid where a.pid='$project_id' ORDER BY a.payment_date DESC"); $select_ac = mysql_query($str); // $select_ac2 = mysql_query($str2); // $row = mysql_fetch_array($select_ac); // $row2 = mysql_fetch_array($select_ac2); // array_merge($row,$row2); while ($row = mysql_fetch_array($select_ac)) { $pid_view=$row['pid_view']; $result_expences_staff = mysql_query("SELECT * FROM project where pid='$pid_view'"); while ($row_expences_staff = mysql_fetch_array($result_expences_staff)) { $pro_name = $row_expences_staff['name']; } // if ($row['estatus']) { ?> <tr id="baccount<?php echo $row['cid']; ?>"> <td><?php echo $i; ?></td> <td><?php echo date("d-m-Y", strtotime($row['payment_date'])); ?></td> <td><?php echo $pro_name; ?></td> <td><?php if(!empty($row['supplier_id'])){ echo $row['narration']; }else{ @$pieces = @explode("-", $row['narration']); echo @$pieces[0]; } ?> </td> <td><?php if(!empty($row['supplier_id'])){ echo $row['supplier_id']; }else{ @$pieces = @explode("-", $row['narration']); echo @$pieces[1]; // piece1 // echo @$pieces[1]; // piece2 } ?> </td> <td><?php if($row['title']=='Debit' or $row['title']=='Credit'){ echo ''; }else{ echo $row['title']; } @$pieces = @explode("-", $row['narration']); echo @$pieces[2]; // piece1 // echo @$pieces[1]; // piece2 ?> </td> <td><?php echo $row['pmothod']; ?> </td> <?php if ($row['status'] == "Debit") { ?> <td><?php echo $row['amounts']; $total = $total - $row['amounts']; $grand_debit_total=$grand_debit_total+$row['amounts']; ?></td> <td>-</td> <?php } else { ?> <td>-</td> <td><?php echo $row['amounts']; $total = $total + $row['amounts']; $grand_credit_total=$grand_credit_total+$row['amounts']; ?></td> <?php } ?> <td><?php echo $total; ?></td> </tr> <?php $i++; // } } ?> </tbody> <tfoot> <tr style="background-color: #000; color:#fff"> <th colspan='7'>#</th> <th style="width: 90px"><?php echo $grand_debit_total; ?></th> <th style="width: 90px"><?php echo $grand_credit_total; ?></th> <th style="width: 90px"><?php echo $total; ?></th> </tr> </tfoot> </table> </div> </div> <!-- END DEFAULT DATATABLE --> </div> </div> </div> <!-- PAGE CONTENT WRAPPER --> <!-- VIEW & EDIT PROJECT MODALS --> <?php include 'footer.php'; ?>
Cancelar
Kerym Chaeceran