Work on VAT reports
This commit is contained in:
@@ -206,8 +206,8 @@ namespace Swarmops.Logic.Financial
|
||||
// Create a corresponding financial transaction with rows
|
||||
|
||||
FinancialTransaction transaction =
|
||||
FinancialTransaction.Create (organization.Identity, DateTime.Now,
|
||||
"Invoice #" + newInvoice.Identity + " from " + supplier);
|
||||
FinancialTransaction.Create (organization.Identity, DateTime.UtcNow,
|
||||
"Invoice #" + newInvoice.OrganizationSequenceId + " from " + supplier);
|
||||
|
||||
transaction.AddRow (organization.FinancialAccounts.DebtsInboundInvoices, -amountCents, creatingPerson);
|
||||
if (vatCents > 0)
|
||||
|
||||
@@ -91,12 +91,19 @@ namespace Swarmops.Logic.Financial
|
||||
{
|
||||
// if there's anything to report
|
||||
|
||||
FinancialTransaction vatReportTransaction = FinancialTransaction.Create(organization, DateTime.UtcNow,
|
||||
FinancialTransaction vatReportTransaction = FinancialTransaction.Create(organization, endDate.AddDays(4).AddHours(9),
|
||||
transactionComment);
|
||||
vatReportTransaction.AddRow(organization.FinancialAccounts.AssetsVatInboundUnreported,
|
||||
-newReport.VatInboundCents, null);
|
||||
vatReportTransaction.AddRow(organization.FinancialAccounts.DebtsVatOutboundUnreported,
|
||||
newReport.VatOutboundCents, null); // not negative, because our number is sign-different from the bookkeeping's
|
||||
if (newReport.VatInboundCents > 0)
|
||||
{
|
||||
vatReportTransaction.AddRow(organization.FinancialAccounts.AssetsVatInboundUnreported,
|
||||
-newReport.VatInboundCents, null);
|
||||
}
|
||||
if (newReport.VatOutboundCents > 0)
|
||||
{
|
||||
vatReportTransaction.AddRow(organization.FinancialAccounts.DebtsVatOutboundUnreported,
|
||||
newReport.VatOutboundCents, null);
|
||||
// not negative, because our number is sign-different from the bookkeeping's
|
||||
}
|
||||
|
||||
if (differenceCents < 0) // outbound > inbound
|
||||
{
|
||||
@@ -163,7 +170,7 @@ namespace Swarmops.Logic.Financial
|
||||
}
|
||||
else if (turnoverAccountLookup.ContainsKey(txRow.FinancialAccountId))
|
||||
{
|
||||
turnOver += txRow.AmountCents;
|
||||
turnOver -= txRow.AmountCents; // turnover accounts are sign reversed, so convert to positive
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Swarmops.Frontend
|
||||
|
||||
// BEGIN TEST CODE
|
||||
|
||||
//VatReports.CreateNewReports();
|
||||
// VatReports.CreateNewReports();
|
||||
|
||||
// END TEST CODE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user