diff --git a/Logic/Support/Document.cs b/Logic/Support/Document.cs
index 2079499c..bb2f4d0d 100644
--- a/Logic/Support/Document.cs
+++ b/Logic/Support/Document.cs
@@ -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;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/Site5/App_GlobalResources/Global.resx b/Site5/App_GlobalResources/Global.resx
index 3ec892d5..25525235 100644
--- a/Site5/App_GlobalResources/Global.resx
+++ b/Site5/App_GlobalResources/Global.resx
@@ -172,7 +172,7 @@
Expense
- Expense #{0}
+ Expense #{0:N0}
Expenses {0}
@@ -337,10 +337,10 @@
List of shortcuts to related actions to current one
- Expense #{0} (minus advance #{1})
+ Expense #{0:N0} (minus advance #{1:N0})
- Expense #{0} (minus advances)
+ Expense #{0:N0} (minus advances)
Expenses {0} (minus advance #{1})
@@ -349,10 +349,10 @@
Expenses {0} (minus advances)
- Expense Claim #{0} by {1}
+ Expense Claim #{0:N0} by {1}
- Inbound Invoice #{0} from {1}
+ Inbound Invoice #{0:N0} from {1}
Receipt Image {0} of {1}
@@ -580,4 +580,29 @@
define to enable
shown as watermark on some edit boxes
+
+ Cash Advance #{0:N0} for {1}
+
+
+ Cash Advance #{0:N0} Payback
+
+
+ Cash Advances {0} Payback
+
+
+ Cash Advances {0} for {1}
+
+
+ Expense Claim #{0:N0}
+
+
+ Expense Claims {0} by {1}
+
+
+ Inbound Invoice #{0:N0}
+
+
+ System
+ as in "Created by: System" for roles, transactions etc.
+
\ No newline at end of file
diff --git a/Site5/App_GlobalResources/Pages.Ledgers.resx b/Site5/App_GlobalResources/Pages.Ledgers.resx
index 8d2bf339..7508388d 100644
--- a/Site5/App_GlobalResources/Pages.Ledgers.resx
+++ b/Site5/App_GlobalResources/Pages.Ledgers.resx
@@ -625,6 +625,32 @@
Logged
- Transaction is <span class="spanAnnoyingBlink">UNBALANCED</span>:
+ Transaction is <span class="spanAnnoyingBlink">UNBALANCED:</span> missing amount
+
+
+ Add rows to transaction
+ (you can't really edit a transaction, just add more rows to it)
+
+
+ Autotransaction tracking details
+ (this means the transaction is locked from editing)
+
+
+ Attested by {0} on {1:yyyy-MMM-dd}
+
+
+ combined with
+ Inserted between transaction causes.
+
+
+ <strong>Inbound Invoice #{0:N0}</strong> from {1}:
+ the {1} is the supplier name
+
+
+ This is <strong>Payout #{0:N0}.</strong> It's a payout for
+
+
+ Document validation by {0} on {1:yyyy-MMM-dd}
+ "Document" refers to receipts, invoices, etc.
\ No newline at end of file
diff --git a/Site5/Pages/v5/Ledgers/InspectLedgers.aspx b/Site5/Pages/v5/Ledgers/InspectLedgers.aspx
index 6bde59ab..5ef3f4fd 100644
--- a/Site5/Pages/v5/Ledgers/InspectLedgers.aspx
+++ b/Site5/Pages/v5/Ledgers/InspectLedgers.aspx
@@ -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('');
-
}
+ // the variables below only handle the cosmetics and not actual access
+ var canSeeDetail = ;
+ var canWriteRows = ;
+ var canAuditTx = ;
+
+
@@ -167,25 +201,34 @@
-
-
- ModalFields
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+ ModalFields
+
+
+ entryLabels
+
-
diff --git a/Site5/Pages/v5/Ledgers/InspectLedgers.aspx.cs b/Site5/Pages/v5/Ledgers/InspectLedgers.aspx.cs
index 9a324aa3..54b94450 100644
--- a/Site5/Pages/v5/Ledgers/InspectLedgers.aspx.cs
+++ b/Site5/Pages/v5/Ledgers/InspectLedgers.aspx.cs
@@ -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
subValidations = new List();
+ List subResults = new List();
+
+ if (payout.DependentExpenseClaims.Count > 0)
+ {
+ if (payout.DependentExpenseClaims.Count == 1)
+ {
+ subResults.Add("" + String.Format(Resources.Global.Financial_ExpenseClaimSpecificationWithClaimer, payout.DependentExpenseClaims[0].Identity, HttpUtility.HtmlEncode(payout.DependentExpenseClaims[0].Claimer.Name)) + ".");
+ }
+ else
+ {
+ subResults.Add("" + String.Format(Resources.Global.Financial_ExpenseClaimsSpecificationWithClaimer, Formatting.GenerateRangeString(payout.DependentExpenseClaims.Identities), HttpUtility.HtmlEncode(payout.DependentExpenseClaims[0].Claimer.Name)) + ".");
+ }
+
+ foreach (ExpenseClaim claim in payout.DependentExpenseClaims)
+ {
+ subValidations.Add ("" + String.Format (Resources.Global.Financial_ExpenseClaimLongSpecification, claim.Identity) + ": " + 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("" + String.Format(Resources.Global.Financial_CashAdvancePaybackSpecification, payout.DependentCashAdvancesPayback[0].Identity) + ".");
+ }
+ else
+ {
+ subResults.Add("" + String.Format(Resources.Global.Financial_CashAdvancePaybacksSpecification, Formatting.GenerateRangeString(payout.DependentExpenseClaims.Identities)) + ".");
+ }
+ }
+
+ if (payout.DependentCashAdvancesPayout.Count > 0)
+ {
+ if (payout.DependentCashAdvancesPayout.Count == 1)
+ {
+ subResults.Add("" + String.Format(Resources.Global.Financial_CashAdvanceLongSpecificationWithRecipient, payout.DependentCashAdvancesPayout[0].Identity) + ".");
+ }
+ else
+ {
+ subResults.Add("" + String.Format(Resources.Global.Financial_CashAdvancesLongSpecificationWithRecipient, Formatting.GenerateRangeString(payout.DependentExpenseClaims.Identities)) + ".");
+ }
+
+ foreach (CashAdvance advance in payout.DependentCashAdvancesPayout)
+ {
+ subValidations.Add("" + String.Format(Resources.Global.Financial_CashAdvanceSpecification, advance.Identity) + ": " + 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 ("" + String.Format (
+ Resources.Global.Financial_InboundInvoiceSpecificationWithSender, invoice.Identity,
+ invoice.Supplier) + ".");
+
+ subValidations.Add("" + String.Format (Resources.Global.Financial_InboundInvoiceSpecification, invoice.Identity) + ": " + 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 "" + result + "
" + String.Join ("
", subValidations) + "
";
+
+ 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") + ". View documents.";
}
}
}
\ No newline at end of file
diff --git a/Site5/Pages/v5/Ledgers/Json-InspectLedgerTxData.aspx.cs b/Site5/Pages/v5/Ledgers/Json-InspectLedgerTxData.aspx.cs
index ae2dcfda..1c32c318 100644
--- a/Site5/Pages/v5/Ledgers/Json-InspectLedgerTxData.aspx.cs
+++ b/Site5/Pages/v5/Ledgers/Json-InspectLedgerTxData.aspx.cs
@@ -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\":\"
" +
+ JsonSanitize (Resources.Pages.Ledgers.InspectLedgers_UnbalancedTransaction) + "\",");
+
+ if (amountCentsTotal < 0)
+ {
+ result.AppendFormat("\"deltaPos\":\"{0:N2}\"",
+ -amountCentsTotal / 100.0);
+ }
+ else if (amountCentsTotal > 0)
+ {
+ result.AppendFormat("\"deltaNeg\":\"{0:N2}\"",
+ -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 (',') + "]");
diff --git a/Site5/Style/style-v5.css b/Site5/Style/style-v5.css
index 5230bd89..e286ca92 100644
--- a/Site5/Style/style-v5.css
+++ b/Site5/Style/style-v5.css
@@ -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