IncomingInvoiceHandlers.cs
5.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Contracts.IncomingInvoice;
using Sungero.Core;
using Sungero.CoreEntities;
namespace Sungero.Contracts
{
partial class IncomingInvoiceClientHandlers
{
public virtual void ContractValueInput(Sungero.Contracts.Client.IncomingInvoiceContractValueInputEventArgs e)
{
this._obj.State.Properties.Contract.HighlightColor = Sungero.Core.Colors.Empty;
}
public override void Refresh(Sungero.Presentation.FormRefreshEventArgs e)
{
base.Refresh(e);
// Контрагент не дб задизейблен, если незаполнен.
if (_obj.Counterparty == null)
_obj.State.Properties.Counterparty.IsEnabled = true;
}
public override void Closing(Sungero.Presentation.FormClosingEventArgs e)
{
base.Closing(e);
_obj.State.Properties.Number.IsRequired = false;
_obj.State.Properties.Date.IsRequired = false;
_obj.State.Properties.TotalAmount.IsRequired = false;
_obj.State.Properties.Currency.IsRequired = false;
}
public override void CounterpartyValueInput(Sungero.Docflow.Client.AccountingDocumentBaseCounterpartyValueInputEventArgs e)
{
base.CounterpartyValueInput(e);
if (Functions.IncomingInvoice.HaveDuplicates(_obj, _obj.DocumentKind, _obj.Number, _obj.Date, _obj.TotalAmount, _obj.Currency, e.NewValue))
e.AddWarning(IncomingInvoices.Resources.DuplicateDetected,
_obj.Info.Properties.DocumentKind,
_obj.Info.Properties.Number,
_obj.Info.Properties.Date,
_obj.Info.Properties.TotalAmount,
_obj.Info.Properties.Currency,
_obj.Info.Properties.Counterparty);
}
public override void CurrencyValueInput(Sungero.Docflow.Client.AccountingDocumentBaseCurrencyValueInputEventArgs e)
{
base.CurrencyValueInput(e);
if (Functions.IncomingInvoice.HaveDuplicates(_obj, _obj.DocumentKind, _obj.Number, _obj.Date, _obj.TotalAmount, e.NewValue, _obj.Counterparty))
e.AddWarning(IncomingInvoices.Resources.DuplicateDetected,
_obj.Info.Properties.DocumentKind,
_obj.Info.Properties.Number,
_obj.Info.Properties.Date,
_obj.Info.Properties.TotalAmount,
_obj.Info.Properties.Currency,
_obj.Info.Properties.Counterparty);
}
public override void DateValueInput(Sungero.Presentation.DateTimeValueInputEventArgs e)
{
base.DateValueInput(e);
if (e.NewValue != null && e.NewValue >= Calendar.SqlMinValue)
{
if (Functions.IncomingInvoice.HaveDuplicates(_obj, _obj.DocumentKind, _obj.Number, e.NewValue, _obj.TotalAmount, _obj.Currency, _obj.Counterparty))
e.AddWarning(IncomingInvoices.Resources.DuplicateDetected,
_obj.Info.Properties.DocumentKind,
_obj.Info.Properties.Number,
_obj.Info.Properties.Date,
_obj.Info.Properties.TotalAmount,
_obj.Info.Properties.Currency,
_obj.Info.Properties.Counterparty);
}
this._obj.State.Properties.Date.HighlightColor = Sungero.Core.Colors.Empty;
}
public override void NumberValueInput(Sungero.Presentation.StringValueInputEventArgs e)
{
base.NumberValueInput(e);
if (Functions.IncomingInvoice.HaveDuplicates(_obj, _obj.DocumentKind, e.NewValue, _obj.Date, _obj.TotalAmount, _obj.Currency, _obj.Counterparty))
e.AddWarning(IncomingInvoices.Resources.DuplicateDetected,
_obj.Info.Properties.DocumentKind,
_obj.Info.Properties.Number,
_obj.Info.Properties.Date,
_obj.Info.Properties.TotalAmount,
_obj.Info.Properties.Currency,
_obj.Info.Properties.Counterparty);
this._obj.State.Properties.Number.HighlightColor = Sungero.Core.Colors.Empty;
}
public override void DocumentKindValueInput(Sungero.Docflow.Client.OfficialDocumentDocumentKindValueInputEventArgs e)
{
base.DocumentKindValueInput(e);
if (Functions.IncomingInvoice.HaveDuplicates(_obj, e.NewValue, _obj.Number, _obj.Date, _obj.TotalAmount, _obj.Currency, _obj.Counterparty))
e.AddWarning(IncomingInvoices.Resources.DuplicateDetected,
_obj.Info.Properties.DocumentKind,
_obj.Info.Properties.Number,
_obj.Info.Properties.Date,
_obj.Info.Properties.TotalAmount,
_obj.Info.Properties.Currency,
_obj.Info.Properties.Counterparty);
}
public override void TotalAmountValueInput(Sungero.Presentation.DoubleValueInputEventArgs e)
{
if (e.NewValue <= 0)
e.AddError(IncomingInvoices.Resources.TotalAmountMustBePositive);
base.TotalAmountValueInput(e);
if (Functions.IncomingInvoice.HaveDuplicates(_obj, _obj.DocumentKind, _obj.Number, _obj.Date, e.NewValue, _obj.Currency, _obj.Counterparty))
e.AddWarning(IncomingInvoices.Resources.DuplicateDetected,
_obj.Info.Properties.DocumentKind,
_obj.Info.Properties.Number,
_obj.Info.Properties.Date,
_obj.Info.Properties.TotalAmount,
_obj.Info.Properties.Currency,
_obj.Info.Properties.Counterparty);
}
}
}