이용요금 1월단위로 변경

그에 맞춰 환불도 수정
This commit is contained in:
2023-09-30 15:17:27 +09:00
parent 61d6070333
commit 20a871354d
5 changed files with 120 additions and 15 deletions

View File

@@ -244,7 +244,7 @@
this.groupBox2.Size = new System.Drawing.Size(302, 100); this.groupBox2.Size = new System.Drawing.Size(302, 100);
this.groupBox2.TabIndex = 20; this.groupBox2.TabIndex = 20;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "이용 금액(1)"; this.groupBox2.Text = "이용 금액(1)";
// //
// metroLabel1 // metroLabel1
// //

View File

@@ -47,6 +47,8 @@
this.metroComboBox_SearchType = new MetroFramework.Controls.MetroComboBox(); this.metroComboBox_SearchType = new MetroFramework.Controls.MetroComboBox();
this.dataGridView_List = new System.Windows.Forms.DataGridView(); this.dataGridView_List = new System.Windows.Forms.DataGridView();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.metroButton1 = new MetroFramework.Controls.MetroButton();
this.metroButton2 = new MetroFramework.Controls.MetroButton();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.metroPanel1.SuspendLayout(); this.metroPanel1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
@@ -100,6 +102,8 @@
// //
// metroPanel1 // metroPanel1
// //
this.metroPanel1.Controls.Add(this.metroButton2);
this.metroPanel1.Controls.Add(this.metroButton1);
this.metroPanel1.Controls.Add(this.metroButton_UpdateUserData); this.metroPanel1.Controls.Add(this.metroButton_UpdateUserData);
this.metroPanel1.Controls.Add(this.metroButton_Certificate); this.metroPanel1.Controls.Add(this.metroButton_Certificate);
this.metroPanel1.Controls.Add(this.metroButton_ExportExcel); this.metroPanel1.Controls.Add(this.metroButton_ExportExcel);
@@ -115,7 +119,7 @@
this.metroPanel1.Location = new System.Drawing.Point(0, 0); this.metroPanel1.Location = new System.Drawing.Point(0, 0);
this.metroPanel1.Margin = new System.Windows.Forms.Padding(0); this.metroPanel1.Margin = new System.Windows.Forms.Padding(0);
this.metroPanel1.Name = "metroPanel1"; this.metroPanel1.Name = "metroPanel1";
this.metroPanel1.Size = new System.Drawing.Size(750, 470); this.metroPanel1.Size = new System.Drawing.Size(750, 600);
this.metroPanel1.TabIndex = 0; this.metroPanel1.TabIndex = 0;
this.metroPanel1.VerticalScrollbarBarColor = true; this.metroPanel1.VerticalScrollbarBarColor = true;
this.metroPanel1.VerticalScrollbarHighlightOnWheel = false; this.metroPanel1.VerticalScrollbarHighlightOnWheel = false;
@@ -151,7 +155,7 @@
this.metroButton_ExportExcel.BackgroundImage = global::HSUCO_Cargo_Garage_Operation_Program.Properties.Resources.file_type_excel_icon_130611; 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.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.metroButton_ExportExcel.FontSize = MetroFramework.MetroButtonSize.Tall; this.metroButton_ExportExcel.FontSize = MetroFramework.MetroButtonSize.Tall;
this.metroButton_ExportExcel.Location = new System.Drawing.Point(626, 335); this.metroButton_ExportExcel.Location = new System.Drawing.Point(626, 465);
this.metroButton_ExportExcel.Name = "metroButton_ExportExcel"; this.metroButton_ExportExcel.Name = "metroButton_ExportExcel";
this.metroButton_ExportExcel.Size = new System.Drawing.Size(121, 115); this.metroButton_ExportExcel.Size = new System.Drawing.Size(121, 115);
this.metroButton_ExportExcel.TabIndex = 9; this.metroButton_ExportExcel.TabIndex = 9;
@@ -162,7 +166,7 @@
// //
this.metroButton_Refund.Anchor = System.Windows.Forms.AnchorStyles.Right; this.metroButton_Refund.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.metroButton_Refund.FontSize = MetroFramework.MetroButtonSize.Tall; this.metroButton_Refund.FontSize = MetroFramework.MetroButtonSize.Tall;
this.metroButton_Refund.Location = new System.Drawing.Point(626, 289); this.metroButton_Refund.Location = new System.Drawing.Point(626, 420);
this.metroButton_Refund.Name = "metroButton_Refund"; this.metroButton_Refund.Name = "metroButton_Refund";
this.metroButton_Refund.Size = new System.Drawing.Size(121, 40); this.metroButton_Refund.Size = new System.Drawing.Size(121, 40);
this.metroButton_Refund.TabIndex = 8; this.metroButton_Refund.TabIndex = 8;
@@ -174,7 +178,7 @@
// //
this.metroButton_Extended.Anchor = System.Windows.Forms.AnchorStyles.Right; this.metroButton_Extended.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.metroButton_Extended.FontSize = MetroFramework.MetroButtonSize.Tall; this.metroButton_Extended.FontSize = MetroFramework.MetroButtonSize.Tall;
this.metroButton_Extended.Location = new System.Drawing.Point(626, 243); this.metroButton_Extended.Location = new System.Drawing.Point(626, 374);
this.metroButton_Extended.Name = "metroButton_Extended"; this.metroButton_Extended.Name = "metroButton_Extended";
this.metroButton_Extended.Size = new System.Drawing.Size(121, 40); this.metroButton_Extended.Size = new System.Drawing.Size(121, 40);
this.metroButton_Extended.TabIndex = 8; this.metroButton_Extended.TabIndex = 8;
@@ -294,16 +298,38 @@
this.dataGridView_List.ReadOnly = true; this.dataGridView_List.ReadOnly = true;
this.dataGridView_List.RowTemplate.Height = 23; this.dataGridView_List.RowTemplate.Height = 23;
this.dataGridView_List.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView_List.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView_List.Size = new System.Drawing.Size(600, 330); this.dataGridView_List.Size = new System.Drawing.Size(600, 460);
this.dataGridView_List.TabIndex = 6; this.dataGridView_List.TabIndex = 6;
// //
// metroButton1
//
this.metroButton1.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.metroButton1.FontSize = MetroFramework.MetroButtonSize.Tall;
this.metroButton1.Location = new System.Drawing.Point(626, 233);
this.metroButton1.Name = "metroButton1";
this.metroButton1.Size = new System.Drawing.Size(121, 40);
this.metroButton1.TabIndex = 14;
this.metroButton1.Text = "결재 확인";
this.metroButton1.UseSelectable = true;
//
// metroButton2
//
this.metroButton2.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.metroButton2.FontSize = MetroFramework.MetroButtonSize.Tall;
this.metroButton2.Location = new System.Drawing.Point(626, 279);
this.metroButton2.Name = "metroButton2";
this.metroButton2.Size = new System.Drawing.Size(121, 40);
this.metroButton2.TabIndex = 15;
this.metroButton2.Text = "결재대기 삭제";
this.metroButton2.UseSelectable = true;
//
// UserList // UserList
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.metroPanel1); this.Controls.Add(this.metroPanel1);
this.Name = "UserList"; this.Name = "UserList";
this.Size = new System.Drawing.Size(750, 470); this.Size = new System.Drawing.Size(750, 600);
this.Load += new System.EventHandler(this.ApplicantList_Load); this.Load += new System.EventHandler(this.ApplicantList_Load);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
@@ -335,5 +361,7 @@
private MetroFramework.Controls.MetroButton metroButton_ExportExcel; private MetroFramework.Controls.MetroButton metroButton_ExportExcel;
private MetroFramework.Controls.MetroButton metroButton_Certificate; private MetroFramework.Controls.MetroButton metroButton_Certificate;
private MetroFramework.Controls.MetroButton metroButton_UpdateUserData; private MetroFramework.Controls.MetroButton metroButton_UpdateUserData;
private MetroFramework.Controls.MetroButton metroButton2;
private MetroFramework.Controls.MetroButton metroButton1;
} }
} }

View File

@@ -225,8 +225,14 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
if (getRefundInformation.ExtensionStart < refundDateTime) if (getRefundInformation.ExtensionStart < refundDateTime)
{ {
// 연장 시작 부와 비교 // 연장 시작 부와 비교
var leftDays = (getRefundInformation.DateEnd - refundDateTime).TotalDays + 1; ProgressDays progressDays = Extends.GetProgressDays(refundDateTime, getRefundInformation.DateEnd);
int leftAmount = (getRefundInformation.ExtensionFee / 365) * (int)leftDays; int totalMonth = Extends.GetProgressMonth(getRefundInformation.ExtensionStart.Year, getRefundInformation.ExtensionStart.Month, getRefundInformation.DateEnd.Year, getRefundInformation.DateEnd.Month);
int monthAmount = getRefundInformation.ExtensionFee / totalMonth;
int leftAmount = progressDays.Month * monthAmount;
if (progressDays.StartDay != 0)
{
leftAmount += (monthAmount / progressDays.StartTotalDay) * (progressDays.StartTotalDay - progressDays.StartDay);
}
if (leftAmount > 0) if (leftAmount > 0)
{ {
leftAmount = leftAmount / 10 * 10; leftAmount = leftAmount / 10 * 10;
@@ -237,14 +243,21 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
} }
else else
{ {
// 최초 이용일에서 남은 이용일 게산 DateTime endDate = getRefundInformation.ExtensionStart.AddDays(-1);
var leftDays = (getRefundInformation.ExtensionStart.AddDays(-1) - refundDateTime).TotalDays + 1; ProgressDays progressDays = Extends.GetProgressDays(refundDateTime, endDate);
int leftAmount = (getRefundInformation.BaseFee / 365) * (int)leftDays; int totalMonth = Extends.GetProgressMonth(getRefundInformation.DateStart.Year, getRefundInformation.DateStart.Month, endDate.Year, endDate.Month);
if(leftAmount > 0) int monthAmount = getRefundInformation.BaseFee / totalMonth;
int leftAmount = progressDays.Month * monthAmount;
if (progressDays.StartDay != 0)
{
leftAmount += (monthAmount / progressDays.StartTotalDay) * (progressDays.StartTotalDay - progressDays.StartDay);
}
if (leftAmount > 0)
{ {
leftAmount = leftAmount / 10 * 10; leftAmount = leftAmount / 10 * 10;
} }
totalAmount += leftAmount; totalAmount += leftAmount;
// 연장 부분 전체
totalAmount += getRefundInformation.ExtensionFee; totalAmount += getRefundInformation.ExtensionFee;
} }
// 연장한 경우 // 연장한 경우
@@ -253,8 +266,14 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
{ {
// 연장안한경우 // 연장안한경우
var leftDays = (getRefundInformation.DateEnd - refundDateTime).TotalDays + 1; ProgressDays progressDays = Extends.GetProgressDays(refundDateTime, getRefundInformation.DateEnd);
int leftAmount = (getRefundInformation.ExtensionFee / 365) * (int)leftDays; int totalMonth = Extends.GetProgressMonth(getRefundInformation.DateStart.Year, getRefundInformation.DateStart.Month, getRefundInformation.DateEnd.Year, getRefundInformation.DateEnd.Month);
int monthAmount = getRefundInformation.BaseFee / totalMonth;
int leftAmount = progressDays.Month * monthAmount;
if(progressDays.StartDay != 0)
{
leftAmount += (monthAmount / progressDays.StartTotalDay) * (progressDays.StartTotalDay - progressDays.StartDay);
}
if (leftAmount > 0) if (leftAmount > 0)
{ {
leftAmount = leftAmount / 10 * 10; leftAmount = leftAmount / 10 * 10;

View File

@@ -21,3 +21,5 @@ UserList Status =
0 결재 대기 0 결재 대기
1 결재 완료 1 결재 완료
2 환불 2 환불
// 무조건 이용시작일은 1일로 고정, 이용종료일을 마지막날로 고정임

View File

@@ -48,8 +48,64 @@ namespace HSUCO_Cargo_Garage_Operation_Program
{ {
return value ? 1 : 0; return value ? 1 : 0;
} }
public static ProgressDays GetProgressDays(DateTime start, DateTime end)
{
ProgressDays progressDays = new ProgressDays();
DateTime midDay = new DateTime(start.Year, start.Month, 1);
if (start.Day != 1)
{
progressDays.StartDay = start.Day;
progressDays.StartTotalDay = DateTime.DaysInMonth(start.Year, start.Month);
midDay = midDay.AddMonths(1);
}
int month = 0;
while (true)
{
DateTime get = new DateTime(midDay.Year, midDay.Month, DateTime.DaysInMonth(midDay.Year, midDay.Month));
if (get <= end.Date)
{
month++;
midDay = midDay.AddMonths(1);
} }
else
{
break;
}
}
return progressDays;
}
public static int GetProgressMonth(int startYear, int startMonth, int endYear, int endMonth)
{
DateTime progressDate = new DateTime(startYear, startMonth, 1);
DateTime endDate = new DateTime(endYear, endMonth, DateTime.DaysInMonth(endYear, endMonth));
int month = 0;
while (true)
{
if (progressDate <= endDate.Date)
{
month++;
progressDate = progressDate.AddMonths(1);
}
else
{
break;
}
}
return month;
}
}
public struct ProgressDays
{
public int StartDay;
public int StartTotalDay;
public int Month;
}
} }