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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user