Added basic OCR readability to pending payouts
This commit is contained in:
@@ -332,23 +332,8 @@ namespace Swarmops.Logic.Financial
|
||||
{
|
||||
// Add the summarized tax line, too
|
||||
|
||||
string referenceString = string.Empty;
|
||||
|
||||
if (identityList.Count == 1)
|
||||
{
|
||||
referenceString = "[Loc]Financial_TaxSpecification|" + identityList[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
identityList.Sort();
|
||||
referenceString = "[Loc]Financial_TaxesSpecification|" +
|
||||
Formatting.GenerateRangeString (identityList);
|
||||
}
|
||||
|
||||
|
||||
BasicPayout basicPayout = new BasicPayout (0, organization.Identity, "[Loc]Financial_TheTaxMan",
|
||||
string.Empty, referenceString,
|
||||
taxTotalCents, payDay, false, DateTime.Now, 0);
|
||||
BasicPayout basicPayout = new BasicPayout (0, organization.Identity, "[Loc]Financial_TheTaxMan", "SEBG 5050-1055", // HACK: Get tax account from something
|
||||
organization.TaxPaymentOcr, taxTotalCents, payDay, false, DateTime.Now, 0);
|
||||
Payout payout = Payout.FromBasic (basicPayout);
|
||||
|
||||
foreach (int salaryId in identityList)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -167,16 +168,38 @@ namespace Swarmops.Logic.Support
|
||||
}
|
||||
|
||||
public static string AddLuhnChecksum (string number)
|
||||
{
|
||||
return number + GetLuhnChecksum (number);
|
||||
}
|
||||
|
||||
public static string GetLuhnChecksum (string number)
|
||||
{
|
||||
int sum = 0;
|
||||
for (int i = 0; i < number.Length; i++)
|
||||
{
|
||||
int temp = (number[i] - '0')*(((number.Length - i)%2) == 1 ? 2 : 1);
|
||||
int temp = (number[i] - '0') * (((number.Length - i) % 2) == 1 ? 2 : 1);
|
||||
if (temp > 9) temp -= 9;
|
||||
sum += temp;
|
||||
}
|
||||
|
||||
return number + ((10 - (sum%10))%10);
|
||||
return ((10 - (sum % 10)) % 10).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public static bool CheckLuhnChecksum (string number)
|
||||
{
|
||||
number = CleanNumber (number);
|
||||
|
||||
if (number.Length < 2)
|
||||
{
|
||||
return false; // requires at least data and checksum
|
||||
}
|
||||
|
||||
if (!number.EndsWith (GetLuhnChecksum (number.Substring (0, number.Length - 1))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -214,6 +214,10 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- assorted popups, for use by all pages -->
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
@@ -235,9 +235,9 @@
|
||||
<div title="<img src='/Images/Icons/iconshock-buildings-256px.png' height='64' width='64' />">
|
||||
<h2>Regulatory stuff (optional)</h2>
|
||||
<div class="entryFields">
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextGovtRegistrationId" Text="SE1234567890" />​<br/>
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextGovtRegistrationId" Text="SE1234567890" Cookie="GovernmentRegistrationId" AjaxCallbackUrl="/Pages/v5/Admin/OrgSettings.aspx/StoreCallback" />​<br/>
|
||||
<Swarmops5:DropDown ID="DropTaxAuthority" CssClass="DropTemp" runat="server"/>​<br/>
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextTaxPaymentOcr" Text="1612345678900" />​<br/>
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextTaxPaymentOcr" Text="1612345678900" Cookie="TaxPaymentOcr" AjaxCallbackUrl="/Pages/v5/Admin/OrgSettings.aspx/StoreCallback" />​<br/>
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
Org registration #<br/>
|
||||
|
||||
@@ -427,6 +427,18 @@ namespace Swarmops.Frontend.Pages.v5.Admin
|
||||
authenticationData.CurrentOrganization.PaypalAccountMailAddress = result.NewData;
|
||||
break;
|
||||
|
||||
case "GovernmentRegistrationId":
|
||||
result.NewData = newValue.Trim();
|
||||
result.ResultCode = AjaxTextBox.CodeSuccess;
|
||||
authenticationData.CurrentOrganization.GovernmentRegistrationId = result.NewData;
|
||||
break;
|
||||
|
||||
case "TaxPaymentOcr":
|
||||
result.NewData = newValue.Trim();
|
||||
result.ResultCode = AjaxTextBox.CodeSuccess;
|
||||
authenticationData.CurrentOrganization.TaxPaymentOcr = result.NewData;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException("Unknown cookie in StoreCallback");
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ namespace Swarmops.Frontend.Pages.Financial
|
||||
"\"reference\":\"{5}\"," +
|
||||
"\"amount\":\"{6:N2}\"," +
|
||||
"\"action\":\"" +
|
||||
"<img id=\\\"IconApproval{7}\\\" class=\\\"LocalIconApproval LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img id=\\\"IconApproved{7}\\\" class=\\\"LocalIconApproved LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img id=\\\"IconDenial{7}\\\" class=\\\"LocalIconDenial LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img id=\\\"IconDenied{7}\\\" class=\\\"LocalIconDenied LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img id=\\\"IconUndo{7}\\\" class=\\\"LocalIconUndo LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconApproval{7} LocalIconApproval LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconApproved{7} LocalIconApproved LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconDenial{7} LocalIconDenial LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconDenied{7} LocalIconDenied LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconUndo{7} LocalIconUndo LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"\"",
|
||||
payout.ProtoIdentity,
|
||||
(payout.ExpectedTransactionDate <= today
|
||||
@@ -115,11 +115,11 @@ namespace Swarmops.Frontend.Pages.Financial
|
||||
"\"reference\":\"{5}\"," +
|
||||
"\"amount\":\"{6:N2}\"," +
|
||||
"\"action\":\"" +
|
||||
"<img id=\\\"IconApproval{7}\\\" class=\\\"LocalIconApproval LocalPrevious\\\" databaseid=\\\"{8}\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img id=\\\"IconApproved{7}\\\" class=\\\"LocalIconApproved LocalPrevious\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img id=\\\"IconDenial{7}\\\" class=\\\"LocalIconDenial LocalPrevious\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img id=\\\"IconDenied{7}\\\" class=\\\"LocalIconDenied LocalPrevious\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img id=\\\"IconUndo{7}\\\" class=\\\"LocalIconUndo LocalPrevious\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconApproval{7} LocalIconApproval LocalPrevious\\\" databaseid=\\\"{8}\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconApproved{7} LocalIconApproved LocalPrevious\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconDenial{7} LocalIconDenial LocalPrevious\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconDenied{7} LocalIconDenied LocalPrevious\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconUndo{7} LocalIconUndo LocalPrevious\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"\"",
|
||||
payout.ProtoIdentity,
|
||||
payout.ExpectedTransactionDate.ToShortDateString(),
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-PayableCostsOcr.aspx.cs" Inherits="Swarmops.Frontend.Pages.Financial.JsonPayableCostsOcr" %>
|
||||
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Resources;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
|
||||
namespace Swarmops.Frontend.Pages.Financial
|
||||
{
|
||||
public partial class JsonPayableCostsOcr : DataV5Base
|
||||
{
|
||||
protected void Page_Load (object sender, EventArgs e)
|
||||
{
|
||||
// Access required is change access to financials
|
||||
|
||||
PageAccessRequired = new Access (CurrentOrganization, AccessAspect.Financials, AccessType.Write);
|
||||
|
||||
// Get all payable items
|
||||
|
||||
Payouts prototypePayouts = Payouts.Construct (CurrentOrganization);
|
||||
Payouts previousPayouts = Payouts.ForOrganization (CurrentOrganization); // gets all currently open payouts - enabled for undoing
|
||||
|
||||
// Format as JSON and return
|
||||
|
||||
string elements = FormatPrototypesAsJson (prototypePayouts);
|
||||
|
||||
Response.ContentType = "application/json";
|
||||
string json = "{\"rows\":[" + elements + "]}";
|
||||
Response.Output.WriteLine (json);
|
||||
Response.End();
|
||||
}
|
||||
|
||||
private string FormatPrototypesAsJson (Payouts payouts)
|
||||
{
|
||||
StringBuilder result = new StringBuilder (16384);
|
||||
|
||||
DateTime today = DateTime.Today;
|
||||
bool bitcoinHotWalletActive = (this.CurrentOrganization.FinancialAccounts.AssetsBitcoinHot != null
|
||||
? true
|
||||
: false);
|
||||
|
||||
foreach (Payout payout in payouts)
|
||||
{
|
||||
if (bitcoinHotWalletActive && payout.RecipientPerson != null && payout.RecipientPerson.BitcoinPayoutAddress.Length > 0 && payout.Account.Length < 4) // 4 because an empty account will be " / ", length 3
|
||||
{
|
||||
// This is a person who will be paid in bitcoin per personal preferences, so don't show for manual payout
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bitcoinHotWalletActive && payout.Account.StartsWith ("bitcoin:"))
|
||||
{
|
||||
// This is a payout registered to be paid in bitcoin, so don't show for manual payout
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (payout.Reference.Length < 2)
|
||||
{
|
||||
continue; // must have at least a reference and a checksum - two digits minimum
|
||||
}
|
||||
|
||||
if (!Swarmops.Logic.Support.Formatting.CheckLuhnChecksum (payout.Reference))
|
||||
{
|
||||
// invalid checksum
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Swarmops.Logic.Support.Formatting.CheckLuhnChecksum (payout.Account))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
result.Append ("{");
|
||||
result.AppendFormat (
|
||||
"\"itemId\":\"{0}\"," +
|
||||
"\"due\":\"{1}\"," +
|
||||
"\"reference\":\"<span class='ocrFont'>{2}</span>\"," +
|
||||
"\"amount\":\"<span class='ocrFont'>{3}</span>\"," +
|
||||
"\"account\":\"<span class='ocrFont'>{4}</span>\"," +
|
||||
"\"action\":\"" +
|
||||
"<img class=\\\"IconApproval{5} LocalIconApproval LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconApproved{5} LocalIconApproved LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconDenial{5} LocalIconDenial LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconDenied{5} LocalIconDenied LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"<img class=\\\"IconUndo{5} LocalIconUndo LocalPrototype\\\" baseid=\\\"{0}\\\" height=\\\"18\\\" width=\\\"24\\\" />" +
|
||||
"\"" ,
|
||||
payout.ProtoIdentity,
|
||||
(payout.ExpectedTransactionDate <= today
|
||||
? Global.Global_ASAP
|
||||
: payout.ExpectedTransactionDate.ToShortDateString()),
|
||||
GetReferenceOcr (payout),
|
||||
GetAmountOcr (payout),
|
||||
GetAccountOcr (payout),
|
||||
payout.ProtoIdentity.Replace ("|", ""));
|
||||
result.Append ("},");
|
||||
}
|
||||
|
||||
if (result.Length > 0)
|
||||
{
|
||||
result.Remove (result.Length - 1, 1); // remove last comma, if there are any elements
|
||||
}
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
private string GetReferenceOcr (Payout payout)
|
||||
{
|
||||
return payout.Reference + " # ";
|
||||
}
|
||||
|
||||
private string GetAmountOcr (Payout payout)
|
||||
{
|
||||
return string.Format ("{0} {1:00} {2} >",
|
||||
payout.AmountCents/100, payout.AmountCents %100,
|
||||
Swarmops.Logic.Support.Formatting.GetLuhnChecksum (
|
||||
payout.AmountCents.ToString (CultureInfo.InvariantCulture)));
|
||||
}
|
||||
|
||||
private string GetAccountOcr (Payout payout)
|
||||
{
|
||||
return Swarmops.Logic.Support.Formatting.CleanNumber (payout.Account) + "#41#";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
|
||||
<!-- Monospace font for OCR view -->
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
|
||||
|
||||
<!-- regular JS -->
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function preload(arrayOfImages) {
|
||||
@@ -29,7 +35,7 @@
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#CheckOptionsShowPrevious').change(function() {
|
||||
$('#CheckOptionsShowPrevious').change(function () {
|
||||
var checked = $('#CheckOptionsShowPrevious').prop('checked');
|
||||
|
||||
if (checked) {
|
||||
@@ -39,7 +45,19 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#TablePayableCosts').datagrid(
|
||||
$('#CheckOptionsShowOcr').change(function () {
|
||||
var checked = $('#CheckOptionsShowOcr').prop('checked');
|
||||
|
||||
if (checked) {
|
||||
$('#divOcrView').show();
|
||||
$('#divNormalView').hide();
|
||||
} else {
|
||||
$('#divOcrView').hide();
|
||||
$('#divNormalView').show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#TablePayableCosts, #TablePayableCostsOcr').datagrid(
|
||||
{
|
||||
rowStyler: function (index, rowData) {
|
||||
if (rowData.databaseId != null) {
|
||||
@@ -55,130 +73,145 @@
|
||||
|
||||
onLoadSuccess: function () {
|
||||
|
||||
$(".LocalIconApproval").attr("src", "/Images/Icons/iconshock-balloon-yes-128x96px.png");
|
||||
$(".LocalIconApproved").attr("src", "/Images/Icons/iconshock-green-tick-128x96px.png").css("opacity", 0.5);
|
||||
$(".LocalIconDenied").attr("src", "/Images/Icons/iconshock-red-cross-circled-128x96px.png");
|
||||
$(".LocalIconUndo").attr("src", "/Images/Icons/iconshock-balloon-undo-128x96px.png");
|
||||
$(".LocalIconApproved.LocalPrototype, .LocalIconUndo.LocalPrototype, .LocalIconDenied.LocalPrototype, .LocalIconApproval.LocalPrevious, .LocalIconDenial.LocalPrevious, .LocalIconDenied.LocalPrevious").css("display", "none");
|
||||
$(".LocalIconDenial").attr("src", "/Images/Icons/iconshock-balloon-no-128x96px-disabled.png");
|
||||
$(".LocalIconApproval, .LocalIconUndo, .LocalIconDenial").css("cursor", "pointer");
|
||||
gridsLoaded++;
|
||||
|
||||
$(".LocalIconApproval").mouseover(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-128x96px-hot.png");
|
||||
}
|
||||
});
|
||||
if (gridsLoaded == 4) { // onLoadSuccess is triggered _twice_ per grid for some arcane reason
|
||||
|
||||
$(".LocalIconApproval").mouseout(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-128x96px.png");
|
||||
}
|
||||
});
|
||||
$('#divOcrView').hide();
|
||||
|
||||
$(".LocalIconUndo").mouseover(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-undo-128x96px-hot.png");
|
||||
}
|
||||
});
|
||||
$(".LocalIconApproval").attr("src", "/Images/Icons/iconshock-balloon-yes-128x96px.png");
|
||||
$(".LocalIconApproved").attr("src", "/Images/Icons/iconshock-green-tick-128x96px.png").css("opacity", 0.5);
|
||||
$(".LocalIconDenied").attr("src", "/Images/Icons/iconshock-red-cross-circled-128x96px.png");
|
||||
$(".LocalIconUndo").attr("src", "/Images/Icons/iconshock-balloon-undo-128x96px.png");
|
||||
$(".LocalIconApproved.LocalPrototype, .LocalIconUndo.LocalPrototype, .LocalIconDenied.LocalPrototype, .LocalIconApproval.LocalPrevious, .LocalIconDenial.LocalPrevious, .LocalIconDenied.LocalPrevious").css("display", "none");
|
||||
$(".LocalIconDenial").attr("src", "/Images/Icons/iconshock-balloon-no-128x96px-disabled.png");
|
||||
$(".LocalIconApproval, .LocalIconUndo, .LocalIconDenial").css("cursor", "pointer");
|
||||
|
||||
$(".LocalIconUndo").mouseout(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-undo-128x96px.png");
|
||||
}
|
||||
});
|
||||
$(".LocalIconApproval").mouseover(function() {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-128x96px-hot.png");
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconDenial").mouseover(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-no-128x96px-hot-disabled.png");
|
||||
}
|
||||
});
|
||||
$(".LocalIconApproval").mouseout(function() {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-128x96px.png");
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconDenial").mouseout(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-no-128x96px-disabled.png");
|
||||
}
|
||||
});
|
||||
$(".LocalIconUndo").mouseover(function() {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-undo-128x96px-hot.png");
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconApproval").click(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(".LocalIconUndo").mouseout(function() {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-undo-128x96px.png");
|
||||
}
|
||||
});
|
||||
|
||||
var jsonData = {};
|
||||
jsonData.protoIdentity = $(this).attr("baseid");
|
||||
$(".LocalIconDenial").mouseover(function() {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-no-128x96px-hot-disabled.png");
|
||||
}
|
||||
});
|
||||
|
||||
$(this).attr("rel", "loading");
|
||||
$(this).attr("src", "/Images/Abstract/ajaxloader-48x36px.gif");
|
||||
$("#IconDenial" + $(this).attr("baseid").replace(/\|/g,'')).fadeTo(1000, 0.01);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/Pages/v5/Financial/PayOutMoney.aspx/ConfirmPayout",
|
||||
data: $.toJSON(jsonData),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: $.proxy(function (msg) {
|
||||
var baseid = $(this).attr("baseid").replace(/\|/g, '');
|
||||
$(this).attr("databaseid", msg.d.AssignedId);
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-128x96px.png");
|
||||
$(this).attr("rel", "active");
|
||||
$(this).hide();
|
||||
$("#IconApproved" + baseid).fadeTo(250, 0.5);
|
||||
$("#IconDenial" + baseid).css('opacity', 1.0).hide();
|
||||
$("#IconUndo" + baseid).fadeIn(100);
|
||||
$('.row' + baseid).animate({ color: "#AAA" }, 400);
|
||||
alertify.success(msg.d.DisplayMessage);
|
||||
}, this)
|
||||
});
|
||||
}
|
||||
});
|
||||
$(".LocalIconDenial").mouseout(function() {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-no-128x96px-disabled.png");
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconUndo").click(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
var jsonData = {};
|
||||
jsonData.databaseId = $("#IconApproval" + $(this).attr("baseid").replace(/\|/g, '')).attr("databaseid");
|
||||
$(".LocalIconApproval").click(function() {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
|
||||
$(this).attr("rel", "loading");
|
||||
$(this).attr("src", "/Images/Abstract/ajaxloader-medium.gif");
|
||||
$("#IconApproved" + $(this).attr("baseid").replace(/\|/g, '')).fadeTo(1000, 0.01);
|
||||
var jsonData = {};
|
||||
jsonData.protoIdentity = $(this).attr("baseid");
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/Pages/v5/Financial/PayOutMoney.aspx/UndoPayout",
|
||||
data: $.toJSON(jsonData),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: $.proxy(function (msg) {
|
||||
if (msg.d.Success) {
|
||||
$(this).attr("rel", "loading");
|
||||
$(this).attr("src", "/Images/Abstract/ajaxloader-48x36px.gif");
|
||||
$(".IconDenial" + $(this).attr("baseid").replace(/\|/g, '')).fadeTo(1000, 0.01);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/Pages/v5/Financial/PayOutMoney.aspx/ConfirmPayout",
|
||||
data: $.toJSON(jsonData),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: $.proxy(function(msg) {
|
||||
var baseid = $(this).attr("baseid").replace(/\|/g, '');
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-undo-128x96px.png");
|
||||
$(this).attr("rel", "");
|
||||
$(this).attr("databaseid", msg.d.AssignedId);
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-128x96px.png");
|
||||
$(this).attr("rel", "active");
|
||||
$(this).hide();
|
||||
$("#IconApproved" + baseid).css('opacity', 1.0).hide();
|
||||
$("#IconApproval" + baseid).fadeIn(100);
|
||||
$("#IconDenial" + baseid).fadeIn(100);
|
||||
$('.row' + baseid).animate({ color: "#000" }, 100);
|
||||
alertify.log(msg.d.DisplayMessage);
|
||||
} else {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-green-tick-128x96px.png");
|
||||
alertify.error(msg.d.DisplayMessage);
|
||||
// TODO: Add alert box?
|
||||
}
|
||||
}, this)
|
||||
});
|
||||
$(".IconApproved" + baseid).fadeTo(250, 0.5);
|
||||
$(".IconDenial" + baseid).css('opacity', 1.0).hide();
|
||||
$(".IconUndo" + baseid).fadeIn(100);
|
||||
$('.row' + baseid).animate({ color: "#AAA" }, 400);
|
||||
alertify.success(msg.d.DisplayMessage);
|
||||
}, this)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
$(".LocalIconUndo").click(function() {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
var jsonData = {};
|
||||
jsonData.databaseId = $(".IconApproval" + $(this).attr("baseid").replace(/\|/g, '')).attr("databaseid");
|
||||
|
||||
$(this).attr("rel", "loading");
|
||||
$(this).attr("src", "/Images/Abstract/ajaxloader-medium.gif");
|
||||
$("#IconApproved" + $(this).attr("baseid").replace(/\|/g, '')).fadeTo(1000, 0.01);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/Pages/v5/Financial/PayOutMoney.aspx/UndoPayout",
|
||||
data: $.toJSON(jsonData),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: $.proxy(function(msg) {
|
||||
if (msg.d.Success) {
|
||||
var baseid = $(this).attr("baseid").replace(/\|/g, '');
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-undo-128x96px.png");
|
||||
$(this).attr("rel", "");
|
||||
$(this).hide();
|
||||
$(".IconApproved" + baseid).css('opacity', 1.0).hide();
|
||||
$(".IconApproval" + baseid).fadeIn(100);
|
||||
$(".IconDenial" + baseid).fadeIn(100);
|
||||
$('.row' + baseid).animate({ color: "#000" }, 100);
|
||||
alertify.log(msg.d.DisplayMessage);
|
||||
} else {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-green-tick-128x96px.png");
|
||||
alertify.error(msg.d.DisplayMessage);
|
||||
// TODO: Add alert box?
|
||||
}
|
||||
}, this)
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
var gridsLoaded = 0;
|
||||
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
.datagrid-row-selected,.datagrid-row-over{
|
||||
background:transparent;
|
||||
}
|
||||
.datagrid-row .ocrFont { /* this is necessary for OCR to work as expected */
|
||||
font-family: Droid Sans Mono;
|
||||
font-weight: bold;
|
||||
font-size: 120%;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.LocalIconApproval, .LocalIconApproved {
|
||||
padding-right: 3px;
|
||||
}
|
||||
@@ -193,22 +226,40 @@
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
|
||||
<h2><asp:Label runat="server" ID="LabelPayOutMoneyHeader" Text="XYZ Costs Awaiting Payment" /></h2>
|
||||
<table id="TablePayableCosts" class="easyui-datagrid" style="width:680px;height:500px"
|
||||
data-options="rownumbers:false,singleSelect:false,fit:false,fitColumns:true,loading:false,selectOnCheck:true,checkOnSelect:true,url:'Json-PayableCosts.aspx'"
|
||||
idField="itemId">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-options="field:'due',width:70"><asp:Label ID="LabelGridHeaderDue" runat="server" Text="XYZ Due"/></th>
|
||||
<th data-options="field:'recipient',width:100,sortable:true"><asp:Label ID="LabelGridHeaderRecipient" runat="server" Text="XYZ Beneficiary" /></th>
|
||||
<th data-options="field:'bank',width:80"><asp:Label ID="LabelGridHeaderBank" runat="server" Text="XYZ Bank" /></th>
|
||||
<th data-options="field:'account',width:90,sortable:true"><asp:Label ID="LabelGridHeaderAccount" runat="server" Text="XYZ Account" /></th>
|
||||
<th data-options="field:'reference',width:160,sortable:true,order:'asc'"><asp:Label ID="LabelGridHeaderReference" runat="server" Text="XYZ Reference" /></th>
|
||||
<th data-options="field:'amount',width:80,align:'right'"><asp:Label ID="LabelGridHeaderAmount" runat="server" Text="XYZ Amount" /></th>
|
||||
<th data-options="field:'action',width:53,align:'center'"><asp:Label ID="LabelGridHeaderPaid" runat="server" Text="XYZPaid" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div id="divNormalView">
|
||||
<h2><asp:Label runat="server" ID="LabelPayOutMoneyHeader" Text="XYZ Costs Awaiting Payment" /></h2>
|
||||
<table id="TablePayableCosts" class="easyui-datagrid" style="width:680px;height:500px"
|
||||
data-options="rownumbers:false,singleSelect:false,fit:false,fitColumns:true,loading:false,selectOnCheck:true,checkOnSelect:true,url:'Json-PayableCosts.aspx'"
|
||||
idField="itemId">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-options="field:'due',width:70"><asp:Label ID="LabelGridHeaderDue" runat="server" Text="XYZ Due"/></th>
|
||||
<th data-options="field:'recipient',width:100,sortable:true"><asp:Label ID="LabelGridHeaderRecipient" runat="server" Text="XYZ Beneficiary" /></th>
|
||||
<th data-options="field:'bank',width:80"><asp:Label ID="LabelGridHeaderBank" runat="server" Text="XYZ Bank" /></th>
|
||||
<th data-options="field:'account',width:90,sortable:true"><asp:Label ID="LabelGridHeaderAccount" runat="server" Text="XYZ Account" /></th>
|
||||
<th data-options="field:'reference',width:160,sortable:true,order:'asc'"><asp:Label ID="LabelGridHeaderReference" runat="server" Text="XYZ Reference" /></th>
|
||||
<th data-options="field:'amount',width:80,align:'right'"><asp:Label ID="LabelGridHeaderAmount" runat="server" Text="XYZ Amount" /></th>
|
||||
<th data-options="field:'action',width:53,align:'center'"><asp:Label ID="LabelGridHeaderPaid" runat="server" Text="XYZPaid" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div id="divOcrView">
|
||||
<h2><asp:Label runat="server" ID="LabelPayOutMoneyOcrHeader" Text="XYZ Costs In Ocr View" /></h2>
|
||||
<table id="TablePayableCostsOcr" class="easyui-datagrid" style="width:680px;height:500px"
|
||||
data-options="rownumbers:false,singleSelect:false,fit:false,fitColumns:true,loading:false,selectOnCheck:true,checkOnSelect:true,url:'Json-PayableCostsOcr.aspx'"
|
||||
idField="itemId">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-options="field:'due',width:70"><asp:Label ID="LabelGridHeaderDue2" runat="server" Text="XYZ Due"/></th>
|
||||
<th data-options="field:'reference',width:180, align:'right'"><asp:Label ID="LabelGridHeaderReferenceOcr" runat="server" Text="XYZ Reference" /></th>
|
||||
<th data-options="field:'amount',width:180, align: 'right'"><asp:Label ID="LabelGridHeaderAmountOcr" runat="server" Text="XYZ Amount" /></th>
|
||||
<th data-options="field:'account',width:150, align: 'right'"><asp:Label ID="LabelGridHeaderAccountOcr" runat="server" Text="XYZ Account" /></th>
|
||||
<th data-options="field:'action',width:53,align:'center'"><asp:Label ID="LabelGridHeaderPaid2" runat="server" Text="XYZPaid" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
|
||||
@@ -219,6 +270,9 @@
|
||||
<div class="link-row-encaps" style="cursor:default; margin-left:2px">
|
||||
<span style="position:relative;top:2px;left:1px"><input type="checkbox" id="CheckOptionsShowPrevious" /></span> <label for="CheckOptionsShowPrevious"><asp:Label ID="LabelOptionsShowPrevious" runat="server" Text="Show previous payouts XYZ"/></label>
|
||||
</div>
|
||||
<div class="link-row-encaps" style="cursor:default; margin-left:2px">
|
||||
<span style="position:relative;top:2px;left:1px"><input type="checkbox" id="CheckOptionsShowOcr" /></span> <label for="CheckOptionsShowOcr"><asp:Label ID="LabelOptionsShowOcr" runat="server" Text="Show previous payouts XYZ"/></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user