database:tables:pears_accountoverrideinvoiceaddress



pears.AccountOverrideInvoiceAddress

Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.

Column Type Null Default Comment
AccountOverrideInvoiceAddressID char(20) NOT NULL
InvoiceCompanyID char(20) NULL
SalesBrandID char(20) NULL
AlternativeInvoiceAddressEmailID char(20) NULL may not be used
InvoiceEmail char(250) NULL may not be used
InvoiceAddress long varchar NULL may not be used
ProduceInvoice tinyint NULL 1
ABIFramework char(50) NULL Pulse only
ABIAmount double NULL Pulse only
  • AccountOverrideInvoiceAddressID
Constraint Columns References Delete/update action
Company InvoiceCompanyID pears.Company (companyid) ON DELETE SET NULL
SalesBrand SalesBrandID pears.SalesBrand (SalesBrandID) ON DELETE SET NULL
AlternativeInvoiceAddressEmail AlternativeInvoiceAddressEmailID pears.AlternativeInvoiceAddressEmail (AlternativeInvoiceAddressEmailID) ON DELETE CASCADE
  • No incoming foreign keys found.
  • No indexes found.
Name Timing Event
AccountOverrideInvoiceAddressAudit after insert,delete,update order 1
-- IQX database structure split by table
-- Source: IQXDatabaseStructure - with comments.sql
-- Table: "pears"."AccountOverrideInvoiceAddress"
-- Table comment: 
-- Statement count: 11
 
CREATE TABLE "pears"."AccountOverrideInvoiceAddress" (
    "AccountOverrideInvoiceAddressID" CHAR(20) NOT NULL
   ,"InvoiceCompanyID"               CHAR(20) NULL
   ,"SalesBrandID"                   CHAR(20) NULL
   ,"AlternativeInvoiceAddressEmailID" CHAR(20) NULL
   ,"InvoiceEmail"                   CHAR(250) NULL
   ,"InvoiceAddress"                 long VARCHAR NULL
   ,"ProduceInvoice"                 tinyint NULL DEFAULT 1
   ,"ABIFramework"                   CHAR(50) NULL
   ,"ABIAmount"                      DOUBLE NULL
   ,PRIMARY KEY ("AccountOverrideInvoiceAddressID" ASC) 
)
GO
 
 
COMMENT ON COLUMN "pears"."AccountOverrideInvoiceAddress"."AlternativeInvoiceAddressEmailID" IS 
	'may not be used'
GO
 
 
COMMENT ON COLUMN "pears"."AccountOverrideInvoiceAddress"."InvoiceEmail" IS 
	'may not be used'
GO
 
 
COMMENT ON COLUMN "pears"."AccountOverrideInvoiceAddress"."InvoiceAddress" IS 
	'may not be used'
GO
 
 
COMMENT ON COLUMN "pears"."AccountOverrideInvoiceAddress"."ABIFramework" IS 
	'Pulse only'
GO
 
 
COMMENT ON COLUMN "pears"."AccountOverrideInvoiceAddress"."ABIAmount" IS 
	'Pulse only'
GO
 
 
ALTER TABLE "pears"."AccountOverrideInvoiceAddress"
    ADD FOREIGN KEY "Company" ("InvoiceCompanyID" ASC)
    REFERENCES "pears"."Company" ("companyid")
    ON DELETE SET NULL
GO
 
 
ALTER TABLE "pears"."AccountOverrideInvoiceAddress"
    ADD FOREIGN KEY "SalesBrand" ("SalesBrandID" ASC)
    REFERENCES "pears"."SalesBrand" ("SalesBrandID")
    ON DELETE SET NULL
GO
 
 
ALTER TABLE "pears"."AccountOverrideInvoiceAddress"
    ADD FOREIGN KEY "AlternativeInvoiceAddressEmail" ("AlternativeInvoiceAddressEmailID" ASC)
    REFERENCES "pears"."AlternativeInvoiceAddressEmail" ("AlternativeInvoiceAddressEmailID")
    ON DELETE CASCADE
GO
 
 
CREATE TRIGGER "AccountOverrideInvoiceAddressAudit" after INSERT,DELETE,UPDATE ORDER 1 ON
"pears"."AccountOverrideInvoiceAddress"
REFERENCING OLD AS "oldrec" NEW AS "newrec"
FOR each ROW
BEGIN
  CALL "AuditLog"('COMPANY',"oldrec"."invoicecompanyid","string"(IF deleting THEN 'Delete' ELSE IF updating THEN 'Update' ELSE 'Insert' endif endif,' Account Override Invoice Address ',
  "isnull"((SELECT "description" FROM "salesbrand" AS "s" WHERE "s"."salesbrandid" = "oldrec"."salesbrandid"),
  (SELECT "description" FROM "AlternativeInvoiceAddressEmail" AS "s" WHERE "s"."AlternativeInvoiceAddressEmailid" = "oldrec"."AlternativeInvoiceAddressEmailid"),
  (SELECT "description" FROM "salesbrand" AS "s" WHERE "s"."salesbrandid" = "newrec"."salesbrandid"),
  (SELECT "description" FROM "AlternativeInvoiceAddressEmail" AS "s" WHERE "s"."AlternativeInvoiceAddressEmailid" = "newrec"."AlternativeInvoiceAddressEmailid"))),
  "string"("oldrec"."invoiceaddress",' ',"oldrec"."invoiceemail"),"string"("newrec"."invoiceaddress",' ',"newrec"."invoiceemail"))
END
GO
 
 
COMMENT TO PRESERVE FORMAT ON TRIGGER "pears"."AccountOverrideInvoiceAddress"."AccountOverrideInvoiceAddressAudit" IS 
{CREATE TRIGGER AccountOverrideInvoiceAddressAudit 
 after INSERT,DELETE,UPDATE 
ORDER 1 ON pears.AccountOverrideInvoiceAddress
REFERENCING OLD AS oldrec NEW AS newrec
FOR each ROW
BEGIN
    CALL AuditLog('COMPANY',oldrec.invoicecompanyid,string( IF deleting THEN 'Delete' ELSE IF updating THEN 'Update' ELSE 'Insert' END IF endif , ' Account Override Invoice Address ', 
          isnull( (SELECT description FROM salesbrand s WHERE s.salesbrandid=oldrec.salesbrandid), 
          (SELECT description FROM AlternativeInvoiceAddressEmail s WHERE s.AlternativeInvoiceAddressEmailid=oldrec.AlternativeInvoiceAddressEmailid) ,
          (SELECT description FROM salesbrand s WHERE s.salesbrandid=newrec.salesbrandid), 
          (SELECT description FROM AlternativeInvoiceAddressEmail s WHERE s.AlternativeInvoiceAddressEmailid=newrec.AlternativeInvoiceAddressEmailid)) ),
          string(oldrec.invoiceaddress, ' ', oldrec.invoiceemail ),string(newrec.invoiceaddress, ' ', newrec.invoiceemail ) )
END
}
GO
  • database/tables/pears_accountoverrideinvoiceaddress.txt
  • Last modified: 2026/08/07 19:24
  • by 127.0.0.1