전체 List 부분 시청 요구사항대로 변경

Database, DataModel, 등등 수정
This commit is contained in:
2023-09-21 16:31:32 +09:00
parent 05ee9c79a5
commit 3443866dab
13 changed files with 264 additions and 195 deletions

View File

@@ -17,7 +17,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
metroComboBox_SearchType.SelectedIndex = 0;
}
void DataChange()
{
@@ -46,14 +46,14 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
var dataTable = new DataTable();
dataTable.Columns.Add("접수번호");
dataTable.Columns.Add("성명(법인명)");
dataTable.Columns.Add("생년월일(법인등록번호)");
dataTable.Columns.Add("성명\r\n(법인명)");
dataTable.Columns.Add("생년월일\r\n(법인등록번호)");
dataTable.Columns.Add("연락처");
dataTable.Columns.Add("주소");
dataTable.Columns.Add("차량번호(화물)");
dataTable.Columns.Add("차종(화물)");
dataTable.Columns.Add("차량번호(승용)");
dataTable.Columns.Add("차종(승용)");
dataTable.Columns.Add("차량번호\r\n(화물)");
dataTable.Columns.Add("차종\r\n(화물)");
dataTable.Columns.Add("차량번호\r\n(승용)");
dataTable.Columns.Add("차종\r\n(승용)");
dataTable.Columns.Add("차량 타입");
dataTable.Columns.Add("신청일");
@@ -73,11 +73,11 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
applicants[i].VehicleType == 0 ? "대형(4.5톤 미만)" : "특대형(4.5톤 이상)",
applicants[i].DateOfApplication
);
);
}
dataGridView_List.DataSource = dataTable;
dataGridView_List.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView_List.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView_List.Columns[0].MinimumWidth = 100;
dataGridView_List.Columns[0].FillWeight = 100;

View File

@@ -162,6 +162,7 @@
this.Controls.Add(this.dataGridView_List);
this.Name = "ListCertificate";
this.Size = new System.Drawing.Size(750, 470);
this.Load += new System.EventHandler(this.ListCertificate_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView_List)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();

View File

@@ -38,33 +38,34 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
private void metroButton_Search_Click(object sender, EventArgs e)
{
List<CertificateData> certificateDatas = Database.GetLedgerCertificate(metroDateTime_StartDate.Value, metroDateTime_EndDate.Value);
List<CertificateInformation> certificateInformation = 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("이름");
dataTable.Columns.Add("생년월일");
dataTable.Columns.Add("주소ㅋ");
dataTable.Columns.Add("차량번호\r\n(화물)");
dataTable.Columns.Add("이용시작일");
dataTable.Columns.Add("이용종료일");
dataTable.Columns.Add("이용금액");
dataTable.Columns.Add("증명일자 시작일");
dataTable.Columns.Add("발급일자 종료일");
for (int i = 0; i < certificateDatas.Count; i++)
for (int i = 0; i < certificateInformation.Count; i++)
{
dataTable.Rows
.Add(
certificateDatas[i].IssueNumber,
certificateDatas[i].IssueDate,
certificateDatas[i].CargoVehicleNumber,
certificateDatas[i].Name,
certificateDatas[i].StartDate,
certificateDatas[i].EndDate
certificateInformation[i].IssueNumber,
certificateInformation[i].IssueDate,
certificateInformation[i].Name,
certificateInformation[i].PersonalNumber,
certificateInformation[i].Address,
certificateInformation[i].CargoVehicleNumber,
certificateInformation[i].StartDate,
certificateInformation[i].EndDate,
certificateInformation[i].Amount
);
}
@@ -92,12 +93,9 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
}
string issueNumber = dataGridView_List.SelectedRows[0].Cells[0].Value.ToString();
CertificateData certificateData = Database.GetCertificate(issueNumber);
var print = new PrintCertificate(new List<CertificateData>() { certificateData }, Global.GlobalSettings.GarageName);
CertificateInformation certificateInformation = Database.GetCertificate(issueNumber);
var print = new PrintCertificate(new List<CertificateInformation>() { certificateInformation }, Global.GlobalSettings.GarageName);
var printPreviewDialog = new PrintPreviewDialog();
printPreviewDialog.Icon = Resources.free_icon_trucks_8552082;
@@ -106,5 +104,11 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
printPreviewDialog.ShowDialog();
}
private void ListCertificate_Load(object sender, EventArgs e)
{
metroDateTime_StartDate.Value = metroDateTime_StartDate.Value.AddDays(1 - metroDateTime_StartDate.Value.Day);
metroDateTime_EndDate.Value = metroDateTime_EndDate.Value.AddMonths(1).AddDays(-metroDateTime_EndDate.Value.Day);
}
}
}

View File

@@ -28,15 +28,15 @@
/// </summary>
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.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();
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();
@@ -56,6 +56,51 @@
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 = "검색 시작일";
//
// dataGridView_List
//
this.dataGridView_List.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -63,14 +108,14 @@
| 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.Name = "dataGridView_List";
@@ -93,51 +138,6 @@
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);
@@ -148,6 +148,7 @@
this.Controls.Add(this.groupBox1);
this.Name = "ListProceeds";
this.Size = new System.Drawing.Size(750, 470);
this.Load += new System.EventHandler(this.ListProceeds_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView_List)).EndInit();

View File

@@ -32,8 +32,8 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
var dataTable = new DataTable();
dataTable.Columns.Add("차량번호(화물)");
dataTable.Columns.Add("차량번호(승용)");
dataTable.Columns.Add("차량번호\r\n(화물)");
dataTable.Columns.Add("차량번호\r\n(승용)");
dataTable.Columns.Add("이름");
dataTable.Columns.Add("수익금 종류");
dataTable.Columns.Add("금액");
@@ -88,5 +88,10 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
dataGridView_List.Columns[2].FillWeight = 60;
}
private void ListProceeds_Load(object sender, EventArgs e)
{
metroDateTime_StartDate.Value = metroDateTime_StartDate.Value.AddDays(1 - metroDateTime_StartDate.Value.Day);
metroDateTime_EndDate.Value = metroDateTime_EndDate.Value.AddMonths(1).AddDays(-metroDateTime_EndDate.Value.Day);
}
}
}

View File

@@ -3,7 +3,6 @@ using MetroFramework;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
@@ -73,9 +72,9 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
dataTable.Columns.Add("연락처");
dataTable.Columns.Add("주소");
dataTable.Columns.Add("주차구역");
dataTable.Columns.Add("차량번호(화물)");
dataTable.Columns.Add("차량번호\r\n(화물)");
dataTable.Columns.Add("차종(화물)");
dataTable.Columns.Add("차량번호(승용)");
dataTable.Columns.Add("차량번호\r\n(승용)");
dataTable.Columns.Add("차종(승용)");
dataTable.Columns.Add("이용시작일");
dataTable.Columns.Add("이용종료일");
@@ -121,7 +120,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
dataGridView_List.Columns[2].FillWeight = 60;
dataGridView_List.Columns[15].DefaultCellStyle.WrapMode =
DataGridViewTriState.True;
}
private void metroButton_Search_Click(object sender, EventArgs e)
@@ -197,24 +196,22 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
MessageBoxIcon.Question);
if (result == DialogResult.No) return;
// 사용자 정보 가져와야함
int code = int.Parse(dataGridView_List.SelectedRows[0].Cells[0].Value.ToString());
CertificateInformation certificateInformation = new CertificateInformation();
CertificateInformation certificateInformation = new CertificateInformation(); //DB 에서 다시 가져오는 선택?
certificateInformation.Name = dataGridView_List.SelectedRows[0].Cells[4].Value.ToString();
certificateInformation.PersonalNumber = dataGridView_List.SelectedRows[0].Cells[5].Value.ToString();
certificateInformation.Address = dataGridView_List.SelectedRows[0].Cells[7].Value.ToString();
certificateInformation.CargoVehicleNumber = dataGridView_List.SelectedRows[0].Cells[10].Value.ToString();
//certificateInformation.Amount = dataGridView_List.SelectedRows[0].Cells[7].Value.ToString();
certificateInformation.Amount = Database.GetAmountByCertificate(dataGridView_List.SelectedRows[0].Cells[0].Value.ToString());
certificateInformation.Area = dataGridView_List.SelectedRows[0].Cells[8].Value.ToString();
certificateInformation.StartDate =
DateTime.Parse(dataGridView_List.SelectedRows[0].Cells[14].Value.ToString());
certificateInformation.EndDate = DateTime.Parse(dataGridView_List.SelectedRows[0].Cells[15].Value.ToString());
DateTime.Parse(dataGridView_List.SelectedRows[0].Cells[13].Value.ToString());
certificateInformation.EndDate = DateTime.Parse(dataGridView_List.SelectedRows[0].Cells[14].Value.ToString());
certificateInformation.IssueDate = nowDateTime;
int lastNo = Database.GetLastCertificate(nowDateTime.Year);
lastNo++;
certificateInformation.IssueNumber = nowDateTime.Year.ToString() + "-" + lastNo.ToString();
@@ -226,33 +223,45 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
setCertificateInformation.IssueDate = certificateInformation.IssueDate;
setCertificateInformation.StartDate = certificateInformation.StartDate;
setCertificateInformation.EndDate = certificateInformation.EndDate;
//bool dbResult = Database.SetCertificate(setCertificateInformation);
setCertificateInformation.Amount = certificateInformation.Amount;
// 요금 상계
//SetProceedsInfo setProceedsInfo = new SetProceedsInfo();
//setProceedsInfo.No = certificate.No;
//setProceedsInfo.Date = nowDateTime;
//setProceedsInfo.Type = ProceedsType.Certificate;
// 요금 상계 부분
// setProceedsInfo.Amount = Global.GlobalSettings.CertificateFee;
//dbResult = Database.SetProceeds(setProceedsInfo);
// 증명서 발급 요금 계산
SetProceedsInfo setProceedsInfo = new SetProceedsInfo();
setProceedsInfo.No = setCertificateInformation.UserNo;
setProceedsInfo.Date = nowDateTime;
setProceedsInfo.Type = ProceedsType.Certificate;
EVehicleType eVehicleType = Database.GetVehicleType(setCertificateInformation.UserNo);
switch (eVehicleType)
{
case EVehicleType.Large:
setProceedsInfo.Amount = Global.GlobalSettings.CargoLargeCertificateFee;
break;
case EVehicleType.Oversized:
setProceedsInfo.Amount = Global.GlobalSettings.CargoOversizedFee;
break;
}
string amount = string.Format("{0:N0} 원", setProceedsInfo.Amount);
var dialogResult = MetroMessageBox.Show(this, $"증명서 발급요금이 {amount} 발생했습니다. 발급하시겠습니까?", "Question", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dialogResult == DialogResult.OK)
{
Database.SetCertificate(setCertificateInformation);
Database.SetProceeds(setProceedsInfo);
var print = new PrintCertificate(new List<CertificateInformation>() { certificateInformation }, Global.GlobalSettings.GarageName);
var printPreviewDialog = new PrintPreviewDialog();
printPreviewDialog.Icon = Resources.free_icon_trucks_8552082;
printPreviewDialog.WindowState = FormWindowState.Maximized;
printPreviewDialog.Document = print.printDocument;
printPreviewDialog.ShowDialog();
}
var print = new PrintCertificate(new List<CertificateInformation>() { certificateInformation }, Global.GlobalSettings.GarageName);
var printDocument = new PrintDocument();
printDocument.DocumentName = "차고지 이용 증명서";
printDocument.PrintPage += print.PrintPage;
var printPreviewDialog = new PrintPreviewDialog();
printPreviewDialog.Icon = Resources.free_icon_trucks_8552082;
printPreviewDialog.WindowState = FormWindowState.Maximized;
printPreviewDialog.Document = printDocument;
printPreviewDialog.ShowDialog();
}
}
}

View File

@@ -99,7 +99,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
public string PersonalNumber { get; set; }
public string Address { get; set; }
public string CargoVehicleNumber { get; set; }
public string Amount { get; set; }
public int Amount { get; set; }
public string Area { get; set; }
public string IssueNumber { get; set; }
public DateTime IssueDate { get; set; }

View File

@@ -1,10 +1,8 @@
using HSUCO_Cargo_Garage_Operation_Program.CustomUserControl;
using System;
using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Globalization;
using System.IO;
using System.Windows.Forms;
namespace HSUCO_Cargo_Garage_Operation_Program
{
@@ -187,11 +185,23 @@ namespace HSUCO_Cargo_Garage_Operation_Program
public static ResultApplicantInsertInformation SetApplicant(ApplicantInformation applicant)
{
string year = DateTime.Now.Year.ToString();
string suffix = applicant.ApplicantType ? Global.SuffixApplicantLot : Global.SuffixApplicantWait;
int lastNo = GetLastApplicant(year, suffix);
int year = DateTime.Now.Year;
string suffix;
EGetLastNumber eGetLastNumber;
if (applicant.ApplicantType)
{
suffix = Global.SuffixApplicantLot;
eGetLastNumber = EGetLastNumber.ApplicantListLots;
}
else
{
suffix = Global.SuffixApplicantWait;
eGetLastNumber = EGetLastNumber.ApplicantListWait;
}
int lastNo = GetLastNo(eGetLastNumber, year);
lastNo++;
string no = $"{year}-{suffix}{lastNo.ToString("D4")}";
string no = $"{year}-{suffix}{lastNo}";
int waitOrder = 0;
string query;
if (!applicant.ApplicantType)
@@ -213,7 +223,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
}
}
query =
$"INSERT INTO ApplicantList VALUES('{applicant.ApplicantType.BoolToInt()}','{no}','{applicant.CargoVehicleNumber}','{applicant.CargoVehicleName}','{applicant.PassengerVehicleNumber}','{applicant.PassengerVehicleName}','{applicant.VehicleType}','{applicant.Name}','{applicant.PersonalNumber}','{applicant.Phone}','{applicant.Address}','{applicant.DateOfApplication.DateTimeDatabase()}') ";
$"INSERT INTO ApplicantList VALUES('{applicant.ApplicantType.BoolToInt()}','{no}','{applicant.CargoVehicleNumber}','{applicant.CargoVehicleName}','{applicant.PassengerVehicleNumber}','{applicant.PassengerVehicleName}','{(int)applicant.VehicleType}','{applicant.Name}','{applicant.PersonalNumber}','{applicant.Phone}','{applicant.Address}','{applicant.DateOfApplication.DateTimeDatabase()}') ";
int insertResult;
using (var command = _sqLiteConnection.CreateCommand())
@@ -478,7 +488,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
var proceedsDatas = new List<ProceedsData>();
var query =
$"SELECT UserList.CargoVehicleNumber, UserList.PassengerVehicleNumber, UserList.Name, LedgerProceeds.Type, LedgerProceeds.Amount, LedgerProceeds.Date From LedgerProceeds INNER JOIN UserList ON LedgerProceeds.No = UserList.No Where LedgerProceeds.Date >='{startDateTime.StartDateTime()}' And LedgerProceeds.Date <='{endDateTime.EndDateTime()}'";
$"SELECT U.CargoVehicleNumber, U.PassengerVehicleNumber, U.Name, P.Type, P.Amount, P.Date From LedgerProceeds P INNER JOIN UserList U ON P.UserNo = U.No Where P.Date >='{startDateTime.StartDateTime()}' And P.Date <='{endDateTime.EndDateTime()}'";
using (var command = _sqLiteConnection.CreateCommand())
{
@@ -503,6 +513,24 @@ namespace HSUCO_Cargo_Garage_Operation_Program
return proceedsDatas;
}
public static int GetAmountByCertificate(string userNo)
{
int amount = 0;
var query = $"SELECT SUM(Amount) as Amount From LedgerProceeds Where Type >= 0 And Type <= 1 And UserNo='{userNo}'";
using (var command = _sqLiteConnection.CreateCommand())
{
command.CommandText = query;
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
amount = int.Parse(reader["Amount"].ToString());
}
}
}
return amount;
}
/// <summary>
/// 증명서 발급 대장 조회용
/// </summary>
@@ -511,9 +539,9 @@ namespace HSUCO_Cargo_Garage_Operation_Program
/// <returns></returns>
public static List<CertificateInformation> GetLedgerCertificate(DateTime startDateTime, DateTime endDateTime)
{
var certificateDatas = new List<CertificateInformation>();
List<CertificateInformation> certificateInformations = new List<CertificateInformation>();
var query =
$"SELECT UserList.Name, UserList.PersonalNumber, UserList.Address, UserList.CargoVehicleNumber, LedgerCertificate.IssueNumber, LedgerCertificate.IssueDate, LedgerCertificate.StartDate, LedgerCertificate.EndDate From LedgerCertificate INNER JOIN UserList ON LedgerCertificate.No = UserList.No Where LedgerCertificate.IssueDate >='{startDateTime.StartDateTime()}' And LedgerCertificate.IssueDate <='{endDateTime.EndDateTime()}'";
$"SELECT U.Name, U.PersonalNumber, U.Address, U.CargoVehicleNumber, C.No, C.IssueDate, C.StartDate, C.EndDate, C.Amount From LedgerCertificate C INNER JOIN UserList U ON C.UserNo = U.No Where C.IssueDate >='{startDateTime.StartDateTime()}' And C.IssueDate <='{endDateTime.EndDateTime()}'";
using (var command = _sqLiteConnection.CreateCommand())
{
@@ -523,23 +551,25 @@ namespace HSUCO_Cargo_Garage_Operation_Program
{
while (reader.Read())
{
var certificateData = new CertificateInformation();
certificateData.Name = reader["Name"].ToString();
certificateData.PersonalNumber = reader["PersonalNumber"].ToString();
certificateData.Address = reader["Address"].ToString();
certificateData.CargoVehicleNumber = reader["CargoVehicleNumber"].ToString();
CertificateInformation certificateInformation = new CertificateInformation();
certificateData.IssueNumber = reader["IssueNumber"].ToString();
certificateData.IssueDate = DateTime.Parse(reader["IssueDate"].ToString());
certificateData.StartDate = DateTime.Parse(reader["StartDate"].ToString());
certificateData.EndDate = DateTime.Parse(reader["EndDate"].ToString());
certificateDatas.Add(certificateData);
certificateInformation.Name = reader["Name"].ToString();
certificateInformation.PersonalNumber = reader["PersonalNumber"].ToString();
certificateInformation.Address = reader["Address"].ToString();
certificateInformation.CargoVehicleNumber = reader["CargoVehicleNumber"].ToString();
certificateInformation.IssueNumber = reader["No"].ToString();
certificateInformation.Amount = int.Parse(reader["Amount"].ToString());
certificateInformation.IssueDate = DateTime.Parse(reader["IssueDate"].ToString());
certificateInformation.StartDate = DateTime.Parse(reader["StartDate"].ToString());
certificateInformation.EndDate = DateTime.Parse(reader["EndDate"].ToString());
certificateInformations.Add(certificateInformation);
}
}
}
return certificateDatas;
return certificateInformations;
}
/// <summary>
/// 발급 번호로 발급데이터 조회
/// </summary>
@@ -547,20 +577,23 @@ namespace HSUCO_Cargo_Garage_Operation_Program
/// <returns></returns>
public static CertificateInformation GetCertificate(string issueNumber)
{
CertificateInformation certificateInformation = new CertificateInformation();
var query = $"SELECT UserList.CargoVehicleNumber, UserList.PassengerVehicleNumber, UserList.Name, LedgerCertificate.IssueNumber, LedgerCertificate.IssueDate, LedgerCertificate.StartDate, LedgerCertificate.EndDate From LedgerCertificate INNER JOIN UserList ON LedgerCertificate.No = UserList.No Where IssueNumber='{issueNumber}'";
CertificateInformation certificateInformation = new CertificateInformation();
var query = $"SELECT U.Name, U.PersonalNumber, U.Address, U.CargoVehicleNumber, C.Amount, U.Area, C.IssueDate, C.StartDate, C.EndDate From LedgerCertificate C INNER JOIN UserList U ON (C.UserNo = U.No) Where C.No='{issueNumber}'";
using (var command = _sqLiteConnection.CreateCommand())
{
command.CommandText = query;
using (var reader = command.ExecuteReader())
{
{ // 이거면 안됨
while (reader.Read())
{
certificateInformation.CargoVehicleNumber = reader["CargoVehicleNumber"].ToString();
//certificateData.PassengerVehicleNumber = reader["PassengerVehicleNumber"].ToString();
certificateInformation.IssueNumber = issueNumber;
certificateInformation.Name = reader["Name"].ToString();
certificateInformation.IssueNumber = reader["IssueNumber"].ToString();
certificateInformation.PersonalNumber = reader["PersonalNumber"].ToString();
certificateInformation.Address = reader["Address"].ToString();
certificateInformation.CargoVehicleNumber = reader["CargoVehicleNumber"].ToString();
certificateInformation.Amount = int.Parse(reader["Amount"].ToString());
certificateInformation.Area = reader["Area"].ToString();
certificateInformation.IssueDate = DateTime.Parse(reader["IssueDate"].ToString());
certificateInformation.StartDate = DateTime.Parse(reader["StartDate"].ToString());
certificateInformation.EndDate = DateTime.Parse(reader["EndDate"].ToString());
@@ -575,10 +608,12 @@ namespace HSUCO_Cargo_Garage_Operation_Program
{
return GetLastNo(EGetLastNumber.ApplicantListLots, year);
}
public static int GetLastApplicantWait(int year)
{
return GetLastNo(EGetLastNumber.ApplicantListWait, year);
}
public static int GetLastCertificate(int year)
{
return GetLastNo(EGetLastNumber.LedgerCertificate, year);
@@ -588,7 +623,8 @@ namespace HSUCO_Cargo_Garage_Operation_Program
{
return GetLastNo(EGetLastNumber.UserList, year);
}
public static int GetLastNo(EGetLastNumber eGetLastNumber, int year)
private static int GetLastNo(EGetLastNumber eGetLastNumber, int year)
{
string tableName = string.Empty;
string suffix = string.Empty;
@@ -598,21 +634,23 @@ namespace HSUCO_Cargo_Garage_Operation_Program
tableName = "ApplicantList";
suffix = "L";
break;
case EGetLastNumber.ApplicantListWait:
tableName = "ApplicantList";
suffix = "W";
break;
case EGetLastNumber.UserList:
tableName = "UserList";
suffix = "U";
break;
case EGetLastNumber.LedgerCertificate:
tableName = "LedgerCertificate";
suffix = "C";
break;
}
var query = $"SELECT No FROM {tableName} Where IssueNumber Like '{year}-{suffix}%' Order By No DESC LIMIT 1";
var query = $"SELECT No FROM {tableName} Where No Like '{year}-{suffix}%' Order By No DESC LIMIT 1";
var lastNo = 0;
using (var command = _sqLiteConnection.CreateCommand())
{
@@ -622,7 +660,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
{
while (reader.Read())
{
var issueNumber = reader["IssueNumber"].ToString();
var issueNumber = reader["No"].ToString();
issueNumber = issueNumber.Substring(6, issueNumber.Length - 6);
lastNo = int.Parse(issueNumber);
}
@@ -630,10 +668,11 @@ namespace HSUCO_Cargo_Garage_Operation_Program
}
return lastNo;
}
public static bool SetCertificate(Certificate certificate)
public static bool SetCertificate(SetCertificateInformation setCertificateInformation)
{
var query =
$"INSERT INTO LedgerCertificate VALUES('{certificate.No}','{certificate.IssueNumber}','{certificate.IssueDate.DateTimeDatabase()}','{certificate.StartDate.StartDateTime()}','{certificate.EndDate.EndDateTime()}') ";
$"INSERT INTO LedgerCertificate VALUES('{setCertificateInformation.No}','{setCertificateInformation.UserNo}','{setCertificateInformation.IssueDate.DateTimeDatabase()}','{setCertificateInformation.StartDate.StartDateTime()}','{setCertificateInformation.EndDate.EndDateTime()}',{setCertificateInformation.Amount}) ";
using (var insertCommand = _sqLiteConnection.CreateCommand())
{
@@ -654,6 +693,25 @@ namespace HSUCO_Cargo_Garage_Operation_Program
}
}
public static EVehicleType GetVehicleType(string no)
{
var query = $"SELECT VehicleType From UserList Where No='{no}'";
int type = 0;
using (var command = _sqLiteConnection.CreateCommand())
{
command.CommandText = query;
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
type = int.Parse(reader["VehicleType"].ToString());
}
}
}
return (EVehicleType)type;
}
public static Settings LoadSettings()
{
var settings = new Settings();

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace HSUCO_Cargo_Garage_Operation_Program
{
@@ -20,8 +15,8 @@ namespace HSUCO_Cargo_Garage_Operation_Program
public static string StartDateTime(this DateTime date)
{
return $"{date.Year:D4}-{date.Month:D2}-{date.Day:D2} 00:00:00";
}
public static string EndDateTime(this DateTime date)

View File

@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HSUCO_Cargo_Garage_Operation_Program
namespace HSUCO_Cargo_Garage_Operation_Program
{
public static class Global
{
@@ -12,8 +6,8 @@ namespace HSUCO_Cargo_Garage_Operation_Program
public static readonly string AreaLarge = "13m × 3.25m";
public static readonly string AreaOversized = "17m × 3.5m";
public static readonly string SuffixApplicantLot = "FL";
public static readonly string SuffixApplicantWait = "FW";
public static readonly string SuffixApplicantLot = "L";
public static readonly string SuffixApplicantWait = "W";
public static readonly string SuffixCertificate = "C";
}
}

View File

@@ -172,6 +172,7 @@
</EmbeddedResource>
<EmbeddedResource Include="CustomUserControl\ApplicantControl.resx">
<DependentUpon>ApplicantControl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="CustomUserControl\ListCertificate.resx">
<DependentUpon>ListCertificate.cs</DependentUpon>
@@ -190,6 +191,7 @@
</EmbeddedResource>
<EmbeddedResource Include="CustomUserControl\ApplicantList.resx">
<DependentUpon>ApplicantList.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Master.resx">
<DependentUpon>Master.cs</DependentUpon>

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.Web;
using Font = System.Drawing.Font;
namespace HSUCO_Cargo_Garage_Operation_Program
@@ -13,15 +12,16 @@ namespace HSUCO_Cargo_Garage_Operation_Program
private readonly string _garageName;
private int _count;
public PrintDocument printDocument;
public PrintCertificate(List<CertificateInformation> certificateDatas, string garageName )
public PrintCertificate(List<CertificateInformation> certificateDatas, string garageName)
{
_certificateDatas = certificateDatas;
_garageName = garageName;
_certificateInformation = certificateDatas;
_garageName = garageName;
_count = 0;
printDocument = new PrintDocument();
printDocument.DocumentName = "차고지 이용 증명서";
printDocument.PrintPage += PrintPage;
printDocument.DefaultPageSettings.Margins.Top = Convert.ToInt32(50); printDocument.DefaultPageSettings.Margins.Left = Convert.ToInt32(50);
printDocument.DefaultPageSettings.Margins.Top = Convert.ToInt32(50);
printDocument.DefaultPageSettings.Margins.Bottom = Convert.ToInt32(50);
printDocument.DefaultPageSettings.Margins.Left = Convert.ToInt32(30);
printDocument.DefaultPageSettings.Margins.Right = Convert.ToInt32(30);
@@ -32,24 +32,24 @@ namespace HSUCO_Cargo_Garage_Operation_Program
e.MarginBounds.Width, e.MarginBounds.Height);
int totalWidth = (int)e.PageBounds.Width;
int totalHeight = (int)e.PageBounds.Height;
e.Graphics.DrawString($"발급번호 : {_certificateInformation[_count].IssueNumber}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 10, e.MarginBounds.Top + 10);
CenterTextWriter($"화물자동차 공영차고지 이용 증명서", new Font("맑은 고딕", 30, FontStyle.Bold), e.Graphics, totalWidth, e.MarginBounds.Top + 100);
e.Graphics.DrawString($"■ 성  명 : {_certificateDatas[_count].Name}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 250);
e.Graphics.DrawString($"■ 생년월일 : {_certificateDatas[_count].PersonalNumber}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 300);
e.Graphics.DrawString($"■ 주  소 : {_certificateDatas[_count].Address}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 350);
e.Graphics.DrawString($"■ 차량번호 : {_certificateDatas[_count].CargoVehicleNumber}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 400);
e.Graphics.DrawString($"■ 이용요금 : {_certificateDatas[_count].Amount}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 450);
e.Graphics.DrawString($"■ 이용면적 : {_certificateDatas[_count].AreaSize}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 500);
e.Graphics.DrawString($"■ 이용기한 : {_certificateDatas[_count].StartDate.ToString("yyyy-MM-dd")} ~ {_certificateDatas[_count].EndDate.ToString("yyyy-MM-dd")}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 550);
e.Graphics.DrawString($"■ 성  명 : {_certificateInformation[_count].Name}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 250);
e.Graphics.DrawString($"■ 생년월일 : {_certificateInformation[_count].PersonalNumber}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 300);
e.Graphics.DrawString($"■ 주  소 : {_certificateInformation[_count].Address}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 350);
e.Graphics.DrawString($"■ 차량번호 : {_certificateInformation[_count].CargoVehicleNumber}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 400);
e.Graphics.DrawString($"■ 이용요금 : {string.Format("{0:N0} ", _certificateInformation[_count].Amount)}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 450);
e.Graphics.DrawString($"■ 이용면적 : {_certificateInformation[_count].Area}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 500);
e.Graphics.DrawString($"■ 이용기한 : {_certificateInformation[_count].StartDate.ToString("yyyy-MM-dd")} ~ {_certificateInformation[_count].EndDate.ToString("yyyy-MM-dd")}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 550);
e.Graphics.DrawString($"■ 차 고 지 : {_garageName}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 600);
CenterTextWriter($"위 차량에 대하여 {_garageName} 화물자동차 공영차고지 이용을 증명합니다.", new Font("맑은 고딕", 12, FontStyle.Bold), e.Graphics, totalWidth, e.MarginBounds.Top + 700);
CenterTextWriter($"{_certificateDatas[_count].IssueDate.ToString("yyyy년 MM월 dd일")}", new Font("맑은 고딕", 15), e.Graphics, totalWidth, e.MarginBounds.Top + 800);
CenterTextWriter($"{_certificateInformation[_count].IssueDate.ToString("yyyy년 MM월 dd일")}", new Font("맑은 고딕", 15), e.Graphics, totalWidth, e.MarginBounds.Top + 800);
CenterTextWriter("화성도시공사 사장", new Font("맑은 고딕", 20, FontStyle.Bold), e.Graphics, totalWidth, e.MarginBounds.Top + 900);
_count++;
e.HasMorePages = _certificateDatas.Count > _count;
e.HasMorePages = _certificateInformation.Count > _count;
}
private void CenterTextWriter(string text, Font font, Graphics g, int totalWidth, int posY)

View File

@@ -37,7 +37,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
e.Graphics.DrawLine(new Pen(Brushes.Black, 1), new Point(e.MarginBounds.Left, e.MarginBounds.Top + 490), new Point(e.MarginBounds.Right, e.MarginBounds.Top + 490));
e.Graphics.DrawLine(new Pen(Brushes.Black, 1), new Point(e.MarginBounds.Left, e.MarginBounds.Top + 540), new Point(e.MarginBounds.Right, e.MarginBounds.Top + 540));
e.Graphics.DrawLine(new Pen(Brushes.Black, 1), new Point(e.MarginBounds.Left+280, e.MarginBounds.Top + 290), new Point(e.MarginBounds.Left + 280, e.MarginBounds.Top + 540));
e.Graphics.DrawLine(new Pen(Brushes.Black, 1), new Point(e.MarginBounds.Left + 280, e.MarginBounds.Top + 290), new Point(e.MarginBounds.Left + 280, e.MarginBounds.Top + 540));
e.Graphics.DrawLine(new Pen(Brushes.Black, 1), new Point(e.MarginBounds.Left + 520, e.MarginBounds.Top + 440), new Point(e.MarginBounds.Left + 520, e.MarginBounds.Top + 490));
@@ -45,11 +45,11 @@ namespace HSUCO_Cargo_Garage_Operation_Program
int totalHeight = (int)e.PageBounds.Height;
CenterTextWriter($"접 수 증", new Font("맑은 고딕", 30, FontStyle.Bold), e.Graphics, totalWidth, e.MarginBounds.Top + 100);
e.Graphics.DrawString($"제 {_printFilingReceiptInformation[_count].No}호", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 100, e.MarginBounds.Top + 250);
e.Graphics.DrawString($"접수일 : {_printFilingReceiptInformation[_count].DateReception.ToString("yyyy-MM-dd")}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 500, e.MarginBounds.Top + 250);
e.Graphics.DrawString($"① 신청인", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 300);
e.Graphics.DrawString($"{_printFilingReceiptInformation[_count].Name}", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 300, e.MarginBounds.Top + 300);
e.Graphics.DrawString($"② 생년월일(법인등록번호)", new Font("맑은 고딕", 12), Brushes.Black, e.MarginBounds.Left + 50, e.MarginBounds.Top + 350);