From 425cdffe5de5616aa15582b66b7b48abfd28da95 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Sun, 18 Jun 2017 16:04:09 +0200 Subject: [PATCH] Work on several items --- Database/Schemata/revisions.txt | 3 +- Database/Schemata/upgrade-0037.sql | 46 ++++++++++++ Database/Schemata/upgrade-0038.sql | 71 +++++++++++++++++++ .../Json-MasterPersonEditPaymentHistory.aspx | 1 + ...son-MasterPersonEditPaymentHistory.aspx.cs | 36 ++++++++++ ...rPersonEditPaymentHistory.aspx.designer.cs | 15 ++++ Site/Master-v5.master | 27 +++++-- Site/Master-v5.master.designer.cs | 63 ++++++++++++++++ Site/Site.csproj | 8 +++ 9 files changed, 265 insertions(+), 5 deletions(-) create mode 100644 Database/Schemata/upgrade-0037.sql create mode 100644 Database/Schemata/upgrade-0038.sql create mode 100644 Site/Automation/Json-MasterPersonEditPaymentHistory.aspx create mode 100644 Site/Automation/Json-MasterPersonEditPaymentHistory.aspx.cs create mode 100644 Site/Automation/Json-MasterPersonEditPaymentHistory.aspx.designer.cs diff --git a/Database/Schemata/revisions.txt b/Database/Schemata/revisions.txt index 5584c8a8..2a693997 100644 --- a/Database/Schemata/revisions.txt +++ b/Database/Schemata/revisions.txt @@ -33,4 +33,5 @@ 0033 - Added transaction row identity return, necessary for 0032 [RF] 0034 - Fix for SetFinancialTransactionRowNativeCurrency 0035 - Added OrganizationSequenceId on FinancialTransactions, VatCents setter on invoices [RF] -0036 - Added support for VatCents on ExpenseClaims [RF] \ No newline at end of file +0036 - Added support for VatCents on ExpenseClaims [RF] +0037 - Added Suppliers, ExternalContacts tables; no procs for them yet [RF] \ No newline at end of file diff --git a/Database/Schemata/upgrade-0037.sql b/Database/Schemata/upgrade-0037.sql new file mode 100644 index 00000000..5993a86d --- /dev/null +++ b/Database/Schemata/upgrade-0037.sql @@ -0,0 +1,46 @@ +ALTER TABLE `InboundInvoices` +ADD COLUMN `PayToBitcoinAddress` VARCHAR(128) NOT NULL DEFAULT '' AFTER `SupplierId`, +ADD COLUMN `PayToEthereumAddress` VARCHAR(128) NOT NULL DEFAULT '' AFTER `PayToBitcoinAddress` + +# + +CREATE TABLE `ExternalContacts` ( + `ExternalContactId` INT NOT NULL AUTO_INCREMENT, + `OrganizationId` INT NOT NULL DEFAULT 0, + `Name` VARCHAR(128) NOT NULL, + `Phone` VARCHAR(128) NOT NULL, + `Email` VARCHAR(128) NOT NULL, + `CultureId` VARCHAR(64) NOT NULL DEFAULT 'en-US', + `ExternalContactTypeId` INT NOT NULL DEFAULT 0, + PRIMARY KEY (`ExternalContactId`), + INDEX `Ix_OrganizationId` (`OrganizationId` ASC), + INDEX `Ix_TypeId` (`ExternalContactTypeId` ASC), + INDEX `Ix_Name` (`Name` ASC)) + +# + +CREATE TABLE `ExternalContactTypes` ( + `ExternalContactTypeId` INT NOT NULL AUTO_INCREMENT, + `Name` VARCHAR(128) NOT NULL, + PRIMARY KEY (`ExternalContactTypeId`), + INDEX `Ix_Name` (`Name` ASC)) + +# + +CREATE TABLE `Suppliers` ( + `SupplierId` INT NOT NULL AUTO_INCREMENT, + `OrganizationId` INT NOT NULL, + `Name` VARCHAR(128) NOT NULL DEFAULT '', + `ExternalContactId` INT NOT NULL DEFAULT 0, + `Street` VARCHAR(128) NOT NULL DEFAULT '', + `PostalCode` VARCHAR(45) NOT NULL DEFAULT '', + `City` VARCHAR(45) NOT NULL DEFAULT '', + `CountryId` INT NOT NULL DEFAULT '', + `Bank` VARCHAR(128) NOT NULL DEFAULT '', + `Account` VARCHAR(128) NOT NULL DEFAULT '', + `BitcoinAddress` VARCHAR(128) NOT NULL DEFAULT '', + `EthereumAddress` VARCHAR(128) NOT NULL DEFAULT '', + `VatId` VARCHAR(128) NOT NULL DEFAULT '', + PRIMARY KEY (`SupplierId`), + INDEX `Ix_Name` (`Name` ASC), + INDEX `Ix_Organization` (`OrganizationId` ASC)) diff --git a/Database/Schemata/upgrade-0038.sql b/Database/Schemata/upgrade-0038.sql new file mode 100644 index 00000000..3ec2aaa9 --- /dev/null +++ b/Database/Schemata/upgrade-0038.sql @@ -0,0 +1,71 @@ +CREATE TABLE `VatReports` ( + `VatReportId` INT NOT NULL AUTO_INCREMENT, + `OrganizationId` INT NOT NULL, + `CreatedDateTime` DATETIME NOT NULL, + `DateTimeStart` DATETIME NOT NULL, + `MonthCount` INT NOT NULL, + `Open` TINYINT NOT NULL, + `VatOutboundCents` BIGINT NOT NULL, + `VatInboundCents` BIGINT NOT NULL, + `UnderConstruction` TINYINT NOT NULL COMMENT 'This is 1 when rows are being populated and the report is not yet ready to display.', + PRIMARY KEY (`VatReportId`), + INDEX `Ix_Organization` (`OrganizationId` ASC), + INDEX `Ix_DateTimeStart` (`DateTimeStart` ASC), + INDEX `Ix_Open` (`Open` ASC), + INDEX `Ix_Construction` (`UnderConstruction` ASC)) + + +# + + +CREATE TABLE `VatReportItems` ( + `VatReportItemId` INT NOT NULL AUTO_INCREMENT, + `VatReportId` INT NOT NULL, + `FinancialTransactionRowId` INT NOT NULL, + `ForeignObjectId` INT NOT NULL, + `FinancialDependencyTypeId` INT NOT NULL, + `VatInboundCents` BIGINT NOT NULL, + `VatOutboundCents` BIGINT NOT NULL, + PRIMARY KEY (`VatReportItemId`), + INDEX `Ix_ReportId` (`VatReportId` ASC), + INDEX `Ix_TxRowId` (`FinancialTransactionRowId` ASC)) + + + +# + +DROP PROCEDURE IF EXISTS `CreateVatReport` + +# + +DROP PROCEDURE IF EXISTS `SetVatReportComplete` + +# + +DROP PROCEDURE IF EXISTS `SetVatReportOpen` + +# + +DROP PROCEDURE IF EXISTS `CreateVatReportItem` + +# + +CREATE PROCEDURE `CreateVatReport` ( + organizationId INT, + createdDateTime DATETIME, + dateTimeStart DATETIME, + monthCount INT +) + +BEGIN + INSERT INTO VatReports + (OrganizationId,CreatedDateTime,DateTimeStart,MonthCount,Open,VatInboundCents,VatOutboundCents,UnderConstruction) + VALUES + (organizationId,createdDateTime,dateTimeStart,monthCount,1,0,0,1); + + SELECT LAST_INSERT_ID() AS Identity; +END + + +Continue with procs to create Vat report, to set open and under construction, to calculate inbound/outbound cents +procs to create vat report item, including copying tx's foreign object and dependency diff --git a/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx b/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx new file mode 100644 index 00000000..46a58bce --- /dev/null +++ b/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx @@ -0,0 +1 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Json-MasterPersonEditPaymentHistory.aspx.cs" Inherits="Swarmops.Frontend.Automation.Json_MasterPersonEditPaymentHistory" %> diff --git a/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx.cs b/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx.cs new file mode 100644 index 00000000..48e175fb --- /dev/null +++ b/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Swarmops.Logic.Swarm; + +namespace Swarmops.Frontend.Automation +{ + public partial class Json_MasterPersonEditPaymentHistory : DataV5Base + { + private AuthenticationData _authenticationData; + private Person _person; + + protected void Page_Load(object sender, EventArgs e) + { + this._authenticationData = GetAuthenticationDataAndCulture(); + + int personId = Int32.Parse(Request.QueryString["PersonId"]); // may throw and that's okay + this._person = Person.FromIdentity(personId); + + /* + + THIS ENTIRE STUFF IS TODO + + Response.ContentType = "application/json"; + + Response.Output.WriteLine("{\"rows\": " + RecurseReport(report.ReportLines) + ", \"footer\": [" + + WriteFooter() + "]}"); + + + Response.End();*/ + } + } +} \ No newline at end of file diff --git a/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx.designer.cs b/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx.designer.cs new file mode 100644 index 00000000..cacb1efb --- /dev/null +++ b/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx.designer.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Swarmops.Frontend.Automation { + + + public partial class Json_MasterPersonEditPaymentHistory { + } +} diff --git a/Site/Master-v5.master b/Site/Master-v5.master index 39fa5475..6424f411 100644 --- a/Site/Master-v5.master +++ b/Site/Master-v5.master @@ -361,6 +361,28 @@ +
+

PERSONNAME: Payment History

+ + + + + + + + + + + + +
+