====== pears.IQacAccount ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Description ===== List of ledger against account names ===== Columns ===== ^ Column ^ Type ^ Null ^ Default ^ Comment ^ | **LedgerID** | char(12) | NOT NULL | | | | **AccountCode** | char(12) | NOT NULL | | | | Name | char(50) | NOT NULL | | | ===== Primary Key ===== * LedgerID, AccountCode ===== Foreign Keys ===== ^ Constraint ^ Columns ^ References ^ Delete/update action ^ | IQacLedger | LedgerID | [[database:tables:pears_iqacledger|pears.IQacLedger (LedgerID)]] | NOT NULL; | ===== Referenced By ===== ^ Table ^ Constraint ^ Columns ^ Referenced columns ^ | [[database:tables:pears_iqacaccountsettings|pears.IQacAccountSettings]] | IQacAccount | LedgerID, AccountCode | LedgerID, AccountCode | | [[database:tables:pears_iqacdocument|pears.IQacDocument]] | Account | LedgerID, AccountCode | LedgerID, AccountCode | | [[database:tables:pears_iqacdocumenttemplate|pears.IQacDocumentTemplate]] | PayAccount | PaymentLedgerID, PaymentAccountCode | LedgerID, AccountCode | | [[database:tables:pears_iqacjournal|pears.IQacJournal]] | Account | LedgerID, AccountCode | LedgerID, AccountCode | | [[database:tables:pears_iqacnominal|pears.IQacNominal]] | NomAccount | LedgerID, AccountCode | LedgerID, AccountCode | ===== Indexes ===== ^ Name ^ Type ^ Columns ^ Detail ^ | IQacAcc_Name | Index | Name | | ===== Triggers ===== ^ Name ^ Timing ^ Event ^ | IQacAccount_Audit | before | update of "Name" order 1 | ===== Original SQL ===== -- IQX database structure split by table -- Source: IQXDatabaseStructure - with comments.sql -- Table: "pears"."IQacAccount" -- Table comment: List of ledger against account names -- Statement count: 5 CREATE TABLE "pears"."IQacAccount" ( "LedgerID" char(12) NOT NULL ,"AccountCode" char(12) NOT NULL ,"Name" char(50) NOT NULL ,PRIMARY KEY ("LedgerID" ASC,"AccountCode" ASC) ) go COMMENT ON TABLE "pears"."IQacAccount" IS 'List of ledger against account names' go ALTER TABLE "pears"."IQacAccount" ADD NOT NULL FOREIGN KEY "IQacLedger" ("LedgerID" ASC) REFERENCES "pears"."IQacLedger" ("LedgerID") go CREATE INDEX "IQacAcc_Name" ON "pears"."IQacAccount" ( "Name" ) go create trigger "IQacAccount_Audit" before update of "Name" order 1 on "pears"."IQacAccount" referencing old as "old_acc" new as "new_acc" for each row when(exists(select * from "AuditItems" where "ItemName" = 'Account Code Name' and "AreaName" = 'Company Account' and "AuditFlag" = 1)) begin declare "coid" varchar(20); declare @CompName char(250); select "getinvoicecompanyid"("new_acc"."AccountCode") into "coid"; set @CompName = (select "name" from "company" where "CompanyID" = "coid"); call "AuditLog"('COMPANY',"coid","string"('Account Code Name Updated - ',@CompName),"old_acc"."name","new_acc"."name") end go