Структура базы данных

Материал из Такси Диспетчер
Перейти к: навигация, поиск

Содержание

Описание

Такси Диспетчер использует для хранение базу данных MySql 4.0.18

Ее структура обновляется вместе с версиями "Такси Диспечтера". Ниже приведено описание ее БД для интеграции со сторонними ПО и дополнительными устройствами.

Сейчас описание располагается по адресу: http://www.taxi-office.ru/help/db_index.htm


SQL структура БД

Структура таблицы 'aonfiles'

CREATE TABLE aonfiles (

 num int(32) unsigned NOT NULL auto_increment,
 userid int(32) unsigned default NULL,
 orderid int(32) unsigned default NULL,
 phone varchar(32) default NULL,
 channel int(32) unsigned default NULL,
 filename varchar(255) default NULL,
 starttime datetime default NULL,
 incomming tinyint(1) unsigned default '1',
 incphone varchar(32) default NULL,
 status int(10) unsigned default '0',
 finishtime datetime default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'archivelog'

CREATE TABLE archivelog (

 num int(10) unsigned NOT NULL auto_increment,
 refusers_num int(10) NOT NULL default '0',
 dateevent datetime default NULL,
 ip varchar(15) NOT NULL default ,
 sdate datetime default NULL,
 edate datetime default NULL,
 fulldate int(11) default '0',
 bookmark_num int(10) NOT NULL default '0',
 PRIMARY KEY  (num),
 KEY index1 (refusers_num)

) TYPE=MyISAM;



Структура таблицы 'autodriver'

CREATE TABLE autodriver (

 num int(20) unsigned NOT NULL auto_increment,
 name varchar(50) default NULL,
 enabled tinyint(1) unsigned default '0',
 rules text,
 enableauto tinyint(1) unsigned default '0',
 autoparams varchar(50) default NULL,
 enablemanual tinyint(1) unsigned default '0',
 manualparams varchar(50) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'cardpaylog'

CREATE TABLE cardpaylog (

 num int(20) unsigned NOT NULL auto_increment,
 paydate datetime default NULL,
 cardid int(20) unsigned default NULL,
 cash tinyint(1) unsigned default NULL,
 payvalue decimal(20,2) default NULL,
 newbalance decimal(20,2) default NULL,
 fromaccount varchar(100) default NULL,
 frombank varchar(100) default NULL,
 frominfo varchar(100) default NULL,
 orderid int(32) default NULL,
 userid int(32) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'command_messages'

CREATE TABLE command_messages (

 num int(32) unsigned NOT NULL auto_increment,
 user_id int(32) unsigned default NULL,
 session_id int(32) unsigned default NULL,
 order_id int(32) unsigned default NULL,
 driver_id int(32) unsigned default NULL,
 drivershift_id int(32) unsigned default NULL,
 status int(8) unsigned default '0',
 created datetime default NULL,
 delivered datetime default NULL,
 pager varchar(128) default ,
 mesid varchar(16) NOT NULL default ,
 body text NOT NULL,
 answer text,
 sendid varchar(128) default ,
 priority tinyint(8) unsigned default NULL,
 lockid int(32) unsigned default NULL,
 confirmed tinyint(8) unsigned default NULL,
 confirmedtime datetime default NULL,
 errortext text,
 way tinyint(8) unsigned default NULL,
 displaystate int(32) unsigned default NULL,
 displayway int(32) unsigned default NULL,
 deleteondel tinyint(8) unsigned default NULL,
 deviceid varchar(64) default NULL,
 delprotect int(10) default '0',
 user_run int(32) unsigned default '0',
 PRIMARY KEY  (num),
 KEY command_messages_index (user_id,driver_id,drivershift_id,status,way),
 KEY command_messages_way_index (way),
 KEY StatusIndex (status)

) TYPE=MyISAM;



Структура таблицы 'command_messagescompletes'

CREATE TABLE command_messagescompletes (

 id int(32) unsigned NOT NULL auto_increment,
 num int(32) unsigned default NULL,
 user_id int(32) unsigned default NULL,
 session_id int(32) unsigned default NULL,
 order_id int(32) unsigned default NULL,
 driver_id int(32) unsigned default NULL,
 drivershift_id int(32) unsigned default NULL,
 status int(8) unsigned default '0',
 created datetime default NULL,
 delivered datetime default NULL,
 pager varchar(32) NOT NULL default ,
 mesid varchar(16) NOT NULL default ,
 body text NOT NULL,
 answer text NOT NULL,
 sendid varchar(128) default ,
 priority tinyint(8) unsigned default NULL,
 lockid int(32) unsigned default NULL,
 confirmed tinyint(8) unsigned default NULL,
 confirmedtime datetime default NULL,
 errortext text,
 way tinyint(8) unsigned default NULL,
 displaystate int(32) unsigned default NULL,
 displayway int(32) unsigned default NULL,
 deleteondel tinyint(8) unsigned default NULL,
 deviceid varchar(64) default NULL,
 delprotect int(10) default '0',
 user_run int(32) unsigned default '0',
 PRIMARY KEY  (id),
 KEY way (way),
 KEY created (created)

) TYPE=MyISAM;



Структура таблицы 'complaint'

CREATE TABLE complaint (

 num int(10) unsigned NOT NULL auto_increment,
 acceptuser int(10) unsigned default '0',
 driverid int(10) unsigned default '0',
 orderid int(10) unsigned default '0',
 datecomplaint datetime default NULL,
 textcomplaint varchar(255) default NULL,
 bossanswerdate datetime default NULL,
 bossanswer varchar(255) default NULL,
 bossexamine tinyint(3) unsigned default '0',
 UNIQUE KEY num (num),
 KEY num_2 (num)

) TYPE=MyISAM;



Структура таблицы 'dcards'

CREATE TABLE dcards (

 num int(20) unsigned NOT NULL auto_increment,
 lock int(10) unsigned default NULL,
 discountid int(10) unsigned default NULL,
 active tinyint(1) unsigned default '1',
 activationdate datetime default NULL,
 balance decimal(20,2) default '0.00',
 usecount int(10) unsigned default '0',
 discountvalue decimal(20,2) default '0.00',
 totalordersum decimal(20,2) default '0.00',
 registeredto varchar(50) default NULL,
 pwd varchar(32) default NULL,
 info varchar(250) default NULL,
 contactfio varchar(50) default NULL,
 contactphone varchar(32) default NULL,
 contactaddress varchar(128) default NULL,
 activereason varchar(64) default NULL,
 smssendtobool tinyint(1) unsigned NOT NULL default '0',
 smssendtoclient varchar(25) default NULL,
 emailsendtobool tinyint(1) unsigned NOT NULL default '0',
 emailsendtoclient varchar(100) default NULL,
 messageoperdisp varchar(250) default NULL,
 discountvalueall decimal(20,2) default '0.00',
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 KEY pwd (pwd),
 KEY contactphone (contactphone)

) TYPE=MyISAM;



Структура таблицы 'dcardsadres'

CREATE TABLE dcardsadres (

 num int(10) unsigned NOT NULL auto_increment,
 dcards int(10) NOT NULL default '0',
 street varchar(100) default NULL,
 house varchar(20) default NULL,
 porch varchar(20) default NULL,
 apart varchar(20) default NULL,
 meet varchar(200) default NULL,
 addressfrom varchar(100) default NULL,
 PRIMARY KEY  (num),
 KEY index1 (dcards),
 KEY index2 (street)

) TYPE=MyISAM;



Структура таблицы 'discount_det'

CREATE TABLE discount_det (

 discountid int(10) unsigned default '0',
 ruleid int(10) unsigned default NULL,
 ruleorder int(10) unsigned default NULL,
 relvalue decimal(20,2) default NULL,
 absvalue decimal(20,2) default NULL,
 useparams varchar(100) default NULL

) TYPE=MyISAM;



Структура таблицы 'discounts'

CREATE TABLE discounts (

 num int(10) unsigned NOT NULL auto_increment,
 dname varchar(50) default NULL,
 common tinyint(3) unsigned default NULL,
 active tinyint(3) unsigned default '1',
 minbalance decimal(20,2) default NULL,
 maxusecount int(10) unsigned default NULL,
 creditcard tinyint(3) unsigned default '0',
 validfrom datetime default NULL,
 validupto datetime default NULL,
 validdays int(10) unsigned default NULL,
 ordertypes varchar(64) default NULL,
 confirm varchar(64) default NULL,
 nodiscount tinyint(3) unsigned default '0',
 findphone tinyint(1) unsigned NOT NULL default '0',
 noclientdata tinyint(1) unsigned NOT NULL default '0',
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;

Структура таблицы 'driverpenaltylog'

CREATE TABLE driverpenaltylog (

 num int(10) unsigned NOT NULL auto_increment,
 driver int(20) unsigned NOT NULL default '0',
 drivershift int(20) unsigned NOT NULL default '0',
 orderid int(20) unsigned NOT NULL default '0',
 userid int(20) unsigned NOT NULL default '0',
 penaltytime datetime default NULL,
 value decimal(18,2) default '0.00',
 paied tinyint(1) default '0',
 penaltyname varchar(100) default NULL,
 comment varchar(255) default NULL,
 setpenaltytime datetime default NULL,
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'driverpinglog'

CREATE TABLE driverpinglog (

 num int(16) unsigned NOT NULL auto_increment,
 driver int(16) unsigned default '0',
 drivershift int(16) unsigned default '0',
 dt datetime default NULL,
 channel int(32) default '0',
 note varchar(8) default NULL,
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'drivershift'

CREATE TABLE drivershift (

 num int(20) unsigned NOT NULL auto_increment,
 complete tinyint(1) unsigned NOT NULL default '0',
 driver int(10) unsigned default NULL,
 sign varchar(10) default NULL,
 channel int(10) default NULL,
 pager varchar(128) default ,
 car varchar(50) default NULL,
 carid int(10) unsigned default NULL,
 starttime datetime default NULL,
 endtime datetime default NULL,
 duration float default NULL,
 waittime float default '0',
 drivetime float default '0',
 notworktime float default '0',
 distance decimal(20,2) default '0.00',
 distcity decimal(20,2) default '0.00',
 distsuburb decimal(20,2) default '0.00',
 drvstate tinyint(3) unsigned NOT NULL default '0',
 statedescr varchar(50) default NULL,
 statetime datetime default NULL,
 stopid int(10) unsigned default '0',
 stoporder int(10) default NULL,
 stopvirtual tinyint(1) unsigned default '0',
 location varchar(100) default NULL,
 locstreet varchar(100) default NULL,
 lochouse varchar(20) default NULL,
 loctime datetime default NULL,
 gpslat decimal(18,6) default '0.000000',
 gpslon decimal(18,6) default '0.000000',
 gpsinputs int(11) default '0',
 orderscount int(10) unsigned default '0',
 addressorders int(10) unsigned default '0',
 noaddressorders int(10) unsigned default '0',
 cashorders int(10) unsigned default '0',
 cashlessorders int(10) unsigned default '0',
 totalsum decimal(20,2) default '0.00',
 totalsumaddress decimal(20,2) default '0.00',
 totalsumnoaddress decimal(20,2) default '0.00',
 totalsumcash decimal(20,2) default '0.00',
 totalsumcashless decimal(20,2) default '0.00',
 totalsum_paid decimal(20,2) default '0.00',
 totalsumaddress_paid decimal(20,2) default '0.00',
 totalsumnoaddress_paid decimal(20,2) default '0.00',
 totalsumcash_paid decimal(20,2) default '0.00',
 totalsumcashless_paid decimal(20,2) default '0.00',
 totaldiscount decimal(20,2) default '0.00',
 totalcarddiscount decimal(20,2) default '0.00',
 bonuses int(10) unsigned default '0',
 odostart decimal(10,0) default '0',
 odoend decimal(10,0) default '0',
 fuelprice decimal(20,2) default '0.00',
 fuelstart decimal(10,0) default '0',
 fuelend decimal(10,0) default '0',
 fueltotal decimal(10,0) default '0',
 fuelstartodo decimal(10,0) default '0',
 avgfuelconsump decimal(20,2) default '0.00',
 disp int(10) unsigned default NULL,
 drvbalance decimal(20,2) default '0.00',
 lastordertime datetime default NULL,
 drvcharged tinyint(3) unsigned default '0',
 lastpingtime datetime default NULL,
 gpsdatetime datetime default NULL,
 virtualsmenastart datetime default NULL,
 starttimesmena datetime default NULL,
 endtimesmena datetime default NULL,
 javadelayshift int(11) default '0',
 shifttype int(11) default '0',
 PRIMARY KEY  (num),
 KEY drivershift_complete_index (complete,drvbalance),
 KEY drivershift_stoporder_index (complete,stoporder),
 KEY stopid (stopid),
 KEY old_dr_com (driver,complete),
 KEY old_com_stop_order (stopid,stoporder,complete),
 KEY drivershift_drivers_sort_index (driver,complete),
 KEY drivershift_stops_sort_index (complete,stopid,stoporder),
 KEY drivershift_drvstate (drvstate),
 KEY drivershift_endtime (endtime),
 KEY drivershift_starttime (starttime)

) TYPE=MyISAM;



Структура таблицы 'driverstatelog'

CREATE TABLE driverstatelog (

 num int(32) unsigned NOT NULL auto_increment,
 user int(32) unsigned NOT NULL default '0',
 driver int(32) unsigned default NULL,
 drivershift int(32) unsigned default NULL,
 state tinyint(8) unsigned default NULL,
 settime datetime default NULL,
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'driverunworklog'

CREATE TABLE driverunworklog (

 num int(32) unsigned NOT NULL auto_increment,
 driver int(32) unsigned NOT NULL default '0',
 userid int(20) unsigned NOT NULL default '0',
 chtype tinyint(8) unsigned NOT NULL default '0',
 chtime datetime default NULL,
 reason varchar(100) default NULL,
 driverid int(11) default '0',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'emppaylog'

CREATE TABLE emppaylog (

 num int(20) unsigned NOT NULL auto_increment,
 paydate datetime default NULL,
 accounttype int(10) unsigned default NULL,
 accountid int(20) unsigned default NULL,
 payvalue decimal(20,2) default NULL,
 newbalance decimal(20,2) default NULL,
 info varchar(200) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;


Структура таблицы 'geodrivershift'

CREATE TABLE geodrivershift (

 num int(11) NOT NULL auto_increment,
 driverid int(11) NOT NULL default '0',
 drivershiftid int(11) NOT NULL default '0',
 gpslat decimal(18,12) NOT NULL default '0.000000000000',
 gpslon decimal(18,12) NOT NULL default '0.000000000000',
 timeevent datetime default '0000-00-00 00:00:00',
 PRIMARY KEY  (num),
 KEY driver_gps (driverid),
 KEY drivershift_gps (drivershiftid)

) TYPE=MyISAM;

Структура таблицы 'log24nonstop'

CREATE TABLE log24nonstop (

 num int(32) unsigned NOT NULL auto_increment,
 act tinyint(1) unsigned NOT NULL default '4',
 time_stamp datetime NOT NULL default '0000-00-00 00:00:00',
 pay_id varchar(36) NOT NULL default ,
 receipt_num int(32) unsigned NOT NULL default '0',
 trade_point varchar(20) default NULL,
 pay_account varchar(20) NOT NULL default ,
 searchparam varchar(36) NOT NULL default ,
 pay_ammount decimal(20,2) NOT NULL default '0.00',
 sign varchar(255) default NULL,
 act_status tinyint(1) unsigned NOT NULL default '0',
 service_id varchar(20) default ,
 PRIMARY KEY  (num),
 UNIQUE KEY U_LOG24NONSTOP_PAY_ID (pay_id)

) TYPE=MyISAM;



Структура таблицы 'logassigneddriver'

CREATE TABLE logassigneddriver (

 num int(20) unsigned NOT NULL auto_increment,
 logtime datetime NOT NULL default '0000-00-00 00:00:00',
 driver int(10) unsigned NOT NULL default '0',
 drivershift int(10) unsigned default NULL,
 orders int(20) unsigned NOT NULL default '0',
 assigned tinyint(1) unsigned NOT NULL default '1',
 driverstate tinyint(3) unsigned NOT NULL default '0',
 stopid int(20) unsigned default '0',
 stoporder int(10) default NULL,
 userid int(11) NOT NULL default '0',
 operation int(11) NOT NULL default '0',
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 KEY logtime_index (logtime),
 KEY driver_index (driver)

) TYPE=MyISAM;



Структура таблицы 'marketingsourceslog'

CREATE TABLE marketingsourceslog (

 num int(20) unsigned NOT NULL auto_increment,
 answer_id int(20) unsigned NOT NULL default '0',
 comment varchar(255) default NULL,
 date datetime NOT NULL default '0000-00-00 00:00:00',
 user_id int(20) unsigned NOT NULL default '0',
 order_num int(20) unsigned NOT NULL default '0',
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'messages'

CREATE TABLE messages (

 num int(32) unsigned NOT NULL auto_increment,
 fromuser int(32) unsigned NOT NULL default '0',
 touser int(32) unsigned default NULL,
 togroup int(3) default NULL,
 message text NOT NULL,
 isread tinyint(1) unsigned NOT NULL default '0',
 senddate datetime NOT NULL default '0000-00-00 00:00:00',
 readdate datetime NOT NULL default '0000-00-00 00:00:00',
 readby int(32) unsigned default NULL,
 driver int(32) unsigned default NULL,
 drivershift int(32) unsigned default NULL,
 order int(32) unsigned default NULL,
 answerto int(32) unsigned default NULL,
 PRIMARY KEY  (num),
 KEY searchfornewmessages (touser,isread),
 KEY searchfornmymessages (fromuser)

) TYPE=MyISAM;



Структура таблицы 'options'

CREATE TABLE options (

 userid varchar(10) NOT NULL default '0',
 optdata text,
 PRIMARY KEY  (userid)

) TYPE=MyISAM;



Структура таблицы 'orders'

CREATE TABLE orders (

 num int(20) unsigned NOT NULL auto_increment,
 lock int(10) unsigned NOT NULL default '0',
 oper int(10) unsigned default NULL,
 disp int(10) unsigned default NULL,
 ordertype varchar(50) default NULL,
 orderstate tinyint(3) unsigned default '0',
 preorder tinyint(1) default '0',
 roadside tinyint(1) unsigned default '0',
 phone varchar(30) default NULL,
 town varchar(50) default NULL,
 street varchar(100) default NULL,
 house varchar(20) default NULL,
 porch varchar(20) default NULL,
 apart varchar(20) default NULL,
 zonefrom int(10) unsigned default '0',
 meet varchar(200) default NULL,
 addressfrom varchar(100) default NULL,
 addressto varchar(100) default NULL,
 townto varchar(50) default NULL,
 streetto varchar(100) default NULL,
 houseto varchar(20) default NULL,
 zoneto int(10) unsigned default '0',
 route text,
 suburb tinyint(3) unsigned default '0',
 distance decimal(20,2) default '0.00',
 distcity decimal(20,2) default '0.00',
 distsuburb decimal(20,2) default '0.00',
 client int(10) unsigned default NULL,
 clientname varchar(100) default NULL,
 prefcar int(10) unsigned default '0',
 driver int(10) unsigned default '0',
 drivershift int(10) unsigned default '0',
 channel int(10) default NULL,
 ordertime datetime default NULL,
 pretime datetime default NULL,
 driverstart datetime default NULL,
 driverwait datetime default NULL,
 clientringup datetime default NULL,
 driverload datetime default NULL,
 completetime datetime default NULL,
 endtask int(10) unsigned default '0',
 cash tinyint(1) default '1',
 dcard int(10) default NULL,
 driveupprice decimal(20,2) default '0.00',
 waitprice decimal(20,2) default '0.00',
 puredriveprice decimal(20,2) default '0.00',
 ordersum decimal(20,2) default NULL,
 paysum decimal(20,2) default NULL,
 discount decimal(20,2) default NULL,
 carddiscount decimal(20,2) default NULL,
 drvcharged tinyint(3) unsigned default '0',
 opercharged tinyint(3) unsigned default '0',
 dispcharged tinyint(3) unsigned default '0',
 info text,
 legend_drv text,
 legend_order text,
 usecldiscount tinyint(1) default NULL,
 cldbalance decimal(20,2) default '0.00',
 drvbonus tinyint(1) default '0',
 msgid int(10) unsigned default NULL,
 waittime float default '0',
 waitingstart datetime default NULL,
 oldnum int(20) unsigned default NULL,
 ordercompany varchar(60) default NULL,
 passenger varchar(60) default NULL,
 ordervendor varchar(20) default NULL,
 stopid int(20) unsigned default '0',
 podachatime datetime default NULL,
 usemanualdist tinyint(1) unsigned default '0',
 worktime int(32) default NULL,
 closeuserid int(16) default '0',
 linecolumn int(10) default '0',
 ordervendorexecute varchar(20) default NULL,
 driverfororder varchar(64) default NULL,
 oper2 int(32) default NULL,
 mess varchar(255) default NULL,
 messtime datetime default NULL,
 ordercounts decimal(18,2) default NULL,
 addballs decimal(18,2) default NULL,
 timeorderproc int(32) default NULL,
 clientphone varchar(24) default NULL,
 msgidtime datetime default NULL,
 notusecommondiscount tinyint(1) unsigned default '0',
 driversetorders datetime default NULL,
 orderwasdrivers varchar(100) default NULL,
 msgid1 int(11) default NULL,
 msgidtime1 datetime default NULL,
 javamess varchar(255) default NULL,
 proctime tinyint(10) unsigned default '0',
 msgid2 int(11) default NULL,
 msgidtime2 datetime default NULL,
 carddiscountdelta decimal(20,2) default '0.00',
 remotenote varchar(255) default NULL,
 recall int(11) default '0',
 remotenotetime datetime default NULL,
 remotevendorphone varchar(25) default ,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 KEY orders_preorderstate_index (preorder,orderstate),
 KEY orders_ordertime_index (ordertime),
 KEY orders_completetime_index (completetime),
 KEY orders_endtask_index (endtask),
 KEY orders_cash_index (cash),
 KEY orders_dcard_index (dcard),
 KEY orders_street_index (street),
 KEY orders_streetto_index (street),
 KEY orders_zonefrom_index (zonefrom),
 KEY orders_zoneto_index (zoneto),
 KEY orders_driver_index (driver),
 KEY orders_drivershift_index (drivershift),
 KEY orders_oper_index (oper),
 KEY orders_disp_index (disp),
 KEY orders_client_index (client),
 KEY orders_ordertype_index (ordertype),
 KEY orders_prefcar_index (prefcar),
 KEY orders_phone_index (phone),
 KEY msgid (msgid),
 KEY pretime (pretime)

) TYPE=MyISAM;

Структура таблицы 'orderscomplete'

CREATE TABLE orderscomplete (

 num int(20) unsigned NOT NULL auto_increment,
 lock int(10) unsigned NOT NULL default '0',
 oper int(10) unsigned default NULL,
 disp int(10) unsigned default NULL,
 ordertype varchar(50) default NULL,
 orderstate tinyint(3) unsigned default NULL,
 preorder tinyint(1) default '0',
 roadside tinyint(1) unsigned default '0',
 phone varchar(30) default NULL,
 town varchar(50) default NULL,
 street varchar(100) default NULL,
 house varchar(20) default NULL,
 porch varchar(20) default NULL,
 apart varchar(20) default NULL,
 zonefrom int(10) unsigned default '0',
 meet varchar(200) default NULL,
 addressfrom varchar(100) default NULL,
 addressto varchar(100) default NULL,
 townto varchar(50) default NULL,
 streetto varchar(100) default NULL,
 houseto varchar(20) default NULL,
 zoneto int(10) unsigned default '0',
 route text,
 suburb tinyint(3) unsigned default '0',
 distance decimal(20,2) default '0.00',
 distcity decimal(20,2) default '0.00',
 distsuburb decimal(20,2) default '0.00',
 client int(10) unsigned default NULL,
 clientname varchar(100) default NULL,
 prefcar int(10) unsigned default NULL,
 driver int(10) unsigned default NULL,
 drivershift int(10) unsigned default NULL,
 channel int(10) default NULL,
 ordertime datetime default NULL,
 pretime datetime default NULL,
 driverstart datetime default NULL,
 driverwait datetime default NULL,
 clientringup datetime default NULL,
 driverload datetime default NULL,
 completetime datetime default NULL,
 endtask int(10) unsigned default NULL,
 cash tinyint(1) default '1',
 dcard int(10) default NULL,
 driveupprice decimal(20,2) default '0.00',
 waitprice decimal(20,2) default '0.00',
 puredriveprice decimal(20,2) default '0.00',
 ordersum decimal(20,2) default NULL,
 paysum decimal(20,2) default NULL,
 discount decimal(20,2) default NULL,
 carddiscount decimal(20,2) default NULL,
 drvcharged tinyint(3) unsigned default '0',
 opercharged tinyint(3) unsigned default '0',
 dispcharged tinyint(3) unsigned default '0',
 info text,
 legend_drv text,
 legend_order text,
 usecldiscount tinyint(1) default NULL,
 cldbalance decimal(20,2) default '0.00',
 drvbonus tinyint(1) default '0',
 msgid int(10) unsigned default NULL,
 oldnum int(20) unsigned default NULL,
 ordercompany varchar(60) default NULL,
 passenger varchar(60) default NULL,
 ordervendor varchar(20) default NULL,
 waittime float default '0',
 waitingstart datetime default NULL,
 stopid int(20) unsigned default '0',
 podachatime datetime default '0000-00-00 00:00:00',
 usemanualdist tinyint(1) unsigned default '0',
 worktime int(32) default NULL,
 closeuserid int(16) default '0',
 linecolumn int(10) default '0',
 ordervendorexecute varchar(20) default NULL,
 driverfororder varchar(64) default NULL,
 oper2 int(32) default NULL,
 mess varchar(255) default NULL,
 messtime datetime default NULL,
 ordercounts decimal(18,2) default NULL,
 addballs decimal(18,2) default NULL,
 timeorderproc int(32) default NULL,
 clientphone varchar(24) default NULL,
 msgidtime datetime default NULL,
 notusecommondiscount tinyint(1) unsigned default '0',
 driversetorders datetime default NULL,
 orderwasdrivers varchar(100) default NULL,
 msgidtime1 datetime default NULL,
 msgid1 int(11) default NULL,
 javamess varchar(255) default NULL,
 proctime tinyint(10) unsigned default '0',
 msgid2 int(11) default NULL,
 msgidtime2 datetime default NULL,
 carddiscountdelta decimal(20,2) default '0.00',
 remotenote varchar(255) default NULL,
 recall int(11) default '0',
 remotenotetime datetime default NULL,
 remotevendorphone varchar(25) default ,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 KEY orderscomplete_preorderstate_index (preorder,orderstate),
 KEY orderscomplete_ordertime_index (ordertime),
 KEY orderscomplete_completetime_index (completetime),
 KEY orderscomplete_endtask_index (endtask),
 KEY orderscomplete_cash_index (cash),
 KEY orderscomplete_dcard_index (dcard),
 KEY orderscomplete_street_index (street),
 KEY orderscomplete_streetto_index (street),
 KEY orderscomplete_zonefrom_index (zonefrom),
 KEY orderscomplete_zoneto_index (zoneto),
 KEY orderscomplete_driver_index (driver),
 KEY orderscomplete_drivershift_index (drivershift),
 KEY orderscomplete_oper_index (oper),
 KEY orderscomplete_disp_index (disp),
 KEY orderscomplete_client_index (client),
 KEY orderscomplete_ordertype_index (ordertype),
 KEY orderscomplete_prefcar_index (prefcar),
 KEY orderscomplete_phone_index (phone),
 KEY oldnum (oldnum)

) TYPE=MyISAM;



Структура таблицы 'orderscomplete1'

CREATE TABLE orderscomplete1 (

 num int(20) NOT NULL auto_increment,
 lock int(10) NOT NULL default '0',
 oper int(10) default NULL,
 disp int(10) default NULL,
 ordertype varchar(50) default NULL,
 orderstate tinyint(3) default NULL,
 preorder tinyint(1) default '0',
 roadside tinyint(1) default '0',
 phone varchar(30) default NULL,
 town varchar(50) default NULL,
 street varchar(100) default NULL,
 house varchar(20) default NULL,
 porch varchar(20) default NULL,
 apart varchar(20) default NULL,
 zonefrom int(10) default '0',
 meet varchar(200) default NULL,
 addressfrom varchar(100) default NULL,
 addressto varchar(100) default NULL,
 townto varchar(50) default NULL,
 streetto varchar(100) default NULL,
 houseto varchar(20) default NULL,
 zoneto int(10) default '0',
 route text,
 suburb tinyint(3) default '0',
 distance decimal(20,2) default '0.00',
 distcity decimal(20,2) default '0.00',
 distsuburb decimal(20,2) default '0.00',
 client int(10) default NULL,
 clientname varchar(100) default NULL,
 prefcar int(10) default NULL,
 driver int(10) default NULL,
 drivershift int(10) default NULL,
 channel int(10) default NULL,
 ordertime datetime default NULL,
 pretime datetime default NULL,
 driverstart datetime default NULL,
 driverwait datetime default NULL,
 clientringup datetime default NULL,
 driverload datetime default NULL,
 completetime datetime default NULL,
 endtask int(10) default NULL,
 cash tinyint(1) default '1',
 dcard int(10) default NULL,
 driveupprice decimal(20,2) default '0.00',
 waitprice decimal(20,2) default '0.00',
 puredriveprice decimal(20,2) default '0.00',
 ordersum decimal(20,2) default NULL,
 paysum decimal(20,2) default NULL,
 discount decimal(20,2) default NULL,
 carddiscount decimal(20,2) default NULL,
 drvcharged tinyint(3) default '0',
 opercharged tinyint(3) default '0',
 dispcharged tinyint(3) default '0',
 info text,
 legend_drv text,
 legend_order text,
 usecldiscount tinyint(1) default NULL,
 cldbalance decimal(20,2) default '0.00',
 drvbonus tinyint(1) default '0',
 msgid int(10) default NULL,
 waittime float default '0',
 waitingstart datetime default NULL,
 oldnum int(20) default NULL,
 ordercompany varchar(60) default NULL,
 passenger varchar(60) default NULL,
 ordervendor varchar(20) default NULL,
 stopid int(20) default '0',
 podachatime datetime default NULL,
 usemanualdist tinyint(1) default '0',
 worktime int(32) default NULL,
 closeuserid int(16) default '0',
 linecolumn int(10) default '0',
 ordervendorexecute varchar(20) default NULL,
 driverfororder varchar(64) default NULL,
 oper2 int(32) default NULL,
 mess varchar(255) default NULL,
 messtime datetime default NULL,
 ordercounts decimal(18,2) default NULL,
 addballs decimal(18,2) default NULL,
 msgid1 int(11) default NULL,
 msgid2 int(11) default NULL,
 timeorderproc int(32) default NULL,
 clientphone varchar(24) default NULL,
 msgidtime datetime default NULL,
 notusecommondiscount tinyint(1) default '0',
 driversetorders datetime default NULL,
 orderwasdrivers varchar(100) default NULL,
 javamess varchar(255) default NULL,
 proctime tinyint(10) default '0',
 carddiscountdelta decimal(20,2) default '0.00',
 recall int(11) default '0',
 remotenotetime datetime default NULL,
 remotevendorphone varchar(25) default ,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 KEY orderscomplete1_preorderstate_index (preorder,orderstate),
 KEY orderscomplete1_ordertime_index (ordertime),
 KEY orderscomplete1_completetime_index (completetime),
 KEY orderscomplete1_endtask_index (endtask),
 KEY orderscomplete1_cash_index (cash),
 KEY orderscomplete1_dcard_index (dcard),
 KEY orderscomplete1_street_index (street),
 KEY orderscomplete1_streetto_index (street),
 KEY orderscomplete1_zonefrom_index (zonefrom),
 KEY orderscomplete1_zoneto_index (zoneto),
 KEY orderscomplete1_driver_index (driver),
 KEY orderscomplete1_drivershift_index (drivershift),
 KEY orderscomplete1_oper_index (oper),
 KEY orderscomplete1_disp_index (disp),
 KEY orderscomplete1_client_index (client),
 KEY orderscomplete1_ordertype_index (ordertype),
 KEY orderscomplete1_prefcar_index (prefcar),
 KEY orderscomplete1_phone_index (phone),
 KEY manual_oldnum (oldnum)

) TYPE=MyISAM;



Структура таблицы 'paybyaccount'

CREATE TABLE paybyaccount (

 num int(10) NOT NULL auto_increment,
 userid int(11) NOT NULL default '0',
 accountid int(11) NOT NULL default '0',
 paydate datetime NOT NULL default '0000-00-00 00:00:00',
 paysum decimal(20,2) NOT NULL default '0.00',
 info text,
 dc int(1) NOT NULL default '1',
 calccomplete int(1) NOT NULL default '0',
 ownerpay int(1) NOT NULL default '0',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'paybymemaccount'

CREATE TABLE paybymemaccount (

 num int(10) NOT NULL auto_increment,
 userid int(11) NOT NULL default '0',
 toaccountid int(11) NOT NULL default '0',
 fromaccountid int(11) NOT NULL default '0',
 paydate datetime NOT NULL default '0000-00-00 00:00:00',
 paysum decimal(18,2) NOT NULL default '0.00',
 info varchar(255) default NULL,
 accept tinyint(1) NOT NULL default '0',
 acceptdate datetime default NULL,
 sessionid int(20) NOT NULL default '0',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'pricerules'

CREATE TABLE pricerules (

 num int(10) unsigned NOT NULL auto_increment,
 priceclass int(10) unsigned default NULL,
 calcorder int(10) unsigned default NULL,
 name varchar(50) default NULL,
 active tinyint(1) unsigned default '1',
 carclass varchar(50) default NULL,
 ordertype varchar(255) default NULL,
 ordertype_and tinyint(1) default '0',
 ordersource varchar(50) default NULL,
 cashtype tinyint(3) default NULL,
 waypoints varchar(50) default NULL,
 timefrom datetime default NULL,
 timeto datetime default NULL,
 days varchar(100) default NULL,
 conditionsubject tinyint(3) unsigned default '0',
 conditiontype tinyint(3) unsigned default NULL,
 conditionparams varchar(100) default NULL,
 relvalue decimal(20,2) default '0.00',
 absvalue decimal(20,2) default '0.00',
 sumvalue tinyint(1) unsigned default '1',
 minvalue decimal(20,2) default NULL,
 maxvalue decimal(20,2) default NULL,
 citysuburb tinyint(8) unsigned default NULL,
 discountuse int(10) unsigned default '1',
 procent_wait varchar(50) default NULL,
 speed_orders varchar(50) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refaccountcompany'

CREATE TABLE refaccountcompany (

 num int(11) NOT NULL auto_increment,
 name varchar(200) default NULL,
 accounttype int(11) NOT NULL default '0',
 balance decimal(20,2) NOT NULL default '0.00',
 info text,
 lastchangebalance datetime NOT NULL default '0000-00-00 00:00:00',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refaccountowners'

CREATE TABLE refaccountowners (

 num int(10) NOT NULL auto_increment,
 name varchar(200) default NULL,
 ownerid int(11) NOT NULL default '0',
 accounttype int(11) NOT NULL default '0',
 balance decimal(20,2) NOT NULL default '0.00',
 lastchangebalance datetime NOT NULL default '0000-00-00 00:00:00',
 info text,
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refaccounttype'

CREATE TABLE refaccounttype (

 num int(11) NOT NULL auto_increment,
 name varchar(200) default NULL,
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refbadplaces'

CREATE TABLE refbadplaces (

 num int(32) NOT NULL auto_increment,
 street varchar(128) default NULL,
 houses varchar(255) default NULL,
 value decimal(18,2) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refbonusdriverlog'

CREATE TABLE refbonusdriverlog (

 num int(20) unsigned NOT NULL auto_increment,
 driverid int(10) NOT NULL default '0',
 drivershift int(10) NOT NULL default '0',
 channel int(10) NOT NULL default '0',
 orderid int(20) NOT NULL default '0',
 userid int(10) NOT NULL default '0',
 bonus int(10) NOT NULL default '0',
 bonustype int(10) NOT NULL default '0',
 value decimal(10,2) NOT NULL default '0.00',
 valuesumm decimal(18,2) NOT NULL default '0.00',
 bonustime datetime default '0000-00-00 00:00:00',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refbonusdrivershifttype'

CREATE TABLE refbonusdrivershifttype (

 num int(20) unsigned NOT NULL auto_increment,
 name varchar(100) default NULL,
 description varchar(255) default NULL,
 value decimal(10,2) NOT NULL default '0.00',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refbonusdrivertype'

CREATE TABLE refbonusdrivertype (

 num int(20) unsigned NOT NULL auto_increment,
 name varchar(100) default NULL,
 description varchar(255) default NULL,
 value decimal(10,2) NOT NULL default '0.00',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refbookeditlog'

CREATE TABLE refbookeditlog (

 num int(32) unsigned NOT NULL auto_increment,
 userid int(32) default '0',
 chtype tinyint(8) default '0',
 chtime datetime default NULL,
 refbook varchar(32) default NULL,
 fieldlist text,
 paramslist text,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refcallsigns'

CREATE TABLE refcallsigns (

 num int(10) unsigned NOT NULL auto_increment,
 sign varchar(10) NOT NULL default '0',
 channel int(10) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refcarclass'

CREATE TABLE refcarclass (

 num int(10) unsigned NOT NULL auto_increment,
 classname varchar(30) default NULL,
 info varchar(100) default NULL,
 def tinyint(1) unsigned default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refcars'

CREATE TABLE refcars (

 num int(10) unsigned NOT NULL auto_increment,
 carnumber varchar(20) default NULL,
 own tinyint(1) unsigned default NULL,
 defsign varchar(10) default '0',
 defchannel int(10) default NULL,
 disabled tinyint(1) default '0',
 model varchar(50) default NULL,
 modelyear datetime default NULL,
 carclass int(10) unsigned default NULL,
 color varchar(30) default NULL,
 mileage decimal(20,2) default '0.00',
 info text,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 KEY refcars_key_carclass (carclass)

) TYPE=MyISAM;



Структура таблицы 'refchannel'

CREATE TABLE refchannel (

 num int(20) unsigned NOT NULL auto_increment,
 name varchar(50) default NULL,
 color int(10) unsigned default NULL,
 chief varchar(50) default NULL,
 contact varchar(100) default NULL,
 info varchar(200) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 KEY key_refchannel_name (name)

) TYPE=MyISAM;



Структура таблицы 'refclientgroups'

CREATE TABLE refclientgroups (

 num int(10) NOT NULL auto_increment,
 Name varchar(64) default NULL,
 Desc varchar(255) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refclientphones'

CREATE TABLE refclientphones (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(100) default NULL,
 phone varchar(30) NOT NULL default ,
 street varchar(100) NOT NULL default ,
 house varchar(20) NOT NULL default ,
 porch varchar(16) default NULL,
 apart varchar(20) default NULL,
 clientid int(10) unsigned NOT NULL default '0',
 PRIMARY KEY  (num),
 UNIQUE KEY refclientphones_phone_unique (name,phone),
 KEY refclientphones_name (name),
 KEY refclientphones_clientid (clientid),
 KEY refclientphones_phone_search (phone)

) TYPE=MyISAM;



Структура таблицы 'refclients'

CREATE TABLE refclients (

 num int(10) unsigned NOT NULL auto_increment,
 lock int(10) unsigned default NULL,
 phone varchar(30) default NULL,
 fname varchar(100) default NULL,
 street varchar(100) default NULL,
 house varchar(20) default NULL,
 porch varchar(16) default NULL,
 apart varchar(20) default NULL,
 usecount int(10) unsigned default '0',
 accumdiscount decimal(20,2) default '0.00',
 cash tinyint(1) unsigned NOT NULL default '1',
 info varchar(100) default NULL,
 blackupto datetime default NULL,
 blackinfo varchar(128) default NULL,
 lastupdate datetime default NULL,
 card_index decimal(32,0) default '0',
 clientgroupid int(10) unsigned default '0',
 createdate datetime default '0000-00-00 00:00:00',
 birthdate datetime default NULL,
 nosms int(3) unsigned default '0',
 alternativphone varchar(30) default ,
 deviceid varchar(64) default ,
 regcode varchar(6) default ,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 KEY refclients_phone_index (phone),
 KEY refclients_adres_house_key (street,house),
 KEY refclients_card_index_key (card_index),
 KEY refclients_blacklist_key (blackupto),
 KEY fnameclient (fname),
 KEY Adress (street,house,apart)

) TYPE=MyISAM;



Структура таблицы 'refcolumn'

CREATE TABLE refcolumn (

 num int(20) unsigned NOT NULL auto_increment,
 name varchar(50) default NULL,
 color int(10) unsigned default NULL,
 info varchar(200) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refcompanyowners'

CREATE TABLE refcompanyowners (

 num int(20) unsigned NOT NULL auto_increment,
 userid int(20) NOT NULL default '0',
 part decimal(18,2) NOT NULL default '0.00',
 name varchar(128) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refdistances'

CREATE TABLE refdistances (

 num int(32) NOT NULL auto_increment,
 idfrom int(32) NOT NULL default '0',
 idto int(32) NOT NULL default '0',
 dist decimal(18,2) default '0.00',
 Name varchar(64) default NULL,
 Route varchar(255) default NULL,
 PRIMARY KEY  (num),
 KEY fromto (idfrom,idto)

) TYPE=MyISAM;



Структура таблицы 'refdistzones'

CREATE TABLE refdistzones (

 num int(10) unsigned NOT NULL auto_increment,
 street varchar(100) default NULL,
 houses varchar(100) default NULL,
 ZoneID int(32) unsigned NOT NULL default '0',
 KEY num (num),
 KEY ind_street (street)

) TYPE=MyISAM;



Структура таблицы 'refdrivermobileways'

CREATE TABLE refdrivermobileways (

 num int(32) unsigned NOT NULL auto_increment,
 driverid int(32) default '0',
 msgtype tinyint(8) default '0',
 way tinyint(8) default '0',
 pager varchar(32) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refdriverpenalty'

CREATE TABLE refdriverpenalty (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(100) default NULL,
 description varchar(255) default ,
 value decimal(18,2) default '0.00',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refdrivers'

CREATE TABLE refdrivers (

 num int(10) unsigned NOT NULL auto_increment,
 fname varchar(50) NOT NULL default ,
 sign varchar(10) NOT NULL default '0',
 channel int(10) default NULL,
 pager varchar(128) default ,
 disabled tinyint(1) default '0',
 car varchar(255) default NULL,
 carclass int(10) unsigned default NULL,
 address varchar(50) default NULL,
 phone varchar(50) default NULL,
 info text,
 dailyrate decimal(20,2) default '0.00',
 yieldrate decimal(20,2) default '0.00',
 orderrate decimal(20,2) default '0.00',
 balance decimal(20,2) default '0.00',
 bonuses decimal(10,0) default '0',
 created datetime default NULL,
 fired datetime default NULL,
 deviceid varchar(64) default NULL,
 default_stop_id int(20) unsigned default NULL,
 textmessage varchar(255) default NULL,
 birthdate datetime default NULL,
 drvstatus int(10) unsigned default NULL,
 drvstatusnote text,
 pasnum varchar(16) default NULL,
 pasvendor varchar(255) default NULL,
 pasdate datetime default NULL,
 realaddress varchar(255) default NULL,
 taxnum varchar(32) default NULL,
 constantorder int(10) default '0',
 useksactive tinyint(1) default '0',
 useksptt tinyint(1) default '0',
 useksjava tinyint(1) default '0',
 usekscorp tinyint(1) default '0',
 percentrate decimal(18,2) default '-1.00',
 archive tinyint(1) unsigned default '0',
 ksbalance decimal(10,2) default '0.00',
 percentratestate decimal(18,2) default '-1.00',
 percentrateminus decimal(18,2) default '0.00',
 minussum decimal(18,2) default '0.00',
 minussumcashpay float default '0',
 shashka varchar(255) default NULL,
 javadelay tinyint(3) default '0',
 putevka decimal(10,2) default '0.00',
 PRIMARY KEY (num),
 KEY refdrivers_balance_index (balance)

) TYPE=MyISAM;

Структура таблицы 'refdriverunwork'

CREATE TABLE refdriverunwork (

 num int(10) unsigned NOT NULL auto_increment,
 driver int(20) unsigned NOT NULL default '0',
 fromtime datetime default NULL,
 totime datetime default NULL,
 reason varchar(255) default NULL,
 comment varchar(255) default NULL,
 PRIMARY KEY  (num),
 KEY driver (driver)

) TYPE=MyISAM;



Структура таблицы 'refdriverunworknames'

CREATE TABLE refdriverunworknames (

 num int(20) unsigned NOT NULL auto_increment,
 name varchar(128) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refdrvstates'

CREATE TABLE refdrvstates (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(30) NOT NULL default '0',
 sys tinyint(1) unsigned default '0',
 groupid int(10) unsigned default '0',
 def tinyint(1) unsigned default '0',
 info text,
 color int(10) unsigned default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refdrvstatus'

CREATE TABLE refdrvstatus (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(30) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refendtask'

CREATE TABLE refendtask (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(30) NOT NULL default ,
 groupid int(10) unsigned default NULL,
 def tinyint(1) unsigned default '0',
 info text,
 blacklistuse tinyint(3) NOT NULL default '0',
 blacklisttext varchar(255) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'reffuel'

CREATE TABLE reffuel (

 num int(32) unsigned NOT NULL auto_increment,
 name char(32) default NULL,
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refmarketingsources'

CREATE TABLE refmarketingsources (

 num int(20) unsigned NOT NULL auto_increment,
 name varchar(64) NOT NULL default ,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refmemaccount'

CREATE TABLE refmemaccount (

 num int(11) NOT NULL auto_increment,
 name varchar(200) NOT NULL default ,
 accounttype int(11) NOT NULL default '0',
 balance decimal(18,2) NOT NULL default '0.00',
 info varchar(255) default NULL,
 lastchangebalance datetime NOT NULL default '0000-00-00 00:00:00',
 memid int(11) NOT NULL default '0',
 closedatetime datetime default NULL,
 opendatetime datetime NOT NULL default '0000-00-00 00:00:00',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refmemaccounttype'

CREATE TABLE refmemaccounttype (

 num int(11) NOT NULL auto_increment,
 name varchar(200) NOT NULL default ,
 memtype int(11) NOT NULL default '0',
 sys tinyint(1) NOT NULL default '0',
 mandatory tinyint(1) unsigned NOT NULL default '0',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refnearstops'

CREATE TABLE refnearstops (

 num int(32) NOT NULL auto_increment,
 stop_id_from int(32) unsigned default NULL,
 stop_id_to int(32) unsigned default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refordertype'

CREATE TABLE refordertype (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(30) NOT NULL default ,
 aux tinyint(1) unsigned NOT NULL default '0',
 def tinyint(1) unsigned default '0',
 price decimal(20,2) default NULL,
 opercash decimal(20,2) default NULL,
 info text,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refplaces'

CREATE TABLE refplaces (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(100) default NULL,
 street varchar(100) default NULL,
 house varchar(20) default NULL,
 createdate timestamp(14) NOT NULL,
 townid int(10) unsigned default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refprices'

CREATE TABLE refprices (

 num int(10) unsigned NOT NULL auto_increment,
 prname varchar(100) default NULL,
 zonefrom int(10) default NULL,
 zoneto int(10) default NULL,
 price decimal(20,2) default NULL,
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refreasons'

CREATE TABLE refreasons (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(50) default NULL,
 comment text,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refsalarydays'

CREATE TABLE refsalarydays (

 num int(32) NOT NULL auto_increment,
 thisdate datetime default NULL,
 drivercalculated tinyint(3) unsigned default '0',
 workercalculated tinyint(3) unsigned default '0',
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 UNIQUE KEY refsalarydays_thisdate_unique (thisdate)

) TYPE=MyISAM;



Структура таблицы 'refstops'

CREATE TABLE refstops (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(100) default NULL,
 street varchar(100) default NULL,
 house varchar(20) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refstreets'

CREATE TABLE refstreets (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(100) default NULL,
 zone int(10) unsigned default '0',
 zonemap varchar(20) default NULL,
 houses varchar(100) default NULL,
 townid int(10) unsigned default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 KEY refstreets_name_ind (name),
 KEY refstreets_zone_ind (zone)

) TYPE=MyISAM;



Структура таблицы 'refsuburb'

CREATE TABLE refsuburb (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(50) default NULL,
 cityrefstreet varchar(50) default NULL,
 cityrefhouse varchar(20) default NULL,
 driveuptime decimal(20,2) default '0.00',
 dist decimal(20,2) default '0.00',
 pricein decimal(20,2) default '0.00',
 priceout decimal(20,2) default '0.00',
 createdate timestamp(14) NOT NULL,
 townid int(10) unsigned default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'reftextofsend'

CREATE TABLE reftextofsend (

 num int(10) unsigned default NULL,
 sendtext varchar(255) default NULL,
 ip varchar(16) default '000.000.000.000',
 userid int(10) unsigned default '0',
 UNIQUE KEY num (num),
 KEY num_2 (num)

) TYPE=MyISAM;



Структура таблицы 'reftowns'

CREATE TABLE reftowns (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(50) NOT NULL default ,
 is_actual tinyint(1) unsigned default '1',
 is_default tinyint(1) unsigned default '0',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refuserbyaccounttype'

CREATE TABLE refuserbyaccounttype (

 num int(11) unsigned NOT NULL auto_increment,
 userid int(11) NOT NULL default '0',
 accounttype int(11) NOT NULL default '0',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refuserlevels'

CREATE TABLE refuserlevels (

 num int(10) NOT NULL default '0',
 name varchar(30) default NULL,
 groupname varchar(30) default NULL,
 dummy tinyint(1) unsigned default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refuserpenalty'

CREATE TABLE refuserpenalty (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(100) default NULL,
 description varchar(255) default ,
 value decimal(18,2) default '0.00',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'refusers'

CREATE TABLE refusers (

 num int(10) unsigned NOT NULL auto_increment,
 fname varchar(50) NOT NULL default ,
 sys tinyint(1) unsigned default NULL,
 ulevel tinyint(1) unsigned default '1',
 access varchar(64) default ,
 loginname varchar(16) default NULL,
 pwd varchar(32) default NULL,
 address varchar(100) default NULL,
 phone varchar(20) default NULL,
 info varchar(100) default NULL,
 dailyrate decimal(20,2) default '0.00',
 yieldrate float default '0',
 orderrate decimal(20,2) default '0.00',
 balance decimal(20,2) default '0.00',
 bonuses decimal(10,0) default '0',
 created datetime default NULL,
 fired datetime default NULL,
 birthdate datetime default NULL,
 lname varchar(64) default NULL,
 mobphone varchar(32) default NULL,
 salary decimal(18,2) default '0.00',
 pay double(18,2) default '0.00',
 constantper double(18,2) default '0.00',
 constantpay double(18,2) default '0.00',
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refuserviewdriver'

CREATE TABLE refuserviewdriver (

 Id int(11) NOT NULL auto_increment,
 userid int(11) NOT NULL default '0',
 driverid int(11) NOT NULL default '0',
 PRIMARY KEY  (Id),
 KEY userindex (userid),
 KEY driverindex (driverid)

) TYPE=MyISAM;



Структура таблицы 'refzones'

CREATE TABLE refzones (

 num int(10) unsigned NOT NULL auto_increment,
 name varchar(100) default NULL,
 driveupprice decimal(20,2) default '0.00',
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'refzonestops'

CREATE TABLE refzonestops (

 num int(32) NOT NULL auto_increment,
 stop_id int(32) unsigned default NULL,
 zone_id int(32) unsigned default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'remoteorders'

CREATE TABLE remoteorders (

 num int(32) unsigned NOT NULL auto_increment,
 comefrom varchar(128) NOT NULL default ,
 cometime datetime NOT NULL default '0000-00-00 00:00:00',
 accepted tinyint(1) NOT NULL default '0',
 declineinfo varchar(255) default NULL,
 clientnotified tinyint(1) NOT NULL default '0',
 acceptor int(32) unsigned default NULL,
 orderid int(32) unsigned default NULL,
 phone varchar(24) NOT NULL default ,
 client int(32) NOT NULL default '0',
 clientname varchar(128) NOT NULL default ,
 dcard varchar(32) NOT NULL default ,
 street varchar(128) default NULL,
 house varchar(32) default NULL,
 porch varchar(16) default NULL,
 apart varchar(16) default NULL,
 preorder tinyint(1) NOT NULL default '0',
 meet varchar(255) default NULL,
 pretime datetime default NULL,
 streetto varchar(128) default NULL,
 houseto varchar(32) default NULL,
 addressfrom varchar(100) default NULL,
 addressto varchar(100) default NULL,
 ordertype varchar(50) default NULL,
 suburb tinyint(3) unsigned default '0',
 ordercompany varchar(60) default NULL,
 passenger varchar(60) default NULL,
 ordervendor varchar(20) default NULL,
 paysum decimal(18,2) default NULL,
 cash tinyint(8) unsigned default NULL,
 route text,
 ordervendorexecute varchar(20) default NULL,
 remoteid int(32) unsigned default NULL,
 source varchar(32) default NULL,
 cometo varchar(32) default NULL,
 zonefrom int(32) default NULL,
 stopid int(32) default NULL,
 channel int(32) default NULL,
 linecolumn int(32) default NULL,
 note text,
 notetime datetime default NULL,
 probabality int(32) default NULL,
 localnum int(32) default NULL,
 vendorname varchar(64) default NULL,
 vendorphone varchar(32) default NULL,
 blacklistnote varchar(128) default NULL,
 mypaysum decimal(20,2) default NULL,
 cartypeid int(32) default NULL,
 executevendorname varchar(32) default NULL,
 executevendorphone varchar(32) default NULL,
 drivershiftid int(20) default '0',
 acceptdate datetime default NULL,
 ordertime datetime default NULL,
 recall tinyint(1) unsigned default NULL,
 bonuses decimal(18,2) default '0.00',
 orderstatus int(10) default '0',
 PRIMARY KEY  (num),
 KEY accepted_key (accepted),
 KEY orderid_key (orderid),
 KEY localnumkey (localnum),
 KEY comefrom (comefrom),
 KEY LocalNumComeFrom (localnum,comefrom),
 KEY cometo (cometo),
 KEY remoteid (remoteid),
 KEY source (source),
 KEY remoteidsource (remoteid,source)

) TYPE=MyISAM;



Структура таблицы 'sessions'

CREATE TABLE sessions (

 num int(10) unsigned NOT NULL auto_increment,
 userid int(10) unsigned NOT NULL default '0',
 host varchar(50) default NULL,
 pid int(10) unsigned default NULL,
 shiftid int(20) unsigned default NULL,
 starttime datetime default NULL,
 endtime datetime default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 KEY sessions_userid_index (userid),
 KEY sessions_host_index (host),
 KEY sessions_shiftid_index (shiftid)

) TYPE=MyISAM;



Структура таблицы 'shifttype'

CREATE TABLE shifttype (

 num int(11) NOT NULL auto_increment,
 name varchar(50) NOT NULL default ,
 starttime datetime NOT NULL default '0000-00-00 00:00:00',
 endtime datetime NOT NULL default '0000-00-00 00:00:00',
 hotkey varchar(50) default ,
 active int(11) NOT NULL default '0',
 colorid int(11) NOT NULL default '0',
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'staffrules'

CREATE TABLE staffrules (

 num int(10) unsigned NOT NULL auto_increment,
 stafflevel tinyint(3) default NULL,
 staffgroup int(10) default '0',
 staffid int(10) default '0',
 eventclass tinyint(3) unsigned default NULL,
 calcorder int(10) unsigned default NULL,
 name varchar(50) default NULL,
 active tinyint(1) unsigned default '1',
 carclass varchar(50) default NULL,
 ordertype varchar(255) default NULL,
 ordertype_and tinyint(1) default '0',
 ordersource varchar(50) default NULL,
 cashtype tinyint(3) unsigned default NULL,
 waypoints varchar(50) default NULL,
 timefrom datetime default NULL,
 timeto datetime default NULL,
 days varchar(100) default NULL,
 conditionsubject tinyint(3) unsigned default '0',
 conditiontype tinyint(3) unsigned default NULL,
 conditionparams varchar(100) default NULL,
 relvalue decimal(20,3) default '0.000',
 absvalue decimal(20,2) default '0.00',
 sumvalue tinyint(1) unsigned default '1',
 minvalue decimal(20,2) default NULL,
 maxvalue decimal(20,2) default NULL,
 citysuburb tinyint(8) unsigned default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num)

) TYPE=MyISAM;



Структура таблицы 'tdchatmessages'

CREATE TABLE tdchatmessages (

 num int(10) unsigned NOT NULL auto_increment,
 msggroup int(11) NOT NULL default '0',
 contactid int(11) NOT NULL default '0',
 msgdatetime datetime NOT NULL default '0000-00-00 00:00:00',
 msgtext varchar(255) default NULL,
 msgvendor varchar(255) NOT NULL default ,
 isread tinyint(1) unsigned NOT NULL default '0',
 readdatetime datetime default '0000-00-00 00:00:00',
 msgsource varchar(32) NOT NULL default ,
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'userpenaltylog'

CREATE TABLE userpenaltylog (

 num int(10) unsigned NOT NULL auto_increment,
 user int(20) unsigned NOT NULL default '0',
 usershift int(20) unsigned NOT NULL default '0',
 orderid int(20) unsigned NOT NULL default '0',
 userid int(20) unsigned NOT NULL default '0',
 penaltytime datetime default NULL,
 value decimal(18,2) default '0.00',
 paied tinyint(1) default '0',
 penaltyname varchar(100) default NULL,
 comment varchar(255) default NULL,
 setpenaltytime datetime default NULL,
 PRIMARY KEY  (num)

) TYPE=MyISAM;



Структура таблицы 'usershift'

CREATE TABLE usershift (

 num int(20) unsigned NOT NULL auto_increment,
 complete tinyint(1) unsigned default '0',
 userid int(10) unsigned default NULL,
 starttime datetime default NULL,
 endtime datetime default NULL,
 operorderscount int(10) unsigned default '0',
 opertotalsum decimal(20,2) default '0.00',
 opertotalsum_paid decimal(20,2) default '0.00',
 disporderscount int(10) unsigned default '0',
 disptotalsum decimal(20,2) default '0.00',
 disptotalsum_paid decimal(20,2) default '0.00',
 opercharged tinyint(3) unsigned default '0',
 dispcharged tinyint(3) unsigned default '0',
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 KEY usershift_complete_userid_index (complete,userid)

) TYPE=MyISAM;



Структура таблицы 'violationusers'

CREATE TABLE violationusers (

 num int(20) unsigned NOT NULL auto_increment,
 violationid int(10) unsigned default NULL,
 violationsource int(10) unsigned default NULL,
 userid int(20) unsigned default NULL,
 usershiftid int(20) unsigned default NULL,
 driverid int(20) unsigned default NULL,
 drivershiftid int(20) unsigned default NULL,
 orderid int(20) unsigned default NULL,
 drivervalue int(20) unsigned default NULL,
 uservalue int(20) unsigned default NULL,
 gravity int(20) unsigned default NULL,
 penalty decimal(20,2) default '0.00',
 time datetime default NULL,
 note varchar(200) default NULL,
 PRIMARY KEY  (num),
 UNIQUE KEY num (num),
 KEY driver_search (violationid,driverid),
 KEY user_search (violationid,userid)

) TYPE=MyISAM;



Структура таблицы 'words'

CREATE TABLE words (

 idname varchar(20) default NULL,
 state int(10) unsigned default '0',
 wvalue varchar(50) default NULL,
 KEY words_idname_state_index (idname,state)

) TYPE=MyISAM;