Merge branch 'master' of https://github.com/Swarmops/Swarmops
This commit is contained in:
+2
-2
@@ -164,7 +164,7 @@ namespace Swarmops.Backend
|
||||
Persistence.Key["SwarmopsInstallationId"] = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
DateTime cycleStartTime = DateTime.Now;
|
||||
DateTime cycleStartTime = DateTime.UtcNow;
|
||||
|
||||
int lastSecond = cycleStartTime.Second;
|
||||
int lastMinute = cycleStartTime.Minute;
|
||||
@@ -176,7 +176,7 @@ namespace Swarmops.Backend
|
||||
{
|
||||
BotLog.Write (0, "MainCycle", "Cycle Start");
|
||||
|
||||
cycleStartTime = DateTime.Now;
|
||||
cycleStartTime = DateTime.UtcNow;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace Swarmops.Database
|
||||
}
|
||||
|
||||
|
||||
private string SqlSanitize (string input)
|
||||
private string SqlSanitize (string input) // TODO: Replace with parameterized queries everywhere.
|
||||
{
|
||||
string[] forbiddenArray =
|
||||
{
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace Swarmops.Database
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Creation and manipulation - stored procedures
|
||||
|
||||
public int CreateCurrency (string code, string name, string sign)
|
||||
|
||||
@@ -31,28 +31,42 @@ namespace Swarmops.Database
|
||||
#endregion
|
||||
|
||||
#region Record reading - SELECT statements
|
||||
/*
|
||||
public BasicCurrency GetCurrency(int currencyId)
|
||||
|
||||
public double GetCurrencyExchangeRate (int fromCurrencyId, int toCurrencyId, DateTime valuationDateTime)
|
||||
{
|
||||
using (DbConnection connection = GetMySqlDbConnection())
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
DbCommand command =
|
||||
GetDbCommand(
|
||||
"SELECT" + currencyFieldSequence + "WHERE CurrencyId=" + currencyId + ";", connection);
|
||||
GetDbCommand(String.Format (
|
||||
"SELECT CurrencyExchangeRateSnapshotData.CurrencyAId AS CurrencyAId, " +
|
||||
" CurrencyExchangeRateSnapshotData.CurrencyBId AS CurrencyBId, " +
|
||||
" CurrencyExchangeRateSnapshotData.APerB AS Rate, " +
|
||||
" CurrencyExchangeRateSnapshots.DateTime AS RateTime " +
|
||||
" FROM CurrencyExchangeRateSnapshotData " +
|
||||
" JOIN CurrencyExchangeRateSnapshots USING (CurrencyExchangeRateSnapshotId)" +
|
||||
" WHERE CurrencyAId = {0} AND CurrencyBId = {1} AND CurrencyExchangeRateSnapshots.DateTime < @valuationDateTime " +
|
||||
" ORDER BY CurrencyExchangeRateSnapshots.DateTime DESC " +
|
||||
" LIMIT 1;", fromCurrencyId, toCurrencyId), connection);
|
||||
|
||||
AddParameterWithName (command, "valuationDateTime", valuationDateTime);
|
||||
|
||||
using (DbDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
return ReadCurrencyFromDataReader(reader);
|
||||
DateTime testDate = reader.GetDateTime (3);
|
||||
|
||||
return reader.GetDouble(2);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unknown Currency Id: " + currencyId);
|
||||
throw new ArgumentException("Unknown Exchange Rate");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
public BasicCurrency GetCurrency(string currencyCode)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
using NBitcoin;
|
||||
using Swarmops.Basic.Types;
|
||||
using Swarmops.Database;
|
||||
|
||||
@@ -23,6 +25,50 @@ namespace Swarmops.Logic.Financial
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsBitcoin
|
||||
{
|
||||
get { return (base.Code == "BTC"); }
|
||||
}
|
||||
|
||||
public static Currency Bitcoin
|
||||
{
|
||||
get { return Currency.FromCode ("BTC"); }
|
||||
}
|
||||
|
||||
|
||||
public double GetConversionRate (Currency otherCurrency)
|
||||
{
|
||||
return GetConversionRate (otherCurrency, DateTime.UtcNow);
|
||||
}
|
||||
|
||||
|
||||
public double GetConversionRate (Currency otherCurrency, DateTime valuationDateTime)
|
||||
{
|
||||
if (this.IsBitcoin)
|
||||
{
|
||||
return SwarmDb.GetDatabaseForReading()
|
||||
.GetCurrencyExchangeRate (otherCurrency.Identity, this.Identity, valuationDateTime);
|
||||
}
|
||||
else if (otherCurrency.IsBitcoin)
|
||||
{
|
||||
return 1.0 / SwarmDb.GetDatabaseForReading()
|
||||
.GetCurrencyExchangeRate (otherCurrency.Identity, this.Identity, valuationDateTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Neither is bitcoin, so go via bitcoin
|
||||
|
||||
int bitcoinCurrencyId = Currency.Bitcoin.Identity;
|
||||
double thisPerBitcoin = SwarmDb.GetDatabaseForReading()
|
||||
.GetCurrencyExchangeRate (this.Identity, bitcoinCurrencyId, valuationDateTime);
|
||||
double otherPerBitcoin = SwarmDb.GetDatabaseForReading()
|
||||
.GetCurrencyExchangeRate (otherCurrency.Identity, bitcoinCurrencyId, valuationDateTime);
|
||||
|
||||
return otherPerBitcoin/thisPerBitcoin; // returns other-per-this, allowing multiplication with exchange rate
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Currency FromBasic (BasicCurrency basic)
|
||||
{
|
||||
return new Currency (basic);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Swarmops.Logic.Financial
|
||||
{
|
||||
public class Money
|
||||
{
|
||||
public Currency Currency { get; set; }
|
||||
public Int64 Cents { get; set; }
|
||||
public DateTime ValuationDateTime { get; set; }
|
||||
|
||||
public Money ToCurrency (Currency newCurrency)
|
||||
{
|
||||
double conversionRate = this.Currency.GetConversionRate (newCurrency, this.ValuationDateTime);
|
||||
|
||||
return new Money {
|
||||
Currency = newCurrency,
|
||||
Cents = (Int64) (this.Cents * conversionRate),
|
||||
ValuationDateTime = this.ValuationDateTime };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,6 +138,7 @@
|
||||
<Compile Include="Financial\FinancialTransactionTagTypes.cs" />
|
||||
<Compile Include="Financial\ImportedBankData.cs" />
|
||||
<Compile Include="Financial\ISummable.cs" />
|
||||
<Compile Include="Financial\Money.cs" />
|
||||
<Compile Include="Financial\StockBankDataReaders.cs" />
|
||||
<Compile Include="Financial\YearlyReport.cs" />
|
||||
<Compile Include="Security\Accesses.cs" />
|
||||
|
||||
@@ -2,11 +2,13 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using Resources;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Support;
|
||||
@@ -44,6 +46,7 @@ namespace Swarmops
|
||||
_currentOrganization = Organization.Sandbox;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void Page_Load (object sender, EventArgs e)
|
||||
|
||||
@@ -16,6 +16,9 @@ namespace Swarmops.Plugins.Stock.TaxForms
|
||||
{
|
||||
public partial class MonthlyTaxFormSE : DataV5Base
|
||||
{
|
||||
private Font _fontHandwriting;
|
||||
private Brush _brushHandwriting;
|
||||
|
||||
protected void Page_Load (object sender, EventArgs e)
|
||||
{
|
||||
string monthString = Request.QueryString["YearMonth"];
|
||||
@@ -25,7 +28,7 @@ namespace Swarmops.Plugins.Stock.TaxForms
|
||||
int year = Int32.Parse (monthString.Substring (0, 4));
|
||||
int month = Int32.Parse (monthString.Substring (4)); // never mind input checking
|
||||
|
||||
int[] yearBreakpoints = { 1938, year-65, year-26 };
|
||||
int[] yearBreakpoints = {1938, year - 65, year - 26};
|
||||
double[] taxRates = {10.21, 15.49, 31.42}; // will need to adapt this when some of the rates change
|
||||
|
||||
SalaryTaxData data = GetSalaryData (year, month, organization, yearBreakpoints);
|
||||
@@ -38,17 +41,62 @@ namespace Swarmops.Plugins.Stock.TaxForms
|
||||
formVersion = 2010;
|
||||
}
|
||||
|
||||
Dictionary<int, Dictionary<GraphicsElement, int>> coord =
|
||||
new Dictionary<int, Dictionary<GraphicsElement, int>>();
|
||||
|
||||
// Coordinates for various elements on the form versions
|
||||
|
||||
coord[2010] = new Dictionary<GraphicsElement, int>();
|
||||
coord[2015] = new Dictionary<GraphicsElement, int>();
|
||||
|
||||
coord[2010][GraphicsElement.LeftColumnX] = 775;
|
||||
coord[2010][GraphicsElement.RightColumnX] = 1492;
|
||||
|
||||
coord[2015][GraphicsElement.LeftColumnX] = 800;
|
||||
coord[2015][GraphicsElement.RightColumnX] = 1512;
|
||||
|
||||
coord[2010][GraphicsElement.AgeBracketMainY] = 694;
|
||||
coord[2010][GraphicsElement.AgeBracketDistY] = 67;
|
||||
|
||||
coord[2015][GraphicsElement.AgeBracketMainY] = 770;
|
||||
coord[2015][GraphicsElement.AgeBracketDistY] = 65;
|
||||
|
||||
coord[2010][GraphicsElement.SalaryY] = 360;
|
||||
coord[2010][GraphicsElement.SalaryTotalY] = 560;
|
||||
coord[2010][GraphicsElement.AdditiveTaxTotalY] = 1329;
|
||||
coord[2010][GraphicsElement.DeductedTaxY] = 1529;
|
||||
coord[2010][GraphicsElement.DeductedTaxTotalY] = 1727;
|
||||
coord[2010][GraphicsElement.SummaryTotalY] = 1795;
|
||||
|
||||
coord[2015][GraphicsElement.SalaryY] = 440;
|
||||
coord[2015][GraphicsElement.SalaryTotalY] = 640;
|
||||
coord[2015][GraphicsElement.AdditiveTaxTotalY] = 1395;
|
||||
coord[2015][GraphicsElement.DeductedTaxY] = 1560;
|
||||
coord[2015][GraphicsElement.DeductedTaxTotalY] = 1759;
|
||||
coord[2015][GraphicsElement.SummaryTotalY] = 1825;
|
||||
|
||||
|
||||
|
||||
Image form = Image.FromFile (MapPath (".") + "/MonthlyTaxForm-SE-" + formVersion + ".png"); // the "." says "in same folder as this file"
|
||||
|
||||
CultureInfo swedishCulture = CultureInfo.CreateSpecificCulture ("sv-SE");
|
||||
monthString = new DateTime(year, month, 1).ToString("MMMM yyyy", swedishCulture);
|
||||
|
||||
string orgNumber = "xxxxxx-xxxx";
|
||||
string sansFontName = "Liberation Sans";
|
||||
string courierFontName = "Liberation Mono";
|
||||
int smallSize = 18;
|
||||
int regularSize = 24;
|
||||
int handWriteSize = 36;
|
||||
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
sansFontName = "Arial"; // yeahyeah...
|
||||
courierFontName = "Courier New";
|
||||
orgNumber = "DEBUGGER ATTACHED";
|
||||
smallSize = 24;
|
||||
regularSize = 30;
|
||||
handWriteSize = 48;
|
||||
}
|
||||
|
||||
using (Graphics graphics = Graphics.FromImage (form))
|
||||
@@ -56,87 +104,114 @@ namespace Swarmops.Plugins.Stock.TaxForms
|
||||
StringFormat rightAlign = new StringFormat();
|
||||
rightAlign.Alignment = StringAlignment.Far;
|
||||
|
||||
Font fontHandwriting = new Font (courierFontName, 64, FontStyle.Bold);
|
||||
Font fontPreprinted = new Font (courierFontName, 30, FontStyle.Bold);
|
||||
Font fontPreprintedSmall = new Font (courierFontName, 24, FontStyle.Bold);
|
||||
Font fontPreprintedSans = new Font (sansFontName, 30, FontStyle.Bold);
|
||||
_fontHandwriting = new Font (sansFontName, handWriteSize, FontStyle.Bold);
|
||||
Font fontPreprinted = new Font (courierFontName, regularSize, FontStyle.Bold);
|
||||
Font fontPreprintedSmall = new Font (courierFontName, smallSize, FontStyle.Bold);
|
||||
Font fontPreprintedSans = new Font (sansFontName, regularSize, FontStyle.Bold);
|
||||
|
||||
Brush brushHandwriting = Brushes.Blue;
|
||||
_brushHandwriting = Brushes.Blue;
|
||||
Brush brushPreprinted = Brushes.Red;
|
||||
Brush brushPreprintedDiscreet = Brushes.DarkRed;
|
||||
|
||||
graphics.CompositingQuality = CompositingQuality.HighQuality;
|
||||
graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
|
||||
// Draw the header and monthname - things to pay attention to
|
||||
|
||||
graphics.DrawString (organization.Name, fontPreprinted, brushPreprinted, 150, 170);
|
||||
// Draw the header and monthname - things to pay attention to when looking at cheat sheet
|
||||
|
||||
if (year <= 2014)
|
||||
{
|
||||
graphics.DrawString (monthString, fontPreprinted, brushPreprinted, 680, 292);
|
||||
graphics.DrawString (monthString, fontPreprinted, brushPreprinted, 620, 1460);
|
||||
graphics.DrawString(organization.Name, fontPreprinted, brushPreprinted, 150, 170);
|
||||
|
||||
graphics.DrawString(monthString, fontPreprinted, brushPreprinted, 676, 288);
|
||||
graphics.DrawString (monthString, fontPreprinted, brushPreprinted, 610, 1455);
|
||||
graphics.DrawString (String.Format ("{0,4}-{1:D2}-{2:D2}", year, month + 1, 12), fontPreprinted,
|
||||
brushPreprinted, 820, 160);
|
||||
graphics.DrawString ("xxxxxx-xxxx", fontPreprinted, brushPreprinted, 1110, 160);
|
||||
graphics.DrawString (orgNumber, fontPreprinted, brushPreprinted, 1110, 160);
|
||||
|
||||
// Draw the years and tax rates and other on-form constants more discreetly
|
||||
|
||||
graphics.DrawString(taxRates[2].ToString("F2", swedishCulture), fontPreprintedSmall,
|
||||
brushPreprintedDiscreet, 840, 729);
|
||||
graphics.DrawString(taxRates[1].ToString("F2", swedishCulture), fontPreprintedSmall,
|
||||
brushPreprintedDiscreet, 840, 796);
|
||||
graphics.DrawString(taxRates[0].ToString("F2", swedishCulture), fontPreprintedSmall,
|
||||
brushPreprintedDiscreet, 840, 863);
|
||||
|
||||
graphics.DrawString(string.Format("{0} - {1}", yearBreakpoints[1], yearBreakpoints[2] - 1),
|
||||
fontPreprintedSmall, brushPreprintedDiscreet, 190, 729);
|
||||
graphics.DrawString(string.Format("{0} -", yearBreakpoints[2] - 1),
|
||||
fontPreprintedSmall, brushPreprintedDiscreet, 190, 796);
|
||||
graphics.DrawString(string.Format("{0}", yearBreakpoints[1] - 1),
|
||||
fontPreprintedSmall, brushPreprintedDiscreet, 250, 859);
|
||||
}
|
||||
else // the latest revision of the tax form
|
||||
{
|
||||
graphics.DrawString (monthString, fontPreprintedSans, brushPreprinted, 670, 287);
|
||||
graphics.DrawString (monthString, fontPreprintedSans, brushPreprinted, 610, 1455);
|
||||
graphics.DrawString(organization.Name.ToUpperInvariant(), fontPreprinted, brushPreprinted, 840, 255);
|
||||
|
||||
graphics.DrawString(monthString, fontPreprintedSans, brushPreprinted, 702, 363);
|
||||
graphics.DrawString (monthString, fontPreprintedSans, brushPreprinted, 639, 1485);
|
||||
graphics.DrawString (String.Format ("{0,4}-{1:D2}-{2:D2}", year, month + 1, 12), fontPreprinted,
|
||||
brushPreprinted, 820, 160);
|
||||
graphics.DrawString ("xxxxxx-xxxx", fontPreprinted, brushPreprinted, 1110, 160);
|
||||
brushPreprinted, 840, 180);
|
||||
graphics.DrawString (orgNumber, fontPreprinted, brushPreprinted, 1125, 180);
|
||||
|
||||
// Draw the years and tax rates and other on-form constants more discreetly
|
||||
|
||||
graphics.DrawString(taxRates[2].ToString("F2", swedishCulture), fontPreprintedSmall,
|
||||
brushPreprintedDiscreet, 870, 798);
|
||||
graphics.DrawString(taxRates[1].ToString("F2", swedishCulture), fontPreprintedSmall,
|
||||
brushPreprintedDiscreet, 870, 865);
|
||||
graphics.DrawString(taxRates[0].ToString("F2", swedishCulture), fontPreprintedSmall,
|
||||
brushPreprintedDiscreet, 870, 932);
|
||||
|
||||
graphics.DrawString(string.Format("{0} - {1}", yearBreakpoints[1], yearBreakpoints[2] - 1),
|
||||
fontPreprintedSmall, brushPreprintedDiscreet, 220, 800);
|
||||
graphics.DrawString(string.Format("{0} -", yearBreakpoints[2] - 1),
|
||||
fontPreprintedSmall, brushPreprintedDiscreet, 220, 863);
|
||||
graphics.DrawString(string.Format("{0}", yearBreakpoints[1] - 1),
|
||||
fontPreprintedSmall, brushPreprintedDiscreet, 270, 924);
|
||||
}
|
||||
|
||||
// Draw the years and tax rates and other on-form constants more discreetly
|
||||
// Draw the actual numbers: First, salary totals
|
||||
|
||||
graphics.DrawString (taxRates[2].ToString ("F2", swedishCulture), fontPreprintedSmall,
|
||||
brushPreprintedDiscreet, 828, 731);
|
||||
graphics.DrawString (taxRates[1].ToString ("F2", swedishCulture), fontPreprintedSmall,
|
||||
brushPreprintedDiscreet, 828, 798);
|
||||
graphics.DrawString (taxRates[0].ToString ("F2", swedishCulture), fontPreprintedSmall,
|
||||
brushPreprintedDiscreet, 828, 865);
|
||||
DrawWrittenNumber(data.SalaryTotal, coord[formVersion][GraphicsElement.LeftColumnX], coord[formVersion][GraphicsElement.SalaryY], graphics);
|
||||
DrawWrittenNumber(data.SalaryTotal, coord[formVersion][GraphicsElement.LeftColumnX], coord[formVersion][GraphicsElement.SalaryTotalY], graphics);
|
||||
|
||||
graphics.DrawString (string.Format ("{0} - {1}", yearBreakpoints[1], yearBreakpoints[2] - 1),
|
||||
fontPreprintedSmall, brushPreprintedDiscreet, 200, 731);
|
||||
graphics.DrawString (string.Format ("{0} -", yearBreakpoints[2] - 1),
|
||||
fontPreprintedSmall, brushPreprintedDiscreet, 200, 798);
|
||||
graphics.DrawString (string.Format ("{0}", yearBreakpoints[1] - 1),
|
||||
fontPreprintedSmall, brushPreprintedDiscreet, 252, 861);
|
||||
|
||||
// Draw the actual numbers
|
||||
|
||||
graphics.DrawString (data.SalaryTotal.ToString ("F0"), fontHandwriting, brushHandwriting, 792, 358,
|
||||
rightAlign); // Salary total sub
|
||||
graphics.DrawString (data.SalaryTotal.ToString ("F0"), fontHandwriting, brushHandwriting, 792, 558,
|
||||
rightAlign); // Salary total total
|
||||
// Additive tax
|
||||
|
||||
for (int ageBracket = 0; ageBracket <= 2; ageBracket++)
|
||||
{
|
||||
if (data.Salary[ageBracket] > 0.0)
|
||||
{
|
||||
graphics.DrawString (data.Salary[ageBracket].ToString ("F0"), fontHandwriting, brushHandwriting,
|
||||
792, 692 + ageBracket*67, rightAlign); // Salary
|
||||
graphics.DrawString (data.TaxAdditive[ageBracket].ToString ("F0"), fontHandwriting,
|
||||
brushHandwriting, 1510, 692 + ageBracket*67, rightAlign); // Employer's fee
|
||||
DrawWrittenNumber(data.Salary[ageBracket], coord[formVersion][GraphicsElement.LeftColumnX],
|
||||
coord[formVersion][GraphicsElement.AgeBracketMainY] +
|
||||
coord[formVersion][GraphicsElement.AgeBracketDistY] * ageBracket,
|
||||
graphics);
|
||||
|
||||
DrawWrittenNumber(data.TaxAdditive[ageBracket], coord[formVersion][GraphicsElement.RightColumnX],
|
||||
coord[formVersion][GraphicsElement.AgeBracketMainY] +
|
||||
coord[formVersion][GraphicsElement.AgeBracketDistY] * ageBracket,
|
||||
graphics);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
graphics.DrawString(data.SalaryTotal.ToString("F0"), fontHandwriting, brushHandwriting, 792, 1524,
|
||||
rightAlign); // Salary total again
|
||||
graphics.DrawString (data.SalaryTotal.ToString ("F0"), fontHandwriting, brushHandwriting, 792, 1725,
|
||||
rightAlign); // Salary total again
|
||||
graphics.DrawString(data.TaxAdditiveTotal.ToString("F0"), fontHandwriting, brushHandwriting, 1510,
|
||||
1326, rightAlign); // Emp fee total
|
||||
graphics.DrawString (data.TaxSubtractiveTotal.ToString ("F0"), fontHandwriting, brushHandwriting, 1510, 1525,
|
||||
rightAlign); // Deducted main
|
||||
graphics.DrawString (data.TaxSubtractiveTotal.ToString ("F0"), fontHandwriting, brushHandwriting, 1510, 1726,
|
||||
rightAlign); // Deducted total
|
||||
graphics.DrawString (data.TaxTotal.ToString ("F0"), fontHandwriting, brushHandwriting, 1510, 1793,
|
||||
rightAlign); // Tax cost total
|
||||
DrawWrittenNumber (data.TaxAdditiveTotal, coord[formVersion][GraphicsElement.RightColumnX], coord[formVersion][GraphicsElement.AdditiveTaxTotalY], graphics);
|
||||
|
||||
// Deducted taxes
|
||||
|
||||
DrawWrittenNumber(data.SalaryTotal, coord[formVersion][GraphicsElement.LeftColumnX], coord[formVersion][GraphicsElement.DeductedTaxY], graphics);
|
||||
DrawWrittenNumber(data.SalaryTotal, coord[formVersion][GraphicsElement.LeftColumnX], coord[formVersion][GraphicsElement.DeductedTaxTotalY], graphics);
|
||||
|
||||
DrawWrittenNumber(data.TaxSubtractiveTotal, coord[formVersion][GraphicsElement.RightColumnX], coord[formVersion][GraphicsElement.DeductedTaxY], graphics);
|
||||
DrawWrittenNumber(data.TaxSubtractiveTotal, coord[formVersion][GraphicsElement.RightColumnX], coord[formVersion][GraphicsElement.DeductedTaxTotalY], graphics);
|
||||
|
||||
// Grand total
|
||||
|
||||
DrawWrittenNumber (data.TaxTotal, coord[formVersion][GraphicsElement.RightColumnX], coord[formVersion][GraphicsElement.SummaryTotalY], graphics);
|
||||
}
|
||||
|
||||
// Write graphics buffer as PNG stream to Response object
|
||||
|
||||
using (Stream responseStream = Response.OutputStream)
|
||||
{
|
||||
form.Save (responseStream, ImageFormat.Png);
|
||||
@@ -145,6 +220,31 @@ namespace Swarmops.Plugins.Stock.TaxForms
|
||||
}
|
||||
|
||||
|
||||
private void DrawWrittenNumber (double number, int x, int y, Graphics graphics)
|
||||
{
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
x += 10; // Mono has different metrics because of bloody course it has
|
||||
}
|
||||
|
||||
// This inserts spaces between every other character
|
||||
string numberString = number.ToString ("F0");
|
||||
char space = ' ';
|
||||
string drawString = string.Empty + numberString[0];
|
||||
|
||||
for (int loop = 1; loop < numberString.Length; loop++)
|
||||
{
|
||||
drawString += space;
|
||||
drawString += numberString[loop];
|
||||
}
|
||||
|
||||
StringFormat rightAlign = new StringFormat();
|
||||
rightAlign.Alignment = StringAlignment.Far;
|
||||
|
||||
graphics.DrawString (drawString, _fontHandwriting, _brushHandwriting, x, y, rightAlign);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class SalaryTaxData
|
||||
{
|
||||
@@ -195,5 +295,21 @@ namespace Swarmops.Plugins.Stock.TaxForms
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private enum GraphicsElement
|
||||
{
|
||||
Unknown = 0,
|
||||
LeftColumnX,
|
||||
RightColumnX,
|
||||
AgeBracketMainY,
|
||||
AgeBracketDistY,
|
||||
AdditiveTaxTotalY,
|
||||
DeductedTaxY,
|
||||
DeductedTaxTotalY,
|
||||
SalaryY,
|
||||
SalaryTotalY,
|
||||
SummaryTopLineY,
|
||||
SummaryTotalY
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,10 @@ div.break
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
[style*="rtl"] .logoimage
|
||||
{
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
/* CURRENT USER INFO */
|
||||
@@ -111,6 +115,9 @@ div.currentuserinfo
|
||||
font-size:14px;
|
||||
}
|
||||
|
||||
[style*="rtl"] div.currentuserinfo {
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
/* MAIN TOP MENU */
|
||||
@@ -153,6 +160,11 @@ img
|
||||
left:-5px;
|
||||
}
|
||||
|
||||
[style*="rtl"] .searchbox {
|
||||
float: left;
|
||||
left: 5px;
|
||||
}
|
||||
|
||||
.searchbox input
|
||||
{
|
||||
width:150px;
|
||||
@@ -170,6 +182,12 @@ img
|
||||
font-family: Ubuntu, Liberation Sans, Arial, Helvetica, Sans-Serif;
|
||||
}
|
||||
|
||||
[style*="rtl"] .searchbox input {
|
||||
padding-left: inherit;
|
||||
padding-right: 26px;
|
||||
background-position-x: right;
|
||||
}
|
||||
|
||||
|
||||
#ctl00_MainMenu {
|
||||
font: 14px/20px Ubuntu !important;
|
||||
@@ -191,6 +209,10 @@ img
|
||||
width: 700px;
|
||||
}
|
||||
|
||||
[style*="rtl"] .mainbar {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.sidebar
|
||||
{
|
||||
float: right;
|
||||
@@ -198,6 +220,10 @@ img
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
[style*="rtl"] .sidebar {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.box
|
||||
{
|
||||
width: 100%;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
.sf-menu li {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.sf-menu ul {
|
||||
position: absolute;
|
||||
display: none;
|
||||
@@ -14,26 +15,45 @@
|
||||
left: 0;
|
||||
z-index: 9990;
|
||||
}
|
||||
|
||||
[style*="rtl"] .sf-menu ul { /* RTL override */
|
||||
left: inherit;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.sf-menu > li {
|
||||
float: left;
|
||||
}
|
||||
|
||||
[style*="rtl"] .sf-menu > li { /* RTL override */
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
.sf-menu li:hover > ul,
|
||||
.sf-menu li.sfHover > ul
|
||||
{
|
||||
display: block;
|
||||
box-shadow: #1C397E 0px 1px 1px 1px, #A2BEFF 0px 1px 5px 1px;
|
||||
box-shadow: 0px 1px 1px 1px #1C397E, 0px 1px 5px 1px #A2BEFF;
|
||||
}
|
||||
|
||||
|
||||
.sf-menu a {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.sf-menu ul ul {
|
||||
top: 0;
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
[style*="rtl"] .sf-menu ul ul { /* RTL override*/
|
||||
left: inherit;
|
||||
right: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*** SWARMOPS SKIN - HEAVILY MODIFIED FROM SUPERFISH DISTRO ***/
|
||||
|
||||
@@ -41,6 +61,13 @@
|
||||
float: left;
|
||||
margin-left: 14px;
|
||||
}
|
||||
|
||||
[style*="rtl"] .sf-menu {
|
||||
float: right;
|
||||
margin-left: inherit;
|
||||
margin-right: 14px;
|
||||
}
|
||||
|
||||
.sf-menu ul {
|
||||
box-shadow: 2px 2px 6px rgba(0,0,0,.2);
|
||||
min-width: 12em; /* allow long menu items to determine submenu width */
|
||||
@@ -62,6 +89,12 @@
|
||||
padding: 2px 10px 8px 12px;
|
||||
}
|
||||
|
||||
[style*="rtl"] .sf-menu ul a
|
||||
{
|
||||
padding: 2px 12px 8px 10px;
|
||||
}
|
||||
|
||||
|
||||
.sf-menu a:hover, .sf-menu li.sfHover > a
|
||||
{
|
||||
color: #7F5500;
|
||||
@@ -92,6 +125,12 @@
|
||||
left: -4px;
|
||||
}
|
||||
|
||||
[style*="rtl"] .sf-menu ul li img
|
||||
{
|
||||
left: 4px;
|
||||
}
|
||||
|
||||
|
||||
.sf-menu li {
|
||||
background: transparent;
|
||||
white-space: nowrap; /* no need for Supersubs plugin */
|
||||
@@ -102,9 +141,22 @@
|
||||
.sf-menu ul li {
|
||||
background: #E4ECFF;
|
||||
}
|
||||
|
||||
.sf-menu li.Submenu li.Submenu { /* default: LTR website */
|
||||
background: #FF00FF url('/Style/submenu-rightarrow.png') no-repeat right top; /* testing selector */
|
||||
padding-left: 20px; /* no icon */
|
||||
}
|
||||
|
||||
[style*="rtl"] .sf-menu li.Submenu li.Submenu { /* Right-to-left override */
|
||||
background: #FF0044 url('/Style/submenu-leftarrow.png') no-repeat right top; /* testing selector */
|
||||
padding-left: inherit;
|
||||
padding-right: 20px; /* no icon */
|
||||
}
|
||||
|
||||
/* -- commented out
|
||||
.sf-menu ul ul li {
|
||||
background: #FF00FF;
|
||||
}
|
||||
}*/
|
||||
|
||||
.sf-menu li:not(.Separator):hover, .sf-menu li.sfHover
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user