Hide direct-debit purchase on positive diffs

This commit is contained in:
Rick Falkvinge
2017-12-31 08:25:45 +01:00
parent 50273d40b6
commit e71edaf55d
3 changed files with 50 additions and 47 deletions
+20 -20
View File
@@ -72,7 +72,7 @@
$('input#inputTextPurchaseDescription').val(data.TransactionDescription);
$('input#inputTextPurchaseAmount').val(data.AmountAsPurchase);
if (data.OpenPayoutData == null) // amount is positive
if (data.AmountSign == 1) // amount is positive
{
$('#divPositiveDifference').show();
$('#divNegativeDifference').hide();
@@ -322,6 +322,25 @@
<asp:Label runat="server" ID="LabelDescribePayoutForeign" Text="Match to payout XYZ" />
</div>
</div>
<p><input type="radio" id="RadioPurchase" name="TxOptions" value="Purchase" /><label for="RadioPurchase">&nbsp;<asp:Label runat="server" ID="LabelRadioPurchase" Text="Mark this as a direct-from-account purchase? XYZ" /></label></p>
<div id="radioOptionPurchase" class="radioOption">
<div class="entryFields">
<div class="stacked-input-control"><input type="text" value="" readonly="readonly" disabled="disabled" class="alignRight" id="inputTextPurchaseAmount"/></div>
<Swarmops5:ComboBudgets Layout="Vertical" ID="DropBudgetsPurchase" runat="server" ListType="InvoiceableIn" />
<div class="stacked-input-control"><input type="text" value="" id="inputTextPurchaseDescription"/></div>
<div class="onVatEnabled" style="display: none"><Swarmops5:CurrencyTextBox ID="CurrencyPurchaseVat" runat="server" Layout="Vertical"/></div>
<Swarmops5:FileUpload ID="UploadPurchase" runat="server"/>
<input type="button" value='#Balance#' class="buttonAccentColor" onclick="onCreateDirectPurchase(); return false;" id="buttonExecutePurchase"/>
</div>
<div class="entryLabels">
<div class="stacked-input-control"><asp:Label runat="server" ID="LabelDescribePurchaseAmount" Text="Direct purchase amount (CUR) XYZ" /></div>
<div class="stacked-input-control"><asp:Label runat="server" ID="LabelDescribePurchaseBudget" Text="Charge purchase to this budget XYZ" /></div>
<div class="stacked-input-control"><asp:Label runat="server" ID="LabelDescribePurchaseDescriptionUpdate" Text="Update transaction description XYZ" /></div>
<div class="onVatEnabled" style="display:none"><div class="stacked-input-control"><asp:Label runat="server" ID="LabelDescribePurchaseVatAmount" Text="VAT part of the amount XYZ" /></div></div>
<div class="stacked-input-control"><asp:Label runat="server" ID="LabelDescribePurchaseUploadReceipt" Text="Upload the receipt or other documentation XYZ" /></div>
</div>
<div style="clear:both"></div>
</div>
</div>
<div id="divPositiveDifference">
<div id="divOutboundInvoice">
@@ -337,25 +356,6 @@
</div>
</div>
</div>
<p><input type="radio" id="RadioPurchase" name="TxOptions" value="Purchase" /><label for="RadioPurchase">&nbsp;<asp:Label runat="server" ID="LabelRadioPurchase" Text="Mark this as a direct-from-account purchase? XYZ" /></label></p>
<div id="radioOptionPurchase" class="radioOption">
<div class="entryFields">
<div class="stacked-input-control"><input type="text" value="" readonly="readonly" disabled="disabled" class="alignRight" id="inputTextPurchaseAmount"/></div>
<Swarmops5:ComboBudgets Layout="Vertical" ID="DropBudgetsPurchase" runat="server" ListType="InvoiceableIn" />
<div class="stacked-input-control"><input type="text" value="" id="inputTextPurchaseDescription"/></div>
<div class="onVatEnabled" style="display: none"><Swarmops5:CurrencyTextBox ID="CurrencyPurchaseVat" runat="server" Layout="Vertical"/></div>
<Swarmops5:FileUpload ID="UploadPurchase" runat="server"/>
<input type="button" value='#Balance#' class="buttonAccentColor" onclick="onCreateDirectPurchase(); return false;" id="buttonExecutePurchase"/>
</div>
<div class="entryLabels">
<div class="stacked-input-control"><asp:Label runat="server" ID="LabelDescribePurchaseAmount" Text="Direct purchase amount (CUR) XYZ" /></div>
<div class="stacked-input-control"><asp:Label runat="server" ID="LabelDescribePurchaseBudget" Text="Charge purchase to this budget XYZ" /></div>
<div class="stacked-input-control"><asp:Label runat="server" ID="LabelDescribePurchaseDescriptionUpdate" Text="Update transaction description XYZ" /></div>
<div class="onVatEnabled" style="display:none"><div class="stacked-input-control"><asp:Label runat="server" ID="LabelDescribePurchaseVatAmount" Text="VAT part of the amount XYZ" /></div></div>
<div class="stacked-input-control"><asp:Label runat="server" ID="LabelDescribePurchaseUploadReceipt" Text="Upload the receipt or other documentation XYZ" /></div>
</div>
<div style="clear:both"></div>
</div>
<p><input type="radio" id="RadioBalance" name="TxOptions" value="Balance" /><label for="RadioBalance">&nbsp;<asp:Label runat="server" ID="LabelRadioBalance" Text="Balance the transaction manually? XYZ" /></label></p>
<div id="radioOptionBalance" class="radioOption"> <!-- this should go last -->
<div class="entryFields">
@@ -81,6 +81,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
public string TransactionDate { get; set; }
public string DifferingAmount { get; set; }
public string AmountAsPurchase { get; set; }
public int AmountSign { get; set; }
public string TransactionDescription { get; set; }
public DropdownOption[] OpenPayoutData { get; set; }
public DropdownOption[] OpenOutboundInvoiceData { get; set; }
@@ -137,11 +138,13 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
if (transaction.Rows.AmountCentsTotal > 0)
{
result.OpenOutboundInvoiceData = GetOpenOutboundInvoiceData(transaction);
result.AmountSign = 1;
}
else
{
// Negative difference
result.AmountSign = -1;
result.OpenPayoutData = GetOpenPayoutData(transaction);
}
+27 -27
View File
@@ -183,33 +183,6 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers {
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelDescribePayoutForeign;
/// <summary>
/// LabelRadioOutboundInvoice 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 LabelRadioOutboundInvoice;
/// <summary>
/// DropOpenOutboundInvoices control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Swarmops.Frontend.Controls.Base.DropDown DropOpenOutboundInvoices;
/// <summary>
/// LabelDescribeOutboundInvoice 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 LabelDescribeOutboundInvoice;
/// <summary>
/// LabelRadioPurchase control.
/// </summary>
@@ -291,6 +264,33 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers {
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelDescribePurchaseUploadReceipt;
/// <summary>
/// LabelRadioOutboundInvoice 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 LabelRadioOutboundInvoice;
/// <summary>
/// DropOpenOutboundInvoices control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Swarmops.Frontend.Controls.Base.DropDown DropOpenOutboundInvoices;
/// <summary>
/// LabelDescribeOutboundInvoice 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 LabelDescribeOutboundInvoice;
/// <summary>
/// LabelRadioBalance control.
/// </summary>