· 10 years ago · Sep 25, 2016, 04:10 PM
1if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TLager]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
2drop table [dbo].[TLager]
3GO
4
5if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TProizvodi]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
6drop table [dbo].[TProizvodi]
7GO
8
9if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TProizvodiDopolnitelniPodatoci]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
10drop table [dbo].[TProizvodiDopolnitelniPodatoci]
11GO
12
13if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TProizvodiKolicini]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
14drop table [dbo].[TProizvodiKolicini]
15GO
16
17if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TProizvodiSliki]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
18drop table [dbo].[TProizvodiSliki]
19GO
20
21if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Tproizvoditeli]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
22drop table [dbo].[Tproizvoditeli]
23GO
24
25if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[locations]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
26drop table [dbo].[locations]
27GO
28
29if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mysqlapp_products_stock]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
30drop table [dbo].[mysqlapp_products_stock]
31GO
32
33if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mysqlapp_synchstatus]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
34drop table [dbo].[mysqlapp_synchstatus]
35GO
36
37if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[product_stocks_local]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
38drop table [dbo].[product_stocks_local]
39GO
40
41if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[synch_global]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
42drop table [dbo].[synch_global]
43GO
44
45if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tkategorii]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
46drop table [dbo].[tkategorii]
47GO
48
49if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tmpOrders]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
50drop table [dbo].[tmpOrders]
51GO
52
53CREATE TABLE [dbo].[TLager] (
54 [proizvodid] [bigint] NOT NULL ,
55 [momLagerANHOCH] [int] NOT NULL ,
56 [slobodniANHOCH] [int] NOT NULL ,
57 [naracaniANHOCH] [int] NOT NULL ,
58 [momLagerAMACO] [int] NOT NULL ,
59 [slobodniAMACO] [int] NOT NULL ,
60 [naracaniAMACO] [int] NOT NULL ,
61 [momLagerASSA] [int] NOT NULL ,
62 [slobodniASSA] [int] NOT NULL ,
63 [naracaniASSA] [int] NOT NULL ,
64 [momLagerPCM] [int] NOT NULL ,
65 [slobodniPCM] [int] NOT NULL ,
66 [naracaniPCM] [int] NOT NULL ,
67 [momLagerPCM2] [int] NOT NULL ,
68 [slobodniPCM2] [int] NOT NULL ,
69 [naracaniPCM2] [int] NOT NULL ,
70 [momLagerPCM3] [int] NOT NULL ,
71 [slobodniPCM3] [int] NOT NULL ,
72 [naracaniPCM3] [int] NOT NULL ,
73 [momLagerPCM4] [int] NOT NULL ,
74 [slobodniPCM4] [int] NOT NULL ,
75 [naracaniPCM4] [int] NOT NULL ,
76 [momLagerPCM5] [int] NOT NULL ,
77 [slobodniPCM5] [int] NOT NULL ,
78 [naracaniPCM5] [int] NOT NULL ,
79 [momLagerPCM6] [int] NOT NULL ,
80 [slobodniPCM6] [int] NOT NULL ,
81 [naracaniPCM6] [int] NOT NULL ,
82 [momLagerPCM7] [int] NOT NULL ,
83 [slobodniPCM7] [int] NOT NULL ,
84 [naracaniPCM7] [int] NOT NULL ,
85 [momLagerPCM8] [int] NOT NULL ,
86 [slobodniPCM8] [int] NOT NULL ,
87 [naracaniPCM8] [int] NOT NULL
88) ON [PRIMARY]
89GO
90
91CREATE TABLE [dbo].[TProizvodi] (
92 [Auto] [bit] NULL ,
93 [BarCode] [nvarchar] (50) COLLATE Macedonian_CI_AS NULL ,
94 [CenaDenari] [int] NULL ,
95 [CenaDil] [numeric](18, 2) NULL ,
96 [CenaDist] [numeric](18, 2) NULL ,
97 [CenaFirmi] [numeric](18, 2) NULL ,
98 [CenaMalo] [numeric](18, 2) NULL ,
99 [CenaNab] [numeric](18, 2) NULL ,
100 [Cenovnik] [bit] NULL ,
101 [DefGarancija] [tinyint] NULL ,
102 [DenariZaklucen] [bit] NULL ,
103 [KategorijaID] [int] NULL ,
104 [Konf] [bit] NULL ,
105 [Opis] [nvarchar] (4000) COLLATE Macedonian_CI_AS NULL ,
106 [Parent] [bit] NULL ,
107 [Popust] [int] NULL ,
108 [ProizvodID] [int] NOT NULL ,
109 [ProizvodIme] [nvarchar] (100) COLLATE Macedonian_CI_AS NULL ,
110 [Seriski] [bit] NULL ,
111 [Sifra] [nvarchar] (30) COLLATE Macedonian_CI_AS NULL ,
112 [Sminka] [nvarchar] (50) COLLATE Macedonian_CI_AS NULL ,
113 [Tarifa] [nvarchar] (10) COLLATE Macedonian_CI_AS NULL ,
114 [VrabotenID] [int] NULL ,
115 [Zastaren] [bit] NULL ,
116 [Aktiven] [bit] NULL ,
117 [DateCreated] [datetime] NOT NULL ,
118 [DateModified] [datetime] NOT NULL ,
119 [DanokID] [int] NULL ,
120 [KSifra] [int] NULL ,
121 [ProizvoditelID] [int] NULL ,
122 [Special] [bit] NULL
123) ON [PRIMARY]
124GO
125
126CREATE TABLE [dbo].[TProizvodiDopolnitelniPodatoci] (
127 [ProizvodID] [bigint] NOT NULL ,
128 [BrutoTezina] [float] NULL ,
129 [NetoTezina] [float] NULL ,
130 [Zapremnina] [float] NULL ,
131 [Hartija] [float] NULL ,
132 [Plastika] [float] NULL ,
133 [Kompozit] [float] NULL
134) ON [PRIMARY]
135GO
136
137CREATE TABLE [dbo].[TProizvodiKolicini] (
138 [Proizvodid] [int] NOT NULL ,
139 [ANHOCH] [int] NOT NULL ,
140 [PCM] [int] NOT NULL ,
141 [REVERS] [bit] NOT NULL ,
142 [DateCreated] [datetime] NULL ,
143 [DateModified] [datetime] NULL
144) ON [PRIMARY]
145GO
146
147CREATE TABLE [dbo].[TProizvodiSliki] (
148 [ProizvodID] [int] NOT NULL ,
149 [Slika] [nvarchar] (50) COLLATE Macedonian_CI_AS NULL ,
150 [Slika2] [nvarchar] (50) COLLATE Macedonian_CI_AS NULL
151) ON [PRIMARY]
152GO
153
154CREATE TABLE [dbo].[Tproizvoditeli] (
155 [ProizvoditelID] [bigint] NOT NULL ,
156 [Ime] [nvarchar] (50) COLLATE Macedonian_CI_AS NOT NULL
157) ON [PRIMARY]
158GO
159
160CREATE TABLE [dbo].[locations] (
161 [id] [bigint] NOT NULL ,
162 [name] [varchar] (30) COLLATE Macedonian_CI_AS NOT NULL ,
163 [ime_za_kolicina] [varchar] (10) COLLATE Macedonian_CI_AS NOT NULL
164) ON [PRIMARY]
165GO
166
167CREATE TABLE [dbo].[mysqlapp_products_stock] (
168 [product_id] [bigint] NOT NULL ,
169 [stock_anhoch] [int] NOT NULL ,
170 [stock_amaconet] [int] NOT NULL ,
171 [stock_pcm] [int] NOT NULL ,
172 [stock_pcm2] [int] NOT NULL ,
173 [stock_pcm3] [int] NOT NULL ,
174 [stock_pcm4] [int] NOT NULL ,
175 [stock_pcm5] [int] NOT NULL ,
176 [stock_pcm6] [int] NOT NULL ,
177 [stock_pcm7] [int] NOT NULL ,
178 [stock_pcm8] [int] NOT NULL ,
179 [stock] [int] NOT NULL
180) ON [PRIMARY]
181GO
182
183CREATE TABLE [dbo].[mysqlapp_synchstatus] (
184 [ID] [bigint] IDENTITY (1, 1) NOT NULL ,
185 [synch_action] [varchar] (15) COLLATE Macedonian_CI_AS NULL ,
186 [synch_status] [varchar] (2) COLLATE Macedonian_CI_AS NULL ,
187 [synch_time] [datetime] NULL
188) ON [PRIMARY]
189GO
190
191CREATE TABLE [dbo].[product_stocks_local] (
192 [ID] [bigint] IDENTITY (1, 1) NOT NULL ,
193 [product_id] [bigint] NOT NULL ,
194 [location_id] [bigint] NOT NULL ,
195 [stock] [bigint] NOT NULL
196) ON [PRIMARY]
197GO
198
199CREATE TABLE [dbo].[synch_global] (
200 [synch_global_ID] [int] IDENTITY (1, 1) NOT NULL ,
201 [synch_type] [nchar] (15) COLLATE Macedonian_CI_AS NOT NULL ,
202 [date] [datetime] NOT NULL ,
203 [synched] [bit] NOT NULL ,
204 [synch_error] [bit] NOT NULL ,
205 [md5] [nchar] (30) COLLATE Macedonian_CI_AS NULL
206) ON [PRIMARY]
207GO
208
209CREATE TABLE [dbo].[tkategorii] (
210 [CategoryName] [nvarchar] (50) COLLATE Macedonian_CI_AS NULL ,
211 [Indeks] [int] NULL ,
212 [KategorijaID] [int] NOT NULL ,
213 [KategorijaIme] [nvarchar] (50) COLLATE Macedonian_CI_AS NULL ,
214 [Nivo] [int] NULL ,
215 [ParentID] [int] NULL ,
216 [Report] [int] NULL ,
217 [NoSynch] [int] NULL ,
218 [MasterCen] [int] NULL ,
219 [SlaveCen] [int] NULL
220) ON [PRIMARY]
221GO
222
223CREATE TABLE [dbo].[tmpOrders] (
224 [order_id] [bigint] NULL ,
225 [date_payed] [datetime] NULL ,
226 [approved] [tinyint] NULL ,
227 [customer_id] [bigint] NULL
228) ON [PRIMARY]
229GO