DROP TABLE IF EXISTS ACCOUNTS_RECEIVABLE_AGING_DELIVERY_CACHE;
CREATE TABLE `ACCOUNTS_RECEIVABLE_AGING_DELIVERY_CACHE` ( `InvoiceID` integer NOT NULL DEFAULT '0' , `AccountNumber` varchar(10) NOT NULL DEFAULT '' , `ElapsedDays` integer DEFAULT NULL , `Payment` double(19,2) DEFAULT NULL , `Sale` double(19,2) DEFAULT NULL , `Balance` double(19,2) DEFAULT NULL , `0To30` double(19,2) DEFAULT NULL , `31To60` double(19,2) DEFAULT NULL , `61To90` double(19,2) DEFAULT NULL , `Over90` double(19,2) DEFAULT NULL );
DROP TABLE IF EXISTS ADMINISTRATOR;
CREATE TABLE `ADMINISTRATOR` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `FullName` varchar(30) DEFAULT NULL , `Username` varchar(30) DEFAULT NULL , `Password` varchar(30) DEFAULT NULL , `Email` varchar(35) DEFAULT NULL , `Level` integer NOT NULL DEFAULT '1' , `LastLogin` datetime DEFAULT NULL );
DROP TABLE IF EXISTS ALTAS_DETAIL;
CREATE TABLE `ALTAS_DETAIL` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AltaID` integer NOT NULL , `Line` varchar(3) NOT NULL , `Group` varchar(3) NOT NULL , `SKU` varchar(30) NOT NULL , UNIQUE (`ID`) );
DROP TABLE IF EXISTS ALTAS_HEAD;
CREATE TABLE `ALTAS_HEAD` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Name` varchar(60) NOT NULL , `NameEN` varchar(60) NOT NULL , `DateLine` varchar(20) NOT NULL , `ReceiptDate` datetime NOT NULL , `Sort` varchar(60) NOT NULL DEFAULT 'Line, SKU' , `Active` integer NOT NULL , UNIQUE (`ID`) );
DROP TABLE IF EXISTS APPLICATIONS_CATALOG;
CREATE TABLE `APPLICATIONS_CATALOG` ( `part_number` varchar(32) DEFAULT NULL , `label` varchar(255) DEFAULT NULL , `parttype` varchar(255) DEFAULT NULL , `position` varchar(255) DEFAULT NULL , `qty` integer DEFAULT NULL , `notes` varchar(255) DEFAULT NULL , `basevehicle` varchar(255) DEFAULT NULL , `enginebase` varchar(255) NOT NULL DEFAULT '' , `aspiration` varchar(255) DEFAULT NULL , `bedlength` varchar(255) DEFAULT NULL , `bedtype` varchar(255) DEFAULT NULL , `bodynumdoors` varchar(255) DEFAULT NULL , `bodytype` varchar(255) DEFAULT NULL , `brakeabs` varchar(255) DEFAULT NULL , `brakesystem` varchar(255) DEFAULT NULL , `cylinderheadtype` varchar(128) DEFAULT NULL , `drivetype` varchar(255) DEFAULT NULL , `enginedesignation` varchar(128) DEFAULT NULL , `enginemfr` varchar(255) DEFAULT NULL , `engineversion` varchar(255) DEFAULT NULL , `enginevin` varchar(255) DEFAULT NULL , `frontbraketype` varchar(255) DEFAULT NULL , `frontspringtype` varchar(255) DEFAULT NULL , `fueldeliverysubtype` varchar(255) DEFAULT NULL , `fueldeliverytype` varchar(255) DEFAULT NULL , `fuelsystemcontroltype` varchar(255) DEFAULT NULL , `fuelsystemdesign` varchar(255) DEFAULT NULL , `fueltype` varchar(255) DEFAULT NULL , `ignitionsystemtype` varchar(255) DEFAULT NULL , `mfrbodycode` varchar(255) DEFAULT NULL , `rearbraketype` varchar(255) DEFAULT NULL , `rearspringtype` varchar(255) DEFAULT NULL , `region` varchar(255) DEFAULT NULL , `steeringsystem` varchar(255) DEFAULT NULL , `steeringtype` varchar(255) DEFAULT NULL , `transmissioneleccontrolled` varchar(255) DEFAULT NULL , `transmissioncontroltype` varchar(255) DEFAULT NULL , `transmissionmfr` varchar(255) DEFAULT NULL , `transmissionmfrcode` varchar(255) DEFAULT NULL , `transmissionnumspeeds` varchar(255) DEFAULT NULL , `transmissiontype` varchar(255) DEFAULT NULL , `valves` varchar(255) DEFAULT NULL , `vehicletype` varchar(255) DEFAULT NULL , `wheelbase` varchar(255) DEFAULT NULL , `liter` varchar(255) DEFAULT NULL , `cc` varchar(255) DEFAULT NULL , `cid` varchar(255) DEFAULT NULL , `cylinders` varchar(255) DEFAULT NULL , `blocktype` varchar(255) DEFAULT NULL , `submodel` varchar(255) DEFAULT NULL , `year` integer DEFAULT NULL , `make` varchar(128) DEFAULT NULL , `model` varchar(128) DEFAULT NULL , `poweroutput` varchar(128) DEFAULT NULL , `brand` varchar(128) DEFAULT NULL , `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `groupcode` varchar(3) NOT NULL DEFAULT '' , `linecode` varchar(3) NOT NULL DEFAULT '' , `dashless` varchar(32) DEFAULT NULL , `enginestring` varchar(12) DEFAULT NULL , `haveit` integer NOT NULL DEFAULT '0' );
DROP TABLE IF EXISTS ASSIGNMENT_HEAD;
CREATE TABLE `ASSIGNMENT_HEAD` ( `AssignmentID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AssignmentDate` datetime DEFAULT NULL , `AssignmentTitle` varchar(1024) DEFAULT NULL , `AssignmentText` text COLLATE BINARY , `DeliveryUser` varchar(32) DEFAULT NULL , `AccountNumber` varchar(12) DEFAULT NULL , `DeliveryDate` datetime DEFAULT NULL , `PickupDate` datetime DEFAULT NULL , `Completed` integer NOT NULL DEFAULT '0' , `ShipToName` varchar(128) DEFAULT NULL , `ShipToAddress1` varchar(128) DEFAULT NULL , `ShipToAddress2` varchar(128) DEFAULT NULL , `ShipToCity` varchar(64) DEFAULT NULL , `ShipToState` varchar(2) DEFAULT NULL , `ShipToZip` varchar(10) DEFAULT NULL , `ContactName` varchar(64) DEFAULT NULL , `ContactPhone` varchar(18) DEFAULT NULL , `Deleted` integer NOT NULL DEFAULT '0' );
DROP TABLE IF EXISTS BILLBOARD;
CREATE TABLE `BILLBOARD` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Title` varchar(128) NOT NULL , `Type` varchar(32) NOT NULL , `Content` text NOT NULL , `Text` text NOT NULL , `Link` text NOT NULL , `Button` text NOT NULL , `Position` integer NOT NULL , `StartDate` datetime NOT NULL , `EndDate` datetime NOT NULL , `Active` integer NOT NULL );
DROP TABLE IF EXISTS CART_LOG;
CREATE TABLE `CART_LOG` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Action` varchar(256) DEFAULT NULL , `Group` varchar(3) DEFAULT NULL , `Line` varchar(3) DEFAULT NULL , `SKU` varchar(32) DEFAULT NULL , `Qty` integer DEFAULT NULL , `User` varchar(32) DEFAULT NULL , `TransactionDate` datetime DEFAULT NULL );
DROP TABLE IF EXISTS CATALOG_CATEGORY;
CREATE TABLE `CATALOG_CATEGORY` ( `CatalogID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Name` varchar(128) NOT NULL DEFAULT '' , `NameEN` varchar(128) NOT NULL DEFAULT '' , `Sort` varchar(60) NOT NULL DEFAULT 'Line, SKU' , `SortOrder` integer NOT NULL DEFAULT '1000' );
DROP TABLE IF EXISTS CATALOG_DETAIL;
CREATE TABLE `CATALOG_DETAIL` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `CategoryID` integer NOT NULL , `Line` varchar(3) NOT NULL , `SKU` varchar(30) NOT NULL , `Title` varchar(60) NOT NULL );
DROP TABLE IF EXISTS CATALOG_ITEMS;
CREATE TABLE `CATALOG_ITEMS` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `SKU` varchar(32) DEFAULT NULL );
DROP TABLE IF EXISTS CATALOG_LOG;
CREATE TABLE `CATALOG_LOG` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AccountNumber` varchar(12) DEFAULT NULL , `SearchDate` datetime DEFAULT NULL , `year` integer DEFAULT NULL , `make` varchar(32) DEFAULT NULL , `model` varchar(32) DEFAULT NULL , `engine` varchar(32) DEFAULT NULL , `parttype` varchar(128) DEFAULT NULL );
DROP TABLE IF EXISTS CELL_PROVIDER;
CREATE TABLE `CELL_PROVIDER` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Name` varchar(20) DEFAULT NULL , `Suffix` varchar(30) DEFAULT NULL );
DROP TABLE IF EXISTS CHECKS_DETAIL;
CREATE TABLE `CHECKS_DETAIL` ( `PaymentID` integer NOT NULL , `CheckNumber` VARCHAR(16) NOT NULL , `Name` VARCHAR(45) NOT NULL DEFAULT '' , `Amount` FLOAT NOT NULL , `CollectingUser` VARCHAR(3) NULL DEFAULT NULL , `PaymentDate` DATETIME NOT NULL );
DROP TABLE IF EXISTS CUSTOMER;
CREATE TABLE `CUSTOMER` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Name` varchar(45) NOT NULL DEFAULT '' , `Address1` varchar(128) DEFAULT NULL , `Address2` varchar(128) DEFAULT NULL , `City` varchar(30) NOT NULL DEFAULT '' , `State` varchar(12) DEFAULT NULL , `ZipCode` varchar(10) DEFAULT NULL , `Phone` varchar(14) NOT NULL , `PhoneExt` varchar(10) DEFAULT NULL , `ContactTitle` varchar(8) DEFAULT NULL , `Contact` varchar(256) NOT NULL DEFAULT '' , `ContactPhone` varchar(14) DEFAULT NULL , `AccountNumber` varchar(12) NOT NULL DEFAULT '' , `PriceLevel` varchar(2) NOT NULL DEFAULT 'B' , `Email` varchar(50) NOT NULL DEFAULT '' , `Salesman` varchar(11) NOT NULL DEFAULT '' , `CreditLimit` decimal(10,2) NOT NULL , `DiscountDays` integer NOT NULL DEFAULT '45' , `SupplierID` varchar(32) DEFAULT NULL , `Password` varchar(32) NOT NULL DEFAULT '827ccb0eea8a706c4c34a16891f84e7b' , `Comments` text NOT NULL , `Active` integer NOT NULL DEFAULT '1' , `Language` varchar(2) NOT NULL DEFAULT 'ES' , `DisableCheck` integer NOT NULL DEFAULT '0' , `LastLogin` datetime NOT NULL , `CookieHash` varchar(32) NOT NULL DEFAULT '' , `CookieExpire` datetime NOT NULL , `ResetHash` varchar(32) NOT NULL DEFAULT '' , `WaiveShipping` integer NOT NULL DEFAULT '0' , `SendOrderEmail` integer DEFAULT '1' , `SendAmountDueEmail` integer NOT NULL DEFAULT '1' , `ShowUPCInvoice` integer NOT NULL DEFAULT '0' , `DueDays` integer DEFAULT NULL , `DueDaysCalcDate` datetime DEFAULT NULL , `TaxID1` varchar(60) DEFAULT NULL , `TaxIDExpiration1` date DEFAULT NULL , `TaxExempt1` integer NOT NULL DEFAULT '0' , `TaxID2` varchar(60) DEFAULT NULL , `TaxIDExpiration2` date DEFAULT NULL , `TaxExempt2` integer NOT NULL DEFAULT '0' , `Terms` varchar(20) NOT NULL DEFAULT '15' , `ShipToAddress1` varchar(128) DEFAULT NULL , `ShipToAddress2` varchar(128) DEFAULT NULL , `ShipToCity` varchar(32) DEFAULT NULL , `ShipToState` varchar(12) DEFAULT NULL , `ShipToZip` varchar(12) DEFAULT NULL , `OverdueReminderSentDate` datetime DEFAULT NULL , UNIQUE (`AccountNumber`) );
DROP TABLE IF EXISTS CUSTOMER_ACTIVITY;
CREATE TABLE `CUSTOMER_ACTIVITY` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AccountNumber` varchar(9) NOT NULL , `ReportDate` datetime NOT NULL , `LastOrder` datetime NOT NULL , `Reason` text NOT NULL , `Salesman` varchar(3) NOT NULL );
DROP TABLE IF EXISTS CUSTOMER_ACTIVITY_ALERT;
CREATE TABLE `CUSTOMER_ACTIVITY_ALERT` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AccountNumber` varchar(9) NOT NULL , `LastOrder` datetime NOT NULL , `AlertDate` datetime NOT NULL , `Salesman` varchar(3) NOT NULL , UNIQUE (`AccountNumber`,`LastOrder`) );
DROP TABLE IF EXISTS CUSTOMER_REORDER_EXCLUDE;
CREATE TABLE `CUSTOMER_REORDER_EXCLUDE` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Line` varchar(3) DEFAULT NULL , `SKU` varchar(32) DEFAULT NULL , `AccountNumber` varchar(12) DEFAULT NULL );
DROP TABLE IF EXISTS CUSTOMER_TAX_CODE;
CREATE TABLE `CUSTOMER_TAX_CODE` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `TaxCode` varchar(32) DEFAULT NULL , `PercentA` double(6,5) DEFAULT NULL , `PercentB` double(6,5) DEFAULT NULL , UNIQUE (`TaxCode`) );
DROP TABLE IF EXISTS CUSTOMER_UPDATE;
CREATE TABLE `CUSTOMER_UPDATE` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AccountNumber` varchar(10) NOT NULL , `UpdateDate` datetime NOT NULL );
DROP TABLE IF EXISTS DELIVERY_CITY;
CREATE TABLE `DELIVERY_CITY` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `DeliveryID` integer DEFAULT NULL , `City` varchar(32) DEFAULT NULL );
DROP TABLE IF EXISTS DELIVERY_OPTION;
CREATE TABLE `DELIVERY_OPTION` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Name` varchar(64) DEFAULT NULL , `StartTime` time DEFAULT NULL , `Cutoff` time DEFAULT NULL , `Comment` varchar(256) DEFAULT NULL , `DeliveredBy` time DEFAULT NULL , `FeeRule` varchar(256) DEFAULT NULL , `DisplayPrice` integer NOT NULL DEFAULT '0' , `SameDay` integer DEFAULT '0' , `SKU` varchar(32) DEFAULT NULL );
DROP TABLE IF EXISTS DELIVERY_RECORD;
CREATE TABLE `DELIVERY_RECORD` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `InvoiceID` integer DEFAULT NULL , `PickupDate` datetime DEFAULT NULL , `DropoffDate` datetime DEFAULT NULL , `DeliveryUser` varchar(32) DEFAULT NULL , `DispatchUser` varchar(32) DEFAULT NULL , `BarcodeScan` varchar(32) DEFAULT NULL , UNIQUE (`InvoiceID`) );
DROP TABLE IF EXISTS DELIVERY_ZONE;
CREATE TABLE `DELIVERY_ZONE` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `DeliveryID` integer DEFAULT NULL , `Zone` integer DEFAULT NULL , UNIQUE (`DeliveryID`,`Zone`) );
DROP TABLE IF EXISTS DELIVERY_ZONE_CITY;
CREATE TABLE `DELIVERY_ZONE_CITY` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Zone` integer DEFAULT NULL , `City` varchar(32) DEFAULT NULL );
DROP TABLE IF EXISTS DETAILED_PAYMENT;
CREATE TABLE `DETAILED_PAYMENT` ( `ID` integer NULL DEFAULT '0' , `PaymentID` integer NULL DEFAULT NULL , `Processed` integer NOT NULL DEFAULT '0' , `InvoiceID` integer NULL DEFAULT '0' , `InvoiceDate` DATE NULL DEFAULT NULL , `SalesmanID` VARCHAR(5) NULL DEFAULT '' , `Reference` VARCHAR(20) NULL DEFAULT NULL , `PartialPayment` integer NULL DEFAULT '0' , `SubtotalAmount` FLOAT NULL DEFAULT NULL , `DiscountAmount` FLOAT NULL DEFAULT NULL , `TaxAmount` FLOAT(8) NULL DEFAULT NULL , `PaymentAmount` FLOAT NULL DEFAULT NULL , `AccountNumber` VARCHAR(10) NOT NULL , `Void` integer NOT NULL DEFAULT '0' , `PaymentDate` DATETIME NOT NULL );
DROP TABLE IF EXISTS DETAILED_PAYMENT_OLD;
CREATE TABLE `DETAILED_PAYMENT_OLD` ( `ID` integer NULL DEFAULT '0' , `PaymentID` integer NULL DEFAULT NULL , `Processed` integer NOT NULL DEFAULT '0' , `InvoiceID` VARCHAR(10) NULL DEFAULT '' , `InvoiceDate` DATE NULL DEFAULT NULL , `SalesmanID` VARCHAR(3) NOT NULL , `Reference` VARCHAR(20) NULL DEFAULT NULL , `PartialPayment` integer NULL DEFAULT '0' , `SubtotalAmount` FLOAT NULL DEFAULT NULL , `DiscountAmount` FLOAT NULL DEFAULT NULL , `TaxAmount` FLOAT(8) NULL DEFAULT NULL , `PaymentAmount` FLOAT NULL DEFAULT NULL , `AccountNumber` VARCHAR(10) NOT NULL , `Void` integer NOT NULL DEFAULT '0' , `PaymentDate` DATETIME NOT NULL );
DROP TABLE IF EXISTS DOCUMENT_RECORD;
CREATE TABLE `DOCUMENT_RECORD` ( `DocumentID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `DocumentType` varchar(16) DEFAULT NULL , `DocumentPath` varchar(256) DEFAULT NULL );
DROP TABLE IF EXISTS EMAIL_LOG;
CREATE TABLE `EMAIL_LOG` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `MailDate` datetime DEFAULT NULL , `ToAddress` varchar(256) DEFAULT NULL , `FromAddress` varchar(256) DEFAULT NULL , `Subject` varchar(256) DEFAULT NULL , `Message` text COLLATE BINARY );
DROP TABLE IF EXISTS ERROR_LOG;
CREATE TABLE `ERROR_LOG` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Content` text COLLATE BINARY );
DROP TABLE IF EXISTS ESTIMATE_CUSTOMER;
CREATE TABLE `ESTIMATE_CUSTOMER` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `EstimateID` integer NOT NULL , `Name` varchar(60) DEFAULT NULL , `Email` varchar(128) DEFAULT NULL , `Phone` varchar(20) DEFAULT NULL , `BillToAddress1` varchar(128) DEFAULT NULL , `BillToAddress2` varchar(128) DEFAULT NULL , `BillToCity` varchar(32) DEFAULT NULL , `BillToState` varchar(4) DEFAULT NULL , `BillToZip` varchar(12) DEFAULT NULL , `ShipToAddress1` varchar(128) DEFAULT NULL , `ShipToAddress2` varchar(128) DEFAULT NULL , `ShipToCity` varchar(32) DEFAULT NULL , `ShipToState` varchar(4) DEFAULT NULL , `ShipToZip` varchar(12) DEFAULT NULL , `ContactTitle` varchar(8) DEFAULT NULL , `Contact` varchar(128) DEFAULT NULL , `TaxID1` varchar(60) DEFAULT NULL , `TaxIDExpiration1` date DEFAULT NULL , `TaxID2` varchar(60) DEFAULT NULL , `TaxIDExpiration2` date DEFAULT NULL );
DROP TABLE IF EXISTS ESTIMATE_DETAIL;
CREATE TABLE `ESTIMATE_DETAIL` ( `EstimateID` integer NOT NULL , `Group` varchar(3) NOT NULL DEFAULT '' , `Line` varchar(3) NOT NULL DEFAULT '' , `SKU` varchar(20) NOT NULL , `Description` text NOT NULL , `Notes` text , `EstimateQty` integer NOT NULL , `AvailableQty` integer DEFAULT NULL , `Interchange` varchar(20) DEFAULT NULL , `Price` float(8,2) NOT NULL , `Core` float(8,2) DEFAULT NULL , `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , UNIQUE (`EstimateID`,`Group`,`Line`,`SKU`) );
DROP TABLE IF EXISTS ESTIMATE_HEAD;
CREATE TABLE `ESTIMATE_HEAD` ( `EstimateID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AccountNumber` varchar(10) NOT NULL DEFAULT '' , `EstimateDate` datetime NOT NULL , `Salesman` varchar(5) NOT NULL DEFAULT '' , `SalesmanEstimate` integer DEFAULT '0' , `WarehouseID` integer NOT NULL DEFAULT '100' , `EstimateNotes` text , `PONumber` varchar(32) DEFAULT NULL , `DeliveryMethod` varchar(64) DEFAULT NULL , `InProcess` integer NOT NULL , `InProcessDate` datetime NOT NULL , `Processed` integer NOT NULL , `ProcessedDate` datetime NOT NULL , `ProcessUser` varchar(20) NOT NULL , `DeleteEstimate` integer NOT NULL , `DeleteEstimateDate` datetime NOT NULL , `HoldDeleteReason` varchar(256) NOT NULL DEFAULT '' , `OnHoldDeleteUser` varchar(20) NOT NULL , `OfflineEstimate` integer NOT NULL DEFAULT '0' , `OfflineID` varchar(30) NOT NULL DEFAULT '' , `OfflineEstimateDate` datetime DEFAULT NULL , `ImageURL` varchar(1024) DEFAULT NULL , `IncludeProductImage` integer DEFAULT '0' , `Archive` integer NOT NULL DEFAULT '0' , `ApproveOrder` integer DEFAULT NULL );
DROP TABLE IF EXISTS EVENT_LOG;
CREATE TABLE `EVENT_LOG` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `DATE_TIME` datetime NOT NULL , `USER` varchar(20) NOT NULL , `ACTION` varchar(60) NOT NULL , `DATA` text NOT NULL );
DROP TABLE IF EXISTS "GROUP";
CREATE TABLE `GROUP` ( `Code` varchar(3) NOT NULL DEFAULT '' , `Name` varchar(60) DEFAULT NULL , `NameEN` varchar(60) NOT NULL , PRIMARY KEY (`Code`) );
DROP TABLE IF EXISTS INTERCHANGE;
CREATE TABLE `INTERCHANGE` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `SKU` varchar(64) DEFAULT NULL , `Reference` varchar(64) DEFAULT NULL , `Supplier` varchar(64) DEFAULT NULL , UNIQUE (`SKU`,`Reference`,`Supplier`) );
DROP TABLE IF EXISTS INVENTORY;
CREATE TABLE `INVENTORY` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Line` varchar(3) NOT NULL , `Group` varchar(3) NOT NULL DEFAULT '' , `SKU` varchar(20) NOT NULL DEFAULT '' , `Familia` varchar(32) NOT NULL DEFAULT '' , `Description` text NOT NULL , `Notes` text NOT NULL , `Qty` integer DEFAULT '0' , `AvgCost` float(8,2) NOT NULL , `Cost` float(8,2) NOT NULL , `PriceA` float(8,2) NOT NULL , `PriceB` float(8,2) NOT NULL , `PriceC` float(8,2) NOT NULL , `PriceD` float(8,2) NOT NULL , `PriceE` float(8,2) NOT NULL , `MSRP` float(8,2) NOT NULL DEFAULT '0.00' , `Core` float(8,2) NOT NULL , `Interchange` varchar(20) NOT NULL DEFAULT '' , `Dashless` varchar(20) NOT NULL DEFAULT '' , `DashlessInterchange` varchar(20) NOT NULL DEFAULT '' , `ProductURL` varchar(2048) DEFAULT NULL , `ImageURL` varchar(2048) DEFAULT NULL , `Category` varchar(64) DEFAULT NULL , `Subcategory` varchar(64) DEFAULT NULL , `OnOrder` integer DEFAULT '0' , `Location` varchar(12) DEFAULT NULL , `Taxable1` integer NOT NULL DEFAULT '1' , `Taxable2` integer NOT NULL DEFAULT '1' , `LocationB` varchar(12) DEFAULT NULL , `LocationC` varchar(12) DEFAULT NULL , `LocationD` varchar(12) DEFAULT NULL , `LocationE` varchar(12) DEFAULT NULL , `Discontinued` integer DEFAULT '0' , `CommissionRate` float(8,2) NOT NULL DEFAULT '0.07' , `Brand` varchar(64) NOT NULL DEFAULT '' , `VendorSKU` varchar(20) DEFAULT NULL , `VendorID` integer NOT NULL , `Active` integer NOT NULL DEFAULT '1' , UNIQUE (`Line`,`SKU`) );
DROP TABLE IF EXISTS INVOICE_CRATE;
CREATE TABLE `INVOICE_CRATE` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `InvoiceID` integer DEFAULT NULL , `CrateNumber` varchar(4) DEFAULT NULL , UNIQUE (`InvoiceID`,`CrateNumber`) );
DROP TABLE IF EXISTS INVOICE_DETAIL;
CREATE TABLE `INVOICE_DETAIL` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `InvoiceID` integer NOT NULL , `Group` varchar(3) NOT NULL DEFAULT '' , `Line` varchar(3) NOT NULL DEFAULT '' , `SKU` varchar(20) NOT NULL DEFAULT '' , `Description` text NOT NULL , `Notes` text COLLATE BINARY , `OrderQty` integer NOT NULL , `ShippedQty` integer DEFAULT NULL , `AvgCost` float(8,2) NOT NULL , `Core` float(8,2) DEFAULT NULL , `Price` float(8,2) NOT NULL , `Taxable1` integer NOT NULL , `Taxable2` integer NOT NULL , `Reference` varchar(128) DEFAULT NULL , `ReferenceType` varchar(128) DEFAULT NULL );
DROP TABLE IF EXISTS INVOICE_HEAD;
CREATE TABLE `INVOICE_HEAD` ( `InvoiceID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `OrderID` integer NOT NULL , `AccountNumber` varchar(10) NOT NULL DEFAULT '' , `InvoiceDate` datetime NOT NULL , `Salesman` varchar(5) NOT NULL DEFAULT '' , `SalesmanOrder` integer DEFAULT '0' , `WarehouseID` integer NOT NULL DEFAULT '100' , `Notes` text , `PONumber` varchar(32) DEFAULT NULL , `DeliveryMethod` varchar(64) DEFAULT NULL , `Status` integer NOT NULL DEFAULT '0' , `DueDate` date DEFAULT NULL , `SentPicking` datetime DEFAULT NULL , `Packed` integer NOT NULL DEFAULT '0' , `PackingUser` varchar(30) DEFAULT NULL , `PackageCount` integer DEFAULT NULL , `CreationDate` datetime DEFAULT NULL , `InvoiceUser` varchar(20) NOT NULL DEFAULT '' , `OnHold` integer NOT NULL DEFAULT '0' , `OnHoldDate` datetime NOT NULL , `Void` integer NOT NULL DEFAULT '0' , `VoidDate` datetime DEFAULT NULL , `HoldVoidReason` varchar(256) NOT NULL DEFAULT '' , `HoldVoidUser` varchar(20) NOT NULL DEFAULT '' , `Terms` varchar(16) DEFAULT NULL , `Subtotal` float(12,2) DEFAULT NULL , `Tax1Total` float(8,2) DEFAULT NULL , `Tax2Total` float(8,2) DEFAULT NULL , `Tax1Rate` float(5,4) DEFAULT NULL , `Tax2Rate` float(5,4) DEFAULT NULL , `ShipToName` varchar(64) NOT NULL DEFAULT '' , `ShipToAddress1` varchar(128) NOT NULL DEFAULT '' , `ShipToAddress2` varchar(128) NOT NULL DEFAULT '' , `ShipToCity` varchar(128) NOT NULL DEFAULT '' , `ShipToState` varchar(2) NOT NULL DEFAULT '' , `ShipToZip` varchar(32) NOT NULL DEFAULT '' , `ShipToCountry` varchar(32) NOT NULL DEFAULT '' , `BillToName` varchar(64) NOT NULL DEFAULT '' , `BillToAddress1` varchar(128) NOT NULL DEFAULT '' , `BillToAddress2` varchar(128) NOT NULL DEFAULT '' , `BillToCity` varchar(32) NOT NULL DEFAULT '' , `BillToState` varchar(2) DEFAULT NULL , `BillToZip` varchar(32) DEFAULT '' , `BillToCountry` varchar(32) NOT NULL DEFAULT '' , `DeliveryDate` datetime DEFAULT NULL , `Delivered` integer NOT NULL DEFAULT '0' , `DeliveryUser` varchar(64) DEFAULT NULL );
DROP TABLE IF EXISTS ITEMS_SEARS;
CREATE TABLE `ITEMS_SEARS` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `SKU` varchar(32) DEFAULT NULL );
DROP TABLE IF EXISTS LINE;
CREATE TABLE `LINE` ( `Code` varchar(3) NOT NULL DEFAULT '' , `Name` varchar(75) DEFAULT NULL , `NameEN` varchar(75) NOT NULL , `ImageURL` varchar(1024) DEFAULT NULL , PRIMARY KEY (`Code`) );
DROP TABLE IF EXISTS LOGIN_LOG;
CREATE TABLE `LOGIN_LOG` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Type` varchar(12) NOT NULL , `Username` varchar(16) NOT NULL , `IPAddress` varchar(16) NOT NULL , `ForwardIP` varchar(16) NOT NULL , `LoginDate` datetime NOT NULL , `Result` integer NOT NULL );
DROP TABLE IF EXISTS LOST_SALE;
CREATE TABLE `LOST_SALE` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AccountNumber` varchar(10) NOT NULL , `SKU` varchar(64) NOT NULL , `Description` varchar(256) NOT NULL , `Qty` integer NOT NULL , `Price` decimal(10,2) NOT NULL , `CompetitionPrice` decimal(10,2) NOT NULL , `CompetitionSource` varchar(32) NOT NULL , `Reason` varchar(64) NOT NULL , `LostSaleDate` datetime NOT NULL , `Comments` varchar(512) NOT NULL );
DROP TABLE IF EXISTS MULTIPLE_WAREHOUSE;
CREATE TABLE `MULTIPLE_WAREHOUSE` ( `WarehouseID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `WarehouseName` varchar(32) DEFAULT NULL , `WarehouseType` varchar(2) DEFAULT NULL );
DROP TABLE IF EXISTS MULTIPLE_WH_INVENTORY;
CREATE TABLE `MULTIPLE_WH_INVENTORY` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `WarehouseID` integer DEFAULT NULL , `Line` varchar(3) DEFAULT NULL , `SKU` varchar(32) DEFAULT NULL , `Qty` integer DEFAULT NULL , `StockLevel` integer DEFAULT NULL , UNIQUE (`WarehouseID`,`Line`,`SKU`) );
DROP TABLE IF EXISTS NEW_CUSTOMER_REORDER;
CREATE TABLE `NEW_CUSTOMER_REORDER` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Line` varchar(3) DEFAULT NULL , `SKU` varchar(32) DEFAULT NULL , `OrderQty` integer DEFAULT NULL );
DROP TABLE IF EXISTS NEW_ORDER;
CREATE TABLE `NEW_ORDER` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `SKU` varchar(32) DEFAULT NULL , `Line` varchar(3) DEFAULT NULL , `Group` varchar(3) DEFAULT NULL , `Description` varchar(128) DEFAULT NULL , `Order` integer DEFAULT NULL , `UPC_SINGLE` text COLLATE BINARY , `UPC_MULTIPLE` text COLLATE BINARY );
DROP TABLE IF EXISTS OFFLINE_SYNC_LOG;
CREATE TABLE `OFFLINE_SYNC_LOG` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Salesman` varchar(3) DEFAULT NULL , `SyncDate` datetime DEFAULT NULL , `OrdersUploaded` integer DEFAULT NULL , `PaymentsUploaded` integer DEFAULT NULL );
DROP TABLE IF EXISTS ORDER_DETAIL;
CREATE TABLE `ORDER_DETAIL` ( `OrderID` integer NOT NULL , `Group` varchar(3) NOT NULL DEFAULT '' , `Line` varchar(3) NOT NULL DEFAULT '' , `SKU` varchar(20) NOT NULL , `Description` text NOT NULL , `Notes` text , `OrderQty` integer NOT NULL , `AvailableQty` integer DEFAULT NULL , `Interchange` varchar(20) DEFAULT NULL , `Price` float(8,2) NOT NULL , `Core` float(8,2) DEFAULT NULL , `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , UNIQUE (`OrderID`,`Group`,`Line`,`SKU`) );
DROP TABLE IF EXISTS ORDER_HEAD;
CREATE TABLE `ORDER_HEAD` ( `OrderID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AccountNumber` varchar(10) NOT NULL DEFAULT '' , `OrderDate` datetime NOT NULL , `Salesman` varchar(5) NOT NULL DEFAULT '' , `SalesmanOrder` integer DEFAULT '0' , `WarehouseID` integer NOT NULL DEFAULT '100' , `OrderNotes` text COLLATE BINARY , `PONumber` varchar(32) DEFAULT NULL , `DeliveryMethod` varchar(64) DEFAULT NULL , `InProcess` integer NOT NULL , `InProcessDate` datetime NOT NULL , `Processed` integer NOT NULL , `ProcessedDate` datetime NOT NULL , `ProcessUser` varchar(20) NOT NULL , `OnHold` integer NOT NULL , `OnHoldDate` datetime NOT NULL , `DeleteOrder` integer NOT NULL , `DeleteOrderDate` datetime NOT NULL , `HoldDeleteReason` varchar(256) NOT NULL , `OnHoldDeleteUser` varchar(20) NOT NULL , `OfflineOrder` integer NOT NULL DEFAULT '0' , `OfflineID` varchar(30) NOT NULL DEFAULT '' , `OfflineOrderDate` datetime DEFAULT NULL , `DocumentID` integer DEFAULT NULL );
DROP TABLE IF EXISTS PAID_INVOICE;
CREATE TABLE `PAID_INVOICE` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Salesman` varchar(3) NOT NULL , `ST` integer NOT NULL , `AccountNumber` varchar(10) NOT NULL , `CustomerName` varchar(60) NOT NULL , `InvoiceNumber` varchar(8) NOT NULL , `PaidDate` date NOT NULL , `PaymentAmt` decimal(12,2) NOT NULL , `Discount` decimal(8,2) NOT NULL , `Tax` decimal(8,2) NOT NULL , `Job` integer NOT NULL , `Reference` varchar(32) DEFAULT NULL , UNIQUE (`ST`,`InvoiceNumber`,`PaidDate`,`PaymentAmt`,`Reference`) );
DROP TABLE IF EXISTS PAYMENT_CHECK;
CREATE TABLE `PAYMENT_CHECK` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PaymentID` integer NOT NULL , `CheckNumber` varchar(16) NOT NULL , `Amount` float NOT NULL );
DROP TABLE IF EXISTS PAYMENT_CREDIT;
CREATE TABLE `PAYMENT_CREDIT` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PaymentID` integer NOT NULL , `CreditDate` date NOT NULL , `CreditNumber` varchar(9) NOT NULL , `Reference` varchar(30) DEFAULT NULL , `Subtotal` float NOT NULL DEFAULT '0' , `Tax` float NOT NULL DEFAULT '0' , `Discount` float NOT NULL DEFAULT '0' , `Total` float DEFAULT '0' );
DROP TABLE IF EXISTS PAYMENT_DEPOSIT_DETAIL;
CREATE TABLE `PAYMENT_DEPOSIT_DETAIL` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `DepositID` integer DEFAULT NULL , `PaymentID` integer DEFAULT NULL );
DROP TABLE IF EXISTS PAYMENT_DEPOSIT_HEAD;
CREATE TABLE `PAYMENT_DEPOSIT_HEAD` ( `DepositID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `DepositDate` date DEFAULT NULL , `Username` varchar(32) DEFAULT NULL , `CreationDate` datetime DEFAULT NULL , `TotalChecks` double(12,2) DEFAULT NULL , `TotalCash` double(12,2) DEFAULT NULL , `TotalTransfer` double(12,2) DEFAULT NULL , `TotalDeposit` double(12,2) DEFAULT NULL , `Notes` text COLLATE BINARY , `Depositor` varchar(32) DEFAULT NULL );
DROP TABLE IF EXISTS PAYMENT_DETAIL;
CREATE TABLE `PAYMENT_DETAIL` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PaymentID` integer NOT NULL , `InvoiceID` varchar(10) NOT NULL DEFAULT '' , `InvoiceDate` date NOT NULL , `Reference` varchar(20) NOT NULL , `PartialPayment` integer NOT NULL DEFAULT '0' , `SubtotalAmount` float NOT NULL , `DiscountAmount` float NOT NULL , `TaxAmount` float(8,2) NOT NULL , `PaymentAmount` float NOT NULL );
DROP TABLE IF EXISTS PAYMENT_HEAD;
CREATE TABLE `PAYMENT_HEAD` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PaymentDate` datetime NOT NULL , `AccountNumber` varchar(10) NOT NULL , `SalesmanID` varchar(3) NOT NULL , `CPD` integer NOT NULL DEFAULT '0' , `CPDDate` date DEFAULT NULL , `CPDReceipt` integer NOT NULL DEFAULT '0' , `CPDReceiptDate` datetime DEFAULT NULL , `CashAmount` float NOT NULL , `CheckAmount` float NOT NULL , `TransferAmount` float DEFAULT '0' , `ProcessDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' , `Processed` integer NOT NULL DEFAULT '0' , `ProcessUser` varchar(24) DEFAULT NULL , `Loaded` integer NOT NULL DEFAULT '0' , `Notes` varchar(1000) NOT NULL DEFAULT '' , `Void` integer NOT NULL DEFAULT '0' , `OfflinePayment` integer NOT NULL DEFAULT '0' , `OfflineID` varchar(30) NOT NULL DEFAULT '' , `OfflineDate` datetime NOT NULL , `Deposited` integer DEFAULT '0' , `CollectingUser` varchar(3) DEFAULT NULL );
DROP TABLE IF EXISTS PAYMENT_REMINDER;
CREATE TABLE `PAYMENT_REMINDER` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PaymentID` integer NOT NULL , `Reason` varchar(128) NOT NULL , `Notes` varchar(256) NOT NULL , `NextVisitDate` date NOT NULL );
DROP TABLE IF EXISTS PAYMENT_SALESMAN_RECONCILE_DETAIL;
CREATE TABLE `PAYMENT_SALESMAN_RECONCILE_DETAIL` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `ReconcileID` integer DEFAULT NULL , `PaymentID` integer DEFAULT NULL );
DROP TABLE IF EXISTS PAYMENT_SALESMAN_RECONCILE_HEAD;
CREATE TABLE `PAYMENT_SALESMAN_RECONCILE_HEAD` ( `ReconcileID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `SalesmanID` varchar(3) DEFAULT NULL , `ReconcileDate` datetime DEFAULT NULL , `ReconcileUser` varchar(32) DEFAULT NULL , `Notes` text COLLATE BINARY );
DROP TABLE IF EXISTS PAYMENT_TAX_DETAIL;
CREATE TABLE `PAYMENT_TAX_DETAIL` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `ST` integer DEFAULT NULL , `InvoiceNumber` varchar(10) DEFAULT NULL , `AccountNumber` varchar(12) DEFAULT NULL , `CustomerName` varchar(32) DEFAULT NULL , `PaidDate` date DEFAULT NULL , `PaymentAmt` double DEFAULT NULL , `Discount` double DEFAULT NULL , `InvoiceTotal` double DEFAULT NULL , `Subtotal` double DEFAULT NULL , `SaleDate` date DEFAULT NULL , `TaxCode` varchar(32) DEFAULT NULL , `IVU` double DEFAULT NULL , `IVU_E` double DEFAULT NULL , `IVU_M` double DEFAULT NULL );
DROP TABLE IF EXISTS PAYMENT_TAX_DETAIL_EXCEPTIONS;
CREATE TABLE `PAYMENT_TAX_DETAIL_EXCEPTIONS` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `ST` integer DEFAULT NULL , `InvoiceNumber` varchar(10) DEFAULT NULL , `AccountNumber` varchar(12) DEFAULT NULL , `CustomerName` varchar(32) DEFAULT NULL , `PaidDate` date DEFAULT NULL , `PaymentAmt` double DEFAULT NULL , `Discount` double DEFAULT NULL , `InvoiceTotal` double DEFAULT NULL , `Subtotal` double DEFAULT NULL , `SaleDate` date DEFAULT NULL , `TaxCode` varchar(32) DEFAULT NULL , `IVU` double DEFAULT NULL , `IVU_E` double DEFAULT NULL , `IVU_M` double DEFAULT NULL );
DROP TABLE IF EXISTS PAYMENT_VOID;
CREATE TABLE `PAYMENT_VOID` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PaymentID` integer NOT NULL , `Reason` text NOT NULL , `User` varchar(30) NOT NULL , `VoidDate` datetime NOT NULL );
DROP TABLE IF EXISTS PICKING_INCENTIVE;
CREATE TABLE `PICKING_INCENTIVE` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `ST` integer NOT NULL , `TransactionDate` date NOT NULL , `PO` varchar(10) NOT NULL , `InvoiceNumber` varchar(10) NOT NULL , `LineNum` integer NOT NULL , `Description` varchar(255) NOT NULL , `NetSale` float NOT NULL , `Units` integer NOT NULL , UNIQUE (`InvoiceNumber`,`LineNum`) );
DROP TABLE IF EXISTS PICKING_INCENTIVE_NAME;
CREATE TABLE `PICKING_INCENTIVE_NAME` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Code` varchar(1) NOT NULL , `Name` varchar(64) NOT NULL , UNIQUE (`Code`) );
DROP TABLE IF EXISTS PICKUP_CART;
CREATE TABLE `PICKUP_CART` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `SalesmanID` varchar(9) DEFAULT NULL , `Line` varchar(3) DEFAULT NULL , `SKU` varchar(20) DEFAULT NULL , `Qty` integer DEFAULT NULL , `OrderID` varchar(11) DEFAULT NULL , `InvoiceNumber` varchar(256) DEFAULT NULL , `Reason` varchar(3) NOT NULL DEFAULT '' , `WarrantyReason` varchar(3) DEFAULT NULL , UNIQUE (`Line`,`SKU`,`SalesmanID`,`InvoiceNumber`,`Reason`) );
DROP TABLE IF EXISTS PICKUP_DETAIL;
CREATE TABLE `PICKUP_DETAIL` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PickupID` integer NOT NULL , `Line` varchar(3) NOT NULL DEFAULT '' , `SKU` varchar(20) NOT NULL DEFAULT '' , `Qty` integer NOT NULL , `OrderID` varchar(11) NOT NULL , `InvoiceNumber` varchar(256) DEFAULT NULL , `Reason` varchar(3) NOT NULL DEFAULT '' , `WarrantyReason` varchar(3) DEFAULT NULL , `Approved` integer DEFAULT NULL , `StatusUser` varchar(32) DEFAULT NULL , `StatusDate` datetime DEFAULT NULL , `StatusReason` varchar(256) DEFAULT NULL );
DROP TABLE IF EXISTS PICKUP_HEAD;
CREATE TABLE `PICKUP_HEAD` ( `PickupID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AccountNumber` varchar(10) NOT NULL DEFAULT '' , `PickupDate` datetime DEFAULT NULL , `Salesman` varchar(3) DEFAULT NULL , `PickupNotes` text , `PickupTicket` integer DEFAULT NULL , `Packages` integer DEFAULT NULL , `RequestedBy` varchar(30) DEFAULT '' , `Via` varchar(32) NOT NULL , `ToPickup` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' , `ToPickupUser` varchar(30) DEFAULT '' , `AtWarehouse` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' , `AtWarehouseUser` varchar(30) DEFAULT '' , `AtWarehouseNotes` varchar(1000) DEFAULT '' , `PickupStatus` varchar(20) DEFAULT '' , `PickupStatusUser` varchar(30) DEFAULT '' , `PickupStatusNotes` varchar(1000) DEFAULT '' , `Void` integer NOT NULL DEFAULT '0' , `Loaded` integer NOT NULL DEFAULT '0' );
DROP TABLE IF EXISTS PICKUP_REASON;
CREATE TABLE `PICKUP_REASON` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Key` varchar(3) DEFAULT NULL , `Value` varchar(30) DEFAULT NULL );
DROP TABLE IF EXISTS PICKUP_RECEIVE_BATCH;
CREATE TABLE `PICKUP_RECEIVE_BATCH` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `User` varchar(28) DEFAULT NULL , `BatchCloseTime` datetime DEFAULT NULL , `BatchCompleted` integer DEFAULT '0' );
DROP TABLE IF EXISTS PICKUP_RECEIVE_PACKAGE;
CREATE TABLE `PICKUP_RECEIVE_PACKAGE` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PickupID` integer DEFAULT NULL , `PackageNumber` integer DEFAULT NULL , `ReceiveDate` datetime DEFAULT NULL , `User` varchar(32) DEFAULT NULL , `BatchID` integer DEFAULT NULL , UNIQUE (`PickupID`,`PackageNumber`) );
DROP TABLE IF EXISTS PICKUP_VERIFICATION_STATUS;
CREATE TABLE `PICKUP_VERIFICATION_STATUS` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PickupDetailID` integer DEFAULT NULL , `PickupID` integer DEFAULT NULL , `StatusReason` varchar(256) DEFAULT NULL );
DROP TABLE IF EXISTS PICKUP_VOID;
CREATE TABLE `PICKUP_VOID` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PickupID` integer NOT NULL , `Reason` text NOT NULL , `User` varchar(30) NOT NULL , `VoidDate` datetime NOT NULL );
DROP TABLE IF EXISTS PICKUP_WARRANTY_REASON;
CREATE TABLE `PICKUP_WARRANTY_REASON` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Key` varchar(3) DEFAULT NULL , `Value` varchar(256) DEFAULT NULL );
DROP TABLE IF EXISTS PRICE_PLAN_CALC;
CREATE TABLE `PRICE_PLAN_CALC` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AccountNumber` varchar(9) NOT NULL , `Percent` float NOT NULL , UNIQUE (`AccountNumber`) );
DROP TABLE IF EXISTS PRICE_PLAN_LIST_CUSTOMER;
CREATE TABLE `PRICE_PLAN_LIST_CUSTOMER` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PriceListID` integer DEFAULT NULL , `AccountNumber` varchar(12) DEFAULT NULL );
DROP TABLE IF EXISTS PRICE_PLAN_LIST_DEF;
CREATE TABLE `PRICE_PLAN_LIST_DEF` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Name` varchar(64) DEFAULT NULL , UNIQUE (`Name`) );
DROP TABLE IF EXISTS PRICE_PLAN_LIST_DETAIL;
CREATE TABLE `PRICE_PLAN_LIST_DETAIL` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PriceListID` integer DEFAULT NULL , `Line` varchar(3) DEFAULT NULL , `SKU` varchar(32) DEFAULT NULL , `Price` float(10,2) DEFAULT NULL , UNIQUE (`PriceListID`,`Line`,`SKU`) );
DROP TABLE IF EXISTS PRODUCT_ATTRIBUTE;
CREATE TABLE `PRODUCT_ATTRIBUTE` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Line` varchar(3) DEFAULT NULL , `SKU` varchar(32) DEFAULT NULL , `Name` varchar(32) DEFAULT NULL , `Value` varchar(128) DEFAULT NULL , UNIQUE (`Line`,`SKU`,`Name`) );
DROP TABLE IF EXISTS PRODUCT_UPC;
CREATE TABLE `PRODUCT_UPC` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `UPC` varchar(20) DEFAULT NULL , `Qty` integer DEFAULT NULL , `Line` varchar(3) DEFAULT NULL , `SKU` varchar(32) DEFAULT NULL , UNIQUE (`UPC`) );
DROP TABLE IF EXISTS PROGRAM_PICTURE;
CREATE TABLE `PROGRAM_PICTURE` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `ProgramName` varchar(30) DEFAULT NULL , `PictureURL` varchar(1024) DEFAULT NULL );
DROP TABLE IF EXISTS PURCHASE_ORDER_DETAIL;
CREATE TABLE `PURCHASE_ORDER_DETAIL` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PurchaseOrderID` integer DEFAULT NULL , `Line` varchar(3) DEFAULT NULL , `SKU` varchar(32) DEFAULT NULL , `Description` varchar(256) DEFAULT NULL , `OrderQty` integer DEFAULT NULL , `ConfirmedQty` integer NOT NULL DEFAULT '0' , `ReceivedQty` integer NOT NULL DEFAULT '0' , `Cost` double(10,2) DEFAULT NULL , `Reference` varchar(1024) DEFAULT NULL , `PackagesReceived` integer NOT NULL DEFAULT '0' );
DROP TABLE IF EXISTS PURCHASE_ORDER_HEADER;
CREATE TABLE `PURCHASE_ORDER_HEADER` ( `PurchaseOrderID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PODate` datetime DEFAULT NULL , `Username` varchar(32) DEFAULT NULL , `VendorID` varchar(4) DEFAULT NULL , `Notes` text COLLATE BINARY , `InvoiceNumber` varchar(30) DEFAULT NULL , `Sent` integer DEFAULT NULL , `SentDate` datetime DEFAULT NULL , `ExpectedDate` datetime DEFAULT NULL , `Freight` double(10,2) DEFAULT NULL , `Received` integer NOT NULL DEFAULT '0' , `Confirmed` integer NOT NULL DEFAULT '0' , `ConfirmedDate` datetime DEFAULT NULL , `ConfirmedUser` varchar(32) DEFAULT NULL , `ShipToName` varchar(32) DEFAULT NULL , `ShipToAddress1` varchar(256) DEFAULT NULL , `ShipToAddress2` varchar(256) DEFAULT NULL , `ShipToCity` varchar(32) DEFAULT NULL , `ShipToState` varchar(12) DEFAULT NULL , `ShipToZip` varchar(16) DEFAULT NULL , `ShipToCountry` varchar(32) DEFAULT NULL , `ShippingTerms` varchar(64) DEFAULT NULL , `PaymentTerms` varchar(20) DEFAULT NULL , `Completed` integer NOT NULL DEFAULT '0' , `InvoiceDate` date DEFAULT NULL , `MiscCharges` double(10,2) DEFAULT NULL , `Packages` integer DEFAULT NULL , `PackagesReceived` integer DEFAULT NULL , `Void` integer NOT NULL DEFAULT '0' , `VoidReason` varchar(256) DEFAULT NULL );
DROP TABLE IF EXISTS PURCHASE_ORDER_RECEIVE;
CREATE TABLE `PURCHASE_ORDER_RECEIVE` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `PurchaseOrderID` integer DEFAULT NULL , `Line` varchar(4) DEFAULT NULL , `SKU` varchar(32) DEFAULT NULL , `QtyScanned` integer DEFAULT NULL , `UPCScanned` varchar(20) DEFAULT NULL , `Username` varchar(30) DEFAULT NULL , `ScanDate` datetime DEFAULT NULL );
DROP TABLE IF EXISTS QUANTITY_BREAK;
CREATE TABLE `QUANTITY_BREAK` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Line` varchar(3) DEFAULT NULL , `SKU` varchar(20) DEFAULT NULL , `QtyBreak` integer DEFAULT NULL , `QtyToAdd` integer DEFAULT NULL , `DiscountRate` float(12,4) DEFAULT NULL , `Active` integer NOT NULL DEFAULT '1' );
DROP TABLE IF EXISTS QUOTE_DETAIL;
CREATE TABLE `QUOTE_DETAIL` ( `QuoteID` integer NOT NULL , `Group` varchar(3) NOT NULL DEFAULT '' , `Line` varchar(3) NOT NULL DEFAULT '' , `SKU` varchar(20) NOT NULL , `Description` text NOT NULL , `Notes` text , `QuoteQty` integer NOT NULL , `AvailableQty` integer DEFAULT NULL , `Interchange` varchar(20) DEFAULT NULL , `Price` float(8,2) NOT NULL , `Core` float(8,2) DEFAULT NULL , `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , UNIQUE (`QuoteID`,`Group`,`Line`,`SKU`) );
DROP TABLE IF EXISTS QUOTE_HEAD;
CREATE TABLE `QUOTE_HEAD` ( `QuoteID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AccountNumber` varchar(10) NOT NULL DEFAULT '' , `QuoteDate` datetime NOT NULL , `Salesman` varchar(5) NOT NULL , `SalesmanQuote` integer DEFAULT '0' , `QuoteNotes` text , `PONumber` varchar(12) DEFAULT NULL , `DeliveryMethod` varchar(64) DEFAULT NULL , `InProcess` integer NOT NULL , `InProcessDate` datetime NOT NULL , `Processed` integer NOT NULL , `ProcessedDate` datetime NOT NULL , `ProcessUser` varchar(20) NOT NULL , `OnHold` integer NOT NULL , `OnHoldDate` datetime NOT NULL , `DeleteQuote` integer NOT NULL , `DeleteQuoteDate` datetime NOT NULL , `HoldDeleteReason` varchar(256) NOT NULL , `OnHoldDeleteUser` varchar(20) NOT NULL , `OfflineQuote` integer NOT NULL DEFAULT '0' , `OfflineID` varchar(30) NOT NULL DEFAULT '' , `OfflineQuoteDate` datetime DEFAULT NULL );
DROP TABLE IF EXISTS REORDER_SORT;
CREATE TABLE `REORDER_SORT` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Familia` varchar(32) DEFAULT NULL , `SortOrder` integer DEFAULT NULL );
DROP TABLE IF EXISTS REPORT_DETAIL;
CREATE TABLE `REPORT_DETAIL` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `ReportID` integer DEFAULT NULL , `ColumnName` varchar(32) DEFAULT NULL , `IsMoney` integer DEFAULT NULL , `Totalize` integer DEFAULT NULL , `CustomFunction` varchar(64) DEFAULT NULL , `ColStyle` varchar(128) DEFAULT NULL , `Comment` text COLLATE BINARY , `Filter` integer NOT NULL DEFAULT '0' );
DROP TABLE IF EXISTS REPORT_HEAD;
CREATE TABLE `REPORT_HEAD` ( `ReportID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Username` varchar(32) DEFAULT NULL , `ReportName` varchar(128) DEFAULT NULL , `CreationDate` datetime DEFAULT NULL , `SQLQuery` text COLLATE BINARY );
DROP TABLE IF EXISTS SALESMAN;
CREATE TABLE `SALESMAN` ( `ID` varchar(11) NOT NULL DEFAULT '' , `FullName` varchar(32) NOT NULL DEFAULT '' , `Username` varchar(20) NOT NULL DEFAULT '' , `Password` varchar(32) NOT NULL DEFAULT '827ccb0eea8a706c4c34a16891f84e7b' , `LastLogin` datetime NOT NULL , `Language` varchar(2) NOT NULL DEFAULT 'ES' , `Email` varchar(50) NOT NULL DEFAULT '' , `CookieHash` varchar(32) DEFAULT NULL , `CookieExpire` datetime DEFAULT NULL , `CommissionRate` float(4,3) DEFAULT NULL , `SalesCommissionRate` float(4,3) DEFAULT NULL , `GlobalCommission` integer NOT NULL DEFAULT '0' , `CommissionSalesman` integer NOT NULL DEFAULT '0' , `Phone` varchar(10) DEFAULT NULL , `CellProvider` integer DEFAULT NULL , `EmailPass` varchar(32) DEFAULT NULL , `iPhoneConfig` varchar(128) DEFAULT NULL , `AllowTruckMode` integer NOT NULL DEFAULT '0' , `SendInventoryEmail` integer NOT NULL DEFAULT '0' , `Active` integer NOT NULL DEFAULT '1' , PRIMARY KEY (`ID`) , UNIQUE (`Username`) , UNIQUE (`CookieHash`) );
DROP TABLE IF EXISTS SALESMAN_QUOTA;
CREATE TABLE `SALESMAN_QUOTA` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Salesman` varchar(3) NOT NULL , `Month` integer NOT NULL , `Year` integer NOT NULL , `MTD` decimal(12,2) NOT NULL , `MTDPayment` double NOT NULL , `Goal` decimal(12,2) NOT NULL , UNIQUE (`Salesman`,`Month`,`Year`) );
DROP TABLE IF EXISTS SALESMAN_QUOTA_TEMP;
CREATE TABLE `SALESMAN_QUOTA_TEMP` ( `SalesmanID` varchar(3) NOT NULL , `SalesmanName` varchar(32) NOT NULL , `MTD` double NOT NULL , `TransactionCounter` integer NOT NULL , `LastDate` varchar(20) NOT NULL );
DROP TABLE IF EXISTS SalesmanReconciliationHistory;
CREATE TABLE `SalesmanReconciliationHistory` ( `ReconcileID` integer NOT NULL DEFAULT '0' , `SalesmanID` VARCHAR(3) NULL DEFAULT NULL , `ReconcileDate` DATETIME NULL DEFAULT NULL , `ReconcileUser` VARCHAR(32) NULL DEFAULT NULL , `Notes` TEXT NULL DEFAULT NULL , `TotalAmount` DOUBLE(19) NULL DEFAULT NULL , `FullName` VARCHAR(30) NULL DEFAULT NULL );
DROP TABLE IF EXISTS SAVED_CART_DETAIL;
CREATE TABLE `SAVED_CART_DETAIL` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `SavedCartID` integer NOT NULL , `Group` varchar(3) DEFAULT NULL , `Line` varchar(3) DEFAULT NULL , `SKU` varchar(20) DEFAULT NULL , `Qty` integer DEFAULT NULL );
DROP TABLE IF EXISTS SAVED_CART_HEAD;
CREATE TABLE `SAVED_CART_HEAD` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AccountNumber` varchar(10) DEFAULT NULL , `SelectedAccount` varchar(10) DEFAULT NULL , `SavedCartDate` datetime DEFAULT NULL , `Name` varchar(32) DEFAULT NULL , `SalesmanCart` integer DEFAULT NULL , `GlobalCart` integer NOT NULL DEFAULT '0' );
DROP TABLE IF EXISTS SEARCH_QUERY;
CREATE TABLE `SEARCH_QUERY` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Group` varchar(3) NOT NULL , `Line` varchar(3) NOT NULL , `SKU` varchar(30) NOT NULL , `AccountNumber` varchar(10) NOT NULL , `Salesman` integer NOT NULL , `QueryDate` datetime NOT NULL );
DROP TABLE IF EXISTS SETTING;
CREATE TABLE `SETTING` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `SettingName` varchar(32) NOT NULL , `Value` varchar(64) NOT NULL DEFAULT '' , `Comment` varchar(64) NOT NULL , UNIQUE (`SettingName`) );
DROP TABLE IF EXISTS SHOPPING_CART;
CREATE TABLE `SHOPPING_CART` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `AccountNumber` varchar(9) NOT NULL , `Group` varchar(3) DEFAULT NULL , `Line` varchar(3) DEFAULT NULL , `SKU` varchar(20) DEFAULT NULL , `Qty` integer DEFAULT NULL , `SalesmanCart` integer DEFAULT '0' , UNIQUE (`AccountNumber`,`Group`,`Line`,`SKU`) );
DROP TABLE IF EXISTS SoldByMonth;
CREATE TABLE `SoldByMonth` ( `Line` VARCHAR(3) NOT NULL DEFAULT '' , `Group` VARCHAR(3) NOT NULL DEFAULT '' , `Familia` VARCHAR(32) NOT NULL DEFAULT '' , `SKU` VARCHAR(20) NOT NULL DEFAULT '' , `Description` TEXT NOT NULL , `Shipped` DECIMAL(32) NULL DEFAULT NULL , `OnHand` integer NULL DEFAULT '0' , `January` DECIMAL(32) NULL DEFAULT NULL , `February` DECIMAL(32) NULL DEFAULT NULL , `March` DECIMAL(32) NULL DEFAULT NULL , `April` DECIMAL(32) NULL DEFAULT NULL , `May` DECIMAL(32) NULL DEFAULT NULL , `June` DECIMAL(32) NULL DEFAULT NULL , `July` DECIMAL(32) NULL DEFAULT NULL , `August` DECIMAL(32) NULL DEFAULT NULL , `September` DECIMAL(32) NULL DEFAULT NULL , `October` DECIMAL(32) NULL DEFAULT NULL , `November` DECIMAL(32) NULL DEFAULT NULL , `December` DECIMAL(32) NULL DEFAULT NULL , `Year` integer NULL DEFAULT NULL );
DROP TABLE IF EXISTS SoldByMonthAll;
CREATE TABLE `SoldByMonthAll` ( `Line` VARCHAR(3) NOT NULL DEFAULT '' , `Group` VARCHAR(3) NOT NULL DEFAULT '' , `Familia` VARCHAR(32) NOT NULL DEFAULT '' , `SKU` VARCHAR(20) NOT NULL DEFAULT '' , `Description` TEXT NOT NULL , `Shipped` DECIMAL(32) NULL DEFAULT NULL , `OnHand` integer NULL DEFAULT '0' , `January` DECIMAL(32) NULL DEFAULT NULL , `February` DECIMAL(32) NULL DEFAULT NULL , `March` DECIMAL(32) NULL DEFAULT NULL , `April` DECIMAL(32) NULL DEFAULT NULL , `May` DECIMAL(32) NULL DEFAULT NULL , `June` DECIMAL(32) NULL DEFAULT NULL , `July` DECIMAL(32) NULL DEFAULT NULL , `August` DECIMAL(32) NULL DEFAULT NULL , `September` DECIMAL(32) NULL DEFAULT NULL , `October` DECIMAL(32) NULL DEFAULT NULL , `November` DECIMAL(32) NULL DEFAULT NULL , `December` DECIMAL(32) NULL DEFAULT NULL , `Year` integer NULL DEFAULT NULL );
DROP TABLE IF EXISTS SPECIAL;
CREATE TABLE `SPECIAL` ( `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Line` varchar(3) NOT NULL , `SKU` varchar(32) NOT NULL , `Description` varchar(60) NOT NULL , `Notes` varchar(60) NOT NULL , `RegularPrice` decimal(9,2) NOT NULL );
DROP TABLE IF EXISTS SUPPLIER;
CREATE TABLE `SUPPLIER` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `CompanyName` varchar(128) DEFAULT NULL , `ContactName` varchar(128) DEFAULT NULL , `PaymentTerms` integer DEFAULT NULL , `POEmail` varchar(256) DEFAULT NULL , `ContactEmail` varchar(256) DEFAULT NULL );
DROP TABLE IF EXISTS SUPPLIER_CATALOG_LINK;
CREATE TABLE `SUPPLIER_CATALOG_LINK` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Name` varchar(30) DEFAULT NULL , `ButtonImage` varchar(1024) DEFAULT NULL , `Link` varchar(1024) DEFAULT NULL , `Position` integer DEFAULT NULL , `AdditionalText` varchar(128) DEFAULT NULL , `Target` varchar(32) DEFAULT '_blank' );
DROP TABLE IF EXISTS TICKET_HEAD;
CREATE TABLE `TICKET_HEAD` ( `TicketID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `TicketDate` datetime DEFAULT NULL , `Username` varchar(32) DEFAULT NULL , `Subject` varchar(256) DEFAULT NULL , `Contents` text COLLATE BINARY , `Status` integer NOT NULL DEFAULT '0' , `Priority` integer NOT NULL DEFAULT '2' , `DateClosed` datetime DEFAULT NULL , `Archived` integer NOT NULL DEFAULT '0' );
DROP TABLE IF EXISTS TICKET_ITEM;
CREATE TABLE `TICKET_ITEM` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `TicketID` integer DEFAULT NULL , `Username` varchar(32) DEFAULT NULL , `PostDate` datetime DEFAULT NULL , `Comment` text COLLATE BINARY , `LastEdit` datetime DEFAULT NULL );
DROP TABLE IF EXISTS VENDOR;
CREATE TABLE `VENDOR` ( `VendorID` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `Name` varchar(64) DEFAULT NULL , `Contact` varchar(64) DEFAULT NULL , `PhysicalAddress1` varchar(128) DEFAULT NULL , `PhysicalAddress2` varchar(128) DEFAULT NULL , `PhysicalAddress3` varchar(128) DEFAULT NULL , `PhysicalCity` varchar(32) DEFAULT NULL , `PhysicalState` varchar(12) DEFAULT NULL , `PhysicalZip` varchar(12) DEFAULT NULL , `PhysicalCountry` varchar(32) DEFAULT NULL , `PostalAddress1` varchar(128) DEFAULT NULL , `PostalAddress2` varchar(128) DEFAULT NULL , `PostalAddress3` varchar(128) DEFAULT NULL , `PostalCity` varchar(32) DEFAULT NULL , `PostalState` varchar(12) DEFAULT NULL , `PostalZip` varchar(12) DEFAULT NULL , `PostalCountry` varchar(30) DEFAULT NULL , `ShippingTerms` varchar(12) DEFAULT NULL , `PaymentTerms` varchar(12) DEFAULT NULL , `MainPhone` varchar(32) DEFAULT NULL , `ContactPhone` varchar(32) DEFAULT NULL , `Fax` varchar(32) DEFAULT NULL , `ContactEmail` varchar(64) DEFAULT NULL , `OrderEmail` varchar(64) DEFAULT NULL , `LeadTime` integer DEFAULT NULL , `OurAccountNumber` varchar(20) DEFAULT NULL );
DROP TABLE IF EXISTS WEEKLY_PLANNER_DETAIL;
CREATE TABLE `WEEKLY_PLANNER_DETAIL` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `WPID` integer DEFAULT NULL , `Weekday` integer DEFAULT NULL , `AccountNumber` varchar(12) DEFAULT NULL , `OverDue` double(10,2) DEFAULT NULL , `Comments` varchar(254) DEFAULT NULL );
DROP TABLE IF EXISTS WEEKLY_PLANNER_HEAD;
CREATE TABLE `WEEKLY_PLANNER_HEAD` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `SalesmanID` varchar(3) DEFAULT NULL , `WeekStart` date DEFAULT NULL , `WeekEnd` date DEFAULT NULL , UNIQUE (`SalesmanID`,`WeekStart`,`WeekEnd`) );
DROP TABLE IF EXISTS WH_PL;
CREATE TABLE `WH_PL` ( `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT , `SKU` varchar(32) DEFAULT NULL , `Description` varchar(128) DEFAULT NULL , `Department` varchar(128) DEFAULT NULL , `Category` varchar(128) DEFAULT NULL , `Price` float(8,2) DEFAULT NULL , UNIQUE (`SKU`) );
DROP INDEX IF EXISTS idx_ALTAS_DETAIL_AltaID;
CREATE INDEX "idx_ALTAS_DETAIL_AltaID" ON "ALTAS_DETAIL" (`AltaID`);
DROP INDEX IF EXISTS idx_ALTAS_DETAIL_Line;
CREATE INDEX "idx_ALTAS_DETAIL_Line" ON "ALTAS_DETAIL" (`Line`,`Group`,`SKU`);
DROP INDEX IF EXISTS idx_ALTAS_HEAD_ReceiptDate;
CREATE INDEX "idx_ALTAS_HEAD_ReceiptDate" ON "ALTAS_HEAD" (`ReceiptDate`,`Active`);
DROP INDEX IF EXISTS idx_APPLICATIONS_CATALOG_brand;
CREATE INDEX "idx_APPLICATIONS_CATALOG_brand" ON "APPLICATIONS_CATALOG" (`brand`);
DROP INDEX IF EXISTS idx_APPLICATIONS_CATALOG_dashless;
CREATE INDEX "idx_APPLICATIONS_CATALOG_dashless" ON "APPLICATIONS_CATALOG" (`dashless`);
DROP INDEX IF EXISTS idx_APPLICATIONS_CATALOG_enginestring;
CREATE INDEX "idx_APPLICATIONS_CATALOG_enginestring" ON "APPLICATIONS_CATALOG" (`enginestring`);
DROP INDEX IF EXISTS idx_APPLICATIONS_CATALOG_FullAppSearch;
CREATE INDEX "idx_APPLICATIONS_CATALOG_FullAppSearch" ON "APPLICATIONS_CATALOG" (`year`,`make`,`model`,`parttype`,`part_number`);
DROP INDEX IF EXISTS idx_APPLICATIONS_CATALOG_haveit;
CREATE INDEX "idx_APPLICATIONS_CATALOG_haveit" ON "APPLICATIONS_CATALOG" (`haveit`);
DROP INDEX IF EXISTS idx_APPLICATIONS_CATALOG_part_number;
CREATE INDEX "idx_APPLICATIONS_CATALOG_part_number" ON "APPLICATIONS_CATALOG" (`part_number`);
DROP INDEX IF EXISTS idx_APPLICATIONS_CATALOG_parttype;
CREATE INDEX "idx_APPLICATIONS_CATALOG_parttype" ON "APPLICATIONS_CATALOG" (`parttype`);
DROP INDEX IF EXISTS idx_APPLICATIONS_CATALOG_year;
CREATE INDEX "idx_APPLICATIONS_CATALOG_year" ON "APPLICATIONS_CATALOG" (`year`,`model`,`make`);
DROP INDEX IF EXISTS idx_APPLICATIONS_CATALOG_year_2;
CREATE INDEX "idx_APPLICATIONS_CATALOG_year_2" ON "APPLICATIONS_CATALOG" (`year`,`make`,`model`,`parttype`);
DROP INDEX IF EXISTS idx_APPLICATIONS_CATALOG_year_3;
CREATE INDEX "idx_APPLICATIONS_CATALOG_year_3" ON "APPLICATIONS_CATALOG" (`year`);
DROP INDEX IF EXISTS idx_ASSIGNMENT_HEAD_AccountNumber;
CREATE INDEX "idx_ASSIGNMENT_HEAD_AccountNumber" ON "ASSIGNMENT_HEAD" (`AccountNumber`);
DROP INDEX IF EXISTS idx_ASSIGNMENT_HEAD_DeliveryUser;
CREATE INDEX "idx_ASSIGNMENT_HEAD_DeliveryUser" ON "ASSIGNMENT_HEAD" (`DeliveryUser`);
DROP INDEX IF EXISTS idx_CART_LOG_TransactionDate;
CREATE INDEX "idx_CART_LOG_TransactionDate" ON "CART_LOG" (`TransactionDate`);
DROP INDEX IF EXISTS idx_CART_LOG_User;
CREATE INDEX "idx_CART_LOG_User" ON "CART_LOG" (`User`,`TransactionDate`);
DROP INDEX IF EXISTS idx_CATALOG_LOG_AccountNumber;
CREATE INDEX "idx_CATALOG_LOG_AccountNumber" ON "CATALOG_LOG" (`AccountNumber`);
DROP INDEX IF EXISTS idx_CUSTOMER_ACTIVITY_Index;
CREATE INDEX "idx_CUSTOMER_ACTIVITY_Index" ON "CUSTOMER_ACTIVITY" (`AccountNumber`);
DROP INDEX IF EXISTS idx_ESTIMATE_DETAIL_EstimateID;
CREATE INDEX "idx_ESTIMATE_DETAIL_EstimateID" ON "ESTIMATE_DETAIL" (`EstimateID`,`SKU`);
DROP INDEX IF EXISTS idx_ESTIMATE_DETAIL_Line_SKU;
CREATE INDEX "idx_ESTIMATE_DETAIL_Line_SKU" ON "ESTIMATE_DETAIL" (`Line`,`SKU`);
DROP INDEX IF EXISTS idx_ESTIMATE_HEAD_AccountNumber;
CREATE INDEX "idx_ESTIMATE_HEAD_AccountNumber" ON "ESTIMATE_HEAD" (`AccountNumber`);
DROP INDEX IF EXISTS idx_ESTIMATE_HEAD_EstimateDate;
CREATE INDEX "idx_ESTIMATE_HEAD_EstimateDate" ON "ESTIMATE_HEAD" (`EstimateDate`);
DROP INDEX IF EXISTS idx_ESTIMATE_HEAD_InProcess;
CREATE INDEX "idx_ESTIMATE_HEAD_InProcess" ON "ESTIMATE_HEAD" (`InProcess`);
DROP INDEX IF EXISTS idx_ESTIMATE_HEAD_Processed;
CREATE INDEX "idx_ESTIMATE_HEAD_Processed" ON "ESTIMATE_HEAD" (`Processed`);
DROP INDEX IF EXISTS idx_ESTIMATE_HEAD_ProcessUser;
CREATE INDEX "idx_ESTIMATE_HEAD_ProcessUser" ON "ESTIMATE_HEAD" (`ProcessUser`);
DROP INDEX IF EXISTS idx_ESTIMATE_HEAD_Salesman;
CREATE INDEX "idx_ESTIMATE_HEAD_Salesman" ON "ESTIMATE_HEAD" (`Salesman`);
DROP INDEX IF EXISTS idx_EVENT_LOG_DATE_TIME;
CREATE INDEX "idx_EVENT_LOG_DATE_TIME" ON "EVENT_LOG" (`DATE_TIME`,`USER`);
DROP INDEX IF EXISTS idx_INTERCHANGE_Index;
CREATE INDEX "idx_INTERCHANGE_Index" ON "INTERCHANGE" (`SKU`);
DROP INDEX IF EXISTS idx_INTERCHANGE_Reference;
CREATE INDEX "idx_INTERCHANGE_Reference" ON "INTERCHANGE" (`Reference`);
DROP INDEX IF EXISTS idx_INTERCHANGE_Reference_2;
CREATE INDEX "idx_INTERCHANGE_Reference_2" ON "INTERCHANGE" (`Reference`);
DROP INDEX IF EXISTS idx_INTERCHANGE_Reference_3;
CREATE INDEX "idx_INTERCHANGE_Reference_3" ON "INTERCHANGE" (`Reference`,`SKU`);
DROP INDEX IF EXISTS idx_INTERCHANGE_SKU;
CREATE INDEX "idx_INTERCHANGE_SKU" ON "INTERCHANGE" (`SKU`);
DROP INDEX IF EXISTS idx_INTERCHANGE_SKU_2;
CREATE INDEX "idx_INTERCHANGE_SKU_2" ON "INTERCHANGE" (`SKU`,`Reference`);
DROP INDEX IF EXISTS idx_INVENTORY_Dashless;
CREATE INDEX "idx_INVENTORY_Dashless" ON "INVENTORY" (`Dashless`);
DROP INDEX IF EXISTS idx_INVENTORY_Dashless_2;
CREATE INDEX "idx_INVENTORY_Dashless_2" ON "INVENTORY" (`Dashless`,`DashlessInterchange`);
DROP INDEX IF EXISTS idx_INVENTORY_DashlessInterchange;
CREATE INDEX "idx_INVENTORY_DashlessInterchange" ON "INVENTORY" (`DashlessInterchange`);
DROP INDEX IF EXISTS idx_INVENTORY_SKU;
CREATE INDEX "idx_INVENTORY_SKU" ON "INVENTORY" (`SKU`);
DROP INDEX IF EXISTS idx_INVENTORY_warehouse;
CREATE INDEX "idx_INVENTORY_warehouse" ON "INVENTORY" (`Group`,`Line`,`SKU`,`Interchange`);
DROP INDEX IF EXISTS idx_INVOICE_DETAIL_Line_SKU;
CREATE INDEX "idx_INVOICE_DETAIL_Line_SKU" ON "INVOICE_DETAIL" (`Line`,`SKU`);
DROP INDEX IF EXISTS idx_INVOICE_DETAIL_OrderID;
CREATE INDEX "idx_INVOICE_DETAIL_OrderID" ON "INVOICE_DETAIL" (`InvoiceID`,`SKU`);
DROP INDEX IF EXISTS idx_INVOICE_HEAD_AccountNumber;
CREATE INDEX "idx_INVOICE_HEAD_AccountNumber" ON "INVOICE_HEAD" (`AccountNumber`);
DROP INDEX IF EXISTS idx_INVOICE_HEAD_InProcess;
CREATE INDEX "idx_INVOICE_HEAD_InProcess" ON "INVOICE_HEAD" (`Status`);
DROP INDEX IF EXISTS idx_INVOICE_HEAD_OrderDate;
CREATE INDEX "idx_INVOICE_HEAD_OrderDate" ON "INVOICE_HEAD" (`InvoiceDate`);
DROP INDEX IF EXISTS idx_INVOICE_HEAD_Processed;
CREATE INDEX "idx_INVOICE_HEAD_Processed" ON "INVOICE_HEAD" (`Packed`);
DROP INDEX IF EXISTS idx_INVOICE_HEAD_ProcessUser;
CREATE INDEX "idx_INVOICE_HEAD_ProcessUser" ON "INVOICE_HEAD" (`InvoiceUser`);
DROP INDEX IF EXISTS idx_INVOICE_HEAD_Salesman;
CREATE INDEX "idx_INVOICE_HEAD_Salesman" ON "INVOICE_HEAD" (`Salesman`);
DROP INDEX IF EXISTS idx_LOGIN_LOG_Username;
CREATE INDEX "idx_LOGIN_LOG_Username" ON "LOGIN_LOG" (`Username`);
DROP INDEX IF EXISTS idx_ORDER_DETAIL_Line_SKU;
CREATE INDEX "idx_ORDER_DETAIL_Line_SKU" ON "ORDER_DETAIL" (`Line`,`SKU`);
DROP INDEX IF EXISTS idx_ORDER_DETAIL_OrderID;
CREATE INDEX "idx_ORDER_DETAIL_OrderID" ON "ORDER_DETAIL" (`OrderID`,`SKU`);
DROP INDEX IF EXISTS idx_ORDER_HEAD_AccountNumber;
CREATE INDEX "idx_ORDER_HEAD_AccountNumber" ON "ORDER_HEAD" (`AccountNumber`);
DROP INDEX IF EXISTS idx_ORDER_HEAD_InProcess;
CREATE INDEX "idx_ORDER_HEAD_InProcess" ON "ORDER_HEAD" (`InProcess`);
DROP INDEX IF EXISTS idx_ORDER_HEAD_OrderDate;
CREATE INDEX "idx_ORDER_HEAD_OrderDate" ON "ORDER_HEAD" (`OrderDate`);
DROP INDEX IF EXISTS idx_ORDER_HEAD_Processed;
CREATE INDEX "idx_ORDER_HEAD_Processed" ON "ORDER_HEAD" (`Processed`);
DROP INDEX IF EXISTS idx_ORDER_HEAD_ProcessUser;
CREATE INDEX "idx_ORDER_HEAD_ProcessUser" ON "ORDER_HEAD" (`ProcessUser`);
DROP INDEX IF EXISTS idx_ORDER_HEAD_Salesman;
CREATE INDEX "idx_ORDER_HEAD_Salesman" ON "ORDER_HEAD" (`Salesman`);
DROP INDEX IF EXISTS idx_PAID_INVOICE_InvoiceNumber;
CREATE INDEX "idx_PAID_INVOICE_InvoiceNumber" ON "PAID_INVOICE" (`InvoiceNumber`);
DROP INDEX IF EXISTS idx_PAID_INVOICE_InvoiceNumber_2;
CREATE INDEX "idx_PAID_INVOICE_InvoiceNumber_2" ON "PAID_INVOICE" (`InvoiceNumber`,`AccountNumber`);
DROP INDEX IF EXISTS idx_PAID_INVOICE_Job;
CREATE INDEX "idx_PAID_INVOICE_Job" ON "PAID_INVOICE" (`Job`);
DROP INDEX IF EXISTS idx_PAID_INVOICE_PaidDate;
CREATE INDEX "idx_PAID_INVOICE_PaidDate" ON "PAID_INVOICE" (`PaidDate`);
DROP INDEX IF EXISTS idx_PAID_INVOICE_Reference;
CREATE INDEX "idx_PAID_INVOICE_Reference" ON "PAID_INVOICE" (`Reference`);
DROP INDEX IF EXISTS idx_PAID_INVOICE_Salesman;
CREATE INDEX "idx_PAID_INVOICE_Salesman" ON "PAID_INVOICE" (`Salesman`,`AccountNumber`,`InvoiceNumber`);
DROP INDEX IF EXISTS idx_PAYMENT_CHECK_Index;
CREATE INDEX "idx_PAYMENT_CHECK_Index" ON "PAYMENT_CHECK" (`PaymentID`);
DROP INDEX IF EXISTS idx_PAYMENT_CREDIT_Index;
CREATE INDEX "idx_PAYMENT_CREDIT_Index" ON "PAYMENT_CREDIT" (`PaymentID`);
DROP INDEX IF EXISTS idx_PAYMENT_DETAIL_InvoiceNumber;
CREATE INDEX "idx_PAYMENT_DETAIL_InvoiceNumber" ON "PAYMENT_DETAIL" (`InvoiceID`);
DROP INDEX IF EXISTS idx_PAYMENT_DETAIL_PaymentID;
CREATE INDEX "idx_PAYMENT_DETAIL_PaymentID" ON "PAYMENT_DETAIL" (`PaymentID`);
DROP INDEX IF EXISTS idx_PAYMENT_HEAD_AccountNumber;
CREATE INDEX "idx_PAYMENT_HEAD_AccountNumber" ON "PAYMENT_HEAD" (`AccountNumber`,`SalesmanID`);
DROP INDEX IF EXISTS idx_PAYMENT_VOID_PaymentID;
CREATE INDEX "idx_PAYMENT_VOID_PaymentID" ON "PAYMENT_VOID" (`PaymentID`);
DROP INDEX IF EXISTS idx_PICKUP_CART_Account;
CREATE INDEX "idx_PICKUP_CART_Account" ON "PICKUP_CART" (`SalesmanID`);
DROP INDEX IF EXISTS idx_PICKUP_CART_OrderID;
CREATE INDEX "idx_PICKUP_CART_OrderID" ON "PICKUP_CART" (`OrderID`);
DROP INDEX IF EXISTS idx_PICKUP_RECEIVE_PACKAGE_PickupID_2;
CREATE INDEX "idx_PICKUP_RECEIVE_PACKAGE_PickupID_2" ON "PICKUP_RECEIVE_PACKAGE" (`PickupID`);
DROP INDEX IF EXISTS idx_PICKUP_VOID_PickupID;
CREATE INDEX "idx_PICKUP_VOID_PickupID" ON "PICKUP_VOID" (`PickupID`);
DROP INDEX IF EXISTS idx_PRODUCT_ATTRIBUTE_Line;
CREATE INDEX "idx_PRODUCT_ATTRIBUTE_Line" ON "PRODUCT_ATTRIBUTE" (`Line`,`SKU`);
DROP INDEX IF EXISTS idx_PRODUCT_ATTRIBUTE_SKU;
CREATE INDEX "idx_PRODUCT_ATTRIBUTE_SKU" ON "PRODUCT_ATTRIBUTE" (`SKU`);
DROP INDEX IF EXISTS idx_PRODUCT_ATTRIBUTE_SKU_2;
CREATE INDEX "idx_PRODUCT_ATTRIBUTE_SKU_2" ON "PRODUCT_ATTRIBUTE" (`SKU`,`Name`);
DROP INDEX IF EXISTS idx_QUOTE_DETAIL_Line_SKU;
CREATE INDEX "idx_QUOTE_DETAIL_Line_SKU" ON "QUOTE_DETAIL" (`Line`,`SKU`);
DROP INDEX IF EXISTS idx_QUOTE_DETAIL_QuoteID;
CREATE INDEX "idx_QUOTE_DETAIL_QuoteID" ON "QUOTE_DETAIL" (`QuoteID`,`SKU`);
DROP INDEX IF EXISTS idx_QUOTE_HEAD_AccountNumber;
CREATE INDEX "idx_QUOTE_HEAD_AccountNumber" ON "QUOTE_HEAD" (`AccountNumber`);
DROP INDEX IF EXISTS idx_QUOTE_HEAD_InProcess;
CREATE INDEX "idx_QUOTE_HEAD_InProcess" ON "QUOTE_HEAD" (`InProcess`);
DROP INDEX IF EXISTS idx_QUOTE_HEAD_Processed;
CREATE INDEX "idx_QUOTE_HEAD_Processed" ON "QUOTE_HEAD" (`Processed`);
DROP INDEX IF EXISTS idx_QUOTE_HEAD_ProcessUser;
CREATE INDEX "idx_QUOTE_HEAD_ProcessUser" ON "QUOTE_HEAD" (`ProcessUser`);
DROP INDEX IF EXISTS idx_QUOTE_HEAD_QuoteDate;
CREATE INDEX "idx_QUOTE_HEAD_QuoteDate" ON "QUOTE_HEAD" (`QuoteDate`);
DROP INDEX IF EXISTS idx_QUOTE_HEAD_Salesman;
CREATE INDEX "idx_QUOTE_HEAD_Salesman" ON "QUOTE_HEAD" (`Salesman`);
DROP INDEX IF EXISTS idx_SALESMAN_QUOTA_Salesman;
CREATE INDEX "idx_SALESMAN_QUOTA_Salesman" ON "SALESMAN_QUOTA" (`Salesman`);
DROP INDEX IF EXISTS idx_SEARCH_QUERY_AccountNumber;
CREATE INDEX "idx_SEARCH_QUERY_AccountNumber" ON "SEARCH_QUERY" (`AccountNumber`);
DROP INDEX IF EXISTS idx_SEARCH_QUERY_AccountNumber_2;
CREATE INDEX "idx_SEARCH_QUERY_AccountNumber_2" ON "SEARCH_QUERY" (`AccountNumber`,`QueryDate`);
DROP INDEX IF EXISTS idx_SEARCH_QUERY_Group;
CREATE INDEX "idx_SEARCH_QUERY_Group" ON "SEARCH_QUERY" (`Group`,`Line`,`SKU`,`AccountNumber`);
DROP INDEX IF EXISTS idx_SEARCH_QUERY_QueryDate;
CREATE INDEX "idx_SEARCH_QUERY_QueryDate" ON "SEARCH_QUERY" (`QueryDate`);
DROP INDEX IF EXISTS idx_SHOPPING_CART_Account;
CREATE INDEX "idx_SHOPPING_CART_Account" ON "SHOPPING_CART" (`AccountNumber`);
DROP INDEX IF EXISTS idx_SPECIAL_Line;
CREATE INDEX "idx_SPECIAL_Line" ON "SPECIAL" (`Line`,`SKU`);
