Improved tax level precision, import
This commit is contained in:
@@ -40,7 +40,7 @@ namespace Swarmops.Database
|
||||
|
||||
if (taxLevel < 0)
|
||||
{
|
||||
return -taxLevel/100.0; // -45 means 45% and should be returned as .45
|
||||
return -taxLevel/10000.0; // -4500 means 45% and should be returned as .45
|
||||
}
|
||||
|
||||
return taxLevel;
|
||||
@@ -72,13 +72,14 @@ namespace Swarmops.Database
|
||||
AddParameterWithName(command, "taxLevelId", taxLevelId);
|
||||
AddParameterWithName(command, "bracketLow", bracketLow);
|
||||
AddParameterWithName(command, "year", year);
|
||||
AddParameterWithName(command, "tax", tax < 1.0 ? (int)(-tax * 100) : (int)tax);
|
||||
AddParameterWithName(command, "tax", tax < 1.0 ? (int)(-tax * 10000) : (int)tax);
|
||||
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Obsolete ("We're using a new Year column rather than deleting obsolete tax data", false)]
|
||||
public void DeleteTaxLevels (int countryId)
|
||||
{
|
||||
using (DbConnection connection = GetMySqlDbConnection())
|
||||
|
||||
@@ -29,13 +29,12 @@ namespace Swarmops.Logic.Financial
|
||||
return taxLevel;
|
||||
}
|
||||
|
||||
static public void ImportTaxLevels (Country country, string data)
|
||||
static public void ImportTaxLevels (Country country, int year, string data)
|
||||
{
|
||||
// Lock out salary processing
|
||||
|
||||
Persistence.Key["TaxDataImporting"] = "1";
|
||||
|
||||
int year = DateTime.Today.Year;
|
||||
if (country.Code != "SE")
|
||||
{
|
||||
throw new NotImplementedException("Can't import this country's tax levels yet");
|
||||
}
|
||||
|
||||
string[] lines = data.Split('\n'); // if \r\n is used, the \r will be harmlessly at the end of lines
|
||||
|
||||
@@ -69,10 +68,6 @@ namespace Swarmops.Logic.Financial
|
||||
SwarmDb.GetDatabaseForWriting().CreateSalaryTaxLevel(country.Identity, taxLevelId, lowerBracket, year, tax);
|
||||
}
|
||||
}
|
||||
|
||||
// Re-enable salary processing
|
||||
|
||||
Persistence.Key["TaxDataImporting"] = "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user