ot집계표에 %추가

This commit is contained in:
ChiKyun Kim
2025-07-30 11:33:17 +09:00
parent c0eb33f60a
commit 943fdb2036
14 changed files with 2033 additions and 1011 deletions

View File

@@ -31,6 +31,9 @@
this.components = new System.ComponentModel.Container();
this.dataGridView1 = new arCtl.arDatagridView();
this.panel1 = new System.Windows.Forms.Panel();
this.cmbApploval = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.radTypeAll = new System.Windows.Forms.RadioButton();
this.radTypePMS = new System.Windows.Forms.RadioButton();
this.radType = new System.Windows.Forms.RadioButton();
this.tbEd = new System.Windows.Forms.TextBox();
@@ -40,9 +43,6 @@
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.btRefresh = new System.Windows.Forms.Button();
this.tbSd = new System.Windows.Forms.TextBox();
this.radTypeAll = new System.Windows.Forms.RadioButton();
this.label2 = new System.Windows.Forms.Label();
this.cmbApploval = new System.Windows.Forms.ComboBox();
this.bs = new System.Windows.Forms.BindingSource(this.components);
this.dsReport = new FPJ0000.dsReport();
this.ta = new FPJ0000.dsReportTableAdapters.jobReportTableAdapter();
@@ -93,6 +93,38 @@
this.panel1.Size = new System.Drawing.Size(1028, 36);
this.panel1.TabIndex = 3;
//
// cmbApploval
//
this.cmbApploval.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbApploval.FormattingEnabled = true;
this.cmbApploval.Items.AddRange(new object[] {
"승인완료",
"미승인"});
this.cmbApploval.Location = new System.Drawing.Point(543, 9);
this.cmbApploval.Name = "cmbApploval";
this.cmbApploval.Size = new System.Drawing.Size(85, 20);
this.cmbApploval.TabIndex = 14;
this.cmbApploval.SelectedIndexChanged += new System.EventHandler(this.cmbApploval_SelectedIndexChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(508, 13);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(29, 12);
this.label2.TabIndex = 13;
this.label2.Text = "승인";
//
// radTypeAll
//
this.radTypeAll.AutoSize = true;
this.radTypeAll.Location = new System.Drawing.Point(749, 11);
this.radTypeAll.Name = "radTypeAll";
this.radTypeAll.Size = new System.Drawing.Size(78, 16);
this.radTypeAll.TabIndex = 12;
this.radTypeAll.Text = "대체,PMS";
this.radTypeAll.UseVisualStyleBackColor = true;
//
// radTypePMS
//
this.radTypePMS.AutoSize = true;
@@ -183,38 +215,6 @@
this.tbSd.Text = "2020";
this.tbSd.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// radTypeAll
//
this.radTypeAll.AutoSize = true;
this.radTypeAll.Location = new System.Drawing.Point(749, 11);
this.radTypeAll.Name = "radTypeAll";
this.radTypeAll.Size = new System.Drawing.Size(78, 16);
this.radTypeAll.TabIndex = 12;
this.radTypeAll.Text = "대체,PMS";
this.radTypeAll.UseVisualStyleBackColor = true;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(508, 13);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(29, 12);
this.label2.TabIndex = 13;
this.label2.Text = "승인";
//
// cmbApploval
//
this.cmbApploval.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbApploval.FormattingEnabled = true;
this.cmbApploval.Items.AddRange(new object[] {
"승인완료",
"미승인"});
this.cmbApploval.Location = new System.Drawing.Point(543, 9);
this.cmbApploval.Name = "cmbApploval";
this.cmbApploval.Size = new System.Drawing.Size(85, 20);
this.cmbApploval.TabIndex = 14;
this.cmbApploval.SelectedIndexChanged += new System.EventHandler(this.cmbApploval_SelectedIndexChanged);
//
// bs
//
this.bs.DataMember = "jobreport";
@@ -223,6 +223,7 @@
// dsReport
//
this.dsReport.DataSetName = "dsReport";
this.dsReport.Namespace = "http://tempuri.org/dsReport.xsd";
this.dsReport.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// ta

View File

@@ -45,7 +45,7 @@ namespace FPJ0000.JobReport_
//var taH = new dsReportTableAdapters.HolidayLIstTableAdapter();
//taH.Fill(this.dsReport.HolidayLIst, tbMon.Text + "%");
var isReqData = cmbApploval.SelectedIndex > 0;
var isReqData = cmbApploval.SelectedIndex > 0; //미승인선택
string prcname = tbProcess.SelectedIndex < 1 ? "%" : tbProcess.Text.Trim();
if (isReqData)
{
@@ -73,8 +73,7 @@ namespace FPJ0000.JobReport_
this.dataGridView1.Columns.Add("공정", "공정");
this.dataGridView1.Columns.Add("이름", "이름");
this.dataGridView1.Columns.Add("사번", "사번");
//var otTitle = radType.Checked ? "연장" : "PMS";
//이름/년도데이터추가
var ymlist = dsReport.jobReport.OrderBy(t => t.yymm).GroupBy(t => t.yymm);
@@ -82,51 +81,77 @@ namespace FPJ0000.JobReport_
{
var drYm = ym.FirstOrDefault();
var basehr = int.Parse(drYm.yymm.Substring(drYm.yymm.IndexOf('(')).Replace("(", "").Replace(")", ""));
this.dataGridView1.Columns.Add(drYm.yymm, drYm.yymm.Substring(0, 7) + "\n휴일");// + "\r\n(" + basehr.ToString() + ")");
var colname = drYm.yymm;//.Substring(0, 7);
var yymm = drYm.yymm.Substring(0, 7);
if (isReqData)
{
this.dataGridView1.Columns.Add(drYm.yymm, $"({basehr})\n요청");
this.dataGridView1.Columns.Add(colname, yymm + "\n휴일");
this.dataGridView1.Columns.Add(colname, $"요청");
}
else if (radTypeAll.Checked)
{
this.dataGridView1.Columns.Add(drYm.yymm, $"({basehr})\n연장");
this.dataGridView1.Columns.Add(drYm.yymm, $"({basehr})\nPMS");
this.dataGridView1.Columns.Add(colname, yymm + "\n휴일");
this.dataGridView1.Columns.Add(colname, $"연장");
this.dataGridView1.Columns.Add(colname, $"휴일\n(PMS)");
this.dataGridView1.Columns.Add(colname, $"PMS");
}
else if (radType.Checked)
{
this.dataGridView1.Columns.Add(drYm.yymm, $"({basehr})\n연장");
this.dataGridView1.Columns.Add(colname, yymm + "\n휴일");
this.dataGridView1.Columns.Add(colname, $"연장");
}
else
{
this.dataGridView1.Columns.Add(drYm.yymm, $"({basehr})\nPMS");
this.dataGridView1.Columns.Add(colname, yymm + "\n휴일\n(PMS)");
this.dataGridView1.Columns.Add(colname, $"PMS");
}
this.dataGridView1.Columns.Add(colname, $"{basehr}h\n%");
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 3].Tag = basehr;
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 3].DefaultCellStyle.Format = "N1";
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 2].Tag = basehr;
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 1].Tag = basehr;
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 2].DefaultCellStyle.Format = "N1";
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 1].DefaultCellStyle.Format = "N1";
if (radTypeAll.Checked)
{
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 3].Tag = basehr;
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 3].DefaultCellStyle.Format = "N1";
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 5].Tag = basehr;
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 5].DefaultCellStyle.Format = "N1";
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 4].Tag = basehr;
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 4].DefaultCellStyle.Format = "N1";
}
}
this.dataGridView1.Columns.Add("subtotal", "합계\n휴일");
//사용자별 전체합계칸
if (isReqData)
{
this.dataGridView1.Columns.Add("subtotal", "합계\n휴일");
this.dataGridView1.Columns.Add($"subtotal", $"합계\n요청");
}
else if (radTypeAll.Checked)
{
this.dataGridView1.Columns.Add("subtotal", "합계\n휴일");
this.dataGridView1.Columns.Add($"subtotal", $"합계\n연장");
this.dataGridView1.Columns.Add("subtotal", "합계\n휴일\n(PMS)");
this.dataGridView1.Columns.Add($"subtotal", $"합계\nPMS");
}
else if (radType.Checked)
{
this.dataGridView1.Columns.Add("subtotal", "합계\n휴일");
this.dataGridView1.Columns.Add($"subtotal", $"합계\n연장");
}
else
{
this.dataGridView1.Columns.Add("subtotal", "합계\n휴일\n(PMS)");
this.dataGridView1.Columns.Add($"subtotal", $"합계\nPMS");
}
@@ -149,19 +174,32 @@ namespace FPJ0000.JobReport_
List<Boolean> high = new List<bool>();
List<Boolean> low = new List<bool>();
for (int i = 3; i < this.dataGridView1.ColumnCount; i += 2)
var columngap = radTypeAll.Checked ? 4 : 2;
for (int i = 3; i < this.dataGridView1.ColumnCount; i += columngap)
{
var col = dataGridView1.Columns[i];
var colName = col.Name;
var coltitle = col.HeaderText;
if (col.Tag == null) continue;
var basehr = int.Parse(col.Tag.ToString());
var userDatas = dsReport.jobReport.Where(t => t.uid == drName.uid && t.yymm == col.Name);
var userDatas = dsReport.jobReport.Where(t => t.uid == drName.uid && t.yymm == colName);
if (userDatas == null || userDatas.Count() == 0)
{
//이달에는 데이터가없다
rowdata.Add(null); //휴일
rowdata.Add(null); //연장
//전체보기시에는 더많은 skip을 해야한다.
if (radTypeAll.Checked)
{
rowdata.Add(null); //휴일(pms)
rowdata.Add(null); //연장(pms)
}
rowdata.Add(null); //ot율
high.Add(false);
low.Add(false);
}
@@ -177,29 +215,31 @@ namespace FPJ0000.JobReport_
//}
var sumhr = userDatas.Sum(t => t.hrs);
double sumotOne = 0.0;
double sumhlOne = 0.0;
double sumotAll = 0.0;
double sumhlAll = 0.0;
double sumotOne = 0.0; //연장근무(평일)
double sumhlOne = 0.0; //연장근무(휴일)
if (isReqData)
double sumotAll = 0.0; //연장근무합계(평일)
double sumhlAll = 0.0; //연장근무합계(휴일)
if (isReqData) //미승인데이터
{
sumotOne = userDatas.Sum(t => t.ot);
sumhlOne = userDatas.Sum(t => t.holyot);
}
else if (radType.Checked)
else if (radType.Checked) //대체승인
{
sumotOne = userDatas.Sum(t => t.ot2);
sumhlOne = userDatas.Sum(t => t.holyot2);
}
else if (radTypePMS.Checked)
else if (radTypePMS.Checked) //PMS승인
{
sumotOne = userDatas.Sum(t => t.otPMS);
sumhlOne = userDatas.Sum(t => t.holyotPMS);
}
else
{
//전체보기에는 두개를 모두 사용한다.
sumotOne = userDatas.Sum(t => t.ot2);
sumhlOne = userDatas.Sum(t => t.holyot2);
@@ -207,24 +247,30 @@ namespace FPJ0000.JobReport_
sumhlAll = userDatas.Sum(t => t.holyotPMS);
}
//사용자별 누적 합계
User_sumhlOne += sumhlOne;
User_sumotOne += sumotOne;
if (radTypeAll.Checked)
{
User_sumhlAll += sumhlAll;
User_sumotAll += sumotAll;
}
var user_total_ot = sumhlOne + sumotOne;
//우측 합계표시
if (sumhlOne == 0.0) rowdata.Add(null);
else rowdata.Add($"{Math.Round(sumhlOne, 1)}");
if (sumotOne == 0.0) rowdata.Add(null);
else rowdata.Add($"{Math.Round(sumotOne, 1)}");
//전체라면 합계를 추가
//전체라면 PMS용 합계를 추가
if (isReqData == false && radTypeAll.Checked)
{
user_total_ot += sumhlAll + sumotAll;
if (sumhlAll == 0.0) rowdata.Add(null);
else rowdata.Add($"{Math.Round(sumhlAll, 1)}");
@@ -234,6 +280,14 @@ namespace FPJ0000.JobReport_
if (basehr != 0.0)
{
var otrate = (user_total_ot / basehr) * 100.0;
rowdata.Add($"{otrate:N1}%");
}
else rowdata.Add(null);
if (sumhr > basehr) high.Add(true);
else high.Add(false);
@@ -242,17 +296,27 @@ namespace FPJ0000.JobReport_
}
}
//사용자별 합계정보 표시
if (User_sumhlOne == 0.0) rowdata.Add(null);
else rowdata.Add($"{Math.Round(User_sumhlOne, 1)}"); //합계(휴일)
rowdata.Add($"{Math.Round(User_sumhlOne, 1)}"); //합게
rowdata.Add($"{Math.Round(User_sumotOne, 1)}"); //합
if (User_sumotOne == 0.0) rowdata.Add(null);
else rowdata.Add($"{Math.Round(User_sumotOne, 1)}"); //합계(연장, PMS)
if (isReqData == false && radTypeAll.Checked)
{
rowdata.Add($"{Math.Round(User_sumhlAll, 1)}"); //합게
rowdata.Add($"{Math.Round(User_sumotAll, 1)}"); //합게
if (User_sumhlAll == 0.0) rowdata.Add(null);
else rowdata.Add($"{Math.Round(User_sumhlAll, 1)}"); //합계(휴일-PMS)
if (User_sumotAll == 0.0) rowdata.Add(null);
else rowdata.Add($"{Math.Round(User_sumotAll, 1)}"); //합게(연장-PMS)
}
dataGridView1.Rows.Add(rowdata.ToArray());
//이번에 추가한 줄의 셀 컬러를 지정한다
@@ -262,13 +326,30 @@ namespace FPJ0000.JobReport_
var col = this.dataGridView1.Columns[i];
if (col.Tag == null)
{
dataGridView1.Rows[currentrow].Cells[i].Style.ForeColor = Color.Black;
dataGridView1.Rows[currentrow].Cells[i].Style.BackColor = Color.WhiteSmoke;
//여기에는 합계칸이 온다
if (col.HeaderText.EndsWith("%"))
{
dataGridView1.Rows[currentrow].Cells[i].Style.ForeColor = Color.Black;
dataGridView1.Rows[currentrow].Cells[i].Style.BackColor = Color.Gold;
}
else if (col.HeaderText.Contains("PMS"))
{
dataGridView1.Rows[currentrow].Cells[i].Style.ForeColor = Color.DimGray;
dataGridView1.Rows[currentrow].Cells[i].Style.BackColor = Color.WhiteSmoke;
}
else
{
dataGridView1.Rows[currentrow].Cells[i].Style.ForeColor = Color.Black;
dataGridView1.Rows[currentrow].Cells[i].Style.BackColor = Color.WhiteSmoke;
}
continue;
}
else
{
if (col.HeaderText.Contains("요청") || col.HeaderText.Contains("연장") || col.HeaderText.Contains("PMS"))
if (col.HeaderText.Contains("휴일"))
dataGridView1.Rows[currentrow].Cells[i].Style.BackColor = Color.White;// 155,82,93);
else if (col.HeaderText.Contains("요청") || col.HeaderText.Contains("연장") || col.HeaderText.Contains("PMS"))
dataGridView1.Rows[currentrow].Cells[i].Style.BackColor = Color.Linen;// 155,82,93);
else
dataGridView1.Rows[currentrow].Cells[i].Style.BackColor = Color.White;
@@ -292,10 +373,16 @@ namespace FPJ0000.JobReport_
rowdata2.Add("합계");
rowdata2.Add(dataGridView1.Rows.Count);
rowdata2.Add(null); //사번
for (int i = 0; i < this.dataGridView1.ColumnCount; i++)
for (int i = 3; i < this.dataGridView1.ColumnCount; i++)
{
var col = this.dataGridView1.Columns[i];
if (col.Tag == null && col.HeaderText.StartsWith("합계") == false) continue;
var colName = col.Name;
var header = col.HeaderText;
if (col.HeaderText.EndsWith("%") == true )
{
rowdata2.Add(null);
continue;
}
var sum = 0.0;
for (int r = 0; r < this.dataGridView1.RowCount; r++)
@@ -306,6 +393,7 @@ namespace FPJ0000.JobReport_
if (sum != 0.0) rowdata2.Add(sum);
else rowdata2.Add(null);
}
dataGridView1.Rows.Add(rowdata2.ToArray());
dataGridView1.Rows[dataGridView1.Rows.Count - 1].DefaultCellStyle.BackColor = Color.LightGray;

View File

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->