적정인원보고서 수정
This commit is contained in:
115
Project/Controller/DashBoardController.cs
Normal file
115
Project/Controller/DashBoardController.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using FCOMMON;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
public class DashBoardController : BaseController
|
||||
{
|
||||
[HttpPost]
|
||||
public void Index([FromBody] string value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// PUT api/values/5
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string TodayCountH()
|
||||
{
|
||||
|
||||
var sql = "select count(*) from EETGW_HolydayRequest " +
|
||||
"where gcode = 'EET1P' and conf = 1 and HolyDays > 0 and " +
|
||||
"sdate <= GETDATE() and edate >= GETDATE()";
|
||||
var cnt = DBM.ExecuteScalar(sql);
|
||||
return cnt.ToString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetholyUser()
|
||||
{
|
||||
var sql = string.Empty;
|
||||
sql = $"select uid,cate,sdate,edate,HolyReason " +
|
||||
$"from EETGW_HolydayRequest " +
|
||||
$"where gcode = '{FCOMMON.info.Login.gcode}'" +
|
||||
$"and conf = 1 and HolyDays > 0 and sdate <= GETDATE() and edate >= GETDATE()";
|
||||
|
||||
if (info.Login.gcode == null)
|
||||
info.Login.gcode = "EET1P";
|
||||
|
||||
sql = sql.Replace("{gcode}", FCOMMON.info.Login.gcode);
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;// "Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!";
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
|
||||
var dt = new System.Data.DataTable();
|
||||
da.Fill(dt);
|
||||
da.Dispose();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View();
|
||||
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var contents = result.Content;
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
4
Project/Dialog/fDashboard.Designer.cs
generated
4
Project/Dialog/fDashboard.Designer.cs
generated
@@ -38,7 +38,7 @@
|
||||
this.label1.ForeColor = System.Drawing.Color.DimGray;
|
||||
this.label1.Location = new System.Drawing.Point(0, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(800, 450);
|
||||
this.label1.Size = new System.Drawing.Size(1063, 567);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "요약 화면 구성 중 입니다.\r\n\r\n업무일지는 \"관리->업무일지->목록\" 을 사용하세요";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
@@ -48,7 +48,7 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.ClientSize = new System.Drawing.Size(1063, 567);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "fDashboard";
|
||||
this.Text = "요약";
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
using FCOMMON;
|
||||
using FCM0000.Mail;
|
||||
using FCOMMON;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using Microsoft.Web.WebView2.WinForms;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -13,11 +17,65 @@ namespace Project.Dialog
|
||||
{
|
||||
public partial class fDashboard : fBase
|
||||
{
|
||||
private WebView2 webView21;
|
||||
public fDashboard()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeWebView2();
|
||||
}
|
||||
private void InitializeWebView2()
|
||||
{
|
||||
// 수동으로 WebView2 컨트롤 생성
|
||||
this.webView21 = new WebView2();
|
||||
|
||||
// 기본 속성 설정
|
||||
this.webView21.CreationProperties = null;
|
||||
this.webView21.DefaultBackgroundColor = Color.White;
|
||||
this.webView21.Dock = DockStyle.Fill;
|
||||
this.webView21.Location = new Point(0, 0);
|
||||
this.webView21.Name = "webView21";
|
||||
this.webView21.Size = new Size(800, 600);
|
||||
this.webView21.TabIndex = 0;
|
||||
this.webView21.ZoomFactor = 1D;
|
||||
|
||||
// 폼에 추가
|
||||
this.Controls.Add(this.webView21);
|
||||
|
||||
// 비동기 초기화
|
||||
InitializeAsync();
|
||||
}
|
||||
private async void InitializeAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Fixed Version 경로 설정
|
||||
string runtimePath = Path.Combine(Application.StartupPath, "WebView2Runtime");
|
||||
|
||||
if (Directory.Exists(runtimePath))
|
||||
{
|
||||
var env = await CoreWebView2Environment.CreateAsync(runtimePath);
|
||||
await this.webView21.EnsureCoreWebView2Async(env);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 시스템에 설치된 WebView2 사용
|
||||
await this.webView21.EnsureCoreWebView2Async();
|
||||
}
|
||||
var fn = "intro.html";
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
fn = "dashboard.html";
|
||||
var fi = new System.IO.FileInfo($"view\\{fn}");
|
||||
if(fi.Exists)
|
||||
{
|
||||
webView21.Source = new Uri(fi.FullName);
|
||||
label1.Visible = false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"WebView2 초기화 실패: {ex.Message}");
|
||||
}
|
||||
}
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
@@ -261,6 +261,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="BaseController.cs" />
|
||||
<Compile Include="Controller\APIController.cs" />
|
||||
<Compile Include="Controller\DashBoardController.cs" />
|
||||
<Compile Include="Controller\ManualController.cs" />
|
||||
<Compile Include="Controller\ProjectController.cs" />
|
||||
<Compile Include="Controller\JobreportController.cs" />
|
||||
@@ -623,6 +624,12 @@
|
||||
<Content Include="SqlServerTypes\x86\SqlServerSpatial140.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="View\intro.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="View\dashboard.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
|
||||
|
||||
114
Project/View/dashboard.html
Normal file
114
Project/View/dashboard.html
Normal file
@@ -0,0 +1,114 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>근태현황 대시보드</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container py-5">
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-3">
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">출근</h5>
|
||||
<p class="card-text fs-2" id="presentCount">0</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">휴가</h5>
|
||||
<p class="card-text fs-2" id="leaveCount">0</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">휴가요청</h5>
|
||||
<p class="card-text fs-2" id="leaveCount">0</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">구매요청</h5>
|
||||
<p class="card-text fs-2" id="leaveCount">0</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
휴가자 현황
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>이름</th>
|
||||
<th>출근 시간</th>
|
||||
<th>퇴근 시간</th>
|
||||
<th>상태</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="attendanceTable">
|
||||
<!-- 데이터가 여기에 표시됩니다 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// 샘플 데이터
|
||||
const attendanceData = [
|
||||
{ name: '홍길동', checkIn: '09:01', checkOut: '18:00', status: '지각' },
|
||||
{ name: '김철수', checkIn: '08:55', checkOut: '18:05', status: '정상' },
|
||||
{ name: '이영희', checkIn: '-', checkOut: '-', status: '결근' },
|
||||
{ name: '박민수', checkIn: '09:00', checkOut: '18:10', status: '정상' },
|
||||
{ name: '최지우', checkIn: '09:20', checkOut: '18:00', status: '지각' }
|
||||
];
|
||||
|
||||
function updateDashboard(data) {
|
||||
let present = 0, leave = 0, late = 0, absent = 0;
|
||||
let tableRows = '';
|
||||
data.forEach(item => {
|
||||
if (item.status === '정상' || item.status === '지각') present++;
|
||||
if (item.checkOut !== '-') leave++;
|
||||
if (item.status === '지각') late++;
|
||||
if (item.status === '결근') absent++;
|
||||
tableRows += `<tr>
|
||||
<td>${item.name}</td>
|
||||
<td>${item.checkIn}</td>
|
||||
<td>${item.checkOut}</td>
|
||||
<td>${item.status}</td>
|
||||
</tr>`;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// 페이지 로드 시 대시보드 업데이트
|
||||
updateDashboard(attendanceData);
|
||||
|
||||
// 휴가 인원 Ajax 업데이트
|
||||
function updateLeaveCount() {
|
||||
fetch('http://127.0.0.1:9000/Dashboard/TodayCountH')
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
// 수신된 데이터가 "1" 형태로 반환되므로, 쌍따옴표를 제거하고 숫자로 변환
|
||||
const cleanData = data.replace(/"/g, '');
|
||||
document.getElementById('leaveCount').textContent = parseInt(cleanData, 10);
|
||||
})
|
||||
.catch(error => console.error('휴가 인원 업데이트 중 오류 발생:', error));
|
||||
}
|
||||
|
||||
// 페이지 로드 시 휴가 인원 업데이트
|
||||
updateLeaveCount();
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
1
Project/View/intro.html
Normal file
1
Project/View/intro.html
Normal file
@@ -0,0 +1 @@
|
||||
intro file
|
||||
@@ -253,40 +253,7 @@ namespace Project
|
||||
var menu_kuntaeVisible = FCOMMON.Util.getBit(FCOMMON.info.Login.gpermission, (int)FCOMMON.eGroupPermission.menu_workday);
|
||||
var menu_logdata = FCOMMON.Util.getBit(FCOMMON.info.Login.gpermission, (int)FCOMMON.eGroupPermission.menu_logdata);
|
||||
|
||||
|
||||
this.Menu_Dashboard();
|
||||
// Menu_Note();
|
||||
|
||||
////시작폼 확인
|
||||
//if (Pub.setting.startForm == eFormList.NR구매관리 && menu_purchaseVisible == true)
|
||||
//{
|
||||
// menu_nrpurchase();
|
||||
//}
|
||||
//else if (Pub.setting.startForm == eFormList.업무일지 && menu_dailyhistoryVisible == true)
|
||||
//{
|
||||
// menu_work_report();
|
||||
//}
|
||||
//else if (Pub.setting.startForm == eFormList.프로젝트관리 && menu_projectVisible == true)
|
||||
//{
|
||||
// menu_projecT_list();
|
||||
//}
|
||||
//else if (Pub.setting.startForm == eFormList.재고관리 && menu_jagoVisible == true)
|
||||
//{
|
||||
// Menu_Inventory();
|
||||
//}
|
||||
//else if (Pub.setting.startForm == eFormList.재고현황 && menu_jagoVisible == true)
|
||||
//{
|
||||
// Menu_InventoryList();
|
||||
//}
|
||||
//else if(Pub.setting.startForm == eFormList.품목입고)
|
||||
//{
|
||||
// menu_itemin();
|
||||
//}
|
||||
//else if (Pub.setting.startForm == eFormList.근태입력)
|
||||
//{
|
||||
// Menu_WorkTable();
|
||||
//}
|
||||
|
||||
}
|
||||
void Menu_WorkTable()
|
||||
{
|
||||
@@ -668,6 +635,12 @@ namespace Project
|
||||
}
|
||||
|
||||
private void 로그인ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
CloseAllForm();
|
||||
Func_Login();
|
||||
}
|
||||
|
||||
void CloseAllForm()
|
||||
{
|
||||
while (tabControl1.TabPages.Count > 0)
|
||||
{
|
||||
@@ -679,7 +652,6 @@ namespace Project
|
||||
this.tabControl1.Refresh();
|
||||
}
|
||||
|
||||
Func_Login();
|
||||
}
|
||||
|
||||
private void 메일전송ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user