초기 커밋: 5130 레거시 시스템

- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경
- DB 연결 하드코딩 → .env 기반으로 변경
- MySQL strict mode DATE 오류 수정
This commit is contained in:
2025-12-10 20:14:31 +09:00
commit aca1767eb9
6728 changed files with 1863265 additions and 0 deletions

115
make/11.php Normal file
View File

@@ -0,0 +1,115 @@
<?php
// make의 자료를 output의 screenlist로 json형태로 저장한 코드입니다.
// 처리시간이 꽤 걸리는 것이며....
// 데이터의 변형을 꿈꿉니다.
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
$pdo = db_connect(); // DB 연결 함수 호출
// 타임 리미트 설정
set_time_limit(0);
// 출력 버퍼링 비활성화
ob_implicit_flush(true);
// 디버깅을 위한 에러 출력 설정
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
print 'screen 제이슨 만들기<br>';
try {
// output 테이블에서 num 컬럼 가져오기
// $output_sql = "SELECT num FROM chandj.output";
$output_sql = "SELECT num FROM chandj.output where num=19293 ";
$output_stmt = $pdo->prepare($output_sql);
$output_stmt->execute();
$output_results = $output_stmt->fetchAll(PDO::FETCH_ASSOC);
$total_rows = count($output_results);
$current_row = 0;
foreach ($output_results as $output_row) {
$output_num = $output_row['num'];
// make 테이블에서 outputnum이 같은 데이터를 가져오기
$make_sql = "SELECT `upnum`, `outputnum`, `num`, `text1`, `text2`, `text3`, `text4`, `text5`,
`ordercompany`, `callname`, `cutwidth`, `cutheight`, `number`, `printside`,
`direction`, `exititem`, `intervalnum`, `intervalnumsecond`, `memo`, `draw`,
`drawbottom1`, `drawbottom2`, `drawbottom3`, `exitinterval`, `cover`, `left_check`,
`mid_check`, `right_check`, `done_check`, `remain_check`
FROM chandj.make WHERE outputnum = :outputnum ORDER BY num ASC";
$make_stmt = $pdo->prepare($make_sql);
$make_stmt->bindParam(':outputnum', $output_num, PDO::PARAM_INT);
$make_stmt->execute();
$make_results = $make_stmt->fetchAll(PDO::FETCH_ASSOC);
$screenlist_data = [];
if ($make_stmt->rowCount() > 0) {
// 각 make 테이블의 행을 배열로 추가
foreach ($make_results as $make_row) {
$screenlist_data[] = [
'upnum' => $make_row['upnum'],
'outputnum' => $make_row['outputnum'],
'num' => $make_row['num'],
'text1' => $make_row['text1'],
'text2' => $make_row['text2'],
'text3' => $make_row['text3'],
'text4' => $make_row['text4'],
'text5' => $make_row['text5'],
'ordercompany' => $make_row['ordercompany'],
'callname' => $make_row['callname'],
'cutwidth' => $make_row['cutwidth'],
'cutheight' => $make_row['cutheight'],
'number' => $make_row['number'],
'printside' => $make_row['printside'],
'direction' => $make_row['direction'],
'exititem' => $make_row['exititem'],
'intervalnum' => $make_row['intervalnum'],
'intervalnumsecond' => $make_row['intervalnumsecond'],
'memo' => $make_row['memo'],
'draw' => $make_row['draw'],
'drawbottom1' => $make_row['drawbottom1'],
'drawbottom2' => $make_row['drawbottom2'],
'drawbottom3' => $make_row['drawbottom3'],
'exitinterval' => $make_row['exitinterval'],
'cover' => $make_row['cover'],
'left_check' => $make_row['left_check'],
'mid_check' => $make_row['mid_check'],
'right_check' => $make_row['right_check'],
'done_check' => $make_row['done_check'],
'remain_check' => $make_row['remain_check']
];
}
}
// JSON으로 인코딩
$screenlist_json = json_encode($screenlist_data, JSON_UNESCAPED_UNICODE);
// output 테이블의 screenlist 업데이트
$update_sql = "UPDATE chandj.output SET screenlist = :screenlist WHERE num = :num";
$update_stmt = $pdo->prepare($update_sql);
$update_stmt->bindParam(':screenlist', $screenlist_json, PDO::PARAM_STR);
$update_stmt->bindParam(':num', $output_num, PDO::PARAM_INT);
if (!$update_stmt->execute()) {
echo "Error updating record for num $output_num: " . implode(", ", $update_stmt->errorInfo()) . "<br>";
}
// 진행 상황 출력
$current_row++;
echo "Processed rows: $current_row<br>";
if ($current_row % 100 == 0) {
echo "Processed $current_row of $total_rows rows<br>";
}
}
echo "Finished processing all records.";
} catch (PDOException $e) {
echo "Error: " . $e->getMessage();
}
?>
</body>
</html>

39
make/_request.php Normal file
View File

@@ -0,0 +1,39 @@
<?php
$upnum = isset($_REQUEST["upnum"]) ? $_REQUEST["upnum"] : "";
$outputnum = isset($_REQUEST["outputnum"]) ? $_REQUEST["outputnum"] : "";
$callname = isset($_REQUEST["callname"]) ? $_REQUEST["callname"] : "";
$cutwidth = isset($_REQUEST["cutwidth"]) ? $_REQUEST["cutwidth"] : "5000";
$cutheight = isset($_REQUEST["cutheight"]) ? $_REQUEST["cutheight"] : "3000";
$exititem = isset($_REQUEST["exititem"]) ? $_REQUEST["exititem"] : "0";
$delivery = isset($_REQUEST["delivery"]) ? $_REQUEST["delivery"] : "";
$callback = isset($_REQUEST["callback"]) ? $_REQUEST["callback"] : "";
$exitinterval = isset($_REQUEST["exitinterval"]) ? $_REQUEST["exitinterval"] : '900';
$cover = isset($_REQUEST["cover"]) ? $_REQUEST["cover"] : '1200';
$tempexit = isset($_REQUEST["exititem"]) ? $_REQUEST["exititem"] : "";
$sort = (isset($_REQUEST["sort"]) && $_REQUEST["sort"] !== '' && $_REQUEST["sort"] !== '0') ? $_REQUEST["sort"] : '1';
$recallcal = isset($_REQUEST["recallcal"]) ? $_REQUEST["recallcal"] : "";
$ordercompany = (isset($_REQUEST["ordercompany"]) && $_REQUEST["ordercompany"] !== "") ? $_REQUEST["ordercompany"] : (isset($_REQUEST["outworkplace"]) ? $_REQUEST["outworkplace"] : "");
$draw = isset($_REQUEST["draw"]) ? $_REQUEST["draw"] : "";
$drawbottom1 = isset($_REQUEST["drawbottom1"]) ? $_REQUEST["drawbottom1"] : ""; // 좌측 공백
$drawbottom2 = isset($_REQUEST["drawbottom2"]) ? $_REQUEST["drawbottom2"] : ""; // 우측
$drawbottom3 = isset($_REQUEST["drawbottom3"]) ? $_REQUEST["drawbottom3"] : ""; // 중앙
$memo = isset($_REQUEST["memo"]) ? $_REQUEST["memo"] : "";
$text2 = isset($_REQUEST["text2"]) ? $_REQUEST["text2"] : "";
$number = (isset($_REQUEST["number"]) && $_REQUEST["number"] !== "") ? $_REQUEST["number"] : "1";
$printside = isset($_REQUEST["printside"]) ? $_REQUEST["printside"] : "0";
$direction = isset($_REQUEST["direction"]) ? $_REQUEST["direction"] : "0";
$intervalnum = isset($_REQUEST["intervalnum"]) ? $_REQUEST["intervalnum"] : "없음";
$intervalnumsecond = isset($_REQUEST["intervalnumsecond"]) ? $_REQUEST["intervalnumsecond"] : "없음";
$left_check = isset($_REQUEST["left_check"]) ? $_REQUEST["left_check"] : "";
$right_check = isset($_REQUEST["right_check"]) ? $_REQUEST["right_check"] : "";
$mid_check = isset($_REQUEST["mid_check"]) ? $_REQUEST["mid_check"] : "";
$done_check = isset($_REQUEST["done_check"]) ? $_REQUEST["done_check"] : "";
$remain_check = isset($_REQUEST["remain_check"]) ? $_REQUEST["remain_check"] : "";
?>

39
make/_row.php Normal file
View File

@@ -0,0 +1,39 @@
<?php
$upnum = isset($_REQUEST["upnum"]) ? $_REQUEST["upnum"] : "";
$outputnum = isset($_REQUEST["outputnum"]) ? $_REQUEST["outputnum"] : "";
$callname = isset($row["callname"]) ? $row["callname"] : "";
$cutwidth = isset($row["cutwidth"]) ? $row["cutwidth"] : "5000";
$cutheight = isset($row["cutheight"]) ? $row["cutheight"] : "3000";
$exititem = isset($row["exititem"]) ? $row["exititem"] : "0";
$delivery = isset($row["delivery"]) ? $row["delivery"] : "";
$callback = isset($row["callback"]) ? $row["callback"] : "";
$exitinterval = isset($row["exitinterval"]) ? $row["exitinterval"] : '900';
$cover = isset($row["cover"]) ? $row["cover"] : '1200';
$tempexit = isset($row["exititem"]) ? $row["exititem"] : "";
$sort = (isset($row["sort"]) && $row["sort"] !== '' && $row["sort"] !== '0') ? $row["sort"] : '1';
$recallcal = isset($row["recallcal"]) ? $row["recallcal"] : "";
$ordercompany = (isset($row["ordercompany"]) && $row["ordercompany"] !== "") ? $row["ordercompany"] : (isset($row["outworkplace"]) ? $row["outworkplace"] : "");
$draw = isset($row["draw"]) ? $row["draw"] : "";
$drawbottom1 = isset($row["drawbottom1"]) ? $row["drawbottom1"] : ""; // 좌측 공백
$drawbottom2 = isset($row["drawbottom2"]) ? $row["drawbottom2"] : ""; // 우측
$drawbottom3 = isset($row["drawbottom3"]) ? $row["drawbottom3"] : ""; // 중앙
$memo = isset($row["memo"]) ? $row["memo"] : "";
$text2 = isset($row["text2"]) ? $row["text2"] : "";
$number = (isset($row["number"]) && $row["number"] !== "") ? $row["number"] : "1";
$printside = isset($row["printside"]) ? $row["printside"] : "0";
$direction = isset($row["direction"]) ? $row["direction"] : "0";
$intervalnum = isset($row["intervalnum"]) ? $row["intervalnum"] : "없음";
$intervalnumsecond = isset($row["intervalnumsecond"]) ? $row["intervalnumsecond"] : "없음";
$left_check = isset($row["left_check"]) ? $row["left_check"] : "";
$right_check = isset($row["right_check"]) ? $row["right_check"] : "";
$mid_check = isset($row["mid_check"]) ? $row["mid_check"] : "";
$done_check = isset($row["done_check"]) ? $row["done_check"] : "";
$remain_check = isset($row["remain_check"]) ? $row["remain_check"] : "";
?>

62
make/delete.php Normal file
View File

@@ -0,0 +1,62 @@
<?php
session_start();
$parentnum=$_REQUEST["parentnum"]; // 리스트번호
$mode=$_REQUEST["mode"];
$num=$_REQUEST["num"];
$sort=$_REQUEST["sort"];
$upnum=$_REQUEST["upnum"];
$tempnum=$_REQUEST["upnum"]; // 발주서 번호 비교를 위해 임시변수 만듦
$callname=$_REQUEST["callname"];
$cutwidth=$_REQUEST["cutwidth"];
$cutheight=$_REQUEST["cutheight"];
$number=$_REQUEST["number"];
$exititem=$_REQUEST["exititem"];
$memo=$_REQUEST["memo"];
$intervalnum=$_REQUEST["intervalnum"];
$intervalnumsecond=$_REQUEST["intervalnumsecond"];
$printside=$_REQUEST["printside"];
$direction=$_REQUEST["direction"];
$ordercompany=$_REQUEST["ordercompany"];
$left_check=$_REQUEST["left_check"];
$right_check=$_REQUEST["right_check"];
$mid_check=$_REQUEST["mid_check"];
$done_check=$_REQUEST["done_check"];
$outputnum=$_REQUEST["outputnum"];
require_once("../lib/mydb.php");
$pdo = db_connect();
if($mode=="all")
{
try{
$pdo->beginTransaction();
$sql = "delete from chandj.make where upnum = ?";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1,$upnum,PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
} catch (Exception $ex) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
}
else
{
try{
$pdo->beginTransaction();
$sql = "delete from chandj.make where num = ?";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1,$num,PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
} catch (Exception $ex) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
}
header("Location:/make/write.php?upnum=$upnum&num=$num&ordercompany=$ordercompany&callname=$callname&cutheight=$cutheight&cutwidth=$cutwidth&number=$number&comment=$comment&printside=$printside&direction=$direction&exititem=$exititem&intervalnum=$intervalnum&intervalnumsecond=$intervalnumsecond&memo=$memo&parentnum=$parentnum&left_check=$left_check&mid_check=$mid_check&right_check=$right_check&done_check=$done_check"); // 신규가입일때는 리스트로 이동
?>

70
make/deletelist.php Normal file
View File

@@ -0,0 +1,70 @@
<?php
session_start();
$num=$_REQUEST["num"];
$upnum=$num; // 상위번호 호출
require_once("../lib/mydb.php");
$pdo = db_connect();
if($num=="all")
{
try{
$pdo->beginTransaction();
$sql = "truncate chandj.orderlist";
$stmh = $pdo->prepare($sql);
$stmh->execute();
$pdo->commit();
header("Location:/make/list.php"); // 리스트로 이동
} catch (Exception $ex) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
}
else
{
try{
$sql = "select * from chandj.orderlist where num = ? ";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1,$num,PDO::PARAM_STR);
$stmh->execute();
$count = $stmh->rowCount();
}catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
try{
$pdo->beginTransaction();
$sql = "delete from chandj.orderlist where num = ?";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1,$num,PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
} catch (Exception $ex) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
// 리스트를 삭제하고 밑에 딸려있는 세부 항목도 지워줘야 한다.
try{
$pdo->beginTransaction();
$sql = "delete from chandj.make where upnum = ?";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1,$upnum,PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
header("Location:/make/list.php"); // 신규가입일때는 리스트로 이동
} catch (Exception $ex) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
}
?>

16
make/dis_message.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
session_start();
$tmp=$_SESSION["name"];
print "<h2> " . $tmp . "님! 변경사항이 저장되었습니다. </h2>";
//sleep(2);
//print "<script> sleep(1000); </script>";
?>
<script>
setTimeout(function() {
self.close();
}, 1500);
</script>

61
make/get_check_done.php Normal file
View File

@@ -0,0 +1,61 @@
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
header("Content-Type: application/json");
$num = isset($_GET['num']) ? $_GET['num'] : '';
$response = ['success' => false];
if ($num) {
try {
$pdo = db_connect();
$sql = "SELECT screenlist FROM chandj.output WHERE num = ?";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $num, PDO::PARAM_INT);
$stmh->execute();
$row = $stmh->fetch(PDO::FETCH_ASSOC);
if ($row) {
$screenlist = json_decode($row['screenlist'], true);
if (is_array($screenlist)) {
$totalCompleted = 0;
$totalItems = 0;
$checkQuantity = 0;
foreach ($screenlist as $item) {
$totalItems += isset($item['number']) ? (float)$item['number'] : 0;
if (isset($item['done_check']) && $item['done_check'] == "1") {
$totalCompleted += isset($item['number']) ? (float)$item['number'] : 0;
}
if (
(isset($item['left_check']) && $item['left_check'] == "1") ||
(isset($item['right_check']) && $item['right_check'] == "1") ||
(isset($item['mid_check']) && $item['mid_check'] == "1") ||
(isset($item['remain_check']) && $item['remain_check'] == "1") ||
(isset($item['done_check']) && $item['done_check'] == "1")
) {
$checkQuantity += isset($item['number']) ? (float)$item['number'] : 0;
}
}
$response['success'] = true;
$response['totalCompleted'] = $totalCompleted;
$response['totalItems'] = $totalItems;
$response['checkQuantity'] = $checkQuantity;
} else {
$response['message'] = "Invalid screenlist format";
}
} else {
$response['message'] = "No data found";
}
} catch (PDOException $e) {
$response['message'] = "Error: " . $e->getMessage();
}
}
echo json_encode($response);
?>

33
make/get_screenlist.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
header("Content-Type: application/json");
$num = isset($_GET['num']) ? $_GET['num'] : '';
$response = ['success' => false];
if ($num) {
try {
$pdo = db_connect();
$sql = "SELECT screenlist FROM chandj.output WHERE num = ?";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $num, PDO::PARAM_INT);
$stmh->execute();
$row = $stmh->fetch(PDO::FETCH_ASSOC);
if ($row) {
$response['success'] = true;
$response['screenlist'] = json_decode($row['screenlist'], true);
} else {
$response['message'] = "No data found";
}
} catch (PDOException $e) {
$response['message'] = "Error: " . $e->getMessage();
}
}
echo json_encode($response);
?>

46
make/insert.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
header("Content-Type: application/json");
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
$pdo = db_connect();
try {
$num = isset($_REQUEST['num']) ? $_REQUEST['num'] : '';
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : '';
$tablename = isset($_REQUEST['tablename']) ? $_REQUEST['tablename'] : '';
$screen_state = isset($_REQUEST['screen_state']) ? $_REQUEST['screen_state'] : ''; // Make sure this is being passed
include $_SERVER['DOCUMENT_ROOT'] . "/output/_request.php";
$update_log = date("Y-m-d H:i:s") . " - " . $_SESSION["name"] . " " . $update_log . "&#10";
$pdo->beginTransaction();
$sql = "UPDATE $DB.$tablename SET screen_state=?, update_log=? WHERE num=? LIMIT 1";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $screen_state, PDO::PARAM_STR);
$stmh->bindValue(2, $update_log, PDO::PARAM_STR);
$stmh->bindValue(3, $num, PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
$data = [
'num' => $num,
'mode' => $mode
];
echo json_encode($data, JSON_UNESCAPED_UNICODE);
} catch (PDOException $Exception) {
$pdo->rollBack();
error_log("Database error: " . $Exception->getMessage()); // Log the error
echo json_encode(['error' => 'Database error: ' . $Exception->getMessage()], JSON_UNESCAPED_UNICODE);
} catch (Exception $e) {
error_log("General error: " . $e->getMessage()); // Log general errors
echo json_encode(['error' => 'General error: ' . $e->getMessage()], JSON_UNESCAPED_UNICODE);
}
?>

166
make/insert_new.php Normal file
View File

@@ -0,0 +1,166 @@
<?php session_start(); ?>
<meta charset="utf-8">
<script src="/make/make.js"></script>
<?php
$modify=$_REQUEST["modify"];
$parentnum=$_REQUEST["parentnum"]; // 리스트번호
$upnum=$_REQUEST["upnum"]; // 전달인수가 변수명과 겹치면 오류가 발생해서 받아들이지 않는다.
$num=$_REQUEST["num"]; // 전달인수가 변수명과 겹치면 오류가 발생해서 받아들이지 않는다.
$text1=$_REQUEST["callname"]; // 전달인수가 변수명과 겹치면 오류가 발생해서 받아들이지 않는다.
$text2=$_REQUEST["text2"];
$ordercompany=$_REQUEST["ordercompany"];
$callname=$_REQUEST["callname"];
$cutwidth=$_REQUEST["cutwidth"];
$cutheight=$_REQUEST["cutheight"];
$number=$_REQUEST["number"];
$printside=$_REQUEST["printside"];
$direction=$_REQUEST["direction"];
$exititem=$_REQUEST["exititem"];
$intervalnum=$_REQUEST["intervalnum"];
$intervalnumsecond=$_REQUEST["intervalnumsecond"];
$memo=$_REQUEST["memo"];
$draw=$_REQUEST["draw"];
$drawbottom1=$_REQUEST["drawbottom1"];
$drawbottom2=$_REQUEST["drawbottom2"];
$drawbottom3=$_REQUEST["drawbottom3"];
$cover=$_REQUEST["cover"];
$exitinterval=$_REQUEST["exitinterval"];
$sort=$_REQUEST["sort"];
$outputnum=$_REQUEST["outputnum"];
$left_check=$_REQUEST["left_check"];
$right_check=$_REQUEST["right_check"];
$mid_check=$_REQUEST["mid_check"];
$done_check=$_REQUEST["done_check"];
$remain_check=$_REQUEST["remain_check"];
$text3="";
$text4="";
$text5="";
// print "<script> alert($modify); </script>";
require_once("../lib/mydb.php");
$pdo = db_connect();
if($modify=='1')
{
try{
$sql = "select * from chandj.make where num=?"; // get target record
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1,$num,PDO::PARAM_STR);
$stmh->execute();
$row = $stmh->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
try{
$pdo->beginTransaction();
$sql = "update chandj.make set text1=?, text2=? ,text3=?, text4=? ,text5=?, ordercompany=? , callname=? ,cutwidth=? ,cutheight=? ,number=? ,printside=? ,direction=? ,exititem=? ,intervalnum=? ,intervalnumsecond=? ,memo=? ,draw=? ,drawbottom1=? ,drawbottom2=? ,drawbottom3=? ,upnum=?, exitinterval=?, cover=?, outputnum=?, left_check=?, mid_check=?, right_check=?, done_check=?, remain_check=? ";
$sql .= " where num=? LIMIT 1";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $text1, PDO::PARAM_STR);
$stmh->bindValue(2, $text2, PDO::PARAM_STR);
$stmh->bindValue(3, $text3, PDO::PARAM_STR);
$stmh->bindValue(4, $text4, PDO::PARAM_STR);
$stmh->bindValue(5, $text5, PDO::PARAM_STR);
$stmh->bindValue(6, $ordercompany, PDO::PARAM_STR);
$stmh->bindValue(7, $callname, PDO::PARAM_STR);
$stmh->bindValue(8, $cutwidth, PDO::PARAM_STR);
$stmh->bindValue(9, $cutheight, PDO::PARAM_STR);
$stmh->bindValue(10, $number, PDO::PARAM_STR);
$stmh->bindValue(11, $printside, PDO::PARAM_STR);
$stmh->bindValue(12, $direction, PDO::PARAM_STR);
$stmh->bindValue(13, $exititem, PDO::PARAM_STR);
$stmh->bindValue(14, $intervalnum, PDO::PARAM_STR);
$stmh->bindValue(15, $intervalnumsecond, PDO::PARAM_STR);
$stmh->bindValue(16, $memo, PDO::PARAM_STR);
$stmh->bindValue(17, $draw, PDO::PARAM_STR);
$stmh->bindValue(18, $drawbottom1, PDO::PARAM_STR);
$stmh->bindValue(19, $drawbottom2, PDO::PARAM_STR);
$stmh->bindValue(20, $drawbottom3, PDO::PARAM_STR);
$stmh->bindValue(21, $upnum, PDO::PARAM_STR);
$stmh->bindValue(22, $exitinterval, PDO::PARAM_STR);
$stmh->bindValue(23, $cover, PDO::PARAM_STR);
$stmh->bindValue(24, $outputnum, PDO::PARAM_STR);
$stmh->bindValue(25, $left_check, PDO::PARAM_STR);
$stmh->bindValue(26, $mid_check, PDO::PARAM_STR);
$stmh->bindValue(27, $right_check, PDO::PARAM_STR);
$stmh->bindValue(28, $done_check, PDO::PARAM_STR);
$stmh->bindValue(29, $remain_check, PDO::PARAM_STR);
$stmh->bindValue(30, $num, PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
}
elseif($modify=='2') // sorting 요청
{
}
else
{
// 데이터 신규 등록하는 구간
try{
$pdo->beginTransaction();
$sql = "insert into chandj.make(text1, text2, text3, text4, text5, ";
$sql .= "ordercompany, callname,cutwidth,cutheight,number,printside,direction,exititem,intervalnum,intervalnumsecond,memo,draw,drawbottom1,drawbottom2,drawbottom3,upnum,exitinterval,cover,outputnum,left_check, mid_check, right_check, done_check, remain_check)";
$sql .= " values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $text1, PDO::PARAM_STR);
$stmh->bindValue(2, $text2, PDO::PARAM_STR);
$stmh->bindValue(3, $text3, PDO::PARAM_STR);
$stmh->bindValue(4, $text4, PDO::PARAM_STR);
$stmh->bindValue(5, $text5, PDO::PARAM_STR);
$stmh->bindValue(6, $ordercompany, PDO::PARAM_STR);
$stmh->bindValue(7, $callname, PDO::PARAM_STR);
$stmh->bindValue(8, $cutwidth, PDO::PARAM_STR);
$stmh->bindValue(9, $cutheight, PDO::PARAM_STR);
$stmh->bindValue(10, $number, PDO::PARAM_STR);
$stmh->bindValue(11, $printside, PDO::PARAM_STR);
$stmh->bindValue(12, $direction, PDO::PARAM_STR);
$stmh->bindValue(13, $exititem, PDO::PARAM_STR);
$stmh->bindValue(14, $intervalnum, PDO::PARAM_STR);
$stmh->bindValue(15, $intervalnumsecond, PDO::PARAM_STR);
$stmh->bindValue(16, $memo, PDO::PARAM_STR);
$stmh->bindValue(17, $draw, PDO::PARAM_STR);
$stmh->bindValue(18, $drawbottom1, PDO::PARAM_STR);
$stmh->bindValue(19, $drawbottom2, PDO::PARAM_STR);
$stmh->bindValue(20, $drawbottom3, PDO::PARAM_STR);
$stmh->bindValue(21, $upnum, PDO::PARAM_STR);
$stmh->bindValue(22, $exitinterval, PDO::PARAM_STR);
$stmh->bindValue(23, $cover, PDO::PARAM_STR);
$stmh->bindValue(24, $outputnum, PDO::PARAM_STR);
$stmh->bindValue(25, $left_check, PDO::PARAM_STR);
$stmh->bindValue(26, $mid_check, PDO::PARAM_STR);
$stmh->bindValue(27, $right_check, PDO::PARAM_STR);
$stmh->bindValue(28, $done_check, PDO::PARAM_STR);
$stmh->bindValue(29, $remain_check, PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
}
header("Location:/make/write.php?num=$num&callname=$callname&cutwidth=$cutwidth&cutheight=$cutheight&ordercompany=$ordercompany&outworkplace=$ordercompany&number=$number&printside=$printside&direction=$direction&exititem=$exititem&intervalnum=$intervalnum&intervalnumsecond=$intervalnumsecond&memo=$memo&draw=$draw&drawbottom1=$drawbottom1&drawbottom2=$drawbottom2&drawbottom3=$drawbottom3&text2=$text2&sort=$sort&upnum=$upnum&exitinterval=$exitinterval&cover=$cover&outputnum=$outputnum&parentnum=$parentnum&number=$number&left_check=$left_check&mid_check=$mid_check&right_check=$right_check&done_check=$done_check&remain_check=$remain_check"); // 신규가입일때는 리스트로 이동 ?>

184
make/insertlist.php Normal file
View File

@@ -0,0 +1,184 @@
<?php
session_start();
$level= $_SESSION["level"];
if(!isset($_SESSION["level"]) || $level>=8) {
echo "<script> alert('관리자 승인이 필요합니다.') </script>";
sleep(2);
header ("Location:/login/logout.php");
exit;
}
$modify=$_REQUEST["modify"];
$outputnum=$_REQUEST["outputnum"];
$callback=$_REQUEST["callback"]; // 출고현황에서 호출했는지 체크함.
if(isset($_REQUEST["page"]))
$page=$_REQUEST["page"];
else
$page=1; // 1로 설정해야 함
if(isset($_REQUEST["mode"])) //modify_form에서 호출할 경우
$mode=$_REQUEST["mode"];
else
$mode="";
if(isset($_REQUEST["num"]))
$num=$_REQUEST["num"];
else
$num="";
if(isset($_REQUEST["sort"])) //수정 버튼을 클릭해서 호출했는지 체크
$sort=$_REQUEST["sort"];
else
$sort="1";
if(isset($_REQUEST["upnum"]))
$upnum=$_REQUEST["upnum"];
else
$upnum=0;
if(isset($_REQUEST["search"])) //수정 버튼을 클릭해서 호출했는지 체크
$search=$_REQUEST["search"];
else
$search="";
if(isset($_REQUEST["find"])) //수정 버튼을 클릭해서 호출했는지 체크
$find=$_REQUEST["find"];
else
$find="";
if(isset($_REQUEST["process"])) //수정 버튼을 클릭해서 호출했는지 체크
$process=$_REQUEST["process"];
else
$process="전체";
$fromdate=$_REQUEST["fromdate"];
$todate=$_REQUEST["todate"];
$outputnumint=(int)$outputnum;
if($outputnumint>0) { // 출고번호의 레코드가 존재할 경우 수정모드로 전환
$outputnum=$_REQUEST["outputnum"];
require_once("../lib/mydb.php");
$pdo = db_connect();
try{
$sql = "select * from chandj.orderlist where outputnum=?"; // get target record
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1,$outputnum,PDO::PARAM_STR);
$stmh->execute();
$rowcount=$stmh->rowCount();
$row = $stmh->fetch(PDO::FETCH_ASSOC); // $row 배열로 DB 정보를 불러온다.
if($rowcount==1)
{
$mode="modify";
$num= $row["num"];
}
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
}
$item_outdate=$_REQUEST["outdate"];
$item_indate=$_REQUEST["indate"];
$item_orderman=$_REQUEST["orderman"];
$item_outworkplace=$_REQUEST["outworkplace"];
$item_outputplace=$_REQUEST["outputplace"];
$item_phone=$_REQUEST["phone"];
$item_receiver=$_REQUEST["receiver"];
$item_comment=$_REQUEST["comment"];
$item_delivery=$_REQUEST["delivery"];
require_once("../lib/mydb.php");
$pdo = db_connect();
if ($mode=="modify" || ($mode=="modify" && $modify=="1")){ // 정렬버튼 선택시도 함께
try{
$sql = "select * from chandj.orderlist where num=?"; // get target record
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1,$num,PDO::PARAM_STR);
$stmh->execute();
$row = $stmh->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
/* print "접속완료" ; */
try{
$pdo->beginTransaction();
$sql = "update chandj.orderlist set outdate=?, indate=?, orderman=?, outworkplace=?, outputplace=?, receiver=?, phone=?, comment=?, delivery=?, outputnum=? ";
$sql .= " where num=? LIMIT 1";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $item_outdate, PDO::PARAM_STR);
$stmh->bindValue(2, $item_indate, PDO::PARAM_STR);
$stmh->bindValue(3, $item_orderman, PDO::PARAM_STR);
$stmh->bindValue(4, $item_outworkplace, PDO::PARAM_STR);
$stmh->bindValue(5, $item_outputplace, PDO::PARAM_STR);
$stmh->bindValue(6, $item_receiver, PDO::PARAM_STR);
$stmh->bindValue(7, $item_phone, PDO::PARAM_STR);
$stmh->bindValue(8, $item_comment, PDO::PARAM_STR);
$stmh->bindValue(9, $item_delivery, PDO::PARAM_STR);
$stmh->bindValue(10, $outputnum, PDO::PARAM_STR);
$stmh->bindValue(11, $num, PDO::PARAM_STR); //고유키값이 같나?의 의미로 ?로 num으로 맞춰야 합니다. where 구문
$stmh->execute();
$pdo->commit();
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
}
else
{
// 데이터 신규 등록하는 구간
try{
$pdo->beginTransaction();
$sql = "insert into chandj.orderlist(outdate, indate, orderman, outworkplace, outputplace, receiver, phone, comment, outputnum, delivery)";
$sql .= " values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";// 총 10개 레코드 추가
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $item_outdate, PDO::PARAM_STR);
$stmh->bindValue(2, $item_indate, PDO::PARAM_STR);
$stmh->bindValue(3, $item_orderman, PDO::PARAM_STR);
$stmh->bindValue(4, $item_outworkplace, PDO::PARAM_STR);
$stmh->bindValue(5, $item_outputplace, PDO::PARAM_STR);
$stmh->bindValue(6, $item_receiver, PDO::PARAM_STR);
$stmh->bindValue(7, $item_phone, PDO::PARAM_STR);
$stmh->bindValue(8, $item_comment, PDO::PARAM_STR);
$stmh->bindValue(9, $outputnum, PDO::PARAM_STR);
$stmh->bindValue(10, $item_delivery, PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
}
?>
<?php
if($mode=="not"&&$modify!='1')
{
$sql = "select * from chandj.orderlist order by num desc";
$stmh = $pdo->prepare($sql);
$stmh->execute();
$row = $stmh->fetch(PDO::FETCH_ASSOC);
$num = $row["num"];
$upnum = $num;
header("Location:/make/write.php?num=$num&upnum=$upnum&outputnum=$outputnum&page=$page&search=$search&find=$find&process=$process&yearcheckbox=$yearcheckbox&year=$year&fromdate=$fromdate&todate=$todate&separate_date=$separate_date&outworkplace=$item_outworkplace&sort=$sort&parentnum=$num&callback=$callback"); // 신규가입일때는 리스트로 이동
}
elseif($modify=='1') // 정렬만 보여줌
header("Location:/make/write_form.php?num=$num&upnum=$upnum&outputnum=$outputnum&page=$page&search=$search&find=$find&process=$process&yearcheckbox=$yearcheckbox&year=$year&fromdate=$fromdate&todate=$todate&separate_date=$separate_date&outworkplace=$item_outworkplace&sort=$sort&indate=$item_indate&outdate=$item_outdate&orderman=$item_orderman&callback=$callback&mode=modify");
else
header("Location:/make/write.php?num=$num&upnum=$upnum&outputnum=$outputnum&page=$page&search=$search&find=$find&process=$process&yearcheckbox=$yearcheckbox&year=$year&fromdate=$fromdate&todate=$todate&separate_date=$separate_date&outworkplace=$item_outworkplace&sort=$sort&parentnum=$num&callback=$callback");
?>

502
make/list.php Normal file
View File

@@ -0,0 +1,502 @@
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
if(!isset($_SESSION["level"]) || $_SESSION["level"]>5) {
sleep(1);
header("Location:" . $WebSite . "login/login_form.php");
exit;
}
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php';
$title_message = '작업 List';
$title_prefix = '스크린';
?>
<title> <?=$title_prefix?> <?=$title_message?> </title>
</head>
<body>
<?php require_once($_SERVER['DOCUMENT_ROOT'] . '/myheader.php'); ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'] . '/mymodal.php'); ?>
<?php
$tablename = 'output';
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
$pdo = db_connect();
// 검색 조건 설정
$search = isset($_REQUEST['search']) ? $_REQUEST['search'] : '';
$fromdate = isset($_REQUEST['fromdate']) ? $_REQUEST['fromdate'] : '';
$todate = isset($_REQUEST['todate']) ? $_REQUEST['todate'] : '';
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : '';
$SettingDate = isset($_REQUEST['SettingDate']) ? $_REQUEST['SettingDate'] : " regist_day ";
if(isset($_REQUEST["separate_date"]))
$separate_date=$_REQUEST["separate_date"];
else
$separate_date="";
if(isset($_REQUEST["status_option"]))
$existing_status=$_REQUEST["status_option"];
else
$existing_status='전체';
require_once("../lib/mydb.php");
$pdo = db_connect();
if($separate_date=="") $separate_date="1";
// 현재 날짜
$currentDate = date("Y-m-d");
// fromdate 또는 todate가 빈 문자열이거나 null인 경우
if ($fromdate === "" || $fromdate === null || $todate === "" || $todate === null) {
$fromdate = date("Y-m-d", strtotime("-1 weeks", strtotime($currentDate))); // 1주 전 날짜
$todate = date("Y-m-d", strtotime("+3 months", strtotime($currentDate))); // 3개월 후 날짜
$Transtodate = $todate;
} else {
// fromdate와 todate가 모두 설정된 경우 (기존 로직 유지)
$Transtodate = $todate;
}
if($separate_date == "1")
$SettingDate = "outdate";
else
$SettingDate = "indate";
// 진행상태에 대한 검색
$orderby = " order by " . $SettingDate . " desc, num desc"; // 내림차순 전체
if ($existing_status == '전체') {
$where = " where " . $SettingDate . " between date('$fromdate') and date('$Transtodate') and is_deleted = '0' AND (devMode <> '1' or devMode IS NULL) and screen = '1'" . $orderby;
$searchwhere = " where is_deleted = '0' AND (devMode <> '1' or devMode IS NULL) and screen = '1' and searchtag like '%$search%'" . $orderby;
} else if ($existing_status == '미출고') {
$where = " where " . $SettingDate . " between date('$fromdate') and date('$Transtodate') and is_deleted = '0' AND (devMode <> '1' or devMode IS NULL) and screen = '1' and screen_state != '완료'" . $orderby;
$searchwhere = " where is_deleted = '0' AND (devMode <> '1' or devMode IS NULL) and screen = '1' and screen_state != '완료' and searchtag like '%$search%'" . $orderby;
} else {
$where = " where " . $SettingDate . " between date('$fromdate') and date('$Transtodate') and is_deleted = '0' AND (devMode <> '1' or devMode IS NULL) and screen = '1' and screen_state = '$existing_status'" . $orderby;
$searchwhere = " where is_deleted = '0' AND (devMode <> '1' or devMode IS NULL) and screen = '1' and screen_state = '$existing_status' and searchtag like '%$search%'" . $orderby;
}
// 수정된 쿼리: outputnum이 존재하는 자료만 선택
if ($search == "") {
$sql = "select * from $DB.$tablename " . $where;
} else {
$sql = "select * from $DB.$tablename " . $searchwhere;
}
$today=date("Y-m-d"); // 현재일자 변수지정
// print $sql;
// print ' existing_status : ' . $existing_status;
try {
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
$total_row = $stmh->rowCount();
$total_sum=0;
$total_m2=0;
?>
<form id="board_form" name="board_form" method="post" action="list.php?mode=search">
<input type="hidden" id="mode" name="mode" value="<?=$mode?>">
<input type="hidden" id="num" name="num">
<input type="hidden" id="tablename" name="tablename" value="<?=$tablename?>">
<input type="hidden" id="header" name="header" value="<?=$header?>">
<div class="container-fluid">
<div class="card mb-2 mt-2">
<div class="card-body">
<div class="row">
<div class="col-sm-7">
<div class="d-flex p-1 m-1 mt-1 justify-content-end align-items-center" style="height: 100%;">
<span class="badge bg-primary fs-5"><?=$title_prefix?></span> &nbsp;&nbsp;
<h5><?=$title_message?> (<?=$existing_status?>)</h5> &nbsp;&nbsp;&nbsp;
<button type="button" class="btn btn-dark btn-sm mx-1" onclick='location.reload()'> <i class="bi bi-arrow-clockwise"></i> </button>
<!-- <button type="button" class="btn btn-dark btn-sm me-1" onclick='location.href="list.php"'>
<i class="bi bi-file-lock"></i>
</button> -->
</div>
</div>
<div class="col-sm-5">
<div class="d-flex justify-content-end align-items-center" style="height: 100%;">
<h5>
<span id="total_screen" class="text-primary me-2"></span>
<span id="total_screen_m2" class="badge bg-primary me-5"></span>
</h5>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="d-flex p-1 m-1 mt-1 justify-content-start align-items-center">
<label>
<input type="radio" name="status_option" value="전체" onclick="submitForm('전체');return false;" <?php if($existing_status == '전체') echo 'checked'; ?>>
<span class="badge bg-secondary me-2 " style="font-size:12px;" >전체</span>
</label>
<label>
<input type="radio" name="status_option" value="등록" onclick="submitForm('등록');return false;" <?php if($existing_status == '등록') echo 'checked'; ?>>
<span class="badge bg-danger me-2 " style="font-size:12px;" >등록</span>
</label>
<label>
<input type="radio" name="status_option" value="접수" onclick="submitForm('접수');return false;" <?php if($existing_status == '접수') echo 'checked'; ?>>
<span class="badge bg-success me-2 " style="font-size:12px;">접수</span>
</label>
<label>
<input type="radio" name="status_option" value="제작중" onclick="submitForm('제작중');return false;" <?php if($existing_status == '제작중') echo 'checked'; ?>>
<span class="badge bg-warning me-2 " style="font-size:12px;" >제작중</span>
</label>
<label>
<input type="radio" name="status_option" value="완료" onclick="submitForm('완료');return false;" <?php if($existing_status == '완료') echo 'checked'; ?>>
<span class="badge bg-dark me-2 " style="font-size:12px;" >완료</span>
</label>
<label>
<input type="radio" name="status_option" value="미출고" onclick="submitForm('미출고');return false;" <?php if($existing_status == '미출고') echo 'checked'; ?>>
<span class="badge bg-primary me-2 " style="font-size:12px;" >미출고</span>
</label>
</div>
</div>
<div class="col-sm-9">
<div class="d-flex p-1 m-1 mt-1 mb-1 justify-content-start align-items-center">
▷ <?= $total_row ?> &nbsp;
<label>&nbsp; 출고일 <input type="radio" name="separate_date" value="1" <?= $separate_date == "1" ? 'checked' : '' ?>></label>
<label>&nbsp; 접수일 <input type="radio" name="separate_date" class="me-3" value="2" <?= $separate_date == "2" ? 'checked' : '' ?>></label>
<button type="button" id="premonth" class="btn btn-dark btn-sm me-1 " onclick='yesterday()' > 전일 </button>
<button type="button" class="btn btn-outline-dark btn-sm me-1 " onclick='this_today()' > 금일 </button>
<button type="button" class="btn btn-dark btn-sm me-1 " onclick='this_tomorrow()' > 익일 </button>
<input type="date" id="fromdate" name="fromdate" class="form-control" style="width:100px;" value="<?=$fromdate?>" > &nbsp; ~ &nbsp;
<input type="date" id="todate" name="todate" class="form-control me-1" style="width:100px;" value="<?=$todate?>" > &nbsp;
<!-- <button type="button" id ="Fromthistoday" type='button' class="btn btn-dark btn-sm me-1 " onclick='Fromthis_today()' > 금일이후 </button>
<button type="button" id ="Fromtomorrow" type='button' class="btn btn-dark btn-sm me-1 " onclick='From_tomorrow()' > 익일이후 </button>
-->
</span>
<div class="inputWrap">
<input type="text" id="search" name="search" value="<?=$search?>" onkeydown="JavaScript:SearchEnter();" autocomplete="off" class="form-control" style="width:150px;" > &nbsp;
<button class="btnClear"></button>
</div>
<div id="autocomplete-list">
</div>
&nbsp;
<button id="searchBtn" type="button" class="btn btn-dark btn-sm" > <i class="bi bi-search"></i> 검색 </button>
</div>
</div>
</div>
</div> <!--card-body-->
</div> <!--card -->
</div> <!--container-fluid -->
<div class="container-fluid">
<div class="d-flex justify-content-center align-items-center">
<table class="table table-hover" id="myTable">
<thead class="table-primary">
<tr>
<th class="text-center" style="width:30px;">번호</th>
<th class="text-center" style="width:90px;">출고일</th>
<th class="text-center" style="width:70px;">접수일</th>
<th class="text-center " style="width:80px;"> 출고리스트 </th>
<th class="text-center " style="width:80px;"> <span class="badge bg-primary" > 스크린 </span> 진행 </th>
<th class="text-center" style="width:30px;">틀수</th>
<th class="text-center" style="width:30px;">제작</th>
<th class="text-center" style="width:30px;">(㎡)</th>
<th class="text-center" style="width:80px;">발주처</th>
<th class="text-center" style="width:200px;">현장명</th>
<th class="text-center" style="width:100px;">수신자</th>
<th class="text-center" style="width:120px;">수신 주소</th>
<th class="text-center" style="width:90px;"><i class="bi bi-telephone-fill"> </i> 수신처</th>
<th class="text-start" style="width:45px; "><i class="bi bi-truck"></i> 운송</th>
<th class="text-center" style="width:40px;">담당</th>
<th class="text-center" style="width:50px;">인정</th>
<th class="text-center" style="width:350px;">비고</th>
</tr>
</thead>
<?php
$start_num=$total_row; // 페이지당 표시되는 첫번째 글순번
$total_sum=0;
$total_m2=0;
$total_egi=0;
$total_egi_m2=0;
$total_m2_formatted =0;
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
include $_SERVER['DOCUMENT_ROOT'] . "/output/_row.php";
// 콤마를 제거하고 숫자로 변환
$screen_su_cleaned = floatval(str_replace(',', '', $screen_su));
$screen_m2_cleaned = floatval(str_replace(',', '', $screen_m2));
$total_sum += $screen_su_cleaned;
$total_m2 += $screen_m2_cleaned;
if($outdate!="") {
$week = array("(일)" , "(월)" , "(화)" , "(수)" , "(목)" , "(금)" ,"(토)") ;
$outdate = $outdate . $week[ date('w', strtotime($outdate) ) ] ;
}
?>
<tr onclick="redirectToView('<?= $num ?>', '<?= $tablename ?>')">
<td class="text-center" ><?= $start_num ?></td>
<td class="text-center" ><?= $outdate ?></td>
<td class="text-center" > <?= $indate ?></td>
<td class="text-center" >
<?php
switch ($regist_state) {
case "등록" :
$regist_word="등록";
echo '<span class="text-dark">' .$regist_word . '</span>';
break;
case "수정" :
$regist_word="수정";
echo '<span class="badge bg-warning blink">' .$regist_word . '</span>';
break;
case "접수" :
$regist_word="접수";
echo '<span class="text-dark">' .$regist_word . '</span>';
break;
case "완료" :
$regist_word="완료";
echo '<span class="text-dark">' .$regist_word . '</span>';
break;
}
?>
</td>
<td class="text-center" >
<?php
switch ($screen_state) {
case "등록" :
$regist_word="등록";
echo '<span class="badge bg-danger">' .$regist_word . '</span>';
break;
case "접수" :
$regist_word="접수";
echo '<span class="badge bg-success">' .$regist_word . '</span>';
break;
case "제작중" :
$regist_word="제작중";
echo '<span class="badge bg-warning">' .$regist_word . '</span>';
break;
case "완료" :
$regist_word="완료";
echo '<span class="badge bg-dark">' .$regist_word . '</span>';
break;
}
?>
</td>
<?php
$sum = isset($screen_su) ? $screen_su : 0 ;
$m2 = isset($screen_m2) ? $screen_m2 : 0 ;
$sum_two = $sum;
$m2_two = $m2 ;
$m2_two = number_format($m2_two, 1);
if ($sum_two > 0)
print '<td class="text-end" style=>' . iconv_substr($sum_two, 0, 3, "utf-8") . '</td>';
else
print '<td class="text-end" style=>&nbsp;</td>';
$screenlist = json_decode($row['screenlist'], true);
if (is_array($screenlist)) {
$total = 0;
foreach ($screenlist as $item) {
if (isset($item['done_check']) && $item['done_check'] == "1") {
$total += isset($item['number']) ? (float)$item['number'] : 0;
}
}
$total;
}
if(!empty($total))
print '<td class="text-end" >' . $total . '</td>';
else
print '<td class="text-end" > </td>';
if ($m2_two > 0)
print '<td class="text-end" style=>' . iconv_substr($m2_two, 0, 7, "utf-8") . '</td>';
else
print '<td class="text-end" style=>&nbsp;</td>';
// 소수점 첫째자리까지만 포맷팅
$total_m2_formatted = number_format($total_m2, 1);
$total_egi_m2_formatted = number_format($total_egi_m2, 1);
?>
<td class="text-start" ><?= $secondord ?></td>
<td class="text-start" ><?= $outworkplace ?></td>
<td class="text-start" ><?= $receiver ?></td>
<td class="text-start" ><?= $outputplace ?></td>
<td class="text-start" ><?= $phone ?></td>
<td class="text-start" >
<?php
if (strpos($delivery, '경동') !== false) {
echo '<span class="text-primary">' . $delivery . '</span>';
} else if (strpos($delivery, '대신') !== false) {
echo '<span class="text-success">' . $delivery . '</span>';
} else {
switch ($delivery) {
case "직접배차":
echo '<span class="badge bg-secondary">' . $delivery . '</span>';
break;
case "직접수령":
echo '<span class="badge bg-dark">' . $delivery . '</span>';
break;
case "상차(선불)":
echo '<span class="badge bg-info">' . $delivery . '</span>';
break;
case "상차(착불)":
echo '<span class="badge bg-warning">' . $delivery . '</span>';
break;
default:
echo '<span class="text-dark">' . $delivery . '</span>';
break;
}
}
?>
</td>
<td class="text-center" ><?= $orderman ?></td>
<td class="text-center"><?= $warranty ?></td>
<td class="text-start">
<?= $comment ?>
<?php if (!empty($updatecomment) && $regist_state !== '완료'): ?>
<span class="text-danger fw-bold blink"><?= $updatecomment ?></span>
<?php else: ?>
<span class="text-danger fw-bold"><?= $updatecomment ?></span>
<?php endif; ?>
</td>
</tr>
<?php
$start_num--;
}
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
?>
</tbody>
</table>
</div>
</div> <!--container-->
</form>
<script>
// 페이지 로딩
$(document).ready(function(){
var loader = document.getElementById('loadingOverlay');
if(loader)
loader.style.display = 'none';
});
</script>
<script>
var dataTable; // DataTables 인스턴스 전역 변수
var screenpageNumber; // 현재 페이지 번호 저장을 위한 전역 변수
$(document).ready(function() {
// DataTables 초기 설정
dataTable = $('#myTable').DataTable({
"paging": true,
"ordering": true,
"searching": false,
"pageLength": 30,
"lengthMenu": [30, 50, 100, 200, 500, 1000],
"language": {
"lengthMenu": "Show _MENU_ entries"
},
"order": [[0, 'desc']] // 출고예정기준 내림정렬
});
// 페이지 번호 복원 (초기 로드 시)
var savedPageNumber = getCookie('screenpageNumber');
if (savedPageNumber) {
dataTable.page(parseInt(savedPageNumber) - 1).draw(false);
}
// 페이지 변경 이벤트 리스너
dataTable.on('page.dt', function() {
var screenpageNumber = dataTable.page.info().page + 1;
setCookie('screenpageNumber', screenpageNumber, 10); // 쿠키에 페이지 번호 저장
});
// 페이지 길이 셀렉트 박스 변경 이벤트 처리
$('#myTable_length select').on('change', function() {
var selectedValue = $(this).val();
dataTable.page.len(selectedValue).draw(); // 페이지 길이 변경 (DataTable 파괴 및 재초기화 없이)
// 변경 후 현재 페이지 번호 복원
savedPageNumber = getCookie('screenpageNumber');
if (savedPageNumber) {
dataTable.page(parseInt(savedPageNumber) - 1).draw(false);
}
});
});
function restorePageNumber() {
var savedPageNumber = getCookie('screenpageNumber');
// if (savedPageNumber) {
// dataTable.page(parseInt(savedPageNumber) - 1).draw('page');
// }
location.reload();
}
function redirectToView(num, tablename) {
var url = "write_form.php?mode=view&num=" + num + "&tablename=" + tablename;
customPopup(url, '수주내역', 1850, 900);
}
$(document).ready(function() {
$("input:radio[name=separate_date]").click(function() {
process_list();
})
});
</script>
<script>
function process_list(){ // 접수일 출고일 라디오버튼 클릭시
document.getElementById('search').value=null;
document.getElementById('board_form').submit(); // form의 검색버튼 누른 효과
}
</script>
<script>
$(document).ready(function(){
$("#writeBtn").click(function(){
var tablename = '<?php echo $tablename; ?>';
var url = "write_form.php?tablename=" + tablename;
customPopup(url, '수주내역', 1850, 900);
});
});
$(document).ready(function(){
// 방문기록 남김
var title = '<?php echo $title_message; ?>';
title = '스크린 ' + title ;
saveMenuLog(title);
});
function submitForm(status) {
$('input[name=status_option]').val(status);
document.getElementById('board_form').submit();
}
$(document).ready(function(){
// 통계란
document.getElementById('total_screen').textContent = '스크린 : <?= $total_sum ?>';
document.getElementById('total_screen_m2').textContent = '면적: <?= $total_m2_formatted ?> ㎡';
});
</script>
</body>
</html>

50
make/load.php Normal file
View File

@@ -0,0 +1,50 @@
<?php session_start(); ?>
<meta charset="utf-8">
<script src="/make/make.js"></script>
<?php
$num=$_REQUEST["num"]; // 번호만 불러오자
$sort=$_REQUEST["sort"]; //
$recallcal=$_REQUEST["recallcal"]; //
$parentnum=$_REQUEST["parentnum"]; // 리스트번호
require_once("../lib/mydb.php");
$pdo = db_connect();
$sql="select * from chandj.make where num='$num'"; // 처음 오름차순
try{
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
$row = $stmh->fetch(PDO::FETCH_ASSOC);
$num=$row["num"];
$upnum=$row["upnum"];
$text1=$row["text1"];
$text2=$row["text2"];
$text3=$row["text3"];
$text4=$row["text4"];
$text5=$row["text5"];
$ordercompany=$row["ordercompany"];
$callname=$row["callname"];
$cutwidth=$row["cutwidth"];
$cutheight=$row["cutheight"];
$number=$row["number"];
$printside=$row["printside"];
$direction=$row["direction"];
$exititem=$row["exititem"];
$intervalnum=$row["intervalnum"];
$intervalnumsecond=$row["intervalnumsecond"];
$memo=$row["memo"];
$draw=$row["draw"];
$drawbottom1=$row["drawbottom1"];
$drawbottom2=$row["drawbottom2"];
$drawbottom3=$row["drawbottom3"];
$cover=$row["cover"];
$exitinterval=$row["exitinterval"];
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
header("Location:/make/write.php?num=$num&callname=$callname&cutwidth=$cutwidth&cutheight=$cutheight&ordercompany=$ordercompany&outworkplace=$ordercompany&number=$number&printside=$printside&direction=$direction&exititem=$exititem&intervalnum=$intervalnum&intervalnumsecond=$intervalnumsecond&memo=$memo&draw=$draw&drawbottom1=$drawbottom1&drawbottom2=$drawbottom2&drawbottom3=$drawbottom3&text2=$text2&sort=$sort&upnum=$upnum&recallcal=$recallcal&exitinterval=$exitinterval&cover=$cover&parentnum=$parentnum"); // 신규가입일때는 리스트로 이동
?>

29
make/load_alert.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
// print "<script> alert($modify); </script>";
$num=1;
require_once("../lib/mydb.php");
$pdo = db_connect();
try{
$sql = "select * from chandj.alert where num=?"; // get target record
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $num, PDO::PARAM_STR);
$stmh->execute();
$row = $stmh->fetch(PDO::FETCH_ASSOC);
$alerts=$row["alert"];
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
?>
<script>
var alerts='<?php echo $alerts; ?>' ;
$("#alerts").val(alerts);
//console.log(alerts);
</script>

602
make/make.js Normal file
View File

@@ -0,0 +1,602 @@
// 브라우저 호환(크로스브라우징)을 체크한후 페이지 로딩후 selectEvent() 함수를 실행 합니다. 셔터박스/린텔선택 창
if ( window.addEventListener ) {
window.addEventListener("load",selectEvent2,false);
} else if ( window.attachEvent ) {
window.attachEvent("onload",selectEvent2);
} else {
window.onload = selectEvent2;
}
function selectEvent2() {
// 폼이름,셀렉트박스이름 으로 셀렉트박스에 접근합니다.
// onchange 이벤트를 적용해줍니다.
document.selectForm2.ceilingbar.onchange = selectFun2;
}
// this.value 로 이벤트가 발생한 곳,자신(this)의 value값을 출력 합니다.
function selectFun2() {
if ( this.value == '마감선택' ) {
$("#block1").hide();
$("#guiderail_area").hide();
$("#block4").hide();
return false;
}
if ( this.value == '셔터박스' ) {
show_box();
$("#block4").hide();
}
if ( this.value == '린텔' ) {
$("#block4").show();
show_lintel();
}
}
function reload_box() {
var tmp = $("#item_sel option:selected").val(); //jQuery로 선택된 값 읽기
var tmp2 = $("#ceilingbar option:selected").val(); //jQuery로 선택된 값 읽기
if ( tmp2 == '마감선택' ) {
$("#block1").hide();
$("#guiderail_area").hide();
$("#block4").hide();
return false;
}
if ( tmp2 == '셔터박스' ) {
show_box();
$("#block4").hide();
}
if ( tmp2 == '린텔' ) {
$("#block4").show();
show_lintel();
}
}
$(document).ready(function(){
var imgs;
var img_count;
var img_position = 1;
/* $("#order_title3").hide(); // 처음실행했을때 비상문 문자 없앰
$("#order_input3").hide(); // 처음실행했을때 비상문 입력창 */
imgs = $(".slide ul");
img_count = imgs.children().length;
FSSrail();
$("#block5").show();
});
$(function() {
// 자재 출고 검색 버튼
$("#searchplace").on("click", function() {
exe_search();
});
// 자재 출고 전화번호 검색 버튼
$("#searchtel").on("click", function() {
exe_searchTel();
});
$("#gunbbang").on("click", function() {
$("#material_list").hide();
$("#guiderail_area").hide();
$("#detail").load("./gunbbang.php");
});
$("#screenexitmake").on("click", function() {
$("#material_list").hide();
$("#guiderail_area").hide();
$("#detail").load("./screenexitmake.php");
});
$("#egimake").on("click", function() { // 철재방화 사이즈 산출 클릭시
$("#material_list").hide();
$("#guiderail_area").hide();
$("#detail").load("./egimake.php");
});
$("#makeguiderail").on("click", function() { // 가이드레일 제작 메뉴얼 클릭시
$("#material_list").hide();
$("#guiderail_area").hide();
$("#detail").load("./makeguiderail.php");
});
$("#menu1").on("click", function() { // 공사진행현황
$("*").load("./work/list.php");
});
$("#menus1").on("click", function() { // 공사진행현황
$("*").load("../work/list.php");
});
//////////////////////////////////////////////////////////////////////////////////////////////////////// 자재산출 클릭시
$("#show_list").on("click", function() { // 자재산출 클릭시
show_one(); // 자재산출 클릭
});
function show_one() {
hide_object();
$("#material_list").show();
var target = document.getElementById("item_sel");
var sendData = target.options[target.selectedIndex].value ;
var ua = window.navigator.userAgent;
var postData;
var text2= document.getElementById("stwidth").value;
var text3= document.getElementById("stheight").value;
var text4= document.getElementById("motormaker").value;
var ceilingbar= document.getElementById("ceilingbar").value;
if (ua.indexOf('MSIE') > 0 || ua.indexOf('Trident') > 0) {
postData = encodeURI(sendData);
ceilingbar=encodeURI(ceilingbar);
text4=encodeURI(text4);
} else {
postData = sendData;
}
var text1 = postData;
text2=uncomma(text2); // 콤마가 있어서 숫자 변환이 안된다.
text3=uncomma(text3); // 콤마가 있어서 숫자 변환이 안된다.
document.getElementById("railheight").value = Number(text3) + 150;
document.getElementById("railheight").value = comma(document.getElementById("railheight").value);
$("#material_list").load("./show_list.php?text1="+text1 +"&text2="+text2+"&text3="+text3+"&text4="+text4+"&ceilingbar="+ceilingbar);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////// 스크린 기본 클릭
$("#show_basic_screen").on("click", function() {
$("#item_sel").val("스크린방화").prop("selected", true); // 선택사항 변경
$("#motormaker").val("경동").prop("selected", true); // 선택사항 변경
$("#power").val("220V").prop("selected", true); // 선택사항 변경
$("#guiderailmaterial").val("SUS H/L 1.5T").prop("selected", true); // 선택사항 변경
$("#wa6").show(); // 가이드레일 이미지
$("#wa6").html("<img src='../img/guiderail/fss/rail1.jpg' class='maxsmall'>");
$("#wa7").show(); // 양쪽레일 이미지
$("#ceilingbar").val("셔터박스").prop("selected", true); // 선택사항 변경
$("#ceilingmaterial").val("전면EGI1.6T+1.2T").prop("selected", true); // 천장마감재질 변경
$("#lin5").html("<img src='../img/box/fss/box1.jpg' class='maxsmall'>");
$("#wr5").html("<img src='../img/Rmolding/Rmolding1.jpg' class='maxsmall2'>");
$("#wr10").html("<img src='../img/Rcase/Rcase1.jpg' class='maxsmall3'>");
$("#block5").show(); // 엘바
$("#block6").show(); // T바
$("#we5").html("<img src='../img/Lbar/Lbar1.jpg' class='maxsmall1'>");
$("#we10").html("<img src='../img/Tbar/fssTbar1.jpg' class='maxsmall1'>");
$("#Tbar").val("SUS H/L 1.2T").prop("selected", true); // T바 재질
$("#Lbar").val("EGI 1.6T").prop("selected", true); // L바 재질
show_one(); // 자재산출 클릭
});
//////////////////////////////////////////////////////////////////////////////////////////////////////// 철재방화 기본 세팅 클릭
$("#show_basic_egi").on("click", function() {
$("#item_sel").val("철재방화EGI1.6T").prop("selected", true); // 셔터형태 선택사항 변경
$("#motormaker").val("경동").prop("selected", true); // 선택사항 변경
$("#power").val("220V").prop("selected", true); // 선택사항 변경
$("#guiderailmaterial").val("SUS H/L 1.5T").prop("selected", true); // 선택사항 변경
$("#wa6").show(); // 가이드레일 이미지
$("#wa6").html("<img src='../img/guiderail/fst/rail1.jpg' class='maxsmall'>"); // 레일 이미지 불러오기
$("#wa7").show(); // 양쪽레일 선택박스
$("#ceilingbar").val("셔터박스").prop("selected", true); // 선택사항 변경
$("#ceilingmaterial").val("전면EGI1.6T+1.2T").prop("selected", true); // 천장마감재질 변경
$("#lin5").html("<img src='../img/box/fst/box1.jpg' class='maxsmall'>");
// $("#wr5").html("<img src='../img/Rmolding/Rmolding1.jpg' class='maxsmall2'>");
// $("#wr10").html("<img src='../img/Rcase/Rcase1.jpg' class='maxsmall3'>");
// $("#block5").show(); // 엘바
$("#block6").show(); // T바
// $("#we5").html("<img src='../img/Lbar/Lbar1.jpg' class='maxsmall1'>");
$("#we10").html("<img src='../img/Tbar/fstTbar1.jpg' class='maxsmall1'>"); // T바 이미지
$("#Tbar").val("SUS H/L 1.2T").prop("selected", true); // T바 재질
// $("#Lbar").val("EGI 1.6T").prop("selected", true); // L바 재질
$("#block5").hide(); // L바 숨기기
show_one(); // 자재산출 클릭
});
$("#setenvbutton").on("click", function() {
hide_object();
$("#material_list").show();
$("#material_list").load("./setenv.php");
});
$("#viewkdmotor").on("click", function() {
window.open("../img/kdmotor.png",'경동모터 제원표',width=880,height=500);
return false;
});
$("#viewcontroler").on("click", function() {
window.open("../img/kdcontroler.jpg",'연동제어기 치수',width=880,height=500);
return false;
});
$("#viewworkerlist").on("click", function() {
window.open("../list/workerlist.xlsx");
return false;
});
$("#gotorail").on("click", function() {
hide_object();
$("#guiderail_area").show();
var target = document.getElementById("item_sel");
// alert(target.options[target.selectedIndex].value);
var sendData = target.options[target.selectedIndex].value ;
var ua = window.navigator.userAgent;
var postData;
sendData = "./rail.php?rail=" + sendData +"&sel=1"; // 첫번째 레일선택
// 윈도우라면 ?
if (ua.indexOf('MSIE') > 0 || ua.indexOf('Trident') > 0) {
postData = encodeURI(sendData);
} else {
postData = sendData;
}
$("#guiderail_area").load(postData);
});
$("#gotorailanother").on("click", function() {
show_rail();
});
$("#gotoRmolding").on("click", function() { // GotoRmolding 버튼 클릭시
show_Rmolding();
});
$("#gotoRcase").on("click", function() { // GotoRcase 버튼 클릭시
show_Rcase();
});
$("#gotoLbar").on("click", function() { // GotoLbar 버튼 클릭시
show_Lbar();
});
$("#gotoTbar").on("click", function() { // GotoTbar 버튼 클릭시
show_Tbar();
});
});
/* function openExcelFile(strFilePath) {
if (window.ActiveXObject) {
try {
var objExcel;
objExcel = new ActiveXObject("Excel.Application");
objExcel.Visible = true;
objExcel.Workbooks.Open(strLocation, false, [readonly: true|false]);
}
catch (e) {
alert (e.message);
}
}
else {
alert ("Your browser does not support this.");
}
} */
function show_Lbar() { // L바 버튼
hide_object();
$("#guiderail_area").show();
var tmp = $("#item_sel option:selected").val(); // 서터종류 선택값
var tmp2 = $("#ceilingbar option:selected").val(); // 천장마감 선택값
var sendData;
sendData = "./Lbar.php"; // L바
$("#guiderail_area").load(sendData);
}
function show_Tbar() { // T바 버튼
hide_object();
$("#guiderail_area").show();
var target = document.getElementById("item_sel");
// alert(target.options[target.selectedIndex].value);
var sendData = target.options[target.selectedIndex].value ;
var ua = window.navigator.userAgent;
var postData;
sendData = "./Tbar.php?rail=" + sendData ; // 셔터 종류 전달
// 윈도우라면 ?
if (ua.indexOf('MSIE') > 0 || ua.indexOf('Trident') > 0) {
postData = encodeURI(sendData);
} else {
postData = sendData;
}
$("#guiderail_area").load(sendData);
}
function show_rail() {
hide_object();
$("#guiderail_area").show();
var target = document.getElementById("item_sel");
// alert(target.options[target.selectedIndex].value);
var sendData = target.options[target.selectedIndex].value ;
var ua = window.navigator.userAgent;
var postData;
sendData = "./rail.php?rail=" + sendData +"&sel=2"; // 두번째 레일선택
// 윈도우라면 ?
if (ua.indexOf('MSIE') > 0 || ua.indexOf('Trident') > 0) {
postData = encodeURI(sendData);
} else {
postData = sendData;
}
$("#guiderail_area").load(postData);
}
function show_lintel() {
hide_object();
$("#guiderail_area").show();
var sendData;
sendData = "./lintel.php"; // 린텔선택
$("#guiderail_area").load(sendData);
}
function show_box() { // 셔터박스 선택하면 실행
hide_object();
$("#guiderail_area").show();
var tmp = $("#item_sel option:selected").val(); //jQuery로 선택된 값 읽기
var tmp2 = $("#ceilingbar option:selected").val(); //jQuery로 선택된 값 읽기
var sendData;
if(tmp=='스크린방화' || tmp=='제연커튼')
sendData = "./box.php"; // 스크린용 셔터박스
else
sendData = "./stbox.php"; // 철재용 셔터박스
$("#guiderail_area").load(sendData);
}
function show_Rmolding() { // R몰딩 선택하면 실행
hide_object();
$("#guiderail_area").show();
var tmp = $("#item_sel option:selected").val(); //jQuery로 선택된 값 읽기
var tmp2 = $("#ceilingbar option:selected").val(); //jQuery로 선택된 값 읽기
var sendData;
sendData = "./Rmolding.php"; // 몰딩이미지
$("#guiderail_area").load(sendData);
}
function show_Rcase() { // R케이스 버튼
hide_object();
$("#guiderail_area").show();
var tmp = $("#item_sel option:selected").val(); //jQuery로 선택된 값 읽기
var tmp2 = $("#ceilingbar option:selected").val(); //jQuery로 선택된 값 읽기
var sendData;
sendData = "./Rcase.php"; // R케이스
$("#guiderail_area").load(sendData);
}
// 브라우저 호환(크로스브라우징)을 체크한후 페이지 로딩후 selectEvent() 함수를 실행 합니다. // 셔터 종류 선택시
if ( window.addEventListener ) {
window.addEventListener("load",selectEvent,false);
} else if ( window.attachEvent ) {
window.attachEvent("onload",selectEvent);
} else {
window.onload = selectEvent;
}
function selectEvent() {
// 폼이름,셀렉트박스이름 으로 셀렉트박스에 접근합니다.
// onchange 이벤트를 적용해줍니다.
document.selectForm.item_sel.onchange = selectFun;
}
// this.value 로 이벤트가 발생한 곳,자신(this)의 value값을 출력 합니다.
function selectFun() {
$("#order_title3").hide();
$("#order_input3").hide();
$("#block2").hide(); // 삼각쫄대 감추기
$("#block3").hide(); // 짜부가스켓 감추기
$("#block5").hide(); // 엘바
$("#block6").hide(); // T바
// $("#block4").hide(); // R몰딩 R케이스 화면
if ( this.value == '셔터종류선택' ) {
return false;
}
if ( this.value == '스크린방화' ) {
FSSrail();
}
if ( this.value == '철재방화EGI1.6T' ) {
FSTrail();
}
if ( this.value != '철재방화EGI1.6T' && this.value != '스크린방화' && this.value != '셔터종류선택') { // 방화셔터가 아닐때
$("#block6").show(); // T바 보여주기
}
}
function FSSrail() {
$("#order_title3").show();
$("#order_input3").show();
$("#block2").show(); // 삼각쫄대 보이기
$("#block3").show(); // 짜부가스켓 보이기
$("#block5").show(); // 엘바
$("#block6").show(); // T바
}
function FSTrail() {
$("#order_title3").show();
$("#order_input3").show();
$("#block3").show(); // 짜부가스켓 보이기
$("#block6").show(); // T바
}
function hide_object() {
// $("#material_list").hide();
$("#guiderail_area").hide();
}
function transData(sendData) {
var ua = window.navigator.userAgent;
var postData;
if (ua.indexOf('MSIE') > 0 || ua.indexOf('Trident') > 0) {
postData = encodeURI(sendData);
} else {
postData = sendData;
}
return postData;
}
function inputNumberFormat(obj) {
obj.value = comma(uncomma(obj.value));
}
function comma(str) {
str = String(str);
return str.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, '$1,');
}
function uncomma(str) {
str = String(str);
return str.replace(/[^\d]+/g, '');
}
function previewImage(targetObj, previewId) {
var preview = document.getElementById(previewId); //div id
var ua = window.navigator.userAgent;
if (ua.indexOf("MSIE") > -1) {//ie일때
targetObj.select();
try {
var src = document.selection.createRange().text; // get file full path
var ie_preview_error = document
.getElementById("ie_preview_error_" + previewId);
if (ie_preview_error) {
preview.removeChild(ie_preview_error); //error가 있으면 delete
}
var img = document.getElementById(previewId); //이미지가 뿌려질 곳
img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"
+ src + "', sizingMethod='scale')"; //이미지 로딩, sizingMethod는 div에 맞춰서 사이즈를 자동조절 하는 역할
} catch (e) {
if (!document.getElementById("ie_preview_error_" + previewId)) {
var info = document.createElement("<p>");
info.id = "ie_preview_error_" + previewId;
info.innerHTML = "a";
preview.insertBefore(info, null);
}
}
} else { //ie가 아닐때
var files = targetObj.files;
for ( var i = 0; i < files.length; i++) {
var file = files[i];
var imageType = /image.*/; //이미지 파일일경우만.. 뿌려준다.
if (!file.type.match(imageType))
continue;
var prevImg = document.getElementById("prev_" + previewId); //이전에 미리보기가 있다면 삭제
if (prevImg) {
preview.removeChild(prevImg);
}
var img = document.createElement("img"); //크롬은 div에 이미지가 뿌려지지 않는다. 그래서 자식Element를 만든다.
img.id = "prev_" + previewId;
img.classList.add("obj");
img.file = file;
img.style.width = '50px'; //기본설정된 div의 안에 뿌려지는 효과를 주기 위해서 div크기와 같은 크기를 지정해준다.
img.style.height = '50px';
preview.appendChild(img);
if (window.FileReader) { // FireFox, Chrome, Opera 확인.
var reader = new FileReader();
reader.onloadend = (function(aImg) {
return function(e) {
aImg.src = e.target.result;
};
})(img);
reader.readAsDataURL(file);
} else { // safari is not supported FileReader
//alert('not supported FileReader');
if (!document.getElementById("sfr_preview_error_"
+ previewId)) {
var info = document.createElement("p");
info.id = "sfr_preview_error_" + previewId;
info.innerHTML = "not supported FileReader";
preview.insertBefore(info, null);
}
}
}
}
}
function drawbracket() {
var brX = Number($("#brX").val());
var brY = Number($("#brY").val());
var spaceX = 200; // 초기 x좌표 좌측 띄움
var spaceY = 100; // 초기 y좌표 좌측 띄움
var boxspaceX = 100;
var boxspaceY = 150;
var axis = brY/2 ; // Arc radius
var radius = brY/2/2 ; // Arc radius
var startAngle = 0; // Starting point on circle
var endAngle = Math.PI + (Math.PI * 2) / 2; // End point on circle
var anticlockwise = true; // clockwise or anticlockwise
// var anticlockwise = i % 2 == 0 ? false : true; // clockwise or anticlockwise
var boxwidth = brX+boxspaceX; // sutter box width
var boxheight = brY+boxspaceY; // sutter box height
// bracket 형상 그림
ctx.beginPath();
ctx.strokeStyle = "blue";
ctx.moveTo(spaceX,spaceY);
ctx.lineTo(spaceX+brX,spaceY);
ctx.lineTo(spaceX+brX,spaceY+brY);
ctx.lineTo(spaceX,spaceY+brY);
ctx.lineTo(spaceX,spaceY);
ctx.stroke();
// bracket 텍스트 넣기
ctx.font = 'italic 22px Calibri';
ctx.fillText(brX + 'X'+brY +" Bracket",spaceX+brX*3/5,spaceY+brY/2);
// 샤프트 그리기
ctx.beginPath();
ctx.strokeStyle = "red";
ctx.arc(spaceX+axis,spaceY+axis, radius, startAngle, endAngle, anticlockwise);
ctx.stroke();
//셔터박스 그리기
ctx.beginPath();
ctx.strokeStyle = "black";
ctx.moveTo(spaceX-boxspaceX*0.35,spaceY);
ctx.lineTo(spaceX+boxwidth,spaceY);
ctx.lineTo(spaceX+boxwidth,spaceY+boxheight);
ctx.lineTo(spaceX-boxspaceX*0.35,spaceY+boxheight);
ctx.lineTo(spaceX-boxspaceX*0.35,spaceY);
ctx.stroke();
}
//enter키로 form submit 막기
$('input[type="text"]').keydown(function() {
if (event.keyCode === 13) {
event.preventDefault();
}
});
function changeUri(tmpdata)
{
var ua = window.navigator.userAgent;
var postData;
if (ua.indexOf('MSIE') > 0 || ua.indexOf('Trident') > 0) {
postData = encodeURI(tmpdata);
} else {
postData = tmpdata;
}
return postData;
}

202
make/print.php Normal file
View File

@@ -0,0 +1,202 @@
<!doctype html>
<?php
session_start();
$img_name="/img/screenorder.jpg";
$num=$_REQUEST["num"];
$upnum=$_REQUEST["upnum"];
$sort=$_REQUEST["sort"]; //정렬 1번 내림차순, 2번 오름차순
$find=$_REQUEST["find"]; // 검색항목
$page=$_REQUEST["page"]; //페이지번호
$process=$_REQUEST["process"]; // 진행현황
$asprocess=$_REQUEST["asprocess"]; // as진행현황
$m2=$_REQUEST["m2"]; // m2 면적
require_once("../lib/mydb.php");
$pdo = db_connect();
try{
$sql = "select * from chandj.orderlist where num=?";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $num, PDO::PARAM_STR);
$stmh->execute();
$row = $stmh->fetch(PDO::FETCH_ASSOC);
$outdate=$row["outdate"];
$indate=$row["indate"];
$orderman=$row["orderman"];
$outworkplace=$row["outworkplace"];
$outputplace=$row["outputplace"];
$receiver=$row["receiver"];
$phone=$row["phone"];
$comment=$row["comment"];
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
if($outdate!="") {
$week = array("(일)" , "(월)" , "(화)" , "(수)" , "(목)" , "(금)" ,"(토)") ;
$outdate = $outdate . $week[ date('w', strtotime($outdate) ) ] ;
}
$pagenum=1;
// 발주서 레코드 수량 파악해서 8개 이상이면 2페이지 이상 출력토록 만드는 서브루틴
if($sort=='1')
$sql="select * from chandj.make where upnum='$upnum' order by num asc"; // 처음 오름차순
else
$sql="select * from chandj.make where upnum='$upnum' order by num desc"; // 처음 내림차순
try{
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
$total_count=$stmh->rowCount();
// print "<script> alert($total_count) </script>";
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
// 배열선언
$text1=[];
$text2=[];
$memo=[];
$draw=[];
$drawbottom1=[];
$drawbottom2=[];
$drawbottom3=[];
if($sort=='1')
$sql="select * from chandj.make where upnum='$upnum' order by num asc"; // 처음 오름차순
else
$sql="select * from chandj.make where upnum='$upnum' order by num desc"; // 처음 내림차순
try{
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
$counter=0;
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
$upnum=$row["upnum"];
if((int)$upnum==(int)$num)
{
$text1[$counter]=$row["text1"];
$text2[$counter]=$row["text2"];
$memo[$counter]=$row["memo"];
$draw[$counter]=$row["draw"];
$drawbottom1[$counter]=$row["drawbottom1"];
$drawbottom2[$counter]=$row["drawbottom2"];
$drawbottom3[$counter]=$row["drawbottom3"];
$start_num--;
$counter++;
}
}
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
$recnum=8; //레코드수가 8개 넘으면 다음페이지로 출력
$limit=ceil($total_count/$recnum);
// print "<script> alert($limit) </script>";
?>
<html lang="ko">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="../css/common.css">
<link rel="stylesheet" type="text/css" media="print" href="../css/print2.css">
<link rel="stylesheet" type="text/css" href="../css/screenlist.css">
<!-- <link rel="stylesheet" type="text/css" href="../css/orderprint.css"> 발주서 인쇄에 맞게 수정하기 위한 css -->
<title>발주서 출력</title>
</head>
<body>
<?php
for($j=0;$j<$limit;$j++)
{
$pagenum=$j+1; // 페이지번호 산출
?>
<div id="print">
<div id="outlineprint">
<div class="img">
<div id="row1"> 페이지번호 : &nbsp; <?=$pagenum?> / &nbsp; <?=$limit?> </div> <!-- end of row1 -->
<div class="clear"> </div>
<div id="row2">
<div id="col1"> <?=$outdate?>
</div> <!-- end of row2 col1-->
<div id="col2"> <?=$indate?> &nbsp;&nbsp; (면적 : <?=$m2?>㎡)
</div> <!-- end of row2 col2-->
</div> <!-- end of row2 -->
<div class="clear"> </div>
<div id="row3">
<div id="col1"> <?=$receiver?>
</div> <!-- end of row3 col1-->
<div id="col2"> <?=$outworkplace?>
</div> <!-- end of row3 col2-->
</div> <!-- end of row3 -->
<div class="clear"> </div>
<div id="row4">
<div id="col1"> <?=$phone?>
</div> <!-- end of row4 col1-->
<div id="col2"> <?=$outputplace?>
</div> <!-- end of row4 col2-->
</div> <!-- end of row4 -->
<div id="row5"> " <?=$comment?> "
</div> <!-- end of row5 -->
<div id="containers" >
<div id="display_result" >
<div id="ares1"> 번호 </div>
<div id="ares2"> 부호 </div>
<div id="ares3"> 스크린제작 치수 너비(W) x 높이(H) , 수량(EA) </div>
<div class="clear"> </div>
<?php
$repeat=$total_count-$j*$recnum;
if($repeat>=8)
$repeat=8;
for($i=$j*$recnum;$i<=$j*$recnum+$repeat-1;$i++)
{
?>
<div id="res1"> <?=$i+1?> </div>
<div id="res2"> <?=$text1[$i]?> </div>
<div id="firstoutline">
<div id="fres1"> <?=$text2[$i]?> </div>
<div id="fres2"> <?=$memo[$i]?> </div>
</div>
<div id="outline">
<div id="res4"> <?=$draw[$i]?> </div>
<div class="clear"> </div>
<div id="res5"> <?=$drawbottom1[$i]?> </div>
<div id="res7"> <?=$drawbottom3[$i]?> </div>
<div id="res6"> <?=$drawbottom2[$i]?> </div>
</div>
<div class="clear"> </div>
<?php
}
?>
</div> <!-- end of display_result -->
</div> <!-- end of containers -->
</div>
</div> <!-- end of outline -->
</div> <!-- end of print -->
<?php
}
?>
</body>
</html>

173
make/print_list.php Normal file
View File

@@ -0,0 +1,173 @@
<?php
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);
}
$common=" where outdate between date('$fromdate') and date('$Transtodate') order by outdate ";
$find1="경동";
$find2="대신";
$con1 =" where (delivery like '%$find1%') and (outdate between date('$fromdate') and date('$Transtodate')) order by outdate ";
$con2 =" where (delivery like '%$find2%') and (outdate between date('$fromdate') and date('$Transtodate')) order by outdate ";
$a= $con1 . "desc "; //경동화물/화물
$b= $con2 . "desc "; //대신화물/화물
$ksql = "select * from chandj.output " . $a; //경동
$dsql = "select * from chandj.output " . $b; //대신
$nowday=date("Y-m-d"); // 현재일자 변수지정
?>
<html lang="ko">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="../css/common.css">
<link rel="stylesheet" type="text/css" href="../css/output.css">
<link rel="stylesheet" type="text/css" media="print" href="../css/print.css">
<title>화물 당일 출고 리스트</title>
</head>
<body onload="pagePrintPreview();" >
<div id="print">
<div class="img">
<div class="menu">
<div class="print1"> <?=$Transtodate?> </div>
<div class="clear"> </div>
<?php
try{
$stmh = $pdo->query($ksql); // 경동화물 가는 것들
$temp=$stmh->rowCount();
$total_row = $temp; // 전체 글수
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
$num=$row["num"];
$outdate=$row["outdate"];
$indate=$row["indate"];
$orderman=$row["orderman"];
$outworkplace=$row["outworkplace"];
$outputplace=$row["outputplace"];
$receiver=$row["receiver"];
$phone=$row["phone"];
$comment=$row["comment"];
$root=$row["root"];
$steel=$row["steel"];
$motor=$row["motor"];
$delivery=$row["delivery"];
?>
<div class="print1_1"> 경동 </div>
<div class="print2"> <?=$receiver?> </div>
<div class="print3"> <?=substr($comment,0,105)?> </div>
<div class="print4"> <?=substr($outputplace,0,90)?> </div>
<div class="print5"> <?=substr($phone,0,13)?> </div>
<div class="print6"> <?=$delivery?> </div>
<div class="clear"> </div>
<?php
} // end of while
} // end of try
catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
?>
<div class="print1_1"> </div> <!--중간에 공백한칸 만들기 -->
<div class="print2"> </div>
<div class="print3"> </div>
<div class="print4"> </div>
<div class="print5"> </div>
<div class="print6"> </div>
<div class="clear"> </div>
<div class="print1_1"> </div> <!--중간에 공백한칸 만들기 -->
<div class="print2"> </div>
<div class="print3"> </div>
<div class="print4"> </div>
<div class="print5"> </div>
<div class="print6"> </div>
<div class="clear"> </div>
<?php
///////////////////////////////////////////// 대신화물 처리부분
try{
$stmh = $pdo->query($dsql);
$temp=$stmh->rowCount();
$total_row = $temp;
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
$num=$row["num"];
$outdate=$row["outdate"];
$indate=$row["indate"];
$orderman=$row["orderman"];
$outworkplace=$row["outworkplace"];
$outputplace=$row["outputplace"];
$receiver=$row["receiver"];
$phone=$row["phone"];
$comment=$row["comment"];
$root=$row["root"];
$steel=$row["steel"];
$motor=$row["motor"];
$delivery=$row["delivery"];
?>
<div class="print1_1"> 대신 </div>
<div class="print2"> <?=$receiver?> </div>
<div class="print3"> <?=substr($comment,0,105)?> </div>
<div class="print4"> <?=substr($outputplace,0,90)?> </div>
<div class="print5"> <?=substr($phone,0,13)?> </div>
<div class="print6"> <?=$delivery?> </div>
<div class="clear"> </div>
<?php
} // end of while
} // end of try
catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
?>
</div> <!-- end of menu -->
</div>
</div>
</body>
</html>

78
make/process_DB.php Normal file
View File

@@ -0,0 +1,78 @@
<?php
session_start();
$level= $_SESSION["level"];
if(!isset($_SESSION["level"]) || $level>=8) {
echo "<script> alert('관리자 승인이 필요합니다.') </script>";
sleep(2);
header ("Location:/login/logout.php");
exit;
}
if(isset($_REQUEST["page"]))
$page=$_REQUEST["page"];
else
$page=1; // 1로 설정해야 함
if(isset($_REQUEST["mode"])) //modify_form에서 호출할 경우
$mode=$_REQUEST["mode"];
else
$mode="";
if(isset($_REQUEST["num"]))
$num=$_REQUEST["num"];
else
$num="";
if(isset($_REQUEST["search"])) //수정 버튼을 클릭해서 호출했는지 체크
$search=$_REQUEST["search"];
else
$search="";
if(isset($_REQUEST["find"])) //수정 버튼을 클릭해서 호출했는지 체크
$find=$_REQUEST["find"];
else
$find="";
if(isset($_REQUEST["process"])) //수정 버튼을 클릭해서 호출했는지 체크
$process=$_REQUEST["process"];
else
$process="전체";
$fromdate=$_REQUEST["fromdate"];
$todate=$_REQUEST["todate"];
// code는 접수완료, 처리완료를 표시해 준다.
$code=$_REQUEST["code"];
if($code=="1")
$regist_state="2";
else
$regist_state="3";
require_once("../lib/mydb.php");
$pdo = db_connect();
try{
$sql = "select regist_state from chandj.output where num=?"; // get target record
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1,$num,PDO::PARAM_STR);
$stmh->execute();
$row = $stmh->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
try{
$pdo->beginTransaction();
$sql = "update chandj.output set regist_state=? where num=? LIMIT 1";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $regist_state, PDO::PARAM_STR);
$stmh->bindValue(2, $num, PDO::PARAM_STR); //고유키값이 같나?의 의미로 ?로 num으로 맞춰야 합니다. where 구문
$stmh->execute();
$pdo->commit();
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
header("Location:/output/view.php?num=$num&page=$page&search=$search&find=$find&process=$process&yearcheckbox=$yearcheckbox&year=$year&fromdate=$fromdate&todate=$todate&separate_date=$separate_date");
?>

29
make/save_alert.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
$choice=$_REQUEST["choice"];
// print "<script> alert($modify); </script>";
$num=1;
require_once("../lib/mydb.php");
$pdo = db_connect();
if($choice=='2') $alerts=0; // 알람해제
else
$alerts=1; // 알람설정
try{
$pdo->beginTransaction();
$sql = "update chandj.alert set alert=? ";
$sql .= " where num=? LIMIT 1";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $alerts, PDO::PARAM_STR);
$stmh->bindValue(2, $num, PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
?>

48
make/save_check.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
$num=$_REQUEST["num"]; // 전달인수가 변수명과 겹치면 오류가 발생해서 받아들이지 않는다.
$left_check=$_REQUEST["left_check"];
$right_check=$_REQUEST["right_check"];
$mid_check=$_REQUEST["mid_check"];
$done_check=$_REQUEST["done_check"];
$remain_check=$_REQUEST["remain_check"];
// print "<script> alert($modify); </script>";
require_once("../lib/mydb.php");
$pdo = db_connect();
try{
$sql = "select * from chandj.make where num=?"; // get target record
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1,$num,PDO::PARAM_STR);
$stmh->execute();
$row = $stmh->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
try{
$pdo->beginTransaction();
$sql = "update chandj.make set left_check=?, mid_check=?, right_check=?, done_check=?, remain_check=? ";
$sql .= " where num=? LIMIT 1";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $left_check, PDO::PARAM_STR);
$stmh->bindValue(2, $mid_check, PDO::PARAM_STR);
$stmh->bindValue(3, $right_check, PDO::PARAM_STR);
$stmh->bindValue(4, $done_check, PDO::PARAM_STR);
$stmh->bindValue(5, $remain_check, PDO::PARAM_STR);
$stmh->bindValue(6, $num, PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
?>

260
make/savefile.php Normal file
View File

@@ -0,0 +1,260 @@
<!doctype html>
<?php
session_start();
$img_name="/img/screenorder.jpg";
$num=$_REQUEST["num"];
$upnum=$_REQUEST["upnum"];
$sort=$_REQUEST["sort"]; //정렬 1번 내림차순, 2번 오름차순
$receiver=$_REQUEST["receiver"]; //수신처
$find=$_REQUEST["find"]; // 검색항목
$page=$_REQUEST["page"]; //페이지번호
$m2=$_REQUEST["m2"]; // m2 면적
require_once("../lib/mydb.php");
$pdo = db_connect();
try{
$sql = "select * from chandj.orderlist where num=?";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $num, PDO::PARAM_STR);
$stmh->execute();
$row = $stmh->fetch(PDO::FETCH_ASSOC);
$outdate=$row["outdate"];
$indate=$row["indate"];
$orderman=$row["orderman"];
$outworkplace=$row["outworkplace"];
$outputplace=$row["outputplace"];
$receiver=$row["receiver"];
$phone=$row["phone"];
$comment=$row["comment"];
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
if($outdate!="") {
$week = array("(일)" , "(월)" , "(화)" , "(수)" , "(목)" , "(금)" ,"(토)") ;
$outdate = $outdate . $week[ date('w', strtotime($outdate) ) ] ;
}
$pagenum=1;
// 발주서 레코드 수량 파악해서 8개 이상이면 2페이지 이상 출력토록 만드는 서브루틴
if($sort=='1')
$sql="select * from chandj.make where upnum='$upnum' order by num asc"; // 처음 오름차순
else
$sql="select * from chandj.make where upnum='$upnum' order by num desc"; // 처음 내림차순
try{
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
$total_count=$stmh->rowCount();
// print "<script> alert($total_count) </script>";
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
// 배열선언
$text1=[];
$text2=[];
$memo=[];
$draw=[];
$drawbottom1=[];
$drawbottom2=[];
$drawbottom3=[];
try{
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
$counter=0;
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
$upnum=$row["upnum"];
if((int)$upnum==(int)$num)
{
$text1[$counter]=$row["text1"];
$text2[$counter]=$row["text2"];
$memo[$counter]=$row["memo"];
$draw[$counter]=$row["draw"];
$drawbottom1[$counter]=$row["drawbottom1"];
$drawbottom2[$counter]=$row["drawbottom2"];
$drawbottom3[$counter]=$row["drawbottom3"];
$start_num--;
$counter++;
}
}
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
$recnum=8; //레코드수가 8개 넘으면 다음페이지로 출력
$limit=ceil($total_count/$recnum);
// print "<script> alert($limit) </script>";
?>
<html lang="ko">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="../css/common.css">
<link rel="stylesheet" type="text/css" media="print" href="../css/print2.css">
<link rel="stylesheet" type="text/css" href="../css/screenlist.css">
<link rel="stylesheet" type="text/css" href="../css/save_screenlist.css">
<!-- <link rel="stylesheet" type="text/css" href="../css/orderprint.css"> 발주서 인쇄에 맞게 수정하기 위한 css -->
<title>발주서 출력</title>
</head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="../js/html2canvas.js"></script> <!-- 스크린샷을 위한 자바스크립트 함수 불러오기 -->
<script>
function partShot(number) {
var d = new Date();
var currentDate = ( d.getMonth() + 1 ) + "-" + d.getDate() + "_" ;
var currentTime = d.getHours() + "_" + d.getMinutes() +"_" + d.getSeconds() ;
var result = 'screen' + currentDate + currentTime + '__' + number +'.jpg';
//특정부분 스크린샷
html2canvas(document.getElementById("outlineprint"+number))
//id outlineprint 부분만 스크린샷
.then(function (canvas) {
//jpg 결과값
drawImg(canvas.toDataURL('image/jpeg'));
//이미지 저장
saveAs(canvas.toDataURL(), result);
}).catch(function (err) {
console.log(err);
});
}
function drawImg(imgData) {
console.log(imgData);
//imgData의 결과값을 console 로그롤 보실 수 있습니다.
return new Promise(function reslove() {
//내가 결과 값을 그릴 canvas 부분 설정
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
//canvas의 뿌려진 부분 초기화
ctx.clearRect(0, 0, canvas.width, canvas.height);
var imageObj = new Image();
imageObj.onload = function () {
ctx.drawImage(imageObj, 10, 10);
//canvas img를 그리겠다.
};
imageObj.src = imgData;
//그릴 image데이터를 넣어준다.
}, function reject() { });
}
function saveAs(uri, filename) {
var link = document.createElement('a');
if (typeof link.download === 'string') {
link.href = uri;
link.download = filename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
} else {
window.open(uri);
}
}
function cleardiv() {
$('#outlineprint').empty();
}
</script>
<body>
<?php
for($j=0;$j<$limit;$j++)
{
$pagenum=$j+1; // 페이지번호 산출
?>
<div id="print">
<div id="outlineprint<?=$pagenum?>">
<div class="img">
<div id="row1"> 페이지번호 : &nbsp; <?=$pagenum?> / &nbsp; <?=$limit?> </div> <!-- end of row1 -->
<div class="clear"> </div>
<div id="row2">
<div id="col1"> <?=$outdate?>
</div> <!-- end of row2 col1-->
<div id="col2"> <?=$indate?> &nbsp;&nbsp; (면적 : <?=$m2?>㎡)
</div> <!-- end of row2 col2-->
</div> <!-- end of row2 -->
<div class="clear"> </div>
<div id="row3">
<div id="col1"> <?=$receiver?>
</div> <!-- end of row3 col1-->
<div id="col2"> <?=$outworkplace?>
</div> <!-- end of row3 col2-->
</div> <!-- end of row3 -->
<div class="clear"> </div>
<div id="row4">
<div id="col1"> <?=$phone?>
</div> <!-- end of row4 col1-->
<div id="col2"> <?=$outputplace?>
</div> <!-- end of row4 col2-->
</div> <!-- end of row4 -->
<div id="row5"> " <?=$comment?> "
</div> <!-- end of row5 -->
<div id="containers" >
<div id="display_result" >
<div id="ares1"> 번호 </div>
<div id="ares2"> 부호 </div>
<div id="ares3"> 스크린제작 치수 너비(W) x 높이(H) , 수량(EA) </div>
<div class="clear"> </div>
<?php
$repeat=$total_count-$j*$recnum;
if($repeat>=8)
$repeat=8;
for($i=$j*$recnum;$i<=$j*$recnum+$repeat-1;$i++)
{
?>
<div id="printres1"> <?=$i+1?> </div>
<div id="printres2"> <?=$text1[$i]?> </div>
<div id="firstoutline">
<div id="fprintres1"> <?=$text2[$i]?> </div>
<div id="fprintres2"> <?=$memo[$i]?> </div>
</div>
<div id="outline">
<div id="res4"> <?=$draw[$i]?> </div>
<div class="clear"> </div>
<div id="res5"> <?=$drawbottom1[$i]?> </div>
<div id="res7"> <?=$drawbottom3[$i]?> </div>
<div id="res6"> <?=$drawbottom2[$i]?> </div>
</div>
<div class="clear"> </div>
<?php
}
?>
</div> <!-- end of display_result -->
</div> <!-- end of containers -->
</div>
</div> <!-- end of outline -->
</div> <!-- end of print -->
<?php
print "<script> partShot($pagenum); </script>";
}
?>
<canvas id="canvas" width="1200" height="1600"style="border:1px solid #d3d3d3; display:none;"></canvas>
</body>
</html>

246
make/search.php Normal file
View File

@@ -0,0 +1,246 @@
<?php
session_start();
$level= $_SESSION["level"];
if(!isset($_SESSION["level"]) || $level>5) {
/* alert("관리자 승인이 필요합니다."); */
sleep(2);
header ("Location:/login/logout.php");
exit;
}
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
header("Expires: 0"); // rfc2616 - Section 14.21
//header("Refresh:0"); // reload refresh
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="../css/common.css">
<link rel="stylesheet" type="text/css" href="../css/work.css">
<link rel="stylesheet" type="text/css" href="../css/special.css">
<title> 주일기업 통합정보시스템 </title>
</head>
<?php
if(isset($_REQUEST["search"])) //목록표에 제목,이름 등 나오는 부분
$search=$_REQUEST["search"];
require_once("../lib/mydb.php");
$pdo = db_connect();
// $find="firstord"; //검색할때 고정시킬 부분 저장 ex) 전체/공사담당/건설사 등
if(isset($_REQUEST["page"])) // $_REQUEST["page"]값이 없을 때에는 1로 지정
{
$page=$_REQUEST["page"]; // 페이지 번호
}
else
{
$page=1;
}
$scale = 20; // 한 페이지에 보여질 게시글 수
$page_scale = 10; // 한 페이지당 표시될 페이지 수 10페이지
$first_num = ($page-1) * $scale; // 리스트에 표시되는 게시글의 첫 순번.
if(isset($_REQUEST["mode"]))
$mode=$_REQUEST["mode"];
else
$mode="";
$a=" order by num desc limit $first_num, $scale";
$b=" order by num desc";
$sql ="select * from chandj.work where ((condate like '%$search%' ) or (workplacename like '%$search%' ) or (chargedperson like '%$search%' )";
$sql .="or (firstord like '%$search%' ) or (secondord like '%$search%' ) or (worker like '%$search%' ) or (cablestaff like '%$search%' ) or (address like '%$search%' )) " . $a;
$sqlcon ="select * from chandj.work where ((condate like '%$search%' ) or (workplacename like '%$search%' ) or (chargedperson like '%$search%' )";
$sqlcon .="or (firstord like '%$search%' ) or (secondord like '%$search%' ) or (worker like '%$search%' ) or (cablestaff like '%$search%' ) or (address like '%$search%')) " . $b;
try{
$allstmh = $pdo->query($sqlcon); // 검색 조건에 맞는 쿼리 전체 개수
$temp2=$allstmh->rowCount();
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
$temp1=$stmh->rowCount();
$total_row = $temp2; // 전체 글수
$total_page = ceil($total_row / $scale); // 검색 전체 페이지 블록 수
$current_page = ceil($page/$page_scale); //현재 페이지 블록 위치계산
// print "$page&nbsp;$total_page&nbsp;$current_page&nbsp;$search&nbsp;$mode";
?>
<body onload="_no_Back();" onpageshow="if(event.persisted)_no_Back();">
<div id="wrap">
<div id="content">
<form name="board_form" method="post" action="search.php?mode=search&search=<?=$search?>&find=<?=$find?>&process=<?=$process?>&yearcheckbox=<?=$yearcheckbox?>&year=<?=$year?>">
<div id="col2">
<div id="list_search">
<div id="list_search1">▷ 총 <?= $total_row ?> 개의 자료 파일이 있습니다. 검색어 : <?= $search ?>
<?php
if($total_row==0)
{
print "<button type='button' id='search_directinput' class='button button2' > 직접입력 </button>";
}
?>
</div>
</div> <!-- end of list_search3 -->
<br>
<div id="outlist_top_title">
<ul>
<li id="outlist_title1">번호</li>
<li id="outlist_title2">현 장 명</li> <!-- 공사현장명 이미 -->
<li id="outlist_title3">발 주 처</li>
<li id="outlist_title4">발주처담당</li>
<li id="outlist_title5">공사담당</li>
<li id="outlist_title6">진행현황</li>
<li id="outlist_title7">요청사항</li>
<li id="outlist_title8">최근수정일</li>
</ul>
</div> <!-- end of list_top_title -->
<br><br>
<div id="list_content">
<?php
if ($page<=1)
$start_num=$total_row; // 페이지당 표시되는 첫번째 글순번
else
$start_num=$total_row-($page-1) * $scale;
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
$item_num=$row["num"];
$item_id=$row["id"];
$item_name=$row["chargedperson"];
$item_nick=$row["nick"];
$item_hit=$row["hit"];
$item_man=$row["chargedperson"];
$item_date=$row["regist_day"];
$item_date=substr($item_date, 0, 10);
$item_orderco=$row["secondord"];
$item_orderman=$row["secondordman"];
$worker=$row["worker"];
$checkstep=$row["checkstep"];
$item_subject=$row["workplacename"];
$address=$row["address"];
$item_subject=mb_substr($item_subject,0,20,'utf-8');
if(mb_strlen($item_subject,'utf-8')>=20)
$item_subject=$item_subject . "..."; // 글자수가 초과하면 ...으로 표기됨
$state_work=0;
if(substr($row["condate"],0,2)=="20") $state_work=1;
if(substr($row["workday"],0,2)=="20") $state_work=2;
if(substr($row["endworkday"],0,2)=="20") $state_work=3;
if(substr($row["cableday"],0,2)=="20") $state_work=4;
if(substr($row["endcableday"],0,2)=="20") $state_work=5;
$font="black";
switch ($state_work) {
case 1: $state_str="착공전"; $font="black";break;
case 2: $state_str="시공중"; $font="blue"; break;
case 3: $state_str="결선대기"; $font="brown"; break;
case 4: $state_str="결선중"; $font="purple"; break;
case 5: $state_str="결선완료"; $font="red";break;
default: $font="grey"; $state_str="계약전";
}
$font1="black";
switch ($checkstep) {
case "상담요청" : $checkstep_str="상담요청"; $font1="black";break;
case "방문요청" : $checkstep_str="방문요청"; $font1="blue"; break;
case "실측요청" : $checkstep_str="실측요청"; $font1="red"; break;
case "발주요청" : $checkstep_str="발주요청"; $font1="grey"; break;
case "결선요청" : $checkstep_str="결선요청"; $font1="green"; break;
case "견적요청" : $checkstep_str="견적요청"; $font1="brown"; break;
default: $font1="grey"; $checkstep_str="";
}
$sql="select * from chandj.work_ripple where parent=$item_num";
$allstmh = $pdo->query($sql);
$num_ripple=$allstmh->rowCount();
?>
<div id="sub_item">
<div id="sub_item1"><?= $start_num ?>&nbsp;</div>
<div id="sub_item2"> <a href="#" onclick="intoval('<?=$item_subject?>','<?=$address?>','<?=$worker?>','<?=$item_num?>','<?=$item_man?>'); return false;" style="font-size=10px;" ><?= $item_subject ?>&nbsp;</a>
</div>
<div id="sub_item3"><?=substr($item_orderco,0,25)?>&nbsp;</div>
<div id="sub_item4"><?=substr($item_orderman,0,25)?>&nbsp;</div>
<div id="sub_item5"><?= $item_man?>&nbsp;</div>
<div id="sub_item6" style="color:<?=$font?>;" ><?= $state_str?>&nbsp;</div>
<div id="sub_item8" style="color:<?=$font1?>;" ><div id class="blink" style="white-space:nowrap"><?= $checkstep_str?>&nbsp;</div></div>
<div id="sub_item7"><?= $item_date?>&nbsp;</div>
</div>
<?php
$start_num--;
}
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
// 페이지 구분 블럭의 첫 페이지 수 계산 ($start_page)
$start_page = ($current_page - 1) * $page_scale + 1;
// 페이지 구분 블럭의 마지막 페이지 수 계산 ($end_page)
$end_page = $start_page + $page_scale - 1;
?>
<div id="page_button">
<div id="page_num">
<?php
if($page!=1 && $page>$page_scale)
{
$prev_page = $page - $page_scale;
// 이전 페이지값은 해당 페이지 수에서 리스트에 표시될 페이지수 만큼 감소
if($prev_page <= 0)
$prev_page = 1; // 만약 감소한 값이 0보다 작거나 같으면 1로 고정
print "<a href=search.php?page=$prev_page&search=$search&find=$find&list=1&process=$process&yearcheckbox=$yearcheckbox&year=$year>◀ </a>";
}
for($i=$start_page; $i<=$end_page && $i<= $total_page; $i++)
{ // [1][2][3] 페이지 번호 목록 출력
if($page==$i) // 현재 위치한 페이지는 링크 출력을 하지 않도록 설정.
print "<font color=red><b>[$i]</b></font>";
else
print "<a href=search.php?page=$i&search=$search&find=$find&list=1&process=$process&yearcheckbox=$yearcheckbox&year=$year>[$i]</a>";
}
if($page<$total_page)
{
$next_page = $page + $page_scale;
if($next_page > $total_page)
$next_page = $total_page;
// netx_page 값이 전체 페이지수 보다 크면 맨 뒤 페이지로 이동시킴
print "<a href=search.php?page=$next_page&search=$search&find=$find&list=1&process=$process&yearcheckbox=$yearcheckbox&year=$year> ▶</a><p>";
}
?>
</div>
</div>
</div>
</div> <!-- end of col2 -->
</form>
</div> <!-- end of content -->
</div> <!-- end of wrap -->
<script>
function check_level()
{
window.open("check_level.php?nick="+document.member_form.nick.value,"NICKcheck", "left=200,top=200,width=300,height=100, scrollbars=no, resizable=yes");
}
function intoval(name,address,worker,con_num,chargedman)
{
$("#displaysearch").hide();
document.getElementById("outworkplace").value = name;
document.getElementById("outputplace").value = address;
document.getElementById("receiver").value = worker;
document.getElementById("con_num").value = con_num;
document.getElementById("orderman").value = chargedman;
$("#searchtel").trigger("click"); // 제이쿼리 클릭 이벤트 발생 전화번호 클릭한 효과발생하기
}
$("#search_directinput").on("click", function() {
$("#displaysearch").hide();
});
</script>
</body>
</html>

447
make/searchkd.php Normal file
View File

@@ -0,0 +1,447 @@
<?php
session_start();
$level= $_SESSION["level"];
if(!isset($_SESSION["level"]) || $level>8) {
/* alert("관리자 승인이 필요합니다."); */
sleep(2);
header ("Location:/login/logout.php");
exit;
}
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
header("Expires: 0"); // rfc2616 - Section 14.21
//header("Refresh:0"); // reload refresh
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="../css/common.css">
<link rel="stylesheet" type="text/css" href="../css/screenmake.css">
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <!--날짜 선택 창 UI 필요 -->
<title> 주일기업 통합정보시스템 </title>
</head>
<script>
window.history.forward(0);
history.navigationMode = 'compatible'; // 오페라, 사파리 뒤로가기 막기
function _no_Back(){
window.history.forward(0);
}
</script>
<?php
if(isset($_REQUEST["search"])) //목록표에 제목,이름 등 나오는 부분
$search=$_REQUEST["search"];
if(isset($_REQUEST["list"])) //목록표에 제목,이름 등 나오는 부분
$list=$_REQUEST["list"];
else
$list=0;
require_once("../lib/mydb.php");
$pdo = db_connect();
// $find="firstord"; //검색할때 고정시킬 부분 저장 ex) 전체/공사담당/건설사 등
if(isset($_REQUEST["page"])) // $_REQUEST["page"]값이 없을 때에는 1로 지정
{
$page=$_REQUEST["page"]; // 페이지 번호
}
else
{
$page=1;
}
$scale = 15; // 한 페이지에 보여질 게시글 수
$page_scale = 10; // 한 페이지당 표시될 페이지 수 10페이지
$first_num = ($page-1) * $scale; // 리스트에 표시되는 게시글의 첫 순번.
if(isset($_REQUEST["mode"]))
$mode=$_REQUEST["mode"];
else
$mode="";
$cursort=$_REQUEST["cursort"]; // 현재 정렬모드 지정
if(isset($_REQUEST["sortof"]))
{
$sortof=$_REQUEST["sortof"]; // 클릭해서 넘겨준 값
if($sortof==1) {
if($cursort!=1)
$cursort=1;
else
$cursort=2;
}
if($sortof==2) { //접수일 클릭되었을때
if($cursort!=3)
$cursort=3;
else
$cursort=4;
}
if($sortof==3) { //구분 클릭되었을때
if($cursort!=5)
$cursort=5;
else
$cursort=6;
}
if($sortof==4) { //절곡 클릭되었을때
if($cursort!=7)
$cursort=7;
else
$cursort=8;
}
if($sortof==5) { //모터 클릭되었을때
if($cursort!=9)
$cursort=9;
else
$cursort=10;
}
}
else
{
$sortof=0;
$cursort=0;
}
// 기간을 정하는 구간
$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);
}
if(isset($_REQUEST["find"])) //목록표에 제목,이름 등 나오는 부분
$find=$_REQUEST["find"];
$process="전체"; // 기본 전체로 정한다.
/*
$a=" order by outdate desc limit $first_num, $scale";
$b=" order by outdate desc"; */
$common=" where outdate between date('$fromdate') and date('$Transtodate') order by outdate ";
$a= $common . " desc limit $first_num, $scale"; //내림차순
$b= $common . " desc "; //내림차순 전체
$c= $common . " asc limit $first_num, $scale"; //오름차순
$d= $common . " asc "; //오름차순 전체
$where=" where outdate between date('$fromdate') and date('$Transtodate') ";
$all=" limit $first_num, $scale";
if($mode=="search"){
if($search==""){
$sql="select * from chandj.output " . $a;
$sqlcon = "select * from chandj.output " . $b; // 전체 레코드수를 파악하기 위함.
}
elseif($search!="") { // 각 필드별로 검색어가 있는지 쿼리주는 부분
$sql ="select * from chandj.output where (outdate like '%$search%') or (outworkplace like '%$search%') ";
$sql .="or (orderman like '%$search%') or (outputplace like '%$search%') or (receiver like '%$search%') or";
$sql .=" (phone like '%$search%') or (comment like '%$search%') order by outdate desc limit $first_num, $scale ";
$sqlcon ="select * from chandj.output where (outdate like '%$search%') or (outworkplace like '%$search%') ";
$sqlcon .="or (orderman like '%$search%') or (outputplace like '%$search%') or (receiver like '%$search%') or";
$sqlcon .=" (phone like '%$search%') or (comment like '%$search%') order by outdate desc";
}
}
if($mode=="") {
$sql="select * from chandj.output " . $a;
$sqlcon = "select * from chandj.output " . $b; // 전체 레코드수를 파악하기 위함.
}
if($cursort==1)
{
$sql="select * from chandj.output " . $c;
$sqlcon="select * from chandj.output " . $d;
}
if($cursort==2)
{
$sql="select * from chandj.output " . $a;
$sqlcon="select * from chandj.output " . $b;
}
if($cursort==3) // 접수일 클릭시 정렬
{
$sql="select * from chandj.output " . $where . " order by indate desc " . $all;
$sqlcon="select * from chandj.output " . $where . " order by indate desc " ;
}
if($cursort==4) // 접수일 클릭시 정렬
{
$sql="select * from chandj.output " . $where . " order by indate asc " . $all;
$sqlcon="select * from chandj.output " . $where . " order by indate asc " ;
}
if($cursort==5) // 구분 클릭시 주일/경동 내림 정렬
{
$sql="select * from chandj.output " . $where . " order by root desc, outdate desc " . $all;
$sqlcon="select * from chandj.output " . $where . " order by root desc, outdate desc " ;
}
if($cursort==6) // 구분 클릭시 주일/경동 오름차순 정렬
{
$sql="select * from chandj.output" . $where . " order by root asc, outdate desc " . $all;
$sqlcon="select * from chandj.output" . $where . " order by root asc, outdate desc " ;
}
if($cursort==7) // 절곡 클릭시 내림 정렬
{
$sql="select * from chandj.output" . $where . " order by steel desc, outdate desc " . $all;
$sqlcon="select * from chandj.output" . $where . " order by steel desc, outdate desc ";
}
if($cursort==8) // 절곡 클릭시 오름차순 정렬
{
$sql="select * from chandj.output" . $where . " order by steel asc, outdate desc " . $all;
$sqlcon="select * from chandj.output" . $where . " order by steel asc, outdate desc ";
}
if($cursort==9) // 모터 클릭시 내림 정렬
{
$sql="select * from chandj.output" . $where . " order by motor desc, outdate desc " . $all;
$sqlcon="select * from chandj.output" . $where . " order by motor desc, outdate desc " ;
}
if($cursort==10) // 모터 클릭시 오름차순 정렬
{
$sql="select * from chandj.output" . $where . " order by motor asc, outdate desc " . $all;
$sqlcon="select * from chandj.output" . $where . " order by motor asc, outdate desc " ;
}
$nowday=date("Y-m-d"); // 현재일자 변수지정
try{
$allstmh = $pdo->query($sqlcon); // 검색 조건에 맞는 쿼리 전체 개수
$temp2=$allstmh->rowCount();
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
$temp1=$stmh->rowCount();
$total_row = $temp2; // 전체 글수
$total_page = ceil($total_row / $scale); // 검색 전체 페이지 블록 수
$current_page = ceil($page/$page_scale); //현재 페이지 블록 위치계산
// print "$page&nbsp;$total_page&nbsp;$current_page&nbsp;$search&nbsp;$mode";
?>
<body >
<div id="content">
<div id="col2">
<form name="board_form" id="board_form" method="post" >
<div id="list_search">
<div id="list_search1">▷ 총 <?= $total_row ?> 개의 자료 파일이 있습니다. 검색어 : <?= $search ?>
<?php
if($total_row==0)
{
print "<button type='button' id='search_directinput' class='button button2' > 직접입력 </button>";
}
?>
</div>
</div> <!-- end of list_search3 -->
<br><br><br>
<div id="output_top_title">
<div id="output_title1"> 번호 </div>
<div id="output_title2"> <a href="list.php?&page=<?=$page?>&search=<?=$search?>&find=<?=$find?>&list=1&sortof=1&cursort=<?=$cursort?>&process=<?=$process?>&year=<?=$year?>"> 출고일자 </a> </div> <!-- 출고일자 -->
<div id="output_title3"> <a href="list.php?&page=<?=$page?>&search=<?=$search?>&find=<?=$find?>&list=1&sortof=2&cursort=<?=$cursort?>&process=<?=$process?>&year=<?=$year?>"> 접 수 일 </a> </div> <!-- 접수일 -->
<div id="output_title4"> <a href="list.php?&page=<?=$page?>&search=<?=$search?>&find=<?=$find?>&list=1&sortof=3&cursort=<?=$cursort?>&process=<?=$process?>&year=<?=$year?>">구분 </a> </div> <!-- 주일/경동 -->
<div id="output_title5"> <a href="list.php?&page=<?=$page?>&search=<?=$search?>&find=<?=$find?>&list=1&sortof=4&cursort=<?=$cursort?>&process=<?=$process?>&year=<?=$year?>">절곡발주 </a> </div> <!-- 절곡발주 -->
<div id="output_title6"><a href="list.php?&page=<?=$page?>&search=<?=$search?>&find=<?=$find?>&list=1&sortof=5&cursort=<?=$cursort?>&process=<?=$process?>&year=<?=$year?>"> 모터발주 </a> </div>
<div id="output_title7"> 현 장 명 </div>
<div id="output_title8"> 수신처 </div>
<div id="output_title13"> 운송방식 </div>
<div id="output_title9"> 수신 주소 </div>
<div id="output_title10"> 수신연락처 </div>
<div id="output_title11"> 발주담당 </div>
<div id="output_title12"> 비 고 </div>
</div>
<div id="list_content">
<?php
if ($page<=1)
$start_num=$total_row; // 페이지당 표시되는 첫번째 글순번
else
$start_num=$total_row-($page-1) * $scale;
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
$item_num=$row["num"];
$outdate=$row["outdate"];
$item_indate=$row["indate"];
$item_orderman=$row["orderman"];
$item_outworkplace=$row["outworkplace"];
$item_outputplace=$row["outputplace"];
$item_receiver=$row["receiver"];
$item_phone=$row["phone"];
$item_comment=$row["comment"];
$root=$row["root"];
$steel=$row["steel"];
$motor=$row["motor"];
$delivery=$row["delivery"];
if($steel=="1")
$steel="절곡";
if($motor=="1")
$motor="모터";
if($root=="주일")
$root_font="black";
else
$root_font="blue";
$date_font="black"; // 현재일자 Red 색상으로 표기
if($nowday==$outdate) {
$date_font="red";
}
$font="black";
switch ($delivery) {
case "상차(선불)" : $font="black"; break;
case "상차(착불)" :$font="grey" ; break;
case "경동화물(선불)" :$font="brown"; break;
case "경동화물(착불)" :$font="brown"; break;
case "경동택배(선불)" :$font="brown"; break;
case "경동택배(착불)" :$font="brown"; break;
case "직접수령" :$font="red"; break;
case "대신화물(선불)" :$font="blue"; break;
case "대신화물(착불)" :$font="blue"; break;
case "대신택배(선불)" :$font="blue"; break;
case "대신택배(착불)" :$font="blue"; break;
}
if($outdate!="") {
$week = array("(일)" , "(월)" , "(화)" , "(수)" , "(목)" , "(금)" ,"(토)") ;
$outdate = $outdate . $week[ date('w', strtotime($outdate) ) ] ;
}
?>
<div id="outlist_item" >
<div id="outlist_item1"> <?=$start_num ?></div>
<div id="outlist_item2" style="color:<?=$date_font?>;">
<b> <?=substr($outdate,0,15)?></b></div>
<?php // 접수일이 당일이면 깜빡이는 효과부여
if($item_indate==date("Y-m-d",time())) // 보라색 굵은 글씨체로 당일 해당 접수된 것...
{
print '<div id="outlist_item3" style="font-weight: bold; color:purple;">';
}
else
{
print '<div id="outlist_item3">';
}
?>
<?=substr($item_indate,0,10)?>
</div>
<div id="outlist_item4"style="color:<?=$root_font?>;" ><b> <?=$root?></b> </div>
<div id="outlist_item5" style="color:green"><b> <?=$steel?></b></div>
<div id="outlist_item6" style="color:purple"><b> <?=$motor?> </b></div>
<div id="outlist_item7"> <?=substr($item_outworkplace,0,36)?> </div>
<div id="outlist_item8"> <a href="#" onclick="intovalkd('<?=$item_outworkplace?>','<?=$item_receiver?>','<?=$delivery?>','<?=$item_phone?>','<?=$item_outputplace?>');"> <?=substr($item_receiver,0,25)?> &nbsp;</a> </div>
<div id="outlist_item13" style="color:<?=$font?>;" ><?=substr($delivery,0,20)?></div>
<div id="outlist_item9"><?=substr($item_outputplace,0,46)?></div>
<div id="outlist_item10"><?=substr($item_phone,0,25)?></div>
<div id="outlist_item11"><?=substr($item_orderman,0,25)?></div>
<div id="outlist_item12"><?=substr($item_comment,0,60)?></a></div>
<div class="clear"> </div>
</div>
<?php
$start_num--;
}
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
// 페이지 구분 블럭의 첫 페이지 수 계산 ($start_page)
$start_page = ($current_page - 1) * $page_scale + 1;
// 페이지 구분 블럭의 마지막 페이지 수 계산 ($end_page)
$end_page = $start_page + $page_scale - 1;
?>
<div id="page_button">
<div id="page_num">
<?php
if($page!=1 && $page>$page_scale)
{
$prev_page = $page - $page_scale;
// 이전 페이지값은 해당 페이지 수에서 리스트에 표시될 페이지수 만큼 감소
if($prev_page <= 0)
$prev_page = 1; // 만약 감소한 값이 0보다 작거나 같으면 1로 고정
print "<a href=list.php?page=$prev_page&search=$search&find=$find&list=1&process=$process&asprocess=$asprocess&yearcheckbox=$yearcheckbox&year=$year>◀ </a>";
}
for($i=$start_page; $i<=$end_page && $i<= $total_page; $i++)
{ // [1][2][3] 페이지 번호 목록 출력
if($page==$i) // 현재 위치한 페이지는 링크 출력을 하지 않도록 설정.
print "<font color=red><b>[$i]</b></font>";
else
print "<a href=list.php?page=$i&search=$search&find=$find&list=1&process=$process&asprocess=$asprocess&yearcheckbox=$yearcheckbox&year=$year>[$i]</a>";
}
if($page<$total_page)
{
$next_page = $page + $page_scale;
if($next_page > $total_page)
$next_page = $total_page;
// netx_page 값이 전체 페이지수 보다 크면 맨 뒤 페이지로 이동시킴
print "<a href=list.php?page=$next_page&search=$search&find=$find&list=1&process=$process&asprocess=$asprocess&yearcheckbox=$yearcheckbox&year=$year> ▶</a><p>";
}
?>
</div>
</div>
</div>
</form>
</div> <!-- end of col2 -->
</div> <!-- end of col2 -->
</div> <!-- end of col2 -->
<script>
function blinker() {
$('.blinking').fadeOut(500);
$('.blinking').fadeIn(500);
}
setInterval(blinker, 1000);
function intovalkd(workplace,receiver,delivery,phone,address)
{
$("#displaysearch").hide();
document.getElementById("outworkplace").value = workplace;
document.getElementById("outputplace").value = address;
document.getElementById("receiver").value = receiver;
document.getElementById("phone").value = phone;
// 라디오버튼 값을 바꾸는 방법 예시로 사용할 것
$("input:radio[name='delivery']:radio[value='" + delivery + "']").prop("checked",true);
}
$("#search_directinput").on("click", function() {
$("#displaysearch").hide();
});
</script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<?php
if($mode==""&&$fromdate==null)
{
echo ("<script language=javascript> this_year();</script>"); // 당해년도 화면에 초기세팅하기
}
?>
</body>
</html>

47
make/update_checkbox.php Normal file
View File

@@ -0,0 +1,47 @@
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
header("Content-Type: application/json");
$num = isset($_POST['num']) ? $_POST['num'] : '';
$screenlist = isset($_POST['screenlist']) ? $_POST['screenlist'] : '';
$response = ['success' => false];
if ($num && $screenlist) {
try {
$pdo = db_connect();
// 기존의 screenlist를 가져와서 업데이트
$sql = "SELECT screenlist FROM chandj.output WHERE num = ?";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $num, PDO::PARAM_INT);
$stmh->execute();
$existingScreenlist = $stmh->fetch(PDO::FETCH_ASSOC)['screenlist'];
$existingScreenlist = json_decode($existingScreenlist, true);
$updatedScreenlist = json_decode($screenlist, true);
// 배열의 순서대로 업데이트
foreach ($updatedScreenlist as $index => $update) {
if (isset($existingScreenlist[$index])) {
$existingScreenlist[$index] = array_merge($existingScreenlist[$index], $update);
}
}
// 업데이트된 screenlist를 다시 JSON 문자열로 변환하여 저장
$sql = "UPDATE chandj.output SET screenlist = ? WHERE num = ?";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, json_encode($existingScreenlist), PDO::PARAM_STR);
$stmh->bindValue(2, $num, PDO::PARAM_INT);
$stmh->execute();
$response['success'] = true;
} catch (PDOException $e) {
$response['message'] = "Error: " . $e->getMessage();
}
}
echo json_encode($response);
?>

216
make/workerlist.php Normal file
View File

@@ -0,0 +1,216 @@
<?php
session_start();
$level= $_SESSION["level"];
if(!isset($_SESSION["level"]) || $level>5) {
/* alert("관리자 승인이 필요합니다."); */
sleep(2);
header ("Location:/login/logout.php");
exit;
}
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
header("Expires: 0"); // rfc2616 - Section 14.21
//header("Refresh:0"); // reload refresh
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="../css/common.css">
<link rel="stylesheet" type="text/css" href="../css/work.css">
<link rel="stylesheet" type="text/css" href="../css/special.css">
<title> 주일기업 통합정보시스템 </title>
</head>
<script>
window.history.forward(0);
history.navigationMode = 'compatible'; // 오페라, 사파리 뒤로가기 막기
function _no_Back(){
window.history.forward(0);
}
</script>
<?php
if(isset($_REQUEST["search"])) //목록표에 제목,이름 등 나오는 부분
$search=$_REQUEST["search"];
require_once("../lib/mydb.php");
$pdo = db_connect();
// $find="firstord"; //검색할때 고정시킬 부분 저장 ex) 전체/공사담당/건설사 등
if(isset($_REQUEST["page"])) // $_REQUEST["page"]값이 없을 때에는 1로 지정
{
$page=$_REQUEST["page"]; // 페이지 번호
}
else
{
$page=1;
}
$scale = 20; // 한 페이지에 보여질 게시글 수
$page_scale = 10; // 한 페이지당 표시될 페이지 수 10페이지
$first_num = ($page-1) * $scale; // 리스트에 표시되는 게시글의 첫 순번.
if(isset($_REQUEST["mode"]))
$mode=$_REQUEST["mode"];
else
$mode="";
$a=" order by num desc limit $first_num, $scale";
$b=" order by num desc";
$sql ="select * from chandj.workerlist where ((name like '%$search%' ) or (comment1 like '%$search%' ) or (comment2 like '%$search%' ) or (comment3 like '%$search%' ) or (comment4 like '%$search%' ) or";
$sql .=" (comment5 like '%$search%' ) or (company like '%$search%' )) " . $a;
$sqlcon ="select * from chandj.workerlist where ((name like '%$search%' ) or (comment1 like '%$search%' ) or (comment2 like '%$search%' ) or (comment3 like '%$search%' ) or (comment4 like '%$search%' ) or";
$sqlcon .=" (comment5 like '%$search%' ) or (company like '%$search%' )) " . $b;
try{
$allstmh = $pdo->query($sqlcon); // 검색 조건에 맞는 쿼리 전체 개수
$temp2=$allstmh->rowCount();
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
$temp1=$stmh->rowCount();
$total_row = $temp2; // 전체 글수
$total_page = ceil($total_row / $scale); // 검색 전체 페이지 블록 수
$current_page = ceil($page/$page_scale); //현재 페이지 블록 위치계산
// print "$page&nbsp;$total_page&nbsp;$current_page&nbsp;$search&nbsp;$mode";
?>
<body onload="_no_Back();" onpageshow="if(event.persisted)_no_Back();">
<div id="wrap">
<div id="content">
<form name="board_form" method="post" action="search.php?mode=search&search=<?=$search?>&find=<?=$find?>&process=<?=$process?>&yearcheckbox=<?=$yearcheckbox?>&year=<?=$year?>">
<div id="col2">
<div id="list_search">
<div id="list_search1">▷ 총 <?= $total_row ?> 개의 자료 파일이 있습니다. 검색어 : <?= $search ?>
<?php
if($total_row==0)
{
print "<button type='button' id='directinput' class='button button2' > 직접입력 </button>";
}
?>
</div>
</div> <!-- end of list_search3 -->
<br>
<div id="outlist_top_title">
<ul>
<li id="outlist_title1">번호</li>
<li id="outlist_title2">수신처(반장) 이름</li>
<li id="outlist_title3">연락처</li>
<li id="outlist_title4">분야</li>
<li id="outlist_title5">회사</li>
<li id="outlist_title6">비고1</li>
<li id="outlist_title7">비고2</li>
<li id="outlist_title8">비고3</li>
</ul>
</div> <!-- end of list_top_title -->
<br><br>
<div id="list_content">
<?php
if ($page<=1)
$start_num=$total_row; // 페이지당 표시되는 첫번째 글순번
else
$start_num=$total_row-($page-1) * $scale;
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
$num=$row["num"];
$con_num=$row["con_num"];
$name=$row["name"];
$tel=$row["tel"];
$item=$row["item"];
$company=$row["company"];
$comment1=$row["comment1"];
$comment2=$row["comment2"];
$comment3=$row["comment3"];
// $item_subject=mb_substr($item_subject,0,20,'utf-8');
/// if(mb_strlen($item_subject,'utf-8')>=20)
// $item_subject=$item_subject . "..."; // 글자수가 초과하면 ...으로 표기됨
?>
<div id="sub_item">
<div id="sub_item1"><?= $start_num ?>&nbsp;</div>
<div id="sub_item2"> <a href="#" onclick="intovaltel('<?=$tel?>','<?=$name?>'); return false;" style="font-size=10px;" ><?= $name ?>&nbsp;</a>
</div>
<div id="sub_item3"><?=substr($tel,0,25)?>&nbsp;</div>
<div id="sub_item4"><?=substr($item,0,25)?>&nbsp;</div>
<div id="sub_item5"><?= $company?>&nbsp;</div>
<div id="sub_item6"><?= $comment1?>&nbsp;</div>
<div id="sub_item7"><?= $comment2?>&nbsp;</div>
<div id="sub_item8"><?= $comment3?>&nbsp;</div>
</div>
<?php
$start_num--;
}
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
// 페이지 구분 블럭의 첫 페이지 수 계산 ($start_page)
$start_page = ($current_page - 1) * $page_scale + 1;
// 페이지 구분 블럭의 마지막 페이지 수 계산 ($end_page)
$end_page = $start_page + $page_scale - 1;
?>
<div id="page_button">
<div id="page_num">
<?php
if($page!=1 && $page>$page_scale)
{
$prev_page = $page - $page_scale;
// 이전 페이지값은 해당 페이지 수에서 리스트에 표시될 페이지수 만큼 감소
if($prev_page <= 0)
$prev_page = 1; // 만약 감소한 값이 0보다 작거나 같으면 1로 고정
print "<a href=workerlist.php?page=$prev_page&search=$search&find=$find&list=1&process=$process&yearcheckbox=$yearcheckbox&year=$year>◀ </a>";
}
for($i=$start_page; $i<=$end_page && $i<= $total_page; $i++)
{ // [1][2][3] 페이지 번호 목록 출력
if($page==$i) // 현재 위치한 페이지는 링크 출력을 하지 않도록 설정.
print "<font color=red><b>[$i]</b></font>";
else
print "<a href=workerlist.php?page=$i&search=$search&find=$find&list=1&process=$process&yearcheckbox=$yearcheckbox&year=$year>[$i]</a>";
}
if($page<$total_page)
{
$next_page = $page + $page_scale;
if($next_page > $total_page)
$next_page = $total_page;
// netx_page 값이 전체 페이지수 보다 크면 맨 뒤 페이지로 이동시킴
print "<a href=workerlist.php?page=$next_page&search=$search&find=$find&list=1&process=$process&yearcheckbox=$yearcheckbox&year=$year> ▶</a><p>";
}
?>
</div>
</div>
</div>
</div> <!-- end of col2 -->
</form>
</div> <!-- end of content -->
</div> <!-- end of wrap -->
<script>
function intovaltel(tel,name)
{
$("#displaysearchworker").hide();
document.getElementById("phone").value = tel;
document.getElementById("receiver").value = name;
}
// 자재 출고 직접입력버튼 클릭
$("#directinput").on("click", function() {
$("#displaysearchworker").hide();
// alert("dkajflasd");
});
</script>
</body>
</html>

848
make/write.php Normal file
View File

@@ -0,0 +1,848 @@
<?php
session_start();
$level= $_SESSION["level"];
if(!isset($_SESSION["level"]) || $level>10) {
/* alert("관리자 승인이 필요합니다."); */
sleep(2);
header ("Location:/login/logout.php");
exit;
}
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
header("Expires: 0"); // rfc2616 - Section 14.21
//header("Refresh:0"); // reload refresh
$parentnum=$_REQUEST["parentnum"]; // 리스트번호
$outputnum=$_REQUEST["outputnum"]; // 리스트번호
$upnum=$_REQUEST["upnum"]; // 발주서 번호
$tempnum=$_REQUEST["upnum"]; // 발주서 번호 비교를 위해 임시변수 만듦
$num=$_REQUEST["num"]; // 발주서 번호 비교를 위해 임시변수 만듦
$callname=$_REQUEST["callname"];
$cutwidth=$_REQUEST["cutwidth"];
$cutheight=$_REQUEST["cutheight"];
$exititem=$_REQUEST["exititem"];
$delivery=$_REQUEST["delivery"];
$callback=$_REQUEST["callback"]; // 출고현황에서 넘어온 자료인지 체크
if(!isset($_REQUEST["exitinterval"]) )
$exitinterval='900';
else
$exitinterval=$_REQUEST["exitinterval"];
if(!isset($_REQUEST["cover"]) )
$cover='1200';
else
$cover=$_REQUEST["cover"];
$tempexit=$_REQUEST["exititem"];
$sort=$_REQUEST["sort"];
$recallcal=$_REQUEST["recallcal"];
if(!isset($_REQUEST["ordercompany"]) || $ordercompany=="" )
$ordercompany=$_REQUEST["outworkplace"]; // 현장명이 없을때는 부모파일 현장명 가져오기
if($sort=='' || $sort=='0')
$sort='1';
$draw=$_REQUEST["draw"];
$drawbottom1=""; //좌측 공백
$drawbottom2=""; //우측 공백
$memo=$_REQUEST["memo"];
$text2=$_REQUEST["text2"];
if(!isset($_REQUEST["number"]) || $number=="" )
$number="1";
else
$number=$_REQUEST["number"];
if(!isset($_REQUEST["cutwidth"]) || $cutwidth=="" )
$cutwidth="5000";
else
$cutwidth=$_REQUEST["cutwidth"];
if(!isset($_REQUEST["cutheight"]) || $cutheight=="" )
$cutheight="3000";
else
$cutheight=$_REQUEST["cutheight"];
if(!isset($_REQUEST["printside"]))
$printside="0";
else
$printside=$_REQUEST["printside"];
if(!isset($_REQUEST["direction"]))
$direction="0";
else
$direction=$_REQUEST["direction"];
if(!isset($_REQUEST["exititem"]))
$exititem="0";
else
$exititem=$_REQUEST["exititem"];
if(!isset($_REQUEST["intervalnum"]) )
$intervalnum="없음";
else
$intervalnum=$_REQUEST["intervalnum"];
if(!isset($_REQUEST["intervalnumsecond"]))
$intervalnumsecond="없음";
else
$intervalnumsecond=$_REQUEST["intervalnumsecond"];
$left_check=$_REQUEST["left_check"];
$right_check=$_REQUEST["right_check"];
$mid_check=$_REQUEST["mid_check"];
$done_check=$_REQUEST["done_check"];
$remain_check=$_REQUEST["remain_check"];
require_once("../lib/mydb.php");
$pdo = db_connect();
?>
<?php
if($sort=='1')
$sql="select * from chandj.make where upnum='$parentnum' order by num desc"; // 처음 내림차순
else
$sql="select * from chandj.make where upnum='$parentnum' order by num asc"; // 처음 오름차순
try{
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
$counter=0;
$sum=0;
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
$upnum=$row["upnum"];
if((int)$upnum==(int)$parentnum)
{
$counter++;
$sum+=(int)$row["number"];
}
}
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
?>
<?php
$page=1;
$scale = 30; // 한 페이지에 보여질 게시글 수
$page_scale = 10; // 한 페이지당 표시될 페이지 수 10페이지
$first_num = ($page-1) * $scale; // 리스트에 표시되는 게시글의 첫 순번.
if($sort=='1')
$sql="select * from chandj.make where upnum='$upnum' order by num desc"; // 처음 내림차순
else
$sql="select * from chandj.make where upnum='$upnum' order by num asc"; // 처음 오름차순
$nowday=date("Y-m-d"); // 현재일자 변수지정
try{
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
$temp=$stmh->rowCount();
$total_row = $temp; // 전체 글수
$total_page = ceil($total_row / $scale); // 검색 전체 페이지 블록 수
$current_page = ceil($page/$page_scale); //현재 페이지 블록 위치계산
if ($page<=1)
$start_num=$total_row; // 페이지당 표시되는 첫번째 글순번
else
$start_num=$total_row-($page-1) * $scale;
if($callname=="") $callname="FSS";
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title> 주일기업 통합정보시스템 </title>
</head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="/order/order.js"></script>
<script src="/make/make.js"></script>
<script src="../js/html2canvas.js"></script> <!-- 스크린샷을 위한 자바스크립트 함수 불러오기 -->
<link rel="stylesheet" type="text/css" href="../css/make_v2.css?v=1">
<style media="screen">
*{
margin: 0; padding: 0;
}
.slide{
width: 400px;
height: 400px;
overflow: hidden;
position: relative;
margin: 0 auto;
}
.slide ul{
width: 11600px;
position: absolute;
top:0;
left:0;
font-size: 0;
}
.slide ul li{
display: inline-block;
}
#back{
position: absolute;
top: 0;
left:0 ;
cursor: pointer;
z-index: 1;
}
#next{
position: absolute;
top: 0;
right: 0;
cursor: pointer;
z-index: 1;
}
</style>
<body>
<div id="wrap">
<div id="header">
<?php include "../lib/top_login2.php"; ?>
</div>
<div id="menu">
<?php include "../lib/top_menu2.php"; ?>
</div>
<div id="content">
<div id="work_col2"> <br>
<h6> 스크린 제작 &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 고유No : &nbsp; <?=$upnum?> &nbsp; 원발주No : &nbsp; <?=$outputnum?> &nbsp;&nbsp; 셔터 수량합계 : &nbsp; <?=$sum?> </h6>
<form name="board_form" id="board_form" method="post" action="insert.php?mode=modify&text1=<?=$callname?>&text2=<?=$text2?>&parentnum=<?=$parentnum?>" >
<div id="exitcontent">
<div id="company1"> 발주처(현장명) : </div>
<div id="company2"> <input id="ordercompany" name="ordercompany" type="text" size="60" placeholder="발주처,현장명" value="<?=$ordercompany?>" readonly> </div>
<div id="company3"> 개구부 : </div>
<div id="company4"> <input id="exitinterval" name="exitinterval" type="text" size="4" value="<?=$exitinterval?>" > </div>
<div id="company5"> 덮개 : </div>
<div id="company6"> <input id="cover" name="cover" type="text" size="5" value="<?=$cover?>" > </div>
<div class="clear"> </div>
<div id="r5"> 부호 </div>
<div id="r6"> <input id="callname" name="callname" type="text" size="16" placeholder="부호" value="<?=$callname?>" > </div>
<div id="r0"> 제작size </div>
<div id="r1"> 가로(W) : </div>
<div id="r2"> <input id="cutwidth" name="cutwidth" type="text" size="5" placeholder="width" value="<?=$cutwidth?>" required > </div>
<div id="r3"> 세로(H) : </div>
<div id="r4"> <input id="cutheight" name="cutheight" type="text" size="5" value="<?=$cutheight?>" required placeholder="height"> </div>
<div id="r33"> 수량 : </div>
<div id="r8"> <input id="number" name="number" type="text" size="3" placeholder="수량" value="<?=$number?>" required > </div>
<div id="r7"> 틀, </div>
<div id="rr1"> 인쇄면 : </div>
<div id="rr2">
<?php
if($printside=='0') {
print "
<select id='printside' name='printside'>
<option value='0' selected >양면 </option>
<option value='1' >한면 </option>
</select> ";
}
if($printside=='1') {
print "
<select id='printside' name='printside'>
<option value='0' >양면 </option>
<option value='1' selected >한면 </option>
</select> ";
}
?>
</div>
<div id="printdirection"> <!-- 인쇄면 한면일 경우 방향표시 -->
<div id="rr3"> 인쇄방향:</div>
<div id="rr4">
<?php
if($direction=='0') {
print "
<select id='direction' name='direction'>
<option value='0' selected >정방향 </option>
<option value='1' >역방향 </option>
</select> ";
}
if($direction=='1') {
print "
<select id='direction' name='direction'>
<option value='0' >정방향 </option>
<option value='1' selected >역방향 </option>
</select> ";
}
?>
</div>
</div>
<div id="exitpos"> 비상문 위치 : </div>
<div id="exitpos1">
<?php
if($exititem=='0') {
print "
<select id='exititem' name='exititem'>
<option value='0' selected >없음 </option>
<option value='1' >중앙 </option>
<option value='2' >좌측 </option>
<option value='3' >우측 </option>
<option value='4' >문2개 </option>
<option value='5' >문2개 지그재그 </option>
</select> ";
}
if($exititem=='1') {
print "
<select id='exititem' name='exititem'>
<option value='0' >없음 </option>
<option value='1' selected >중앙 </option>
<option value='2' >좌측 </option>
<option value='3' >우측 </option>
<option value='4' >문2개 </option>
<option value='5' >문2개 지그재그 </option>
</select> ";
}
if($exititem=='2') {
print "
<select id='exititem' name='exititem'>
<option value='0' >없음 </option>
<option value='1' >중앙 </option>
<option value='2' selected >좌측 </option>
<option value='3' >우측 </option>
<option value='4' >문2개 </option>
<option value='5' >문2개 지그재그 </option>
</select> ";
}
if($exititem=='3') {
print "
<select id='exititem' name='exititem'>
<option value='0' >없음 </option>
<option value='1' >중앙 </option>
<option value='2' >좌측 </option>
<option value='3' selected >우측 </option>
<option value='4' >문2개 </option>
<option value='5' >문2개 지그재그 </option>
</select> ";
}
if($exititem=='4') {
print "
<select id='exititem' name='exititem'>
<option value='0' >없음 </option>
<option value='1' >중앙 </option>
<option value='2' >좌측 </option>
<option value='3' >우측 </option>
<option value='4' selected >문2개 </option>
<option value='5' >문2개 지그재그 </option>
</select> ";
}
if($exititem=='5') {
print "
<select id='exititem' name='exititem'>
<option value='0' >없음 </option>
<option value='1' >중앙 </option>
<option value='2' >좌측 </option>
<option value='3' >우측 </option>
<option value='4' >문2개 </option>
<option value='5' selected>문2개 지그재그 </option>
</select> ";
}
?>
</div>
<div id="exityesno" >
<div id="excol1"> 띄울치수1 : </div>
<div id="excol2"> <input id="intervalnum" name="intervalnum" type="text" size="5" value="<?=$intervalnum?>" > </div>
<div id="excol3"> 띄울치수2 : </div>
<div id="excol4"> <input id="intervalnumsecond" name="intervalnumsecond" type="text" size="5" value="<?=$intervalnumsecond?>"> </div>
</div>
<div class="clear"> </div>
<div id="excol6"> 추가메모 : </div>
<div id="excol7"> <input id="memo" name="memo" type="text" size="50" value="<?=$memo?>" > </div>
<div id="result1" name="result1" >
<textarea rows="1" cols="60" name="text2" id="text2" value="<?=$text2?>" ></textarea>
</div>
<!-- 화면에 도면 보여주기-->
<div id="drawimg"> </div>
<input id="draw" name="draw" type="hidden" value="<?=$draw?>" >
<input id="sort" name="sort" type="hidden" value="<?=$sort?>" > <!-- 정렬방식 변경 -->
<input id="upnum" name="upnum" type="hidden" value="<?=$upnum?>" > <!-- 발주서 상위번호-->
<input id="num" name="num" type="hidden" value="<?=$num?>" > <!-- 발주서 -->
<input id="outputnum" name="outputnum" type="hidden" value="<?=$outputnum?>" >
<input id="modify" name="modify" type="hidden" value="<?=$modify?>" > <!-- 수정여부 -->
<input id="left_check" name="left_check" type="hidden" value="<?=$left_check?>" >
<input id="right_check" name="right_check" type="hidden" value="<?=$right_check?>" >
<input id="mid_check" name="mid_check" type="hidden" value="<?=$mid_check?>" >
<input id="done_check" name="done_check" type="hidden" value="<?=$done_check?>" >
<input id="remain_check" name="remain_check" type="hidden" value="<?=$remain_check?>" >
<div class="clear"> </div>
<div id="drawbottom11"> <input id="drawbottom1" name="drawbottom1" type="text" size="16" value="<?=$drawbottom1?>" readonly> </div>
<div id="drawbottom33"> <input id="drawbottom3" name="drawbottom3" type="text" size="16" value="<?=$drawbottom3?>" readonly> </div>
<div id="drawbottom22"> <input id="drawbottom2" name="drawbottom2" type="text" size="16" value="<?=$drawbottom2?>" readonly> </div>
</div>
</form>
</div>
<div class="clear"> </div>
&nbsp;&nbsp; <button id="calsize_exe" onclick="calsize_exe();"> 스크린제작사이즈 산출 </button>
&nbsp;&nbsp; <button id="addline" onclick="addline();" > 행 추가 </button>
&nbsp;&nbsp; <button id="update" onclick="update();" > 수정&저장 </button>
<!-- 일부분 부분-->
&nbsp;&nbsp; <button onclick="partShot();"> 이미지 저장 </button>
&nbsp;&nbsp;
<button onclick="javascript:del('delete.php?mode=all&upnum=<?=$upnum?>&parentnum=<?=$parentnum?>')" > DATA 전체삭제 </button>
&nbsp;&nbsp;
<button onclick="sorting();" > 정렬변경 </button>
&nbsp;&nbsp;
<button onclick="javascript:move('write_form.php?num=<?=$upnum?>&mode=modify&upnum=<?=$upnum?>&parentnum=<?=$parentnum?>&callback=1')" > 발주화면 </button>
<div class="clear"> </div><br><br>
<div id="containers" >
<div id="display_result" >
<div id="ares1"> 번호 </div>
<div id="ares2"> 부호 </div>
<div id="ares3"> 스크린제작 치수 너비(W) x 높이(H) , 수량(EA) </div>
<div class="clear"> </div>
<?php
$counter=0;
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
$upnum=$row["upnum"];
if((int)$upnum==(int)$tempnum)
{
$counter++;
$num=$row["num"];
$text1=$row["text1"];
$text2=$row["text2"];
$text3=$row["text3"];
$text4=$row["text4"];
$text5=$row["text5"];
$ordercompany=$row["ordercompany"];
$callname=$row["callname"];
$cutwidth=$row["cutwidth"];
$cutheight=$row["cutheight"];
$number=$row["number"];
$printside=$row["printside"];
$direction=$row["direction"];
$exititem=$row["exititem"];
$intervalnum=$row["intervalnum"];
$intervalnumsecond=$row["intervalnumsecond"];
$memo=$row["memo"];
$draw=$row["draw"];
$drawbottom1=$row["drawbottom1"];
$drawbottom2=$row["drawbottom2"];
$drawbottom3=$row["drawbottom3"];
$cover=$row["cover"];
$exitinterval=$row["exitinterval"];
$left_check=$row["left_check"];
$right_check=$row["right_check"];
$mid_check=$row["mid_check"];
$done_check=$row["done_check"];
// echo '<script type="text/javascript"> changeUri(); </script>';
?>
<div id="res1"> <a href="javascript:del('delete.php?num=<?=$num?>&upnum=<?=$upnum?>&ordercompany=<?=$ordercompany?>&callname=<?=$callname?>&cutheight=<?=$cutheight?>&cutwidth=<?=$cutwidth?>&number=<?=$number?>&comment=<?=$comment?>&printside=<?=$printside?>&direction=<?=$direction?>&exititem=<?=$exititem?>&intervalnum=<?=$intervalnum?>&intervalnumsecond=<?=$intervalnumsecond?>&memo=<?=$memo?>&parentnum=<?=$parentnum?>')"> <?=$counter?> </a> </div>
<div id="res2">
<div id="no1">
<a href="javascript:load('load.php?num=<?=$num?>&upnum=<?=$upnum?>&sort=<?=$sort?>&recallcal=1&parentnum=<?=$parentnum?>')"> <?=$text1?> </a> </div>
<div id="no2">
<?=$memo?>
</div>
</div>
<div id="firstoutline">
<div id="fres1"> <?=$text2?> </div>
</div>
<div id="outline">
<div id="res4"> <?=$draw?> </div>
<div class="clear"> </div>
<div id="res5"> <?=$drawbottom1?> </div>
<div id="res7"> <?=$drawbottom3?> </div>
<div id="res6"> <?=$drawbottom2?> </div>
</div>
<div class="clear"> </div>
<?php
$start_num--;
}
}
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
// 페이지 구분 블럭의 첫 페이지 수 계산 ($start_page)
$start_page = ($current_page - 1) * $page_scale + 1;
// 페이지 구분 블럭의 마지막 페이지 수 계산 ($end_page)
$end_page = $start_page + $page_scale - 1;
?>
</div> <!-- end of display_result -->
</div> <!-- end of containers -->
</div>
</div>
<br>
</div>
<script> // 화면을 시간 지연 후 나타내 주기
setTimeout(function(){
/* var exititem = "<? echo $exititem; ?>"; // php변수를 자바스크립트에서 사용하는 방법 echo 이용
if(exititem=='0')
$("#exityesno").hide();
else
$("#exityesno").show(); */
calsize_exe(); //your code here
}, 500);
</script>
</body>
<script>
$(function(){
$("#printdirection").show();
$("#exititem").change(function(){
if ( this.value == '0' ) {
exitno();
}
if ( this.value == '1' ) {
exitcenter();
}
if ( this.value == '2' ) {
exitleft();
}
if ( this.value == '3' ) {
exitright();
}
if ( this.value == '4' ||this.value == '5' ) {
exitboth();
}
});
$("#printside").change(function(){
$("#printdirection").show();
if ( this.value == '0' ) {
$("#printdirection").show();
return false;
}
if ( this.value == '1' ) {
$("#printdirection").show();
}
});
});
function calsize_exe() { // 계산하기 산출하기
var a = 0;
var totalheight = 0;
var screenheight = 0;
var width = 0;
var height = 0;
var mod = 0;
var b = 0;
var c = 0;
var d = 0;
var e = 0;
var f = 0;
var g = 0;
var h = 0;
var i = 0; //쪽바계산용
var exitvar;
var screenjpg;
var midamount; // 중간판 수량
var upperheight; // 상판 높이
var upperrow; // 상판 매수(비상문 있을시)
var amount;
var dis_text;
var numleft;
var numright;
var numcenter;
var comment;
var exitinterval= Number($("#exitinterval").val()); // 개구부 치수 적용하기
var memo= $("#memo").val(); // 메모
var cover= Number($("#cover").val()); // 개구부 치수 적용하기
var remainleft; // 왼쪽 적을 치수
var remainright; // 오른쪽 적을 치수
width=Number($("#cutwidth").val());
height=Number($("#cutheight").val());
if($("#intervalnum").val()=='' && $("#exititem").val()!='0') {
alert("띄울 치수를 입력해 주세요.");
return false;
}
exitvar=$("#exititem").val();
directionvar=$("#direction").val();
printsidevar=$("#printside").val();
numleft=$("#intervalnum").val();
numright=$("#intervalnumsecond").val();
numcenter=width-exitinterval*2-numleft-numright; // 문2개일때 가운데 치수
comment='';
if(exitvar=='0')
{
screenjpg='0';
comment=" (문X)";
}
if(exitvar=='1' && directionvar=='0' && printsidevar=='0')
screenjpg='1'; // 비상문 중앙 인쇄방향 정방향 양면인쇄
if(exitvar=='1' && directionvar=='1' && printsidevar=='0' )
screenjpg='2'; // 비상문 중앙 인쇄방향 역방향 양면인쇄
if(exitvar=='1' && directionvar=='0' && printsidevar=='1')
screenjpg='3'; // 비상문 중앙 인쇄방향 정방향 한면인쇄
if(exitvar=='1' && directionvar=='1' && printsidevar=='1')
screenjpg='4'; // 비상문 중앙 인쇄방향 역방향 한면인쇄
if(exitvar=='2' && directionvar=='0' && printsidevar=='0')
screenjpg='5'; // 비상문 좌측 인쇄방향 정방향 양면인쇄
if(exitvar=='2' && directionvar=='1' && printsidevar=='0')
screenjpg='6'; // 비상문 좌측 인쇄방향 역방향 양면인쇄
if(exitvar=='2' && directionvar=='0' && printsidevar=='1')
screenjpg='7'; // 비상문 좌측 인쇄방향 정방향 한면인쇄
if(exitvar=='2' && directionvar=='1' && printsidevar=='1')
screenjpg='8'; // 비상문 좌측 인쇄방향 역방향 한면인쇄
if(exitvar=='3' && directionvar=='0' && printsidevar=='0')
screenjpg='9'; // 비상문 우측 인쇄방향 정방향 양면인쇄
if(exitvar=='3' && directionvar=='1' && printsidevar=='0')
screenjpg='10'; // 비상문 우측 인쇄방향 역방향 양면인쇄
if(exitvar=='3' && directionvar=='0' && printsidevar=='1')
screenjpg='11'; // 비상문 우측 인쇄방향 정방향 한면인쇄
if(exitvar=='3' && directionvar=='1' && printsidevar=='1')
screenjpg='12'; // 비상문 우측 인쇄방향 역방향 한면인쇄
if(exitvar=='4' && directionvar=='0' && printsidevar=='0')
screenjpg='13'; // 비상문 2개 인쇄방향 정방향 양면인쇄
if(exitvar=='4' && directionvar=='1' && printsidevar=='0')
screenjpg='14'; // 비상문 2개 인쇄방향 역방향 양면인쇄
if(exitvar=='4' && directionvar=='0' && printsidevar=='1')
screenjpg='15'; // 비상문 2개 인쇄방향 정방향 한면인쇄
if(exitvar=='4' && directionvar=='1' && printsidevar=='1')
screenjpg='16'; // 비상문 2개 인쇄방향 역방향 한면인쇄
if(exitvar=='5' && directionvar=='0')
screenjpg='17'; // 비상문 2개 인쇄방향 정방향 한면인쇄
if(exitvar=='5' && directionvar=='1')
screenjpg='18'; // 비상문 2개 인쇄방향 역방향 한면인쇄
if(exitvar=='0' )
{
$("#drawbottom1").val(' ');
$("#drawbottom2").val(' ');
$("#drawbottom3").val(' ');
$("#line1").val (dis_text); // 도면 저장을 위해....
}
if(exitvar=='1' )
{
remainleft = width/2 - (exitinterval/2) ;
$("#drawbottom1").val(remainleft);
$("#drawbottom3").val(' ');
$("#drawbottom2").val(remainleft);
$("#line1").val (dis_text); // 도면 저장을 위해....
}
if(exitvar=='2')
{
remainright = width - numleft - exitinterval ;
$("#drawbottom1").val('좌에서 ' + numleft + ' 띄우고,');
$("#drawbottom3").val(' ');
$("#drawbottom2").val(remainright);
}
if(exitvar=='3')
{
remainright = width - numleft - exitinterval ;
$("#drawbottom2").val('우에서 ' + numleft + ' 띄우고'); // numleft는 첫번째 띄우는 치수다. 그래서 numright가 아니다.
$("#drawbottom3").val(' ');
$("#drawbottom1").val(remainright);
}
if(exitvar=='4' || exitvar=='5')
{
$("#drawbottom1").val('좌에서 ' + numleft + ' 띄우고,');
$("#drawbottom2").val('우에서 ' + numright + ' 띄우고');
$("#drawbottom3").val(numcenter);
}
dis_text='<img src="../img/screen/screen' + screenjpg + '.jpg">';
$("#drawimg").html(dis_text);
$("#draw").val(dis_text);
totalheight=Math.ceil((height+100)/1180);
a=Math.ceil(width) ;
g=Number($("#intervalnum").val()) ;
amount=$("#number").val() ;
if(exitinterval!=900)
comment = comment + "개구부:" + exitinterval + "," ;
if(cover!=1200)
comment = comment + "덮개:" + cover ;
$("#text2").text( a + " X " + height + " , " + amount + " EA, " + comment); //comment는 비상문 없음 표시
} // end of function
function exitno() {
$("#intervalnum").val("없음");
$("#intervalnumsecond").val("없음");
}
function exitcenter() {
$("#exityesno").show();
$("#intervalnum").val("없음");
$("#intervalnumsecond").val("없음");
}
function exitleft() {
$("#exityesno").show();
$("#intervalnum").val("");
$("#intervalnumsecond").val("없음");
}
function exitright() {
$("#exityesno").show();
$("#intervalnum").val("");
$("#intervalnumsecond").val("없음");
}
function exitboth() {
$("#exityesno").show();
$("#intervalnum").val("");
$("#intervalnumsecond").val("");
}
function addline(){
calsize_exe();
document.getElementById('board_form').submit(); // form의 검색버튼 누른 효과
}
function update(){
calsize_exe();
$("#modify").val("1"); // 수정할 부분 연결
document.getElementById('board_form').submit(); // form의 검색버튼 누른 효과
}
function sorting(){
var sort;
sort=$("#sort").val();
if(sort=='1')
$("#sort").val("2");
else
$("#sort").val("1");
$("#modify").val("2"); // 소팅할 것
document.getElementById('board_form').submit(); // form의 검색버튼 누른 효과
}
function del(href)
{
if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) {
document.location.href = href;
}
}
function move(href)
{
document.location.href = href;
}
function load(href)
{
document.location.href = href;
}
function partShot() {
//특정부분 스크린샷
html2canvas(document.getElementById("containers"))
//id container 부분만 스크린샷
.then(function (canvas) {
//jpg 결과값
drawImg(canvas.toDataURL('image/jpeg'));
//이미지 저장
saveAs(canvas.toDataURL(), 'make.jpg');
}).catch(function (err) {
console.log(err);
});
}
function drawImg(imgData) {
console.log(imgData);
//imgData의 결과값을 console 로그롤 보실 수 있습니다.
return new Promise(function reslove() {
//내가 결과 값을 그릴 canvas 부분 설정
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
//canvas의 뿌려진 부분 초기화
ctx.clearRect(0, 0, canvas.width, canvas.height);
var imageObj = new Image();
imageObj.onload = function () {
ctx.drawImage(imageObj, 10, 10);
//canvas img를 그리겠다.
};
imageObj.src = imgData;
//그릴 image데이터를 넣어준다.
}, function reject() { });
}
function saveAs(uri, filename) {
var link = document.createElement('a');
if (typeof link.download === 'string') {
link.href = uri;
link.download = filename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
} else {
window.open(uri);
}
}
function submit_form(frm) {
frm.action='delete.php';
frm.submit();
return true;
}
function info() {
return;
}
</script>
</html>

946
make/write_form.php Normal file
View File

@@ -0,0 +1,946 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/load_GoogleDrive.php'; // 세션 등 여러가지 포함됨 파일 포함
if (!isset($_SESSION["level"]) || $_SESSION["level"] > 8) {
sleep(1);
header("Location:" . $WebSite . "login/login_form.php");
exit;
}
include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php';
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : '';
$num = isset($_REQUEST["num"]) ? $_REQUEST["num"] : "";
$tablename = 'output';
$title_message = "스크린 작업 ";
require_once $_SERVER['DOCUMENT_ROOT'] . '/load_GoogleDriveSecond.php'; // attached, image에 대한 정보 불러오기
include $_SERVER['DOCUMENT_ROOT'] . '/mymodal.php';
include $_SERVER['DOCUMENT_ROOT'] . '/output/common/function.php'; // 스크린절단사이즈 함수 불러오기
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
$pdo = db_connect();
$today = date("Y-m-d"); // 현재일자 변수지정
try {
$sql = "select * from $DB.$tablename where num = ? ";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $num, PDO::PARAM_STR);
$stmh->execute();
$count = $stmh->rowCount();
$row = $stmh->fetch(PDO::FETCH_ASSOC); // $row 배열로 DB 정보를 불러온다.
if ($count < 1) {
print "검색결과가 없습니다.<br>";
} else {
include $_SERVER['DOCUMENT_ROOT'] . "/output/_row.php";
}
} catch (PDOException $Exception) {
print "오류: ".$Exception->getMessage();
}
?>
<title><?=$title_message?></title>
<style>
textarea {
overflow: hidden;
resize: none; /* 사용자 크기 조절을 방지 */
}
/* 기본 스타일 설정 */
input[type="checkbox"],
input[type="radio"] {
transform: scale(1.1); /* 크기 확대 */
margin: 3px; /* 여백 추가 */
}
/* "readonly" 상태일 때 스타일 설정 */
.readonly-checkbox,
.readonly-radio {
pointer-events: none; /* 사용자 상호작용 비활성화 */
opacity: 1; /* 불투명도 설정 */
color: red;
}
/* 레이블 텍스트 크게 설정 */
label {
font-size: 1.2em; /* 글꼴 크기 확대 */
display: inline-block;
margin: 3px 0;
}
.w-40{
width: 40%!important;
}
.w-60{
width: 60%!important;
}
</style>
</head>
<body>
<form id="board_form" name="board_form" method="post" enctype="multipart/form-data">
<input type="hidden" id="mode" name="mode" value="<?= isset($mode) ? $mode : '' ?>">
<input type="hidden" id="num" name="num" value="<?= isset($num) ? $num : '' ?>">
<input type="hidden" id="user_name" name="user_name" value="<?= isset($user_name) ? $user_name : '' ?>">
<input type="hidden" id="update_log" name="update_log" value="<?= isset($update_log) ? $update_log : NULL ?>">
<input type="hidden" id="tablename" name="tablename" value="<?= isset($tablename) ? $tablename : '' ?>">
<input type="hidden" id="is_deleted" name="is_deleted" value="<?= isset($is_deleted) ? $is_deleted : '0' ?>">
<input type="hidden" id="screen_su" name="screen_su" value="<?= isset($screen_su) ? $screen_su : '' ?>">
<input type="hidden" id="screen_m2" name="screen_m2" value="<?= isset($screen_m2) ? $screen_m2 : '' ?>">
<div class="container">
<div class="row justify-content-center align-items-center ">
<div class="card align-middle " style="width: 55rem;">
<div class="card-body text-center">
<div class="row d-flex justify-content-center align-items-center mb-2" >
<div class="col-sm-10" >
<div class="d-flex p-1 mb-1 justify-content-center align-items-center ">
<h3><?=$title_message?></h3> &nbsp; &nbsp; &nbsp; &nbsp;
<?php if($mode!=='view') { ?>
<button id="saveBtn" class="btn btn-dark btn-sm me-1" type="button">
<? if((int)$num>0) print ' <i class="bi bi-hdd-fill"></i> 저장'; else print ' <i class="bi bi-hdd-fill"></i> 저장'; ?></button>
<? } ?>
<button type="button" class="btn btn-outline-dark btn-sm me-2" id="showlogBtn">H</button>
</div>
</div>
<div class="col-sm-2" >
<button type="button" class="btn btn-outline-dark btn-sm" onclick="self.close();" > <i class="bi bi-box-arrow-left"></i> 창닫기 </button> &nbsp;
</div>
</div>
<div class="row text-center justify-content-center">
<span class="text-primary fs-6">
관리자가 아래의 라디오버튼을 클릭하면 상태가 변경됩니다.
</span>
</div>
<div class="row text-center justify-content-center">
<div class="d-flex justify-content-center align-items-center w-75">
<table class="table table-bordered">
<tbody>
<tr class="text-center">
<td class="text-center" style="width:120px;">
<span class="badge bg-dark fs-6">진행상태</span>
</td>
<td colspan="2" style="width:350px;">
<?php
$states = ["등록", "접수", "제작중", "완료"];
$is_admin = ($user_name === '김동실' || $user_name === '개발자');
?>
<?php foreach ($states as $state): ?>
&nbsp; <?= $state ?>
<input type="radio" class="readonly-radio" name="screen_state" value="<?= $state ?>" <?= ($screen_state === $state) ? "checked" : "" ?> <?= $is_admin ? "" : "readonly" ?> style="pointer-events: <?= $is_admin ? 'auto' : 'none' ?>;">
<?php endforeach; ?>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<button id="saveBtn" type="button" style="display:none;"></button>
</div>
</div>
</div>
</div>
<?php include $_SERVER['DOCUMENT_ROOT'] . '/output/common/output_write_form.php'; // 공통으로 들어가는 부분 ?>
<div class="container-fluid">
<div class="row justify-content-center align-items-center p-1 mt-1 mb-1">
<div class="row ">
<div class="col-sm-6">
<div class="d-flex justify-content-end align-items-center">
<span class="text-center fs-4">
스크린 작업 지시서 &nbsp;&nbsp;&nbsp;&nbsp;
<button type='button' id="loadScreenWorkBtn" class='btn btn-primary btn-sm me-2' ><i class="bi bi-card-text"></i> 작업일지 </button>
<button type='button' id="loadmidInspectScreenBtn" class='btn btn-danger btn-sm me-2' ><i class="bi bi-card-text"></i> 중간검사 </button>
</span>
</div>
</div>
<div class="col-sm-6">
<div class="d-flex justify-content-end align-items-center">
<span class="text-center fs-5">
<span id="total_screen" class="badge bg-secondary me-2"></span>
<span id="make_screen" class="badge bg-dark me-2"></span>
<span id="total_screen_m2" class="badge bg-dark"></span>
</span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-sm-12">
<div class="card">
<div class="card-body text-center">
<div class="container-fluid">
<div class="row">
<table id="screenTable" class="table table-bordered">
<thead>
<tr>
<th class="text-dark w60px">번호</th>
<th class="text-dark">층</th>
<th class="text-dark">부호</th>
<th class="text-dark" style="width:250px;">제작 너비(W)x높이(H), 수량(EA)</th>
<th colspan="3" class="text-dark" style="width:400px;"> 제작 형태 </th>
<th class="text-dark " style="width:400px;">제단 사항</th>
<th class="text-dark w120px">전체 공정</th>
</tr>
</thead>
<tbody>
<?php
$counter = 0;
$screenlist = isset($row['screenlist']) ? json_decode($row['screenlist'], true) : [];
foreach ($screenlist as $screenlist_item) {
$counter++;
$screenlist_item['num'] = $counter;
$floors = isset($screenlist_item['floors']) ? trim($screenlist_item['floors']) : '';
$text1 = isset($screenlist_item['text1']) ? trim($screenlist_item['text1']) : '';
$cutwidth = isset($screenlist_item['cutwidth']) ? trim($screenlist_item['cutwidth']) : '';
$cutheight = isset($screenlist_item['cutheight']) ? trim($screenlist_item['cutheight']) : '';
$number = isset($screenlist_item['number']) ? trim($screenlist_item['number']) : '';
$printside = isset($screenlist_item['printside']) ? trim($screenlist_item['printside']) : '';
$direction = isset($screenlist_item['direction']) ? trim($screenlist_item['direction']) : '';
$exititem = isset($screenlist_item['exititem']) ? trim($screenlist_item['exititem']) : '';
if ($exititem == '0') {
$intervalnum = '';
$intervalnumsecond = '';
$exitinterval = '';
$cover = '';
} else {
$intervalnum = isset($screenlist_item['intervalnum']) ? trim($screenlist_item['intervalnum']) : '';
$intervalnumsecond = isset($screenlist_item['intervalnumsecond']) ? trim($screenlist_item['intervalnumsecond']) : '';
$exitinterval = isset($screenlist_item['exitinterval']) ? trim($screenlist_item['exitinterval']) : '';
$cover = isset($screenlist_item['cover']) ? trim($screenlist_item['cover']) : '';
}
$memo = isset($screenlist_item['memo']) ? trim($screenlist_item['memo']) : '';
$text2 = isset($screenlist_item['text2']) ? trim($screenlist_item['text2']) : '';
$drawbottom1 = isset($screenlist_item['drawbottom1']) ? trim($screenlist_item['drawbottom1']) : '';
$drawbottom2 = isset($screenlist_item['drawbottom2']) ? trim($screenlist_item['drawbottom2']) : '';
$drawbottom3 = isset($screenlist_item['drawbottom3']) ? trim($screenlist_item['drawbottom3']) : '';
$remain_check = isset($screenlist_item['remain_check']) ? trim($screenlist_item['remain_check']) : '';
$done_check = isset($screenlist_item['done_check']) ? trim($screenlist_item['done_check']) : '';
$mid_check = isset($screenlist_item['mid_check']) ? trim($screenlist_item['mid_check']) : '';
$left_check = isset($screenlist_item['left_check']) ? trim($screenlist_item['left_check']) : '';
$right_check = isset($screenlist_item['right_check']) ? trim($screenlist_item['right_check']) : '';
$draw = isset($screenlist_item['draw']) ? trim($screenlist_item['draw']) : '';
$readonly = ($user_name !== '김동실' && $user_name !== '개발자') ? "readonly" : "";
if(!empty($exitinterval))
$text2 .= ' 개구부:' . $exitinterval . ', ';
if(!empty($cover))
$text2 .= '덮개:' . $cover ;
?>
<tr data-num="<?= $counter ?>">
<td rowspan="2"><?= $counter ?></td>
<td rowspan="2"><?= $floors ?></td>
<td rowspan="2" class="text-center">
<div class="d-flex justify-content-center fs-5">
<span class="text-dark fs-6"><?= $text1 ?></span> &nbsp;
<span class="badge bg-success fs-6" data-bs-toggle="tooltip" data-bs-placement="bottom" title="실리카/와이어/화이바" ><?= $memo ?></span>
</div>
</td>
<td rowspan="2" class="text-center">
<div class="d-flex justify-content-center fs-6">
<?= $text2 ?>
</div>
</td>
<td colspan="3">
<?php if (!empty($draw) && $draw != 'screennull.jpg'): ?>
<img src="../img/screen/<?= $draw ?>" style="width: 600px; height: auto;">
<?php endif; ?>
</td>
<td rowspan="2">
<?php
// 제품명에 따른 절단 치수 결정 ('실리카'는 1220, '와이어'는 1180, '화이'는 1200)
if (strpos($memo, '와이') !== false) {
$value = 1180;
$valueCut = 1180;
} elseif (strpos($memo, '화이') !== false) {
$value = 1200;
$valueCut = 1200;
} elseif (strpos($memo, '실리') !== false) {
$value = 1220;
$valueCut = 1220;
} else {
$value = 1220;
$valueCut = 1220;
}
$vertical = $cutheight;
// 시접 부분을 더한 제작 높이 계산
$makeVertical = $vertical + 140 + floor($vertical / $value) * 40;
// 1) 1180 또는 1220 크기 계산
$sizefirstCut = (int)floor(($makeVertical) / $value);
// echo '$sizefirstCut ' . $sizefirstCut;
// 2) 나머지 높이 계산
$remaining_height = $makeVertical - ($sizefirstCut * $value);
$First_remaining_height = $makeVertical - ($sizefirstCut * $value);
// echo '$remaining_height ' . $remaining_height;
// 나머지 높이가 940 이상일 때 추가 절단
if ($remaining_height > 940) {
$sizefirstCut += 1;
$remaining_height -= $value;
}
// 3) 공차를 적용한 규격 계산
$size_900 = ($remaining_height >= 841 && $remaining_height <= 940) ? 1 : 0;
$size_800 = ($remaining_height >= 541 && $remaining_height <= 840) ? 1 : 0;
$size_600 = ($remaining_height >= 441 && $remaining_height <= 640) ? 1 : 0;
$size_400 = ($remaining_height >= 341 && $remaining_height <= 440) ? 1 : 0;
$size_300 = ($remaining_height >= 1 && $remaining_height <= 340) ? 1 : 0;
// 공차 조건에 맞으면 시접부분 40을 가산
// if ($size_900 || $size_600 || $size_400 || $size_300) {
// $First_remaining_height += 40;
// }
// 추가 문구 설정
$dis_addstring = '';
if ($size_900) {
$dis_addstring .= '900 1(매), ';
}
if ($size_800) {
$dis_addstring .= '800 1(매), ';
}
if ($size_600) {
$dis_addstring .= '600 1(매), ';
}
if ($size_400) {
$dis_addstring .= '400 1(매), ';
}
if ($size_300) {
$dis_addstring .= '300 1(매), ';
}
// 마지막에 불필요한 쉼표와 공백을 제거
$dis_addstring = rtrim($dis_addstring, ', ');
// 기존 형식에 맞춘 출력 값
$dis_text = "높이 " . $value . " 절단 : " . $sizefirstCut . " (매)";
$dis_left = "나머지 높이 : " . $First_remaining_height . " (mm)";
$row_count = 0;
// 합계를 위한 변수 선언 (위쪽)
$totalfirstCut = 0;
$total_900 = 0;
$total_800 = 0;
$total_600 = 0;
$total_400 = 0;
$total_300 = 0;
// 세로 값을 가져옵니다 (col9가 F13에 해당)
$vertical = $cutheight;
$productName = $memo;
$result = calculateCutSize($productName, $vertical);
$size_900 = $result['900'];
$size_800 = $result['800'];
$size_600 = $result['600'];
$size_400 = $result['400'];
$size_300 = $result['300'];
// 제품명에 따른 절단 치수 결정 ('실리카'는 1220, '와이어'는 1180, '화이바'는 1200)
$result = calculateCutSize($productName, $vertical);
$size_900 = $result['900'];
$size_800 = $result['800'];
$size_600 = $result['600'];
$size_400 = $result['400'];
$size_300 = $result['300'];
// echo '<span class="text-dark fs-6">' . $dis_text . '</span> <br>';
// echo '<span class="text-dark fs-6">' . $dis_left . '</span> <br>';
// echo '<span class="text-primary fs-6">' . $dis_addstring . '</span>';
?>
<div class="d-flex align-items-center justify-content-center m-1">
<table id="mainTable" class="table table-bordered" >
<thead>
<tr>
<td rowspan="2" class="text-center align-middle lightgray">나머지 <br> 높이</td>
<td colspan="6" class="text-center align-middle lightgray"> 규격(매수) </td>
</tr>
<tr>
<td class="text-center lightgray"> <?=$valueCut?> </td>
<td class="text-center lightgray">900</td>
<td class="text-center lightgray">800</td>
<td class="text-center lightgray">600</td>
<td class="text-center lightgray">400</td>
<td class="text-center lightgray">300</td>
</tr>
</thead>
<tbody>
<tr>
<?php
// 나머지 높이 출력
echo '<td class="text-center fw-bold ">' . ($result['remaining'] > 0 ? $result['remaining'] : '') . '</td>';
// 각 규격에 따른 수량 계산
echo '<td class="text-center">'. ($result['firstCut'] >0 ? $result['firstCut'] : '') .'</td>';
echo '<td class="text-center">'. ($size_900 >0 ? $size_900 : '') .'</td>';
echo '<td class="text-center">'. ($size_800 >0 ? $size_800 : '') .'</td>';
echo '<td class="text-center">'. ($size_600 >0 ? $size_600 : '') .'</td>';
echo '<td class="text-center">'. ($size_400 >0 ? $size_400 : '') .'</td>';
echo '<td class="text-center">'. ($size_300 >0 ? $size_300 : '') .'</td>';
echo '</tr>';
$row_count++;
?>
</tr>
</tbody>
</tbody>
</table>
</div>
</div>
<?php
$checked = $remain_check == '1' ? "checked" : "";
echo '<div><input type="checkbox" name="remain_check[]" id="remain_check' . $counter . '" class="workcheckbox" ' . $checked . ' value="1" ' . $readonly . '> <label for="remain_check' . $counter . '">절단check</label></div>';
?>
</td>
<td rowspan="2">
<?php
$checked = $done_check == '1' ? "checked" : "";
echo '<div><input type="checkbox" name="done_check[]" id="done_check' . $counter . '" class="workcheckbox" ' . $checked . ' value="1" ' . $readonly . '> <label for="done_check' . $counter . '">작업완료</label></div>';
?>
</td>
</tr>
<tr data-num="<?= $counter ?>">
<td>
<span class="text-dark fw-bold fs-5"><?= $drawbottom1 ?></span>
<?php
$checked = $left_check == '1' ? "checked" : "";
if (in_array($exititem, ['1', '2', '3', '4', '5'])) {
echo '<div><input type="checkbox" name="left_check[]" id="left_check' . $counter . '" class="workcheckbox" ' . $checked . ' value="1" ' . $readonly . '> <label for="left_check' . $counter . '">절단check</label></div>';
}
?>
</td>
<td>
<span class="text-dark fw-bold fs-5"><?= $drawbottom3 ?></span>
<?php
$checked = $mid_check == '1' ? "checked" : "";
if (in_array($exititem, ['0', '4', '5'])) {
echo '<div><input type="checkbox" name="mid_check[]" id="mid_check' . $counter . '" class="workcheckbox" ' . $checked . ' value="1" ' . $readonly . '> <label for="mid_check' . $counter . '">절단check</label></div>';
}
?>
</td>
<td>
<span class="text-dark fw-bold fs-5"><?= $drawbottom2 ?></span>
<?php
$checked = $right_check == '1' ? "checked" : "";
if (in_array($exititem, ['1', '2', '3', '4', '5'])) {
echo '<div><input type="checkbox" name="right_check[]" id="right_check' . $counter . '" class="workcheckbox" ' . $checked . ' value="1" ' . $readonly . '> <label for="right_check' . $counter . '">절단check</label></div>';
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<script>
function captureReturnKey(e) {
if (e.keyCode == 13 && e.srcElement.type != 'textarea')
return false;
}
function recaptureReturnKey(e) {
if (e.keyCode == 13)
exe_search();
}
function Enter_Check() {
if (event.keyCode == 13) {
exe_search();
}
}
$(document).ready(function() {
var loader = document.getElementById('loadingOverlay');
if(loader)
loader.style.display = 'none';
});
var mode = '<?php echo $mode; ?>';
var ajaxRequest_write = null;
$(document).ready(function() {
$("input[name='screen_state']").change(function() {
if ($(this).is(":checked")) {
$("#saveBtn").click();
}
});
$("#saveBtn").click(function() {
var form = $('#board_form')[0];
var data = new FormData(form);
savedata();
});
hideOverlay();
});
function savedata() {
var form = $('#board_form')[0];
var data = new FormData(form);
$("#overlay").show();
$("button").prop("disabled", true);
Toastify({
text: "저장중...",
duration: 2000,
close: true,
gravity: "top",
position: "center",
style: {
background: "linear-gradient(to right, #00b09b, #96c93d)"
},
}).showToast();
if ((typeof ajaxRequest_write !== 'undefined' && ajaxRequest_write) || ajaxRequest_write !== null) {
ajaxRequest_write.abort();
}
ajaxRequest_write = $.ajax({
enctype: 'multipart/form-data',
processData: false,
contentType: false,
cache: false,
timeout: 600000,
url: "insert.php",
type: "post",
data: data,
dataType: "json",
success: function(data) {
// console.log(data.num);
setTimeout(function() {
Toastify({
text: "저장완료",
duration: 3000,
close: true,
gravity: "top",
position: "center",
style: {
background: "linear-gradient(to right, #00b09b, #96c93d)"
},
}).showToast();
}, 1000);
setTimeout(function() {
if (window.opener && !window.opener.closed) {
if (typeof window.opener.restorePageNumber === 'function') {
window.opener.restorePageNumber();
}
}
setTimeout(function() {
if (data && data.num)
window.location.href = 'write_form.php?mode=view&tablename=' + $('#tablename').val() + '&num=' + data.num;
}, 1000);
}, 1500);
hideOverlay();
},
error: function(jqxhr, status, error) {
console.log(jqxhr, status, error);
}
});
}
$(document).ready(function() {
var mode = '<?php echo $mode; ?>';
if (mode === 'view') {
$('input, textarea').prop('readonly', true); // Disable all input, textarea, and select elements
$('input[type=hidden]').prop('readonly', false);
$('.viewon').prop('readonly', true);
$('.viewNoBtn').prop('readonly', true);
$('input[type=hidden]').prop('readonly', false);
$('.viewon').each(function() {
$(this).addClass('readonly-checkbox readonly-radio');
});
$('input[type=file]').prop('disabled', true);
$('label').css('font-size', '1.2em');
// select 속성 readonly 효과 내기
$('select[data-readonly="true"]').on('mousedown', function(event) {
event.preventDefault();
});
// checkbox 속성 readonly 효과 내기
$('input[type="checkbox"][data-readonly="true"]').on('click', function(event) {
event.preventDefault();
});
}
});
function adjustTextareaHeight(textarea) {
textarea.style.height = 'auto';
textarea.style.height = (textarea.scrollHeight) + 'px';
}
$(document).ready(function() {
var $comment = $('#comment');
if ($comment.length) {
adjustTextareaHeight($comment[0]); // 초기 높이 조정
$comment.on('input', function() {
adjustTextareaHeight(this);
});
}
var $updatecomment = $('#updatecomment');
if ($updatecomment.length) {
adjustTextareaHeight($updatecomment[0]); // 초기 높이 조정
$updatecomment.on('input', function() {
adjustTextareaHeight(this);
});
}
});
$(document).ready(function() {
$("#showlogBtn").click(function() {
var num = '<?php echo $num; ?>';
var workitem = 'output';
var btn = $(this);
popupCenter("../Showlog.php?num=" + num + "&workitem=" + workitem, '로그기록', 500, 500);
btn.prop('disabled', false);
});
$(document).on('click', '.Modalclose', function(e) {
$("#telModal").modal("hide");
});
});
var ajaxRequest = null;
$(document).ready(function() {
let fullScreenlist = [];
function fetchScreenlistAndUpdateCheckboxes() {
if (ajaxRequest !== null) {
ajaxRequest.abort();
}
ajaxRequest = $.ajax({
url: 'get_screenlist.php',
method: 'GET',
data: {
num: <?= $row['num'] ?>
},
success: function(response) {
console.log('get_screenlist.php 결과값 : ', response);
if (response.success) {
fullScreenlist = response.screenlist || [];
if (Array.isArray(fullScreenlist)) {
updateCheckboxes(fullScreenlist);
updateTotals(fullScreenlist);
} else {
console.error('Invalid screenlist format', fullScreenlist);
}
} else {
console.error('Failed to fetch screenlist:', response.message);
}
}
});
}
function updateCheckboxes(screenlist) {
$('#screenTable tbody').children('tr').each(function(index, tr) {
const row = $(tr);
const item = screenlist[Math.floor(index / 2)];
if (item) {
for (const key in item) {
if (item.hasOwnProperty(key) && key.endsWith('_check')) {
row.find(`input[name="${key}[]"]`).prop('checked', item[key] === "1");
}
}
}
});
}
function onlysave() {
var form = $('#board_form')[0];
var data = new FormData(form);
$("button").prop("disabled", true);
showMsgModal(2); // 파일저장중
if ((typeof ajaxRequest_write !== 'undefined' && ajaxRequest_write) || ajaxRequest_write !== null) {
ajaxRequest_write.abort();
}
ajaxRequest_write = $.ajax({
enctype: 'multipart/form-data',
processData: false,
contentType: false,
cache: false,
timeout: 600000,
url: "insert.php",
type: "post",
data: data,
dataType: "json",
success: function(data) {
if (window.opener && !window.opener.closed) {
// 부모창 새로고침
window.opener.location.reload();
// 1초 대기 (예: 이후 작업이 있다면 여기서 처리 가능)
setTimeout(function() {
hideMsgModal();
console.log('부모창 리로드 후 1초 경과');
// 여기에 추가 작업이 있다면 넣으세요.
}, 1000);
}
},
error: function(jqxhr, status, error) {
console.log(jqxhr, status, error);
hideMsgModal();
}
});
}
function updateTotals() {
if (ajaxRequest !== null) {
ajaxRequest.abort();
}
ajaxRequest = $.ajax({
url: 'get_check_done.php',
method: 'GET',
data: { num: <?= $row['num'] ?> },
success: function(response) {
if (response.success) {
$('#make_screen').text('완료 : ' +response.total);
// console.log('response ', response);
// Corrected property names according to the JSON response from the server
var completedQuantity = response['totalCompleted']; // Corrected from response['total']
var checkQuantity = response['checkQuantity']; // 하나라도 체크되어있으면
var totalQuantity = response['totalItems']; // Corrected from response.totalQuantity
console.log('checkQuantity ', checkQuantity); // Should log 4
console.log('completedQuantity ', completedQuantity); // Should log 4
console.log('totalQuantity ', totalQuantity); // Should log 6
var newState = "";
if (completedQuantity === 0 && checkQuantity === 0) {
newState = "접수";
// } else if (completedQuantity < totalQuantity) {
} else if (checkQuantity > 0 && completedQuantity !== totalQuantity) {
newState = "제작중";
} else if (completedQuantity === totalQuantity) {
newState = "완료";
}
// Update the radio buttons for screen_state
$('input[name="screen_state"]').each(function() {
if ($(this).val() === newState) {
$(this).prop('checked', true);
}
});
// 진행상태 저장
onlysave();
// Update the UI elements with the fetched data
$('#total_screen').text(`총 수량: ${totalQuantity}`);
$('#make_screen').text(`완료: ${completedQuantity}`);
$('#total_screen_m2').text(`총 면적: ${parseFloat($("#screen_m2").val()).toFixed(1)} m²`);
} else {
console.error('Failed to fetch total:', response.message);
}
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('AJAX call failed: ', textStatus, errorThrown);
}
});
}
$('.workcheckbox').change(function() {
var screenlist = [];
$('#screenTable tbody').children('tr').each(function(index, tr) {
if (index % 2 === 0) {
const rowData = {};
screenlist.push(rowData);
}
});
$('#screenTable tbody').children('tr').each(function(index, tr) {
const row = $(tr);
const rowData = screenlist[Math.floor(index / 2)];
row.find('.workcheckbox').each(function() {
const checkbox = $(this);
const name = checkbox.attr('name').replace('[]', '');
rowData[name] = checkbox.is(':checked') ? "1" : "0";
});
});
// console.log('Updated screenlist before sending to server:', screenlist);
if (ajaxRequest !== null) {
ajaxRequest.abort();
}
ajaxRequest = $.ajax({
url: 'update_checkbox.php',
method: 'POST',
data: {
num: <?= $row['num'] ?>,
screenlist: JSON.stringify(screenlist)
},
success: function(response) {
// console.log('update_checkbox.php', response);
updateTotals();
if (response.success) {
Toastify({
text: "설정 저장중...",
duration: 1000,
close: true,
gravity: "top",
position: "center",
style: {
background: "linear-gradient(to right, #000000, #96c93d)",
marginTop: "0px"
},
}).showToast();
} else {
Toastify({
text: "저장실패...",
duration: 1000,
close: true,
gravity: "top",
position: "center",
style: {
background: "linear-gradient(to right, #000000, #96c93d)"
},
}).showToast();
}
}
});
});
// fetchScreenlistAndUpdateCheckboxes();
updatesummary();
});
function updatesummary() {
let totalScreen = '<?php echo isset($screen_su) ? $screen_su : '' ?>';
let totalScreenM2 = <?php echo isset($screen_m2) ? $screen_m2 : '' ?>;
document.getElementById('total_screen').textContent = `총 수량: ${totalScreen}`;
document.getElementById('total_screen_m2').textContent = `총 면적: ${totalScreenM2.toFixed(1)} m²`;
}
// 부트스트랩 툴팁
$(document).ready(function() {
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl);
});
});
</script>
<script>
$(document).ready(function () {
displayFileLoad(); // 기존파일 업로드 보이기
});
// 기존 파일 불러오기 (Google Drive에서 가져오기)
function displayFileLoad() {
$('#displayFile').show();
var data = <?php echo json_encode($savefilename_arr); ?>;
$("#displayFile").html(''); // 기존 내용 초기화
if (Array.isArray(data) && data.length > 0) {
data.forEach(function (fileData, i) {
const realName = fileData.realname || '다운로드 파일';
const link = fileData.link || '#';
const fileId = fileData.fileId || null;
if (!fileId) {
console.error("fileId가 누락되었습니다. index: " + i, fileData);
return;
}
$("#displayFile").append(
"<div class='row mb-3'>" +
"<div class='d-flex mb-3 align-items-center justify-content-start'>" +
"<span id='file" + i + "'>" +
"<a href='#' onclick=\"downloadFile('" + fileId + "', '" + realName + "'); return false;\">" +
"<span class='fw-bold text-primary'>" + realName + "</span>" +
"</a>" +
"</span> &nbsp;&nbsp;" +
"</div>" +
"</div>"
);
});
} else {
$("#displayFile").append(
"<div class='text-center text-muted'>No files</div>"
);
}
}
// 스크린작업일지 버튼 클릭 시
$(document).on('click', '#loadScreenWorkBtn', function() {
var num = $("#num").val();
var url = '/output/viewScreenWork.php?num=' + num ;
// 팝업 호출
customPopup(url, '스크린작업일지', 800, 900);
});
// 스크린-중간검사 버튼 클릭 시
$(document).on('click', '#loadmidInspectScreenBtn', function() {
var num = $("#num").val();
var url = '/output/viewMidInspectScreen.php?num=' + num ;
// 팝업 호출
customPopup(url, '스크린-중간검사', 800, 900);
});
</script>
</body>
</html>