Skip to content

Commit

Permalink
Add separate quotation option
Browse files Browse the repository at this point in the history
  • Loading branch information
woin2ee committed Jul 23, 2024
1 parent 3ca42ba commit cf13f98
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 14 deletions.
28 changes: 18 additions & 10 deletions MemoGenerator/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,25 @@
<CheckBox x:Name="transactionStatementCheckBox" Click="updatePaymentProofMethodComponent" Content="거래명세서"
IsChecked="{Binding InvoiceInfo.IncludesTransactionSpecification, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
IsEnabled="{Binding EnableInvoice}" />
<TextBlock Margin="10" FontWeight="Bold"
<StackPanel Margin="4" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" FontWeight="Bold"
Foreground="{Binding InvoiceHeaderColor}"
Text="사업자" />
<ComboBox x:Name="companyCheckBox" Margin="10,2,0,0"
IsEnabled="{Binding EnableInvoice}"
SelectedIndex="{Binding InvoiceInfo.SelectedBusinessIndex, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
SelectionChanged="updatePaymentProofMethodComponent">
<ComboBoxItem>미지정</ComboBoxItem>
<ComboBoxItem>일이삼사</ComboBoxItem>
<ComboBoxItem>대미기프트</ComboBoxItem>
</ComboBox>
</StackPanel>
<TextBlock Margin="4" VerticalAlignment="Center" FontWeight="Bold"
Foreground="{Binding InvoiceHeaderColor}"
Text="사업자" />
<ComboBox x:Name="companyCheckBox"
IsEnabled="{Binding EnableInvoice}"
SelectedIndex="{Binding InvoiceInfo.SelectedBusinessIndex, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
SelectionChanged="updatePaymentProofMethodComponent">
<ComboBoxItem>미지정</ComboBoxItem>
<ComboBoxItem>일이삼사</ComboBoxItem>
<ComboBoxItem>대미기프트</ComboBoxItem>
</ComboBox>
Text="옵션" />
<CheckBox Margin="4,0,0,0" Click="updatePaymentProofMethodComponent" Content="별도견적서"
IsChecked="{Binding InvoiceInfo.ExistsSeparateQuotation, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
IsEnabled="{Binding EnableInvoice}" />
</StackPanel>
<Frame Height="2" Margin="0,12,0,0" Background="DarkGray" />
<StackPanel x:Name="cardPanel">
Expand Down
24 changes: 20 additions & 4 deletions MemoGenerator/Model/MemoGenerating/PaymentProofModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private bool isToday
{
get
{
if (date is DateTime unwrapped) { return (DateTime.Today.Day == unwrapped.Day) && DateTime.Today.Month== unwrapped.Month; }
if (date is DateTime unwrapped) { return (DateTime.Today.Day == unwrapped.Day) && DateTime.Today.Month == unwrapped.Month; }
else { return false; }
}
}
Expand All @@ -39,6 +39,7 @@ private bool isToday
internal bool includesTransactionSpecification;
private readonly List<BusinessInfo> businessList;
internal BusinessInfo selectedBusiness;
internal bool existsSeparateQuotation;

internal InvoiceInfo()
{
Expand All @@ -48,6 +49,7 @@ internal InvoiceInfo()
this.includesTransactionSpecification = false;
this.businessList = GlobalSettings.Instance.businessInfos;
this.selectedBusiness = businessList.First();
this.existsSeparateQuotation = false;
}

// Binding
Expand Down Expand Up @@ -94,7 +96,8 @@ public bool IsToday
public bool IncludesInvoice
{
get => includesInvoice;
set {
set
{
includesInvoice = value;
if (owner.TryGetTarget(out var target))
{
Expand All @@ -120,6 +123,12 @@ public int SelectedBusinessIndex
get => businessList.IndexOf(selectedBusiness);
set { selectedBusiness = businessList[value]; }
}

public bool ExistsSeparateQuotation
{
get => existsSeparateQuotation;
set { existsSeparateQuotation = value; }
}
}

enum CardType
Expand Down Expand Up @@ -191,6 +200,11 @@ internal string memoComponent
elements.Add(businessName);
}

if (InvoiceInfo.existsSeparateQuotation)
{
elements.Add("별도견적서");
}

if (invoiceInfo.includesInvoice && invoiceInfo.includesTransactionSpecification)
{
switch (invoiceInfo.selectedInvoiceType)
Expand Down Expand Up @@ -253,7 +267,8 @@ internal PaymentProofModel()
public int SelectedPaymentProofTypeIndex
{
get => (int)paymentProofType;
set {
set
{
paymentProofType = (PaymentProofType)value;
propertyChanged("EnableInvoice");
propertyChanged("EnableInvoiceTypeRadioButtons");
Expand All @@ -276,7 +291,8 @@ public SolidColorBrush InvoiceHeaderColor
{
get
{
switch (paymentProofType) {
switch (paymentProofType)
{
case PaymentProofType.invoice:
return new SolidColorBrush(Colors.Black);
case PaymentProofType.card:
Expand Down

0 comments on commit cf13f98

Please sign in to comment.