버그수정

인쇄 버그 수정
연장 금액 (1년치로) 수정
증명서 발급 에러 수정
신청자 리스트 Excel 제목 수정
This commit is contained in:
2023-10-12 15:17:19 +09:00
parent e5712d80a9
commit a917993a32
10 changed files with 110 additions and 48 deletions

View File

@@ -2,6 +2,7 @@
using MetroFramework;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
@@ -140,14 +141,16 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
printFilingReceiptInformation.CargoVehicleNumber = applicant.CargoVehicleNumber;
printFilingReceiptInformation.PassengerVehicleNumber = applicant.PassengerVehicleNumber;
printFilingReceiptInformation.DateReception = applicant.Date;
try
{
PrintFilingReceipt printFilingReceipt = new PrintFilingReceipt(new List<PrintFilingReceiptInformation>() { printFilingReceiptInformation });
var printPreviewDialog = new PrintPreviewDialog();
printPreviewDialog.Icon = Resources.free_icon_trucks_8552082;
printPreviewDialog.WindowState = FormWindowState.Maximized;
printPreviewDialog.Document = printFilingReceipt.printDocument;
printPreviewDialog.ShowDialog();
printFilingReceipt.Print();
}
catch(Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
else

View File

@@ -198,7 +198,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
var result = excelWrapper.WriteDataTableToExcel((DataTable)dataGridView_List.DataSource, "UserList", saveFileDialog.FileName, "이용자 리스트", Environment.MachineName, DateTime.Now);
var result = excelWrapper.WriteDataTableToExcel((DataTable)dataGridView_List.DataSource, "추첨 신청자 리스트", saveFileDialog.FileName, "추첨 신청자 리스트", Environment.MachineName, DateTime.Now);
if (result)
{
MetroMessageBox.Show(this, "엑셀 파일 저장에 성공하였습니다.", "Excel Export", MessageBoxButtons.OK, MessageBoxIcon.Information);

View File

@@ -97,12 +97,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
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;
printPreviewDialog.WindowState = FormWindowState.Maximized;
printPreviewDialog.Document = print.printDocument;
printPreviewDialog.ShowDialog();
print.Print();
}

View File

@@ -60,6 +60,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
int.TryParse(metroTextBox_CargoOversizedCertificateFee.Text, out value);
settings.CargoOversizedCertificateFee = value;
Database.SaveSettings(settings);
if (reStart)
{
MetroMessageBox.Show(this, "중요 설정이 변경되었습니다. 프로그램을 재시작합니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
@@ -69,6 +70,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
{
MetroMessageBox.Show(this, "설정이 완료되었습니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
Global.GlobalSettings = settings;
}

View File

@@ -245,6 +245,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
// 연장 금액 가져오기
EVehicleType eVehicleType = Database.GetVehicleType(no);
int amount = eVehicleType == EVehicleType.Large ? Global.GlobalSettings.CargoLargeFee : Global.GlobalSettings.CargoOversizedFee;
amount = amount * 12; // 한달치
string cargoNumber = dataGridView_List.SelectedRows[0].Cells[9].Value.ToString();
var message = $"선태하신 차량 {cargoNumber}을 연장하시겠습니까?\r\n연장금액 : {String.Format("{0:n0}", amount)}원";
@@ -399,28 +400,18 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
var result = MetroMessageBox.Show(this, "발급 하시겠습니까?", "증명서 발급", MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (result == DialogResult.No) return;
string no = dataGridView_List.SelectedRows[0].Cells[0].Value.ToString();
CertificateInformation certificateInformation = Database.GetUserCertificate(no);
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 = 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[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();
certificateInformation.IssueNumber = nowDateTime.Year.ToString() + "-C" + lastNo.ToString();
SetCertificateInformation setCertificateInformation = new SetCertificateInformation();
setCertificateInformation.No = dataGridView_List.SelectedRows[0].Cells[0].Value.ToString();
setCertificateInformation.UserNo = dataGridView_List.SelectedRows[0].Cells[0].Value.ToString();
setCertificateInformation.No = certificateInformation.IssueNumber;
setCertificateInformation.UserNo = no;
setCertificateInformation.IssueDate = certificateInformation.IssueDate;
setCertificateInformation.StartDate = certificateInformation.StartDate;
setCertificateInformation.EndDate = certificateInformation.EndDate;
@@ -451,12 +442,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
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();
print.Print();
}
}

View File

@@ -200,7 +200,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
var result = excelWrapper.WriteDataTableToExcel((DataTable)dataGridView_List.DataSource, "UserList", saveFileDialog.FileName, "이용자 리스트", Environment.MachineName, DateTime.Now);
var result = excelWrapper.WriteDataTableToExcel((DataTable)dataGridView_List.DataSource, "당첨 신청자 리스트", saveFileDialog.FileName, "당첨 신청자 리스트", Environment.MachineName, DateTime.Now);
if (result)
{
MetroMessageBox.Show(this, "엑셀 파일 저장에 성공하였습니다.", "Excel Export", MessageBoxButtons.OK, MessageBoxIcon.Information);

View File

@@ -572,7 +572,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
{
while (reader.Read())
{
endDate = DateTime.Parse(reader["DateEnd"].ToString());
endDate = DateTime.Parse(reader["DateStart"].ToString());
}
}
}
@@ -981,6 +981,51 @@ namespace HSUCO_Cargo_Garage_Operation_Program
return certificateInformations;
}
public static CertificateInformation GetUserCertificate(string no)
{
CertificateInformation certificateInformation = new CertificateInformation();
var query = $"SELECT * FROM ViewUserList Where No='{no}'";
using (var command = _sqLiteConnection.CreateCommand())
{
command.CommandText = query;
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
certificateInformation.Name = reader["Name"].ToString();
certificateInformation.PersonalNumber = reader["PersonalNumber"].ToString();
certificateInformation.Address = reader["Address"].ToString();
certificateInformation.CargoVehicleNumber = reader["CargoVehicleNumber"].ToString();
certificateInformation.Area = reader["Area"].ToString();
certificateInformation.StartDate = DateTime.Parse(reader["DateStart"].ToString());
certificateInformation.EndDate = DateTime.Parse(reader["DateEnd"].ToString());
}
}
}
/// Amount 의
query = $"SELECT SUM(AMOUNT) FROM LedgerProceeds Where UserNo='{no}' And (Type={(int)EProceedsType.Fees} Or Type={(int)EProceedsType.ExtensionFees})";
using (var command = _sqLiteConnection.CreateCommand())
{
command.CommandText = query;
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
string amountString = reader[0].ToString();
int amount = 0;
int.TryParse(amountString, out amount);
certificateInformation.Amount = amount;
}
}
}
return certificateInformation;
}
/// <summary>
/// 발급 번호로 발급데이터 조회
/// </summary>
@@ -1137,7 +1182,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
{
leftAreaInformation.OverSized.Add(i);
}
var query = $"SELECT Area FROM UserList Where DateEnd > '{startDateTime.Date.DateTimeDatabase()}'";
var query = $"SELECT Area FROM UserList Where DateEnd > '{startDateTime.Date.DateTimeDatabase()}' And PaymentStatus < {(int)EPaymentStatus.Refund}";
using (var command = _sqLiteConnection.CreateCommand())
{

View File

@@ -1,4 +1,5 @@
using System;
using System.Windows.Controls;
namespace HSUCO_Cargo_Garage_Operation_Program
{
@@ -16,6 +17,8 @@ namespace HSUCO_Cargo_Garage_Operation_Program
settings1.SettingReset();
this.Text = $"{Global.GlobalSettings.GarageName} 화물 차고지 운영프로그램 v{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}";
applicant1.GarageName(Global.GlobalSettings.GarageName);
}

View File

@@ -1,7 +1,9 @@
using System;
using HSUCO_Cargo_Garage_Operation_Program.Properties;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
using Font = System.Drawing.Font;
namespace HSUCO_Cargo_Garage_Operation_Program
@@ -11,7 +13,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
private readonly List<CertificateInformation> _certificateInformation;
private readonly string _garageName;
private int _count;
public PrintDocument printDocument;
private PrintDocument printDocument;
public PrintCertificate(List<CertificateInformation> certificateDatas, string garageName)
{
_certificateInformation = certificateDatas;
@@ -24,9 +26,17 @@ namespace HSUCO_Cargo_Garage_Operation_Program
printDocument.DefaultPageSettings.Margins.Bottom = Convert.ToInt32(50);
printDocument.DefaultPageSettings.Margins.Left = Convert.ToInt32(30);
printDocument.DefaultPageSettings.Margins.Right = Convert.ToInt32(30);
}
public void PrintPage(object sender, PrintPageEventArgs e)
public void Print()
{
PrintDialog printDialog = new PrintDialog();
printDialog.Document = printDocument;
if (printDialog.ShowDialog() == DialogResult.OK)
{
printDocument.Print();
}
}
private void PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawRectangle(new Pen(Brushes.Black, 3), e.MarginBounds.Left, e.MarginBounds.Top,
e.MarginBounds.Width, e.MarginBounds.Height);
@@ -48,6 +58,10 @@ namespace HSUCO_Cargo_Garage_Operation_Program
CenterTextWriter("화성도시공사 사장", new Font("맑은 고딕", 20, FontStyle.Bold), e.Graphics, totalWidth, e.MarginBounds.Top + 900);
_count++;
e.HasMorePages = _certificateInformation.Count > _count;
if(!e.HasMorePages)
{
_count = 0;
}
}
private void CenterTextWriter(string text, Font font, Graphics g, int totalWidth, int posY)

View File

@@ -1,7 +1,9 @@
using System;
using HSUCO_Cargo_Garage_Operation_Program.Properties;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
using Font = System.Drawing.Font;
namespace HSUCO_Cargo_Garage_Operation_Program
@@ -12,20 +14,28 @@ namespace HSUCO_Cargo_Garage_Operation_Program
{
private List<PrintFilingReceiptInformation> _printFilingReceiptInformation;
private int _count;
public PrintDocument printDocument;
private PrintDocument printDocument;
public PrintFilingReceipt(List<PrintFilingReceiptInformation> printFilingReceiptInformation)
{
_printFilingReceiptInformation = printFilingReceiptInformation;
_count = 0;
printDocument = new PrintDocument();
printDocument.DocumentName = "접수증";
printDocument.PrintPage += PrintPage;
printDocument.PrintPage += new PrintPageEventHandler(PrintPage);
printDocument.DefaultPageSettings.Margins.Top = Convert.ToInt32(50); printDocument.DefaultPageSettings.Margins.Left = Convert.ToInt32(50);
printDocument.DefaultPageSettings.Margins.Left = Convert.ToInt32(30);
printDocument.DefaultPageSettings.Margins.Right = Convert.ToInt32(30);
}
public void PrintPage(object sender, PrintPageEventArgs e)
public void Print()
{
PrintDialog printDialog = new PrintDialog();
printDialog.Document = printDocument;
if (printDialog.ShowDialog() == DialogResult.OK)
{
printDocument.Print();
}
}
private void PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawRectangle(new Pen(Brushes.Black, 3), e.MarginBounds.Left, e.MarginBounds.Top,
e.MarginBounds.Width, e.MarginBounds.Height);
@@ -64,6 +74,10 @@ namespace HSUCO_Cargo_Garage_Operation_Program
CenterTextWriter("화성도시공사 사장", new Font("맑은 고딕", 20, FontStyle.Bold), e.Graphics, totalWidth, e.MarginBounds.Top + 800);
_count++;
e.HasMorePages = _printFilingReceiptInformation.Count > _count;
if (!e.HasMorePages)
{
_count = 0;
}
}
private void CenterTextWriter(string text, Font font, Graphics g, int totalWidth, int posY)