mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
Increase sales tax precision from 2 to 3 decimal places (#1525)
* Allow for tax rates with 3 decimal places * Update input validation * Increase precision of create procedure
This commit is contained in:
parent
a0a5ddef77
commit
4bc683c38d
@ -344,7 +344,7 @@
|
||||
<div class="form-group">
|
||||
<label asp-for="Rate">Tax Rate</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" asp-for="Rate" pattern="^\d{0,3}.\d{0,2}$" required>
|
||||
<input type="text" class="form-control" asp-for="Rate" pattern="^\d{0,3}.\d{0,3}$" required>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">%</span>
|
||||
</div>
|
||||
|
@ -3,7 +3,7 @@ CREATE PROCEDURE [dbo].[TaxRate_Create]
|
||||
@Country VARCHAR(50),
|
||||
@State VARCHAR(2),
|
||||
@PostalCode VARCHAR(10),
|
||||
@Rate DECIMAL(5,2),
|
||||
@Rate DECIMAL(6,3),
|
||||
@Active BIT
|
||||
AS
|
||||
BEGIN
|
||||
|
@ -3,7 +3,7 @@ CREATE TABLE [dbo].[TaxRate] (
|
||||
[Country] VARCHAR(50) NOT NULL,
|
||||
[State] VARCHAR(2) NULL,
|
||||
[PostalCode] VARCHAR(10) NOT NULL,
|
||||
[Rate] DECIMAL(5,2) NOT NULL,
|
||||
[Rate] DECIMAL(6,3) NOT NULL,
|
||||
[Active] BIT NOT NULL,
|
||||
CONSTRAINT [PK_TaxRate] PRIMARY KEY CLUSTERED ([Id] ASC)
|
||||
);
|
||||
|
44
util/Migrator/DbScripts/2021-08-19_00_FixTaxRate.sql
Normal file
44
util/Migrator/DbScripts/2021-08-19_00_FixTaxRate.sql
Normal file
@ -0,0 +1,44 @@
|
||||
IF OBJECT_ID('[dbo].[TaxRate]') IS NOT NULL
|
||||
BEGIN
|
||||
ALTER TABLE
|
||||
[dbo].[TaxRate]
|
||||
ALTER COLUMN
|
||||
[Rate] DECIMAL(6,3) NOT NULL;
|
||||
END
|
||||
|
||||
IF OBJECT_ID('[dbo].[TaxRate_Create]') IS NOT NULL
|
||||
BEGIN
|
||||
DROP PROCEDURE [dbo].[TaxRate_Create]
|
||||
END
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[TaxRate_Create]
|
||||
@Id VARCHAR(40) OUTPUT,
|
||||
@Country VARCHAR(50),
|
||||
@State VARCHAR(2),
|
||||
@PostalCode VARCHAR(10),
|
||||
@Rate DECIMAL(6,3),
|
||||
@Active BIT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
INSERT INTO [dbo].[TaxRate]
|
||||
(
|
||||
[Id],
|
||||
[Country],
|
||||
[State],
|
||||
[PostalCode],
|
||||
[Rate],
|
||||
[Active]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@Id,
|
||||
@Country,
|
||||
@State,
|
||||
@PostalCode,
|
||||
@Rate,
|
||||
1
|
||||
)
|
||||
END
|
Loading…
Reference in New Issue
Block a user