Use ATNDBTest
Go

Create Table ATNDB.dbo.GritCustomerGroup(
	Serial smallint Not Null,
	FADes Varchar(50) Null,
	ENDes Varchar(50) Null,
	OfficeDetailRef Int Null)
GO

Create Table GritCustomer(
	Serial Bigint Not Null,
	Code Bigint Not Null,
	FAName Varchar(50) Null,
	ENName Varchar(50) Null,
	GritCustomerGroupRef smallint Null,
	Agent Varchar(50) Null,
	Address Varchar(300) Null,
	PostCode Varchar(20) Null,
	Email Varchar(50) Null,
	Website	Varchar(50) Null,
	RegNo Varchar(50) Null,
	SSN Varchar(50) Null,
	EconomicCode Varchar(50) Null,
	Tel1 Varchar(20) Null,
	Tel2 Varchar(20) Null,
	Fax Varchar(20) Null,
	Mobile Varchar(20) Null,
	Active bit Null,
	AccEntityL1CodeBookRef Bigint Null,
	AccEntityL2CodeBookRef Bigint Null,
	AccountMaximum Bigint Null,
	RecorderRef Int Null,
	RecordDate char(10) Null,
	EditorRef Int Null,
	EditDate char(10) Null,
	Description Varchar(300) Null,
	OfficeDetailRef Int Null)
GO


Create Table GritProduct(
	Serial Bigint Not Null,
	Code Bigint Not Null,
	FAName Varchar(50) Null,
	ENName Varchar(50) Null,
	UnitRef Bigint Null,
	Active bit Null,
	BuyUnitPrice Bigint Null,
	GritSalePriceScopeRef smallint Null,
	RecorderRef Int Null,
	RecordDate char(10) Null,
	EditorRef Int Null,
	EditDate char(10) Null,
	Comment Varchar(300) Null,
	OfficeDetailRef Int Null)
GO


Create Table GritSalePrice(
	Serial Bigint Not Null,
	GritProductRef Bigint Not Null,
	GritSalePriceBaseRef smallint Not Null,
	SaleUnitPrice Bigint Null)
GO


Create Table GritFactor(
	Serial Bigint Not Null,
	Code Bigint Null,
	AccDocumentHeaderRefOnVerification Bigint Null,
	GritCustomerRef Bigint Null,
	ControlNo Varchar(20) Null,
	EffectiveDate char(10) Null,
	EffectiveTime char(8) Null,
	LicensePlate Varchar(15) Null,
	EmptyWeight Bigint Null,
	GrossWeight Bigint Null,
	GritProductRef Bigint Null,
	Quantity float Null,
	UnitPrice Bigint Null,
	ApprovedUnitPrice Bigint Null,
	TotalPrice Bigint Null,
	BuyUnitPriceInProductTable Bigint Null,
	VAT Bigint Null,
	Cost Bigint Null,
	TotalPaid Bigint Null,
	PayDate char(10) Null,
	RecorderRef Int Null,
	RecordDate char(10) Null,
	EditorRef Int Null,
	EditDate char(10) Null,
	VerifierRef Int Null,
	VerificationDate char(10) Null,
	Description Varchar(300) Null,
	OfficeDetailRef Int Null,
	OfficePeriodRef Int Null)
GO


Create Table GritFactorAccCode(
	Serial Bigint Not Null,
	GritFactorRef Bigint Not Null,
	SystemAccCodeDefaultBaseRef Int Not Null,
	DebitAccGroupCodeBookRef Bigint Null,
	DebitAccGeneralCodeBookRef Bigint Null,
	DebitAccAdjutantL1CodeBookRef Bigint Null,
	DebitAccEntityL1CodeBookRef Bigint Null,
	DebitAccEntityL2CodeBookRef Bigint Null,
	CreditAccGroupCodeBookRef Bigint Null,
	CreditAccGeneralCodeBookRef Bigint Null,
	CreditAccAdjutantL1CodeBookRef Bigint Null,
	CreditAccEntityL1CodeBookRef Bigint Null,
	CreditAccEntityL2CodeBookRef Bigint Null)
GO
