Enabled date to propagate for new invoices

This commit is contained in:
Rick Falkvinge
2021-07-07 13:29:59 +02:00
parent aba42087ae
commit e6b567edde
5 changed files with 13 additions and 23 deletions
+2 -2
View File
@@ -191,7 +191,7 @@ namespace Swarmops.Logic.Financial
}
}
public static InboundInvoice Create (Organization organization, DateTime dueDate, Int64 amountCents,
public static InboundInvoice Create (Organization organization, DateTime issuedDate, DateTime dueDate, Int64 amountCents,
Int64 vatCents, FinancialAccount budget, string supplier, string description, string payToAccount, string ocr,
string invoiceReference, Person creatingPerson)
{
@@ -210,7 +210,7 @@ namespace Swarmops.Logic.Financial
// Create a corresponding financial transaction with rows
FinancialTransaction transaction =
FinancialTransaction.Create (organization.Identity, DateTime.UtcNow,
FinancialTransaction.Create (organization.Identity, issuedDate == DateTime.Today? DateTime.UtcNow: issuedDate.AddHours(12),
"Invoice #" + newInvoice.OrganizationSequenceId + " from " + supplier);
transaction.AddRow (organization.FinancialAccounts.DebtsInboundInvoices, -amountCents, creatingPerson);
+1 -1
View File
@@ -42,7 +42,7 @@ namespace Swarmops.Frontend.Controls.Base
set
{
this.InterpretedDate.Value = value.ToString(CultureInfo.InvariantCulture);
this.TextInput.Text = value.ToString("YYYY MMM dd");
this.TextInput.Text = value.ToString("yyyy MMM dd");
}
}
@@ -147,7 +147,6 @@
<asp:HiddenField ID="HiddenTagSetIdentifiers" runat="server"/>
<div class="data-entry-fields">
<Swarmops5:DateTextBox runat="server" ID="DateInvoiceIssued"/>
<div class="stacked-input-control"><asp:TextBox runat="server" ID="TextInvoiceDate"/></div>
<div class="stacked-input-control"><asp:TextBox runat="server" ID="TextSupplier" /></div>
<Swarmops5:CurrencyAmount runat="server" ID="CurrencyAmount" />
<span class="vatEnabled"><Swarmops5:CurrencyAmount runat="server" ID="CurrencyVat" /></span>
@@ -170,11 +169,11 @@
<asp:Button ID="ButtonCreate" runat="server" CssClass="button-accent-color suppress-input-focus" OnClientClick="return validateFields();" OnClick="ButtonCreate_Click" Text="Create"/>
</div>
<div class="data-entry-labels">
<asp:Label runat="server" ID="LabelInvoiceDate"/><br/>
<asp:Label runat="server" ID="LabelDateInvoiceIssued"/><br/>
<asp:Label runat="server" ID="LabelSupplier" /><br/>
<asp:Label runat="server" ID="LabelAmount" /><br/>
<span class="vatEnabled"><asp:Label runat="server" ID="LabelVat" /><br/></span>
<asp:Label runat="server" ID="LabelDueDate" /><br/>
<asp:Label runat="server" ID="LabelDateInvoiceDue" /><br/>
<asp:Label runat="server" ID="LabelPurpose" /><br/>
<asp:Label runat="server" ID="LabelBudget" /><br/>
<asp:Repeater ID="RepeaterTagLabels" runat="server"><ItemTemplate><%# Eval("TagSetLocalizedName") %><br/></ItemTemplate></asp:Repeater>
@@ -113,10 +113,10 @@ namespace Swarmops.Frontend.Pages.v5.Financial
private void Localize()
{
this.LabelInvoiceDate.Text = LocalizedStrings.Get(LocDomain.PagesFinancial,
this.LabelDateInvoiceIssued.Text = LocalizedStrings.Get(LocDomain.PagesFinancial,
"CreateInboundInvoice_InvoiceDate");
this.LabelSupplier.Text = LocalizedStrings.Get(LocDomain.Global, "Financial_Supplier");
this.LabelDueDate.Text = this.LabelInvoiceDate.Text = LocalizedStrings.Get(LocDomain.Global, "Financial_DueDate");
this.LabelDateInvoiceDue.Text = LocalizedStrings.Get(LocDomain.Global, "Financial_DueDate");
this.LabelAmount.Text = string.Format (LocalizedStrings.Get(LocDomain.PagesFinancial, "CreateInboundInvoice_Amount"),
CurrentOrganization.Currency.Code);
this.LabelVat.Text = string.Format(LocalizedStrings.Get(LocDomain.PagesFinancial, "CreateInboundInvoice_AmountVat"),
@@ -143,9 +143,9 @@ namespace Swarmops.Frontend.Pages.v5.Financial
string description = this.TextPurpose.Text;
DateTime issuedDate = this.DateInvoiceIssued.Value;
DateTime dueDate = this.DateInvoiceDue.Value;
FinancialAccount budget = this.ComboBudgets.SelectedAccount;
// sanity check
@@ -165,7 +165,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
throw new InvalidOperationException ("No documents uploaded");
}
InboundInvoice invoice = InboundInvoice.Create (CurrentOrganization, dueDate, amountCents, amountVatCents, budget,
InboundInvoice invoice = InboundInvoice.Create (CurrentOrganization, issuedDate, dueDate, amountCents, amountVatCents, budget,
this.TextSupplier.Text, this.TextPurpose.Text, this.TextAccount.Text, string.Empty,
this.TextReference.Text, CurrentUser);
+4 -13
View File
@@ -57,15 +57,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial {
/// </remarks>
protected global::Swarmops.Frontend.Controls.Base.DateTextBox DateInvoiceIssued;
/// <summary>
/// TextInvoiceDate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox TextInvoiceDate;
/// <summary>
/// TextSupplier control.
/// </summary>
@@ -166,13 +157,13 @@ namespace Swarmops.Frontend.Pages.v5.Financial {
protected global::System.Web.UI.WebControls.Button ButtonCreate;
/// <summary>
/// LabelInvoiceDate control.
/// LabelDateInvoiceIssued control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelInvoiceDate;
protected global::System.Web.UI.WebControls.Label LabelDateInvoiceIssued;
/// <summary>
/// LabelSupplier control.
@@ -202,13 +193,13 @@ namespace Swarmops.Frontend.Pages.v5.Financial {
protected global::System.Web.UI.WebControls.Label LabelVat;
/// <summary>
/// LabelDueDate control.
/// LabelDateInvoiceDue control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelDueDate;
protected global::System.Web.UI.WebControls.Label LabelDateInvoiceDue;
/// <summary>
/// LabelPurpose control.