From 97574f837e0c903bc791daf84408a68ede2a44f0 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 28 Aug 2024 21:15:30 +0000 Subject: [PATCH] case 4610 --- docs/8.0/ayanova/docs/ay-start-data-types.md | 6 +- server/AyaNova/AyaNova.csproj | 6 +- server/AyaNova/util/AySchema.cs | 66 +++++++++++--------- 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/docs/8.0/ayanova/docs/ay-start-data-types.md b/docs/8.0/ayanova/docs/ay-start-data-types.md index 19a0c0f8..c2f5ba84 100644 --- a/docs/8.0/ayanova/docs/ay-start-data-types.md +++ b/docs/8.0/ayanova/docs/ay-start-data-types.md @@ -18,7 +18,7 @@ This means that two people with browsers in different time zones using a filter ### Currency -Currency values are stored with 38 digit precision and 18 digit scale. This means a total of 38 digits can be stored and of those 38 digits, up to 18 can come after the decimal point. This level of precision and scale is more than adequate for most circulating currencies but is necessary to accomodate potential future support for crypto currencies such as Etherium or Bitcoin. +Currency values are stored with 28 digit precision and 8 digit scale. This means up to 20 digits to the left of the decimal point and 8 digits to the right of the decimal point. This level of precision and scale is more than adequate for most circulating currencies but is necessary to accomodate potential future support for crypto currencies such as Bitcoin. This applies to any item which is a currency amount or a rate used to calculate a currency amount (except taxes see below) @@ -28,7 +28,7 @@ Currency as entered is interpreted and displayed with a combination of settings ### Decimal numbers -Decimal numbers used typically for quantities of items are stored internally with 19 digit precision and 5 digit scale meaning 19 total digits can be stored of which a maximum of 5 can come after the decimal point. +Decimal numbers used typically for quantities of items are stored internally with 19 digit precision and 5 digit scale meaning 19 total digits can be stored 14 to the left of the decimal and 5 to the right. They are displayed and accepted from entry according to the capabilities and rules of the locale / language setting of the browser (or the override if overriden). @@ -38,7 +38,7 @@ Taxes are stored and displayed in "face" value and not as fractions. For example, a 7% sales tax is entered displayed and stored as 7.0 and not .07. -Taxes are stored with 8 digits precision and 5 digits scale so a total of 8 digits with up to 5 of those 8 after the decimal point. +Taxes are stored with 10 digits precision and 5 digits scale so maximum 5 digits to the left and 5 digits to the right of the decimal point. ### Geographic coordinates diff --git a/server/AyaNova/AyaNova.csproj b/server/AyaNova/AyaNova.csproj index 27b0bf67..ff877656 100644 --- a/server/AyaNova/AyaNova.csproj +++ b/server/AyaNova/AyaNova.csproj @@ -32,20 +32,20 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + - + diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index af210bed..ce9ff611 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -44,6 +44,12 @@ namespace AyaNova.Util (left digits max is precision minus scale) CURRENCY: DECIMAL(38,18) (to support potential of cryptocurrencies) largest Etherium value fits in this (36bytes) + Whups: case 4610 - this is too large to fit in a c# decimal and bombs on retrieval because it pads zeros to the right in postgres + so in reality it needs to be 28 total characters, not 38, that's a fuckup on my part somehow, vicom found it. + So as of this case downgrading it to 28,8 which means still works for crypto which is 8 digits after decimal (sats) and still larger than can enter in the + ui so in theory should be no issues as of now. thankfully I did the inventory values as 19,5 so nothing to try to fix there with the whole blockchain and all + getting in the way of that. + TAX/PERCENTAGES/PDF PAGE SCALE: DECIMAL(10,5) largest tax I could find would fit in this, (was 8,5 but Joyce had an item that was 8000% so changed to allow up to 10000%) Taxes are in face value not fractional value, i.e. "7" not .07 in db Inventory/incidents/service rate quantity etc general numbers (19,5) @@ -544,12 +550,12 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //SERVICERATE await ExecQueryAsync("CREATE TABLE aservicerate (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " + "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, " - + "accountnumber TEXT, unit TEXT, contractonly BOOL NOT NULL, cost DECIMAL(38,18) NOT NULL default 0, charge DECIMAL(38,18) NOT NULL default 0)"); + + "accountnumber TEXT, unit TEXT, contractonly BOOL NOT NULL, cost DECIMAL(28,8) NOT NULL default 0, charge DECIMAL(28,8) NOT NULL default 0)"); //TRAVELRATE await ExecQueryAsync("CREATE TABLE atravelrate (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " + "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, " - + "accountnumber TEXT, unit TEXT, contractonly BOOL NOT NULL, cost DECIMAL(38,18) NOT NULL default 0, charge DECIMAL(38,18) NOT NULL default 0)"); + + "accountnumber TEXT, unit TEXT, contractonly BOOL NOT NULL, cost DECIMAL(28,8) NOT NULL default 0, charge DECIMAL(28,8) NOT NULL default 0)"); //TAXCODE await ExecQueryAsync("CREATE TABLE ataxcode (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " @@ -590,7 +596,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); // await ExecQueryAsync("CREATE TABLE aservicebank (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL, " // + "entrydate TIMESTAMPTZ NOT NULL, lastentrydate TIMESTAMPTZ NULL, atype INTEGER NOT NULL, objectid BIGINT NOT NULL, sourcetype INTEGER NOT NULL, sourceid BIGINT NOT NULL, " // + "incidents DECIMAL(19,5) NOT NULL, incidentsbalance DECIMAL(19,5) NOT NULL, lastincidentsbalance DECIMAL(19,5) NULL, " - // + "currency DECIMAL(38,18) NOT NULL, currencybalance DECIMAL(38,18) NOT NULL, lastcurrencybalance DECIMAL(38,18) NULL, " + // + "currency DECIMAL(28,8) NOT NULL, currencybalance DECIMAL(28,8) NOT NULL, lastcurrencybalance DECIMAL(28,8) NULL, " // + "hours DECIMAL(19,5) NOT NULL, hoursbalance DECIMAL(19,5) NOT NULL, lasthoursbalance DECIMAL(19,5) NULL, " // + "CONSTRAINT unq_servicebank UNIQUE (entrydate, objectid, atype, incidentsbalance, hoursbalance, currencybalance), " // + "CONSTRAINT unq_servicebank_previous_values UNIQUE (lastentrydate, objectid, atype, lastincidentsbalance, lasthoursbalance, lastcurrencybalance), " @@ -671,7 +677,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); + "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, " + "description TEXT, manufacturerid BIGINT REFERENCES avendor, manufacturernumber TEXT, " + "wholesalerid BIGINT REFERENCES avendor, wholesalernumber TEXT, alternativewholesalerid BIGINT REFERENCES avendor, alternativewholesalernumber TEXT, " - + "cost DECIMAL(38,18) NOT NULL, retail DECIMAL(38,18) NOT NULL, unitofmeasure TEXT, upc TEXT " + + "cost DECIMAL(28,8) NOT NULL, retail DECIMAL(28,8) NOT NULL, unitofmeasure TEXT, upc TEXT " + " )"); //PARTWAREHOUSE @@ -736,7 +742,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //PURCHASEORDERITEM await ExecQueryAsync("CREATE TABLE apurchaseorderitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, purchaseorderid BIGINT NOT NULL REFERENCES apurchaseorder ON DELETE CASCADE, " + "partid BIGINT NOT NULL REFERENCES apart, partwarehouseid BIGINT NOT NULL REFERENCES apartwarehouse, quantityordered DECIMAL(19,5) NOT NULL default 0, " - + "quantityreceived DECIMAL(19,5) NOT NULL default 0, purchaseordercost DECIMAL(38,18) NOT NULL default 0, receivedcost DECIMAL(38,18) NOT NULL default 0, " + + "quantityreceived DECIMAL(19,5) NOT NULL default 0, purchaseordercost DECIMAL(28,8) NOT NULL default 0, receivedcost DECIMAL(28,8) NOT NULL default 0, " + "receiveddate TIMESTAMPTZ, partrequestedbyid BIGINT REFERENCES auser, purchasetaxcodeid BIGINT REFERENCES ataxcode, vendorpartnumber TEXT, serials TEXT " + ")"); @@ -774,8 +780,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE aloanunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " + "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, " + "serial TEXT, unitid BIGINT NULL REFERENCES aunit(id), defaultrate INTEGER NOT NULL, " - + "ratehourcost DECIMAL(38,18) NOT NULL DEFAULT 0, ratehalfdaycost DECIMAL(38,18) NOT NULL DEFAULT 0, ratedaycost DECIMAL(38,18) NOT NULL DEFAULT 0, rateweekcost DECIMAL(38,18) NOT NULL DEFAULT 0, ratemonthcost DECIMAL(38,18) NOT NULL DEFAULT 0, rateyearcost DECIMAL(38,18) NOT NULL DEFAULT 0, " - + "ratehour DECIMAL(38,18) NOT NULL, ratehalfday DECIMAL(38,18) NOT NULL, rateday DECIMAL(38,18) NOT NULL, rateweek DECIMAL(38,18) NOT NULL, ratemonth DECIMAL(38,18) NOT NULL, rateyear DECIMAL(38,18) NOT NULL " + + "ratehourcost DECIMAL(28,8) NOT NULL DEFAULT 0, ratehalfdaycost DECIMAL(28,8) NOT NULL DEFAULT 0, ratedaycost DECIMAL(28,8) NOT NULL DEFAULT 0, rateweekcost DECIMAL(28,8) NOT NULL DEFAULT 0, ratemonthcost DECIMAL(28,8) NOT NULL DEFAULT 0, rateyearcost DECIMAL(28,8) NOT NULL DEFAULT 0, " + + "ratehour DECIMAL(28,8) NOT NULL, ratehalfday DECIMAL(28,8) NOT NULL, rateday DECIMAL(28,8) NOT NULL, rateweek DECIMAL(28,8) NOT NULL, ratemonth DECIMAL(28,8) NOT NULL, rateyear DECIMAL(28,8) NOT NULL " + ")"); //---------- @@ -833,7 +839,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //WORKORDERITEM EXPENSE await ExecQueryAsync("CREATE TABLE aworkorderitemexpense (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), " - + "description TEXT, name TEXT, totalcost DECIMAL(38,18) NOT NULL default 0, chargeamount DECIMAL(38,18) NOT NULL default 0, taxpaid DECIMAL(38,18) NOT NULL default 0, " + + "description TEXT, name TEXT, totalcost DECIMAL(28,8) NOT NULL default 0, chargeamount DECIMAL(28,8) NOT NULL default 0, taxpaid DECIMAL(28,8) NOT NULL default 0, " + "chargetaxcodeid BIGINT REFERENCES ataxcode, reimburseuser BOOL NOT NULL, userid BIGINT REFERENCES auser, chargetocustomer BOOL NOT NULL " + ")"); @@ -841,12 +847,12 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE aworkorderitemlabor (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), " + "userid BIGINT REFERENCES auser, servicestartdate TIMESTAMPTZ, servicestopdate TIMESTAMPTZ, servicerateid BIGINT REFERENCES aservicerate, servicedetails text, " + "serviceratequantity DECIMAL(19,5) NOT NULL default 0, nochargequantity DECIMAL(19,5) NOT NULL default 0, " - + "taxcodesaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(38,18) " + + "taxcodesaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(28,8) " + ")"); //WORKORDERITEM LOAN await ExecQueryAsync("CREATE TABLE aworkorderitemloan (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), " - + "notes TEXT, outdate TIMESTAMPTZ, duedate TIMESTAMPTZ, returndate TIMESTAMPTZ,cost DECIMAL(38,18) NOT NULL default 0, listprice DECIMAL(38,18) NOT NULL default 0, priceoverride DECIMAL(38,18), " + + "notes TEXT, outdate TIMESTAMPTZ, duedate TIMESTAMPTZ, returndate TIMESTAMPTZ,cost DECIMAL(28,8) NOT NULL default 0, listprice DECIMAL(28,8) NOT NULL default 0, priceoverride DECIMAL(28,8), " + "taxcodeid BIGINT REFERENCES ataxcode, loanunitid BIGINT NOT NULL REFERENCES aloanunit, quantity DECIMAL(19,5) NOT NULL default 0, rate INTEGER NOT NULL" + ")"); await ExecQueryAsync("ALTER TABLE aloanunit ADD column workorderitemloanid BIGINT NULL REFERENCES aworkorderitemloan"); @@ -854,7 +860,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //WORKORDERITEM PART await ExecQueryAsync("CREATE TABLE aworkorderitempart (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), " + "description TEXT, serials TEXT, partid BIGINT NOT NULL REFERENCES apart, partwarehouseid BIGINT NOT NULL REFERENCES apartwarehouse, quantity DECIMAL(19,5) NOT NULL default 0, " - + "suggestedquantity DECIMAL(19,5) NOT NULL default 0, cost DECIMAL(38,18) NOT NULL default 0, listprice DECIMAL(38,18) NOT NULL default 0, taxpartsaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(38,18) " + + "suggestedquantity DECIMAL(19,5) NOT NULL default 0, cost DECIMAL(28,8) NOT NULL default 0, listprice DECIMAL(28,8) NOT NULL default 0, taxpartsaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(28,8) " + ")"); //WORKORDERITEM PART REQUEST @@ -883,7 +889,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE aworkorderitemtravel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), " + "userid BIGINT REFERENCES auser, travelstartdate TIMESTAMPTZ, travelstopdate TIMESTAMPTZ, travelrateid BIGINT REFERENCES atravelrate, traveldetails text, " + "travelratequantity DECIMAL(19,5) NOT NULL default 0, nochargequantity DECIMAL(19,5) NOT NULL default 0, " - + "taxcodesaleid BIGINT REFERENCES ataxcode, distance DECIMAL(19,5) NOT NULL default 0, priceoverride DECIMAL(38,18) " + + "taxcodesaleid BIGINT REFERENCES ataxcode, distance DECIMAL(19,5) NOT NULL default 0, priceoverride DECIMAL(28,8) " + ")"); //WORKORDERITEM UNIT @@ -897,7 +903,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //WORKORDERITEM OUTSIDE SERVICE await ExecQueryAsync("CREATE TABLE aworkorderitemoutsideservice (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), " + "notes TEXT, unitid BIGINT NOT NULL REFERENCES aunit, vendorsenttoid BIGINT REFERENCES avendor, vendorsentviaid BIGINT REFERENCES avendor, rmanumber text, trackingnumber text, " - + "taxcodeid BIGINT REFERENCES ataxcode, repaircost DECIMAL(38,18) NOT NULL default 0, repairprice DECIMAL(38,18) NOT NULL default 0, shippingcost DECIMAL(38,18) NOT NULL default 0, shippingprice DECIMAL(38,18) NOT NULL default 0, " + + "taxcodeid BIGINT REFERENCES ataxcode, repaircost DECIMAL(28,8) NOT NULL default 0, repairprice DECIMAL(28,8) NOT NULL default 0, shippingcost DECIMAL(28,8) NOT NULL default 0, shippingprice DECIMAL(28,8) NOT NULL default 0, " + "SentDate TIMESTAMPTZ, etadate TIMESTAMPTZ, returndate TIMESTAMPTZ" + ")"); @@ -1021,7 +1027,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //QUOTEITEM EXPENSE await ExecQueryAsync("CREATE TABLE aquoteitemexpense (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, quoteitemid BIGINT NOT NULL REFERENCES aquoteitem (id), " - + "description TEXT, name TEXT, totalcost DECIMAL(38,18) NOT NULL default 0, chargeamount DECIMAL(38,18) NOT NULL default 0, taxpaid DECIMAL(38,18) NOT NULL default 0, " + + "description TEXT, name TEXT, totalcost DECIMAL(28,8) NOT NULL default 0, chargeamount DECIMAL(28,8) NOT NULL default 0, taxpaid DECIMAL(28,8) NOT NULL default 0, " + "chargetaxcodeid BIGINT REFERENCES ataxcode, reimburseuser BOOL NOT NULL, userid BIGINT REFERENCES auser, chargetocustomer BOOL NOT NULL " + ")"); @@ -1029,19 +1035,19 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE aquoteitemlabor (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, quoteitemid BIGINT NOT NULL REFERENCES aquoteitem (id), " + "userid BIGINT REFERENCES auser, servicestartdate TIMESTAMPTZ, servicestopdate TIMESTAMPTZ, servicerateid BIGINT REFERENCES aservicerate, servicedetails text, " + "serviceratequantity DECIMAL(19,5) NOT NULL default 0, nochargequantity DECIMAL(19,5) NOT NULL default 0, " - + "taxcodesaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(38,18) " + + "taxcodesaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(28,8) " + ")"); //QUOTEITEM LOAN await ExecQueryAsync("CREATE TABLE aquoteitemloan (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, quoteitemid BIGINT NOT NULL REFERENCES aquoteitem (id), " - + "notes TEXT, outdate TIMESTAMPTZ, duedate TIMESTAMPTZ, returndate TIMESTAMPTZ,cost DECIMAL(38,18) NOT NULL default 0, listprice DECIMAL(38,18) NOT NULL default 0, priceoverride DECIMAL(38,18), " + + "notes TEXT, outdate TIMESTAMPTZ, duedate TIMESTAMPTZ, returndate TIMESTAMPTZ,cost DECIMAL(28,8) NOT NULL default 0, listprice DECIMAL(28,8) NOT NULL default 0, priceoverride DECIMAL(28,8), " + "taxcodeid BIGINT REFERENCES ataxcode, loanunitid BIGINT NOT NULL REFERENCES aloanunit, quantity DECIMAL(19,5) NOT NULL default 0, rate INTEGER NOT NULL" + ")"); //QUOTEITEM PART await ExecQueryAsync("CREATE TABLE aquoteitempart (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, quoteitemid BIGINT NOT NULL REFERENCES aquoteitem (id), " + "description TEXT, serials TEXT, partid BIGINT NOT NULL REFERENCES apart, partwarehouseid BIGINT NOT NULL REFERENCES apartwarehouse, quantity DECIMAL(19,5) NOT NULL default 0, " - + "cost DECIMAL(38,18) NOT NULL default 0, listprice DECIMAL(38,18) NOT NULL default 0, taxpartsaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(38,18) " + + "cost DECIMAL(28,8) NOT NULL default 0, listprice DECIMAL(28,8) NOT NULL default 0, taxpartsaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(28,8) " + ")"); //QUOTEITEM SCHEDULED USER @@ -1059,7 +1065,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE aquoteitemtravel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, quoteitemid BIGINT NOT NULL REFERENCES aquoteitem (id), " + "userid BIGINT REFERENCES auser, travelstartdate TIMESTAMPTZ, travelstopdate TIMESTAMPTZ, travelrateid BIGINT REFERENCES atravelrate, traveldetails text, " + "travelratequantity DECIMAL(19,5) NOT NULL default 0, nochargequantity DECIMAL(19,5) NOT NULL default 0, " - + "taxcodesaleid BIGINT REFERENCES ataxcode, distance DECIMAL(19,5) NOT NULL default 0, priceoverride DECIMAL(38,18) " + + "taxcodesaleid BIGINT REFERENCES ataxcode, distance DECIMAL(19,5) NOT NULL default 0, priceoverride DECIMAL(28,8) " + ")"); //QUOTEITEM UNIT @@ -1070,7 +1076,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //QUOTEITEM OUTSIDE SERVICE await ExecQueryAsync("CREATE TABLE aquoteitemoutsideservice (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, quoteitemid BIGINT NOT NULL REFERENCES aquoteitem (id), " + "notes TEXT, unitid BIGINT NOT NULL REFERENCES aunit, vendorsenttoid BIGINT REFERENCES avendor, vendorsentviaid BIGINT REFERENCES avendor, rmanumber text, trackingnumber text, " - + "taxcodeid BIGINT REFERENCES ataxcode, repaircost DECIMAL(38,18) NOT NULL default 0, repairprice DECIMAL(38,18) NOT NULL default 0, shippingcost DECIMAL(38,18) NOT NULL default 0, shippingprice DECIMAL(38,18) NOT NULL default 0, " + + "taxcodeid BIGINT REFERENCES ataxcode, repaircost DECIMAL(28,8) NOT NULL default 0, repairprice DECIMAL(28,8) NOT NULL default 0, shippingcost DECIMAL(28,8) NOT NULL default 0, shippingprice DECIMAL(28,8) NOT NULL default 0, " + "SentDate TIMESTAMPTZ, etadate TIMESTAMPTZ, returndate TIMESTAMPTZ" + ")"); @@ -1110,7 +1116,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //PMITEM EXPENSE await ExecQueryAsync("CREATE TABLE apmitemexpense (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), " - + "description TEXT, name TEXT, totalcost DECIMAL(38,18) NOT NULL default 0, chargeamount DECIMAL(38,18) NOT NULL default 0, taxpaid DECIMAL(38,18) NOT NULL default 0, " + + "description TEXT, name TEXT, totalcost DECIMAL(28,8) NOT NULL default 0, chargeamount DECIMAL(28,8) NOT NULL default 0, taxpaid DECIMAL(28,8) NOT NULL default 0, " + "chargetaxcodeid BIGINT REFERENCES ataxcode, reimburseuser BOOL NOT NULL, userid BIGINT REFERENCES auser, chargetocustomer BOOL NOT NULL " + ")"); @@ -1118,19 +1124,19 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE apmitemlabor (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), " + "userid BIGINT REFERENCES auser, servicestartdate TIMESTAMPTZ, servicestopdate TIMESTAMPTZ, servicerateid BIGINT REFERENCES aservicerate, servicedetails text, " + "serviceratequantity DECIMAL(19,5) NOT NULL default 0, nochargequantity DECIMAL(19,5) NOT NULL default 0, " - + "taxcodesaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(38,18) " + + "taxcodesaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(28,8) " + ")"); //PMITEM LOAN await ExecQueryAsync("CREATE TABLE apmitemloan (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), " - + "notes TEXT, outdate TIMESTAMPTZ, duedate TIMESTAMPTZ, returndate TIMESTAMPTZ,cost DECIMAL(38,18) NOT NULL default 0, listprice DECIMAL(38,18) NOT NULL default 0, priceoverride DECIMAL(38,18), " + + "notes TEXT, outdate TIMESTAMPTZ, duedate TIMESTAMPTZ, returndate TIMESTAMPTZ,cost DECIMAL(28,8) NOT NULL default 0, listprice DECIMAL(28,8) NOT NULL default 0, priceoverride DECIMAL(28,8), " + "taxcodeid BIGINT REFERENCES ataxcode, loanunitid BIGINT NOT NULL REFERENCES aloanunit, quantity DECIMAL(19,5) NOT NULL default 0, rate INTEGER NOT NULL" + ")"); //PMITEM PART await ExecQueryAsync("CREATE TABLE apmitempart (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), " + "description TEXT, serials TEXT, partid BIGINT NOT NULL REFERENCES apart, partwarehouseid BIGINT NOT NULL REFERENCES apartwarehouse, quantity DECIMAL(19,5) NOT NULL default 0, " - + "cost DECIMAL(38,18) NOT NULL default 0, listprice DECIMAL(38,18) NOT NULL default 0, taxpartsaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(38,18) " + + "cost DECIMAL(28,8) NOT NULL default 0, listprice DECIMAL(28,8) NOT NULL default 0, taxpartsaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(28,8) " + ")"); //PMITEM SCHEDULED USER @@ -1148,7 +1154,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE apmitemtravel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), " + "userid BIGINT REFERENCES auser, travelstartdate TIMESTAMPTZ, travelstopdate TIMESTAMPTZ, travelrateid BIGINT REFERENCES atravelrate, traveldetails text, " + "travelratequantity DECIMAL(19,5) NOT NULL default 0, nochargequantity DECIMAL(19,5) NOT NULL default 0, " - + "taxcodesaleid BIGINT REFERENCES ataxcode, distance DECIMAL(19,5) NOT NULL default 0, priceoverride DECIMAL(38,18) " + + "taxcodesaleid BIGINT REFERENCES ataxcode, distance DECIMAL(19,5) NOT NULL default 0, priceoverride DECIMAL(28,8) " + ")"); //PMITEM UNIT @@ -1159,7 +1165,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //PMITEM OUTSIDE SERVICE await ExecQueryAsync("CREATE TABLE apmitemoutsideservice (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), " + "notes TEXT, unitid BIGINT NOT NULL REFERENCES aunit, vendorsenttoid BIGINT REFERENCES avendor, vendorsentviaid BIGINT REFERENCES avendor, rmanumber text, trackingnumber text, " - + "taxcodeid BIGINT REFERENCES ataxcode, repaircost DECIMAL(38,18) NOT NULL default 0, repairprice DECIMAL(38,18) NOT NULL default 0, shippingcost DECIMAL(38,18) NOT NULL default 0, shippingprice DECIMAL(38,18) NOT NULL default 0, " + + "taxcodeid BIGINT REFERENCES ataxcode, repaircost DECIMAL(28,8) NOT NULL default 0, repairprice DECIMAL(28,8) NOT NULL default 0, shippingcost DECIMAL(28,8) NOT NULL default 0, shippingprice DECIMAL(28,8) NOT NULL default 0, " + "SentDate TIMESTAMPTZ, etadate TIMESTAMPTZ, returndate TIMESTAMPTZ" + ")"); @@ -1187,17 +1193,17 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //NOTIFICATION await ExecQueryAsync("CREATE TABLE anotifysubscription (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " + "userid BIGINT NOT NULL REFERENCES auser (id) ON DELETE CASCADE, ayatype INTEGER NOT NULL, eventtype INTEGER NOT NULL, advancenotice INTERVAL NOT NULL, " - + "idvalue BIGINT NOT NULL, decvalue DECIMAL(38,18) NOT NULL, agevalue INTERVAL NOT NULL, deliverymethod INTEGER NOT NULL, " + + "idvalue BIGINT NOT NULL, decvalue DECIMAL(28,8) NOT NULL, agevalue INTERVAL NOT NULL, deliverymethod INTEGER NOT NULL, " + "deliveryaddress TEXT, linkreportid BIGINT, tags VARCHAR(255) ARRAY)"); await ExecQueryAsync("CREATE TABLE anotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created TIMESTAMPTZ NOT NULL, " + "ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, name TEXT NOT NULL, eventtype INTEGER NOT NULL, notifysubscriptionid BIGINT NOT NULL REFERENCES anotifysubscription(id) ON DELETE CASCADE, " - + "userid BIGINT NOT NULL REFERENCES auser (id) ON DELETE CASCADE, eventdate TIMESTAMPTZ NOT NULL, decvalue DECIMAL(38,18) NULL, message TEXT)"); + + "userid BIGINT NOT NULL REFERENCES auser (id) ON DELETE CASCADE, eventdate TIMESTAMPTZ NOT NULL, decvalue DECIMAL(28,8) NULL, message TEXT)"); await ExecQueryAsync("CREATE TABLE ainappnotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid BIGINT NOT NULL REFERENCES auser (id) ON DELETE CASCADE, " + "created TIMESTAMPTZ NOT NULL, ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, name TEXT NOT NULL, agevalue INTERVAL, eventtype INTEGER NOT NULL, " - + "decvalue DECIMAL(38,18) NULL, notifysubscriptionid BIGINT NOT NULL REFERENCES anotifysubscription(id) ON DELETE CASCADE, message TEXT, fetched BOOL NOT NULL)"); + + "decvalue DECIMAL(28,8) NULL, notifysubscriptionid BIGINT NOT NULL REFERENCES anotifysubscription(id) ON DELETE CASCADE, message TEXT, fetched BOOL NOT NULL)"); await ExecQueryAsync("CREATE TABLE anotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, processed TIMESTAMPTZ NOT NULL, " + "objectid BIGINT NOT NULL, notifysubscriptionid BIGINT NOT NULL, fail BOOL NOT NULL, error TEXT)"); @@ -1208,12 +1214,12 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); + "translationid BIGINT NOT NULL REFERENCES atranslation (id) NOT NULL, languageoverride TEXT NOT NULL, timezoneoverride TEXT NOT NULL, " + "currencyname TEXT NOT NULL, hour12 BOOL NOT NULL, " + "customertags VARCHAR(255) ARRAY, ayatype INTEGER NOT NULL, eventtype INTEGER NOT NULL, advancenotice INTERVAL NOT NULL, " - + "idvalue BIGINT NOT NULL, decvalue DECIMAL(38,18) NOT NULL, agevalue INTERVAL NOT NULL, " + + "idvalue BIGINT NOT NULL, decvalue DECIMAL(28,8) NOT NULL, agevalue INTERVAL NOT NULL, " + "linkreportid BIGINT, template TEXT NOT NULL, subject TEXT NOT NULL, tags VARCHAR(255) ARRAY)"); await ExecQueryAsync("CREATE TABLE acustomernotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created TIMESTAMPTZ NOT NULL, " + "ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, name TEXT NOT NULL, eventtype INTEGER NOT NULL, customernotifysubscriptionid BIGINT NOT NULL REFERENCES acustomernotifysubscription(id) ON DELETE CASCADE, " - + "customerid BIGINT NOT NULL REFERENCES acustomer (id) ON DELETE CASCADE, eventdate TIMESTAMPTZ NOT NULL, decvalue DECIMAL(38,18) NULL)"); + + "customerid BIGINT NOT NULL REFERENCES acustomer (id) ON DELETE CASCADE, eventdate TIMESTAMPTZ NOT NULL, decvalue DECIMAL(28,8) NULL)"); await ExecQueryAsync("CREATE TABLE acustomernotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, processed TIMESTAMPTZ NOT NULL, " + "objectid BIGINT NOT NULL, customernotifysubscriptionid BIGINT NOT NULL, fail BOOL NOT NULL, error TEXT)");