From 9a99d064b9b9402fa61db741f82e8e51ae712206 Mon Sep 17 00:00:00 2001 From: Crudelis Date: Mon, 11 Sep 2023 22:58:59 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=9D=B5=EA=B8=88=EB=8C=80=EC=9E=A5,?= =?UTF-8?q?=20=EC=A6=9D=EB=AA=85=EC=84=9C=EB=B0=9C=EA=B8=89=20=EB=8C=80?= =?UTF-8?q?=EC=9E=A5=20=EA=B8=B0=EB=8A=A5=20=EC=99=84=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 두개의 대장 기능 완성 - 재발급 기능은 발급 기능과 연계 해서 완성 --- .../ListCertificate.Designer.cs | 148 +++++++++++++++++- .../CustomUserControl/ListCertificate.cs | 63 +++++++- .../CustomUserControl/ListCertificate.resx | 120 ++++++++++++++ .../ListProceeds.Designer.cs | 133 +++++++++++++++- .../CustomUserControl/ListProceeds.cs | 79 ++++++++++ .../CustomUserControl/ListProceeds.resx | 120 ++++++++++++++ .../CustomUserControl/UserList.Designer.cs | 19 +-- .../CustomUserControl/UserList.cs | 1 + .../CustomUserControl/WaitingList.cs | 12 +- .../DataModel.cs | 43 +++-- .../Database.cs | 61 +++++++- ...SUCO_Cargo_Garage_Operation_Program.csproj | 6 + .../Master.Designer.cs | 28 +++- 13 files changed, 798 insertions(+), 35 deletions(-) create mode 100644 HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListCertificate.resx create mode 100644 HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListProceeds.resx diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListCertificate.Designer.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListCertificate.Designer.cs index 1a71e59..be303da 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListCertificate.Designer.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListCertificate.Designer.cs @@ -28,10 +28,156 @@ /// private void InitializeComponent() { - components = new System.ComponentModel.Container(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + this.dataGridView_List = new System.Windows.Forms.DataGridView(); + this.metroButton_ReCertificate = new MetroFramework.Controls.MetroButton(); + this.metroButton_ExportExcel = new MetroFramework.Controls.MetroButton(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.metroDateTime_EndDate = new MetroFramework.Controls.MetroDateTime(); + this.metroDateTime_StartDate = new MetroFramework.Controls.MetroDateTime(); + this.metroButton_Search = new MetroFramework.Controls.MetroButton(); + this.metroLabel2 = new MetroFramework.Controls.MetroLabel(); + this.metroLabel1 = new MetroFramework.Controls.MetroLabel(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_List)).BeginInit(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // dataGridView_List + // + this.dataGridView_List.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView_List.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; + this.dataGridView_List.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle2.Font = new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_List.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + this.dataGridView_List.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView_List.Location = new System.Drawing.Point(20, 120); + this.dataGridView_List.Name = "dataGridView_List"; + this.dataGridView_List.ReadOnly = true; + this.dataGridView_List.RowTemplate.Height = 23; + this.dataGridView_List.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridView_List.Size = new System.Drawing.Size(600, 330); + this.dataGridView_List.TabIndex = 11; + // + // metroButton_ReCertificate + // + this.metroButton_ReCertificate.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.metroButton_ReCertificate.FontSize = MetroFramework.MetroButtonSize.Tall; + this.metroButton_ReCertificate.Location = new System.Drawing.Point(626, 138); + this.metroButton_ReCertificate.Name = "metroButton_ReCertificate"; + this.metroButton_ReCertificate.Size = new System.Drawing.Size(121, 40); + this.metroButton_ReCertificate.TabIndex = 12; + this.metroButton_ReCertificate.Text = "재 발급"; + this.metroButton_ReCertificate.UseSelectable = true; + this.metroButton_ReCertificate.Click += new System.EventHandler(this.metroButton_ReCertificate_Click); + // + // metroButton_ExportExcel + // + this.metroButton_ExportExcel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.metroButton_ExportExcel.BackgroundImage = global::HSUCO_Cargo_Garage_Operation_Program.Properties.Resources.file_type_excel_icon_130611; + this.metroButton_ExportExcel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.metroButton_ExportExcel.FontSize = MetroFramework.MetroButtonSize.Tall; + this.metroButton_ExportExcel.Location = new System.Drawing.Point(626, 184); + this.metroButton_ExportExcel.Name = "metroButton_ExportExcel"; + this.metroButton_ExportExcel.Size = new System.Drawing.Size(121, 115); + this.metroButton_ExportExcel.TabIndex = 13; + this.metroButton_ExportExcel.UseSelectable = true; + this.metroButton_ExportExcel.Click += new System.EventHandler(this.metroButton_ExportExcel_Click); + // + // groupBox1 + // + this.groupBox1.BackColor = System.Drawing.Color.Transparent; + this.groupBox1.Controls.Add(this.metroDateTime_EndDate); + this.groupBox1.Controls.Add(this.metroDateTime_StartDate); + this.groupBox1.Controls.Add(this.metroButton_Search); + this.groupBox1.Controls.Add(this.metroLabel2); + this.groupBox1.Controls.Add(this.metroLabel1); + this.groupBox1.Location = new System.Drawing.Point(20, 20); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(480, 90); + this.groupBox1.TabIndex = 14; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "검색"; + // + // metroDateTime_EndDate + // + this.metroDateTime_EndDate.Location = new System.Drawing.Point(110, 50); + this.metroDateTime_EndDate.MinimumSize = new System.Drawing.Size(0, 29); + this.metroDateTime_EndDate.Name = "metroDateTime_EndDate"; + this.metroDateTime_EndDate.Size = new System.Drawing.Size(200, 29); + this.metroDateTime_EndDate.TabIndex = 8; + // + // metroDateTime_StartDate + // + this.metroDateTime_StartDate.Location = new System.Drawing.Point(110, 15); + this.metroDateTime_StartDate.MinimumSize = new System.Drawing.Size(0, 29); + this.metroDateTime_StartDate.Name = "metroDateTime_StartDate"; + this.metroDateTime_StartDate.Size = new System.Drawing.Size(200, 29); + this.metroDateTime_StartDate.TabIndex = 7; + // + // metroButton_Search + // + this.metroButton_Search.FontSize = MetroFramework.MetroButtonSize.Tall; + this.metroButton_Search.Location = new System.Drawing.Point(316, 15); + this.metroButton_Search.Name = "metroButton_Search"; + this.metroButton_Search.Size = new System.Drawing.Size(131, 64); + this.metroButton_Search.TabIndex = 6; + this.metroButton_Search.Text = "조회"; + this.metroButton_Search.UseSelectable = true; + this.metroButton_Search.Click += new System.EventHandler(this.metroButton_Search_Click); + // + // metroLabel2 + // + this.metroLabel2.AutoSize = true; + this.metroLabel2.Location = new System.Drawing.Point(20, 50); + this.metroLabel2.Name = "metroLabel2"; + this.metroLabel2.Size = new System.Drawing.Size(83, 19); + this.metroLabel2.TabIndex = 1; + this.metroLabel2.Text = "검색 종료일"; + // + // metroLabel1 + // + this.metroLabel1.AutoSize = true; + this.metroLabel1.Location = new System.Drawing.Point(20, 20); + this.metroLabel1.Name = "metroLabel1"; + this.metroLabel1.Size = new System.Drawing.Size(83, 19); + this.metroLabel1.TabIndex = 0; + this.metroLabel1.Text = "검색 시작일"; + // + // ListCertificate + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.metroButton_ExportExcel); + this.Controls.Add(this.metroButton_ReCertificate); + this.Controls.Add(this.dataGridView_List); + this.Name = "ListCertificate"; + this.Size = new System.Drawing.Size(750, 470); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_List)).EndInit(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + } #endregion + private System.Windows.Forms.DataGridView dataGridView_List; + private MetroFramework.Controls.MetroButton metroButton_ReCertificate; + private MetroFramework.Controls.MetroButton metroButton_ExportExcel; + private System.Windows.Forms.GroupBox groupBox1; + private MetroFramework.Controls.MetroDateTime metroDateTime_EndDate; + private MetroFramework.Controls.MetroDateTime metroDateTime_StartDate; + private MetroFramework.Controls.MetroButton metroButton_Search; + private MetroFramework.Controls.MetroLabel metroLabel2; + private MetroFramework.Controls.MetroLabel metroLabel1; } } diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListCertificate.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListCertificate.cs index fe8fbd2..8395167 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListCertificate.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListCertificate.cs @@ -16,5 +16,66 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl { InitializeComponent(); } + + private void metroButton_ExportExcel_Click(object sender, EventArgs e) + { + var excelWrapper = new ExcelWrapper(); + + var saveFileDialog = new SaveFileDialog(); + saveFileDialog.Filter = "XLSX files (*.xlsx)|*.xlsx"; + + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + var result = excelWrapper.WriteDataTableToExcel((DataTable)dataGridView_List.DataSource, "Certificate", saveFileDialog.FileName, "정기권 발급 대장", Environment.MachineName, DateTime.Now); + } + } + + private void metroButton_ReCertificate_Click(object sender, EventArgs e) + { + if(dataGridView_List.SelectedRows.Count == 0) return; + var x = dataGridView_List.SelectedRows[0]; + //if(dataGridView_List.select) + // 재발급 인쇠 + // 금액 산정 + } + + private void metroButton_Search_Click(object sender, EventArgs e) + { + List certificateDatas = Database.GetLedgerCertificate(metroDateTime_StartDate.Value, metroDateTime_EndDate.Value); + + var dataTable = new DataTable(); + + dataTable.Columns.Add("차량번호(화물)"); + dataTable.Columns.Add("차량번호(승용)"); + dataTable.Columns.Add("이름"); + dataTable.Columns.Add("발급번호"); + dataTable.Columns.Add("발급일자"); + + for (int i = 0; i < certificateDatas.Count; i++) + { + dataTable.Rows + .Add( + + certificateDatas[i].RegistrationNumberTruck, + certificateDatas[i].RegistrationNumberPassenger, + certificateDatas[i].Name, + certificateDatas[i].IssueNumber, + certificateDatas[i].Date + + ); + } + + dataGridView_List.DataSource = dataTable; + dataGridView_List.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView_List.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; + dataGridView_List.Columns[0].MinimumWidth = 100; + dataGridView_List.Columns[0].FillWeight = 100; + + + dataGridView_List.Columns[1].MinimumWidth = 100; + dataGridView_List.Columns[1].FillWeight = 100; + dataGridView_List.Columns[2].MinimumWidth = 60; + dataGridView_List.Columns[2].FillWeight = 60; + } + } } -} diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListCertificate.resx b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListCertificate.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListCertificate.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListProceeds.Designer.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListProceeds.Designer.cs index 484635a..ccb74eb 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListProceeds.Designer.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListProceeds.Designer.cs @@ -28,10 +28,141 @@ /// private void InitializeComponent() { - components = new System.ComponentModel.Container(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.dataGridView_List = new System.Windows.Forms.DataGridView(); + this.metroButton_ExportExcel = new MetroFramework.Controls.MetroButton(); + this.metroLabel1 = new MetroFramework.Controls.MetroLabel(); + this.metroLabel2 = new MetroFramework.Controls.MetroLabel(); + this.metroButton_Search = new MetroFramework.Controls.MetroButton(); + this.metroDateTime_StartDate = new MetroFramework.Controls.MetroDateTime(); + this.metroDateTime_EndDate = new MetroFramework.Controls.MetroDateTime(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_List)).BeginInit(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.BackColor = System.Drawing.Color.Transparent; + this.groupBox1.Controls.Add(this.metroDateTime_EndDate); + this.groupBox1.Controls.Add(this.metroDateTime_StartDate); + this.groupBox1.Controls.Add(this.metroButton_Search); + this.groupBox1.Controls.Add(this.metroLabel2); + this.groupBox1.Controls.Add(this.metroLabel1); + this.groupBox1.Location = new System.Drawing.Point(20, 20); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(480, 90); + this.groupBox1.TabIndex = 9; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "검색"; + // + // dataGridView_List + // + this.dataGridView_List.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView_List.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; + this.dataGridView_List.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle2.Font = new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_List.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + this.dataGridView_List.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView_List.Location = new System.Drawing.Point(20, 120); + this.dataGridView_List.Name = "dataGridView_List"; + this.dataGridView_List.ReadOnly = true; + this.dataGridView_List.RowTemplate.Height = 23; + this.dataGridView_List.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridView_List.Size = new System.Drawing.Size(600, 330); + this.dataGridView_List.TabIndex = 11; + // + // metroButton_ExportExcel + // + this.metroButton_ExportExcel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.metroButton_ExportExcel.BackgroundImage = global::HSUCO_Cargo_Garage_Operation_Program.Properties.Resources.file_type_excel_icon_130611; + this.metroButton_ExportExcel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.metroButton_ExportExcel.FontSize = MetroFramework.MetroButtonSize.Tall; + this.metroButton_ExportExcel.Location = new System.Drawing.Point(626, 120); + this.metroButton_ExportExcel.Name = "metroButton_ExportExcel"; + this.metroButton_ExportExcel.Size = new System.Drawing.Size(121, 115); + this.metroButton_ExportExcel.TabIndex = 14; + this.metroButton_ExportExcel.UseSelectable = true; + this.metroButton_ExportExcel.Click += new System.EventHandler(this.metroButton_ExportExcel_Click); + // + // metroLabel1 + // + this.metroLabel1.AutoSize = true; + this.metroLabel1.Location = new System.Drawing.Point(20, 20); + this.metroLabel1.Name = "metroLabel1"; + this.metroLabel1.Size = new System.Drawing.Size(83, 19); + this.metroLabel1.TabIndex = 0; + this.metroLabel1.Text = "검색 시작일"; + // + // metroLabel2 + // + this.metroLabel2.AutoSize = true; + this.metroLabel2.Location = new System.Drawing.Point(20, 50); + this.metroLabel2.Name = "metroLabel2"; + this.metroLabel2.Size = new System.Drawing.Size(83, 19); + this.metroLabel2.TabIndex = 1; + this.metroLabel2.Text = "검색 종료일"; + // + // metroButton_Search + // + this.metroButton_Search.FontSize = MetroFramework.MetroButtonSize.Tall; + this.metroButton_Search.Location = new System.Drawing.Point(316, 15); + this.metroButton_Search.Name = "metroButton_Search"; + this.metroButton_Search.Size = new System.Drawing.Size(131, 64); + this.metroButton_Search.TabIndex = 6; + this.metroButton_Search.Text = "조회"; + this.metroButton_Search.UseSelectable = true; + this.metroButton_Search.Click += new System.EventHandler(this.metroButton_Search_Click); + // + // metroDateTime_StartDate + // + this.metroDateTime_StartDate.Location = new System.Drawing.Point(110, 15); + this.metroDateTime_StartDate.MinimumSize = new System.Drawing.Size(0, 29); + this.metroDateTime_StartDate.Name = "metroDateTime_StartDate"; + this.metroDateTime_StartDate.Size = new System.Drawing.Size(200, 29); + this.metroDateTime_StartDate.TabIndex = 7; + // + // metroDateTime_EndDate + // + this.metroDateTime_EndDate.Location = new System.Drawing.Point(110, 50); + this.metroDateTime_EndDate.MinimumSize = new System.Drawing.Size(0, 29); + this.metroDateTime_EndDate.Name = "metroDateTime_EndDate"; + this.metroDateTime_EndDate.Size = new System.Drawing.Size(200, 29); + this.metroDateTime_EndDate.TabIndex = 8; + // + // ListProceeds + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.Controls.Add(this.metroButton_ExportExcel); + this.Controls.Add(this.dataGridView_List); + this.Controls.Add(this.groupBox1); + this.Name = "ListProceeds"; + this.Size = new System.Drawing.Size(750, 470); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_List)).EndInit(); + this.ResumeLayout(false); + } #endregion + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.DataGridView dataGridView_List; + private MetroFramework.Controls.MetroButton metroButton_ExportExcel; + private MetroFramework.Controls.MetroLabel metroLabel2; + private MetroFramework.Controls.MetroLabel metroLabel1; + private MetroFramework.Controls.MetroDateTime metroDateTime_EndDate; + private MetroFramework.Controls.MetroDateTime metroDateTime_StartDate; + private MetroFramework.Controls.MetroButton metroButton_Search; } } diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListProceeds.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListProceeds.cs index 63ef6dd..83db087 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListProceeds.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListProceeds.cs @@ -6,6 +6,7 @@ using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Documents; using System.Windows.Forms; namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl @@ -16,5 +17,83 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl { InitializeComponent(); } + + private void metroButton_ExportExcel_Click(object sender, EventArgs e) + { + var excelWrapper = new ExcelWrapper(); + + var saveFileDialog = new SaveFileDialog(); + saveFileDialog.Filter = "XLSX files (*.xlsx)|*.xlsx"; + + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + var result = excelWrapper.WriteDataTableToExcel((DataTable)dataGridView_List.DataSource, "Proceeds", saveFileDialog.FileName, "수익금 대장", Environment.MachineName, DateTime.Now); + } + } + + private void metroButton_Search_Click(object sender, EventArgs e) + { + List proceedsDatas = Database.GetLedgerProceeds(metroDateTime_StartDate.Value, metroDateTime_EndDate.Value); + + var dataTable = new DataTable(); + + dataTable.Columns.Add("차량번호(화물)"); + dataTable.Columns.Add("차량번호(승용)"); + dataTable.Columns.Add("이름"); + dataTable.Columns.Add("수익금 종류"); + dataTable.Columns.Add("금액"); + dataTable.Columns.Add("일자"); + + for (int i = 0; i < proceedsDatas.Count; i++) + { + string typeString = string.Empty; + switch (proceedsDatas[i].Type) + { + case ProceedsType.Fees: + typeString = "이용요금"; + break; + case ProceedsType.ExtensionFees: + typeString = "연장이용요금"; + break; + case ProceedsType.Certificate: + typeString = "인증서 발급비용"; + break; + case ProceedsType.ReCertificate: + typeString = "인증서 재발급비용"; + break; + case ProceedsType.Refunds: + typeString = "환불"; + break; + default: + break; + } + + dataTable.Rows + .Add( + + proceedsDatas[i].RegistrationNumberTruck, + proceedsDatas[i].RegistrationNumberPassenger, + proceedsDatas[i].Name, + typeString, + String.Format("{0:n0}", proceedsDatas[i].Amount), + proceedsDatas[i].Date + + ); + } + + dataGridView_List.DataSource = dataTable; + dataGridView_List.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView_List.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; + dataGridView_List.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; + dataGridView_List.Columns[0].MinimumWidth = 100; + dataGridView_List.Columns[0].FillWeight = 100; + + + dataGridView_List.Columns[1].MinimumWidth = 100; + dataGridView_List.Columns[1].FillWeight = 100; + dataGridView_List.Columns[2].MinimumWidth = 60; + dataGridView_List.Columns[2].FillWeight = 60; + } + } } diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListProceeds.resx b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListProceeds.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ListProceeds.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.Designer.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.Designer.cs index 8152b4a..51c28e0 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.Designer.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.Designer.cs @@ -28,7 +28,7 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.metroRadioButton_EndUser = new MetroFramework.Controls.MetroRadioButton(); this.metroRadioButton_UseUser = new MetroFramework.Controls.MetroRadioButton(); @@ -265,16 +265,17 @@ | System.Windows.Forms.AnchorStyles.Right))); this.dataGridView_List.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; this.dataGridView_List.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle2.Font = new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_List.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle1.Font = new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_List.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; this.dataGridView_List.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView_List.Location = new System.Drawing.Point(20, 120); + this.dataGridView_List.MultiSelect = false; this.dataGridView_List.Name = "dataGridView_List"; this.dataGridView_List.ReadOnly = true; this.dataGridView_List.RowTemplate.Height = 23; diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs index 195c16e..1689d4d 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs @@ -125,6 +125,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl void metroButton_Extended_Click(object sender, EventArgs e) { + if (dataGridView_List.SelectedRows.Count == 0) return; var allCount = dataGridView_List.SelectedRows.Count; if (allCount == 0) return; diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/WaitingList.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/WaitingList.cs index 87e54bd..8dcd2eb 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/WaitingList.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/WaitingList.cs @@ -217,13 +217,11 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl var waitingCount = new WaitingCount(allCount, RegistrationNumberTruck.Count); - if (waitingCount.ShowDialog() == DialogResult.OK) - { - var list = RegistrationNumberTruck.GetRange(0, waitingCount.ResultCount); - TODO: //업데이트 필요함 - Database.AddUserList(list, waitingCount.StartDate, waitingCount.EndDate, waitingCount.TotalCost); - DataChange(); - } + if (waitingCount.ShowDialog() != DialogResult.OK) return; + var list = RegistrationNumberTruck.GetRange(0, waitingCount.ResultCount); + //TODO: 업데이트 필요함 + Database.AddUserList(list, waitingCount.StartDate, waitingCount.EndDate, waitingCount.TotalCost); + DataChange(); } private void metroButton_ExportExcel_Click(object sender, EventArgs e) diff --git a/HSUCO_Cargo_Garage_Operation_Program/DataModel.cs b/HSUCO_Cargo_Garage_Operation_Program/DataModel.cs index 4f5029c..6ba74ea 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/DataModel.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/DataModel.cs @@ -5,15 +5,15 @@ namespace HSUCO_Cargo_Garage_Operation_Program public struct Applicant { public bool ApplicantType { get; set; } - public string RegistrationNumberTruck{ get; set; } - public string RegistrationNumberPassenger{ get; set; } - public string Name{ get; set; } - public string Phone{ get; set; } - public string Address{ get; set; } - public DateTime DateOfApplication{ get; set; } - public bool Inspection{ get; set; } - + public string RegistrationNumberTruck { get; set; } + public string RegistrationNumberPassenger { get; set; } + public string Name { get; set; } + public string Phone { get; set; } + public string Address { get; set; } + public DateTime DateOfApplication { get; set; } + public bool Inspection { get; set; } } + public struct User { public string RegistrationNumberTruck { get; set; } @@ -34,9 +34,28 @@ namespace HSUCO_Cargo_Garage_Operation_Program public DateTime DateEnd { get; set; } } + public struct ProceedsData + { + public string RegistrationNumberTruck { get; set; } + public string RegistrationNumberPassenger { get; set; } + public string Name { get; set; } + public ProceedsType Type { get; set; } + public int Amount { get; set; } + public DateTime Date { get; set; } + } + + public struct CertificateData + { + public string RegistrationNumberTruck { get; set; } + public string RegistrationNumberPassenger { get; set; } + public string Name { get; set; } + public string IssueNumber { get; set; } + public int Amount { get; set; } + public DateTime Date { get; set; } + } public struct Settings { - public long UsageFee {get; set;} + public long UsageFee { get; set; } public long ExtendedFee { get; set; } public long CertificateFee { get; set; } public long ReCertificateFee { get; set; } @@ -46,16 +65,14 @@ namespace HSUCO_Cargo_Garage_Operation_Program // 연장금액 Extended Fee // 증명서발급 비용 Certificate Fee // 재발급 비용 ReCertificate Fee - } public enum ProceedsType { Fees, + ExtensionFees, Certificate, ReCertificate, Refunds - } - -} +} \ No newline at end of file diff --git a/HSUCO_Cargo_Garage_Operation_Program/Database.cs b/HSUCO_Cargo_Garage_Operation_Program/Database.cs index 28211c5..323eb8a 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/Database.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/Database.cs @@ -292,7 +292,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program } } - public static List GetApplicantList(List RegistrationNumberTruck) { var applicants = new List(); @@ -342,7 +341,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program insertCommand.ExecuteNonQuery(); } - var no = _sqLiteConnection.LastInsertRowId; query = $"INSERT INTO LedgerProceeds(No, Type, Amount, Date) VALUES({no},{(int)ProceedsType.Fees},{totalCost},'{DateTime.Now}')"; @@ -389,6 +387,62 @@ namespace HSUCO_Cargo_Garage_Operation_Program } } + public static List GetLedgerProceeds(DateTime startDateTime, DateTime endDateTime) + { + List proceedsDatas = new List(); + + string query = $"SELECT UserList.RegistrationNumberTruck, UserList.RegistrationNumberPassenger, UserList.Name, LedgerProceeds.Type, LedgerProceeds.Amount, LedgerProceeds.Date From LedgerProceeds INNER JOIN UserList ON LedgerProceeds.No = UserList.No Where LedgerProceeds.Date >='{startDateTime}' And LedgerProceeds.Date <='{endDateTime}'"; + + using (var command = _sqLiteConnection.CreateCommand()) + { + command.CommandText = query; + + using (var reader = command.ExecuteReader()) + { + while (reader.Read()) + { + ProceedsData proceedsData = new ProceedsData(); + proceedsData.RegistrationNumberTruck = reader["RegistrationNumberTruck"].ToString(); + proceedsData.RegistrationNumberPassenger = reader["RegistrationNumberPassenger"].ToString(); + proceedsData.Name = reader["Name"].ToString(); + proceedsData.Amount = int.Parse(reader["Amount"].ToString()); + proceedsData.Date = DateTime.Parse(reader["Date"].ToString()); + proceedsData.Type = (ProceedsType)int.Parse(reader["Type"].ToString()); + proceedsDatas.Add(proceedsData); + } + } + } + + return proceedsDatas; + } + + public static List GetLedgerCertificate(DateTime startDateTime, DateTime endDateTime) + { + List certificateDatas = new List(); + string query = $"SELECT UserList.RegistrationNumberTruck, UserList.RegistrationNumberPassenger, UserList.Name, LedgerCertificate.Date From LedgerCertificate INNER JOIN UserList ON LedgerCertificate.No = UserList.No Where LedgerCertificate.Date >='{startDateTime}' And LedgerCertificate.Date <='{endDateTime}'"; + + using (var command = _sqLiteConnection.CreateCommand()) + { + command.CommandText = query; + + using (var reader = command.ExecuteReader()) + { + while (reader.Read()) + { + CertificateData certificateData = new CertificateData(); + certificateData.RegistrationNumberTruck = reader["RegistrationNumberTruck"].ToString(); + certificateData.RegistrationNumberPassenger = reader["RegistrationNumberPassenger"].ToString(); + certificateData.Name = reader["Name"].ToString(); + certificateData.IssueNumber = reader["IssueNumber"].ToString(); + certificateData.Date = DateTime.Parse(reader["Date"].ToString()); + certificateDatas.Add(certificateData); + } + } + } + + return certificateDatas; + } + public static Settings LoadSettings() { var settings = new Settings(); @@ -413,15 +467,18 @@ namespace HSUCO_Cargo_Garage_Operation_Program long.TryParse(value, out longValue); settings.UsageFee = longValue; break; + case "ExtendedFee": long.TryParse(value, out longValue); settings.ExtendedFee = longValue; break; + case "CertificateFee": long.TryParse(value, out longValue); settings.CertificateFee = longValue; break; + case "ReCertificateFee": long.TryParse(value, out longValue); settings.ReCertificateFee = longValue; diff --git a/HSUCO_Cargo_Garage_Operation_Program/HSUCO_Cargo_Garage_Operation_Program.csproj b/HSUCO_Cargo_Garage_Operation_Program/HSUCO_Cargo_Garage_Operation_Program.csproj index 821a24e..d3a84d8 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/HSUCO_Cargo_Garage_Operation_Program.csproj +++ b/HSUCO_Cargo_Garage_Operation_Program/HSUCO_Cargo_Garage_Operation_Program.csproj @@ -180,6 +180,12 @@ ApplicantControl.cs + + ListCertificate.cs + + + ListProceeds.cs + SettingControl.cs diff --git a/HSUCO_Cargo_Garage_Operation_Program/Master.Designer.cs b/HSUCO_Cargo_Garage_Operation_Program/Master.Designer.cs index 4baec31..373525d 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/Master.Designer.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/Master.Designer.cs @@ -44,6 +44,8 @@ this.tabPage10 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.settings1 = new HSUCO_Cargo_Garage_Operation_Program.CustomUserControl.SettingControl(); + this.listProceeds = new HSUCO_Cargo_Garage_Operation_Program.CustomUserControl.ListProceeds(); + this.listCertificate1 = new HSUCO_Cargo_Garage_Operation_Program.CustomUserControl.ListCertificate(); this.metroTabControl_Main.SuspendLayout(); this.tabPage1.SuspendLayout(); this.metroTabControl_Applicant.SuspendLayout(); @@ -51,6 +53,8 @@ this.tabPage6.SuspendLayout(); this.tabPage7.SuspendLayout(); this.tabPage8.SuspendLayout(); + this.tabPage9.SuspendLayout(); + this.tabPage10.SuspendLayout(); this.tabPage2.SuspendLayout(); this.SuspendLayout(); // @@ -164,6 +168,7 @@ // // tabPage9 // + this.tabPage9.Controls.Add(this.listProceeds); this.tabPage9.Location = new System.Drawing.Point(4, 38); this.tabPage9.Name = "tabPage9"; this.tabPage9.Size = new System.Drawing.Size(968, 604); @@ -172,6 +177,7 @@ // // tabPage10 // + this.tabPage10.Controls.Add(this.listCertificate1); this.tabPage10.Location = new System.Drawing.Point(4, 38); this.tabPage10.Name = "tabPage10"; this.tabPage10.Size = new System.Drawing.Size(968, 604); @@ -189,12 +195,29 @@ // // settings1 // + this.settings1.BackColor = System.Drawing.Color.White; this.settings1.Dock = System.Windows.Forms.DockStyle.Fill; this.settings1.Location = new System.Drawing.Point(0, 0); this.settings1.Name = "settings1"; this.settings1.Size = new System.Drawing.Size(976, 646); this.settings1.TabIndex = 0; // + // listProceeds + // + this.listProceeds.Dock = System.Windows.Forms.DockStyle.Fill; + this.listProceeds.Location = new System.Drawing.Point(0, 0); + this.listProceeds.Name = "listProceeds"; + this.listProceeds.Size = new System.Drawing.Size(968, 604); + this.listProceeds.TabIndex = 0; + // + // listCertificate1 + // + this.listCertificate1.Dock = System.Windows.Forms.DockStyle.Fill; + this.listCertificate1.Location = new System.Drawing.Point(0, 0); + this.listCertificate1.Name = "listCertificate1"; + this.listCertificate1.Size = new System.Drawing.Size(968, 604); + this.listCertificate1.TabIndex = 0; + // // Master // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); @@ -212,6 +235,8 @@ this.tabPage6.ResumeLayout(false); this.tabPage7.ResumeLayout(false); this.tabPage8.ResumeLayout(false); + this.tabPage9.ResumeLayout(false); + this.tabPage10.ResumeLayout(false); this.tabPage2.ResumeLayout(false); this.ResumeLayout(false); @@ -231,10 +256,11 @@ private CustomUserControl.ApplicantList applicantList1; private CustomUserControl.WaitingList waitingList1; private CustomUserControl.UserList userList1; - private MetroFramework.Controls.MetroButton metroButton1; private System.Windows.Forms.TabPage tabPage9; private System.Windows.Forms.TabPage tabPage10; private CustomUserControl.SettingControl settings1; + private CustomUserControl.ListProceeds listProceeds; + private CustomUserControl.ListCertificate listCertificate1; } }