update
This commit is contained in:
parent
adadd350ba
commit
543c04dc40
|
@ -4,7 +4,7 @@ namespace app\assets;
|
|||
|
||||
use yii\web\AssetBundle;
|
||||
|
||||
class LogsAsset extends AssetBundle {
|
||||
class DashboardAsset extends AssetBundle {
|
||||
|
||||
public $basePath = '@webroot';
|
||||
public $baseUrl = '@web';
|
||||
|
|
|
@ -160,13 +160,31 @@ class LogsController extends Controller {
|
|||
$f = date_format(date_create_from_format('H:i d/m/Y', $from), 'U');
|
||||
$t = date_format(date_create_from_format('H:i d/m/Y', $to), 'U');
|
||||
|
||||
$lists = Logs::find()->andWhere(["OR", ["BETWEEN", 'time_in', $f, $t], ["BETWEEN", 'time_out', $f, $t]])->orderBy(['time_in' => SORT_ASC])->all();
|
||||
$logs = Logs::find()->andWhere(["OR", ["BETWEEN", 'time_in', $f, $t], ["BETWEEN", 'time_out', $f, $t]])->orderBy(['time_in' => SORT_ASC])->all();
|
||||
|
||||
$temp = [];
|
||||
foreach ($logs as $k => $v) {
|
||||
if ($v->time_out) {
|
||||
$temp[$v->id] = $v->time_out;
|
||||
} else {
|
||||
$temp[$v->id] = $v->time_in;
|
||||
}
|
||||
}
|
||||
arsort($temp);
|
||||
|
||||
$results = [];
|
||||
foreach ($temp as $k => $v) {
|
||||
foreach ($logs as $key => $value) {
|
||||
if ($value->id == $k)
|
||||
$results[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$objPHPExcel = new \PHPExcel();
|
||||
$count = 1;
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
$toExcelFile[] = [
|
||||
"STT",
|
||||
"Biến số",
|
||||
"Loại xe",
|
||||
"Tên công ty",
|
||||
"Lái xe",
|
||||
|
@ -174,13 +192,15 @@ class LogsController extends Controller {
|
|||
"CMT",
|
||||
"Factory",
|
||||
"SEAL_NO",
|
||||
"Biến số",
|
||||
"Ảnh biển vào",
|
||||
"Thời gian vào",
|
||||
"Ảnh biển ra",
|
||||
"Thời gian ra",
|
||||
"Nội dung khác"
|
||||
];
|
||||
foreach ($lists as $k => $v) {
|
||||
foreach ($results as $k => $v) {
|
||||
$ExportData[] = $count++;
|
||||
$ExportData[] = $v->vehicle->plate;
|
||||
$ExportData[] = $v->vehicle->type;
|
||||
$ExportData[] = $v->vehicle->company;
|
||||
$ExportData[] = $v->vehicle->driver;
|
||||
|
@ -188,32 +208,52 @@ class LogsController extends Controller {
|
|||
$ExportData[] = $v->vehicle->indentity_card;
|
||||
$ExportData[] = $v->factory;
|
||||
$ExportData[] = $v->seal_no;
|
||||
$ExportData[] = $v->vehicle->plate;
|
||||
$ExportData[] = "";
|
||||
$ExportData[] = $v->time_in == 0 ? "" : date("H:i:s d/m/Y", $v->time_in);
|
||||
$ExportData[] = "";
|
||||
$ExportData[] = $v->time_out == 0 ? "" : date("H:i:s d/m/Y", $v->time_out);
|
||||
$ExportData[] = $v->note;
|
||||
if ($v->time_in) {
|
||||
$objDrawing = new \PHPExcel_Worksheet_Drawing();
|
||||
$objDrawing->setPath("./data/uploads/" . $v->plate_image_in);
|
||||
$objDrawing->setWidth(105);
|
||||
$objDrawing->setCoordinates('J' . ($k + 3));
|
||||
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
|
||||
}
|
||||
if ($v->time_out) {
|
||||
$objDrawing = new \PHPExcel_Worksheet_Drawing();
|
||||
$objDrawing->setPath("./data/uploads/" . $v->plate_image_out);
|
||||
$objDrawing->setWidth(105);
|
||||
$objDrawing->setCoordinates('L' . ($k + 3));
|
||||
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
|
||||
}
|
||||
$toExcelFile[] = $ExportData;
|
||||
unset($ExportData);
|
||||
}
|
||||
$totals = count($lists) + 2;
|
||||
|
||||
$totals = count($results) + 2;
|
||||
$activeSheet = $objPHPExcel->getActiveSheet();
|
||||
$activeSheet->setCellValue("A1", "DANH SÁCH XE RA VÀO TỪ {$from} ĐẾN {$to}");
|
||||
$activeSheet->mergeCells('A1:L1');
|
||||
$activeSheet->mergeCells('A1:N1');
|
||||
$activeSheet->getRowDimension('1')->setRowHeight(50);
|
||||
$activeSheet->getStyle("A2:L2")->getFont()->setBold(true);
|
||||
$activeSheet->getStyle("A2:N2")->getFont()->setBold(true);
|
||||
$activeSheet->getStyle("A1")->getFont()->setBold(true)->setName('Time New Roman')->setSize(13);
|
||||
$activeSheet->getStyle("A2:L" . $totals)->getFont()->setName('Time New Roman')->setSize(10);
|
||||
$activeSheet->getStyle("A2:N" . $totals)->getFont()->setName('Time New Roman')->setSize(10);
|
||||
$activeSheet->getColumnDimension('A')->setWidth(5);
|
||||
$activeSheet->getColumnDimension('B')->setWidth(12);
|
||||
$activeSheet->getColumnDimension('C')->setWidth(10);
|
||||
$activeSheet->getColumnDimension('D')->setWidth(30);
|
||||
$activeSheet->getColumnDimension('B')->setWidth(10);
|
||||
$activeSheet->getColumnDimension('C')->setWidth(30);
|
||||
$activeSheet->getColumnDimension('D')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('E')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('F')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('G')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('H')->setWidth(12);
|
||||
$activeSheet->getColumnDimension('I')->setWidth(10);
|
||||
$activeSheet->getColumnDimension('G')->setWidth(12);
|
||||
$activeSheet->getColumnDimension('H')->setWidth(10);
|
||||
$activeSheet->getColumnDimension('I')->setWidth(12);
|
||||
$activeSheet->getColumnDimension('J')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('K')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('L')->setWidth(20);
|
||||
$activeSheet->getColumnDimension('L')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('M')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('N')->setWidth(20);
|
||||
$style = array(
|
||||
'alignment' => array(
|
||||
'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
|
||||
|
@ -221,8 +261,8 @@ class LogsController extends Controller {
|
|||
'wrap' => true
|
||||
)
|
||||
);
|
||||
$activeSheet->getStyle("A1:L2")->applyFromArray($style);
|
||||
$activeSheet->getStyle("A2:L2")->applyFromArray([
|
||||
$activeSheet->getStyle("A1:N2")->applyFromArray($style);
|
||||
$activeSheet->getStyle("A2:N2")->applyFromArray([
|
||||
'fill' => array(
|
||||
'type' => \PHPExcel_Style_Fill::FILL_SOLID,
|
||||
'color' => array('rgb' => '00c0ef')
|
||||
|
@ -245,7 +285,7 @@ class LogsController extends Controller {
|
|||
$rowCount++;
|
||||
}
|
||||
|
||||
$activeSheet->getStyle("A2:L" . $totals)->applyFromArray([
|
||||
$activeSheet->getStyle("A2:N" . $totals)->applyFromArray([
|
||||
'alignment' => [
|
||||
'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
|
||||
'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
|
||||
|
|
|
@ -167,7 +167,6 @@ class LogsUnknowController extends Controller {
|
|||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
$toExcelFile[] = [
|
||||
"STT",
|
||||
"Biến số",
|
||||
"Loại xe",
|
||||
"Tên công ty",
|
||||
"Lái xe",
|
||||
|
@ -175,13 +174,15 @@ class LogsUnknowController extends Controller {
|
|||
"CMT",
|
||||
"Factory",
|
||||
"SEAL_NO",
|
||||
"Biến số",
|
||||
"Ảnh biển vào",
|
||||
"Thời gian vào",
|
||||
"Ảnh biển ra",
|
||||
"Thời gian ra",
|
||||
"Nội dung khác"
|
||||
];
|
||||
foreach ($lists as $k => $v) {
|
||||
$ExportData[] = $count++;
|
||||
$ExportData[] = $v->plate;
|
||||
$ExportData[] = "";
|
||||
$ExportData[] = "";
|
||||
$ExportData[] = "";
|
||||
|
@ -189,32 +190,51 @@ class LogsUnknowController extends Controller {
|
|||
$ExportData[] = "";
|
||||
$ExportData[] = $v->factory;
|
||||
$ExportData[] = $v->seal_no;
|
||||
$ExportData[] = $v->plate;
|
||||
$ExportData[] = "";
|
||||
$ExportData[] = $v->time_in == 0 ? "" : date("H:i:s d/m/Y", $v->time_in);
|
||||
$ExportData[] = "";
|
||||
$ExportData[] = $v->time_out == 0 ? "" : date("H:i:s d/m/Y", $v->time_out);
|
||||
$ExportData[] = $v->note;
|
||||
if ($v->time_in) {
|
||||
$objDrawing = new \PHPExcel_Worksheet_Drawing();
|
||||
$objDrawing->setPath("./data/uploads/" . $v->plate_image_in);
|
||||
$objDrawing->setWidth(105);
|
||||
$objDrawing->setCoordinates('J' . ($k + 3));
|
||||
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
|
||||
}
|
||||
if ($v->time_out) {
|
||||
$objDrawing = new \PHPExcel_Worksheet_Drawing();
|
||||
$objDrawing->setPath("./data/uploads/" . $v->plate_image_out);
|
||||
$objDrawing->setWidth(105);
|
||||
$objDrawing->setCoordinates('L' . ($k + 3));
|
||||
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
|
||||
}
|
||||
$toExcelFile[] = $ExportData;
|
||||
unset($ExportData);
|
||||
}
|
||||
$totals = count($lists) + 2;
|
||||
$activeSheet = $objPHPExcel->getActiveSheet();
|
||||
$activeSheet->setCellValue("A1", "DANH SÁCH XE KHÔNG RÕ NGUỒN GỐC RA VÀO TỪ {$from} ĐẾN {$to}");
|
||||
$activeSheet->mergeCells('A1:L1');
|
||||
$activeSheet->mergeCells('A1:N1');
|
||||
$activeSheet->getRowDimension('1')->setRowHeight(50);
|
||||
$activeSheet->getStyle("A2:L2")->getFont()->setBold(true);
|
||||
$activeSheet->getStyle("A2:N2")->getFont()->setBold(true);
|
||||
$activeSheet->getStyle("A1")->getFont()->setBold(true)->setName('Time New Roman')->setSize(13);
|
||||
$activeSheet->getStyle("A2:L" . $totals)->getFont()->setName('Time New Roman')->setSize(10);
|
||||
$activeSheet->getStyle("A2:N" . $totals)->getFont()->setName('Time New Roman')->setSize(10);
|
||||
$activeSheet->getColumnDimension('A')->setWidth(5);
|
||||
$activeSheet->getColumnDimension('B')->setWidth(12);
|
||||
$activeSheet->getColumnDimension('C')->setWidth(10);
|
||||
$activeSheet->getColumnDimension('D')->setWidth(30);
|
||||
$activeSheet->getColumnDimension('B')->setWidth(10);
|
||||
$activeSheet->getColumnDimension('C')->setWidth(30);
|
||||
$activeSheet->getColumnDimension('D')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('E')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('F')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('G')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('H')->setWidth(12);
|
||||
$activeSheet->getColumnDimension('I')->setWidth(10);
|
||||
$activeSheet->getColumnDimension('G')->setWidth(12);
|
||||
$activeSheet->getColumnDimension('H')->setWidth(10);
|
||||
$activeSheet->getColumnDimension('I')->setWidth(12);
|
||||
$activeSheet->getColumnDimension('J')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('K')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('L')->setWidth(20);
|
||||
$activeSheet->getColumnDimension('L')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('M')->setWidth(15);
|
||||
$activeSheet->getColumnDimension('N')->setWidth(20);
|
||||
$style = array(
|
||||
'alignment' => array(
|
||||
'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
|
||||
|
@ -222,8 +242,8 @@ class LogsUnknowController extends Controller {
|
|||
'wrap' => true
|
||||
)
|
||||
);
|
||||
$activeSheet->getStyle("A1:L2")->applyFromArray($style);
|
||||
$activeSheet->getStyle("A2:L2")->applyFromArray([
|
||||
$activeSheet->getStyle("A1:N2")->applyFromArray($style);
|
||||
$activeSheet->getStyle("A2:N2")->applyFromArray([
|
||||
'fill' => array(
|
||||
'type' => \PHPExcel_Style_Fill::FILL_SOLID,
|
||||
'color' => array('rgb' => '00c0ef')
|
||||
|
@ -246,7 +266,7 @@ class LogsUnknowController extends Controller {
|
|||
$rowCount++;
|
||||
}
|
||||
|
||||
$activeSheet->getStyle("A2:L" . $totals)->applyFromArray([
|
||||
$activeSheet->getStyle("A2:N" . $totals)->applyFromArray([
|
||||
'alignment' => [
|
||||
'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
|
||||
'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
|
||||
|
|
|
@ -22,11 +22,11 @@ use dmstr\widgets\Alert;
|
|||
</section>
|
||||
</div>
|
||||
|
||||
<footer class="main-footer">
|
||||
<div class="pull-right hidden-xs">
|
||||
<b>Version</b> 2.0
|
||||
<footer class="main-footer" style="font-size: 22px;">
|
||||
<div class="pull-right hidden-xs" style="margin-top: 10px;">
|
||||
<b>Hotline</b> <a href="tel:0912461556">091.246.1556</a>
|
||||
</div>
|
||||
<strong>Copyright © 2019 <a href="#">BEET INNOVATORS</a>.</strong> All rights reserved.
|
||||
<strong>Copyright © 2019 <a href="https://beetinnovators.com/"><img src="images/BI_Logo.png" width="120px"></a> & <a href="https://tctech.vn/"><img src="images/TCTech.jpg" width="120px"></a>.</strong> All rights reserved.
|
||||
</footer>
|
||||
|
||||
<!-- Control Sidebar -->
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
<table class="table table-striped table-bordered" style="background:#fff;min-width:700px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Biển số</th>
|
||||
<th>Loại xe</th>
|
||||
<th style="width: 15%;">Tên công ty</th>
|
||||
<th style="width: 10%;">Lái xe</th>
|
||||
|
@ -35,6 +34,7 @@
|
|||
<th style="width: 7%;">CMT</th>
|
||||
<th>Factory</th>
|
||||
<th>SEAL_NO</th>
|
||||
<th>Biển số</th>
|
||||
<th style="width: 8%;">Ảnh biển vào</th>
|
||||
<th style="width: 7%;">Thời gian vào</th>
|
||||
<th style="width: 8%;">Ảnh biển ra</th>
|
||||
|
@ -45,7 +45,6 @@
|
|||
<tbody id="logs-lists">
|
||||
{foreach from=$results item=arr}
|
||||
<tr id="logs-{$arr->id}">
|
||||
<td>{$arr->vehicle->plate}</td>
|
||||
<td>{$arr->vehicle->type}</td>
|
||||
<td>{$arr->vehicle->company}</td>
|
||||
<td>
|
||||
|
@ -78,6 +77,7 @@
|
|||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
<td>{$arr->vehicle->plate}</td>
|
||||
<td class="text-center">
|
||||
{if $arr->time_in}
|
||||
<img src="{Yii::$app->request->hostInfo}/AIParking_Intops_Server/web/data/uploads/{$arr->plate_image_in}" class="img-thumbnail" style="width:100%;">
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
],
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
'plate',
|
||||
[
|
||||
'attribute' => 'factory',
|
||||
'format' => 'raw',
|
||||
|
@ -55,6 +54,7 @@
|
|||
'format' => 'raw',
|
||||
'value' => \app\helpers\LogsGrid::sealNo()
|
||||
],
|
||||
'plate',
|
||||
[
|
||||
'attribute' => "plate_image_in",
|
||||
'format' => 'raw',
|
||||
|
|
|
@ -62,10 +62,6 @@
|
|||
],
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
[
|
||||
'attribute' => 'plate',
|
||||
'value' => 'vehicle.plate'
|
||||
],
|
||||
[
|
||||
'attribute' => 'type',
|
||||
'value' => 'vehicle.type'
|
||||
|
@ -99,6 +95,10 @@
|
|||
'format' => 'raw',
|
||||
'value' => \app\helpers\LogsGrid::sealNo()
|
||||
],
|
||||
[
|
||||
'attribute' => 'plate',
|
||||
'value' => 'vehicle.plate'
|
||||
],
|
||||
[
|
||||
'attribute' => "plate_image_in",
|
||||
'format' => 'raw',
|
||||
|
|
|
@ -78,7 +78,6 @@ function renderNewLogs(data) {
|
|||
var telephone = data.vehicleInfo.telephone.split("/");
|
||||
var cmt = data.vehicleInfo.indentity_card.split("/");
|
||||
var html = `<tr id="logs-` + data.id + `">
|
||||
<td>` + data.vehicleInfo.plate + `</td>
|
||||
<td>` + data.vehicleInfo.type + `</td>
|
||||
<td>` + data.vehicleInfo.company + `</td>
|
||||
<td>` + driver.join("<br>") + `</td>
|
||||
|
@ -94,6 +93,7 @@ function renderNewLogs(data) {
|
|||
<i class='text-red'>không có</i>
|
||||
</div>
|
||||
</td>
|
||||
<td>` + data.vehicleInfo.plate + `</td>
|
||||
<td class="text-center">` + imageIn + `</td>
|
||||
<td class="text-center">` + timeIn + `</td>
|
||||
<td class="text-center">` + imageOut + `</td>
|
||||
|
|
Loading…
Reference in New Issue
Block a user