====== pears.CompanyAccount ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Description ===== Holds details of Client Account - only exists for companies with allocated account code. ===== Columns ===== ^ Column ^ Type ^ Null ^ Default ^ Comment ^ | **CompanyID** | char(20) | NOT NULL | | | | NotLtdCo | tinyint | NULL | 0 | | | RegNo | char(20) | NULL | | | | VatExempt | tinyint | NULL | 0 | | | VATNumber | char(20) | NULL | | | | ERNIonInvoice | tinyint | NULL | 0 | | | TheirRefRequired | tinyint | NULL | 0 | | | GroupInvoice | tinyint | NULL | 0 | 0=1 inv per timesheet 1=1 inv per client | | Construction | tinyint | NULL | 0 | | | DaysCredit | smallint | NULL | | | | InvoiceEmail | char(250) | NULL | | | | AccountsContact | char(20) | NULL | | | | TimesheetContact | char(20) | NULL | | | | TransferBatch | integer | NULL | | | | ExtNumber | integer | NULL | | | | CreditLimit | integer | NULL | | | | OnStop | tinyint | NULL | 0 | | | InvoiceFrequency | char(1) | NULL | | eekly, <2> weekly, <4> weekly, onthly | | VatOnTempMargin | tinyint | NULL | 0 | | | BlockStatus | tinyint | NULL | | Used by LSM auto update file. 0=no block 1=Warn 2=Warn if Manager otherwise block 3=Block | | BlockDescription | char(50) | NULL | | Used by LSM auto update file. Descriptive text for warning or block message | | ETimesheets | tinyint | NULL | 0 | | | TempETimesheetEditCapability | tinyint | NULL | | 1=Confirm Only 2=Edit Existing Shifts 3=Add Shifts | | TheirRefRequiredInvoice | tinyint | NULL | 0 | | | documenttemplateid | char(12) | NULL | | | | PDFInvCreate | tinyint | NULL | 0 | | | PDFInvIncTS | tinyint | NULL | 0 | | | InvoiceManagementGroup | char(1) | NULL | | | | FixedNI | double | NULL | | % | | FixedWTR | double | NULL | | % | | NoTSBarcode | tinyint | NULL | 0 | | | PDFExtraDocs | smallint | NULL | | 0/null - none 1 - std TS image 2 - std + 1 ... | | StatementEmail | char(250) | NULL | | | | AWRFixedNI | double | NULL | | % | | AWRFixedWTR | double | NULL | | % | | statementfrequency | char(1) | NULL | | =None W=Weekly M=Monthly | | NoPDFSecurity | tinyint | NULL | 0 | | | NotPDFInvIncTS | tinyint | NULL | 0 | | | NotImageInvIncTS | tinyint | NULL | 0 | | | AdhocDocumentTemplateID | char(12) | NULL | | | ===== Primary Key ===== * CompanyID ===== Foreign Keys ===== ^ Constraint ^ Columns ^ References ^ Delete/update action ^ | Company | CompanyID | [[database:tables:pears_company|pears.Company (companyid)]] | NOT NULL; | | Employment | AccountsContact | [[database:tables:pears_employment|pears.employment (employmentid)]] | ON DELETE SET NULL | | Employment2 | TimesheetContact | [[database:tables:pears_employment|pears.employment (employmentid)]] | ON DELETE SET NULL | | iqacdocumenttemplate | documenttemplateid | [[database:tables:pears_iqacdocumenttemplate|pears.IQacDocumentTemplate (DocumentTemplateID)]] | ON DELETE SET NULL | ===== Referenced By ===== * No incoming foreign keys found. ===== Indexes ===== ^ Name ^ Type ^ Columns ^ Detail ^ | coac_extnumber | Index | ExtNumber | | | coac_transferbatch | Index | TransferBatch | | | coac_AdhocInvoice | Index | AdhocDocumentTemplateID | | ===== Triggers ===== ^ Name ^ Timing ^ Event ^ | companyaccountUpdate | before | update of "NotLtdCo", "RegNo","VatExempt","VATNumber","ERNIonInvoice","TheirRefRequired","GroupInvoice","Construction","DaysCredit","InvoiceEmail","AccountsContact","TimesheetContact", "ExtNumber","OnStop","InvoiceFrequency","VatOnTempMargin" order 1 | | CompanyAccountAudit | before | update of "NotLtdCo", "RegNo","VatExempt","VATNumber","ERNIonInvoice","TheirRefRequired","GroupInvoice","Construction","DaysCredit","InvoiceEmail","AccountsContact","TimesheetContact","ExtNumber","CreditLimit","OnStop","InvoiceFrequency","VatOnTempMargin","BlockStatus","BlockDescription", "ETimesheets","documenttemplateid","PDFInvCreate","PDFInvIncTS","TheirRefRequiredInvoice","InvoiceManagementGroup","FixedNI","FixedWTR","PDFExtraDocs","AWRFixedNI","AWRFixedWTR" order 2 | ===== Original SQL ===== -- IQX database structure split by table -- Source: IQXDatabaseStructure - with comments.sql -- Table: "pears"."CompanyAccount" -- Table comment: Holds details of Client Account - only exists for companies with allocated account code. -- Statement count: 24 CREATE TABLE "pears"."CompanyAccount" ( "CompanyID" char(20) NOT NULL ,"NotLtdCo" tinyint NULL DEFAULT 0 ,"RegNo" char(20) NULL ,"VatExempt" tinyint NULL DEFAULT 0 ,"VATNumber" char(20) NULL ,"ERNIonInvoice" tinyint NULL DEFAULT 0 ,"TheirRefRequired" tinyint NULL DEFAULT 0 ,"GroupInvoice" tinyint NULL DEFAULT 0 ,"Construction" tinyint NULL DEFAULT 0 ,"DaysCredit" smallint NULL ,"InvoiceEmail" char(250) NULL ,"AccountsContact" char(20) NULL ,"TimesheetContact" char(20) NULL ,"TransferBatch" integer NULL ,"ExtNumber" integer NULL ,"CreditLimit" integer NULL ,"OnStop" tinyint NULL DEFAULT 0 ,"InvoiceFrequency" char(1) NULL ,"VatOnTempMargin" tinyint NULL DEFAULT 0 ,"BlockStatus" tinyint NULL ,"BlockDescription" char(50) NULL ,"ETimesheets" tinyint NULL DEFAULT 0 ,"TempETimesheetEditCapability" tinyint NULL ,"TheirRefRequiredInvoice" tinyint NULL DEFAULT 0 ,"documenttemplateid" char(12) NULL ,"PDFInvCreate" tinyint NULL DEFAULT 0 ,"PDFInvIncTS" tinyint NULL DEFAULT 0 ,"InvoiceManagementGroup" char(1) NULL ,"FixedNI" double NULL ,"FixedWTR" double NULL ,"NoTSBarcode" tinyint NULL DEFAULT 0 ,"PDFExtraDocs" smallint NULL ,"StatementEmail" char(250) NULL ,"AWRFixedNI" double NULL ,"AWRFixedWTR" double NULL ,"statementfrequency" char(1) NULL ,"NoPDFSecurity" tinyint NULL DEFAULT 0 ,"NotPDFInvIncTS" tinyint NULL DEFAULT 0 ,"NotImageInvIncTS" tinyint NULL DEFAULT 0 ,"AdhocDocumentTemplateID" char(12) NULL ,PRIMARY KEY ("CompanyID" ASC) ) go COMMENT ON COLUMN "pears"."CompanyAccount"."GroupInvoice" IS '0=1 inv per timesheet 1=1 inv per client' go COMMENT ON COLUMN "pears"."CompanyAccount"."InvoiceFrequency" IS 'eekly, <2> weekly, <4> weekly, onthly' go COMMENT ON COLUMN "pears"."CompanyAccount"."BlockStatus" IS 'Used by LSM auto update file. 0=no block 1=Warn 2=Warn if Manager otherwise block 3=Block' go COMMENT ON COLUMN "pears"."CompanyAccount"."BlockDescription" IS 'Used by LSM auto update file. Descriptive text for warning or block message' go COMMENT ON COLUMN "pears"."CompanyAccount"."TempETimesheetEditCapability" IS '1=Confirm Only 2=Edit Existing Shifts 3=Add Shifts' go COMMENT ON COLUMN "pears"."CompanyAccount"."FixedNI" IS '%' go COMMENT ON COLUMN "pears"."CompanyAccount"."FixedWTR" IS '%' go COMMENT ON COLUMN "pears"."CompanyAccount"."PDFExtraDocs" IS '0/null - none 1 - std TS image 2 - std + 1 ... ' go COMMENT ON COLUMN "pears"."CompanyAccount"."AWRFixedNI" IS '%' go COMMENT ON COLUMN "pears"."CompanyAccount"."AWRFixedWTR" IS '%' go COMMENT ON COLUMN "pears"."CompanyAccount"."statementfrequency" IS '=None W=Weekly M=Monthly' go COMMENT ON TABLE "pears"."CompanyAccount" IS 'Holds details of Client Account - only exists for companies with allocated account code.' go ALTER TABLE "pears"."CompanyAccount" ADD NOT NULL FOREIGN KEY "Company" ("CompanyID" ASC) REFERENCES "pears"."Company" ("companyid") go ALTER TABLE "pears"."CompanyAccount" ADD FOREIGN KEY "Employment" ("AccountsContact" ASC) REFERENCES "pears"."employment" ("employmentid") ON DELETE SET NULL go ALTER TABLE "pears"."CompanyAccount" ADD FOREIGN KEY "Employment2" ("TimesheetContact" ASC) REFERENCES "pears"."employment" ("employmentid") ON DELETE SET NULL go ALTER TABLE "pears"."CompanyAccount" ADD FOREIGN KEY "iqacdocumenttemplate" ("documenttemplateid" ASC) REFERENCES "pears"."IQacDocumentTemplate" ("DocumentTemplateID") ON DELETE SET NULL go CREATE INDEX "coac_extnumber" ON "pears"."CompanyAccount" ( "ExtNumber" ) go CREATE INDEX "coac_transferbatch" ON "pears"."CompanyAccount" ( "TransferBatch" ) go CREATE INDEX "coac_AdhocInvoice" ON "pears"."CompanyAccount" ( "AdhocDocumentTemplateID" ) go create trigger "companyaccountUpdate" before update of "NotLtdCo", "RegNo","VatExempt","VATNumber","ERNIonInvoice","TheirRefRequired","GroupInvoice","Construction","DaysCredit","InvoiceEmail","AccountsContact","TimesheetContact", "ExtNumber","OnStop","InvoiceFrequency","VatOnTempMargin" order 1 on "pears"."CompanyAccount" referencing old as "old_coac" new as "new_coac" for each row when("old_coac"."transferbatch" > 0) begin set "new_coac"."transferbatch" = 0 end go COMMENT TO PRESERVE FORMAT ON TRIGGER "pears"."CompanyAccount"."companyaccountUpdate" IS {create trigger companyaccountUpdate before update of NotLtdCo, RegNo,VatExempt,VATNumber,ERNIonInvoice,TheirRefRequired,GroupInvoice,Construction,DaysCredit,InvoiceEmail,AccountsContact,TimesheetContact, ExtNumber,OnStop,InvoiceFrequency,VatOnTempMargin order 1 on pears.CompanyAccount referencing old as old_coac new as new_coac for each row when(old_coac.transferbatch > 0) begin set new_coac.transferbatch=0 end } go create trigger "CompanyAccountAudit" before update of "NotLtdCo", "RegNo","VatExempt","VATNumber","ERNIonInvoice","TheirRefRequired","GroupInvoice","Construction","DaysCredit","InvoiceEmail","AccountsContact","TimesheetContact","ExtNumber","CreditLimit","OnStop","InvoiceFrequency","VatOnTempMargin","BlockStatus","BlockDescription", "ETimesheets","documenttemplateid","PDFInvCreate","PDFInvIncTS","TheirRefRequiredInvoice","InvoiceManagementGroup","FixedNI","FixedWTR","PDFExtraDocs","AWRFixedNI","AWRFixedWTR" order 2 on "pears"."CompanyAccount" referencing old as "old_comp" new as "new_comp" for each row when(exists(select * from "AuditItems" where "AreaName" = 'Company Account' and "AuditFlag" = 1)) begin declare @AuditList long varchar; declare @OldDescrip char(250); declare @NewDescrip char(250); declare @CompName char(250); select "string"(',',"list"("ItemName"),',') into @AuditList from "AuditItems" where "AreaName" = 'Company Account' and "AuditFlag" = 1; set @CompName = (select "name" from "company" where "Company"."CompanyID" = "old_comp"."CompanyID"); -- Not Limited Company if "locate"(@AuditList,',Not Limited Company,') > 0 and update("NotLtdCo") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Not Limited Company Updated - ',@CompName),"old_comp"."NotLtdCo","new_comp"."NotLtdCo") end if; -- Registered Number if "locate"(@AuditList,',Registered Number,') > 0 and update("RegNo") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Registered Number Updated - ',@CompName),"old_comp"."RegNo","new_comp"."RegNo") end if; -- Vat Exempt if "locate"(@AuditList,',Vat Exempt,') > 0 and update("VatExempt") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Vat Exempt Updated - ',@CompName),"old_comp"."VatExempt","new_comp"."VatExempt") end if; -- VAT Number if "locate"(@AuditList,',VAT Number,') > 0 and update("VATNumber") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('VAT Number Updated - ',@CompName),"old_comp"."VATNumber","new_comp"."VATNumber") end if; -- ERNI On Invoice if "locate"(@AuditList,',ERNI On Invoice,') > 0 and update("ERNIonInvoice") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('ERNI On Invoice Updated - ',@CompName),"old_comp"."ERNIonInvoice","new_comp"."ERNIonInvoice") end if; -- TheirRef Required if "locate"(@AuditList,',TheirRef Required,') > 0 and update("TheirRefRequired") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('TheirRef Required Updated - ',@CompName),"old_comp"."TheirRefRequired","new_comp"."TheirRefRequired") end if; -- Group Invoice if "locate"(@AuditList,',Group Invoice,') > 0 and update("GroupInvoice") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Group Invoice Updated - ',@CompName),"old_comp"."GroupInvoice","new_comp"."GroupInvoice") end if; -- Construction if "locate"(@AuditList,',Construction,') > 0 and update("Construction") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Construction Updated - ',@CompName),"old_comp"."Construction","new_comp"."Construction") end if; -- Days Credit if "locate"(@AuditList,',Days Credit,') > 0 and update("DaysCredit") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Days Credit Updated - ',@CompName),"old_comp"."DaysCredit","new_comp"."DaysCredit") end if; -- Invoice Email if "locate"(@AuditList,',Invoice Email,') > 0 and update("InvoiceEmail") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Invoice Email Updated - ',@CompName),"old_comp"."InvoiceEmail","new_comp"."InvoiceEmail") end if; -- Accounts Contact if "locate"(@AuditList,',Accounts Contact,') > 0 and update("AccountsContact") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Accounts Contact Updated - ',@CompName),"old_comp"."AccountsContact","new_comp"."AccountsContact") end if; -- Timesheet Contact if "locate"(@AuditList,',Timesheet Contact,') > 0 and update("TimesheetContact") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Timesheet Contact Updated - ',@CompName),"old_comp"."TimesheetContact","new_comp"."TimesheetContact") end if; -- Ext Number if "locate"(@AuditList,',Ext Number,') > 0 and update("ExtNumber") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Ext Number Updated - ',@CompName),"old_comp"."ExtNumber","new_comp"."ExtNumber") end if; -- Credit Limit if "locate"(@AuditList,',Credit Limit,') > 0 and update("CreditLimit") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Credit Limit Updated - ',@CompName),"old_comp"."CreditLimit","new_comp"."CreditLimit") end if; -- On Stop if "locate"(@AuditList,',On Stop,') > 0 and update("OnStop") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('On Stop Updated - ',@CompName),"old_comp"."OnStop","new_comp"."OnStop") end if; -- Invoice Frequency if "locate"(@AuditList,',Invoice Frequency,') > 0 and update("InvoiceFrequency") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Invoice Frequency Updated - ',@CompName),"old_comp"."InvoiceFrequency","new_comp"."InvoiceFrequency") end if; -- Vat On Temp Margin if "locate"(@AuditList,',Vat On Temp Margin,') > 0 and update("VatOnTempMargin") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Vat On Temp Margin Updated - ',@CompName),"old_comp"."VatOnTempMargin","new_comp"."VatOnTempMargin") end if; -- Block Status if "locate"(@AuditList,',Block Status,') > 0 and update("BlockStatus") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Block Status Updated - ',@CompName),"old_comp"."BlockStatus","new_comp"."BlockStatus") end if; -- Block Description if "locate"(@AuditList,',Block Description,') > 0 and update("BlockDescription") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Block Description Updated - ',@CompName),"old_comp"."BlockDescription","new_comp"."BlockDescription") end if; -- ETimesheets if "locate"(@AuditList,',ETimesheets,') > 0 and update("ETimesheets") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('ETimesheets Updated - ',@CompName),"old_comp"."ETimesheets","new_comp"."ETimesheets") end if; -- Override Invoice Layout if "locate"(@AuditList,',Override Invoice Layout,') > 0 and update("documenttemplateid") then set @OldDescrip = (select "name" from "iqacdocumenttemplate" where "documenttemplateid" = "old_comp"."documenttemplateid"); set @NewDescrip = (select "name" from "iqacdocumenttemplate" where "documenttemplateid" = "new_comp"."documenttemplateid"); call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Override Invoice Layout Updated - ',@CompName),@OldDescrip,@NewDescrip) end if; -- Invoice PDF Create if "locate"(@AuditList,',Invoice PDF Create,') > 0 and update("PDFInvCreate") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Invoice PDF Create Updated - ',@CompName),"old_comp"."PDFInvCreate","new_comp"."PDFInvCreate") end if; -- PDF Invoice add Timesheets if "locate"(@AuditList,',PDF Invoice add Timesheets,') > 0 and update("PDFInvIncTS") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('PDF Invoice add Timesheets Updated - ',@CompName),"old_comp"."PDFInvIncTS","new_comp"."PDFInvIncTS") end if; -- Their Ref Required if "locate"(@AuditList,',Their Ref Required,') > 0 and update("TheirRefRequiredInvoice") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Their Ref Required Updated - ',@CompName),"old_comp"."TheirRefRequiredInvoice","new_comp"."TheirRefRequiredInvoice") end if; -- Invoice Management Group if "locate"(@AuditList,',Invoice Management Group,') > 0 and update("InvoiceManagementGroup") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Invoice Management Group Updated - ',@CompName),"old_comp"."InvoiceManagementGroup","new_comp"."InvoiceManagementGroup") end if; -- Fixed NI if "locate"(@AuditList,',Fixed NI,') > 0 and update("FixedNI") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Fixed NI Updated - ',@CompName),"old_comp"."FixedNI","new_comp"."FixedNI") end if; -- Fixed WTR if "locate"(@AuditList,',Fixed WTR,') > 0 and update("FixedWTR") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('Fixed WTR Updated - ',@CompName),"old_comp"."FixedWTR","new_comp"."FixedWTR") end if; if "locate"(@AuditList,',AWR Fixed NI,') > 0 and update("AWRFixedNI") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('AWR Fixed NI Updated - ',@CompName),"old_comp"."AWRFixedNI","new_comp"."AWRFixedNI") end if; -- Fixed WTR if "locate"(@AuditList,',AWR Fixed WTR,') > 0 and update("AWRFixedWTR") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('AWR Fixed WTR Updated - ',@CompName),"old_comp"."AWRFixedWTR","new_comp"."AWRFixedWTR") end if; -- PDF must have Documents if "locate"(@AuditList,',PDF must have Documents,') > 0 and update("PDFExtraDocs") then call "AuditLog"('COMPANY',"old_comp"."CompanyID","string"('PDF must have Documents Updated - ',@CompName),"old_comp"."PDFExtraDocs","new_comp"."PDFExtraDocs") end if end go COMMENT TO PRESERVE FORMAT ON TRIGGER "pears"."CompanyAccount"."CompanyAccountAudit" IS {create trigger CompanyAccountAudit before update of NotLtdCo,RegNo,VatExempt,VATNumber,ERNIonInvoice,TheirRefRequired,GroupInvoice,Construction,DaysCredit,InvoiceEmail,AccountsContact,TimesheetContact,ExtNumber,CreditLimit,OnStop,InvoiceFrequency,VatOnTempMargin,BlockStatus,BlockDescription, ETimesheets,documenttemplateid,PDFInvCreate,PDFInvIncTS,TheirRefRequiredInvoice,InvoiceManagementGroup,FixedNI,FixedWTR,PDFExtraDocs, AWRFixedNI,AWRFixedWTR order 2 on pears.CompanyAccount referencing old as old_comp new as new_comp for each row when(exists(select* from AuditItems where AreaName = 'Company Account' and AuditFlag = 1)) begin declare @AuditList long varchar; declare @OldDescrip char(250); declare @NewDescrip char(250); declare @CompName char(250); select string(',',list(ItemName),',') into @AuditList from AuditItems where AreaName = 'Company Account' and AuditFlag = 1; set @CompName=(select name from company where Company.CompanyID = old_comp.CompanyID); -- Not Limited Company if locate(@AuditList,',Not Limited Company,') > 0 and update(NotLtdCo) then call AuditLog('COMPANY',old_comp.CompanyID,string('Not Limited Company Updated - ',@CompName),old_comp.NotLtdCo,new_comp.NotLtdCo) end if; -- Registered Number if locate(@AuditList,',Registered Number,') > 0 and update(RegNo) then call AuditLog('COMPANY',old_comp.CompanyID,string('Registered Number Updated - ',@CompName),old_comp.RegNo,new_comp.RegNo) end if; -- Vat Exempt if locate(@AuditList,',Vat Exempt,') > 0 and update(VatExempt) then call AuditLog('COMPANY',old_comp.CompanyID,string('Vat Exempt Updated - ',@CompName),old_comp.VatExempt,new_comp.VatExempt) end if; -- VAT Number if locate(@AuditList,',VAT Number,') > 0 and update(VATNumber) then call AuditLog('COMPANY',old_comp.CompanyID,string('VAT Number Updated - ',@CompName),old_comp.VATNumber,new_comp.VATNumber) end if; -- ERNI On Invoice if locate(@AuditList,',ERNI On Invoice,') > 0 and update(ERNIonInvoice) then call AuditLog('COMPANY',old_comp.CompanyID,string('ERNI On Invoice Updated - ',@CompName),old_comp.ERNIonInvoice,new_comp.ERNIonInvoice) end if; -- TheirRef Required if locate(@AuditList,',TheirRef Required,') > 0 and update(TheirRefRequired) then call AuditLog('COMPANY',old_comp.CompanyID,string('TheirRef Required Updated - ',@CompName),old_comp.TheirRefRequired,new_comp.TheirRefRequired) end if; -- Group Invoice if locate(@AuditList,',Group Invoice,') > 0 and update(GroupInvoice) then call AuditLog('COMPANY',old_comp.CompanyID,string('Group Invoice Updated - ',@CompName),old_comp.GroupInvoice,new_comp.GroupInvoice) end if; -- Construction if locate(@AuditList,',Construction,') > 0 and update(Construction) then call AuditLog('COMPANY',old_comp.CompanyID,string('Construction Updated - ',@CompName),old_comp.Construction,new_comp.Construction) end if; -- Days Credit if locate(@AuditList,',Days Credit,') > 0 and update(DaysCredit) then call AuditLog('COMPANY',old_comp.CompanyID,string('Days Credit Updated - ',@CompName),old_comp.DaysCredit,new_comp.DaysCredit) end if; -- Invoice Email if locate(@AuditList,',Invoice Email,') > 0 and update(InvoiceEmail) then call AuditLog('COMPANY',old_comp.CompanyID,string('Invoice Email Updated - ',@CompName),old_comp.InvoiceEmail,new_comp.InvoiceEmail) end if; -- Accounts Contact if locate(@AuditList,',Accounts Contact,') > 0 and update(AccountsContact) then call AuditLog('COMPANY',old_comp.CompanyID,string('Accounts Contact Updated - ',@CompName),old_comp.AccountsContact,new_comp.AccountsContact) end if; -- Timesheet Contact if locate(@AuditList,',Timesheet Contact,') > 0 and update(TimesheetContact) then call AuditLog('COMPANY',old_comp.CompanyID,string('Timesheet Contact Updated - ',@CompName),old_comp.TimesheetContact,new_comp.TimesheetContact) end if; -- Ext Number if locate(@AuditList,',Ext Number,') > 0 and update(ExtNumber) then call AuditLog('COMPANY',old_comp.CompanyID,string('Ext Number Updated - ',@CompName),old_comp.ExtNumber,new_comp.ExtNumber) end if; -- Credit Limit if locate(@AuditList,',Credit Limit,') > 0 and update(CreditLimit) then call AuditLog('COMPANY',old_comp.CompanyID,string('Credit Limit Updated - ',@CompName),old_comp.CreditLimit,new_comp.CreditLimit) end if; -- On Stop if locate(@AuditList,',On Stop,') > 0 and update(OnStop) then call AuditLog('COMPANY',old_comp.CompanyID,string('On Stop Updated - ',@CompName),old_comp.OnStop,new_comp.OnStop) end if; -- Invoice Frequency if locate(@AuditList,',Invoice Frequency,') > 0 and update(InvoiceFrequency) then call AuditLog('COMPANY',old_comp.CompanyID,string('Invoice Frequency Updated - ',@CompName),old_comp.InvoiceFrequency,new_comp.InvoiceFrequency) end if; -- Vat On Temp Margin if locate(@AuditList,',Vat On Temp Margin,') > 0 and update(VatOnTempMargin) then call AuditLog('COMPANY',old_comp.CompanyID,string('Vat On Temp Margin Updated - ',@CompName),old_comp.VatOnTempMargin,new_comp.VatOnTempMargin) end if; -- Block Status if locate(@AuditList,',Block Status,') > 0 and update(BlockStatus) then call AuditLog('COMPANY',old_comp.CompanyID,string('Block Status Updated - ',@CompName),old_comp.BlockStatus,new_comp.BlockStatus) end if; -- Block Description if locate(@AuditList,',Block Description,') > 0 and update(BlockDescription) then call AuditLog('COMPANY',old_comp.CompanyID,string('Block Description Updated - ',@CompName),old_comp.BlockDescription,new_comp.BlockDescription) end if; -- ETimesheets if locate(@AuditList,',ETimesheets,') > 0 and update(ETimesheets) then call AuditLog('COMPANY',old_comp.CompanyID,string('ETimesheets Updated - ',@CompName),old_comp.ETimesheets,new_comp.ETimesheets) end if; -- Override Invoice Layout if locate(@AuditList,',Override Invoice Layout,') > 0 and update(documenttemplateid) then set @OldDescrip=(select name from iqacdocumenttemplate where documenttemplateid = old_comp.documenttemplateid); set @NewDescrip=(select name from iqacdocumenttemplate where documenttemplateid = new_comp.documenttemplateid); call AuditLog('COMPANY',old_comp.CompanyID,string('Override Invoice Layout Updated - ',@CompName),@OldDescrip,@NewDescrip) end if; -- Invoice PDF Create if locate(@AuditList,',Invoice PDF Create,') > 0 and update(PDFInvCreate) then call AuditLog('COMPANY',old_comp.CompanyID,string('Invoice PDF Create Updated - ',@CompName),old_comp.PDFInvCreate,new_comp.PDFInvCreate) end if; -- PDF Invoice add Timesheets if locate(@AuditList,',PDF Invoice add Timesheets,') > 0 and update(PDFInvIncTS) then call AuditLog('COMPANY',old_comp.CompanyID,string('PDF Invoice add Timesheets Updated - ',@CompName),old_comp.PDFInvIncTS,new_comp.PDFInvIncTS) end if; -- Their Ref Required if locate(@AuditList,',Their Ref Required,') > 0 and update(TheirRefRequiredInvoice) then call AuditLog('COMPANY',old_comp.CompanyID,string('Their Ref Required Updated - ',@CompName),old_comp.TheirRefRequiredInvoice,new_comp.TheirRefRequiredInvoice) end if; -- Invoice Management Group if locate(@AuditList,',Invoice Management Group,') > 0 and update(InvoiceManagementGroup) then call AuditLog('COMPANY',old_comp.CompanyID,string('Invoice Management Group Updated - ',@CompName),old_comp.InvoiceManagementGroup,new_comp.InvoiceManagementGroup) end if; -- Fixed NI if locate(@AuditList,',Fixed NI,') > 0 and update(FixedNI) then call AuditLog('COMPANY',old_comp.CompanyID,string('Fixed NI Updated - ',@CompName),old_comp.FixedNI,new_comp.FixedNI) end if; -- Fixed WTR if locate(@AuditList,',Fixed WTR,') > 0 and update(FixedWTR) then call AuditLog('COMPANY',old_comp.CompanyID,string('Fixed WTR Updated - ',@CompName),old_comp.FixedWTR,new_comp.FixedWTR) end if; if locate(@AuditList,',AWR Fixed NI,') > 0 and update(AWRFixedNI) then call AuditLog('COMPANY',old_comp.CompanyID,string('AWR Fixed NI Updated - ',@CompName),old_comp.AWRFixedNI,new_comp.AWRFixedNI) end if; -- Fixed WTR if locate(@AuditList,',AWR Fixed WTR,') > 0 and update(AWRFixedWTR) then call AuditLog('COMPANY',old_comp.CompanyID,string('AWR Fixed WTR Updated - ',@CompName),old_comp.AWRFixedWTR,new_comp.AWRFixedWTR) end if; -- PDF must have Documents if locate(@AuditList,',PDF must have Documents,') > 0 and update(PDFExtraDocs) then call AuditLog('COMPANY',old_comp.CompanyID,string('PDF must have Documents Updated - ',@CompName),old_comp.PDFExtraDocs,new_comp.PDFExtraDocs) end if end } go