Joywork/ajax/getGridTableSources.php
2026-05-22 21:21:54 +03:00

134 lines
6.6 KiB
PHP

<?php
require_once($_SERVER['DOCUMENT_ROOT']."/config.php");
?>
<div class="">
<div id="export_stat_sources" style="margin-left: 20px; " class="crm__new-client">
<a style="padding: 3px 15px 6px; background: -moz-linear-gradient(top, #fff, #f5f5f5);
background: -webkit-linear-gradient(top, #fff, #f5f5f5);
background: -o-linear-gradient(top, #fff, #f5f5f5);
background: -ms-linear-gradient(top, #fff, #f5f5f5);
background: linear-gradient(top, #fff, #f5f5f5);
cursor: pointer;
position: absolute;
margin-top: 17px;
border: 1px solid #d0d0d0; border-bottom: 1px solid #d0d0d0;" href="javascript:{}" class="jw__g-button">Экспорт в Excel</a>
</div>
<div class="buttons-toolbar" style="padding-top: 15px">
</div>
<!-- <div id="table-sources-keep-selection-fixed" class="bootstrap-table bootstrap4" style="display:none; position:absolute;z-index: 999;">
<div class="fixed-table-container fixed-height" style="border-bottom: 0;">
<table style="border-bottom: 0px;" class="table table-bordered table-hover">
<thead style="border-bottom: 0px;"></thead>
</table>
</div>
<div class="fixed-table-body">
<table class="table table-bordered table-hover">
<tbody>
</tbody>
</table>
</div>
</div> -->
<table class="table"
id="table-sources-keep-selection"
data-locale="ru-RU"
data-height="650"
data-show-refresh="true"
data-show-columns="true"
data-buttons-toolbar=".buttons-toolbar"
data-show-columns-toggle-all="true"
data-ajax="ajaxRequestSource"
data-loading-template="loadingTemplate"
data-show-footer="true"
>
<thead>
<?php
$agency_id = 0;
if(isset($_POST['agency_id'])){
$agency_id = (int)$_POST['agency_id'];
}
$sql_d = "SELECT * FROM denial_work WHERE (agency_id = 0 or agency_id={$agency_id}) and del = 0";
if($agency_id == 19895){
$sql_d = "SELECT * FROM denial_work WHERE agency_id = {$agency_id} AND del = 0";
}
$q_d = mysql_query($sql_d);
$row_d = mysql_num_rows($q_d);
$list_denial = array();
while($r_d = mysql_fetch_assoc($q_d))
{
$list_denial[] = $r_d;
}
?>
<tr>
<th data-field="source" data-formatter="sourceFormatter" data-cell-style="cellStyle" data-class="table_white active_in_footer_source" data-switchable="false" data-footer-formatter="Итого" rowspan="2">Рекламный источник</th>
<th data-field="expenditure" rowspan="2" data-cell-style="cellStyle" data-class="table_white active_in_footer_expenditure" data-footer-formatter="priceFormaterrForSources">Расход</th>
<th data-field="calls_all" rowspan="2" data-cell-style="cellStyle" data-class="table_white active_in_footer_calls_all" data-footer-formatter="priceFormaterrForSources" data-sortable="true" data-sorter="linkSorter">Получено обращений за период</th>
<th data-field="work" rowspan="2" data-cell-style="cellStyle" data-class="table_white active_in_footer_work" data-footer-formatter="priceFormaterrForSources" data-sortable="true" data-sorter="linkSorter">Осталось в работе к концу периода (Целевые)</th>
<th data-field="closes" colspan="<?=($row_d+2)?>" data-cell-style="cellStyle" data-class="table_white inactive_in_footer_closes" data-footer-formatter="priceFormaterrForSources">Закрыто</th>
<th data-field="transaction" rowspan="2" data-cell-style="cellStyle" data-class="table_white active_in_footer_transaction" data-footer-formatter="priceBySlashFormaterrForSources" data-sortable="true" data-sorter="linkSorter">Сделок количество/сумма</th>
<th data-field="conversion" rowspan="2" data-cell-style="cellStyle" data-class="table_white active_in_footer_conversion" data-footer-formatter="procentFormaterrForSources" data-sortable="true" data-sorter="linkSorter">Конверсия в сделку</th>
<th data-field="conversion_closes" rowspan="2" data-cell-style="cellStyle" data-class="table_white active_in_footer_conversion_closes" data-footer-formatter="procentFormaterrForSources" data-sortable="true" data-sorter="linkSorter">Конверсия в закрытие</th>
<th data-field="cost" rowspan="2" data-cell-style="cellStyle" data-class="table_white active_in_footer_cost" data-footer-formatter="priceFormaterrForSources">Стоимость 1 клиента</th>
<th data-field="cost_transaction" rowspan="2" data-cell-style="cellStyle" data-class="table_white active_in_footer_cost_transaction" data-footer-formatter="priceFormaterrForSources">Стоимость сделки</th>
</tr>
<tr>
<?php
foreach($list_denial as $denial)
{
?>
<th data-cell-style="cellStyle" data-class="table_white active_in_footer_closest_<?=$denial['id']?>" data-footer-formatter="priceFormaterrForSources" data-sortable="true" data-sorter="linkSorter" data-field="closest_<?=$denial['id']?>"><?=$denial['name']?></th>
<?php
}
?>
<th data-cell-style="cellStyle" data-class="table_white active_in_footer_closest_0" data-footer-formatter="priceFormaterrForSources" data-sortable="true" data-sorter="linkSorter" data-field="closest_0">Другие причины</th>
<th data-cell-style="cellStyle" data-class="table_white active_in_footer_closest_all" data-footer-formatter="priceFormaterrForSources" data-sortable="true" data-sorter="linkSorter" data-field="closest_all">Итого</th>
</tr>
</thead>
</table>
</div>
<?php
$sql = 'SELECT item_list FROM `reclame_table` WHERE id_user='.$_SESSION['id']. ' AND id_table=5';
$reSql = mysql_query($sql);
$res = mysql_fetch_assoc($reSql);
$resList = $res['item_list'];
?>
<script>
function resList() {
let res = '<?=$resList?>';
return res;
}
// resList('<?=$resList?>');
function saveTableColumn(_this) {
let arr = [];
let idUser = <?= $_SESSION['id'];?>;
_this.closest('.dropdown-menu').find('input').each(function(){
$(this).is(':checked') ? arr.push($(this).attr('data-field')) : '';
})
console.log(arr);
console.log(_this.closest('.dropdown-menu').find('input'));
$.ajax({
url:"/ajax/getReclameTable.php",
method: 'get',
dataType: 'html',
data: {arrPunkt: arr, idTable: 5, idUser: idUser},
success: function(data) {
console.log(data);
}
});
}
</script>