otPMS추가(테스트버젼)

This commit is contained in:
chi
2025-07-02 23:41:25 +09:00
parent cc4430a553
commit 4f4625b56b
42 changed files with 6901 additions and 3122 deletions

View File

@@ -28,160 +28,186 @@
/// </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.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);
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.tbEd = new System.Windows.Forms.TextBox();
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.radType = new System.Windows.Forms.RadioButton();
this.radTypePMS = new System.Windows.Forms.RadioButton();
((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.Namespace = "http://tempuri.org/dsReport.xsd";
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.radTypePMS);
this.panel1.Controls.Add(this.radType);
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;
//
// tbEd
//
this.tbEd.Location = new System.Drawing.Point(187, 11);
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;
//
// 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, 11);
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, 11);
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;
//
// radType
//
this.radType.AutoSize = true;
this.radType.Checked = true;
this.radType.Location = new System.Drawing.Point(528, 13);
this.radType.Name = "radType";
this.radType.Size = new System.Drawing.Size(47, 16);
this.radType.TabIndex = 10;
this.radType.TabStop = true;
this.radType.Text = "대체";
this.radType.UseVisualStyleBackColor = true;
//
// radTypePMS
//
this.radTypePMS.AutoSize = true;
this.radTypePMS.Location = new System.Drawing.Point(584, 13);
this.radTypePMS.Name = "radTypePMS";
this.radTypePMS.Size = new System.Drawing.Size(50, 16);
this.radTypePMS.TabIndex = 11;
this.radTypePMS.Text = "PMS";
this.radTypePMS.UseVisualStyleBackColor = true;
//
// 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.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);
}
@@ -198,5 +224,7 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox tbEd;
}
private System.Windows.Forms.RadioButton radTypePMS;
private System.Windows.Forms.RadioButton radType;
}
}

View File

@@ -10,216 +10,230 @@ using System.Windows.Forms;
namespace FPJ0000.JobReport_
{
public partial class rJobReportOT : fBase
{
public rJobReportOT()
{
InitializeComponent();
//this.WindowState = FormWindowState.Maximized;
}
public partial class rJobReportOT : fBase
{
public rJobReportOT()
{
InitializeComponent();
//this.WindowState = FormWindowState.Maximized;
}
private void rJobReport_Load(object sender, EventArgs e)
private void rJobReport_Load(object sender, EventArgs e)
{
EnsureVisibleAndUsableSize();
this.tbProcess.Items.Clear();
tbProcess.Items.Add("전체");
//var taProcess = new dsReportTableAdapters.ProcessListTableAdapter();
var dtProcessList = FCOMMON.DBM.GroupUserProcessList();//taProcess.GetData(FCOMMON.info.Login.gcode);
tbProcess.Items.Add("전체");
//var taProcess = new dsReportTableAdapters.ProcessListTableAdapter();
var dtProcessList = FCOMMON.DBM.GroupUserProcessList();//taProcess.GetData(FCOMMON.info.Login.gcode);
foreach (var dr in dtProcessList)
tbProcess.Items.Add(dr);
tbProcess.Items.Add(dr);
//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.tbSd.Text = DateTime.Now.Year.ToString() + "-01";
this.tbEd.Text = DateTime.Now.Year.ToString() + "-12";
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, FCOMMON.info.Login.gcode, prcname, tbSd.Text, tbEd.Text);
string prcname = tbProcess.SelectedIndex < 1 ? "%" : tbProcess.Text.Trim();
if (radType.Checked)
this.ta.FillByOt2(this.dsReport.jobReport, FCOMMON.info.Login.gcode, prcname, tbSd.Text, tbEd.Text);
else
this.ta.FillByOtPMS(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.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 otTitle = radType.Checked ? "연장" : "PMS";
//이름/년도데이터추가
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{otTitle}");
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";
}
this.dataGridView1.Columns.Add("subtotal", "합계\n휴일");
this.dataGridView1.Columns.Add($"subtotal", $"합계\n{otTitle}");
//이름으로 정렬해서 데이터를 가져온다
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<string> rowdata = new List<string>();
rowdata.Add(drName.UserProcess);
rowdata.Add(drName.uname);
rowdata.Add(drName.uid);
//이름/년도데이터추가
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연장");
//이름으로 정렬해서 데이터를 가져온다
var namelist = this.dsReport.jobReport.OrderBy(t => t.UserProcess + t.uname).GroupBy(t => t.uname);
foreach (var uname in namelist)
{
var drName = uname.FirstOrDefault();
double User_sumhl = 0;
double User_sumot = 0;
List<string> rowdata = new List<string>();
rowdata.Add(drName.UserProcess);
rowdata.Add(drName.uname);
rowdata.Add(drName.uid);
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 (drName.uid.Equals("221597"))
{
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);
//}
}
var sumhr = userDatas.Sum(t => t.hrs);
double sumot = 0.0;
double sumhl = 0.0;
if (radType.Checked)
{
sumot = userDatas.Sum(t => t.ot2);
sumhl = userDatas.Sum(t => t.holyot2);
}
else
{
sumot = userDatas.Sum(t => t.otPMS);
sumhl = userDatas.Sum(t => t.holyotPMS);
}
double User_sumhl = 0;
double User_sumot = 0;
User_sumhl += sumhl;
User_sumot += sumot;
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 (sumhl == 0.0) rowdata.Add(null);
else rowdata.Add($"{Math.Round(sumhl,1)}");
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);
//}
if (sumot == 0.0) rowdata.Add(null);
else rowdata.Add($"{Math.Round(sumot,1)}");
var sumhr = userDatas.Sum(t => t.hrs);
var sumot = userDatas.Sum(t => t.ot2);
var sumhl = userDatas.Sum(t => t.holyot2);
if (sumhr > basehr) high.Add(true);
else high.Add(false);
User_sumhl += sumhl;
User_sumot += sumot;
if (sumhl == 0.0) rowdata.Add(null);
else rowdata.Add($"{sumhl}");
if (sumot == 0.0) rowdata.Add(null);
else rowdata.Add($"{sumot}");
if (sumhr > basehr) high.Add(true);
else high.Add(false);
if (sumhr < basehr) low.Add(true);
else low.Add(false);
}
}
if (sumhr < basehr) low.Add(true);
else low.Add(false);
}
}
rowdata.Add($"{User_sumhl}"); //합게
rowdata.Add($"{User_sumot}"); //합게
dataGridView1.Rows.Add(rowdata.ToArray());
rowdata.Add($"{Math.Round(User_sumhl,1)}"); //합게
rowdata.Add($"{Math.Round(User_sumot,1)}"); //합게
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 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(otTitle))
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;
}
}
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;
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;
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();
this.dataGridView1.AutoResizeColumns();
}
}
private void btRefresh_Click(object sender, EventArgs e)
{
refrehData();
}
private void btRefresh_Click(object sender, EventArgs e)
{
refrehData();
}
private void tbProcess_SelectedIndexChanged(object sender, EventArgs e)
{
if (tbProcess.SelectedIndex >= 0) 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);
}
}
private void button1_Click(object sender, EventArgs e)
{
dataGridView1.ExportData(string.Empty);
}
}
}

View File

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
<!--
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.
-->