휴가신청구분 입력 불가 하게 함

This commit is contained in:
chi
2022-07-04 09:26:39 +09:00
parent f8c38ae031
commit 38a681000f
11 changed files with 2103 additions and 725 deletions

View File

@@ -28,149 +28,160 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.bs = new System.Windows.Forms.BindingSource(this.components);
this.dsReport = new FPJ0000.dsReport();
this.ta = new FPJ0000.dsReportTableAdapters.jobReportTableAdapter();
this.dataGridView1 = new arCtl.arDatagridView();
this.panel1 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.tbProcess = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.btRefresh = new System.Windows.Forms.Button();
this.tbMon = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.bs)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dsReport)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// bs
//
this.bs.DataMember = "jobreport";
this.bs.DataSource = this.dsReport;
//
// dsReport
//
this.dsReport.DataSetName = "dsReport";
this.dsReport.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// ta
//
this.ta.ClearBeforeFill = true;
//
// dataGridView1
//
this.dataGridView1.A_DelCurrentCell = true;
this.dataGridView1.A_EnterToTab = true;
this.dataGridView1.A_KoreanField = null;
this.dataGridView1.A_UpperField = null;
this.dataGridView1.A_ViewRownumOnHeader = true;
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
this.dataGridView1.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView1.Location = new System.Drawing.Point(0, 42);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(1348, 657);
this.dataGridView1.TabIndex = 2;
//
// panel1
//
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.tbProcess);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.linkLabel1);
this.panel1.Controls.Add(this.btRefresh);
this.panel1.Controls.Add(this.tbMon);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Padding = new System.Windows.Forms.Padding(5);
this.panel1.Size = new System.Drawing.Size(1348, 42);
this.panel1.TabIndex = 3;
//
// button1
//
this.button1.Dock = System.Windows.Forms.DockStyle.Right;
this.button1.Location = new System.Drawing.Point(1193, 5);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 32);
this.button1.TabIndex = 8;
this.button1.Text = "내보내기";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// tbProcess
//
this.tbProcess.FormattingEnabled = true;
this.tbProcess.Location = new System.Drawing.Point(222, 10);
this.tbProcess.Name = "tbProcess";
this.tbProcess.Size = new System.Drawing.Size(158, 20);
this.tbProcess.TabIndex = 7;
this.tbProcess.SelectedIndexChanged += new System.EventHandler(this.tbProcess_SelectedIndexChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(187, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 12);
this.label1.TabIndex = 6;
this.label1.Text = "공정";
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(13, 15);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(45, 12);
this.linkLabel1.TabIndex = 0;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "조회 년";
//
// btRefresh
//
this.btRefresh.Dock = System.Windows.Forms.DockStyle.Right;
this.btRefresh.Location = new System.Drawing.Point(1268, 5);
this.btRefresh.Name = "btRefresh";
this.btRefresh.Size = new System.Drawing.Size(75, 32);
this.btRefresh.TabIndex = 2;
this.btRefresh.Text = "새로고침";
this.btRefresh.UseVisualStyleBackColor = true;
this.btRefresh.Click += new System.EventHandler(this.btRefresh_Click);
//
// tbMon
//
this.tbMon.Location = new System.Drawing.Point(66, 10);
this.tbMon.Name = "tbMon";
this.tbMon.Size = new System.Drawing.Size(115, 21);
this.tbMon.TabIndex = 1;
this.tbMon.Text = "2020";
this.tbMon.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// rJobReportOT
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1348, 699);
this.Controls.Add(this.dataGridView1);
this.Controls.Add(this.panel1);
this.Name = "rJobReportOT";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "휴일/연장근무 집계표";
this.Load += new System.EventHandler(this.rJobReport_Load);
((System.ComponentModel.ISupportInitialize)(this.bs)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dsReport)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
this.components = new System.ComponentModel.Container();
this.bs = new System.Windows.Forms.BindingSource(this.components);
this.dsReport = new FPJ0000.dsReport();
this.ta = new FPJ0000.dsReportTableAdapters.jobReportTableAdapter();
this.dataGridView1 = new arCtl.arDatagridView();
this.panel1 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.tbProcess = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.btRefresh = new System.Windows.Forms.Button();
this.tbSd = new System.Windows.Forms.TextBox();
this.tbEd = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.bs)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dsReport)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// bs
//
this.bs.DataMember = "jobreport";
this.bs.DataSource = this.dsReport;
//
// dsReport
//
this.dsReport.DataSetName = "dsReport";
this.dsReport.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// ta
//
this.ta.ClearBeforeFill = true;
//
// dataGridView1
//
this.dataGridView1.A_DelCurrentCell = true;
this.dataGridView1.A_EnterToTab = true;
this.dataGridView1.A_KoreanField = null;
this.dataGridView1.A_UpperField = null;
this.dataGridView1.A_ViewRownumOnHeader = true;
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
this.dataGridView1.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView1.Location = new System.Drawing.Point(0, 42);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(1348, 657);
this.dataGridView1.TabIndex = 2;
//
// panel1
//
this.panel1.Controls.Add(this.tbEd);
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.tbProcess);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.linkLabel1);
this.panel1.Controls.Add(this.btRefresh);
this.panel1.Controls.Add(this.tbSd);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Padding = new System.Windows.Forms.Padding(5);
this.panel1.Size = new System.Drawing.Size(1348, 42);
this.panel1.TabIndex = 3;
//
// button1
//
this.button1.Dock = System.Windows.Forms.DockStyle.Right;
this.button1.Location = new System.Drawing.Point(1193, 5);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 32);
this.button1.TabIndex = 8;
this.button1.Text = "내보내기";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// tbProcess
//
this.tbProcess.FormattingEnabled = true;
this.tbProcess.Location = new System.Drawing.Point(344, 10);
this.tbProcess.Name = "tbProcess";
this.tbProcess.Size = new System.Drawing.Size(158, 20);
this.tbProcess.TabIndex = 7;
this.tbProcess.SelectedIndexChanged += new System.EventHandler(this.tbProcess_SelectedIndexChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(309, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 12);
this.label1.TabIndex = 6;
this.label1.Text = "공정";
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(13, 15);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(45, 12);
this.linkLabel1.TabIndex = 0;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "조회 년";
//
// btRefresh
//
this.btRefresh.Dock = System.Windows.Forms.DockStyle.Right;
this.btRefresh.Location = new System.Drawing.Point(1268, 5);
this.btRefresh.Name = "btRefresh";
this.btRefresh.Size = new System.Drawing.Size(75, 32);
this.btRefresh.TabIndex = 2;
this.btRefresh.Text = "새로고침";
this.btRefresh.UseVisualStyleBackColor = true;
this.btRefresh.Click += new System.EventHandler(this.btRefresh_Click);
//
// tbSd
//
this.tbSd.Location = new System.Drawing.Point(66, 10);
this.tbSd.Name = "tbSd";
this.tbSd.Size = new System.Drawing.Size(115, 21);
this.tbSd.TabIndex = 1;
this.tbSd.Text = "2020";
this.tbSd.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// tbEd
//
this.tbEd.Location = new System.Drawing.Point(187, 10);
this.tbEd.Name = "tbEd";
this.tbEd.Size = new System.Drawing.Size(115, 21);
this.tbEd.TabIndex = 9;
this.tbEd.Text = "2020";
this.tbEd.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// rJobReportOT
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1348, 699);
this.Controls.Add(this.dataGridView1);
this.Controls.Add(this.panel1);
this.Name = "rJobReportOT";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "휴일/연장근무 집계표";
this.Load += new System.EventHandler(this.rJobReport_Load);
((System.ComponentModel.ISupportInitialize)(this.bs)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dsReport)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
}
@@ -182,9 +193,10 @@
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.Button btRefresh;
private System.Windows.Forms.TextBox tbMon;
private System.Windows.Forms.TextBox tbSd;
private System.Windows.Forms.ComboBox tbProcess;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
}
private System.Windows.Forms.TextBox tbEd;
}
}

View File

@@ -9,140 +9,215 @@ using System.Windows.Forms;
namespace FPJ0000.JobReport_
{
public partial class rJobReportOT : Form
{
public rJobReportOT()
{
InitializeComponent();
//this.WindowState = FormWindowState.Maximized;
}
public partial class rJobReportOT : Form
{
public rJobReportOT()
{
InitializeComponent();
//this.WindowState = FormWindowState.Maximized;
}
private void rJobReport_Load(object sender, EventArgs e)
{
this.tbProcess.Items.Clear();
tbProcess.Items.Add("전체");
var taProcess = new dsReportTableAdapters.ProcessListTableAdapter();
var dtProcessList = taProcess.GetData(FCOMMON.info.Login.gcode);
foreach (dsReport.ProcessListRow dr in dtProcessList.Rows)
tbProcess.Items.Add(dr.processs);
private void rJobReport_Load(object sender, EventArgs e)
{
this.tbProcess.Items.Clear();
tbProcess.Items.Add("전체");
var taProcess = new dsReportTableAdapters.ProcessListTableAdapter();
var dtProcessList = taProcess.GetData(FCOMMON.info.Login.gcode);
foreach (dsReport.ProcessListRow dr in dtProcessList.Rows)
tbProcess.Items.Add(dr.processs);
//this.tbProcess.Text = FCOMMON.info.Login.process;
if (tbProcess.SelectedIndex < 0) tbProcess.SelectedIndex = 0;
//this.tbProcess.Text = FCOMMON.info.Login.process;
if (tbProcess.SelectedIndex < 0) tbProcess.SelectedIndex = 0;
this.tbMon.Text = DateTime.Now.Year.ToString();
this.Show();
Application.DoEvents();
this.tbSd.Text = DateTime.Now.Year.ToString() + "-01";
this.tbEd.Text = DateTime.Now.Year.ToString() + "-12";
this.Show();
Application.DoEvents();
refrehData();
}
refrehData();
}
void refrehData()
{
////휴일데이터가 들어가 있음.
//var taH = new dsReportTableAdapters.HolidayLIstTableAdapter();
//taH.Fill(this.dsReport.HolidayLIst, tbMon.Text + "%");
void refrehData()
{
////휴일데이터가 들어가 있음.
//var taH = new dsReportTableAdapters.HolidayLIstTableAdapter();
//taH.Fill(this.dsReport.HolidayLIst, tbMon.Text + "%");
string prcname = tbProcess.SelectedIndex < 1 ? "%" : tbProcess.Text.Trim();
this.ta.FillByOt2(this.dsReport.jobReport, tbMon.Text, FCOMMON.info.Login.gcode, prcname);
string prcname = tbProcess.SelectedIndex < 1 ? "%" : tbProcess.Text.Trim();
this.ta.FillByOt2(this.dsReport.jobReport, FCOMMON.info.Login.gcode, prcname, tbSd.Text, tbEd.Text);
//그리드뷰 생성
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.Rows.Clear();
this.dataGridView1.Columns.Clear();
this.dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
this.dataGridView1.ColumnHeadersHeight = 35;
this.dataGridView1.Columns.Add("공정", "공정");
this.dataGridView1.Columns.Add("이름", "이름");
//그리드뷰 생성
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.Rows.Clear();
this.dataGridView1.Columns.Clear();
this.dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
this.dataGridView1.ColumnHeadersHeight = 35;
this.dataGridView1.Columns.Add("공정", "공정");
this.dataGridView1.Columns.Add("이름", "이름");
this.dataGridView1.Columns.Add("사번", "사번");
//이름/년도데이터추가
var ymlist = dsReport.jobReport.OrderBy(t => t.yymm).GroupBy(t => t.yymm);
foreach (var ym in ymlist)
{
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) + "\r\n(" + basehr.ToString() + ")");
}
//이름으로 정렬해서 데이터를 가져온다
var namelist = this.dsReport.jobReport.OrderBy(t => t.UserProcess + t.uname).GroupBy(t => t.uname);
foreach (var uname in namelist)
{
var drName = uname.FirstOrDefault();
//이름/년도데이터추가
var ymlist = dsReport.jobReport.OrderBy(t => t.yymm).GroupBy(t => t.yymm);
foreach (var ym in ymlist)
{
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() + ")");
this.dataGridView1.Columns.Add(drYm.yymm, $"({basehr})\n연장");
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 2].Tag = basehr;
this.dataGridView1.Columns[this.dataGridView1.Columns.Count - 1].Tag = basehr;
}
this.dataGridView1.Columns.Add("subtotal", "합계\n휴일");
this.dataGridView1.Columns.Add("subtotal", "합계\n연장");
List<string> rowdata = new List<string>();
rowdata.Add(drName.UserProcess);
rowdata.Add(drName.uname + "(" + drName.uid + ")");
//이름으로 정렬해서 데이터를 가져온다
var namelist = this.dsReport.jobReport.OrderBy(t => t.UserProcess + t.uname).GroupBy(t => t.uname);
foreach (var uname in namelist)
{
var drName = uname.FirstOrDefault();
List<Boolean> high = new List<bool>();
List<Boolean> low = new List<bool>();
for (int i = 2; i < this.dataGridView1.ColumnCount; i++)
{
var coltitle = dataGridView1.Columns[i].HeaderText;
var basehr = int.Parse(coltitle.Split('\n')[1].Replace("(", "").Replace(")", ""));
List<string> rowdata = new List<string>();
rowdata.Add(drName.UserProcess);
rowdata.Add(drName.uname);
rowdata.Add(drName.uid);
var userDatas = dsReport.jobReport.Where(t => t.uid == drName.uid && t.yymm == dataGridView1.Columns[i].Name);
if (userDatas == null || userDatas.Count() == 0)
{
//이달에는 데이터가없다
rowdata.Add("--");
high.Add(false);
low.Add(false);
}
else
{
////모든데이터를 확인해서 휴일이랑 데이터를 분리해야한다.
//var sumhr = 0f;
//var sumot = 0f;
//var sumholy = 0f;
//foreach(dsReport.jobReportRow item in userDatas)
//{
// dsReport.HolidayLIst.Where(t => t.pdate == item.yymm);
//}
if (drName.uid.Equals("221597"))
{
var sumhr = userDatas.Sum(t => t.hrs);
var sumot = userDatas.Sum(t => t.ot2);
var sumhl = userDatas.Sum(t => t.holyot2);
}
rowdata.Add($"휴일({sumhl})\r\n연장({sumot})");
double User_sumhl = 0;
double User_sumot = 0;
if (sumhr > basehr) high.Add(true);
else high.Add(false);
List<Boolean> high = new List<bool>();
List<Boolean> low = new List<bool>();
for (int i = 3; i < this.dataGridView1.ColumnCount; i += 2)
{
var col = dataGridView1.Columns[i];
var coltitle = col.HeaderText;
if (col.Tag == null) continue;
var basehr = int.Parse(col.Tag.ToString());
if (sumhr < basehr) low.Add(true);
else low.Add(false);
}
}
var userDatas = dsReport.jobReport.Where(t => t.uid == drName.uid && t.yymm == col.Name);
if (userDatas == null || userDatas.Count() == 0)
{
//이달에는 데이터가없다
rowdata.Add(null); //휴일
rowdata.Add(null); //연장
high.Add(false);
low.Add(false);
}
else
{
////모든데이터를 확인해서 휴일이랑 데이터를 분리해야한다.
//var sumhr = 0f;
//var sumot = 0f;
//var sumholy = 0f;
//foreach(dsReport.jobReportRow item in userDatas)
//{
// dsReport.HolidayLIst.Where(t => t.pdate == item.yymm);
//}
dataGridView1.Rows.Add(rowdata.ToArray());
var sumhr = userDatas.Sum(t => t.hrs);
var sumot = userDatas.Sum(t => t.ot2);
var sumhl = userDatas.Sum(t => t.holyot2);
//이번에 추가한 줄의 셀 컬러를 지정한다
var currentrow = dataGridView1.Rows.Count - 1;
for (int i = 2; i < this.dataGridView1.ColumnCount; i++)
{
if (high[i - 2]) dataGridView1.Rows[currentrow].Cells[i].Style.ForeColor = Color.Red;
else if (low[i - 2]) dataGridView1.Rows[currentrow].Cells[i].Style.ForeColor = Color.Blue;
else dataGridView1.Rows[currentrow].Cells[i].Style.ForeColor = Color.Black;
}
}
this.dataGridView1.AutoResizeColumns();
User_sumhl += sumhl;
User_sumot += sumot;
}
if (sumhl == 0.0) rowdata.Add(null);
else rowdata.Add($"{sumhl}");
private void btRefresh_Click(object sender, EventArgs e)
{
refrehData();
}
if (sumot == 0.0) rowdata.Add(null);
else rowdata.Add($"{sumot}");
private void tbProcess_SelectedIndexChanged(object sender, EventArgs e)
{
if (tbProcess.SelectedIndex >= 0) refrehData();
}
if (sumhr > basehr) high.Add(true);
else high.Add(false);
private void button1_Click(object sender, EventArgs e)
{
dataGridView1.ExportData(string.Empty);
}
}
if (sumhr < basehr) low.Add(true);
else low.Add(false);
}
}
rowdata.Add($"{User_sumhl}"); //합게
rowdata.Add($"{User_sumot}"); //합게
dataGridView1.Rows.Add(rowdata.ToArray());
//이번에 추가한 줄의 셀 컬러를 지정한다
var currentrow = dataGridView1.Rows.Count - 1;
for (int i = 0; i < this.dataGridView1.ColumnCount; i++)
{
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;
continue;
}
else
{
if (col.HeaderText.Contains("연장"))
dataGridView1.Rows[currentrow].Cells[i].Style.BackColor = Color.Linen;// 155,82,93);
else
dataGridView1.Rows[currentrow].Cells[i].Style.BackColor = Color.White;
}
var idx = i - 2;
if (idx < high.Count)
{
if (high[idx]) dataGridView1.Rows[currentrow].Cells[i].Style.ForeColor = Color.Red;
else if (low[i - 2]) dataGridView1.Rows[currentrow].Cells[i].Style.ForeColor = Color.Blue;
else dataGridView1.Rows[currentrow].Cells[i].Style.ForeColor = Color.Black;
}
else dataGridView1.Rows[currentrow].Cells[i].Style.ForeColor = Color.Black;
}
}
//총계추가
List<object> rowdata2 = new List<object>();
rowdata2.Add("합계");
rowdata2.Add(dataGridView1.Rows.Count);
rowdata2.Add(null);
for (int i = 0; i < this.dataGridView1.ColumnCount; i++)
{
var col = this.dataGridView1.Columns[i];
if (col.Tag == null && col.HeaderText.StartsWith("합계") == false) continue;
var sum = 0.0;
for (int r = 0; r < this.dataGridView1.RowCount; r++)
{
var cell = dataGridView1.Rows[r].Cells[i];
if (cell.Value != null) sum += double.Parse(cell.Value.ToString());
}
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;
this.dataGridView1.AutoResizeColumns();
}
private void btRefresh_Click(object sender, EventArgs e)
{
refrehData();
}
private void tbProcess_SelectedIndexChanged(object sender, EventArgs e)
{
if (tbProcess.SelectedIndex >= 0) refrehData();
}
private void button1_Click(object sender, EventArgs e)
{
dataGridView1.ExportData(string.Empty);
}
}
}