Inspecting transactions work reasonably
This commit is contained in:
@@ -38,6 +38,10 @@ namespace Swarmops.Logic.Financial
|
||||
{
|
||||
return FinancialDependencyType.Salary;
|
||||
}
|
||||
if (foreignObject is CashAdvance)
|
||||
{
|
||||
return FinancialDependencyType.CashAdvance;
|
||||
}
|
||||
|
||||
throw new NotImplementedException ("Unknown dependency: " + foreignObject.GetType());
|
||||
}
|
||||
|
||||
@@ -264,6 +264,20 @@ namespace Swarmops.Logic.Financial
|
||||
}
|
||||
|
||||
|
||||
public Person CreatedByPerson
|
||||
{
|
||||
get
|
||||
{
|
||||
if (base.CreatedByPersonId > 0)
|
||||
{
|
||||
return Person.FromIdentity (base.CreatedByPersonId);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public FinancialTransaction FinancialTransaction
|
||||
{
|
||||
get { return FinancialTransaction.FromDependency (this); }
|
||||
|
||||
@@ -605,4 +605,23 @@
|
||||
<value>System</value>
|
||||
<comment>as in "Created by: System" for roles, transactions etc.</comment>
|
||||
</data>
|
||||
<data name="Financial_SalariesDualSpecification" xml:space="preserve">
|
||||
<value>Salaries {0} for {1:yyyy-MMM}</value>
|
||||
</data>
|
||||
<data name="Financial_SalariesTaxSpecification" xml:space="preserve">
|
||||
<value>Salary Taxes for {0:yyyy-MMM}</value>
|
||||
</data>
|
||||
<data name="Financial_SalaryDualSpecification" xml:space="preserve">
|
||||
<value>Salary #{0:N0} for {1:yyyy-MMM}</value>
|
||||
</data>
|
||||
<data name="Financial_SalaryDualSpecificationWithRecipient" xml:space="preserve">
|
||||
<value>Salary #{0:N0} for {1:yyyy-MMM} for {2}</value>
|
||||
<comment>0 is identity, 1 is month, 2 is name</comment>
|
||||
</data>
|
||||
<data name="Financial_SalaryIdentity" xml:space="preserve">
|
||||
<value>Salary #{0:N0}</value>
|
||||
</data>
|
||||
<data name="Financial_SalaryTaxDualSpecification" xml:space="preserve">
|
||||
<value>Taxes for Salary #{0:N0} for {1:yyyy-MMM}</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -653,4 +653,12 @@
|
||||
<value>Document validation by {0} on {1:yyyy-MMM-dd}</value>
|
||||
<comment>"Document" refers to receipts, invoices, etc.</comment>
|
||||
</data>
|
||||
<data name="InspectLedgers_TxDetail_PaidOutBy" xml:space="preserve">
|
||||
<value>Executed by {0}.</value>
|
||||
<comment>As in "payout executed by": who actually paid the money?</comment>
|
||||
</data>
|
||||
<data name="InspectLedgers_TxDetail_SalaryDetail" xml:space="preserve">
|
||||
<value>Base salary {0} {1:N2}, gross adjustments {2:+N2;-N2;none}, gross salary {3:N2}, deducted tax {4:N2}, net adjustments {5:+N2;-N2;none}, payout {6:N2}.</value>
|
||||
<comment>The "none"s in the format strings need to be translated.</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -3,6 +3,11 @@
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
|
||||
<script type="text/javascript" src="/Scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
|
||||
<script type="text/javascript" src="/Scripts/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
|
||||
<script type="text/javascript" src="/Scripts/jquery.snipe.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/Scripts/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
@@ -47,7 +52,17 @@
|
||||
|
||||
$('#gridTransaction').datagrid({
|
||||
onLoadSuccess: function() {
|
||||
$('#gridTransaction').datagrid('resize');
|
||||
|
||||
// Dynamic reloading screws up resizing for some reason, so we'll have to resize the tx grid manually.
|
||||
|
||||
var heightBody = $('div#divModalCover table.datagrid-btable').height();
|
||||
$('div#divModalCover div.datagrid-body').height(heightBody);
|
||||
|
||||
var heightHeaders = $('div#divModalCover div.datagrid-header').height();
|
||||
$('div#divModalCover div.datagrid-view').height(heightBody + heightHeaders + 20); // +20 adds some margin on the bottom. It's an arbitrary number.
|
||||
$('div#divModalCover div.datagrid-wrap').height(heightBody + heightHeaders + 20);
|
||||
|
||||
$('div#divModalBox').height($('div#divModalBox div.content').height() + 20);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -103,6 +118,7 @@
|
||||
|
||||
var jsonData = {};
|
||||
jsonData.txId = transactionId;
|
||||
$('span#spanModalTransactionId').text(transactionId);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
@@ -115,6 +131,20 @@
|
||||
$('#divTransactionTrackingDetails').html(msg.d);
|
||||
$('#divTransactionTrackingDetails').show();
|
||||
$('#divEditTransaction').hide();
|
||||
|
||||
$("a.FancyBox_Gallery").fancybox({
|
||||
'overlayShow': true,
|
||||
'transitionIn': 'fade',
|
||||
'transitionOut': 'fade',
|
||||
'type': 'image',
|
||||
'opacity': true
|
||||
});
|
||||
|
||||
$("a.linkViewDox").click(function () {
|
||||
$("a.FancyBox_Gallery[rel='" + $(this).attr("objectId") + "']").first().click();
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
$('#divTransactionTrackingDetails').hide();
|
||||
$('#divEditTransaction').show();
|
||||
@@ -171,6 +201,10 @@
|
||||
100% { color: red; }
|
||||
}
|
||||
|
||||
span.hiddenDocLinks {
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</asp:Content>
|
||||
@@ -199,9 +233,9 @@
|
||||
|
||||
<div id="divModalCover" class="modalcover">
|
||||
<div id="divModalBox" class="box modal">
|
||||
<div class="content">
|
||||
<div class="content" style="overflow:hidden">
|
||||
<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%"
|
||||
<table id="gridTransaction" class="easyui-datagrid" style="width:910px"
|
||||
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>
|
||||
|
||||
@@ -90,13 +90,18 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
|
||||
// if write access
|
||||
|
||||
this.LiteralEditHeader.Text = Resources.Pages.Ledgers.InspectLedgers_EditingTransactionX;
|
||||
if (
|
||||
CurrentUser.HasAccess (new Access (CurrentOrganization, AccessAspect.BookkeepingDetails,
|
||||
AccessType.Write)))
|
||||
{
|
||||
this.LiteralEditHeader.Text = Resources.Pages.Ledgers.InspectLedgers_EditingTransactionX;
|
||||
}
|
||||
else // read access, at a minimum of AccessAspect.Bookkeeping
|
||||
{
|
||||
this.LiteralEditHeader.Text = Resources.Pages.Ledgers.InspectLedgers_InspectingTransactionX;
|
||||
}
|
||||
|
||||
// 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)
|
||||
// Access helpers to JavaScript (these don't actually determine access, but help in UI prettiness)
|
||||
|
||||
this.LiteralAuditAccess.Text =
|
||||
(CurrentUser.HasAccess(new Access(CurrentOrganization, AccessAspect.Auditing, AccessType.Write)))
|
||||
@@ -164,7 +169,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
|
||||
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));
|
||||
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, claim));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,13 +187,15 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
|
||||
if (payout.DependentCashAdvancesPayout.Count > 0)
|
||||
{
|
||||
CashAdvance advance0 = payout.DependentCashAdvancesPayout[0];
|
||||
|
||||
if (payout.DependentCashAdvancesPayout.Count == 1)
|
||||
{
|
||||
subResults.Add("<strong>" + String.Format(Resources.Global.Financial_CashAdvanceLongSpecificationWithRecipient, payout.DependentCashAdvancesPayout[0].Identity) + ".</strong>");
|
||||
subResults.Add("<strong>" + String.Format(Resources.Global.Financial_CashAdvanceLongSpecificationWithRecipient, advance0.Identity, advance0.Person.Name) + ".</strong>");
|
||||
}
|
||||
else
|
||||
{
|
||||
subResults.Add("<strong>" + String.Format(Resources.Global.Financial_CashAdvancesLongSpecificationWithRecipient, Formatting.GenerateRangeString(payout.DependentExpenseClaims.Identities)) + ".</strong>");
|
||||
subResults.Add("<strong>" + String.Format(Resources.Global.Financial_CashAdvancesLongSpecificationWithRecipient, Formatting.GenerateRangeString(payout.DependentExpenseClaims.Identities), advance0.Person.Name) + ".</strong>");
|
||||
}
|
||||
|
||||
foreach (CashAdvance advance in payout.DependentCashAdvancesPayout)
|
||||
@@ -205,15 +212,58 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
|
||||
subResults.Add ("<strong>" + String.Format (
|
||||
Resources.Global.Financial_InboundInvoiceSpecificationWithSender, invoice.Identity,
|
||||
invoice.Supplier) + ".</strong>");
|
||||
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));
|
||||
GetDocumentDetails (invoice.Documents, invoice));
|
||||
}
|
||||
|
||||
|
||||
if (payout.DependentSalariesNet.Count > 0)
|
||||
{
|
||||
// Assume one salary
|
||||
|
||||
result += String.Join (" " + Resources.Pages.Ledgers.InspectLedgers_TxDetail_CombinedWith + " ", subResults);
|
||||
Salary salary = payout.DependentSalariesNet[0];
|
||||
|
||||
subResults.Add ("<strong>" +
|
||||
String.Format (Resources.Global.Financial_SalaryDualSpecificationWithRecipient,
|
||||
salary.Identity, salary.PayoutDate, HttpUtility.HtmlEncode (salary.PayrollItem.PersonCanonical)) +
|
||||
"</strong>");
|
||||
|
||||
subValidations.Add ("<strong>" +
|
||||
String.Format (Resources.Global.Financial_SalaryIdentity, salary.Identity) +
|
||||
":</strong> " +
|
||||
String.Format (Resources.Pages.Ledgers.InspectLedgers_TxDetail_SalaryDetail,
|
||||
salary.PayrollItem.Organization.Currency.Code,
|
||||
salary.BaseSalaryCents/100.0, // base salary
|
||||
(salary.GrossSalaryCents - salary.BaseSalaryCents)/100.0, // before-tax adjustments
|
||||
salary.GrossSalaryCents/100.0, // before-tax adjusted salary
|
||||
salary.SubtractiveTaxCents/100.0, // tax deduction
|
||||
(salary.NetSalaryCents + salary.SubtractiveTaxCents -
|
||||
salary.GrossSalaryCents)/100.0, // after-tax adjustments
|
||||
salary.NetSalaryCents/100.0) + // actual payout amount
|
||||
" " + GetValidationDetails (salary.Validations));
|
||||
}
|
||||
|
||||
if (payout.DependentSalariesTax.Count > 0)
|
||||
{
|
||||
Salary salary0 = payout.DependentSalariesTax[0];
|
||||
|
||||
if (payout.DependentSalariesTax.Count == 1)
|
||||
{
|
||||
subResults.Add("<strong>" +
|
||||
String.Format(Resources.Global.Financial_SalaryTaxDualSpecification, salary0.Identity, salary0.PayoutDate) + "</strong>");
|
||||
}
|
||||
else
|
||||
{
|
||||
subResults.Add ("<strong>" +
|
||||
String.Format (Resources.Global.Financial_SalariesTaxSpecification, salary0.PayoutDate) + "</strong>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result +=
|
||||
String.Join (" " + Resources.Pages.Ledgers.InspectLedgers_TxDetail_CombinedWith + " ",
|
||||
subResults) + ". " + String.Format (Resources.Pages.Ledgers.InspectLedgers_TxDetail_PaidOutBy, payout.CreatedByPerson.Canonical);
|
||||
|
||||
return "<p>" + result + "</p><p>" + String.Join ("</p><p>", subValidations) + "</p>";
|
||||
|
||||
@@ -244,10 +294,20 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string GetDocumentDetails (Documents documents)
|
||||
private static string GetDocumentDetails (Documents documents, IHasIdentity identifiableObject)
|
||||
{
|
||||
string docLink = string.Empty;
|
||||
string objectIdString = identifiableObject.GetType().Name + identifiableObject.Identity;
|
||||
|
||||
foreach (Document document in documents)
|
||||
{
|
||||
docLink += "<a href='/Pages/v5/Support/StreamUpload.aspx?DocId=" + document.Identity +
|
||||
"' class='FancyBox_Gallery' rel='" + objectIdString + "'> </a>";
|
||||
}
|
||||
|
||||
return "Documents were uploaded by " + documents[0].UploadedByPerson.Canonical + " at " +
|
||||
documents[0].UploadedDateTime.ToString ("yyyy-MMM-dd HH:mm") + ". <a href='#'>View documents.</a>";
|
||||
documents[0].UploadedDateTime.ToString ("yyyy-MMM-dd HH:mm") +
|
||||
". <a href='#' class='linkViewDox' objectId='" + objectIdString + "'>View documents.</a><span class='hiddenDocLinks'>" + docLink + "</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,8 +48,6 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
|
||||
FinancialTransactionRows rows = transaction.Rows;
|
||||
|
||||
// SIGNOFF: CONTINUE HERE BUILDING JSON DATA FOR TRANSACTION
|
||||
|
||||
StringBuilder result = new StringBuilder (16384);
|
||||
|
||||
foreach (FinancialTransactionRow row in rows)
|
||||
@@ -66,10 +64,6 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
debitString = String.Format ("{0:N2}", row.AmountCents/100.0);
|
||||
}
|
||||
|
||||
string actionHtml = String.Format (
|
||||
"<img src=\"/Images/Icons/iconshock-magnifyingglass-16px.png\" class=\"LocalIconInspect\" txId=\"{0}\" /> <img src=\"/Images/Icons/iconshock-flag-white-16px.png\" class=\"LocalIconFlag\" txId=\"{0}\" />",
|
||||
row.FinancialTransactionId.ToString (CultureInfo.InvariantCulture));
|
||||
|
||||
result.Append ("{" + String.Format (
|
||||
"\"id\":\"{0}\",\"dateTime\":\"{1:yyyy-MMM-dd HH:mm}\",\"accountName\":\"{2}\"," +
|
||||
"\"deltaPos\":\"{3}\",\"deltaNeg\":\"{4}\",\"initials\":\"{5}\"",
|
||||
|
||||
@@ -373,15 +373,11 @@ body.rtl .sidebar {
|
||||
|
||||
.divIconCloseModal {
|
||||
float:right;
|
||||
margin-top: 2px;
|
||||
margin-right: -5px
|
||||
}
|
||||
|
||||
|
||||
body.rtl .divIconCloseModal {
|
||||
float:left;
|
||||
margin-top: 2px;
|
||||
margin-left: -5px
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user