Checkpoint commit on transaction inspection
This commit is contained in:
@@ -147,7 +147,6 @@ namespace Swarmops.Logic.Support
|
||||
.SetDocumentForeignObject (Identity, GetDocumentTypeForObject (foreignObject), foreignObject.Identity);
|
||||
}
|
||||
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
// Unlink, actually
|
||||
@@ -166,5 +165,18 @@ namespace Swarmops.Logic.Support
|
||||
{
|
||||
return GetReader (Encoding.GetEncoding (encodingCodePage));
|
||||
}
|
||||
|
||||
public Person UploadedByPerson
|
||||
{
|
||||
get
|
||||
{
|
||||
if (base.UploadedByPersonId > 0)
|
||||
{
|
||||
return Person.FromIdentity (base.UploadedByPersonId);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@
|
||||
<value>Expense</value>
|
||||
</data>
|
||||
<data name="Financial_ExpenseClaimSpecification" xml:space="preserve">
|
||||
<value>Expense #{0}</value>
|
||||
<value>Expense #{0:N0}</value>
|
||||
</data>
|
||||
<data name="Financial_ExpenseClaimsSpecification" xml:space="preserve">
|
||||
<value>Expenses {0}</value>
|
||||
@@ -337,10 +337,10 @@
|
||||
<comment>List of shortcuts to related actions to current one</comment>
|
||||
</data>
|
||||
<data name="Financial_ExpenseClaimSpecificationLessAdvance" xml:space="preserve">
|
||||
<value>Expense #{0} (minus advance #{1})</value>
|
||||
<value>Expense #{0:N0} (minus advance #{1:N0})</value>
|
||||
</data>
|
||||
<data name="Financial_ExpenseClaimSpecificationLessAdvances" xml:space="preserve">
|
||||
<value>Expense #{0} (minus advances)</value>
|
||||
<value>Expense #{0:N0} (minus advances)</value>
|
||||
</data>
|
||||
<data name="Financial_ExpenseClaimsSpecificationLessAdvance" xml:space="preserve">
|
||||
<value>Expenses {0} (minus advance #{1})</value>
|
||||
@@ -349,10 +349,10 @@
|
||||
<value>Expenses {0} (minus advances)</value>
|
||||
</data>
|
||||
<data name="Financial_ExpenseClaimSpecificationWithClaimer" xml:space="preserve">
|
||||
<value>Expense Claim #{0} by {1}</value>
|
||||
<value>Expense Claim #{0:N0} by {1}</value>
|
||||
</data>
|
||||
<data name="Financial_InboundInvoiceSpecificationWithSender" xml:space="preserve">
|
||||
<value>Inbound Invoice #{0} from {1}</value>
|
||||
<value>Inbound Invoice #{0:N0} from {1}</value>
|
||||
</data>
|
||||
<data name="Financial_ReceiptSpecification" xml:space="preserve">
|
||||
<value>Receipt Image {0} of {1}</value>
|
||||
@@ -580,4 +580,29 @@
|
||||
<value>define to enable</value>
|
||||
<comment>shown as watermark on some edit boxes</comment>
|
||||
</data>
|
||||
<data name="Financial_CashAdvanceLongSpecificationWithRecipient" xml:space="preserve">
|
||||
<value>Cash Advance #{0:N0} for {1}</value>
|
||||
</data>
|
||||
<data name="Financial_CashAdvancePaybackSpecification" xml:space="preserve">
|
||||
<value>Cash Advance #{0:N0} Payback </value>
|
||||
</data>
|
||||
<data name="Financial_CashAdvancePaybacksSpecification" xml:space="preserve">
|
||||
<value>Cash Advances {0} Payback</value>
|
||||
</data>
|
||||
<data name="Financial_CashAdvancesLongSpecificationWithRecipient" xml:space="preserve">
|
||||
<value>Cash Advances {0} for {1}</value>
|
||||
</data>
|
||||
<data name="Financial_ExpenseClaimLongSpecification" xml:space="preserve">
|
||||
<value>Expense Claim #{0:N0}</value>
|
||||
</data>
|
||||
<data name="Financial_ExpenseClaimsSpecificationWithClaimer" xml:space="preserve">
|
||||
<value>Expense Claims {0} by {1}</value>
|
||||
</data>
|
||||
<data name="Financial_InboundInvoiceSpecification" xml:space="preserve">
|
||||
<value>Inbound Invoice #{0:N0}</value>
|
||||
</data>
|
||||
<data name="Global_System" xml:space="preserve">
|
||||
<value>System</value>
|
||||
<comment>as in "Created by: System" for roles, transactions etc.</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -625,6 +625,32 @@
|
||||
<value>Logged</value>
|
||||
</data>
|
||||
<data name="InspectLedgers_UnbalancedTransaction" xml:space="preserve">
|
||||
<value>Transaction is <span class="spanAnnoyingBlink">UNBALANCED</span>:</value>
|
||||
<value>Transaction is <span class="spanAnnoyingBlink">UNBALANCED:</span> missing amount</value>
|
||||
</data>
|
||||
<data name="InspectLedgers_HeaderAddTransactionRow" xml:space="preserve">
|
||||
<value>Add rows to transaction</value>
|
||||
<comment>(you can't really edit a transaction, just add more rows to it)</comment>
|
||||
</data>
|
||||
<data name="InspectLedgers_HeaderAutoTransactionTracking" xml:space="preserve">
|
||||
<value>Autotransaction tracking details</value>
|
||||
<comment>(this means the transaction is locked from editing)</comment>
|
||||
</data>
|
||||
<data name="InspectLedgers_TxDetail_AttestedByX" xml:space="preserve">
|
||||
<value>Attested by {0} on {1:yyyy-MMM-dd}</value>
|
||||
</data>
|
||||
<data name="InspectLedgers_TxDetail_CombinedWith" xml:space="preserve">
|
||||
<value>combined with</value>
|
||||
<comment>Inserted between transaction causes.</comment>
|
||||
</data>
|
||||
<data name="InspectLedgers_TxDetail_InvoiceX" xml:space="preserve">
|
||||
<value><strong>Inbound Invoice #{0:N0}</strong> from {1}:</value>
|
||||
<comment>the {1} is the supplier name</comment>
|
||||
</data>
|
||||
<data name="InspectLedgers_TxDetail_ThisIsPayoutX" xml:space="preserve">
|
||||
<value>This is <strong>Payout #{0:N0}.</strong> It's a payout for</value>
|
||||
</data>
|
||||
<data name="InspectLedgers_TxDetail_ValidatedByX" xml:space="preserve">
|
||||
<value>Document validation by {0} on {1:yyyy-MMM-dd}</value>
|
||||
<comment>"Document" refers to receipts, invoices, etc.</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -46,7 +46,10 @@
|
||||
});
|
||||
|
||||
$('#gridTransaction').datagrid({
|
||||
onLoadSuccess: function() {}
|
||||
onLoadSuccess: function() {
|
||||
$('#gridTransaction').datagrid('resize');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#<%=DropYears.ClientID %>').change(function () {
|
||||
@@ -66,8 +69,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('div.datagrid').css('opacity', 0.4);
|
||||
});
|
||||
|
||||
@@ -99,13 +100,46 @@
|
||||
$('#divModalCover').fadeIn();
|
||||
|
||||
$('#gridTransaction').datagrid({ url: 'Json-InspectLedgerTxData.aspx?TxId=' + transactionId });
|
||||
|
||||
var jsonData = {};
|
||||
jsonData.txId = transactionId;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/Pages/v5/Ledgers/InspectLedgers.aspx/GetTransactionTracking",
|
||||
data: $.toJSON(jsonData),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (msg) {
|
||||
if (msg.d.length > 1) {
|
||||
$('#divTransactionTrackingDetails').html(msg.d);
|
||||
$('#divTransactionTrackingDetails').show();
|
||||
$('#divEditTransaction').hide();
|
||||
} else {
|
||||
$('#divTransactionTrackingDetails').hide();
|
||||
$('#divEditTransaction').show();
|
||||
}
|
||||
},
|
||||
error: function (msg) {
|
||||
alertify.error("<%= Resources.Global.Error_AjaxCallException %>");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onTransactionTrackingLoaded(data) {
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
function onFlagTransaction(transactionId) {
|
||||
alertify.log('<asp:Label ID="LabelFlagNotAvailable" runat="server" />');
|
||||
|
||||
}
|
||||
|
||||
// the variables below only handle the cosmetics and not actual access
|
||||
var canSeeDetail = <asp:Literal ID="LiteralDetailAccess" runat="server" />;
|
||||
var canWriteRows = <asp:Literal ID="LiteralWriteAccess" runat="server" />;
|
||||
var canAuditTx = <asp:Literal ID="LiteralAuditAccess" runat="server" />;
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -167,25 +201,34 @@
|
||||
<div id="divModalBox" class="box modal">
|
||||
<div class="content">
|
||||
<div class="divIconCloseModal"><img id="IconCloseEdit" src="/Images/Icons/iconshock-cross-16px.png" /></div><h2><asp:Literal ID="LiteralEditHeader" runat="server"/></h2>
|
||||
<table id="gridTransaction" class="easyui-datagrid" style="width:100%;height:240px"
|
||||
<table id="gridTransaction" class="easyui-datagrid" style="width:100%"
|
||||
data-options="rownumbers:false,singleSelect:false,nowrap:false,fitColumns:true,fit:true,showFooter:false,loading:false,selectOnCheck:true,checkOnSelect:true,url:'Json-InspectLedgerTxData.aspx'"
|
||||
idField="id">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-options="field:'accountName',width:270"><asp:Label ID="LabelGridHeaderAccountName" runat="server" Text="XYZ Description" /></th>
|
||||
<th data-options="field:'deltaPos',width:70,align:'right'"><asp:Label ID="LabelGridHeaderDeltaPositive2" runat="server" Text="XYZ Debit" /></th>
|
||||
<th data-options="field:'deltaNeg',width:70,align:'right'"><asp:Label ID="LabelGridHeaderDeltaNegative2" runat="server" Text="XYZ Credit" /></th>
|
||||
<th data-options="field:'dateTime',width:90"><asp:Label ID="LabelGridHeaderDateTimeEntered" runat="server" Text="XYZ DateTime" /></th>
|
||||
<th data-options="field:'initials',width:50"><asp:Label ID="LabelGridHeaderInitials" runat="server" Text="ID#"/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div id="DivModalFields" class="entryFields">
|
||||
ModalFields
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-options="field:'accountName',width:270"><asp:Label ID="LabelGridHeaderAccountName" runat="server" Text="XYZ Description" /></th>
|
||||
<th data-options="field:'deltaPos',width:70,align:'right'"><asp:Label ID="LabelGridHeaderDeltaPositive2" runat="server" Text="XYZ Debit" /></th>
|
||||
<th data-options="field:'deltaNeg',width:70,align:'right'"><asp:Label ID="LabelGridHeaderDeltaNegative2" runat="server" Text="XYZ Credit" /></th>
|
||||
<th data-options="field:'dateTime',width:90"><asp:Label ID="LabelGridHeaderDateTimeEntered" runat="server" Text="XYZ DateTime" /></th>
|
||||
<th data-options="field:'initials',width:50"><asp:Label ID="LabelGridHeaderInitials" runat="server" Text="ID#"/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<div id="divEditTransaction">
|
||||
<h2><asp:Label ID="LabelAddTransactionRowsHeader" runat="server" /></h2>
|
||||
<div id="divModalFields" class="entryFields">
|
||||
ModalFields
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
entryLabels
|
||||
</div>
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
entryLabels
|
||||
<div id="divTransactionTracking">
|
||||
<h2><asp:Label ID="LabelTrackedTransactionHeader" runat="server" /></h2>
|
||||
<div id="divTransactionTrackingDetails"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.UI.WebControls;
|
||||
using Resources;
|
||||
using Swarmops.Common.Enums;
|
||||
using Swarmops.Common.Interfaces;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Support;
|
||||
|
||||
namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
{
|
||||
@@ -69,13 +77,17 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
this.LabelGridHeaderId.Text = Resources.Pages.Ledgers.InspectLedgers_TransactionId;
|
||||
|
||||
this.LabelGridHeaderAccountName.Text = Resources.Pages.Ledgers.InspectLedgers_AccountName;
|
||||
this.LabelGridHeaderDateTimeEntered.Text = Resources.Pages.Ledgers.InspectLedgers_LoggedByInitials;
|
||||
this.LabelGridHeaderDateTimeEntered.Text = Resources.Pages.Ledgers.InspectLedgers_LoggedDate;
|
||||
this.LabelGridHeaderDeltaNegative2.Text = Global.Ledgers_Credit;
|
||||
this.LabelGridHeaderDeltaPositive2.Text = Global.Ledgers_Debit;
|
||||
this.LabelGridHeaderInitials.Text = Resources.Pages.Ledgers.InspectLedgers_LoggedByInitials;
|
||||
|
||||
this.LabelFlagNotAvailable.Text = Resources.Pages.Ledgers.InspectLedgers_FlaggingNotAvailable;
|
||||
|
||||
this.LabelAddTransactionRowsHeader.Text = Resources.Pages.Ledgers.InspectLedgers_HeaderAddTransactionRow;
|
||||
this.LabelTrackedTransactionHeader.Text =
|
||||
Resources.Pages.Ledgers.InspectLedgers_HeaderAutoTransactionTracking;
|
||||
|
||||
// if write access
|
||||
|
||||
this.LiteralEditHeader.Text = Resources.Pages.Ledgers.InspectLedgers_EditingTransactionX;
|
||||
@@ -83,6 +95,159 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
// else if read access
|
||||
|
||||
this.LiteralEditHeader.Text = Resources.Pages.Ledgers.InspectLedgers_InspectingTransactionX;
|
||||
|
||||
// Access helpers to JavaScript (don't actually determine access, but help in UI prettiness)
|
||||
|
||||
this.LiteralAuditAccess.Text =
|
||||
(CurrentUser.HasAccess(new Access(CurrentOrganization, AccessAspect.Auditing, AccessType.Write)))
|
||||
? "true"
|
||||
: "false";
|
||||
this.LiteralWriteAccess.Text =
|
||||
(CurrentUser.HasAccess(new Access(CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Write)))
|
||||
? "true"
|
||||
: "false";
|
||||
this.LiteralDetailAccess.Text =
|
||||
(CurrentUser.HasAccess(new Access(CurrentOrganization, AccessAspect.BookkeepingDetails, AccessType.Read)))
|
||||
? "true"
|
||||
: "false";
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public static string GetTransactionTracking (int txId)
|
||||
{
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
|
||||
if (
|
||||
!authData.CurrentUser.HasAccess (new Access (authData.CurrentOrganization,
|
||||
AccessAspect.BookkeepingDetails, AccessType.Read)))
|
||||
{
|
||||
return string.Empty; // leave no clue to an attacker why the call failed
|
||||
}
|
||||
|
||||
FinancialTransaction transaction = FinancialTransaction.FromIdentity (txId);
|
||||
|
||||
IHasIdentity dependency = transaction.Dependency;
|
||||
|
||||
if (dependency == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return GetTrackingDetails (dependency);
|
||||
}
|
||||
|
||||
private static string GetTrackingDetails (object someObject)
|
||||
{
|
||||
string objectType = someObject.GetType().Name;
|
||||
|
||||
switch (objectType)
|
||||
{
|
||||
case "Payout":
|
||||
Payout payout = (Payout) someObject;
|
||||
string result =
|
||||
String.Format (Resources.Pages.Ledgers.InspectLedgers_TxDetail_ThisIsPayoutX, payout.Identity) +
|
||||
" ";
|
||||
|
||||
List<string> subValidations = new List<string>();
|
||||
List<string> subResults = new List<string>();
|
||||
|
||||
if (payout.DependentExpenseClaims.Count > 0)
|
||||
{
|
||||
if (payout.DependentExpenseClaims.Count == 1)
|
||||
{
|
||||
subResults.Add("<strong>" + String.Format(Resources.Global.Financial_ExpenseClaimSpecificationWithClaimer, payout.DependentExpenseClaims[0].Identity, HttpUtility.HtmlEncode(payout.DependentExpenseClaims[0].Claimer.Name)) + ".</strong>");
|
||||
}
|
||||
else
|
||||
{
|
||||
subResults.Add("<strong>" + String.Format(Resources.Global.Financial_ExpenseClaimsSpecificationWithClaimer, Formatting.GenerateRangeString(payout.DependentExpenseClaims.Identities), HttpUtility.HtmlEncode(payout.DependentExpenseClaims[0].Claimer.Name)) + ".</strong>");
|
||||
}
|
||||
|
||||
foreach (ExpenseClaim claim in payout.DependentExpenseClaims)
|
||||
{
|
||||
subValidations.Add ("<strong>" + String.Format (Resources.Global.Financial_ExpenseClaimLongSpecification, claim.Identity) + ":</strong> " + claim.Organization.Currency.Code + " " + (claim.AmountCents / 100.0).ToString("N2") + ". " + HttpUtility.HtmlEncode (GetValidationDetails(claim.Validations)) + " " + GetDocumentDetails(claim.Documents));
|
||||
}
|
||||
}
|
||||
|
||||
if (payout.DependentCashAdvancesPayback.Count > 0)
|
||||
{
|
||||
if (payout.DependentCashAdvancesPayback.Count == 1)
|
||||
{
|
||||
subResults.Add("<strong>" + String.Format(Resources.Global.Financial_CashAdvancePaybackSpecification, payout.DependentCashAdvancesPayback[0].Identity) + ".</strong>");
|
||||
}
|
||||
else
|
||||
{
|
||||
subResults.Add("<strong>" + String.Format(Resources.Global.Financial_CashAdvancePaybacksSpecification, Formatting.GenerateRangeString(payout.DependentExpenseClaims.Identities)) + ".</strong>");
|
||||
}
|
||||
}
|
||||
|
||||
if (payout.DependentCashAdvancesPayout.Count > 0)
|
||||
{
|
||||
if (payout.DependentCashAdvancesPayout.Count == 1)
|
||||
{
|
||||
subResults.Add("<strong>" + String.Format(Resources.Global.Financial_CashAdvanceLongSpecificationWithRecipient, payout.DependentCashAdvancesPayout[0].Identity) + ".</strong>");
|
||||
}
|
||||
else
|
||||
{
|
||||
subResults.Add("<strong>" + String.Format(Resources.Global.Financial_CashAdvancesLongSpecificationWithRecipient, Formatting.GenerateRangeString(payout.DependentExpenseClaims.Identities)) + ".</strong>");
|
||||
}
|
||||
|
||||
foreach (CashAdvance advance in payout.DependentCashAdvancesPayout)
|
||||
{
|
||||
subValidations.Add("<strong>" + String.Format(Resources.Global.Financial_CashAdvanceSpecification, advance.Identity) + ":</strong> " + advance.Organization.Currency.Code + " " + (advance.AmountCents / 100.0).ToString("N2") + ". " + HttpUtility.HtmlEncode(GetValidationDetails(advance.Validations)));
|
||||
}
|
||||
}
|
||||
|
||||
if (payout.DependentInvoices.Count > 0)
|
||||
{
|
||||
// Assume _one_ invoice
|
||||
|
||||
InboundInvoice invoice = payout.DependentInvoices[0];
|
||||
|
||||
subResults.Add ("<strong>" + String.Format (
|
||||
Resources.Global.Financial_InboundInvoiceSpecificationWithSender, invoice.Identity,
|
||||
invoice.Supplier) + ".</strong>");
|
||||
|
||||
subValidations.Add("<strong>" + String.Format (Resources.Global.Financial_InboundInvoiceSpecification, invoice.Identity) + ":</strong> " + invoice.Organization.Currency.Code + " " + (invoice.AmountCents / 100.0).ToString("N2") + ". " + GetValidationDetails(invoice.Validations) + " " +
|
||||
GetDocumentDetails (invoice.Documents));
|
||||
}
|
||||
|
||||
|
||||
|
||||
result += String.Join (" " + Resources.Pages.Ledgers.InspectLedgers_TxDetail_CombinedWith + " ", subResults);
|
||||
|
||||
return "<p>" + result + "</p><p>" + String.Join ("</p><p>", subValidations) + "</p>";
|
||||
|
||||
break;
|
||||
default:
|
||||
return "Unimplemented dependency type: " + objectType;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetValidationDetails (FinancialValidations validations)
|
||||
{
|
||||
string result = string.Empty;
|
||||
|
||||
foreach (FinancialValidation validation in validations)
|
||||
{
|
||||
if (validation.ValidationType == FinancialValidationType.Attestation)
|
||||
{
|
||||
result += String.Format (Resources.Pages.Ledgers.InspectLedgers_TxDetail_AttestedByX + ". ", validation.Person.Canonical,
|
||||
validation.DateTime);
|
||||
}
|
||||
if (validation.ValidationType == FinancialValidationType.Validation)
|
||||
{
|
||||
result += String.Format(Resources.Pages.Ledgers.InspectLedgers_TxDetail_ValidatedByX + ". ", validation.Person.Canonical,
|
||||
validation.DateTime);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string GetDocumentDetails (Documents documents)
|
||||
{
|
||||
return "Documents were uploaded by " + documents[0].UploadedByPerson.Canonical + " at " +
|
||||
documents[0].UploadedDateTime.ToString ("yyyy-MMM-dd HH:mm") + ". <a href='#'>View documents.</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,13 +46,6 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
throw new UnauthorizedAccessException ("Access denied because security tokens say so");
|
||||
}
|
||||
|
||||
bool listDetails = false;
|
||||
|
||||
if (CurrentUser.HasAccess (new Access (CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Read)))
|
||||
{
|
||||
listDetails = true;
|
||||
}
|
||||
|
||||
FinancialTransactionRows rows = transaction.Rows;
|
||||
|
||||
// SIGNOFF: CONTINUE HERE BUILDING JSON DATA FOR TRANSACTION
|
||||
@@ -66,11 +59,11 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
|
||||
if (row.AmountCents < 0)
|
||||
{
|
||||
creditString = String.Format ("{0:N0}", row.AmountCents/100.0);
|
||||
creditString = String.Format ("{0:N2}", row.AmountCents/100.0);
|
||||
}
|
||||
else if (row.AmountCents > 0)
|
||||
{
|
||||
debitString = String.Format ("{0:N0}", row.AmountCents/100.0);
|
||||
debitString = String.Format ("{0:N2}", row.AmountCents/100.0);
|
||||
}
|
||||
|
||||
string actionHtml = String.Format (
|
||||
@@ -78,24 +71,37 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
row.FinancialTransactionId.ToString (CultureInfo.InvariantCulture));
|
||||
|
||||
result.Append ("{" + String.Format (
|
||||
"\"id\":\"{0}\",\"dateTime\":\"{1:MMM-dd HH:mm}\",\"accountName\":\"{2}\"," +
|
||||
"\"id\":\"{0}\",\"dateTime\":\"{1:yyyy-MMM-dd HH:mm}\",\"accountName\":\"{2}\"," +
|
||||
"\"deltaPos\":\"{3}\",\"deltaNeg\":\"{4}\",\"initials\":\"{5}\"",
|
||||
row.FinancialTransactionId,
|
||||
row.CreatedDateTime,
|
||||
JsonSanitize (row.AccountName),
|
||||
debitString,
|
||||
creditString,
|
||||
row.CreatedByPerson.Initials) + "},");
|
||||
row.CreatedByPerson != null? row.CreatedByPerson.Initials: Resources.Global.Global_System) + "},");
|
||||
}
|
||||
|
||||
Int64 amountCentsTotal = transaction.Rows.AmountCentsTotal;
|
||||
|
||||
if (amountCentsTotal == 0)
|
||||
if (amountCentsTotal != 0)
|
||||
{
|
||||
// If there are no transactions in this time period, say so
|
||||
// If the transaction is unbalanced, make a huge deal about it
|
||||
|
||||
result.Append ("{\"accountName\":\"" +
|
||||
JsonSanitize (Resources.Pages.Ledgers.InspectLedgers_UnbalancedTransaction) + "\"},");
|
||||
result.Append ("{\"accountName\":\"<img src='/Images/Icons/iconshock-warning-24px.png' height='16px' width='16px' class='elementFloatFar' />" +
|
||||
JsonSanitize (Resources.Pages.Ledgers.InspectLedgers_UnbalancedTransaction) + "\",");
|
||||
|
||||
if (amountCentsTotal < 0)
|
||||
{
|
||||
result.AppendFormat("\"deltaPos\":\"<span class='spanAnnoyingBlink'>{0:N2}</span>\"",
|
||||
-amountCentsTotal / 100.0);
|
||||
}
|
||||
else if (amountCentsTotal > 0)
|
||||
{
|
||||
result.AppendFormat("\"deltaNeg\":\"<span class='spanAnnoyingBlink'>{0:N2}</span>\"",
|
||||
-amountCentsTotal / 100.0);
|
||||
}
|
||||
|
||||
result.Append ("},"); // the comma isn't really necessary here but will be stripped later and is kept for cut&paste consistency of this code block
|
||||
}
|
||||
|
||||
Response.Output.WriteLine ("[" + result.ToString().TrimEnd (',') + "]");
|
||||
|
||||
@@ -385,6 +385,24 @@ body.rtl .divIconCloseModal {
|
||||
}
|
||||
|
||||
|
||||
.elementFloatNear {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.elementFloatFar {
|
||||
float: right;
|
||||
}
|
||||
|
||||
body.rtl .elementFloatNear {
|
||||
float: right;
|
||||
}
|
||||
|
||||
body.rtl .elementFloatFar {
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* LOGINBOX */
|
||||
|
||||
body.loginpage
|
||||
|
||||
Reference in New Issue
Block a user