- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
189 lines
4.8 KiB
PHP
189 lines
4.8 KiB
PHP
<?php
|
|
error_reporting(E_ALL);
|
|
ini_set("display_errors", 1);
|
|
|
|
require_once("../lib/mydb.php");
|
|
$pdo = db_connect();
|
|
|
|
// 기간을 정하는 구간
|
|
$fromdate=$_REQUEST["fromdate"];
|
|
$todate=$_REQUEST["todate"];
|
|
|
|
if($fromdate=="")
|
|
{
|
|
$fromdate=substr(date("Y-m-d",time()),0,4) ;
|
|
$fromdate=$fromdate . "-01-01";
|
|
}
|
|
if($todate=="")
|
|
{
|
|
$todate=substr(date("Y-m-d",time()),0,4) . "-12-31" ;
|
|
$Transtodate=strtotime($todate.'+1 days');
|
|
$Transtodate=date("Y-m-d",$Transtodate);
|
|
}
|
|
else
|
|
{
|
|
$Transtodate=strtotime($todate);
|
|
$Transtodate=date("Y-m-d",$Transtodate);
|
|
}
|
|
|
|
$nowday=date("Y-m-d"); // 현재일자 변수지정
|
|
|
|
|
|
$common=" WHERE outdate between date('$fromdate') and date('$Transtodate') order by outdate ";
|
|
$sql = "SELECT * FROM chandj.output " . $common;
|
|
$stmt = $pdo->query($sql);
|
|
|
|
$arr = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
?>
|
|
|
|
<style>
|
|
* {padding:0; margin:0;}
|
|
|
|
.container {position:relative; top:0px; width:100%; height:100%; text-align: center;}
|
|
|
|
.c-table { width: 100%; border-collapse: collapse; border: 1px solid #444444;}
|
|
|
|
.c-table__top { height: 10px; color: blue;}
|
|
.c-table__top > th { border: 1px solid #444444;}
|
|
|
|
.c-table__content { height: 10px; }
|
|
.c-table__content > td { border: 1px solid #444444; font-size:13px; font-weight:bold;}
|
|
</style>
|
|
|
|
<?if( count($arr) <= 20 ){?>
|
|
|
|
<div class="container">
|
|
<h2> <?=$Transtodate?> 화물 출고 리스트 </h2>
|
|
|
|
<div style="position:relative; width:100%; height:20px;">
|
|
 
|
|
</div>
|
|
|
|
<table class="c-table">
|
|
<tr class="c-table__top">
|
|
<th style="width:7%;">화물회사</th>
|
|
<th style="width:10%;">업체명</th>
|
|
<th style="width:25%;">품목</th>
|
|
<th>묶음수량</th>
|
|
<th style="width:25%;">보낼주소(영업소)</th>
|
|
<th style="width:10%;">연락처</th>
|
|
<th style="width:10%;">운송방식</th>
|
|
<th>비고</th>
|
|
</tr>
|
|
|
|
<?
|
|
for($i=0; $i < 20 ;$i++)
|
|
{
|
|
?>
|
|
<tr class="c-table__content">
|
|
<td> 금일 </td>
|
|
<td> <?=$arr[$i]['receiver']?> </td>
|
|
<td> <?=substr($arr[$i]['comment'],0,90)?> </td>
|
|
<td> </td>
|
|
<td> <?=substr($arr[$i]['outputplace'],0,90)?> </td>
|
|
<td> <?=substr($arr[$i]['phone'],0,13)?> </td>
|
|
<td> <?=$arr[$i]['delivery']?> </td>
|
|
<td> </td>
|
|
</tr>
|
|
<?
|
|
}
|
|
?>
|
|
</table>
|
|
<div>
|
|
|
|
<?
|
|
}
|
|
else if( count($arr) <= 40 )
|
|
{
|
|
?>
|
|
|
|
<div class="container">
|
|
<h2> <?=$Transtodate?> 화물 출고 리스트 <span style="font-size:20px; color:red;">1페이지</span> </h2>
|
|
|
|
<div style="position:relative; width:100%; height:20px;">
|
|
 
|
|
</div>
|
|
|
|
<table class="c-table">
|
|
<tr class="c-table__top">
|
|
<th style="width:7%;">화물회사</th>
|
|
<th style="width:10%;">업체명</th>
|
|
<th style="width:25%;">품목</th>
|
|
<th>묶음수량</th>
|
|
<th style="width:25%;">보낼주소(영업소)</th>
|
|
<th style="width:10%;">연락처</th>
|
|
<th style="width:10%;">운송방식</th>
|
|
<th>비고</th>
|
|
</tr>
|
|
|
|
<?
|
|
for($i=0; $i < 20 ;$i++)
|
|
{
|
|
?>
|
|
<tr class="c-table__content">
|
|
<td> 금일 </td>
|
|
<td> <?=$arr[$i]['receiver']?> </td>
|
|
<td> <?=substr($arr[$i]['comment'],0,90)?> </td>
|
|
<td> </td>
|
|
<td> <?=substr($arr[$i]['outputplace'],0,90)?> </td>
|
|
<td> <?=substr($arr[$i]['phone'],0,13)?> </td>
|
|
<td> <?=$arr[$i]['delivery']?> </td>
|
|
<td> </td>
|
|
</tr>
|
|
<?
|
|
}
|
|
?>
|
|
</table>
|
|
<div>
|
|
|
|
<!-- 페이지 강제로 나눠주는 css -->
|
|
<p style="page-break-after: always;"></p>
|
|
|
|
<div class="container">
|
|
<h2> <?=$Transtodate?> 화물 출고 리스트 <span style="font-size:20px; color:red;">2페이지</span> </h2>
|
|
|
|
<div style="position:relative; width:100%; height:20px;">
|
|
 
|
|
</div>
|
|
|
|
<table class="c-table">
|
|
<tr class="c-table__top">
|
|
<th style="width:7%;">화물회사</th>
|
|
<th style="width:10%;">업체명</th>
|
|
<th style="width:25%;">품목</th>
|
|
<th>묶음수량</th>
|
|
<th style="width:25%;">보낼주소(영업소)</th>
|
|
<th style="width:10%;">연락처</th>
|
|
<th style="width:10%;">운송방식</th>
|
|
<th>비고</th>
|
|
</tr>
|
|
|
|
<?
|
|
for($i=20; $i < count($arr) ;$i++)
|
|
{
|
|
?>
|
|
<tr class="c-table__content">
|
|
<td> 금일 </td>
|
|
<td> <?=$arr[$i]['receiver']?> </td>
|
|
<td> <?=substr($arr[$i]['comment'],0,90)?> </td>
|
|
<td> </td>
|
|
<td> <?=substr($arr[$i]['outputplace'],0,90)?> </td>
|
|
<td> <?=substr($arr[$i]['phone'],0,13)?> </td>
|
|
<td> <?=$arr[$i]['delivery']?> </td>
|
|
<td> </td>
|
|
</tr>
|
|
<?
|
|
}
|
|
?>
|
|
</table>
|
|
<div>
|
|
<?
|
|
}
|
|
?>
|
|
<div style="position:relative; width:100%; height:10px;">
|
|
 
|
|
</div>
|
|
|
|
<div style="position:relative; width:100%; text-align:center; ">
|
|
<button style="width:20%; color:blue; font-weight:bold;" onclick="window.print()">프린트</button>
|
|
</div>
|