-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 197.44.62.106
-- Generation Time: May 22, 2019 at 11:09 AM
-- Server version: 5.6.17
-- PHP Version: 5.5.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `erp2016_fatma`
--

-- --------------------------------------------------------

--
-- Table structure for table `accountmovement`
--

CREATE TABLE IF NOT EXISTS `accountmovement` (
  `accountmovementid` int(11) NOT NULL AUTO_INCREMENT,
  `accountmovementbefore` decimal(10,2) NOT NULL,
  `accountmovementamount` decimal(10,2) NOT NULL,
  `accountmovementafter` decimal(10,2) NOT NULL,
  `accountmovementtype` int(11) NOT NULL COMMENT '0 => deposit- 1 => withdrawal',
  `processname` varchar(256) DEFAULT NULL,
  `accountmovementmodelid` int(11) NOT NULL,
  `accountmovementdate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `accountid` int(11) NOT NULL,
  `tablename` varchar(256) NOT NULL,
  `bankid` int(11) NOT NULL,
  `accountmovementcomment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `accountmovementkindid` int(11) NOT NULL,
  `clientdebtchangeidfk` int(11) NOT NULL DEFAULT '0',
  `clientid` int(11) DEFAULT NULL,
  PRIMARY KEY (`accountmovementid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `accountmovementkind`
--

CREATE TABLE IF NOT EXISTS `accountmovementkind` (
  `accountmovementkindid` int(11) NOT NULL AUTO_INCREMENT,
  `accountmovementkindname` varchar(256) DEFAULT NULL,
  `accountmovementkinddate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `tablename` varchar(256) NOT NULL,
  `conditions` int(1) NOT NULL,
  `accountmovementkindcomment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`accountmovementkindid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

-- --------------------------------------------------------

--
-- Table structure for table `accountstree`
--

CREATE TABLE IF NOT EXISTS `accountstree` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `customName` varchar(255) NOT NULL,
  `customNameEn` varchar(255) NOT NULL,
  `nameEn` varchar(255) NOT NULL,
  `parent` int(11) NOT NULL,
  `accountNature` tinyint(4) NOT NULL COMMENT '0 debit, 1 credit',
  `theValue` decimal(10,2) NOT NULL,
  `theOrder` int(11) NOT NULL COMMENT 'like 123',
  `layingOrder` varchar(255) NOT NULL COMMENT 'like 1.2.1',
  `reportid` int(11) NOT NULL,
  `listId` int(11) NOT NULL COMMENT '1 budget, 2 income list',
  `notes` text NOT NULL,
  `itemfrom` int(11) NOT NULL COMMENT '0 from program - 1 from tree only',
  `itemtype` int(11) NOT NULL COMMENT '0 masrofat-1khsoom-2eradat-3osool',
  `itemtype2` int(11) NOT NULL COMMENT '0 "parent" is a node haschilden - 1 "end element" has no childern only 1 is used in daily entry',
  `itemtype3` varchar(255) NOT NULL COMMENT 'from excel',
  `userid` int(11) NOT NULL,
  `del` int(11) NOT NULL COMMENT '0not del - 1 deleted',
  `sysdate` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `accountstreefromprog`
--

CREATE TABLE IF NOT EXISTS `accountstreefromprog` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `displayName` varchar(255) NOT NULL,
  `fptype` int(11) NOT NULL COMMENT '0 masrofat-1khsoom-2eradat-3osool',
  `showit` int(11) NOT NULL COMMENT '0show-1hide',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `accountstreesetting`
--

CREATE TABLE IF NOT EXISTS `accountstreesetting` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `levelno` int(11) NOT NULL,
  `nooffields` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `assets`
--

CREATE TABLE IF NOT EXISTS `assets` (
  `assetId` int(11) NOT NULL AUTO_INCREMENT,
  `assetsName` varchar(265) NOT NULL DEFAULT '',
  `assetsDescription` text,
  `assetsValue` decimal(10,2) NOT NULL,
  `assetsDate` datetime NOT NULL,
  `depreciation` decimal(10,2) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `userid` int(11) NOT NULL,
  `type` int(11) NOT NULL DEFAULT '0' COMMENT '0 --->old and 1 -->new',
  `assetsDepreciation` decimal(10,2) NOT NULL COMMENT 'for rate',
  `assetscatid` int(11) NOT NULL,
  `manufacture` int(11) NOT NULL DEFAULT '0' COMMENT '1 for ',
  `Hourlyrate` decimal(10,2) NOT NULL DEFAULT '10',
  `dailyentryid` varchar(11) NOT NULL,
  `saveid` int(11) NOT NULL DEFAULT '0',
  `treeId` int(11) NOT NULL DEFAULT '0',
  `paytype` int(11) NOT NULL COMMENT '0:save 1: bank 2:supplier',
  `supplierid` int(11) NULL,
  PRIMARY KEY (`assetId`),
  KEY `assetscatid` (`assetscatid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------
--
-- Table structure for table `assetssale`
--

CREATE TABLE IF NOT EXISTS `assetssale` (
  `assetssaleid` int(11) NOT NULL AUTO_INCREMENT,
  `assetssaleclient` int(11) NOT NULL,
  `assetssalesave` int(11) NOT NULL,
  `assetssaleval` varchar(191) NOT NULL,
  `assetssalecomment` text CHARACTER SET utf8 NOT NULL,
  `assetssaledateadd` varchar(191) NOT NULL,
  `assetssaledate` varchar(191) NOT NULL,
  `assetsid` int(11) NOT NULL,
  PRIMARY KEY (`assetssaleid`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------
--
-- Table structure for table `assetscat`
--

CREATE TABLE IF NOT EXISTS `assetscat` (
  `assetscatid` int(11) NOT NULL AUTO_INCREMENT,
  `cattitel` varchar(255) NOT NULL,
  `descripe` text NOT NULL,
  `userid` int(11) NOT NULL,
  `assetscatdate` date NOT NULL,
  `del` int(11) NOT NULL DEFAULT '0',
  `treeId` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`assetscatid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `availableparcode`
--

CREATE TABLE IF NOT EXISTS `availableparcode` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `value` varchar(15) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `value` (`value`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `bank`
--

CREATE TABLE IF NOT EXISTS `bank` (
  `bankid` int(11) NOT NULL AUTO_INCREMENT,
  `bankname` varchar(256) NOT NULL,
  `bankdetails` text,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `bankdate` date NOT NULL,
  PRIMARY KEY (`bankid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `bankaccount`
--

CREATE TABLE IF NOT EXISTS `bankaccount` (
  `accountid` int(11) NOT NULL AUTO_INCREMENT,
  `accountname` varchar(256) NOT NULL,
  `comment` text,
  `accountnumber` varchar(256) NOT NULL,
  `accountbeginingbalance` decimal(10,2) NOT NULL,
  `accountdate` datetime NOT NULL,
  `accountcurrencytype` varchar(10) DEFAULT NULL,
  `bankid` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `visa` tinyint(4) NOT NULL DEFAULT '0',
  `visaDisPer` float NOT NULL DEFAULT '0',
  `treeId` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`accountid`),
  KEY `bankid` (`bankid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `billname`
--

CREATE TABLE IF NOT EXISTS `billname` (
  `billnameid` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(256) NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL,
  `billnamedate` date NOT NULL,
  `billtype` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 => sellbill- 1 => buybill',
  `billtype2` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0=>normal bill-1=>optics bill',
  `ordertype` tinyint(4) NOT NULL DEFAULT '0' COMMENT ' 1 ',
  `saveeffect` tinyint(4) NOT NULL DEFAULT '0' COMMENT ' 1 ',
  `productAndQuantityOnly` int(11) NOT NULL DEFAULT '0',
  `posFlag` int(11) NOT NULL COMMENT 'parcode scale',
  `posCode` int(11) NOT NULL COMMENT 'parcode scale',
  `posType` tinyint(4) NOT NULL COMMENT 'parcode scale',
  `posWeightPrice` int(11) NOT NULL COMMENT 'parcode scale',
  `checkDigit` int(11) NOT NULL COMMENT 'parcode scale',
  `goodsReceiptApproval` text NOT NULL,
  `parcodeType` tinyint(4) NOT NULL DEFAULT '0',
  `defVisaAccount` int(11) NOT NULL DEFAULT '0',
  `defVisaAccountSelect` tinyint(4) NOT NULL DEFAULT '0',
  `isBankAccountTransfer` tinyint(4) NOT NULL DEFAULT '0',
  `taxOfDiscountVal` float NOT NULL DEFAULT '0',
  `taxOfDiscountPrint` tinyint(4) NOT NULL DEFAULT '0',
  `extraDiscountPlace` tinyint(4) NOT NULL DEFAULT '0',
  `extraDiscountFixed` tinyint(4) NOT NULL DEFAULT '0',
  `extraDiscountPer` float NOT NULL DEFAULT '0',
  `storeeffect` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`billnameid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `billoperation`
--

CREATE TABLE IF NOT EXISTS `billoperation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `userid` int(11) NOT NULL,
  `sydate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  `treeId` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `billproperty`
--

CREATE TABLE IF NOT EXISTS `billproperty` (
  `billpropertyid` int(11) NOT NULL AUTO_INCREMENT,
  `billpropertyname` varchar(256) NOT NULL,
  `description` text NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`billpropertyid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `bills`
--

CREATE TABLE IF NOT EXISTS `bills` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `branchid` int(11) DEFAULT '0',
  `clientid` int(11) DEFAULT NULL,
  `receivedate` datetime DEFAULT NULL,
  `billno` varchar(255) DEFAULT NULL,
  `comment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `billdate` datetime DEFAULT NULL,
  `serverdate` datetime DEFAULT NULL COMMENT 'date when bill added',
  `kashfid` int(11) DEFAULT NULL,
  `cash` int(11) DEFAULT '0',
  `cashvalue` decimal(10,2) DEFAULT '0',
  `waitvalue` decimal(10,2) DEFAULT '0',
  `insurance` int(11) DEFAULT '0',
  `insurancecompanyid` int(11) DEFAULT NULL,
  `customerpercent` decimal(10,2) DEFAULT '0',
  `customermax` decimal(10,2) DEFAULT '0',
  `customercarry` decimal(10,2) DEFAULT '0',
  `companyaccept` decimal(10,2) DEFAULT '0',
  `companycarry` decimal(10,2) DEFAULT '0',
  `card` int(11) DEFAULT '0',
  `cardvalue` decimal(10,2) DEFAULT '0',
  `paymentnetworkid` int(11) DEFAULT NULL,
  `userid` int(11) DEFAULT NULL,
  `deleted` int(11) DEFAULT '0',
  `kashftype` int(11) NOT NULL DEFAULT '0' COMMENT '1 external - 0 internal ',
  `alloweddays` int(11) DEFAULT '0' COMMENT '',
  `productstotalprice` decimal(10,2) DEFAULT NULL COMMENT '',
  `kashfvalue` decimal(10,2) DEFAULT NULL COMMENT '',
  `kashfdiscount` decimal(10,2) DEFAULT NULL COMMENT '',
  `netbillvalue` decimal(10,2) DEFAULT NULL COMMENT '',
  `discounttype` int(11) DEFAULT NULL COMMENT ' 1 direct   - 2 percent',
  `discountvalue` decimal(10,2) DEFAULT NULL COMMENT 'discValue',
  `finalnetbillvalue` decimal(10,2) DEFAULT NULL COMMENT '',
  `offline` int(11) DEFAULT '0' COMMENT '0 online - 1 offline',
  `uploaddate` datetime DEFAULT NULL,
  `pricetype` tinyint DEFAULT NULL,
  `billstatus` int(11) DEFAULT NULL,
  `approvalno` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deliverytime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kashfplace` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kashfdate` date DEFAULT NULL,
  `dailyentryid` int(11) DEFAULT NULL,
  `insdiscountpercent` decimal(10,2) DEFAULT '0' COMMENT 'insurance company discount percent',
  `clientPayReceiptVal` decimal(10,2) DEFAULT '0',
  `netdiscountpercent` decimal(10,2) DEFAULT '0' COMMENT 'network discount percent',
  `rondomtxt` varchar(255) DEFAULT NULL,
  `attatch` varchar(255) NOT NULL COMMENT 'for insurance only it is file in the bill by fatma',
  `approved` int(11) NOT NULL COMMENT '1accepted-2rejected this is for insurance only  by fatma',
  `saveid` int(11) NOT NULL COMMENT ' by fatma',
  `approveNo` varchar(255) NOT NULL COMMENT 'for insurance bills approve by fatma',
  `approveFile` varchar(255) NOT NULL COMMENT 'for insurance bills approve  by fatma',
  `notifSeen` int(11) NOT NULL COMMENT '0 not seen - 1 seen in notification',
  `payType` varchar(30) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `billsbuy`
--

CREATE TABLE IF NOT EXISTS `billsbuy` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `branchid` int(11) DEFAULT '0',
  `clientid` int(11) DEFAULT NULL COMMENT 'which is supplierid',
  `receivedate` date DEFAULT NULL,
  `billno` varchar(255) DEFAULT NULL,
  `comment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `billdate` datetime DEFAULT NULL,
  `serverdate` datetime DEFAULT NULL COMMENT 'date when bill added',
  `kashfid` int(11) DEFAULT NULL,
  `cash` int(11) DEFAULT '0',
  `cashvalue` decimal(10,2) DEFAULT '0',
  `waitvalue` decimal(10,2) DEFAULT '0',
  `insurance` int(11) DEFAULT '0',
  `insurancecompanyid` int(11) DEFAULT NULL,
  `customerpercent` decimal(10,2) DEFAULT '0',
  `customermax` decimal(10,2) DEFAULT '0',
  `customercarry` decimal(10,2) DEFAULT '0',
  `companyaccept` decimal(10,2) DEFAULT '0',
  `companycarry` decimal(10,2) DEFAULT '0',
  `card` int(11) DEFAULT '0',
  `cardvalue` decimal(10,2) DEFAULT '0',
  `paymentnetworkid` int(11) DEFAULT NULL,
  `userid` int(11) DEFAULT NULL,
  `deleted` int(11) DEFAULT '0',
  `kashftype` int(11) NOT NULL DEFAULT '0' COMMENT '1 external - 0 internal ',
  `alloweddays` int(11) DEFAULT '0' COMMENT '',
  `productstotalprice` decimal(10,2) DEFAULT NULL COMMENT '',
  `kashfvalue` decimal(10,2) DEFAULT NULL COMMENT '',
  `kashfdiscount` decimal(10,2) DEFAULT NULL COMMENT '',
  `netbillvalue` decimal(10,2) DEFAULT NULL COMMENT '',
  `discounttype` int(11) DEFAULT NULL COMMENT ' 1 direct   - 2 percent',
  `discountvalue` decimal(10,2) DEFAULT NULL COMMENT 'discValue',
  `finalnetbillvalue` decimal(10,2) DEFAULT NULL COMMENT '',
  `offline` int(11) DEFAULT '0' COMMENT '0 online - 1 offline',
  `uploaddate` datetime DEFAULT NULL,
  `pricetype` tinyint DEFAULT NULL,
  `billstatus` int(11) DEFAULT NULL,
  `approvalno` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deliverytime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kashfplace` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kashfdate` date DEFAULT NULL,
  `dailyentryid` int(11) DEFAULT NULL,
  `insdiscountpercent` decimal(10,2) DEFAULT '0' COMMENT 'insurance company discount percent',
  `clientPayReceiptVal` decimal(10,2) DEFAULT '0',
  `netdiscountpercent` decimal(10,2) DEFAULT '0' COMMENT 'network discount percent',
  `rondomtxt` varchar(255) DEFAULT NULL,
  `attatch` varchar(255) NOT NULL COMMENT 'for insurance only it is file in the bill by fatma',
  `approved` int(11) NOT NULL COMMENT '1accepted-2rejected this is for insurance only  by fatma',
  `saveid` int(11) NOT NULL COMMENT ' by fatma',
  `approveNo` varchar(255) NOT NULL COMMENT 'for insurance bills approve by fatma',
  `approveFile` varchar(255) NOT NULL COMMENT 'for insurance bills approve  by fatma',
  `notifSeen` int(11) NOT NULL COMMENT '0 not seen - 1 seen in notification',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `billsettings`
--

CREATE TABLE IF NOT EXISTS `billsettings` (
  `billsettingsid` int(11) NOT NULL AUTO_INCREMENT,
  `billnameid` int(11) NOT NULL,
  `billpropertyid` int(11) NOT NULL,
  `billsettingsvalue` int(11) NOT NULL DEFAULT '0' COMMENT '0 => yes- 1 => no',
  PRIMARY KEY (`billsettingsid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `billsproducts`
--

CREATE TABLE IF NOT EXISTS `billsproducts` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `billid` int(11) unsigned DEFAULT NULL,
  `productid` int(11) unsigned DEFAULT NULL,
  `note` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `productno` int(10) unsigned DEFAULT NULL,
  `productprice` decimal(10,2) unsigned DEFAULT NULL,
  `producttotalprice` decimal(10,2) DEFAULT NULL,
  `deleted` int(11) DEFAULT '0',
  `service` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `retproductno` int(11) DEFAULT '0' COMMENT 'no of returned product',
  `rondomtxt` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `lastbuyprice` decimal(10,2) DEFAULT NULL,
  `meanbuyprice` decimal(10,2) DEFAULT NULL,
  `storeid` int(11) NOT NULL,
  `productcode` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `billsproductsbuy`
--

CREATE TABLE IF NOT EXISTS `billsproductsbuy` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `billid` int(11) unsigned DEFAULT NULL,
  `productid` int(11) unsigned DEFAULT NULL,
  `note` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `productno` int(10) unsigned DEFAULT NULL,
  `productprice` decimal(10,2) unsigned DEFAULT NULL,
  `producttotalprice` decimal(10,2) DEFAULT NULL,
  `deleted` int(11) DEFAULT '0',
  `service` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `retproductno` int(11) DEFAULT '0' COMMENT 'no of returned product',
  `rondomtxt` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `lastbuyprice` decimal(10,2) DEFAULT NULL,
  `meanbuyprice` decimal(10,2) DEFAULT NULL,
  `storeid` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `billsreturn`
--

CREATE TABLE IF NOT EXISTS `billsreturn` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `billid` int(11) DEFAULT NULL,
  `returnedprice` decimal(10,2) DEFAULT '0',
  `clientreceivevalue` decimal(10,2) DEFAULT '0',
  `date` date DEFAULT NULL,
  `deleted` int(11) DEFAULT '0',
  `dailyentryid` int(11) DEFAULT NULL,
  `userid` int(11) DEFAULT NULL,
  `branchid` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `billsreturnproducts`
--

CREATE TABLE IF NOT EXISTS `billsreturnproducts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `productid` int(11) DEFAULT NULL,
  `returnbillid` int(11) DEFAULT NULL,
  `productno` int(11) DEFAULT '0',
  `productprice` decimal(10,2) DEFAULT NULL,
  `producttotalprice` decimal(10,2) DEFAULT NULL,
  `deleted` int(11) DEFAULT '0',
  `billproductid` int(11) DEFAULT NULL,
  `lastbuyprice` decimal(10,2) DEFAULT NULL,
  `meanbuyprice` decimal(10,2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `billtemplate`
--

CREATE TABLE IF NOT EXISTS `billtemplate` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(300) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `billtemplatedetail`
--

CREATE TABLE IF NOT EXISTS `billtemplatedetail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `billTemplateId` int(11) NOT NULL,
  `type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 sell,1 ret',
  `parcode` varchar(255) NOT NULL,
  `productid` int(11) NOT NULL,
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `unitid` int(11) NOT NULL DEFAULT '-1',
  `quantity` float NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `bind`
--

CREATE TABLE IF NOT EXISTS `bind` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `employeeid` int(11) DEFAULT NULL,
  `bindtype` int(11) DEFAULT NULL COMMENT '1 : save - 0 : bank',
  `saveid` int(11) DEFAULT NULL,
  `savevalue` decimal(10,2) DEFAULT NULL,
  `bankid` int(11) DEFAULT NULL,
  `bankaccount` int(11) DEFAULT NULL,
  `ckekno` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `benefitname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ckekvalue` decimal(10,2) DEFAULT NULL,
  `dailyentryid` int(11) DEFAULT NULL,
  `userid` int(11) DEFAULT NULL,
  `binddate` date DEFAULT NULL,
  `deleted` int(11) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `bindsettlement`
--

CREATE TABLE IF NOT EXISTS `bindsettlement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `userid` int(11) DEFAULT NULL,
  `employeeid` int(11) DEFAULT NULL,
  `settlementway` int(11) DEFAULT NULL COMMENT '1 : masroufat - 2 saves',
  `settlementwayid` int(11) DEFAULT NULL,
  `projectid` int(11) DEFAULT NULL,
  `value` decimal(10,2) DEFAULT NULL,
  `comment` text COLLATE utf8mb4_unicode_ci,
  `deleted` int(11) DEFAULT '0',
  `dailyentryid` int(11) DEFAULT NULL,
  `groupno` int(11) DEFAULT '0',
  `group` int(11) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='تسوية عهده ' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `branch`
--

CREATE TABLE IF NOT EXISTS `branch` (
  `branchId` int(11) NOT NULL AUTO_INCREMENT,
  `branchName` varchar(255) NOT NULL,
  `branchDate` date NOT NULL,
  `phone` varchar(255) NOT NULL,
  `mobile` varchar(255) NOT NULL,
  `branchNo` int(11) DEFAULT NULL,
  `branchAddress` varchar(255) DEFAULT NULL,
  `message` text NOT NULL,
  `logo` varchar(255) NOT NULL,
  `branchTaxNo` varchar(255) NOT NULL,
  PRIMARY KEY (`branchId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;

--
-- Dumping data for table `branch`
--

INSERT INTO `branch` (`branchId`, `branchName`, `branchDate`, `phone`, `mobile`, `branchNo`, `branchAddress`, `message`, `logo`, `branchTaxNo`) VALUES
(0, 'ÙƒÙ„ Ø§Ù„ÙØ±ÙˆØ¹', '0000-00-00', '', '', NULL, NULL, '', '', '');

-- --------------------------------------------------------

--
-- Table structure for table `buyandruternbill`
--

CREATE TABLE IF NOT EXISTS `buyandruternbill` (
  `buybillid` int(11) NOT NULL AUTO_INCREMENT,
  `buybillSerial` varchar(255) DEFAULT NULL,
  `buybilldate` datetime DEFAULT NULL,
  `buybillsupplierid` int(11) NOT NULL,
  `buybilltotaldeptbefor` decimal(10,2) NOT NULL,
  `buybilltotaldeptafter` decimal(10,2) NOT NULL,
  `buybilldiscount` varchar(255) NOT NULL DEFAULT '',
  `buybilldiscountrype` int(11) NOT NULL DEFAULT '0',
  `buybilltotalbill` decimal(10,2) NOT NULL,
  `buybillaftertotalbill` decimal(10,2) NOT NULL,
  `buybilltotalpayed` decimal(10,2) NOT NULL,
  `buybillfinalbill` decimal(10,2) NOT NULL,
  `buybillstoreid` int(11) NOT NULL,
  `buybillsysdate` datetime NOT NULL,
  `comment` text NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `buybillclientname` varchar(255) NOT NULL DEFAULT '',
  `buybillsaveid` int(11) NOT NULL,
  `buybilldirectpayment` int(11) NOT NULL DEFAULT '0' COMMENT '',
  `billnameid` int(11) NOT NULL,
  `deletedbuyid` int(11) DEFAULT NULL,
  `controlname` varchar(255) NOT NULL,
  `payedtax` decimal(10,2) NOT NULL DEFAULT '0',
  `costcenterid` int(11) DEFAULT '0',
  `dailyentryid` varchar(100) NOT NULL DEFAULT '',
  `delbyuserid` int(11) NOT NULL DEFAULT '0',
  `currencyId` int(11) NOT NULL DEFAULT '1',
  `taxOfDiscountPer` float NOT NULL DEFAULT '0',
  `taxOfDiscountVal` float NOT NULL DEFAULT '0',
  `client` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`buybillid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `buyandruternbillcurr`
--

CREATE TABLE IF NOT EXISTS `buyandruternbillcurr` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `buybillid` int(11) NOT NULL,
  `conversionFactor` float NOT NULL DEFAULT '1',
  `buybilldiscountC` varchar(255) NOT NULL DEFAULT '',
  `buybilltotalbillC` decimal(10,2) NOT NULL,
  `buybillaftertotalbillC` decimal(10,2) NOT NULL,
  `buybilltotalpayedC` decimal(10,2) NOT NULL,
  `buybillfinalbillC` decimal(10,2) NOT NULL,
  `buybilldirectpaymentC` int(11) NOT NULL DEFAULT '0',
  `payedtaxC` decimal(10,2) NOT NULL DEFAULT '0.00',
  `saveConversionFactor` float NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `buyandruternbilldetail`
--

CREATE TABLE IF NOT EXISTS `buyandruternbilldetail` (
  `Parcode` varchar(255) NOT NULL DEFAULT '',
  `buybilldetailid` int(11) NOT NULL AUTO_INCREMENT,
  `buybillid` int(11) NOT NULL,
  `buybilldetailcatid` int(11) NOT NULL,
  `buybilldetailproductid` int(11) NOT NULL,
  `buybilldetailquantity` decimal(10,2) NOT NULL,
  `buybilldetailprice` decimal(10,2) NOT NULL,
  `buybilldetailtotalprice` decimal(10,2) NOT NULL,
  `discountvalue` decimal(10,2) NOT NULL,
  `note` varchar(256) DEFAULT NULL,
  `buybilldetaildate` date NOT NULL,
  `billtype` int(11) NOT NULL COMMENT '0 for buy 1 for return',
  `productunitid` int(11) NOT NULL,
  `lastbuyprice` decimal(10,2) DEFAULT NULL,
  `meanbuyprice` decimal(10,2) DEFAULT NULL,
  `lastbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `otherdetailquantity` int(11) NOT NULL DEFAULT '0',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `quantitybefore` decimal(10,2) DEFAULT NULL,
  `buybilldetailpriceC` decimal(10,2) NOT NULL,
  `buybilldetailtotalpriceC` decimal(10,2) NOT NULL,
  `discountvalueC` decimal(10,2) NOT NULL,
  `discounttype` decimal(10,2) NOT NULL DEFAULT '0' COMMENT 'discount percentage like 5%',
  `rowtaxval` decimal(10,2) NOT NULL,
  `rowtaxper` decimal(10,2) NOT NULL DEFAULT '0' COMMENT 'like 5%',
  `lastbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `lastbuyprice_withDiscountAndTax` decimal(10,2) DEFAULT NULL,
  PRIMARY KEY (`buybilldetailid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `buybill`
--

CREATE TABLE IF NOT EXISTS `buybill` (
  `buybillid` int(11) NOT NULL AUTO_INCREMENT,
  `buybillSerial` varchar(255) DEFAULT NULL,
  `buybilldate` datetime DEFAULT NULL,
  `buybillsupplierid` int(11) NOT NULL,
  `buybilltotaldeptbefor` decimal(10,2) NOT NULL,
  `buybilltotaldeptafter` decimal(10,2) NOT NULL,
  `buybilldiscount` varchar(255) NOT NULL DEFAULT '',
  `buybilldiscountrype` int(11) NOT NULL DEFAULT '0',
  `buybilltotalbill` decimal(10,2) NOT NULL,
  `buybillaftertotalbill` decimal(10,2) NOT NULL,
  `buybilltotalpayed` decimal(10,2) NOT NULL,
  `buybillfinalbill` decimal(10,2) NOT NULL,
  `buybillstoreid` int(11) NOT NULL,
  `buybillsysdate` datetime NOT NULL,
  `comment` text NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `buybillclientname` varchar(255) NOT NULL DEFAULT '',
  `buybillsaveid` int(11) NOT NULL,
  `buybilldirectpayment` int(11) NOT NULL DEFAULT '0' COMMENT '',
  `billnameid` int(11) NOT NULL,
  `deletedbuyid` int(11) DEFAULT NULL,
  `controlname` varchar(255) NOT NULL,
  `payedtax` decimal(10,2) NOT NULL DEFAULT '0',
  `costcenterid` int(11) DEFAULT '0',
  `dailyentryid` varchar(100) NOT NULL DEFAULT '',
  `delbyuserid` int(11) NOT NULL DEFAULT '0',
  `currencyId` int(11) NOT NULL DEFAULT '1',
  `taxOfDiscountPer` float NOT NULL DEFAULT '0',
  `taxOfDiscountVal` float NOT NULL DEFAULT '0',
  `files` text NOT NULL DEFAULT '',
  `client` int(11) NOT NULL DEFAULT '0',
  `totalBuyDiscountVal` decimal(10,2) NOT NULL DEFAULT '0',
  PRIMARY KEY (`buybillid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `buybillcurr`
--

CREATE TABLE IF NOT EXISTS `buybillcurr` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `buybillid` int(11) NOT NULL,
  `conversionFactor` float NOT NULL DEFAULT '1',
  `buybilldiscountC` varchar(255) NOT NULL DEFAULT '',
  `buybilltotalbillC` decimal(10,2) NOT NULL,
  `buybillaftertotalbillC` decimal(10,2) NOT NULL,
  `buybilltotalpayedC` decimal(10,2) NOT NULL,
  `buybillfinalbillC` decimal(10,2) NOT NULL,
  `buybilldirectpaymentC` int(11) NOT NULL DEFAULT '0',
  `payedtaxC` decimal(10,2) NOT NULL DEFAULT '0.00',
  `saveConversionFactor` float NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `buybilldetail`
--

CREATE TABLE IF NOT EXISTS `buybilldetail` (
  `Parcode` varchar(255) NOT NULL DEFAULT '',
  `buybilldetailid` int(11) NOT NULL AUTO_INCREMENT,
  `buybillid` int(11) NOT NULL,
  `buybilldetailcatid` int(11) NOT NULL,
  `buybilldetailproductid` int(11) NOT NULL,
  `buybilldetailquantity` decimal(10,2) NOT NULL,
  `buybilldetailprice` decimal(10,2) NOT NULL,
  `buybilldetailtotalprice` decimal(10,2) NOT NULL,
  `discountvalue` decimal(10,2) NOT NULL,
  `note` varchar(256) DEFAULT NULL,
  `buybilldetaildate` date NOT NULL,
  `productunitid` int(11) NOT NULL,
  `lastbuyprice` decimal(10,2) DEFAULT NULL,
  `meanbuyprice` decimal(10,2) DEFAULT NULL,
  `lastbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `otherdetailquantity` int(11) NOT NULL DEFAULT '0',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `quantitybefore` decimal(10,2) DEFAULT NULL,
  `buybilldetailpriceC` decimal(10,2) NOT NULL,
  `buybilldetailtotalpriceC` decimal(10,2) NOT NULL,
  `discountvalueC` decimal(10,2) NOT NULL,
  `discounttype` decimal(10,2) NOT NULL DEFAULT '0' COMMENT 'discount percentage like 5%',
  `rowtaxval` decimal(10,2) NOT NULL,
  `rowtaxper` decimal(10,2) NOT NULL DEFAULT '0' COMMENT 'like 5%',
  `lastbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `probuyDiscountPer` FLOAT NOT NULL DEFAULT '0',
  `lastbuyprice_withDiscountAndTax` decimal(10,2) DEFAULT NULL,
  PRIMARY KEY (`buybilldetailid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `buybilldetailoffer`
--

CREATE TABLE IF NOT EXISTS `buybilldetailoffer` (
  `Parcode` varchar(255) NOT NULL DEFAULT '',
  `buybilldetailid` int(11) NOT NULL AUTO_INCREMENT,
  `buybillid` int(11) NOT NULL,
  `buybilldetailcatid` int(11) NOT NULL,
  `buybilldetailproductid` int(11) NOT NULL,
  `buybilldetailquantity` decimal(10,2) NOT NULL,
  `buybilldetailprice` decimal(10,2) NOT NULL,
  `buybilldetailtotalprice` decimal(10,2) NOT NULL,
  `discountvalue` decimal(10,2) NOT NULL,
  `note` varchar(256) DEFAULT NULL,
  `buybilldetaildate` date NOT NULL,
  `productunitid` int(11) NOT NULL,
  `lastbuyprice` decimal(10,2) DEFAULT NULL,
  `meanbuyprice` decimal(10,2) DEFAULT NULL,
  `lastbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `otherdetailquantity` int(11) NOT NULL DEFAULT '0',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `quantitybefore` decimal(10,2) DEFAULT NULL,
  `buybilldetailpriceC` decimal(10,2) NOT NULL,
  `buybilldetailtotalpriceC` decimal(10,2) NOT NULL,
  `discountvalueC` decimal(10,2) NOT NULL,
  `discountper` decimal(10,2) NOT NULL DEFAULT '0.00',
  `discounttype` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'discount percentage like 5%',
  PRIMARY KEY (`buybilldetailid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `buybilloffer`
--

CREATE TABLE IF NOT EXISTS `buybilloffer` (
  `buybillid` int(11) NOT NULL AUTO_INCREMENT,
  `buybillSerial` varchar(255) DEFAULT NULL,
  `buybilldate` datetime DEFAULT NULL,
  `buybillsupplierid` int(11) NOT NULL,
  `buybilltotaldeptbefor` decimal(10,2) NOT NULL,
  `buybilltotaldeptafter` decimal(10,2) NOT NULL,
  `buybilldiscount` varchar(255) NOT NULL DEFAULT '',
  `buybilldiscountrype` int(11) NOT NULL DEFAULT '0',
  `buybilltotalbill` decimal(10,2) NOT NULL,
  `buybillaftertotalbill` decimal(10,2) NOT NULL,
  `buybilltotalpayed` decimal(10,2) NOT NULL,
  `buybillfinalbill` decimal(10,2) NOT NULL,
  `buybillstoreid` int(11) NOT NULL,
  `buybillsysdate` datetime NOT NULL,
  `comment` text NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `buybillclientname` varchar(255) NOT NULL DEFAULT '',
  `buybillsaveid` int(11) NOT NULL,
  `buybilldirectpayment` int(11) NOT NULL DEFAULT '0' COMMENT '',
  `billnameid` int(11) NOT NULL,
  `deletedbuyid` int(11) DEFAULT NULL,
  `controlname` varchar(255) NOT NULL,
  `payedtax` decimal(10,2) NOT NULL DEFAULT '0.00',
  `costcenterid` int(11) DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `delbyuserid` int(11) NOT NULL DEFAULT '0',
  `currencyId` int(11) NOT NULL DEFAULT '1',
  `orderSavedBillId` int(11) NOT NULL DEFAULT '0',
  `taxOfDiscountPer` float NOT NULL DEFAULT '0',
  `taxOfDiscountVal` float NOT NULL DEFAULT '0',
  PRIMARY KEY (`buybillid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `buypriceshistorybook`
--

CREATE TABLE IF NOT EXISTS `buypriceshistorybook` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `theDate` date NOT NULL,
  `storeId` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `sizeid` int(11) NOT NULL,
  `colorid` int(11) NOT NULL,
  `buyprice` decimal(10,2) NOT NULL,
  `buyQuantity` decimal(10,2) NOT NULL,
  `sellQuantity` decimal(10,2) NOT NULL,
  `del` tinyint(4) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysDate` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `theDate` (`theDate`,`storeId`,`productid`,`sizeid`,`colorid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `capital`
--

CREATE TABLE IF NOT EXISTS `capital` (
  `capitalid` int(11) NOT NULL AUTO_INCREMENT,
  `capitalamount` double NOT NULL,
  `treeId` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`capitalid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `cashtransfer`
--

CREATE TABLE IF NOT EXISTS `cashtransfer` (
  `cashtransferid` int(11) NOT NULL AUTO_INCREMENT,
  `bankaccountid` int(11) NOT NULL,
  `saveid` int(11) NOT NULL,
  `accountbeforevalue` decimal(10,2) NOT NULL,
  `cashtransferuser` varchar(256) DEFAULT NULL,
  `cashtransferamount` decimal(10,2) NOT NULL,
  `cashtransferdate` date NOT NULL,
  `cashtransfernote` varchar(600) DEFAULT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `cashtransfernumber` decimal(55,2) NOT NULL,
  `type` int(11) NOT NULL DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`cashtransferid`),
  KEY `bankaccountid` (`bankaccountid`,`saveid`),
  KEY `saveid` (`saveid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `checkcontroller`
--

CREATE TABLE IF NOT EXISTS `checkcontroller` (
  `checkControllerid` int(11) NOT NULL AUTO_INCREMENT,
  `checkid` int(11) NOT NULL,
  `controllerid` int(11) NOT NULL,
  `type` varchar(255) NOT NULL,
  PRIMARY KEY (`checkControllerid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `checkdeposit`
--

CREATE TABLE IF NOT EXISTS `checkdeposit` (
  `checkdepositid` int(11) NOT NULL AUTO_INCREMENT,
  `bankaccountid` int(11) NOT NULL,
  `clientid` int(11) NOT NULL,
  `checkdepositnumber` int(11) NOT NULL,
  `checkdeposituser` varchar(256) DEFAULT NULL,
  `checkdepositamount` decimal(10,2) NOT NULL,
  `checkdepositdate` date NOT NULL,
  `checkdepositnote` varchar(600) DEFAULT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `accountbeforevalue` decimal(10,2) NOT NULL,
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `checkdate` date DEFAULT NULL,
  PRIMARY KEY (`checkdepositid`),
  KEY `bankaccountid` (`bankaccountid`,`clientid`),
  KEY `clientid` (`clientid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `checkwithdrawal`
--

CREATE TABLE IF NOT EXISTS `checkwithdrawal` (
  `checkwithdrawalid` int(11) NOT NULL AUTO_INCREMENT,
  `bankaccountid` int(11) NOT NULL,
  `supplierid` int(11) NOT NULL,
  `accountbeforevalue` decimal(10,2) NOT NULL,
  `checkwithdrawaluser` varchar(256) DEFAULT NULL,
  `checkwithdrawalamount` decimal(10,2) NOT NULL,
  `checkwithdrawaldate` date NOT NULL,
  `checkwithdrawalnote` varchar(600) DEFAULT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `checkwithdrawalnumber` decimal(13,0) NOT NULL,
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`checkwithdrawalid`),
  KEY `bankaccountid` (`bankaccountid`,`supplierid`),
  KEY `supplierid` (`supplierid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `client`
--

CREATE TABLE IF NOT EXISTS `client` (
  `clientid` int(11) NOT NULL AUTO_INCREMENT,
  `clientname` varchar(256) NOT NULL,
  `clientaddress` varchar(256) DEFAULT NULL,
  `clientphone` varchar(20) DEFAULT NULL,
  `clientmobile` varchar(20) DEFAULT NULL,
  `clientdebt` decimal(10,2) NOT NULL DEFAULT '0',
  `clientdetails` text,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `clientdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `branchId` int(11) DEFAULT '0',
  `clientareaid` int(11) NOT NULL DEFAULT '0',
  `clientcode` varchar(255) DEFAULT NULL,
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `rondomtxt` varchar(255) DEFAULT NULL,
  `clientStoreIds` varchar(255) NOT NULL DEFAULT '0' COMMENT 'for sell bills',
  `obygyPatientId` int(11) DEFAULT NULL,
  `debtLimit` decimal(10,2) NOT NULL DEFAULT '0',
  `typeclientid` varchar(255) NOT NULL DEFAULT '0',
  `priceTypeId` int(11) NOT NULL DEFAULT '0',
  `lastEditUser` int(11) NOT NULL DEFAULT '0',
  `inUse` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 free - 1 in use means to stop changing debt till it is free again',
  `card_number` int(11) NOT NULL,
  `file_faida` varchar(255) NOT NULL,
  `specialDiscount` tinyint(4) NOT NULL DEFAULT '0',
  `specialDiscountVal` float NOT NULL DEFAULT '0',
  `file` varchar(255) NOT NULL,
  `addDate` date NOT NULL COMMENT 'add date of client ,dont change it again',
  `mandobCollectRatio` float NOT NULL DEFAULT '0',
  `webApiId` int(11) NOT NULL DEFAULT '0',
  `clientRFID` varchar(20) DEFAULT NULL,
  `linkedSupplierId` int(11) NOT NULL DEFAULT '0',
  `postponeDays` int(11) NOT NULL DEFAULT '0',
  `studentid` int(11) NOT NULL DEFAULT '0',
  `taxnumber` varchar(255) DEFAULT NULL,
  `password` varchar(256) NOT NULL,
  `clientTypeForTree` tinyint(4) NOT NULL DEFAULT '0' COMMENT '',
  `treeId` int(11) NOT NULL DEFAULT '0',
  `husbandNameObgy` varchar(256) NOT NULL,
  `txtNameE` varchar(256) NOT NULL,
  `facility` varchar(256) NOT NULL,
  `delegate` varchar(256) NOT NULL,
  `txtemail` varchar(256) NOT NULL,
  `commercial` varchar(256) NOT NULL,
  `valtaxnumber` varchar(256) NOT NULL,
  `clientaddress2` varchar(256) DEFAULT NULL,
  `country` varchar(256) DEFAULT NULL,
  `delegateid` int(11) NOT NULL DEFAULT '0',
  `datecustomeraccount` date NOT NULL,
  PRIMARY KEY (`clientid`),
  KEY `typeclientid` (`typeclientid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `clientarea`
--

CREATE TABLE IF NOT EXISTS `clientarea` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `comment` text NOT NULL,
  `associatedtag_id` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `clientdebtchange`
--

CREATE TABLE IF NOT EXISTS `clientdebtchange` (
  `clientdebtchangeid` int(11) NOT NULL AUTO_INCREMENT,
  `clientid` int(11) NOT NULL,
  `clientdebtchangebefore` decimal(10,3) NOT NULL,
  `clientdebtchangeamount` decimal(10,3) NOT NULL,
  `clientdebtchangetype` int(11) NOT NULL DEFAULT '0' COMMENT '0 => plus- 1 => minus',
  `processname` varchar(500) NOT NULL,
  `clientdebtchangemodelid` int(11) NOT NULL,
  `clientdebtchangeafter` decimal(10,3) NOT NULL,
  `clientdebtchangedate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `tablename` varchar(256) NOT NULL,
  `comment` text,
  `totalOperationCost` decimal(10,2) NOT NULL DEFAULT '0' COMMENT '',
  `discount` decimal(10,2) DEFAULT '0',
  `reciptid` int(11) DEFAULT '0',
  `del` int(11) NOT NULL DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `num` int(11) DEFAULT NULL,
  `billid` int(11) DEFAULT NULL,
  `paytype` varchar(255) DEFAULT NULL,
  `seller` int(11) NOT NULL DEFAULT '0',
  `discountearlyRepayment` decimal(10,2) DEFAULT NULL,
  `costcenterid` int(11) NOT NULL DEFAULT '0',
  `currencyId` int(11) NOT NULL,
  `conversionFactor` float NOT NULL,
  `payedInCurrency` decimal(10,2) NOT NULL,
  `saveConversionFactor` float NOT NULL,
  `userSelectedDate` datetime NOT NULL,
  `paySerialNo` int(11) NOT NULL,
  `totalpayments` decimal(10,3) NOT NULL,
  PRIMARY KEY (`clientdebtchangeid`),
  KEY `clientid` (`clientid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `clientpaymentreceiptt`
--

CREATE TABLE IF NOT EXISTS `clientpaymentreceiptt` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clientid` int(11) NOT NULL,
  `billid` int(11) NOT NULL,
  `payedtype` int(11) NOT NULL COMMENT '0 ',
  `paymethod` int(11) NOT NULL,
  `debtbefore` decimal(10,2) NOT NULL,
  `payed` decimal(10,2) NOT NULL,
  `debtafter` decimal(10,2) NOT NULL,
  `biltype` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` date NOT NULL,
  `del` int(11) NOT NULL,
  `dailyentryid` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `clinic`
--

CREATE TABLE IF NOT EXISTS `clinic` (
  `id` int(6) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8 NOT NULL,
  `description` text CHARACTER SET utf8 NOT NULL,
  `tempdel` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `collectedparcodestemp`
--

CREATE TABLE IF NOT EXISTS `collectedparcodestemp` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `userid` int(11) NOT NULL,
  `sellerid` int(11) NOT NULL,
  `parcodes` text NOT NULL,
  `sysdate` datetime NOT NULL,
  `conditions` tinyint(4) NOT NULL COMMENT '0 new,1 being done as sellbill , 2 completed',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `commentclient`
--

CREATE TABLE IF NOT EXISTS `commentclient` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clientid` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `comments` text NOT NULL,
  `commentdate` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `costcenter`
--

CREATE TABLE IF NOT EXISTS `costcenter` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `comment` text NOT NULL,
  `condation` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `costcenterdetail`
--

CREATE TABLE IF NOT EXISTS `costcenterdetail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `costcenterid` int(11) NOT NULL,
  `type` int(11) NOT NULL COMMENT '0 for sell 1 for return sell 2 for selland return 3 for buy 4 for return buy 5 for buyand return 6 for expeneses 7 for income 8 for salary 9 withdrow 10borrow 11 Advance payment directly-12 expenseexchange-13 bindsettlement',
  `processname` text NOT NULL,
  `modelid` int(11) NOT NULL,
  `tablename` varchar(255) NOT NULL,
  `costdate` date NOT NULL,
  `uesrid` int(11) NOT NULL,
  `del` int(11) NOT NULL,
  `costamount` decimal(10,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `country`
--

CREATE TABLE IF NOT EXISTS `country` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `nameen` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `currency`
--

CREATE TABLE IF NOT EXISTS `currency` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `symbol` varchar(100) NOT NULL,
  `conversionFactor` float NOT NULL DEFAULT '1',
  `conditions` tinyint(4) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysDate` datetime NOT NULL,
  `otherconversionFactor` float NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `dailyentry`
--

CREATE TABLE IF NOT EXISTS `dailyentry` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `totalcreditor` decimal(10,2) NOT NULL COMMENT '',
  `totaldebtor` decimal(10,2) NOT NULL COMMENT '',
  `thedate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `condition` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 not del',
  `reverseofid` int(11) NOT NULL DEFAULT '0',
  `dDateTime` datetime NOT NULL,
  `entryComment` text,
  `fromFlag` int(11) NOT NULL COMMENT '0entry from daily entry controller-1 entry from program plugins-2 from plugins that use affectplugin()"like case 0" it makes daily entry and automatically affect plugins like ÃƒÆ’Ã†â€™Ãƒâ€ Ã¢â‚¬â„¢ÃƒÆ’Ã¢â‚¬Â ÃƒÂ¢Ã¢â€šÂ¬Ã¢â€žÂ¢ÃƒÆ’Ã†â€™ÃƒÂ¢Ã¢â€šÂ¬Ã‚Â ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â‚¬Å¡Ã‚Â¬ÃƒÂ¢Ã¢â‚¬Å¾Ã‚Â¢ÃƒÆ’Ã†â€™Ãƒâ€ Ã¢â‚¬â„¢ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â‚¬Å¡Ã‚Â¬Ãƒâ€šÃ‚Â ÃƒÆ’Ã†â€™Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â€šÂ¬Ã…Â¡Ãƒâ€šÃ‚Â¬ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â€šÂ¬Ã…Â¾Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã†â€™Ãƒâ€ Ã¢â‚¬â„¢ÃƒÆ’Ã¢â‚¬Â ÃƒÂ¢Ã¢â€šÂ¬Ã¢â€žÂ¢ÃƒÆ’Ã†â€™Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â€šÂ¬Ã…Â¡Ãƒâ€šÃ‚Â¬ÃƒÆ’Ã¢â‚¬Å¡Ãƒâ€šÃ‚Â ÃƒÆ’Ã†â€™Ãƒâ€ Ã¢â‚¬â„¢ÃƒÆ’Ã¢â‚¬Å¡Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã†â€™Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â‚¬Å¡Ã‚Â¬Ãƒâ€¦Ã‚Â¡ÃƒÆ’Ã¢â‚¬Å¡Ãƒâ€šÃ‚Â¬ÃƒÆ’Ã†â€™Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â‚¬Å¡Ã‚Â¬Ãƒâ€¦Ã‚Â¾ÃƒÆ’Ã¢â‚¬Å¡Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã†â€™Ãƒâ€ Ã¢â‚¬â„¢ÃƒÆ’Ã¢â‚¬Â ÃƒÂ¢Ã¢â€šÂ¬Ã¢â€žÂ¢ÃƒÆ’Ã†â€™ÃƒÂ¢Ã¢â€šÂ¬Ã‚Â ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â‚¬Å¡Ã‚Â¬ÃƒÂ¢Ã¢â‚¬Å¾Ã‚Â¢ÃƒÆ’Ã†â€™Ãƒâ€ Ã¢â‚¬â„¢ÃƒÆ’Ã¢â‚¬Å¡Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã†â€™Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â‚¬Å¡Ã‚Â¬Ãƒâ€¦Ã‚Â¡ÃƒÆ’Ã¢â‚¬Å¡Ãƒâ€šÃ‚Â¬ÃƒÆ’Ã†â€™ÃƒÂ¢Ã¢â€šÂ¬Ã…Â¡ÃƒÆ’Ã¢â‚¬Å¡Ãƒâ€šÃ‚Â ÃƒÆ’Ã†â€™Ãƒâ€ Ã¢â‚¬â„¢ÃƒÆ’Ã¢',
  `related` int(11) NOT NULL COMMENT 'rows has the same no are related "dailyentrymany one entry"',
  `branchid` int(11) DEFAULT '0',
  `isopeningentry` tinyint(4) NOT NULL DEFAULT '0',
  `operationId` int(11) NOT NULL,
  `operationDetailLink` text NOT NULL,
  PRIMARY KEY (`id`),
  KEY `thedate` (`thedate`),
  KEY `related` (`related`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `dailyentrycreditor`
--

CREATE TABLE IF NOT EXISTS `dailyentrycreditor` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `dailyentryid` int(11) NOT NULL,
  `accountstreeid` int(11) NOT NULL,
  `value` decimal(10,2) NOT NULL,
  `dComment` varchar(300) NOT NULL,
  `costcenterid` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `dailyentryid` (`dailyentryid`),
  KEY `accountstreeid` (`accountstreeid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `dailyentrydebtor`
--

CREATE TABLE IF NOT EXISTS `dailyentrydebtor` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `dailyentryid` int(11) NOT NULL,
  `accountstreeid` int(11) NOT NULL,
  `value` decimal(10,2) NOT NULL,
  `dComment` varchar(300) NOT NULL,
  `costcenterid` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `dailyentryid` (`dailyentryid`),
  KEY `accountstreeid` (`accountstreeid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `damagedproduct`
--

CREATE TABLE IF NOT EXISTS `damagedproduct` (
  `damagedProductId` int(11) NOT NULL AUTO_INCREMENT,
  `productId` int(11) NOT NULL,
  `measurUnitId` int(11) NOT NULL,
  `productQuantity` int(11) NOT NULL,
  `cost` int(11) NOT NULL,
  `productionOrderId` int(11) NOT NULL,
  `operationDate` date NOT NULL,
  `userID` int(11) NOT NULL,
  `storeId` int(11) NOT NULL,
  PRIMARY KEY (`damagedProductId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `datedchecked`
--

CREATE TABLE IF NOT EXISTS `datedchecked` (
  `addType` int(11) NOT NULL COMMENT '0 for client 1 for supplier',
  `datedCheckedID` int(11) NOT NULL AUTO_INCREMENT,
  `bankName` varchar(255) NOT NULL,
  `accountNo` int(11) NOT NULL,
  `checkValue` int(11) NOT NULL,
  `checkNo` int(11) NOT NULL,
  `dueDate` date NOT NULL,
  `antherDetailes` varchar(255) NOT NULL,
  `done` int(11) NOT NULL COMMENT '0 for not done - 1 for done - 2 for cancaled - 3 for endoursed',
  `operationDate` date NOT NULL,
  `userID` int(11) NOT NULL,
  `clientNum` int(11) NOT NULL COMMENT 'clientNum = clientId',
  `resonForRefused` varchar(255) NOT NULL,
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `checkdate` date DEFAULT NULL,
  `endorsePersonId` int(11) DEFAULT NULL COMMENT 'often id of supplier ',
  `endorseComment` text,
  `endorseDate` date DEFAULT NULL,
  `paperType` tinyint(4) NULL DEFAULT '0',
  `bankid` int(11) NULL DEFAULT '0' ,
  `accountid` int(11) NULL DEFAULT '0',
  PRIMARY KEY (`datedCheckedID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `discountcontrol`
--

CREATE TABLE IF NOT EXISTS `discountcontrol` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `totalFrom` float NOT NULL,
  `totalTo` float NOT NULL,
  `discount` float NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `conditions` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `doctorkashf`
--

CREATE TABLE IF NOT EXISTS `doctorkashf` (
  `id` int(6) NOT NULL AUTO_INCREMENT,
  `rdsphere` text NOT NULL,
  `rnsphere` text NOT NULL,
  `rdcylinder` text NOT NULL,
  `rncylinder` text NOT NULL,
  `rdaxis` text NOT NULL,
  `rnaxis` text NOT NULL,
  `rdprism` text NOT NULL,
  `rnprism` text NOT NULL,
  `rdva` text NOT NULL,
  `rnva` text NOT NULL,
  `ldsphere` text NOT NULL,
  `lnsphere` text NOT NULL,
  `ldcylinder` text NOT NULL,
  `lncylinder` text NOT NULL,
  `ldaxis` text NOT NULL,
  `lnaxis` text NOT NULL,
  `ldprism` text NOT NULL,
  `lnprism` text NOT NULL,
  `ldva` text NOT NULL,
  `lnva` text NOT NULL,
  `customerid` int(6) NOT NULL,
  `kashfid` int(11) NOT NULL DEFAULT '0',
  `doctorid` int(11) NOT NULL,
  `date` date NOT NULL,
  `loguserid` int(11) NOT NULL DEFAULT '0',
  `branchid` int(11) NOT NULL DEFAULT '0',
  `rondomtxt` varchar(255) DEFAULT NULL,
  `uploaddate` datetime DEFAULT NULL,
  `offline` int(11) DEFAULT '0' COMMENT ' 1 offline - 0 online ',
  `radd` text,
  `rbiofocal` text,
  `ladd` text,
  `lbiofocal` text,
  `pd` text,
  `bvd` text,
  `notes` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `ebillsetting`
--

CREATE TABLE IF NOT EXISTS `ebillsetting` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `eTaxNum` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `eTaxNumBranch` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `eGovernorate` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `eCity` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `eStreet` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
  `eBuildingNum` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `eTaxType` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL,
  `eTaxTypeNum` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `eCompanyNameInTaxCard` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `eunitInTax` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employee`
--

CREATE TABLE IF NOT EXISTS `employee` (
  `employeeId` int(11) NOT NULL AUTO_INCREMENT,
  `employeeName` varchar(256) NOT NULL,
  `employeeBOD` date DEFAULT NULL,
  `employeeAddress` text,
  `employeePhone` varchar(256) DEFAULT NULL,
  `employeeSalary` decimal(10,2) NOT NULL DEFAULT '0',
  `employeeBouns` decimal(10,2) NOT NULL DEFAULT '0',
  `employeeDate` datetime NOT NULL,
  `conditions` int(1) NOT NULL DEFAULT '0',
  `userId` int(11) NOT NULL,
  `username` varchar(256) NOT NULL,
  `empdept` int(11) NOT NULL DEFAULT '0',
  `isworker` int(11) NOT NULL DEFAULT '0' COMMENT '0 for yes 1 for no',
  `Hourlyrate` decimal(10,2) NOT NULL DEFAULT '0',
  `houseAllowance` decimal(10,2) NOT NULL,
  `transportationAllowance` decimal(10,2) NOT NULL,
  `otherAllowance` decimal(10,2) NOT NULL,
  `nationality` varchar(256) NOT NULL,
  `religion` varchar(256) NOT NULL,
  `noOfWorkDaysPerMonth` int(11) NOT NULL,
  `noOfWorkHoursDaysPerDay` int(11) NOT NULL,
  `noOfDistountDaysWhenAbsences` int(11) NOT NULL,
  `contract` varchar(255) NOT NULL,
  `residence` varchar(255) NOT NULL,
  `personalPhoto` varchar(255) NOT NULL,
  `healthCard` varchar(255) NOT NULL,
  `visa` varchar(255) NOT NULL,
  `passport` varchar(255) NOT NULL,
  `minuteLateCost` decimal(10,2) NOT NULL,
  `dayAbsencesCost` decimal(10,2) NOT NULL,
  `graduate` varchar(255) NOT NULL,
  `expert1` varchar(255) NOT NULL,
  `expert2` varchar(255) NOT NULL,
  `expert3` varchar(255) NOT NULL,
  `employeegroupid` int(11) NOT NULL,
  `employeesubgroupid` int(11) NOT NULL,
  `halfHourLateWithPermissionDisount` float NOT NULL,
  `hourLateWithPermissionDisount` float NOT NULL,
  `hourAndHalfLateWithPermissionDisount` float NOT NULL,
  `twoHoursLateWithPermissionDisount` float NOT NULL,
  `halfHourLateWithoutPermissionDisount` float NOT NULL,
  `hourLateWithoutPermissionDisount` float NOT NULL,
  `hourAndHalfLateWithoutPermissionDisount` float NOT NULL,
  `twoHoursLateWithoutPermissionDisount` float NOT NULL,
  `halfHourPermissionDisount` float NOT NULL,
  `hourPermissionDisount` float NOT NULL,
  `hourAndHalfPermissionDisount` float NOT NULL,
  `twoHoursPermissionDisount` float NOT NULL,
  `dayAbsenceWithPermissionDisount` float NOT NULL,
  `dayAbsenceWithoutPermissionDisount` float NOT NULL,
  `moreThanTwoHoursLateWithPermissionDisount` float NOT NULL,
  `moreThanTwoHoursLateWithoutPermissionDisount` float NOT NULL,
  `empFingerId` varchar(18) NOT NULL DEFAULT '',
  `empRFID` varchar(18) NOT NULL DEFAULT '',
  `empFingerId2` varchar(18) NOT NULL DEFAULT '',
  `empFingerId3` varchar(18) NOT NULL DEFAULT '',
  `empFingerId4` varchar(18) NOT NULL DEFAULT '',
  `empFingerId5` varchar(18) NOT NULL DEFAULT '',
  `numberOfMinutesOfDelayAllowed` int(11) NOT NULL DEFAULT '0',
  `takeVacationDays` int(11) NOT NULL DEFAULT '0',
  `treeId` int(11) NOT NULL DEFAULT '0',
  `treeId2` int(11) NOT NULL DEFAULT '0',
  `quarterHourLateWithPermissionDisount` float NOT NULL,
  `quarterHourLateWithoutPermissionDisount` float NOT NULL,
  `numberOfCountsOfDelayAllowed` int(11) NOT NULL DEFAULT '0',
  `branchid` int(11) NOT NULL DEFAULT '0',
  `empCode` int(11) NOT NULL,
  `socialInsurance` FLOAT NOT NULL DEFAULT '0',
  `workTax` FLOAT NOT NULL DEFAULT '0',
  PRIMARY KEY (`employeeId`),
  UNIQUE KEY `empCode` (`empCode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employeeattendance`
--

CREATE TABLE IF NOT EXISTS `employeeattendance` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `empid` int(11) NOT NULL,
  `theImage` varchar(255) NOT NULL,
  `sysdate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `fingerid` varchar(18) NOT NULL,
  `rfid` varchar(18) NOT NULL,
  `accessType` tinyint(4) NOT NULL COMMENT 'finger access 0, rfid access 1',
  `syncToServer` tinyint(4) NOT NULL COMMENT '0 at accees  device , 1 handled at erp',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employeeattendancesystem`
--

CREATE TABLE IF NOT EXISTS `employeeattendancesystem` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `numberOfMinutesOfDelayAllowed` int(11) NOT NULL DEFAULT '0',
  `takeVacationDays` int(11) NOT NULL DEFAULT '0',
  `halfHourLateWithPermissionDisount` float NOT NULL,
  `hourLateWithPermissionDisount` float NOT NULL,
  `hourAndHalfLateWithPermissionDisount` float NOT NULL,
  `twoHoursLateWithPermissionDisount` float NOT NULL,
  `halfHourLateWithoutPermissionDisount` float NOT NULL,
  `hourLateWithoutPermissionDisount` float NOT NULL,
  `hourAndHalfLateWithoutPermissionDisount` float NOT NULL,
  `twoHoursLateWithoutPermissionDisount` float NOT NULL,
  `halfHourPermissionDisount` float NOT NULL,
  `hourPermissionDisount` float NOT NULL,
  `hourAndHalfPermissionDisount` float NOT NULL,
  `twoHoursPermissionDisount` float NOT NULL,
  `dayAbsenceWithPermissionDisount` float NOT NULL,
  `dayAbsenceWithoutPermissionDisount` float NOT NULL,
  `userid` int(11) NOT NULL,
  `del` tinyint(4) NOT NULL,
  `sysdate` datetime NOT NULL,
  `moreThanTwoHoursLateWithPermissionDisount` float NOT NULL,
  `moreThanTwoHoursLateWithoutPermissionDisount` float NOT NULL,
  `quarterHourLateWithPermissionDisount` float NOT NULL,
  `quarterHourLateWithoutPermissionDisount` float NOT NULL,
  `numberOfCountsOfDelayAllowed` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employeeclosedaygroupstatus`
--

CREATE TABLE IF NOT EXISTS `employeeclosedaygroupstatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `day` date NOT NULL,
  `employeegroupid` int(11) NOT NULL,
  `status` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `conditions` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `day` (`day`,`employeegroupid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employeeclosedayhistory`
--

CREATE TABLE IF NOT EXISTS `employeeclosedayhistory` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `employeeid` int(11) NOT NULL,
  `day` date NOT NULL,
  `attendanceTime` time NOT NULL,
  `departureTime` time NOT NULL,
  `latePeriod` float NOT NULL,
  `lateHasPermission` tinyint(4) NOT NULL,
  `lateDiscount` float NOT NULL,
  `isAbsent` tinyint(4) NOT NULL,
  `absentHasPermission` tinyint(4) NOT NULL,
  `absentDiscount` float NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` int(11) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT '-1' COMMENT '-1 is just attenendace no affect with late or absent money, 1 hr close it and already affect done',
  PRIMARY KEY (`id`),
  UNIQUE KEY `employeeid` (`employeeid`,`day`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employeeclosedaystatus`
--

CREATE TABLE IF NOT EXISTS `employeeclosedaystatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `day` date NOT NULL,
  `status` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `conditions` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `day` (`day`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employeeclosedaysubgroupstatus`
--

CREATE TABLE IF NOT EXISTS `employeeclosedaysubgroupstatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `day` date NOT NULL,
  `employeesubgroupid` int(11) NOT NULL,
  `status` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `conditions` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `day` (`day`,`employeesubgroupid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employeedoctor`
--

CREATE TABLE IF NOT EXISTS `employeedoctor` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `thetype` tinyint(4) NOT NULL COMMENT '0 employee,1 doctor',
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `val` float NOT NULL,
  `treeId` int(11) NOT NULL,
  `dailyentryid` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employeedoctordebtandpay`
--

CREATE TABLE IF NOT EXISTS `employeedoctordebtandpay` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `thetype` tinyint(4) NOT NULL COMMENT '0 debt , 1 pay',
  `employeeOrDoctor` tinyint(4) NOT NULL,
  `employeeOrDoctorId` int(11) NOT NULL,
  `saveid` int(11) NOT NULL,
  `paytype` tinyint(4) NOT NULL COMMENT '0 direct with save , 1 with salary',
  `whatexpens` tinyint(4) NOT NULL COMMENT 'this is for employess    0 genersl expenses, 1  running expenses',
  `val` float NOT NULL,
  `dailyentryid` varchar(11) NOT NULL,
  `note` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employeedoctordebtchange`
--

CREATE TABLE IF NOT EXISTS `employeedoctordebtchange` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `employeeOrDoctor` tinyint(4) NOT NULL,
  `employeeOrDoctorId` int(11) NOT NULL,
  `debtchangebefore` decimal(10,2) NOT NULL,
  `debtchangeamount` decimal(10,2) NOT NULL,
  `debtchangetype` tinyint(4) NOT NULL,
  `processname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `debtchangemodelid` int(11) NOT NULL,
  `debtchangeafter` decimal(10,2) NOT NULL,
  `debtchangedate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `tablename` varchar(300) COLLATE utf8mb4_unicode_ci NOT NULL,
  `comment` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `del` tinyint(4) NOT NULL,
  `dailyentryid` int(11) NOT NULL,
  `saveid` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employeegroup`
--

CREATE TABLE IF NOT EXISTS `employeegroup` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `employeeattendancesystemid` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `del` tinyint(4) NOT NULL,
  `sysdate` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employeepersonnel`
--

CREATE TABLE IF NOT EXISTS `employeepersonnel` (
  `employeepersonnelid` int(11) NOT NULL AUTO_INCREMENT,
  `employeeid` int(11) NOT NULL,
  `employeepersonnelvalue` decimal(10,2) NOT NULL,
  `employeepersonnelnote` varchar(600) DEFAULT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `userid` int(11) NOT NULL,
  `employeepersonneldate` datetime NOT NULL,
  `employeepersonneltype` int(11) NOT NULL COMMENT '1 for Reward 2 for Discount  3 for  Withdrawal 4 for Borrow 5 for Absence 6 for  Repayment 7 Repayment from salary   ',
  `done` int(11) NOT NULL DEFAULT '0' COMMENT '1 for Catch 0 for notCatch',
  `empdeptbefor` int(11) NOT NULL DEFAULT '0',
  `empdeptafter` int(11) NOT NULL DEFAULT '0',
  `salarymonth` varchar(255) NOT NULL,
  `paymenttype` int(11) NOT NULL,
  `payid` int(11) NOT NULL,
  `payid2` int(11) NOT NULL,
  `checknum` varchar(255) NOT NULL,
  `isMandobReward` tinyint(4) NOT NULL DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `deviceid` varchar(255) NOT NULL DEFAULT '01',
  `employeedeviceid` varchar(255) NOT NULL DEFAULT '0',
  PRIMARY KEY (`employeepersonnelid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `employeesubgroup`
--

CREATE TABLE IF NOT EXISTS `employeesubgroup` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `employeegroupid` int(11) NOT NULL,
  `employeeattendancesystemid` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `del` tinyint(4) NOT NULL,
  `sysdate` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `entryproductspurchased`
--

CREATE TABLE IF NOT EXISTS `entryproductspurchased` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `productid` int(11) NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `productquantity` decimal(10,2) NOT NULL,
  `soldquantity` decimal(10,2) NOT NULL,
  `tablename` varchar(255) NOT NULL,
  `modelid` int(11) NOT NULL,
  `expirationDate` date DEFAULT NULL,
  `priority` int(11) NOT NULL DEFAULT '0',
  `del` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `expenseexchange`
--

CREATE TABLE IF NOT EXISTS `expenseexchange` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `serialno` varchar(255) NOT NULL,
  `projectid` int(11) NOT NULL,
  `expensefrom` int(11) NOT NULL COMMENT '0 from save-1from bank-2from ohda',
  `expenseid` int(11) NOT NULL,
  `expenseid2` int(11) NOT NULL,
  `thevalue` int(11) NOT NULL,
  `costcenterid` int(11) NOT NULL,
  `expensedate` date NOT NULL,
  `expensetype` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `del` int(11) NOT NULL,
  `sysdate` date NOT NULL,
  `entryid` int(11) NOT NULL,
  `expenseexcomment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `supplierid` int(11) NOT NULL,
  `supervision_type` int(11) NOT NULL,
  `supervision_amount` int(11) NOT NULL,
  `finalsupervision` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `expenses`
--

CREATE TABLE IF NOT EXISTS `expenses` (
  `expensesid` int(11) NOT NULL AUTO_INCREMENT,
  `expensestypeid` int(11) NOT NULL,
  `expensesname` varchar(100) NOT NULL,
  `expensesdetails` text,
  `expensesValue` decimal(10,2) NOT NULL DEFAULT '0',
  `expensesdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0' COMMENT '0 for not deleted- 1 for deleted',
  `costcenterid` int(11) DEFAULT '0',
  `saveid` int(11) NOT NULL,
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `bankid` int(11) NOT NULL,
  `bankaccountid` int(11) NOT NULL,
  `checknum` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `productid` INT(11) NOT NULL DEFAULT '0',
  `expensenumbrt` decimal(10,2) NOT NULL DEFAULT '0',
  `expenseprice` decimal(10,2) NOT NULL DEFAULT '0',
  `expensetotaln` decimal(10,2) NOT NULL DEFAULT '0',
  `expenseshortfalls` decimal(10,2) NOT NULL DEFAULT '0',
  `supplier` int(11) NOT NULL,
  `suppRemainingVal` float NOT NULL,
  `sellbillid` INT(11) NOT NULL DEFAULT '0',
  `clientid` INT(11) NOT NULL DEFAULT '0',
  `realestateid` INT(11) NOT NULL DEFAULT '0',
  `realestateunitid` INT(11) NOT NULL DEFAULT '0',
  `file` varchar(255) NOT NULL DEFAULT '',
  `taxPer` float NOT NULL DEFAULT '0',
  `taxVal` float NOT NULL DEFAULT '0',
  `travelDriverId` INT NULL DEFAULT NULL,
  `travelBusId` INT NULL DEFAULT NULL,
  `travelPathId` INT NULL DEFAULT NULL,
  `travelTripId` INT NULL DEFAULT NULL,
  `travelTripTypeId` INT NULL DEFAULT NULL,
  `travelTripDateId` INT NULL DEFAULT NULL,
  `travelOfficeId` INT NULL DEFAULT NULL,
  `webApiId` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`expensesid`),
  KEY `idx_expenses` (`expensestypeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `expensestype`
--

CREATE TABLE IF NOT EXISTS `expensestype` (
  `expensestypeid` int(11) NOT NULL AUTO_INCREMENT,
  `expensestypename` varchar(256) NOT NULL,
  `expensestypedetails` text,
  `expensestypedate` date NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0' COMMENT '0 for not deleted- 1 for deleted',
  `userid` int(11) NOT NULL,
  `parent` int(11) NOT NULL,
  `type` int(11) NOT NULL DEFAULT '0' COMMENT '0 for ',
  `saveid` int(11) NOT NULL,
  `addOnlyGroupIds` varchar(255) NOT NULL,
  `treeType` tinyint(4) DEFAULT '0',
  `treeId` int(11) NOT NULL DEFAULT '0',
  `withinsupervision_ratio` tinyint(4) DEFAULT NULL,
  `supervision_ratiotype` tinyint(4) DEFAULT '1',
  `supervision_amount` decimal(10,2) NOT NULL DEFAULT '0',
  `webApiId` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`expensestypeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `goverarea`
--

CREATE TABLE IF NOT EXISTS `goverarea` (
  `goverareaid` int(11) NOT NULL AUTO_INCREMENT,
  `governmentid` int(11) DEFAULT NULL,
  `clientareaid` int(11) DEFAULT NULL,
  PRIMARY KEY (`goverareaid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


-- --------------------------------------------------------

--
-- Table structure for table `government`
--

CREATE TABLE IF NOT EXISTS `government` (
  `governmetid` int(11) NOT NULL AUTO_INCREMENT,
  `governmentname` text,
  PRIMARY KEY (`governmetid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


-- --------------------------------------------------------

--
-- Table structure for table `impotencetreatmentsuppliersave`
--

CREATE TABLE IF NOT EXISTS `impotencetreatmentsuppliersave` (
  `impotencetreatmentsuppliersaveid` int(11) NOT NULL AUTO_INCREMENT,
  `typesimpotencetreatmentid` int(11) NOT NULL,
  `saveid` int(11) NOT NULL,
  `supplierid` int(11) NOT NULL,
  `impotencetreatmentsuppliersavetype` int(11) NOT NULL,
  `impotencetreatmentsuppliersavebefore` decimal(10,2) NOT NULL,
  `impotencetreatmentsuppliersavetamount` decimal(10,2) NOT NULL,
  `impotencetreatmentsuppliersaveafter` decimal(10,2) NOT NULL,
  `impotencetreatmentsuppliersavecomment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `conditions` int(11) NOT NULL COMMENT '0 for not deleted- 1 for deleted',
  `impotencetreatmentsuppliersavedate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `tablename` varchar(256) NOT NULL,
  `dailyentryid` varchar(11) NOT NULL,
  PRIMARY KEY (`impotencetreatmentsuppliersaveid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `income`
--

CREATE TABLE IF NOT EXISTS `income` (
  `incomeId` int(11) NOT NULL AUTO_INCREMENT,
  `incomeTypeId` int(11) NOT NULL,
  `incomeName` varchar(255) NOT NULL,
  `incomeDetails` text NOT NULL,
  `incomeValue` decimal(10,2) NOT NULL,
  `incomeDate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL COMMENT '0 for not deleted- 1 for deleted',
  `costcenterid` int(11) DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `saveid` int(11) DEFAULT '0',
  `clientid` int(11) DEFAULT '0',
  PRIMARY KEY (`incomeId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `incometype`
--

CREATE TABLE IF NOT EXISTS `incometype` (
  `incomeTypeId` int(11) NOT NULL AUTO_INCREMENT,
  `incomeTypeName` varchar(255) NOT NULL,
  `defaultValue` decimal(10,2) NOT NULL,
  `incomeTypeDetails` text NOT NULL,
  `parent` int(11) NOT NULL,
  `incomeTypeDate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL COMMENT '0 for not deleted- 1 for deleted',
  `studentsubjectid` int(11) NOT NULL DEFAULT '0',
  `treeId` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`incomeTypeId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `insurancecompanies`
--

CREATE TABLE IF NOT EXISTS `insurancecompanies` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `discountpercent` decimal(10,2) DEFAULT '0',
  `contractstart` date DEFAULT NULL,
  `contractend` date DEFAULT NULL,
  `contractphoto` varchar(255) DEFAULT NULL,
  `instruction` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `deleted` int(11) NOT NULL DEFAULT '0',
  `userid` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='أسماء شركات التأمين ' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `kashf`
--

CREATE TABLE IF NOT EXISTS `kashf` (
  `id` int(6) NOT NULL AUTO_INCREMENT,
  `kashfvalue` int(6) NOT NULL,
  `kashftype` varchar(50) CHARACTER SET utf8mb4 NOT NULL,
  `customerid` int(6) NOT NULL,
  `doctorid` int(6) NOT NULL,
  `kashfdate` date DEFAULT NULL,
  `entered` int(11) unsigned NOT NULL DEFAULT '0',
  `paystatus` int(11) NOT NULL DEFAULT '0' COMMENT '0 paid now - will be paid with bill - ## added to bill previous already ',
  `rondomtxt` varchar(255) DEFAULT NULL,
  `branchid` int(11) DEFAULT NULL,
  `offline` int(11) DEFAULT '0' COMMENT ' 1 offline - 0 online ',
  `uploaddate` datetime DEFAULT NULL,
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `kasfhserial` int(11) NOT NULL,
  `discountkashf` int(11) DEFAULT NULL COMMENT '0 => no - 1 =>yes',
  `used` int(11) DEFAULT NULL COMMENT '0=> no - 1 => yes',
  `bill_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `kempiala`
--

CREATE TABLE IF NOT EXISTS `kempiala` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clientID` int(11) NOT NULL,
  `recievingdate` date NOT NULL COMMENT '',
  `value` decimal(10,2) NOT NULL,
  `clientcomment` text NOT NULL,
  `selling` int(11) NOT NULL DEFAULT '0' COMMENT '0 => not sold- 1 => sold',
  `expiredate` date NOT NULL COMMENT '',
  `supplierID` int(11) DEFAULT NULL,
  `sellingdate` datetime DEFAULT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0' COMMENT '0 for not canceled- 1 for canceled',
  `suppliercomment` text,
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `clientID` (`clientID`),
  KEY `supplierID` (`supplierID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `lastbillidspricesupdated`
--

CREATE TABLE IF NOT EXISTS `lastbillidspricesupdated` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `buybill` int(11) NOT NULL DEFAULT '0',
  `buyandret` int(11) NOT NULL DEFAULT '0',
  `retbuy` int(11) NOT NULL DEFAULT '0',
  `sell` int(11) NOT NULL DEFAULT '0',
  `sellandret` int(11) NOT NULL DEFAULT '0',
  `retsell` int(11) NOT NULL DEFAULT '0',
  `buyquantity` int(11) NOT NULL DEFAULT '0',
  `buyandretquantity` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `lastbillidsquickprofit`
--

CREATE TABLE IF NOT EXISTS `lastbillidsquickprofit` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sell` int(11) NOT NULL,
  `sellDetail` int(11) NOT NULL,
  `sellandret` int(11) NOT NULL,
  `sellandretDetail` int(11) NOT NULL,
  `retsell` int(11) NOT NULL,
  `retsellDetail` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------
--
-- Table structure for table `maccontrol`
--

CREATE TABLE IF NOT EXISTS `maccontrol` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mac` varchar(17) NOT NULL,
  `deviceType` varchar(10) NOT NULL COMMENT '0 desktop - 1 mobile',
  `allowRemoteAccess` tinyint(4) NOT NULL COMMENT '0 allowd,1 forbidden',
  `userid` int(11) NOT NULL,
  `del` tinyint(4) NOT NULL,
  `sysdate` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `maintenancecases`
--

CREATE TABLE IF NOT EXISTS `maintenancecases` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `casename` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `maintenancecasedate` datetime DEFAULT NULL,
  `conditions` int(11) unsigned DEFAULT NULL,
  `userid` double DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=5 ;

--
-- Dumping data for table `maintenancecases`
--

INSERT INTO `maintenancecases` (`id`, `casename`, `maintenancecasedate`, `conditions`, `userid`) VALUES
(1, 'Ø§Ù„Ø·Ù„Ø¨Ø§Øª Ø§Ù„Ù…Ø³ØªÙ„Ù…Ø©', '2022-02-09 12:42:35', 0, -1),
(2, 'ØªÙ… Ø§Ù„Ø´Ø­Ù†', '2022-02-09 12:43:11', 0, -1),
(3, 'ØªÙ… Ø±Ø¬ÙˆØ¹Ù‡Ø§', '2022-02-09 12:43:35', 0, -1),
(4, 'Ø¬Ø§Ù‡Ø² Ù„Ù„ØªØ³Ù„ÙŠÙ…', '2022-02-09 15:49:09', 0, -1);

-- --------------------------------------------------------

--
-- Table structure for table `maintenancecenters`
--

CREATE TABLE IF NOT EXISTS `maintenancecenters` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `maintenancecenterdate` datetime DEFAULT NULL,
  `conditions` int(11) unsigned DEFAULT NULL,
  `userid` double DEFAULT NULL,
  `centername` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `centerphone` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `centermobile` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `administrator` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `administratorphone` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `administratordebt` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `centeraddress` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `euserid` double DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `maintenancecomments`
--

CREATE TABLE IF NOT EXISTS `maintenancecomments` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `comments` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `maintenanceid` int(11) unsigned DEFAULT NULL,
  `maintenancecommentdate` datetime DEFAULT NULL,
  `conditions` int(11) unsigned DEFAULT NULL,
  `userid` double DEFAULT NULL,
  `euserid` double DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `maintenancecompanies`
--

CREATE TABLE IF NOT EXISTS `maintenancecompanies` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `maintenancecompaniedate` datetime DEFAULT NULL,
  `conditions` int(11) unsigned DEFAULT NULL,
  `userid` double DEFAULT NULL,
  `companyname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `companyphone` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `companyaddress` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `euserid` double DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `maintenancepolicys`
--

CREATE TABLE IF NOT EXISTS `maintenancepolicys` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `maintenancepolicydate` datetime DEFAULT NULL,
  `conditions` int(11) unsigned DEFAULT NULL,
  `userid` double DEFAULT NULL,
  `policydate` date DEFAULT NULL,
  `policynumber` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `supplierid` int(11) unsigned DEFAULT NULL,
  `maintenancecompanieid` int(11) unsigned DEFAULT NULL,
  `policystatement` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `shippingvalue` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `euserid` double DEFAULT NULL,
  `sendorreceipt` int(11) NOT NULL DEFAULT '1',
  `bmaintenancepolicydate` datetime DEFAULT NULL,
  `buserid` double DEFAULT NULL,
  `maintenancaseid` int(11) unsigned DEFAULT NULL,
  `bpolicydate` date DEFAULT NULL,
  `bpolicynumber` int(11) unsigned DEFAULT NULL,
  `bpolicystatement` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `bshippingvalue` int(11) unsigned DEFAULT NULL,
  `bmaintenancecompanieid` int(11) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `maintenanceprocedures`
--

CREATE TABLE IF NOT EXISTS `maintenanceprocedures` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `maintenanceproceduredate` datetime DEFAULT NULL,
  `conditions` int(11) unsigned DEFAULT NULL,
  `userid` double DEFAULT NULL,
  `procedurename` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `euserid` double DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `maintenances`
--

CREATE TABLE IF NOT EXISTS `maintenances` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `maintenancedate` datetime DEFAULT NULL,
  `conditions` int(11) unsigned DEFAULT NULL,
  `userid` double DEFAULT NULL,
  `clientid` int(11) unsigned DEFAULT NULL,
  `branchid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `supplierid` int(11) unsigned DEFAULT NULL,
  `productid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `maintenancecenterid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `maintenancecaseid` int(11) unsigned DEFAULT NULL,
  `receiptnumber` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `dateatime` datetime DEFAULT NULL,
  `quantity` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `defect` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `accessories` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `estimatedcost` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `prepaid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `datepurchase` date DEFAULT NULL,
  `invoicenumber` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `invoicedate` date DEFAULT NULL,
  `maintorguar` int(11) unsigned DEFAULT NULL,
  `euserid` double DEFAULT NULL,
  `maintenancepolicyid` int(11) unsigned DEFAULT NULL,
  `shipprice` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `shipcharge` int(11) unsigned DEFAULT NULL,
  `shipnumber` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `bshipprice` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `bshipcharge` int(11) unsigned DEFAULT NULL,
  `factoringnumber` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `maintenanceprice` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `maintenancecost` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `statementprocedure` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `maintenanceprocedureid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `totalcost` double DEFAULT NULL,
  `requiredcustomer` double DEFAULT NULL,
  `repayment` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `clipnumber` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deliverydate` date DEFAULT NULL,
  `paidlater` int(11) unsigned DEFAULT NULL,
  `paidall` int(11) unsigned DEFAULT NULL,
  `residual` int(11) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `manufacuresetting`
--

CREATE TABLE IF NOT EXISTS `manufacuresetting` (
  `manufacuresettingid` int(11) NOT NULL AUTO_INCREMENT,
  `ordername` varchar(255) NOT NULL,
  `excahangeorder` int(11) NOT NULL DEFAULT '1' COMMENT '1->no-0->yes',
  PRIMARY KEY (`manufacuresettingid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `menuurl`
--

CREATE TABLE IF NOT EXISTS `menuurl` (
  `menuurlid` int(11) NOT NULL AUTO_INCREMENT,
  `orderno` int(11) DEFAULT '0',
  `urltitle` varchar(255) NOT NULL,
  `menuurl` varchar(255) NOT NULL,
  `urlimage` varchar(255) NOT NULL,
  `usergroupid` text NOT NULL,
  PRIMARY KEY (`menuurlid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `movementmanage`
--

CREATE TABLE IF NOT EXISTS `movementmanage` (
  `movementmanageid` int(11) NOT NULL AUTO_INCREMENT,
  `operationname` varchar(256) NOT NULL,
  `movementmanagedate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `currentDo` varchar(255) NOT NULL,
  `ip` varchar(35) NOT NULL,
  `mac` varchar(35) NOT NULL,
  `deviceType` varchar(10) NOT NULL,
  `completeURL` text NOT NULL,
  PRIMARY KEY (`movementmanageid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `movementmanagedeleted`
--

CREATE TABLE IF NOT EXISTS `movementmanagedeleted` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `operationname` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `movementmanagedate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `currentDo` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `ip` varchar(35) NOT NULL,
  `mac` varchar(35) NOT NULL,
  `deviceType` varchar(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_check`
--

CREATE TABLE IF NOT EXISTS `m_check` (
  `checkId` int(11) NOT NULL AUTO_INCREMENT,
  `ourSerial` varchar(255) NOT NULL,
  `userId` int(11) NOT NULL,
  `stageFrom` int(11) NOT NULL,
  `checkDate` date NOT NULL,
  `branchId` int(11) NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del -1 for del',
  PRIMARY KEY (`checkId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_comreceipt`
--

CREATE TABLE IF NOT EXISTS `m_comreceipt` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `receiptserial` varchar(255) NOT NULL,
  `receiptdat` date NOT NULL,
  `branchid` int(11) NOT NULL,
  `clientid` int(11) NOT NULL,
  `totalCost` decimal(10,2) DEFAULT '0' COMMENT 'for MaintennanceSettlement ',
  `Initialcost` decimal(10,2) NOT NULL,
  `shipcost` decimal(10,2) NOT NULL,
  `documentid` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `del` int(11) NOT NULL DEFAULT '0' COMMENT '0 not del 1 del',
  `status` int(11) NOT NULL DEFAULT '0' COMMENT '1 for done',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_comreceiptdetail`
--

CREATE TABLE IF NOT EXISTS `m_comreceiptdetail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `receiptid` int(11) NOT NULL,
  `productserial` varchar(255) NOT NULL,
  `productId` int(11) NOT NULL,
  `ourserial` varchar(255) NOT NULL,
  `granttype` int(11) NOT NULL COMMENT '0 for maintennance- 1  for client insurance -2 for copmany insurance',
  `sellbillid` int(11) NOT NULL,
  `sellbilldate` date NOT NULL,
  `buybillid` int(11) NOT NULL,
  `buybilldate` date NOT NULL,
  `insduration` int(11) NOT NULL,
  `insstatus` int(11) NOT NULL,
  `problem` text NOT NULL,
  `attach` text NOT NULL,
  `comment` text NOT NULL,
  `shipcost` decimal(10,2) NOT NULL,
  `initialcost` decimal(10,2) NOT NULL,
  `supplierid` int(11) NOT NULL,
  `currentstage` int(11) NOT NULL,
  `branchid` int(11) NOT NULL,
  `del` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_comreceiptimage`
--

CREATE TABLE IF NOT EXISTS `m_comreceiptimage` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `comreceiptid` int(11) NOT NULL,
  `receiptimage` varchar(255) NOT NULL,
  `imagedate` date NOT NULL,
  `userid` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_externalmaintenance`
--

CREATE TABLE IF NOT EXISTS `m_externalmaintenance` (
  `externalmaintenanceId` int(11) NOT NULL AUTO_INCREMENT,
  `ourSerial` varchar(255) NOT NULL,
  `supplierId` int(11) NOT NULL,
  `externalmaintenanceDate` date NOT NULL,
  `comment` text NOT NULL,
  `externalmaintenanceReturn` int(11) NOT NULL COMMENT '0 for nonReturn - 1 for Returned',
  `returnComment` text NOT NULL,
  `supplierCost` decimal(10,2) NOT NULL,
  `returnedDate` date NOT NULL,
  `branchId` int(11) NOT NULL,
  `userId` int(11) NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del -1 for del',
  PRIMARY KEY (`externalmaintenanceId`),
  KEY `externalmaintenanceReturn` (`externalmaintenanceReturn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_finishingpayed`
--

CREATE TABLE IF NOT EXISTS `m_finishingpayed` (
  `finishingPayedId` int(11) NOT NULL AUTO_INCREMENT,
  `clientId` int(11) NOT NULL,
  `payed` decimal(10,2) NOT NULL,
  `clientDebtChangeId` int(11) NOT NULL,
  `finishingType` int(11) NOT NULL COMMENT '0 for not uesd "new"- 1 for finished - 2  for remain',
  `finishingPayedDate` date NOT NULL,
  `remain` decimal(10,2) NOT NULL,
  `userId` int(11) NOT NULL,
  `branchId` int(11) NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del - 1 for del',
  PRIMARY KEY (`finishingPayedId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_handedreport`
--

CREATE TABLE IF NOT EXISTS `m_handedreport` (
  `handedReportId` int(11) NOT NULL AUTO_INCREMENT COMMENT '',
  `stageId` int(11) NOT NULL,
  `ourSerial` varchar(255) NOT NULL,
  `actualCost` decimal(10,2) NOT NULL,
  `initiateCost` decimal(10,2) NOT NULL,
  `clientCost` decimal(10,2) NOT NULL,
  `comment` text NOT NULL,
  `userId` int(11) NOT NULL,
  `handedReportDate` date NOT NULL,
  `archive` int(11) NOT NULL COMMENT '0 for delivered-1not delevered',
  `branchId` int(11) NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del -1 for del',
  PRIMARY KEY (`handedReportId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_initialmaintenance`
--

CREATE TABLE IF NOT EXISTS `m_initialmaintenance` (
  `initialMaintenanceId` int(11) NOT NULL AUTO_INCREMENT,
  `ourSerial` varchar(255) NOT NULL,
  `initialMaintenanceDate` date NOT NULL,
  `comment` text NOT NULL,
  `userId` int(11) NOT NULL,
  `branchId` int(11) NOT NULL,
  `totalClientCost` decimal(10,2) NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del -1 for del',
  PRIMARY KEY (`initialMaintenanceId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_initialmaintenancedetail`
--

CREATE TABLE IF NOT EXISTS `m_initialmaintenancedetail` (
  `initialMaintenanceDetailId` int(11) NOT NULL AUTO_INCREMENT,
  `initialMaintenanceId` int(11) NOT NULL,
  `propertyId` int(11) NOT NULL,
  `propertyValue` decimal(10,2) NOT NULL,
  `userId` int(11) NOT NULL,
  `branchId` int(11) NOT NULL,
  `initialMaintenanceDetailDate` date NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del -1 for del',
  PRIMARY KEY (`initialMaintenanceDetailId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_insurance`
--

CREATE TABLE IF NOT EXISTS `m_insurance` (
  `insuranceId` int(11) NOT NULL AUTO_INCREMENT,
  `ourSerial` varchar(255) NOT NULL,
  `stageIdBefore` int(11) NOT NULL,
  `currentStage` int(11) NOT NULL,
  `shipNameGo` int(11) NOT NULL,
  `shipCompanyGo` int(11) NOT NULL,
  `shipPersonalGo` int(11) NOT NULL,
  `shipCostGo` decimal(10,2) NOT NULL,
  `shipNameReturned` int(11) NOT NULL,
  `shipCompanyReturned` int(11) NOT NULL,
  `shipPersonalReturned` int(11) NOT NULL,
  `shipCostReturned` decimal(10,2) NOT NULL,
  `type` int(11) NOT NULL COMMENT '0 for replace - 1 for discount - 2 for  maintenance-3 for reject- 4 in preparing Stage "Donnot have type yet"',
  `oldSN` varchar(255) NOT NULL,
  `newSN` varchar(255) NOT NULL,
  `insuranceCost` decimal(10,2) NOT NULL,
  `kindOfInsurance` int(11) NOT NULL COMMENT '0 for new - 1 for continue',
  `insuranceDate` date NOT NULL,
  `insuranceDiscount` decimal(10,2) NOT NULL,
  `userId` int(11) NOT NULL,
  `branchId` int(11) NOT NULL,
  `comment` text NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del - 1 for del',
  `returned` int(11) NOT NULL COMMENT '0 fornot returned - 1 for returned',
  PRIMARY KEY (`insuranceId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_maintenancereceipt`
--

CREATE TABLE IF NOT EXISTS `m_maintenancereceipt` (
  `maintenanceReceiptId` int(11) NOT NULL AUTO_INCREMENT,
  `receiptId` int(11) NOT NULL,
  `totalCost` decimal(10,2) NOT NULL,
  `type` int(11) NOT NULL COMMENT '0 for finished-1 for remain',
  `userId` int(11) NOT NULL,
  `branchId` int(11) NOT NULL,
  `maintenanceReceiptDAte` date NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del - 1 for del',
  PRIMARY KEY (`maintenanceReceiptId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_maintenancereceiptfinish`
--

CREATE TABLE IF NOT EXISTS `m_maintenancereceiptfinish` (
  `maintenanceReceiptFinishId` int(11) NOT NULL AUTO_INCREMENT,
  `maintenanceReceiptId` int(11) NOT NULL,
  `finishingPayedId` int(11) NOT NULL,
  `payed` decimal(10,2) NOT NULL,
  `remain` decimal(10,2) NOT NULL,
  `maintenanceReceiptFinishDate` date NOT NULL,
  `userId` int(11) NOT NULL,
  `branchId` int(11) NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del - 1 for del',
  PRIMARY KEY (`maintenanceReceiptFinishId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_producthistory`
--

CREATE TABLE IF NOT EXISTS `m_producthistory` (
  `productHistoryId` int(11) NOT NULL AUTO_INCREMENT,
  `ourSerial` varchar(255) NOT NULL,
  `stageFrom` int(11) NOT NULL,
  `stageTo` int(11) NOT NULL,
  `cost` decimal(10,2) NOT NULL,
  `comment` text NOT NULL,
  `status` int(11) NOT NULL COMMENT '0 for accepted- 1 for rejected',
  `userId` int(11) NOT NULL,
  `productHistoryDate` datetime NOT NULL,
  `branchId` int(11) NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del -1 for del',
  PRIMARY KEY (`productHistoryId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_stage`
--

CREATE TABLE IF NOT EXISTS `m_stage` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `descreption` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `m_stageproperity`
--

CREATE TABLE IF NOT EXISTS `m_stageproperity` (
  `stageProperityId` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `initialValue` decimal(10,2) NOT NULL,
  `stageId` int(11) NOT NULL,
  `userId` int(11) NOT NULL,
  `branchId` int(11) NOT NULL,
  `stageProperityDate` date NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del -1 for del',
  PRIMARY KEY (`stageProperityId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `newdbbackup`
--

CREATE TABLE IF NOT EXISTS `newdbbackup` (
  `backupid` int(11) NOT NULL AUTO_INCREMENT,
  `backupname` varchar(255) NOT NULL,
  `backupdate` datetime NOT NULL,
  PRIMARY KEY (`backupid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `newdbname`
--

CREATE TABLE IF NOT EXISTS `newdbname` (
  `newdbnameid` int(11) NOT NULL AUTO_INCREMENT,
  `dbname` varchar(255) NOT NULL,
  PRIMARY KEY (`newdbnameid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `notics`
--

CREATE TABLE IF NOT EXISTS `notics` (
  `noticesid` int(11) NOT NULL AUTO_INCREMENT,
  `productno` int(11) NOT NULL DEFAULT '0',
  `productnotsellno` int(11) NOT NULL DEFAULT '0',
  `kempilano` int(11) NOT NULL DEFAULT '0',
  `clientcheckno` int(11) NOT NULL DEFAULT '0',
  `suppliercheckno` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`noticesid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `offerpricebill`
--

CREATE TABLE IF NOT EXISTS `offerpricebill` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `offerpricebillid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `productname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `sellprice` decimal(10,2) NOT NULL,
  `prodescrption` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `pronumber` int(11) NOT NULL,
  `totalprice` decimal(10,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `offerpricebillprop`
--

CREATE TABLE IF NOT EXISTS `offerpricebillprop` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clientid` int(11) NOT NULL,
  `clientname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `totalprice` double NOT NULL,
  `realtotalprice` double NOT NULL,
  `sysdate` date NOT NULL,
  `serialno` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `offerpricecondition`
--

CREATE TABLE IF NOT EXISTS `offerpricecondition` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `introduction` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `detail` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `onlinestoresetting`
--

CREATE TABLE IF NOT EXISTS `onlinestoresetting` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `url` varchar(255) NOT NULL,
  `availableStores` varchar(255) NOT NULL,
  `onlinestoreid` int(11) NOT NULL DEFAULT '2',
  `onlineclientareaid` int(11) NOT NULL DEFAULT '0',
  `updatetype` tinyint(4) NOT NULL DEFAULT '0',
  `catprohour` decimal(10,2) NOT NULL DEFAULT '0',
  `catprominute` decimal(10,2) NOT NULL DEFAULT '0',
  `proquantityhour` decimal(10,2) NOT NULL DEFAULT '0',
  `proquantityminute` decimal(10,2) NOT NULL DEFAULT '0',
  `clientshour` decimal(10,2) NOT NULL DEFAULT '0',
  `clientsminute` decimal(10,2) NOT NULL DEFAULT '0',
  `ordershour` decimal(10,2) NOT NULL,
  `ordersminute` decimal(10,2) NOT NULL,
  `clientdebtchangeStartId` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `onlinetempcategory`
--

CREATE TABLE IF NOT EXISTS `onlinetempcategory` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `catid` int(11) NOT NULL,
  `edited` tinyint(4) NOT NULL COMMENT '0 not edited "this value is therre online", 1 edited , 2 del',
  `sysdate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `catid` (`catid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `onlinetemporder`
--

CREATE TABLE IF NOT EXISTS `onlinetemporder` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `onlineorderid` int(11) NOT NULL,
  `customerid` int(11) NOT NULL,
  `ordertotal` double NOT NULL,
  `shippingcost` varchar(191) NOT NULL,
  `fulltotal` varchar(191) NOT NULL,
  `paytype` varchar(191) NOT NULL,
  `createdatetime` datetime NOT NULL,
  `orderstatus` tinyint(4) NOT NULL,
  `tax_value` varchar(191) NOT NULL,
  `userid` int(11) NOT NULL COMMENT 'userid online',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `onlinetemporderclient`
--

CREATE TABLE IF NOT EXISTS `onlinetemporderclient` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `erpid` int(11) NOT NULL,
  `customer_id` int(11) NOT NULL,
  `orderid` int(11) NOT NULL,
  `clientname` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL,
  `clientcode` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `clientmobile` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `clientdebt` decimal(10,2) NOT NULL,
  `clientaddress` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL,
  `clientareaid` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `onlinetemporderproduct`
--

CREATE TABLE IF NOT EXISTS `onlinetemporderproduct` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `orderid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `sizeid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `price` double NOT NULL,
  `quantity` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `shippingcost` double NOT NULL,
  `total` double NOT NULL,
  `orderstatus` int(11) NOT NULL,
  `shippingtype` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `discountprice` double NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `onlinetempproduct`
--

CREATE TABLE IF NOT EXISTS `onlinetempproduct` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `productid` int(11) NOT NULL,
  `edited` tinyint(4) NOT NULL COMMENT '0 not edited "this value is therre online", 1 edited , 2 del',
  `sysdate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `productid` (`productid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `onlinetempstoredetail`
--

CREATE TABLE IF NOT EXISTS `onlinetempstoredetail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `storeid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `sizeid` int(11) NOT NULL,
  `colorid` int(11) NOT NULL,
  `quantity` decimal(10,2) NOT NULL,
  `edited` tinyint(4) NOT NULL COMMENT '0 not edited "this value is therre online", 1 edited , 2 del',
  `sysdate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniquecombination` (`storeid`,`productid`,`sizeid`,`colorid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `onlinetempstorereport`
--

CREATE TABLE IF NOT EXISTS `onlinetempstorereport` (
  `storereportid` int(11) NOT NULL AUTO_INCREMENT,
  `productid` int(11) NOT NULL,
  `storeid` int(11) NOT NULL,
  `productquantity` decimal(10,2) NOT NULL,
  `storereporttype` int(11) NOT NULL COMMENT '0 => plus- 1 => minus',
  `storereportmodelid` int(11) NOT NULL,
  `processname` varchar(256) NOT NULL,
  `tablename` varchar(256) NOT NULL,
  `productbefore` decimal(10,2) NOT NULL,
  `productafter` decimal(10,2) NOT NULL,
  `userid` int(11) NOT NULL,
  `storereportdate` date NOT NULL,
  PRIMARY KEY (`storereportid`),
  KEY `productid` (`productid`,`storeid`),
  KEY `storeid` (`storeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `otherrequest`
--

CREATE TABLE IF NOT EXISTS `otherrequest` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `requestTo` int(11) NOT NULL COMMENT '0 branch - 1 user group - 2 user',
  `requestToId` int(11) NOT NULL,
  `requestTitle` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `comment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `requestDate` date NOT NULL,
  `userId` int(11) NOT NULL,
  `branchId` int(11) NOT NULL COMMENT 'branch who made the request',
  `seen` int(11) NOT NULL DEFAULT '0',
  `deleted` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `otherstoremovement`
--

CREATE TABLE IF NOT EXISTS `otherstoremovement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `oprationnumber` varchar(255) NOT NULL,
  `deloperation` int(11) NOT NULL,
  `del` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `comment` text NOT NULL,
  `oprationdata` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `partner`
--

CREATE TABLE IF NOT EXISTS `partner` (
  `partnerid` int(11) NOT NULL AUTO_INCREMENT,
  `partnername` varchar(256) NOT NULL,
  `partnerdate` date NOT NULL,
  `partnerpercentage` decimal(10,2) NOT NULL,
  `partnermoney` decimal(10,2) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `comment` text NOT NULL,
  `userid` int(11) NOT NULL,
  `dailyentryid` int(11) NOT NULL,
  `treeId` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`partnerid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `partnertransferbetween`
--

CREATE TABLE IF NOT EXISTS `partnertransferbetween` (
  `partnertransferbetweenid` int(11) NOT NULL AUTO_INCREMENT,
  `partneridfrom` int(11) NOT NULL,
  `partneridto` int(11) NOT NULL,
  `partnervalue` decimal(10,2) NOT NULL,
  `comment` text NOT NULL,
  `partnerdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `partnerfrombefore` decimal(10,2) NOT NULL DEFAULT '0',
  `partnerfromafter` decimal(10,2) NOT NULL DEFAULT '0',
  `partnertobefore` decimal(10,2) NOT NULL DEFAULT '0',
  `partnertoafter` decimal(10,2) NOT NULL DEFAULT '0',
  `dailyentryid` int(11) NOT NULL,
  PRIMARY KEY (`partnertransferbetweenid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=25 ;

-- --------------------------------------------------------

--
-- Table structure for table `partnerwithdrawal`
--

CREATE TABLE IF NOT EXISTS `partnerwithdrawal` (
  `partnerwithdrawalid` int(11) NOT NULL AUTO_INCREMENT,
  `partnerid` int(11) NOT NULL,
  `partnerwithdrawalvalue` decimal(10,2) NOT NULL,
  `comment` text NOT NULL,
  `partnerwithdrawaldate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `saveid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `partenrwithdrawaltype` int(11) NOT NULL COMMENT '0 ',
  `dailyentryid` int(11) NOT NULL,
  `bankid` int(11) NOT NULL,
  `bankaccountid` int(11) NOT NULL,
  `checknum` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `partnerbefore` decimal(10,2) NOT NULL DEFAULT '0',
  `partnerafter` decimal(10,2) NOT NULL DEFAULT '0',
  PRIMARY KEY (`partnerwithdrawalid`),
  KEY `partnerid` (`partnerid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `paymentnetworks`
--

CREATE TABLE IF NOT EXISTS `paymentnetworks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `discountpercent` decimal(10,2) DEFAULT '0',
  `deleted` int(11) NOT NULL DEFAULT '0',
  `nameen` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `playstationcard`
--

CREATE TABLE IF NOT EXISTS `playstationcard` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `packageVal` float NOT NULL,
  `packagePrice` float NOT NULL,
  `packageDays` int(11) NOT NULL,
  `file` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `del` tinyint(4) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `playstationclientcard`
--

CREATE TABLE IF NOT EXISTS `playstationclientcard` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cardid` int(11) NOT NULL,
  `clientid` int(11) NOT NULL,
  `buyDate` datetime NOT NULL,
  `packVal` float NOT NULL,
  `packPrice` float NOT NULL,
  `packDays` int(11) NOT NULL,
  `packValConsumed` float NOT NULL,
  `cardEndDate` datetime NOT NULL,
  `cardStatus` tinyint(4) NOT NULL COMMENT '0 active,1 totaly consumed , 2 expired',
  `userid` int(11) NOT NULL,
  `del` tinyint(4) NOT NULL,
  `sysDate` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `playstationclientcardpayhistory`
--

CREATE TABLE IF NOT EXISTS `playstationclientcardpayhistory` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clientid` int(11) NOT NULL,
  `cardid` int(11) NOT NULL,
  `cardValBefore` float NOT NULL,
  `payAmount` float NOT NULL,
  `changeType` tinyint(4) NOT NULL COMMENT '0 increase , 1decrease',
  `cardValAfter` float NOT NULL,
  `processname` varchar(255) CHARACTER SET latin1 NOT NULL,
  `modelid` int(11) NOT NULL,
  `tablename` varchar(255) CHARACTER SET latin1 NOT NULL,
  `comment` text CHARACTER SET latin1 NOT NULL,
  `conditions` tinyint(4) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysDate` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `policy`
--

CREATE TABLE IF NOT EXISTS `policy` (
  `policyId` int(11) NOT NULL AUTO_INCREMENT,
  `policyName` varchar(255) NOT NULL,
  `policyDate` date NOT NULL,
  `policyNum` int(11) NOT NULL,
  `policyCost` decimal(10,2) NOT NULL,
  `policyType` int(11) NOT NULL COMMENT '1 => go- 2 =>return',
  `companyId` int(11) NOT NULL,
  `SenderName` varchar(255) NOT NULL,
  `invoicenumber` varchar(255) NOT NULL,
  `tempdele` int(11) NOT NULL,
  `saveId` int(11) NOT NULL,
  `senderType` int(11) NOT NULL COMMENT '1 => client- 2 =>supplier',
  `affectSave` tinyint(4) DEFAULT '0',
  `senderId` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`policyId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `product`
--

CREATE TABLE IF NOT EXISTS `product` (
  `productId` int(11) NOT NULL AUTO_INCREMENT,
  `inMenu` tinyint(4) DEFAULT '0' COMMENT '0 show in resturant menu-1 hide it',
  `productName` varchar(256) NOT NULL DEFAULT '',
  `productDescription` text,
  `productCatId` int(11) NOT NULL,
  `productBuyPrice` decimal(10,2) NOT NULL,
  `productSellAllPrice` decimal(10,2) NOT NULL,
  `productSellUnitPrice` decimal(10,2) NOT NULL,
  `productSellHalfPrice` decimal(10,2) NOT NULL,
  `productDate` date NOT NULL,
  `conditions` int(1) NOT NULL DEFAULT '0',
  `userId` int(11) NOT NULL,
  `limitamount` int(11) NOT NULL DEFAULT '0',
  `parcode` varchar(256) DEFAULT NULL,
  `type` int(11) NOT NULL DEFAULT '0' COMMENT '1 for Manufacturing - 0 for not Manufacturing',
  `sellingtype` int(11) DEFAULT '0' COMMENT '1 for FCFO  2 for  LCFO  3 for expirdata ',
  `expireDate` int(11) DEFAULT NULL,
  `dailyentryId` int(11) NOT NULL,
  `isService` int(11) NOT NULL DEFAULT '0' COMMENT '0 no - 1 yes',
  `isOptic` int(11) NOT NULL DEFAULT '0' COMMENT '0 not optic -1 without size and color-2 with size and color',
  `lastbuyprice` decimal(10,2) DEFAULT NULL,
  `lastbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `meanbuyprice` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `productbuypricereal` decimal(10,2) DEFAULT '0',
  `buypricereal_precentage` decimal(10,2) DEFAULT '0',
  `buytotal_precentage` decimal(10,2) DEFAULT '0',
  `buyhalf_precentage` decimal(10,2) DEFAULT '0',
  `buypart_precentage` decimal(10,2) DEFAULT '0',
  `logo` varchar(255) DEFAULT NULL,
  `obygyDetectionId` int(11) DEFAULT NULL,
  `hasSizeAndColor` tinyint(4) NOT NULL DEFAULT '0',
  `logo1` varchar(255) DEFAULT NULL,
  `logo2` varchar(255) DEFAULT NULL,
  `logo3` varchar(255) DEFAULT NULL,
  `logo4` varchar(255) DEFAULT NULL,
  `logo5` varchar(255) DEFAULT NULL,
  `logo6` varchar(255) DEFAULT NULL,
  `logo7` varchar(255) DEFAULT NULL,
  `overAllAveragePrice` decimal(10,2) NOT NULL DEFAULT '0',
  `online` text,
  `reviewType` int(11) NOT NULL DEFAULT '0',
  `updatebyuser` int(11) NOT NULL DEFAULT '0',
  `proExcelid` int(11) NOT NULL DEFAULT '0' COMMENT 'used to link products to products from another erp like siam see in buybill',
  `proExcelParcode` varchar(12) NOT NULL COMMENT 'used to link products to products from another erp like siam see in buybill',
  `webApiId` int(11) NOT NULL DEFAULT '0',
  `runquery` varchar(256) NOT NULL DEFAULT '',
  `weightedDiscount` float NOT NULL DEFAULT '0',
  `sortby` int(11) NOT NULL DEFAULT '0',
  `obygyInvestigationId` int(11) DEFAULT NULL,
  `TypeOfBarcodeInTax` varchar(10) DEFAULT NULL,
  `barcodeInTax` varchar(150) DEFAULT NULL,
  `productNameE` varchar(256) DEFAULT NULL,
  `partNumber` int(11) NOT NULL DEFAULT '0',
  `vehicleType` int(11) NOT NULL DEFAULT '0',
  `company` int(11) NOT NULL DEFAULT '0',
  `weight` decimal(10,2) DEFAULT '0',
  `origin` varchar(150) DEFAULT NULL,
  `hscode` decimal(10,2) DEFAULT '0',
  `power` tinyint(4) DEFAULT '0' ,
  `ProductionDate` varchar(150) DEFAULT NULL,
  `expiry` int(11) NOT NULL DEFAULT '0',
  `procode` varchar(150) DEFAULT NULL,
  `lastbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `treeId` int(11) NOT NULL DEFAULT '0' COMMENT 'for royal products that is services',
  `price4` float NOT NULL DEFAULT '0',
  `price5` float NOT NULL DEFAULT '0',
  `price6` float NOT NULL DEFAULT '0',
  `price7` float NOT NULL DEFAULT '0',
  `price8` float NOT NULL DEFAULT '0',
  `clientid` INT NOT NULL DEFAULT '0',
  `grantduration` int(11) NOT NULL DEFAULT '0',
  `onlinepro` tinyint(4) DEFAULT '0' ,
  `minappearonline` int(11) NOT NULL DEFAULT '0',
  `selladdpercent` float NOT NULL DEFAULT '0',
  `selldiscountpercent` float NOT NULL DEFAULT '0',
  `buydiscountpercent` float NOT NULL DEFAULT '0',
  `onlinecatid` INT NOT NULL DEFAULT '0',
  `sellpercenttype` int(11) NOT NULL DEFAULT '0',
  `searchfiltersid` varchar(150) DEFAULT NULL,
  `lastbuyprice_withDiscountAndTax` decimal(10,2) DEFAULT NULL,
  PRIMARY KEY (`productId`),
  KEY `productCatId` (`productCatId`),
  KEY `userId` (`userId`),
  KEY `parcode` (`parcode`(255))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productcat`
--

CREATE TABLE IF NOT EXISTS `productcat` (
  `productCatId` int(11) NOT NULL AUTO_INCREMENT,
  `productCatName` varchar(256) NOT NULL,
  `productCatDate` date NOT NULL,
  `productCatDescription` text,
  `productCatParent` int(11) NOT NULL DEFAULT '0',
  `userId` int(11) NOT NULL,
  `conditions` int(1) NOT NULL DEFAULT '0',
  `selldiscount` decimal(10,2) NOT NULL DEFAULT '0' COMMENT '',
  `buydiscount` decimal(10,2) NOT NULL DEFAULT '0' COMMENT '',
  `discounttype` int(11) NOT NULL DEFAULT '0' COMMENT '0 =>direct- 1=>percent',
  `isOptic` int(11) NOT NULL DEFAULT '0' COMMENT '0 not optic -1 without size and color-2 with size and color',
  `buytotal` int(11) DEFAULT '0',
  `buyhalf` int(11) DEFAULT '0',
  `buypart` int(11) DEFAULT '0',
  `buypricereal` int(11) DEFAULT '0',
  `opticServices` varchar(200) NOT NULL,
  `logo` varchar(255) DEFAULT NULL,
  `inMenu` tinyint(4) DEFAULT '0' COMMENT '0 show in resturant menu-1 hide it',
  `stopNegativeSale` tinyint(4) NOT NULL DEFAULT '0',
  `catExcelid` int(11) NOT NULL COMMENT 'used to link products to products from another erp like siam see in buybill',
  `webApiId` int(11) NOT NULL DEFAULT '0',
  `obygyInvestigationCatId` int(11) DEFAULT '0',
  `price4` float NOT NULL DEFAULT '0',
  `price5` float NOT NULL DEFAULT '0',
  `price6` float NOT NULL DEFAULT '0',
  `price7` float NOT NULL DEFAULT '0',
  `price8` float NOT NULL DEFAULT '0',
  PRIMARY KEY (`productCatId`),
  KEY `productCatParent` (`productCatParent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productcatunit`
--

CREATE TABLE IF NOT EXISTS `productcatunit` (
  `productcatunitid` int(11) NOT NULL AUTO_INCREMENT,
  `unitid` int(11) NOT NULL,
  `productcatid` int(11) NOT NULL,
  `productnumber` decimal(10,2) NOT NULL,
  `productcatunitdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`productcatunitid`),
  KEY `productcatid` (`productcatid`),
  KEY `unitid` (`unitid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productingredients`
--

CREATE TABLE IF NOT EXISTS `productingredients` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `productId` int(11) NOT NULL COMMENT 'from product tabe it is the product that has ingredients',
  `ingridientId` int(11) NOT NULL COMMENT 'from product table it is the ingridient',
  `unitId` int(11) NOT NULL,
  `quantity` decimal(10,2) NOT NULL,
  `userId` int(11) NOT NULL,
  `thedate` date NOT NULL,
  `conditions` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productionexecution`
--

CREATE TABLE IF NOT EXISTS `productionexecution` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `orderId` int(11) NOT NULL DEFAULT '0',
  `title` varchar(255) NOT NULL,
  `orderdate` date NOT NULL,
  `taskid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `num` decimal(10,2) NOT NULL,
  `outstoreid` int(11) NOT NULL,
  `wastestoreid` int(11) NOT NULL,
  `rentcost` double NOT NULL,
  `othercost` double NOT NULL,
  `executioncost` double NOT NULL,
  `sysdate` datetime NOT NULL,
  `executed` int(11) NOT NULL DEFAULT '0' COMMENT '0: not execued -- 1:executed',
  `comment` text NOT NULL,
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `orderId` (`orderId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productionexecutionoutput`
--

CREATE TABLE IF NOT EXISTS `productionexecutionoutput` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `exeutionid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `allprice` double NOT NULL,
  `halfprice` double NOT NULL,
  `unitprice` double NOT NULL,
  `num` decimal(10,2) NOT NULL,
  `cost` double NOT NULL,
  `storeid` int(11) NOT NULL,
  `buyPricesHistoryBookIdQuantity`  TEXT NOT NULL DEFAULT '',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productionexecutionproduct`
--

CREATE TABLE IF NOT EXISTS `productionexecutionproduct` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `executionid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `unitid` int(11) NOT NULL,
  `quantity` decimal(10,2) NOT NULL,
  `actualquantity` decimal(10,2) NOT NULL,
  `cost` double NOT NULL,
  `actualcost` double NOT NULL,
  `buyPricesHistoryBookIdQuantity`  TEXT NOT NULL DEFAULT '',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productionexecutionwaste`
--

CREATE TABLE IF NOT EXISTS `productionexecutionwaste` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `executionid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `allprice` double NOT NULL,
  `halfprice` double NOT NULL,
  `unitprice` double NOT NULL,
  `num` decimal(10,2) NOT NULL,
  `storeid` int(11) NOT NULL,
  `buyPricesHistoryBookIdQuantity`  TEXT NOT NULL DEFAULT '',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productionorder`
--

CREATE TABLE IF NOT EXISTS `productionorder` (
  `productionOrderid` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `orderDate` date NOT NULL,
  `branchId` int(11) DEFAULT NULL,
  `startDate` date NOT NULL,
  `endDate` date NOT NULL,
  `productId` int(11) NOT NULL,
  `stageId` int(11) NOT NULL,
  `storeId` int(11) NOT NULL,
  `outQuantity` decimal(10,3) NOT NULL,
  `measureUnitId` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0' COMMENT '0 for notdel -1 for del',
  `userId` int(11) NOT NULL,
  `orderStatus` int(11) NOT NULL DEFAULT '0' COMMENT '0 for Under implementation - 1 for finished',
  PRIMARY KEY (`productionOrderid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productionout`
--

CREATE TABLE IF NOT EXISTS `productionout` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `outStore` int(11) NOT NULL,
  `inStore` int(11) NOT NULL,
  `supplier` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `sizeid` int(11) NOT NULL,
  `colorid` int(11) NOT NULL,
  `outQuantity` float NOT NULL,
  `outUnitCost` float NOT NULL,
  `outAllCost` float NOT NULL,
  `comment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `userid` int(11) NOT NULL,
  `sysDate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  `outAllCostTot` float NOT NULL,
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productionoutdetails`
--

CREATE TABLE IF NOT EXISTS `productionoutdetails` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `productionOutId` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `sizeid` int(11) NOT NULL,
  `colorid` int(11) NOT NULL,
  `unitid` int(11) NOT NULL,
  `price` float NOT NULL,
  `quantity` float NOT NULL,
  `inTotalCost` float NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `productionoutmany`
--

CREATE TABLE IF NOT EXISTS `productionoutmany` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `outStore` int(11) NOT NULL,
  `inStore` int(11) NOT NULL,
  `supplier` int(11) NOT NULL,
  `comment` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `userid` int(11) NOT NULL,
  `sysDate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  `title` varchar(255) NOT NULL,
  `productionoutmanynum` int(11) NOT NULL DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productionoutmanyinproducts`
--

CREATE TABLE IF NOT EXISTS `productionoutmanyinproducts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `productionoutmanyid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `sizeid` int(11) NOT NULL,
  `colorid` int(11) NOT NULL,
  `prounitid` int(11) NOT NULL,
  `quantity` float NOT NULL,
  `unitpriceraw` float NOT NULL,
  `unitManufPrice` float NOT NULL,
  `inTotalCostUnit` float NOT NULL,
  `inTotalCost` float NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productionoutmanyoutproducts`
--

CREATE TABLE IF NOT EXISTS `productionoutmanyoutproducts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `productionoutmanyid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `sizeid` int(11) NOT NULL,
  `colorid` int(11) NOT NULL,
  `prounitid` int(11) NOT NULL,
  `quantity` float NOT NULL,
  `unitprice` float NOT NULL,
  `cost` float NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productionrate`
--

CREATE TABLE IF NOT EXISTS `productionrate` (
  `productionRateId` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL COMMENT 'equation name',
  `finalName` varchar(255) NOT NULL COMMENT 'equation final product name',
  `userId` int(11) NOT NULL,
  `thedate` date NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0' COMMENT '0 for notdel- 1for del',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`productionRateId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productionrateproduct`
--

CREATE TABLE IF NOT EXISTS `productionrateproduct` (
  `productionRateProductId` int(11) NOT NULL AUTO_INCREMENT,
  `productionRateId` int(11) NOT NULL,
  `productId` int(11) NOT NULL,
  `unitId` int(11) NOT NULL,
  `rate` decimal(10,2) NOT NULL,
  `quantity` decimal(10,2) NOT NULL,
  `userId` int(11) NOT NULL,
  `thedate` date NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0' COMMENT '0 for notdel- 1for del',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`productionRateProductId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productrecieve`
--

CREATE TABLE IF NOT EXISTS `productrecieve` (
  `productrecieveid` int(11) NOT NULL AUTO_INCREMENT,
  `sparepartid` int(11) NOT NULL,
  `productrecievedate` date NOT NULL,
  `recieptnum` varchar(255) NOT NULL,
  `clientname` varchar(255) NOT NULL,
  `type` int(11) NOT NULL COMMENT '1=>',
  `cost` decimal(10,2) NOT NULL,
  `partsnumber` decimal(10,2) NOT NULL,
  `userid` int(11) NOT NULL,
  PRIMARY KEY (`productrecieveid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productrequests`
--

CREATE TABLE IF NOT EXISTS `productrequests` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `productid` int(11) NOT NULL,
  `storeid` int(11) NOT NULL,
  `requeststoreid` int(11) NOT NULL COMMENT 'id of store that made the request',
  `productnoreq` int(11) NOT NULL COMMENT 'no of requested pieces',
  `productnoaccept` int(11) NOT NULL COMMENT 'no of accepted pieces',
  `useridadd` int(11) NOT NULL COMMENT 'user who add the request',
  `useridresponse` int(11) NOT NULL COMMENT 'user who respond to the request',
  `status` int(11) NOT NULL DEFAULT '0' COMMENT '0 new - 1 refuse - 2 accept - 3 accept and added to bill',
  `seen` int(11) NOT NULL DEFAULT '0',
  `deleted` int(11) NOT NULL DEFAULT '0' COMMENT '1 deleted - 0 not deleted ',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productserial`
--

CREATE TABLE IF NOT EXISTS `productserial` (
  `productserailid` int(11) NOT NULL AUTO_INCREMENT,
  `productid` int(11) NOT NULL,
  `serialnumber` varchar(256) NOT NULL,
  `comment` text NOT NULL,
  `startdate` date NOT NULL,
  `enddate` date NOT NULL,
  `billid` int(11) NOT NULL,
  `type` int(11) NOT NULL COMMENT '0 for Buy 1 for returnBuyBill',
  `buybilldetailid` int(11) NOT NULL,
  `don` decimal(10,2) NOT NULL COMMENT '',
  `sellbillid` int(11) NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del 1 for del',
  `storeid` int(11) NOT NULL COMMENT 'store of buy bill where serial exists',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `chassisNo` varchar(25) NOT NULL DEFAULT '',
  `motorNo` varchar(25) NOT NULL DEFAULT '',
  `theColor` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`productserailid`),
  KEY `productid` (`productid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productsetting`
--

CREATE TABLE IF NOT EXISTS `productsetting` (
  `productsettingid` int(11) NOT NULL AUTO_INCREMENT,
  `leastValueAtStore` decimal(10,2) NOT NULL,
  `storeid` int(11) NOT NULL,
  PRIMARY KEY (`productsettingid`),
  KEY `storeid` (`storeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `producttemp`
--

CREATE TABLE IF NOT EXISTS `producttemp` (
  `producttempid` int(11) NOT NULL AUTO_INCREMENT,
  `productName` varchar(256) NOT NULL DEFAULT '',
  `productCatId` int(11) NOT NULL,
  `productBuyPrice` decimal(10,2) NOT NULL COMMENT '',
  `productSellAllPrice` decimal(10,2) NOT NULL COMMENT '',
  `productSellUnitPrice` decimal(10,2) NOT NULL COMMENT '',
  `productSellHalfPrice` decimal(10,2) NOT NULL COMMENT '',
  `productDate` date NOT NULL,
  `conditions` int(1) NOT NULL DEFAULT '0',
  `userId` int(11) NOT NULL,
  `parcode` varchar(256) DEFAULT NULL,
  PRIMARY KEY (`producttempid`),
  KEY `productCatId` (`productCatId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `producttempunit`
--

CREATE TABLE IF NOT EXISTS `producttempunit` (
  `producttempunitid` int(11) NOT NULL AUTO_INCREMENT,
  `unitid` int(11) NOT NULL,
  `producttempid` int(11) NOT NULL,
  `productnumber` int(11) NOT NULL,
  `producttempunitdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`producttempunitid`),
  KEY `producttempid` (`producttempid`),
  KEY `unitid` (`unitid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `productunit`
--

CREATE TABLE IF NOT EXISTS `productunit` (
  `productunitid` int(11) NOT NULL AUTO_INCREMENT,
  `unitid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `productnumber` decimal(10,2) NOT NULL,
  `productunitdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `proUnitParcode` varchar(30) NOT NULL,
  `proUnitSellAllPrice` float NOT NULL,
  `proUnitSellHalfPrice` float NOT NULL,
  `proUnitSellUnitPrice` float NOT NULL,
  `proUnitBuyPrice` float NOT NULL,
  `unitInTax` varchar(150) NOT NULL,
  `proUnitPrice4` float NOT NULL,
  `proUnitPrice5` float NOT NULL,
  `proUnitPrice6` float NOT NULL,
  `proUnitPrice7` float NOT NULL,
  `proUnitPrice8` float NOT NULL,

  PRIMARY KEY (`productunitid`),
  KEY `productid` (`productid`),
  KEY `unitid` (`unitid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `programsettings`
--

CREATE TABLE IF NOT EXISTS `programsettings` (
  `programsettingsid` int(11) NOT NULL AUTO_INCREMENT,
  `companyname` varchar(400) NOT NULL,
  `address` varchar(400) DEFAULT NULL,
  `topaddress` int(11) NOT NULL DEFAULT '0',
  `specializtion` varchar(256) DEFAULT NULL COMMENT '',
  `phone` text NOT NULL,
  `phone2` varchar(255) DEFAULT NULL,
  `faxnumber` varchar(256) DEFAULT NULL,
  `email` varchar(256) DEFAULT NULL,
  `website` varchar(256) DEFAULT NULL,
  `logo` varchar(256) NOT NULL COMMENT '',
  `roundnumbers` int(11) NOT NULL DEFAULT '0' COMMENT '0=> round numbers- 1=> don''t round',
  `saveprinting` int(11) NOT NULL DEFAULT '0' COMMENT '',
  `deptprinting` int(11) NOT NULL DEFAULT '0' COMMENT '',
  `printingpapersize` int(11) NOT NULL DEFAULT '0' COMMENT '0 => A4- 1 => A5- 2 => reciept',
  `userid` int(11) NOT NULL,
  `showPreviousPrice` int(11) NOT NULL DEFAULT '0',
  `parcode` int(11) NOT NULL DEFAULT '0',
  `priceing` int(11) NOT NULL DEFAULT '0',
  `lastprice` int(11) NOT NULL DEFAULT '0',
  `searchvalue` int(11) NOT NULL DEFAULT '3',
  `clientsearchvalue` int(11) NOT NULL DEFAULT '3',
  `updateproductprice` int(11) NOT NULL,
  `allowfinsldelete` int(11) NOT NULL COMMENT '0  yes 1 no',
  `updateclientprice` int(11) NOT NULL COMMENT '0  yes 1 no ',
  `partition` varchar(255) NOT NULL,
  `taxcard` varchar(255) NOT NULL DEFAULT '0',
  `commercialregistration` varchar(255) NOT NULL DEFAULT '0',
  `costcenter` int(11) NOT NULL DEFAULT '1',
  `copytype` int(11) DEFAULT NULL,
  `urlcopy` varchar(500) DEFAULT NULL,
  `internalcopy` varchar(500) DEFAULT NULL,
  `clinic` tinyint(4) NOT NULL DEFAULT '0',
  `workshop` tinyint(4) NOT NULL DEFAULT '0',
  `transport` tinyint(4) NOT NULL DEFAULT '0',
  `manufacturing` tinyint(4) NOT NULL DEFAULT '0',
  `masterCopy` int(11) NOT NULL,
  `dailyentrydate` date DEFAULT NULL COMMENT 'last network daily entry date',
  `updatefiledate` date DEFAULT NULL COMMENT 'last time update file created',
  `workerbetweenstores` int(11) NOT NULL DEFAULT '0',
  `workshoptimeout` int(11) NOT NULL DEFAULT '0',
  `drivertimeout` int(11) NOT NULL DEFAULT '0',
  `currancy` varchar(100) DEFAULT NULL,
  `serial` text NOT NULL,
  `allowdateedit` int(11) NOT NULL DEFAULT '0',
  `clientcode` char(1) NOT NULL,
  `clientserial` char(1) NOT NULL,
  `timezone` varchar(50) NOT NULL,
  `expiredate` int(11) NOT NULL DEFAULT '0',
  `production` int(11) NOT NULL DEFAULT '0',
  `description` int(11) NOT NULL DEFAULT '0',
  `service` int(11) NOT NULL DEFAULT '0',
  `date` int(11) NOT NULL DEFAULT '0',
  `limitamount` int(11) NOT NULL DEFAULT '0',
  `measuringunit` int(11) DEFAULT '0',
  `print_amount` int(11) DEFAULT '0',
  `billid` int(11) DEFAULT '1',
  `precentages` int(11) DEFAULT '0',
  `realprice` int(11) DEFAULT '0',
  `delegate_seller` int(11) NOT NULL DEFAULT '0',
  `storeserial` int(11) DEFAULT NULL,
  `clientcodname` text,
  `clientfieldrequired` int(11) NOT NULL DEFAULT '0' COMMENT '1 for yes 0 for no',
  `colortype` int(11) NOT NULL,
  `nakdyOnly` int(11) NOT NULL DEFAULT '0',
  `nakdyKashf` int(11) NOT NULL DEFAULT '0',
  `discount_pres_direct` int(11) DEFAULT '0',
  `general_discount` int(11) DEFAULT '0',
  `sells_return` int(11) DEFAULT '0',
  `scunitname` varchar(255) NOT NULL,
  `vatValue` decimal(10,2) NOT NULL,
  `syncstructure` tinyint(4) NOT NULL DEFAULT '0',
  `showPrevPrices` tinyint(4) NOT NULL,
  `isOpticProg` tinyint(4) NOT NULL DEFAULT '0',
  `reportsPlusHours` int(11) NOT NULL,
  `showM5zon` int(11) DEFAULT NULL,
  `restaurantStoreId` int(11) NOT NULL,
  `restuarantPrintTimeout` int(11) NOT NULL,
  `sumSameProductForStore` tinyint(4) NOT NULL,
  `editAllPrice` int(11) DEFAULT NULL,
  `isCafe` tinyint(4) NOT NULL DEFAULT '0',
  `isRestaurent` tinyint(4) NOT NULL DEFAULT '0',
  `productDays` int(11) DEFAULT '0',
  `thereIsRestTax` tinyint(4) NOT NULL DEFAULT '0',
  `restTaxVal` decimal(10,2) NOT NULL DEFAULT '0',
  `restPrintLang` tinyint(4) NOT NULL DEFAULT '0',
  `taxNameFlag` tinyint(4) NOT NULL DEFAULT '0',
  `parcodeDigits` int(11) NOT NULL DEFAULT '5',
  `specializedParcodeDigits` int(11) NOT NULL DEFAULT '7',
  `clientDefaultDebtLimit` decimal(10,2) NOT NULL DEFAULT '0',
  `clientDefaultDebtLimitControl` tinyint(4) NOT NULL DEFAULT '0',
  `usedParcode` tinyint(4) NOT NULL DEFAULT '1',
  `productbycodeimage` varchar(255) NOT NULL,
  `commentClient` text NOT NULL,
  `Inventoryevaluation` varchar(25) NOT NULL DEFAULT 'first',
  `Profitevaluation` varchar(25) NOT NULL DEFAULT 'first',
  `delivery` int(11) NOT NULL DEFAULT '0',
  `premiums` int(11) DEFAULT '0',
  `operationnumEdit` tinyint(4) NOT NULL DEFAULT '0',
  `noOfDecimalPlaces` int(11) NOT NULL DEFAULT '2',
  `unReviewBills` tinyint(4) NOT NULL DEFAULT '0',
  `unReviewBillsPass` varchar(255) NOT NULL DEFAULT '',
  `billReviewNote` text NOT NULL DEFAULT '',
  `tamweenBakery` tinyint(4) NOT NULL DEFAULT '0',
  `copyRightsStatment` text,
  `three_months` int(11) NULL,
  `six_months` int(11) NULL,
  `twelve_months` int(11) NULL,
  `eighteen_months` int(11) NULL,
  `twentyfour_months` int(11) NULL,
  `thirty_months` int(11) NULL,
  `sixthirty_months` int(11) NULL,
  `fortytwo_months` int(11) NULL,
  `fortyeight_months` int(11) NULL,
  `remoteBackupLink` text NOT NULL DEFAULT '',
  `remoteBackupUser` varchar(255) NOT NULL DEFAULT '',
  `remoteBackupPass` varchar(255) NOT NULL DEFAULT '',
  `remoteBackupFolder` varchar(255) NOT NULL DEFAULT '',
  `mandobCollectionRatio` tinyint(4) NOT NULL DEFAULT '0',
  `takeAwayClient` tinyint(4) NOT NULL DEFAULT '0',
  `restaurantServiceOn` varchar(10) NOT NULL,
  `earlyrepayment` int(11) NOT NULL DEFAULT '0',
  `visaPay` tinyint(4) NOT NULL DEFAULT '0',
  `headerPrint` varchar(255) DEFAULT NULL,
  `headerPrintSand` varchar(191) DEFAULT NULL,
  `printSand` int(11) NOT NULL DEFAULT '0',
  `makeDailyEntry` tinyint(4) NOT NULL DEFAULT '0',
  `clientShowTawla` int(11) NOT NULL DEFAULT '0',
  `billRest` int(11) NOT NULL DEFAULT '1',
  `suppIsClientToo` tinyint(4) NOT NULL DEFAULT '0',
  `isCarBill` tinyint(4) NOT NULL DEFAULT '0',
  `expensesproduct` int(11) NOT NULL DEFAULT '1',
  `projectshownew` int(11) NOT NULL DEFAULT '1',
  `showparcode` int(11) NOT NULL DEFAULT '0',
  `changeBuyPriceChangeSellInBuyBillCtrl` tinyint(4) NOT NULL DEFAULT '0',
  `changeBuyPriceChangeSellInProductCtrl` tinyint(4) NOT NULL DEFAULT '0',
  `inventoryvaluation` tinyint(4) NOT NULL DEFAULT '1',
  `showBillCollectionSearch` tinyint(4) NOT NULL DEFAULT '0',
  `incomeclient` int(11) NOT NULL DEFAULT '1',
  `showserial` int(11) NOT NULL DEFAULT '1',
  `editservice` int(11) NOT NULL DEFAULT '1',
  `showCurrency` tinyint(4) NOT NULL DEFAULT '0',
  `qrerp` int(11) NOT NULL DEFAULT '1',
  `valueadded`  TINYINT(4) NOT NULL DEFAULT '0' COMMENT '1 Product price is inclusive of tax',
  `qrcodesh` int(11) NOT NULL DEFAULT '1',
  `printfoot` text NOT NULL,
  `sellorder` int(11) NOT NULL DEFAULT '1',
  `numberprint` int(11) NOT NULL DEFAULT '0',
  `valueaddedbuy`  TINYINT(4) NOT NULL DEFAULT '0' COMMENT '1 Product price is inclusive of tax',
  `simpleAddClientInBill` tinyint(4) NOT NULL DEFAULT '0',
  `licenseNo` varchar(255) NOT NULL DEFAULT '',
  `maintenance` TINYINT(4) NOT NULL DEFAULT '0',
  `showPrevDiscount` tinyint(4) NOT NULL DEFAULT '0',
  `vatvalueqr` decimal(10,8) NOT NULL DEFAULT '0.13043479',
  `imgprinthide` tinyint(4) NOT NULL DEFAULT '0',
  `parcodeprinttype` varchar(7) NOT NULL DEFAULT 'C128A',
  `parcodeprintwidth` smallint(6) NOT NULL DEFAULT '160',
  `parcodeprinttextsize` TINYINT(4) NOT NULL DEFAULT '14',
  `parcodeprintCurr` varchar(255) NOT NULL DEFAULT 'L.E',
  `sizecolorDigits` tinyint(4) NOT NULL DEFAULT '3',
  `searchBarcodeInBill` tinyint(4) NOT NULL DEFAULT '0',
  `allowMobileLogin` tinyint(4) NOT NULL DEFAULT '0',
  `lanAllowType` tinyint(4) NOT NULL DEFAULT '0',
  `wanAllowType` tinyint(4) NOT NULL DEFAULT '0',
  `sendBillToRestaurant` tinyint(4) NOT NULL DEFAULT '0',
  `obgyPharmacyGroups` varchar(150) DEFAULT '',
  `updateProUnitPricesOnPriceUpdate` tinyint(4) NOT NULL DEFAULT '0',
  `ebill` tinyint(4) NOT NULL DEFAULT '0',
  `valueaddeddiscount` tinyint(4) NOT NULL DEFAULT '0',
  `clientdetail` tinyint(4) NOT NULL DEFAULT '1',
  `showPrevPricesRet` tinyint(4) NOT NULL DEFAULT '0',
  `showPrevDiscountRet` tinyint(4) NOT NULL DEFAULT '0',
  `eunitInTax` varchar(100) NOT NULL DEFAULT '',
  `showStoreToDetail` tinyint(4) NOT NULL DEFAULT '0',
  `showBuyPriceAtProductddl` tinyint(4) NOT NULL DEFAULT '0',
  `specialexpenses` tinyint(4) NOT NULL DEFAULT '1',
  `ratioshow` tinyint(4) NOT NULL DEFAULT '0',
  `defaultUnitPriceAtBill` tinyint(4) NOT NULL DEFAULT '0',
  `rulers` tinyint(4) NOT NULL DEFAULT '0',
  `quantitynew` tinyint(4) NOT NULL DEFAULT '0',
  `showBillOperationSearch` tinyint(4) NOT NULL DEFAULT '0',
  `obygyFolder` varchar(255) NOT NULL DEFAULT '',
  `clientsell` tinyint(4) NOT NULL DEFAULT '0',
  `preorderperiod` int(11) NOT NULL DEFAULT '0',
  `useListPrice` int(11) NOT NULL DEFAULT '0',
  `ebillclient`  tinyint(4) NOT NULL DEFAULT '0',
  `importproduct` tinyint(4) NOT NULL DEFAULT '1',
  `realestateunits` tinyint(4) NOT NULL DEFAULT '0',
  `expensesupplier` tinyint(4) NOT NULL DEFAULT '0',
  `changeOrderproduct` tinyint(4) NOT NULL DEFAULT '0',
  `searchlimit` int(11) NOT NULL DEFAULT '0',
  `typebill` varchar(255) NOT NULL DEFAULT '',
  `roundnumbersbilltotal` int(11) NOT NULL DEFAULT '0',
  `noOfDecimalPlacesBillTotal` int(11) NOT NULL DEFAULT '2',
  `dailyEntryCostprice` varchar(25) NOT NULL DEFAULT 'first',
  `storeRecieveType` tinyint(4) NOT NULL DEFAULT '0',
  `clientPhoneReq` tinyint(4) NOT NULL DEFAULT '0',
  `addServiceToBill` tinyint(4) NOT NULL DEFAULT '0',
  `realestatedev` tinyint(4) NOT NULL DEFAULT '1',
  `showprice4` tinyint(4) NOT NULL DEFAULT '0',
  `showprice5` tinyint(4) NOT NULL DEFAULT '0',
  `showprice6` tinyint(4) NOT NULL DEFAULT '0',
  `showprice7` tinyint(4) NOT NULL DEFAULT '0',
  `showprice8` tinyint(4) NOT NULL DEFAULT '0',
  `showpriceall` tinyint(4) NOT NULL DEFAULT '1',
  `showpricehalf` tinyint(4) NOT NULL DEFAULT '1',
  `showpriceunit` tinyint(4) NOT NULL DEFAULT '1',
  `showbillstatus` tinyint(4) NOT NULL DEFAULT '0',
  `showbilldeliverydate` tinyint(4) NOT NULL DEFAULT '0',
  `enablequantityfractions` tinyint(4) NOT NULL DEFAULT '1',
  `addclienttoproduct` tinyint(4) NOT NULL DEFAULT '0',
  `closingcustomeraccount` tinyint(4) NOT NULL DEFAULT '0',
  `serial2` text NOT NULL,
  `shownameE` tinyint(4) NOT NULL DEFAULT '0',
  `showprocode` tinyint(4) NOT NULL DEFAULT '0',
  `showpartnumber` tinyint(4) NOT NULL DEFAULT '0',
  `showtype` tinyint(4) NOT NULL DEFAULT '0',
  `showcompany` tinyint(4) NOT NULL DEFAULT '0',
  `showweight` tinyint(4) NOT NULL DEFAULT '0',
  `showorigin` tinyint(4) NOT NULL DEFAULT '0',
  `showhscode` tinyint(4) NOT NULL DEFAULT '0',
  `showexpire` tinyint(4) NOT NULL DEFAULT '0',
  `showgrantduration` tinyint(4) NOT NULL DEFAULT '0',
  `showonline` tinyint(4) NOT NULL DEFAULT '0',
  `showminappear` tinyint(4) NOT NULL DEFAULT '0',
  `showonlinecat` tinyint(4) NOT NULL DEFAULT '0',
  `showsellpercentage` tinyint(4) NOT NULL DEFAULT '0',
  `showbuydiscount` tinyint(4) NOT NULL DEFAULT '0',
  `preparingStore` int(11) NOT NULL DEFAULT '0',
  `sellordername` int(11) NOT NULL DEFAULT '0',
  `showsearchfilter` tinyint(4) NOT NULL DEFAULT '0',
  `unitPriceAtsalesreport` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`programsettingsid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


-- --------------------------------------------------------

--
-- Table structure for table `project`
--

CREATE TABLE IF NOT EXISTS `project` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `totalcontract` decimal(10,2) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `detail` text NOT NULL,
  `clientid` int(11) NOT NULL,
  `costcenterid` int(11) NOT NULL,
  `treeid` int(11) NOT NULL,
  `treeproid` int(11) NOT NULL,
  `entryid` int(11) NOT NULL,
  `sysdate` date NOT NULL,
  `del` int(11) NOT NULL DEFAULT '0',
  `finish` int(11) DEFAULT '0' COMMENT '0: not finish 1: finish',
  `projectkindid` int(11) NOT NULL DEFAULT '0',
  `bannerdesigned` int(11) NOT NULL DEFAULT '0',
  `projectsuit` int(11) NOT NULL DEFAULT '0',
  `addeddate` date NOT NULL,
  `expirydate` date NOT NULL,
  `owner_name` varchar(255) DEFAULT NULL,
  `business_type` tinyint(4) DEFAULT '0' ,
  `supervision_type` tinyint(4) DEFAULT '0' ,
  `supervision_amount` decimal(10,2) NOT NULL,
  `projectstageids` varchar(255) DEFAULT '0' ,
  `userid` int(11) NOT NULL DEFAULT '0',
  `projectstagesdata` tinyint(4) DEFAULT '2' ,
  `projecttimetableitems` tinyint(4) DEFAULT '2' ,
  `expenses` tinyint(4) DEFAULT '2' ,
  `income` tinyint(4) DEFAULT '2' ,
  `showpdf` tinyint(4) DEFAULT NULL,
  `filepdf` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `projectexchmaterial`
--

CREATE TABLE IF NOT EXISTS `projectexchmaterial` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `serilno` varchar(255) NOT NULL,
  `projectid` int(11) NOT NULL,
  `storeid` int(11) NOT NULL,
  `projdate` date NOT NULL,
  `sysdate` date NOT NULL,
  `totalnum` varchar(255) NOT NULL,
  `totalbuyprice` varchar(255) NOT NULL,
  `entryid` int(11) NOT NULL,
  `userid` int(11) NOT NULL DEFAULT '0',
  `supervision_type` int(11) NOT NULL,
  `supervision_amount` int(11) NOT NULL,
  `supplierid` int(11) NOT NULL,
  `finalsupervision` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `projectexchmaterialdetail`
--

CREATE TABLE IF NOT EXISTS `projectexchmaterialdetail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `projectexchid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `pronumber` int(11) NOT NULL,
  `probuyprice` int(11) NOT NULL,
  `expensestypeid` int(11) NOT NULL,
  `supervision_amount` int(11) NOT NULL,
  `supervision` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `projectexchmaterialdetailreturn`
--

CREATE TABLE IF NOT EXISTS `projectexchmaterialdetailreturn` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `projectexchid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `pronumber` int(11) NOT NULL,
  `probuyprice` int(11) NOT NULL,
  `expensestypeid` int(11) NOT NULL,
  `supervision_amount` int(11) NOT NULL,
  `supervision` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `projectexchmaterialreturn`
--

CREATE TABLE IF NOT EXISTS `projectexchmaterialreturn` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `serilno` varchar(255) NOT NULL,
  `projectid` int(11) NOT NULL,
  `storeid` int(11) NOT NULL,
  `projdate` date NOT NULL,
  `sysdate` date NOT NULL,
  `totalnum` varchar(255) NOT NULL,
  `totalbuyprice` varchar(255) NOT NULL,
  `entryid` int(11) NOT NULL,
  `userid` int(11) NOT NULL DEFAULT '0',
  `supervision_type` int(11) NOT NULL,
  `supervision_amount` int(11) NOT NULL,
  `supplierid` int(11) NOT NULL,
  `finalsupervision` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `projectkind`
--

CREATE TABLE IF NOT EXISTS `projectkind` (
  `projectkindid` int(11) NOT NULL AUTO_INCREMENT,
  `projectkindname` varchar(256) DEFAULT NULL,
  `projectkinddate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(1) NOT NULL,
  `projectkindcomment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`projectkindid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;


-- --------------------------------------------------------

--
-- Table structure for table `properties`
--

CREATE TABLE IF NOT EXISTS `properties` (
  `propertyid` int(11) NOT NULL AUTO_INCREMENT,
  `propertyname` varchar(255) NOT NULL,
  `propertyparent` int(11) NOT NULL,
  `propertydefault` int(11) NOT NULL DEFAULT '0',
  `propertyurl` varchar(255) NOT NULL,
  PRIMARY KEY (`propertyid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `quickprofitclient`
--

CREATE TABLE IF NOT EXISTS `quickprofitclient` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clientId` int(11) NOT NULL,
  `theDate` date NOT NULL,
  `sellVal` decimal(15,2) NOT NULL,
  `sellCostBuyPrice` decimal(15,2) NOT NULL,
  `sellCostLastBuyPrice` decimal(15,2) NOT NULL,
  `sellCostMeanBuyPrice` decimal(15,2) NOT NULL,
  `sellCostLastBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `sellCostMeanBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `sellCostOverAllAveragePrice` decimal(15,2) NOT NULL,
  `returnSellVal` decimal(15,2) NOT NULL,
  `returnSellCostBuyPrice` decimal(15,2) NOT NULL,
  `returnSellCostLastBuyPrice` decimal(15,2) NOT NULL,
  `returnSellCostMeanBuyPrice` decimal(15,2) NOT NULL,
  `returnSellCostLastBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `returnSellCostMeanBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `returnSellCostOverAllAveragePrice` decimal(15,2) NOT NULL,
  `debtLimit` decimal(10,2) NOT NULL DEFAULT '0',
  `sellCostLastBuyPricewithTax` decimal(15,2) NOT NULL,
  `sellCostMeanBuyPricewithTax` decimal(15,2) NOT NULL,
  `returnSellCostLastBuyPricewithTax` decimal(15,2) NOT NULL,
  `returnSellCostMeanBuyPricewithTax` decimal(15,2) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_quickprofitclient` (`clientId`,`theDate`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `quickprofitday`
--

CREATE TABLE IF NOT EXISTS `quickprofitday` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `theDate` date NOT NULL,
  `sellVal` decimal(15,2) NOT NULL,
  `sellCostBuyPrice` decimal(15,2) NOT NULL,
  `sellCostLastBuyPrice` decimal(15,2) NOT NULL,
  `sellCostMeanBuyPrice` decimal(15,2) NOT NULL,
  `sellCostLastBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `sellCostMeanBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `sellCostOverAllAveragePrice` decimal(15,2) NOT NULL,
  `returnSellVal` decimal(15,2) NOT NULL,
  `returnSellCostBuyPrice` decimal(15,2) NOT NULL,
  `returnSellCostLastBuyPrice` decimal(15,2) NOT NULL,
  `returnSellCostMeanBuyPrice` decimal(15,2) NOT NULL,
  `returnSellCostLastBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `returnSellCostMeanBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `returnSellCostOverAllAveragePrice` decimal(15,2) NOT NULL,
  `sellCostLastBuyPricewithTax` decimal(15,2) NOT NULL,
  `sellCostMeanBuyPricewithTax` decimal(15,2) NOT NULL,
  `returnSellCostLastBuyPricewithTax` decimal(15,2) NOT NULL,
  `returnSellCostMeanBuyPricewithTax` decimal(15,2) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `theDate` (`theDate`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `quickprofitgeneral`
--

CREATE TABLE IF NOT EXISTS `quickprofitgeneral` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `netSellVal` decimal(15,2) NOT NULL,
  `netSellCostBuyPrice` decimal(15,2) NOT NULL,
  `netSellCostLastBuyPrice` decimal(15,2) NOT NULL,
  `netSellCostMeanBuyPrice` decimal(15,2) NOT NULL,
  `netSellCostLastBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `netSellCostMeanBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `netSellCostOverAllAveragePrice` decimal(15,2) NOT NULL,
  `netSellCostLastBuyPricewithTax` decimal(15,2) NOT NULL,
  `netSellCostMeanBuyPricewithTax` decimal(15,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `quickprofitproduct`
--

CREATE TABLE IF NOT EXISTS `quickprofitproduct` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `productId` int(11) NOT NULL,
  `theDate` date NOT NULL,
  `sellVal` decimal(15,2) NOT NULL,
  `sellCostBuyPrice` decimal(15,2) NOT NULL,
  `sellCostLastBuyPrice` decimal(15,2) NOT NULL,
  `sellCostMeanBuyPrice` decimal(15,2) NOT NULL,
  `sellCostLastBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `sellCostMeanBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `sellCostOverAllAveragePrice` decimal(15,2) NOT NULL,
  `returnSellVal` decimal(15,2) NOT NULL,
  `returnSellCostBuyPrice` decimal(15,2) NOT NULL,
  `returnSellCostLastBuyPrice` decimal(15,2) NOT NULL,
  `returnSellCostMeanBuyPrice` decimal(15,2) NOT NULL,
  `returnSellCostLastBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `returnSellCostMeanBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `returnSellCostOverAllAveragePrice` decimal(15,2) NOT NULL,
  `netQuantity` decimal(10,2) NOT NULL,
  `netQuantityRet` decimal(10,2) NOT NULL,
  `sellCostLastBuyPricewithTax` decimal(15,2) NOT NULL,
  `sellCostMeanBuyPricewithTax` decimal(15,2) NOT NULL,
  `returnSellCostLastBuyPricewithTax` decimal(15,2) NOT NULL,
  `returnSellCostMeanBuyPricewithTax` decimal(15,2) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_quickprofitproduct` (`productId`,`theDate`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `quickprofitstore`
--

CREATE TABLE IF NOT EXISTS `quickprofitstore` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `storeId` int(11) NOT NULL,
  `theDate` date NOT NULL,
  `sellVal` decimal(15,2) NOT NULL,
  `sellCostBuyPrice` decimal(15,2) NOT NULL,
  `sellCostLastBuyPrice` decimal(15,2) NOT NULL,
  `sellCostMeanBuyPrice` decimal(15,2) NOT NULL,
  `sellCostLastBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `sellCostMeanBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `sellCostOverAllAveragePrice` decimal(15,2) NOT NULL,
  `returnSellVal` decimal(15,2) NOT NULL,
  `returnSellCostBuyPrice` decimal(15,2) NOT NULL,
  `returnSellCostLastBuyPrice` decimal(15,2) NOT NULL,
  `returnSellCostMeanBuyPrice` decimal(15,2) NOT NULL,
  `returnSellCostLastBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `returnSellCostMeanBuyPricewithDiscount` decimal(15,2) NOT NULL,
  `returnSellCostOverAllAveragePrice` decimal(15,2) NOT NULL,
  `sellCostLastBuyPricewithTax` decimal(15,2) NOT NULL,
  `sellCostMeanBuyPricewithTax` decimal(15,2) NOT NULL,
  `returnSellCostLastBuyPricewithTax` decimal(15,2) NOT NULL,
  `returnSellCostMeanBuyPricewithTax` decimal(15,2) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_quickprofitstore` (`storeId`,`theDate`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `religions`
--

CREATE TABLE IF NOT EXISTS `religions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `relusergroupproperties`
--

CREATE TABLE IF NOT EXISTS `relusergroupproperties` (
  `relusergrouppropertiesid` int(11) NOT NULL AUTO_INCREMENT,
  `usergroupid` int(11) NOT NULL,
  `propertyid` int(11) NOT NULL,
  `propertyvalue` int(11) NOT NULL DEFAULT '0',
  `theorder` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`relusergrouppropertiesid`),
  UNIQUE KEY `usergroupid_2` (`usergroupid`,`propertyid`),
  KEY `usergroupid` (`usergroupid`,`propertyid`),
  KEY `propertyid` (`propertyid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `rentbill`
--

CREATE TABLE IF NOT EXISTS `rentbill` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clientid` int(11) DEFAULT NULL,
  `createdatetime` date DEFAULT NULL,
  `billtotal` decimal(10,2) DEFAULT NULL,
  `firmbilltotal` decimal(10,2) DEFAULT NULL,
  `billpayed` decimal(10,2) DEFAULT NULL,
  `billreset` decimal(10,2) DEFAULT NULL,
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `payistype` char(1) NOT NULL DEFAULT '0',
  `bankid` int(11) DEFAULT NULL,
  `accountid` int(11) DEFAULT NULL,
  `paperno` int(11) DEFAULT NULL,
  `paperval` decimal(10,2) DEFAULT NULL,
  `paperdate` date DEFAULT NULL,
  `discount` decimal(10,2) DEFAULT NULL,
  `distotal` decimal(10,2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `rentbillprop`
--

CREATE TABLE IF NOT EXISTS `rentbillprop` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `billid` int(11) DEFAULT NULL,
  `productid` int(11) DEFAULT NULL,
  `type` char(1) DEFAULT NULL,
  `supplierid` int(11) DEFAULT NULL,
  `amount` int(11) DEFAULT NULL,
  `rentprice` decimal(10,2) DEFAULT NULL,
  `supplierprice` decimal(10,2) DEFAULT NULL,
  `totalprice` decimal(10,2) DEFAULT NULL,
  `suppliertotalpice` decimal(10,2) DEFAULT NULL,
  `startdate` date DEFAULT NULL,
  `enddate` date DEFAULT NULL,
  `rentdays` int(11) DEFAULT NULL,
  `status` char(1) DEFAULT NULL,
  `delayvalue` decimal(10,2) DEFAULT NULL,
  `delaytype` char(1) DEFAULT NULL,
  `delypay` decimal(10,2) DEFAULT NULL,
  `delayreset` decimal(10,2) DEFAULT NULL,
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `diffdate` varchar(2000) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `rentproduct`
--

CREATE TABLE IF NOT EXISTS `rentproduct` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(2000) DEFAULT NULL,
  `quantity` int(11) DEFAULT NULL,
  `buyprice` decimal(10,2) DEFAULT NULL,
  `totalprice` decimal(10,2) DEFAULT NULL,
  `rentprice` decimal(10,2) DEFAULT NULL,
  `paytype` char(1) DEFAULT NULL,
  `supplierid` int(11) DEFAULT '0',
  `createdate` date DEFAULT NULL,
  `info` text,
  `isdel` char(1) DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `rentstore`
--

CREATE TABLE IF NOT EXISTS `rentstore` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `rentproductid` int(11) DEFAULT NULL,
  `amount` int(11) DEFAULT NULL,
  `rented` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `representativecompany`
--

CREATE TABLE IF NOT EXISTS `representativecompany` (
  `representativecompanyId` int(11) NOT NULL AUTO_INCREMENT,
  `representativeName` varchar(255) NOT NULL,
  `representativePhone` varchar(255) NOT NULL,
  `companyId` int(11) NOT NULL,
  `otherInfo` longtext NOT NULL,
  PRIMARY KEY (`representativecompanyId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `restauranthall`
--

CREATE TABLE IF NOT EXISTS `restauranthall` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `hallPrice` tinyint(4) NOT NULL,
  `hallUsers` varchar(300) NOT NULL,
  `userId` int(11) NOT NULL,
  `sysdate` date NOT NULL,
  `del` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `restaurantkitchenprint`
--

CREATE TABLE IF NOT EXISTS `restaurantkitchenprint` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `orderId` int(11) NOT NULL,
  `productId` int(11) NOT NULL,
  `quantity` int(11) NOT NULL,
  `notesPrinted` text NOT NULL,
  `togetherNo` int(11) NOT NULL,
  `isPrinted` tinyint(4) NOT NULL COMMENT '0 not printed - 1 printed',
  `sysDateTime` datetime NOT NULL,
  `fromBillDirectWithId` int(11) NOT NULL DEFAULT '-1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `restaurantorder`
--

CREATE TABLE IF NOT EXISTS `restaurantorder` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `hallUserId` int(11) NOT NULL,
  `tableId` int(11) NOT NULL,
  `totalBill` decimal(10,2) NOT NULL,
  `discount` decimal(10,2) NOT NULL,
  `tax` decimal(10,2) NOT NULL DEFAULT '0',
  `netBill` decimal(10,2) NOT NULL,
  `finished` tinyint(4) NOT NULL COMMENT '0 not finished - 1 finished',
  `sellBillId` int(11) NOT NULL,
  `userId` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  `daySreial` int(11) NOT NULL,
  `billComment` text CHARACTER SET utf8 NOT NULL,
  `payed` decimal(10,2) NOT NULL DEFAULT '0',
  `restaurantplaystationplayid` int(11) NOT NULL DEFAULT '0',
  `rest` decimal(8,2) NOT NULL DEFAULT '0.00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `restaurantorderdeliverydetails`
--

CREATE TABLE IF NOT EXISTS `restaurantorderdeliverydetails` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `orderId` int(11) NOT NULL,
  `clientId` int(11) NOT NULL,
  `clientmobile` tinyint(4) NOT NULL COMMENT '0 hide- 1 show',
  `clientphone` tinyint(4) NOT NULL COMMENT '0 hide- 1 show',
  `clientaddress` tinyint(4) NOT NULL COMMENT '0 hide- 1 show',
  `clientdetails` tinyint(4) NOT NULL COMMENT '0 hide- 1 show',
  `driverId` int(11) NOT NULL,
  `driverReciveDate` datetime NOT NULL,
  `deliveryStatus` tinyint(4) NOT NULL COMMENT '0 new -1 assigned to driver - 2 finish',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `restaurantorderdetails`
--

CREATE TABLE IF NOT EXISTS `restaurantorderdetails` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `orderId` int(11) NOT NULL,
  `productId` int(11) NOT NULL,
  `quantity` decimal(10,2) NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `total` decimal(10,2) NOT NULL,
  `notes` text NOT NULL,
  `notesPrinted` text NOT NULL,
  `isPrinted` tinyint(4) NOT NULL,
  `printedQuantity` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `restaurantplaystation`
--

CREATE TABLE IF NOT EXISTS `restaurantplaystation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `hourPrice` float NOT NULL,
  `beingUsed` tinyint(4) NOT NULL COMMENT '0 empty-1 is used now',
  `tableId` int(11) NOT NULL,
  `serviceId` int(11) NOT NULL,
  `userId` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  `theType` tinyint(4) NOT NULL COMMENT 'it is to be deleted below it doesnot exist',
  `deviceIdentification` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `subDeviceIdentification` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `useSubIdentification` tinyint(4) NOT NULL,
  `hourPriceMulti` float NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `restaurantplaystationplay`
--

CREATE TABLE IF NOT EXISTS `restaurantplaystationplay` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `playstationid` int(11) NOT NULL,
  `hourPrice` float NOT NULL,
  `startsysDate` datetime NOT NULL,
  `endsysDate` datetime NOT NULL,
  `duration` time NOT NULL,
  `note` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `totalPrice` float NOT NULL,
  `discount` float NOT NULL,
  `tax` float NOT NULL,
  `netPrice` float NOT NULL,
  `payed` float NOT NULL,
  `finished` tinyint(4) NOT NULL,
  `sellBillId` int(11) NOT NULL,
  `userId` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  `reservationType` tinyint(4) NOT NULL COMMENT '0 open - 1 with timer',
  `reservationHours` int(11) NOT NULL,
  `reservationMinutes` int(11) NOT NULL,
  `reservationEndDateTime` datetime NOT NULL,
  `moveStartSysDate` datetime NOT NULL COMMENT 'used in move psplay',
  `moveDuration` time NOT NULL COMMENT 'used in move psplay',
  `oldPsPlayid` INT NOT NULL DEFAULT '0' COMMENT 'used in move psplay',
  `startPrice` FLOAT NOT NULL DEFAULT '0' COMMENT 'used in move psplay  it is sum of price of all previous plastation play',
  `cardPayed` float NOT NULL,
  `cashPayed` float NOT NULL,
  `psClientCardId` int(11) NOT NULL,
  `priceIs` tinyint(4) NOT NULL COMMENT '0 hourPrice - 1 hourPriceMulti',
  `hourPriceMulti` float NOT NULL,
  `allMovesUnitedSellBillId` INT NOT NULL DEFAULT '0' COMMENT 'it is sellbill id made to all movenent from playstation to another and from single to multi as we need it to identify them and use it in print',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `restaurantprinter`
--

CREATE TABLE IF NOT EXISTS `restaurantprinter` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `cats` varchar(400) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` date NOT NULL,
  `del` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `restaurantrawdestruction`
--

CREATE TABLE IF NOT EXISTS `restaurantrawdestruction` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `storeid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `quantity` int(11) NOT NULL,
  `productBuyPrice` decimal(10,2) NOT NULL,
  `lastbuyprice` decimal(10,2) NOT NULL,
  `meanbuyprice` decimal(10,2) NOT NULL,
  `lastbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `conditions` tinyint(4) NOT NULL,
  `sysdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `operationNum` int(11) NOT NULL,
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `realestateid` INT(11) NOT NULL DEFAULT '0',
  `realestateunitid` INT(11) NOT NULL DEFAULT '0',
  `lastbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `restauranttable`
--

CREATE TABLE IF NOT EXISTS `restauranttable` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `hallid` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `beingUsed` tinyint(4) NOT NULL COMMENT '0 empty-1 is used now',
  `userId` int(11) NOT NULL,
  `sysdate` date NOT NULL,
  `del` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `returnbuybill`
--

CREATE TABLE IF NOT EXISTS `returnbuybill` (
  `returnbuybillid` int(11) NOT NULL AUTO_INCREMENT,
  `returnbuybillSerial` varchar(255) DEFAULT NULL,
  `returnbuybilldate` datetime DEFAULT NULL,
  `returnbuybillsupplierid` int(11) NOT NULL,
  `returnbuybilltotaldeptbefor` decimal(10,2) NOT NULL,
  `returnbuybilltotaldeptafter` decimal(10,2) NOT NULL,
  `returnbuybilldiscount` varchar(255) NOT NULL DEFAULT '',
  `returnbuybilldiscountrype` int(11) NOT NULL DEFAULT '0',
  `returnbuybilltotalbill` decimal(10,2) NOT NULL,
  `returnbuybillaftertotalbill` decimal(10,2) NOT NULL,
  `returnbuybilltotalpayed` decimal(10,2) NOT NULL,
  `returnbuybillfinalbill` decimal(10,2) NOT NULL,
  `returnbuybillstoreid` int(11) NOT NULL,
  `returnbuybillsysdate` datetime NOT NULL,
  `comment` text NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `returnbuybillclientname` varchar(255) NOT NULL DEFAULT '',
  `returnbuybillsaveid` int(11) NOT NULL,
  `billnameid` int(11) NOT NULL,
  `returnbuybilldirectpayment` int(11) NOT NULL DEFAULT '0' COMMENT '',
  `deletedbuyid` int(11) DEFAULT NULL,
  `controlname` varchar(255) NOT NULL,
  `payedtax` decimal(10,2) NOT NULL DEFAULT '0',
  `costcenterid` int(11) DEFAULT '0',
  `dailyentryid` varchar(100) NOT NULL DEFAULT '',
  `delbyuserid` int(11) NOT NULL DEFAULT '0',
  `currencyId` int(11) NOT NULL DEFAULT '1',
  `taxOfDiscountPer` float NOT NULL DEFAULT '0',
  `taxOfDiscountVal` float NOT NULL DEFAULT '0',
  `client` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`returnbuybillid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `returnbuybillcurr`
--

CREATE TABLE IF NOT EXISTS `returnbuybillcurr` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `buybillid` int(11) NOT NULL,
  `conversionFactor` float NOT NULL DEFAULT '1',
  `returnbuybilldiscountC` varchar(255) NOT NULL DEFAULT '',
  `returnbuybilltotalbillC` decimal(10,2) NOT NULL,
  `returnbuybillaftertotalbillC` decimal(10,2) NOT NULL,
  `returnbuybilltotalpayedC` decimal(10,2) NOT NULL,
  `returnbuybillfinalbillC` decimal(10,2) NOT NULL,
  `returnbuybilldirectpaymentC` int(11) NOT NULL DEFAULT '0',
  `payedtaxC` decimal(10,2) NOT NULL DEFAULT '0.00',
  `saveConversionFactor` float NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

--
-- Table structure for table `returnbuybilldetail`
--

CREATE TABLE IF NOT EXISTS `returnbuybilldetail` (
  `returnbuybilldetailid` int(11) NOT NULL AUTO_INCREMENT,
  `Parcode` varchar(255) NOT NULL DEFAULT '',
  `returnbuybillid` int(11) NOT NULL,
  `returnbuybilldetailcatid` int(11) NOT NULL,
  `returnbuybilldetailproductid` int(11) NOT NULL,
  `returnbuybilldetailquantity` decimal(10,2) NOT NULL,
  `returnbuybilldetailprice` decimal(10,2) NOT NULL,
  `returnbuybilldetailtotalprice` decimal(10,2) NOT NULL,
  `discountvalue` decimal(10,2) NOT NULL,
  `note` varchar(256) DEFAULT NULL,
  `productunitid` int(11) NOT NULL,
  `lastbuyprice` decimal(10,2) DEFAULT NULL,
  `meanbuyprice` decimal(10,2) DEFAULT NULL,
  `lastbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `otherdetailquantity` int(11) NOT NULL DEFAULT '0',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `returnbuybilldetailpriceC` decimal(10,2) NOT NULL,
  `returnbuybilldetailtotalpriceC` decimal(10,2) NOT NULL,
  `discountvalueC` decimal(10,2) NOT NULL,
  `discounttype` decimal(10,2) NOT NULL DEFAULT '0' COMMENT 'discount percentage like 5%',
  `rowtaxval` decimal(10,2) NOT NULL,
  `rowtaxper` decimal(10,2) NOT NULL DEFAULT '0' COMMENT 'like 5%',
  `lastbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `lastbuyprice_withDiscountAndTax` decimal(10,2) DEFAULT NULL,
  PRIMARY KEY (`returnbuybilldetailid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `returnsellbill`
--

CREATE TABLE IF NOT EXISTS `returnsellbill` (
  `returnsellbillid` int(11) NOT NULL AUTO_INCREMENT,
  `returnsellbilldate` datetime DEFAULT NULL,
  `returnsellbillserial` varchar(5000) DEFAULT NULL,
  `returnsellbillclientid` int(11) NOT NULL,
  `returnsellbilltotaldeptbefor` decimal(10,2) NOT NULL,
  `returnsellbilltotaldeptafter` decimal(10,2) NOT NULL,
  `returnsellbilldiscount` varchar(255) NOT NULL DEFAULT '',
  `returnsellbilldiscounttype` int(11) NOT NULL DEFAULT '1' COMMENT '1 for direct- 2 for percent',
  `returnsellbilltotalbill` decimal(10,2) NOT NULL,
  `returnsellbillaftertotalbill` decimal(10,2) NOT NULL,
  `returnsellbilltotalpayed` decimal(10,2) NOT NULL,
  `returnsellbillfinalbill` decimal(10,2) NOT NULL,
  `returnsellbillstoreid` int(11) NOT NULL,
  `returnsellbillsysdate` datetime NOT NULL,
  `comment` text NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `returnsellbillclientname` text NOT NULL,
  `returnsellbillsaveid` int(11) NOT NULL,
  `returnsellbildirectpayment` int(11) NOT NULL DEFAULT '0' COMMENT '',
  `billnameid` int(11) NOT NULL,
  `sellerid` int(11) NOT NULL,
  `tempclientName` varchar(255) NOT NULL,
  `returnsellQuantity` decimal(10,2) NOT NULL COMMENT '',
  `deletedsellid` int(11) NOT NULL DEFAULT '0',
  `controlname` varchar(255) NOT NULL DEFAULT '0',
  `tax` decimal(10,2) NOT NULL DEFAULT '0',
  `carnumber` varchar(255) NOT NULL,
  `cartype` varchar(255) NOT NULL,
  `carchase` varchar(255) NOT NULL,
  `carmotor` varchar(255) NOT NULL,
  `costcenterid` int(11) DEFAULT NULL,
  `dailyentryid` varchar(100) NOT NULL DEFAULT '',
  `delbyuserid` int(11) NOT NULL DEFAULT '0',
  `lastReviewType` tinyint(4) NOT NULL DEFAULT '0',
  `lastReviewUser` int(11) DEFAULT NULL,
  `lastReviewDateTime` datetime DEFAULT NULL,
  `billReservation` tinyint(4) NOT NULL DEFAULT '0',
  `billReservationDate` date NOT NULL,
  `visaAccountId` int(11) NOT NULL DEFAULT '0',
  `cashPayed` decimal(10,2) NOT NULL,
  `visaPayed` decimal(10,2) NOT NULL,
  `isBankAccountTransfer` tinyint(4) NOT NULL DEFAULT '0',
  `extraDiscountPer` float NOT NULL DEFAULT '0',
  `extraDiscountVal` float NOT NULL DEFAULT '0',
  `taxOfDiscountPer` float NOT NULL DEFAULT '0',
  `taxOfDiscountVal` float NOT NULL DEFAULT '0',
  `autoSaveFlag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 completed in sellbillcontrol, 1 not completed still temp saved in ajax',
  `obgyBillType` tinyint(4) NOT NULL DEFAULT '0',
  `billoperationid` int(11) NOT NULL DEFAULT '0',
  `obygyVisitId` int(11) DEFAULT '0' COMMENT 'has id of refund visitid not main visit id we making refund on it',
  `pricetype` tinyint NOT NULL DEFAULT '0',
  `currencyId` int(11) NOT NULL DEFAULT '1',
  `sellbillno` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`returnsellbillid`),
  KEY `returnsellbilldate` (`returnsellbilldate`),
  KEY `returnsellbillclientid` (`returnsellbillclientid`),
  KEY `obgyBillType` (`obgyBillType`),
  KEY `pricetype` (`pricetype`),
  KEY `returnsellbillstoreid` (`returnsellbillstoreid`),
  KEY `sellerid` (`sellerid`),
  KEY `userid` (`userid`),
  KEY `conditions` (`conditions`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `returnsellbillcurr`
--

CREATE TABLE IF NOT EXISTS `returnsellbillcurr` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `returnsellbillid` int(11) NOT NULL,
  `conversionFactor` float NOT NULL,
  `returnsellbilldiscountC` varchar(255) NOT NULL,
  `returnsellbilltotalbillC` decimal(10,2) NOT NULL,
  `returnsellbillaftertotalbillC` decimal(10,2) NOT NULL,
  `returnsellbilltotalpayedC` decimal(10,2) NOT NULL,
  `returnsellbillfinalbillC` decimal(10,2) NOT NULL,
  `returnsellbildirectpaymentC` int(11) NOT NULL,
  `taxC` decimal(10,2) NOT NULL,
  `cashPayedC` decimal(10,2) NOT NULL,
  `visaPayedC` decimal(10,2) NOT NULL,
  `extraDiscountValC` float NOT NULL,
  `taxOfDiscountValC` float NOT NULL,
  `saveConversionFactor` float NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `returnsellbilldetail`
--

CREATE TABLE IF NOT EXISTS `returnsellbilldetail` (
  `returnsellbilldetailid` int(11) NOT NULL AUTO_INCREMENT,
  `buyprice` decimal(10,2) NOT NULL,
  `parcode` varchar(256) NOT NULL DEFAULT '',
  `returnsellbillid` int(11) NOT NULL,
  `returnsellbilldetailcatid` int(11) NOT NULL,
  `returnsellbilldetailproductid` int(11) NOT NULL,
  `returnsellbilldetailquantity` decimal(10,2) NOT NULL,
  `returnsellbilldetailprice` decimal(10,2) NOT NULL,
  `returnsellbilldetailtotalprice` decimal(10,2) NOT NULL,
  `conditions` decimal(10,2) NOT NULL,
  `note` varchar(256) DEFAULT NULL,
  `pricetype` tinyint NOT NULL DEFAULT '0',
  `discountvalue` decimal(10,2) NOT NULL,
  `productunitid` int(11) NOT NULL,
  `buydiscount` decimal(10,2) NOT NULL,
  `buydiscounttype` int(11) NOT NULL,
  `storeid` int(11) NOT NULL DEFAULT '0',
  `discounttype` decimal(10,2) NOT NULL DEFAULT '0' COMMENT 'discount percentage like 5%',
  `lastbuyprice` decimal(10,2) DEFAULT NULL,
  `meanbuyprice` decimal(10,2) DEFAULT NULL,
  `lastbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `scunitqty` int(11) NOT NULL DEFAULT '0',
  `otherdetailquantity` int(11) NOT NULL DEFAULT '0',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `pricetypepro` tinyint(4) NOT NULL DEFAULT '0',
  `proHeight` float NOT NULL DEFAULT '0',
  `proWidth` float NOT NULL DEFAULT '0',
  `soldSerialsInDetails`  TEXT NOT NULL DEFAULT '',
  `lastbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `returnsellbilldetailpriceC` decimal(10,2) NOT NULL,
  `returnsellbilldetailtotalpriceC` decimal(10,2) NOT NULL,
  `discountvalueC` decimal(10,2) NOT NULL,
  `proSellTrackingSerial` varchar(50) NOT NULL DEFAULT '',
  `lastbuyprice_withDiscountAndTax` decimal(10,2) DEFAULT NULL,
  PRIMARY KEY (`returnsellbilldetailid`),
  KEY `returnsellbillid` (`returnsellbillid`),
  KEY `returnsellbilldetailproductid` (`returnsellbilldetailproductid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `returnsellbillreview`
--

CREATE TABLE IF NOT EXISTS `returnsellbillreview` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `billid` int(11) NOT NULL,
  `reviewType` tinyint(4) NOT NULL COMMENT '0 cancel review , 1 reviewed',
  `reviewComment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `reviewuserid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL COMMENT '0 not del , 1 del',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `richproperity`
--

CREATE TABLE IF NOT EXISTS `richproperity` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `parentid` int(11) NOT NULL,
  `url` varchar(255) NOT NULL,
  `defaultval` int(11) NOT NULL,
  `showit` int(11) NOT NULL,
  `displayorder` int(11) NOT NULL,
  `groupid` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `salaryreport`
--

CREATE TABLE IF NOT EXISTS `salaryreport` (
  `salaryreportid` int(11) NOT NULL AUTO_INCREMENT,
  `employeeid` int(11) NOT NULL,
  `salaryreportdate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `salaryreportsalary` decimal(10,2) NOT NULL,
  `salaryreportdiscount` decimal(10,2) DEFAULT NULL,
  `salaryreportbouns` decimal(10,2) DEFAULT NULL,
  `salaryreportwithdrawal` decimal(10,2) DEFAULT NULL,
  `salaryreportnet` decimal(10,2) NOT NULL,
  `salarymonthdate` varchar(255) NOT NULL,
  `salarymonth` varchar(255) NOT NULL,
  `Repayment` decimal(10,2) NOT NULL,
  `Absence` decimal(10,2) NOT NULL,
  `Reward` decimal(10,2) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0' COMMENT '1 for del 0 for notdel',
  `costcenterid` int(11) DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `saveid` int(11) NOT NULL DEFAULT '0',
  `permission` decimal(10,2) NOT NULL,
  PRIMARY KEY (`salaryreportid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `save`
--

CREATE TABLE IF NOT EXISTS `save` (
  `saveid` int(11) NOT NULL AUTO_INCREMENT,
  `savename` varchar(256) NOT NULL,
  `savecurrentvalue` decimal(15,2) NOT NULL DEFAULT '0.00',
  `savedetails` text,
  `savedate` datetime NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0' COMMENT '0 for not deleted- 1 for deleted',
  `userid` int(11) NOT NULL,
  `currencyId` int(11) NOT NULL DEFAULT '1',
  `sortby` int(11) NOT NULL DEFAULT '0',
  `treeId` int(11) NOT NULL DEFAULT '0',
  `saveTreeParentType` tinyint NOT NULL DEFAULT '0',
  `inUse` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 free - 1 in use means to stop changing debt till it is free again',
  PRIMARY KEY (`saveid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `savedaily`
--

CREATE TABLE IF NOT EXISTS `savedaily` (
  `savedailyid` int(11) NOT NULL AUTO_INCREMENT,
  `savedailysavebefore` decimal(15,2) NOT NULL,
  `savedailychangeamount` decimal(10,2) NOT NULL,
  `savedailychangetype` int(11) DEFAULT NULL COMMENT '0 for plus- 1 for minus',
  `saveid` int(11) NOT NULL,
  `processname` varchar(256) NOT NULL COMMENT 'name of the process',
  `savedailymodelid` int(11) NOT NULL COMMENT '0 => ',
  `savedailysaveafter` decimal(15,2) NOT NULL,
  `savedailydate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `tablename` varchar(256) NOT NULL COMMENT 'table of this process',
  `clientid` int(11) DEFAULT '0',
  `note` TEXT NOT NULL DEFAULT '',
  `clientdebtchangeidfk` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`savedailyid`),
  KEY `saveid` (`saveid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sellandruternbilldetail`
--

CREATE TABLE IF NOT EXISTS `sellandruternbilldetail` (
  `buyprice` decimal(10,2) NOT NULL,
  `parcode` varchar(256) NOT NULL DEFAULT '',
  `sellbilldetailid` int(11) NOT NULL AUTO_INCREMENT,
  `sellbillid` int(11) NOT NULL,
  `sellbilldetailcatid` int(11) NOT NULL,
  `sellbilldetailproductid` int(11) NOT NULL,
  `sellbilldetailquantity` decimal(10,2) NOT NULL,
  `sellbilldetailprice` decimal(10,2) NOT NULL,
  `sellbilldetailtotalprice` decimal(10,2) NOT NULL,
  `discountvalue` decimal(10,2) NOT NULL,
  `note` varchar(256) DEFAULT NULL,
  `pricetype` tinyint NOT NULL DEFAULT '0',
  `sellbilldetaildate` date NOT NULL,
  `selltype` int(11) NOT NULL COMMENT '0 for sell 1 for return',
  `productunitid` int(11) NOT NULL,
  `buydiscount` decimal(10,2) NOT NULL,
  `buydiscounttype` int(11) NOT NULL,
  `storeid` int(11) NOT NULL DEFAULT '0',
  `discounttype` decimal(10,2) NOT NULL DEFAULT '0' COMMENT 'discount percentage like 5%',
  `lastbuyprice` decimal(10,2) DEFAULT NULL,
  `meanbuyprice` decimal(10,2) DEFAULT NULL,
  `lastbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `scunitqty` int(11) NOT NULL DEFAULT '0',
  `otherdetailquantity` int(11) NOT NULL DEFAULT '0',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `pricetypepro` tinyint(4) NOT NULL DEFAULT '0',
  `buyPricesHistoryBookIdQuantity`  TEXT NOT NULL DEFAULT '',
  `proHeight` float NOT NULL DEFAULT '0',
  `proWidth` float NOT NULL DEFAULT '0',
  `soldSerialsInDetails`  TEXT NOT NULL DEFAULT '',
  `lastbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `sellbilldetailpriceC` decimal(10,2) NOT NULL,
  `sellbilldetailtotalpriceC` decimal(10,2) NOT NULL,
  `discountvalueC` decimal(10,2) NOT NULL,
  `proSellTrackingSerial` varchar(50) NOT NULL DEFAULT '',
  `categorydiscount` decimal(10,2) NOT NULL DEFAULT '0',
  `lastbuyprice_withDiscountAndTax` decimal(10,2) DEFAULT NULL,
  PRIMARY KEY (`sellbilldetailid`),
  KEY `sellbillid` (`sellbillid`),
  KEY `sellbilldetailproductid` (`sellbilldetailproductid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sellbill`
--

CREATE TABLE IF NOT EXISTS `sellbill` (
  `sellbillid` int(11) NOT NULL AUTO_INCREMENT,
  `sellbilldate` datetime DEFAULT NULL,
  `sellbillserial` varchar(255) DEFAULT NULL,
  `sellbillclientid` int(11) NOT NULL DEFAULT '0',
  `sellbilltotaldeptbefor` decimal(10,2) NOT NULL,
  `sellbilltotaldeptafter` decimal(10,2) NOT NULL,
  `sellbilldiscount` varchar(255) NOT NULL DEFAULT '',
  `sellbilldiscounttype` int(11) NOT NULL DEFAULT '0',
  `sellbilltotalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbillaftertotalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbilltotalpayed` decimal(10,2) NOT NULL COMMENT '',
  `sellbillfinalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbillstoreid` int(11) NOT NULL,
  `sellbillsysdate` datetime NOT NULL,
  `comment` text NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `sellbillclientname` text NOT NULL,
  `sellbillsaveid` int(11) NOT NULL,
  `sellbildirectpayment` int(11) NOT NULL COMMENT '',
  `billnameid` int(11) NOT NULL,
  `sellerid` int(11) NOT NULL,
  `tempclientName` varchar(255) NOT NULL,
  `sellQuantity` decimal(10,2) NOT NULL COMMENT '',
  `deletedsellid` int(11) NOT NULL,
  `controlname` varchar(255) NOT NULL,
  `tax` decimal(10,2) NOT NULL DEFAULT '0',
  `carnumber` varchar(255) NOT NULL,
  `cartype` varchar(255) NOT NULL,
  `carchase` varchar(255) NOT NULL,
  `carmotor` varchar(255) NOT NULL,
  `costcenterid` int(11) DEFAULT NULL,
  `localdonw` int(11) DEFAULT '0',
  `dailyentryid` varchar(100) NOT NULL DEFAULT '',
  `obygyVisitId` int(11) DEFAULT '0',
  `onlineOrderId` int(11) DEFAULT '0',
  `delbyuserid` int(11) NOT NULL DEFAULT '0',
  `lastReviewType` tinyint(4) NOT NULL DEFAULT '0',
  `lastReviewUser` int(11) DEFAULT NULL,
  `lastReviewDateTime` datetime DEFAULT NULL,
  `delivery` decimal(10,2) NOT NULL DEFAULT '0',
  `totalafterdelivery` decimal(10,2) NOT NULL DEFAULT '0',
  `billReservation` tinyint(4) NOT NULL DEFAULT '0',
  `billReservationDate` date NOT NULL,
  `webApiId` int(11) NOT NULL DEFAULT '0',
  `visaAccountId` int(11) NOT NULL DEFAULT '0',
  `cashPayed` decimal(10,2) NOT NULL,
  `visaPayed` decimal(10,2) NOT NULL,
  `isBankAccountTransfer` tinyint(4) NOT NULL DEFAULT '0',
  `extraDiscountPer` float NOT NULL DEFAULT '0',
  `extraDiscountVal` float NOT NULL DEFAULT '0',
  `taxOfDiscountPer` float NOT NULL DEFAULT '0',
  `taxOfDiscountVal` float NOT NULL DEFAULT '0',
  `shippingDate` date NOT NULL,
  `taxBillNumber` int(11) NOT NULL DEFAULT '0',
  `collectionType` tinyint(4) NOT NULL DEFAULT '0',
  `collectionDate` date NOT NULL,
  `qrerpid` varchar(255) NOT NULL,
  `qrerpids` TEXT NOT NULL,
  `autoSaveFlag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 completed in sellbillcontrol, 1 not completed still temp saved in ajax',
  `ereason` text NOT NULL,
  `estatus` varchar(255) NOT NULL,
  `epdf` varchar(255) NOT NULL,
  `obgyBillType` tinyint(4) NOT NULL DEFAULT '0',
  `billoperationid` int(11) NOT NULL DEFAULT '0',
  `datestarting` date NOT NULL,
  `pricetype` tinyint NOT NULL DEFAULT '0',
  `currencyId` int(11) NOT NULL DEFAULT '1',
  `knownwayId` INT NULL DEFAULT NULL,
  `travelDriverId` INT NULL DEFAULT NULL,
  `travelBusId` INT NULL DEFAULT NULL,
  `travelPathId` INT NULL DEFAULT NULL,
  `travelTripId` INT NULL DEFAULT NULL,
  `travelTripTypeId` INT NULL DEFAULT NULL,
  `travelTripDateId` INT NULL DEFAULT NULL,
  `totalprodiscount` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`sellbillid`),
  KEY `sellbilldate` (`sellbilldate`),
  KEY `sellbillclientid` (`sellbillclientid`),
  KEY `obgyBillType` (`obgyBillType`),
  KEY `sellbillstoreid` (`sellbillstoreid`),
  KEY `pricetype` (`pricetype`),
  KEY `sellerid` (`sellerid`),
  KEY `userid` (`userid`),
  KEY `conditions` (`conditions`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sellbillandreturnreview`
--

CREATE TABLE IF NOT EXISTS `sellbillandreturnreview` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `billid` int(11) NOT NULL,
  `reviewType` tinyint(4) NOT NULL COMMENT '0 cancel review , 1 reviewed',
  `reviewuserid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL COMMENT '0 not del , 1 del',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sellbillandrutern`
--

CREATE TABLE IF NOT EXISTS `sellbillandrutern` (
  `sellbillid` int(11) NOT NULL AUTO_INCREMENT,
  `sellbilldate` datetime DEFAULT NULL,
  `sellbillserial` varchar(255) DEFAULT NULL,
  `sellbillclientid` int(11) NOT NULL DEFAULT '0',
  `sellbilltotaldeptbefor` decimal(10,2) NOT NULL,
  `sellbilltotaldeptafter` decimal(10,2) NOT NULL,
  `sellbilldiscount` varchar(255) NOT NULL DEFAULT '',
  `sellbilldiscounttype` int(11) NOT NULL DEFAULT '0',
  `sellbilltotalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbillaftertotalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbilltotalpayed` decimal(10,2) NOT NULL COMMENT '',
  `sellbillfinalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbillstoreid` int(11) NOT NULL,
  `sellbillsysdate` datetime NOT NULL,
  `comment` text NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `sellbillclientname` text NOT NULL,
  `sellbillsaveid` int(11) NOT NULL,
  `sellbildirectpayment` int(11) NOT NULL COMMENT '',
  `billnameid` int(11) NOT NULL,
  `sellerid` int(11) NOT NULL,
  `sellbillprice` decimal(10,2) NOT NULL,
  `returnsellbillprice` decimal(10,2) NOT NULL,
  `tempclientName` varchar(255) NOT NULL,
  `sellQuantity` decimal(10,2) NOT NULL COMMENT '',
  `returnsellQuantity` decimal(10,2) NOT NULL COMMENT '',
  `deletedsellid` int(11) NOT NULL,
  `controlname` varchar(255) NOT NULL,
  `tax` decimal(10,2) NOT NULL DEFAULT '0',
  `carnumber` varchar(255) NOT NULL,
  `cartype` varchar(255) NOT NULL,
  `carchase` varchar(255) NOT NULL,
  `carmotor` varchar(255) NOT NULL,
  `costcenterid` int(11) DEFAULT NULL,
  `dailyentryid` varchar(100) NOT NULL DEFAULT '',
  `delbyuserid` int(11) NOT NULL DEFAULT '0',
  `billReservation` tinyint(4) NOT NULL DEFAULT '0',
  `billReservationDate` date NOT NULL,
  `visaAccountId` int(11) NOT NULL DEFAULT '0',
  `cashPayed` decimal(10,2) NOT NULL,
  `visaPayed` decimal(10,2) NOT NULL,
  `isBankAccountTransfer` tinyint(4) NOT NULL DEFAULT '0',
  `extraDiscountPer` float NOT NULL DEFAULT '0',
  `extraDiscountVal` float NOT NULL DEFAULT '0',
  `taxOfDiscountPer` float NOT NULL DEFAULT '0',
  `taxOfDiscountVal` float NOT NULL DEFAULT '0',
  `autoSaveFlag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 completed in sellbillcontrol, 1 not completed still temp saved in ajax',
  `obgyBillType` tinyint(4) NOT NULL DEFAULT '0',
  `billoperationid` int(11) NOT NULL DEFAULT '0',
  `pricetype` tinyint NOT NULL DEFAULT '0',
  `currencyId` int(11) NOT NULL DEFAULT '1',
  `totalprodiscount` varchar(255) NOT NULL DEFAULT '',
  `sellbillno` varchar(255) DEFAULT NULL,
   PRIMARY KEY (`sellbillid`),
   KEY `sellbilldate` (`sellbilldate`),
   KEY `sellbillclientid` (`sellbillclientid`),
   KEY `obgyBillType` (`obgyBillType`),
   KEY `pricetype` (`pricetype`),
   KEY `sellbillstoreid` (`sellbillstoreid`),
   KEY `sellerid` (`sellerid`),
   KEY `userid` (`userid`),
   KEY `conditions` (`conditions`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sellbillandruterncurr`
--

CREATE TABLE IF NOT EXISTS `sellbillandruterncurr` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sellbillid` int(11) NOT NULL,
  `conversionFactor` float NOT NULL,
  `sellbilldiscountC` varchar(255) NOT NULL,
  `sellbilltotalbillC` decimal(10,2) NOT NULL,
  `sellbillaftertotalbillC` decimal(10,2) NOT NULL,
  `sellbilltotalpayedC` decimal(10,2) NOT NULL,
  `sellbillfinalbillC` decimal(10,2) NOT NULL,
  `sellbildirectpaymentC` int(11) NOT NULL,
  `sellbillpriceC` decimal(10,2) NOT NULL,
  `returnsellbillpriceC` decimal(10,2) NOT NULL,
  `taxC` decimal(10,2) NOT NULL,
  `cashPayedC` decimal(10,2) NOT NULL,
  `visaPayedC` decimal(10,2) NOT NULL,
  `extraDiscountValC` float NOT NULL,
  `taxOfDiscountValC` float NOT NULL,
  `saveConversionFactor` float NOT NULL,
  `totalprodiscountC` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sellbillcurr`
--

CREATE TABLE IF NOT EXISTS `sellbillcurr` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sellbillid` int(11) NOT NULL,
  `conversionFactor` float NOT NULL,
  `sellbilldiscountC` varchar(255) NOT NULL,
  `sellbilltotalbillC` decimal(10,2) NOT NULL,
  `sellbillaftertotalbillC` decimal(10,2) NOT NULL,
  `sellbilltotalpayedC` decimal(10,2) NOT NULL,
  `sellbillfinalbillC` decimal(10,2) NOT NULL,
  `sellbildirectpaymentC` int(11) NOT NULL,
  `taxC` decimal(10,2) NOT NULL,
  `deliveryC` decimal(10,2) NOT NULL,
  `totalafterdeliveryC` decimal(10,2) NOT NULL,
  `cashPayedC` decimal(10,2) NOT NULL,
  `visaPayedC` decimal(10,2) NOT NULL,
  `extraDiscountValC` float NOT NULL,
  `taxOfDiscountValC` float NOT NULL,
  `saveConversionFactor` float NOT NULL DEFAULT '1',
  `totalprodiscountC` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sellbilldetail`
--

CREATE TABLE IF NOT EXISTS `sellbilldetail` (
  `buyprice` decimal(10,2) NOT NULL,
  `parcode` varchar(256) NOT NULL DEFAULT '',
  `sellbilldetailid` int(11) NOT NULL AUTO_INCREMENT,
  `sellbillid` int(11) NOT NULL,
  `sellbilldetailcatid` int(11) NOT NULL,
  `sellbilldetailproductid` int(11) NOT NULL,
  `sellbilldetailquantity` decimal(10,2) NOT NULL,
  `sellbilldetailprice` decimal(10,2) NOT NULL,
  `sellbilldetailtotalprice` decimal(10,2) NOT NULL,
  `discountvalue` decimal(10,2) NOT NULL,
  `note` varchar(256) DEFAULT NULL,
  `pricetype` tinyint NOT NULL DEFAULT '0',
  `sellbilldetaildate` date NOT NULL,
  `productunitid` int(11) NOT NULL,
  `buydiscount` decimal(10,2) NOT NULL,
  `buydiscounttype` int(11) NOT NULL,
  `storeid` int(11) NOT NULL DEFAULT '0',
  `discounttype` decimal(10,2) NOT NULL DEFAULT '0' COMMENT 'discount percentage like 5%',
  `localdonw` int(11) DEFAULT '0',
  `lastbuyprice` decimal(10,2) DEFAULT NULL,
  `meanbuyprice` decimal(10,2) DEFAULT NULL,
  `lastbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `scunitqty` int(11) NOT NULL DEFAULT '0',
  `otherdetailquantity` int(11) NOT NULL DEFAULT '0',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `onlineOrderId` int(11) NOT NULL DEFAULT '0',
  `pricetypepro` tinyint(4) NOT NULL DEFAULT '0',
  `playstationPlayId` int(11) NOT NULL DEFAULT '0' COMMENT 'it is restaurantplaystationplay id',
  `soldSerialsInDetails`  TEXT NOT NULL DEFAULT '',
  `buyPricesHistoryBookIdQuantity`  TEXT NOT NULL DEFAULT '',
  `proHeight` float NOT NULL DEFAULT '0',
  `proWidth` float NOT NULL DEFAULT '0',
  `lastbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withTax` decimal(10,2) DEFAULT NULL,
  `sellbilldetailpriceC` decimal(10,2) NOT NULL,
  `sellbilldetailtotalpriceC` decimal(10,2) NOT NULL,
  `discountvalueC` decimal(10,2) NOT NULL,
  `proSellTrackingSerial` varchar(50) NOT NULL DEFAULT '',
  `travelBrokerId` int(11) NOT NULL DEFAULT '0',
  `categorydiscount` decimal(10,2) NOT NULL DEFAULT '0',
  `lastbuyprice_withDiscountAndTax` decimal(10,2) DEFAULT NULL,
  `prosellDiscountPer` float NOT NULL DEFAULT '0',
  `prosellDiscountPerType` tinyint(4) NOT NULL DEFAULT '0',
  `prosellDiscountVal` float NOT NULL DEFAULT '0',
  PRIMARY KEY (`sellbilldetailid`),
  KEY `sellbillid` (`sellbillid`),
  KEY `sellbilldetailproductid` (`sellbilldetailproductid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sellbilldetailoffer`
--

CREATE TABLE IF NOT EXISTS `sellbilldetailoffer` (
  `buyprice` decimal(10,2) NOT NULL,
  `parcode` varchar(256) NOT NULL DEFAULT '',
  `sellbilldetailid` int(11) NOT NULL AUTO_INCREMENT,
  `sellbillid` int(11) NOT NULL,
  `sellbilldetailcatid` int(11) NOT NULL,
  `sellbilldetailproductid` int(11) NOT NULL,
  `sellbilldetailquantity` decimal(10,2) NOT NULL,
  `sellbilldetailprice` decimal(10,2) NOT NULL,
  `sellbilldetailtotalprice` decimal(10,2) NOT NULL,
  `discountvalue` decimal(10,2) NOT NULL,
  `note` varchar(256) DEFAULT NULL,
  `pricetype` tinyint NOT NULL DEFAULT '0',
  `sellbilldetaildate` date NOT NULL,
  `productunitid` int(11) NOT NULL,
  `buydiscount` decimal(10,2) NOT NULL,
  `buydiscounttype` int(11) NOT NULL,
  `storeid` int(11) NOT NULL DEFAULT '0',
  `discounttype` decimal(10,2) NOT NULL DEFAULT '0.00',
  `localdonw` int(11) DEFAULT '0',
  `lastbuyprice` decimal(10,2) DEFAULT NULL,
  `meanbuyprice` decimal(10,2) DEFAULT NULL,
  `lastbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `meanbuyprice_withDiscount` decimal(10,2) DEFAULT NULL,
  `scunitqty` int(11) NOT NULL DEFAULT '0',
  `otherdetailquantity` int(11) NOT NULL DEFAULT '0',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `onlineOrderId` int(11) NOT NULL DEFAULT '0',
  `pricetypepro` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`sellbilldetailid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sellbilldetailorder`
--

CREATE TABLE IF NOT EXISTS `sellbilldetailorder` (
  `buyprice` decimal(10,2) NOT NULL,
  `parcode` varchar(256) NOT NULL DEFAULT '',
  `sellbilldetailid` int(11) NOT NULL AUTO_INCREMENT,
  `sellbillid` int(11) NOT NULL,
  `sellbilldetailcatid` int(11) NOT NULL,
  `sellbilldetailproductid` int(11) NOT NULL,
  `sellbilldetailquantity` decimal(10,2) NOT NULL,
  `sellbilldetailprice` decimal(10,2) NOT NULL,
  `sellbilldetailtotalprice` decimal(10,2) NOT NULL,
  `discountvalue` decimal(10,2) NOT NULL,
  `note` varchar(256) DEFAULT NULL,
  `pricetype` tinyint NOT NULL DEFAULT '0',
  `sellbilldetaildate` date NOT NULL,
  `productunitid` int(11) NOT NULL,
  `buydiscount` decimal(10,2) NOT NULL,
  `buydiscounttype` int(11) NOT NULL,
  `storeid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`sellbilldetailid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


-- --------------------------------------------------------
--
-- Table structure for table `sellbillimage`
--

CREATE TABLE IF NOT EXISTS `sellbillimage` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `sellbillid` int(11) unsigned DEFAULT NULL,
  `images` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;

--
-- Dumping data for table `sellbillimage`
--
-- --------------------------------------------------------
--
-- Table structure for table `sellbilloffer`
--

CREATE TABLE IF NOT EXISTS `sellbilloffer` (
  `sellbillid` int(11) NOT NULL AUTO_INCREMENT,
  `sellbilldate` datetime DEFAULT NULL,
  `sellbillserial` varchar(255) DEFAULT NULL,
  `sellbillclientid` int(11) NOT NULL DEFAULT '0',
  `sellbilltotaldeptbefor` decimal(10,2) NOT NULL,
  `sellbilltotaldeptafter` decimal(10,2) NOT NULL,
  `sellbilldiscount` varchar(255) NOT NULL DEFAULT '',
  `sellbilldiscounttype` int(11) NOT NULL DEFAULT '0',
  `sellbilltotalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbillaftertotalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbilltotalpayed` decimal(10,2) NOT NULL COMMENT '',
  `sellbillfinalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbillstoreid` int(11) NOT NULL,
  `sellbillsysdate` datetime NOT NULL,
  `comment` text NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `sellbillclientname` text NOT NULL,
  `sellbillsaveid` int(11) NOT NULL,
  `sellbildirectpayment` int(11) NOT NULL COMMENT '',
  `billnameid` int(11) NOT NULL,
  `sellerid` int(11) NOT NULL,
  `tempclientName` varchar(255) NOT NULL,
  `sellQuantity` decimal(10,2) NOT NULL COMMENT '',
  `deletedsellid` int(11) NOT NULL,
  `controlname` varchar(255) NOT NULL,
  `tax` decimal(10,2) NOT NULL DEFAULT '0',
  `carnumber` varchar(255) NOT NULL,
  `cartype` varchar(255) NOT NULL,
  `carchase` varchar(255) NOT NULL,
  `carmotor` varchar(255) NOT NULL,
  `costcenterid` int(11) DEFAULT NULL,
  `localdonw` int(11) DEFAULT '0',
  `dailyentryid` varchar(100) NOT NULL DEFAULT '',
  `obygyVisitId` int(11) DEFAULT '0',
  `onlineOrderId` int(11) DEFAULT '0',
  `delbyuserid` int(11) NOT NULL DEFAULT '0',
  `lastReviewType` tinyint(4) NOT NULL DEFAULT '0',
  `lastReviewUser` int(11) DEFAULT NULL,
  `lastReviewDateTime` datetime DEFAULT NULL,
  `delivery` decimal(10,2) NOT NULL DEFAULT '0',
  `totalafterdelivery` decimal(10,2) NOT NULL DEFAULT '0',
  `billReservation` tinyint(4) NOT NULL DEFAULT '0',
  `billReservationDate` date NOT NULL,
  `webApiId` int(11) NOT NULL DEFAULT '0',
  `visaAccountId` int(11) NOT NULL DEFAULT '0',
  `cashPayed` decimal(10,2) NOT NULL,
  `visaPayed` decimal(10,2) NOT NULL,
  `isBankAccountTransfer` tinyint(4) NOT NULL DEFAULT '0',
  `extraDiscountPer` float NOT NULL DEFAULT '0',
  `extraDiscountVal` float NOT NULL DEFAULT '0',
  `taxOfDiscountPer` float NOT NULL DEFAULT '0',
  `taxOfDiscountVal` float NOT NULL DEFAULT '0',
  `shippingDate` date NOT NULL,
  `taxBillNumber` int(11) NOT NULL DEFAULT '0',
  `collectionType` tinyint(4) NOT NULL DEFAULT '0',
  `collectionDate` date NOT NULL,
  `qrerpid` varchar(255) NOT NULL,
  `qrerpids` TEXT NOT NULL,
  `autoSaveFlag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 completed in sellbillcontrol, 1 not completed still temp saved in ajax',
  `ereason` text NOT NULL,
  `estatus` varchar(255) NOT NULL,
  `epdf` varchar(255) NOT NULL,
  `obgyBillType` tinyint(4) NOT NULL DEFAULT '0',
  `billoperationid` int(11) NOT NULL DEFAULT '0',
  `datestarting` date NOT NULL,
  `pricetype` tinyint NOT NULL DEFAULT '0',
  `orderSavedBillId` int(11) NOT NULL DEFAULT '0',
  `totalprodiscount` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`sellbillid`),
  KEY `sellbilldate` (`sellbilldate`),
  KEY `sellbillclientid` (`sellbillclientid`),
  KEY `obgyBillType` (`obgyBillType`),
  KEY `sellbillstoreid` (`sellbillstoreid`),
  KEY `pricetype` (`pricetype`),
  KEY `sellerid` (`sellerid`),
  KEY `userid` (`userid`),
  KEY `conditions` (`conditions`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `sellbillorder`
--

CREATE TABLE IF NOT EXISTS `sellbillorder` (
  `sellbillid` int(11) NOT NULL AUTO_INCREMENT,
  `sellbilldate` date DEFAULT NULL,
  `sellbillserial` varchar(255) DEFAULT NULL,
  `sellbillclientid` int(11) NOT NULL DEFAULT '0',
  `sellbilltotaldeptbefor` decimal(10,2) NOT NULL,
  `sellbilltotaldeptafter` decimal(10,2) NOT NULL,
  `sellbilldiscount` varchar(255) NOT NULL DEFAULT '',
  `sellbilldiscounttype` int(11) NOT NULL DEFAULT '0',
  `sellbilltotalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbillaftertotalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbilltotalpayed` decimal(10,2) NOT NULL COMMENT '',
  `sellbillfinalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbillstoreid` int(11) NOT NULL,
  `sellbillsysdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `sellbillclientname` text NOT NULL,
  `sellbillsaveid` int(11) NOT NULL,
  `sellbildirectpayment` int(11) NOT NULL COMMENT '',
  `billnameid` int(11) NOT NULL,
  `sellerid` int(11) NOT NULL,
  `tempclientName` varchar(255) NOT NULL,
  `sellQuantity` decimal(10,2) NOT NULL COMMENT '',
  `actualsellbill` int(11) NOT NULL DEFAULT '0' COMMENT 'the actual sell bill id   0 not don yet ',
  `saveAffect` int(11) NOT NULL DEFAULT '0' COMMENT ' 0 for Affect in save  1 not affect',
  PRIMARY KEY (`sellbillid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sellbillreview`
--

CREATE TABLE IF NOT EXISTS `sellbillreview` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `billid` int(11) NOT NULL,
  `reviewType` tinyint(4) NOT NULL COMMENT '0 cancel review , 1 reviewed',
  `reviewComment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `reviewuserid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL COMMENT '0 not del , 1 del',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `settingoperation`
--

CREATE TABLE IF NOT EXISTS `settingoperation` (
  `settingOperationID` int(11) NOT NULL AUTO_INCREMENT,
  `settingOperationName` varchar(100) NOT NULL,
  `workStationID` int(11) NOT NULL,
  `realTime` int(11) NOT NULL,
  `assetesID` int(11) NOT NULL,
  `workersNo` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0' COMMENT '0 for del - 1 for not del',
  `userID` int(11) NOT NULL,
  `operationDate` date NOT NULL,
  `operationType` varchar(255) NOT NULL DEFAULT '0',
  PRIMARY KEY (`settingOperationID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `shippercompanies`
--

CREATE TABLE IF NOT EXISTS `shippercompanies` (
  `companyId` int(11) NOT NULL AUTO_INCREMENT,
  `companyName` varchar(255) NOT NULL,
  `otherInfo` longtext NOT NULL,
  `tempdele` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`companyId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `simplemanufacturesetting`
--

CREATE TABLE IF NOT EXISTS `simplemanufacturesetting` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `storeid` tinyint(4) NOT NULL,
  `reducestoreamount` tinyint(4) NOT NULL COMMENT '1: yes --- 0: no',
  `productsproductionequation` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0: Manufacturing products -- 1:all products',
  `orderclient` tinyint(4) NOT NULL DEFAULT '0',
  `taskOrderName` tinyint(4) NOT NULL DEFAULT '0',
  `lowOutPriceAlert` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `sizecolor`
--

CREATE TABLE IF NOT EXISTS `sizecolor` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8 NOT NULL,
  `type` tinyint(4) NOT NULL COMMENT '0 size , 1 color',
  `userid` int(11) NOT NULL,
  `conditions` tinyint(4) NOT NULL,
  `sysdate` date NOT NULL,
  `scExcelid` int(11) NOT NULL COMMENT 'used to link products to products from another erp like siam see in buybill',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sizecolorstoredetail`
--

CREATE TABLE IF NOT EXISTS `sizecolorstoredetail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `storeid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `sizeid` int(11) NOT NULL,
  `colorid` int(11) NOT NULL,
  `parcode` varchar(300) NOT NULL,
  `buyprice` decimal(10,2) NOT NULL,
  `sellunitprice` decimal(10,2) NOT NULL,
  `quantity` decimal(10,2) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `scdExcelParcode` varchar(12) NOT NULL COMMENT 'used to link products to products from another erp like siam see in buybill',
  `inUse` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 free - 1 in use means to stop changing debt till it is free again',
  PRIMARY KEY (`id`),
  UNIQUE KEY `prosizecolor_unique` (`storeid`,`productid`,`sizeid`,`colorid`),
  KEY `productid` (`productid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `soldserialproduct`
--

CREATE TABLE IF NOT EXISTS `soldserialproduct` (
  `soldserialproductid` int(11) NOT NULL AUTO_INCREMENT,
  `productserailid` int(11) NOT NULL,
  `sellbillid` int(11) NOT NULL,
  `sellbilltype` int(11) NOT NULL COMMENT '0 for sellbill 1 for sell and return sellpart 3 returnsellbill 4 for sell and return returnpart',
  `quantity` decimal(10,2) NOT NULL,
  `del` int(11) NOT NULL COMMENT '0 for not del 1 for del',
  `clientid` int(11) NOT NULL,
  PRIMARY KEY (`soldserialproductid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sparepart`
--

CREATE TABLE IF NOT EXISTS `sparepart` (
  `sparepartid` int(11) NOT NULL AUTO_INCREMENT,
  `sparepartname` varchar(255) NOT NULL,
  `sparepartprice` decimal(10,2) NOT NULL,
  `sparepartnotes` text NOT NULL,
  `userid` int(11) NOT NULL,
  `sparepartdate` date NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`sparepartid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sparepartstore`
--

CREATE TABLE IF NOT EXISTS `sparepartstore` (
  `sparepartstoreId` int(11) NOT NULL AUTO_INCREMENT,
  `storeName` varchar(255) NOT NULL,
  `storeDate` date NOT NULL,
  `storeDescription` text NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `userId` int(11) NOT NULL,
  PRIMARY KEY (`sparepartstoreId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sparepartstoredetails`
--

CREATE TABLE IF NOT EXISTS `sparepartstoredetails` (
  `sparepartstoredetailid` int(11) NOT NULL AUTO_INCREMENT,
  `sparepartid` int(11) NOT NULL,
  `sparepartstoreId` int(11) NOT NULL,
  `partquantity` decimal(10,2) NOT NULL,
  `userid` int(11) NOT NULL,
  `sparepartstoredetaildate` date NOT NULL,
  PRIMARY KEY (`sparepartstoredetailid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `sparepartstorereport`
--

CREATE TABLE IF NOT EXISTS `sparepartstorereport` (
  `sparepartstorereportid` int(11) NOT NULL AUTO_INCREMENT,
  `sparepartid` int(11) NOT NULL,
  `sparepartstoreId` int(11) NOT NULL,
  `partquantity` decimal(10,2) NOT NULL,
  `storereporttype` int(11) NOT NULL COMMENT '0 => plus- 1 => minus',
  `storereportmodelid` int(11) NOT NULL,
  `processname` varchar(256) NOT NULL,
  `tablename` varchar(256) NOT NULL,
  `partbefore` decimal(10,2) NOT NULL,
  `partafter` decimal(10,2) NOT NULL,
  `userid` int(11) NOT NULL,
  `storereportdate` date NOT NULL,
  PRIMARY KEY (`sparepartstorereportid`),
  KEY `sparepartid` (`sparepartid`,`sparepartstoreId`),
  KEY `sparepartstoreId` (`sparepartstoreId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `stage`
--

CREATE TABLE IF NOT EXISTS `stage` (
  `stageId` int(11) NOT NULL AUTO_INCREMENT,
  `stagename` varchar(255) NOT NULL,
  `productId` int(11) NOT NULL,
  `totalhour` decimal(10,2) NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `date` varchar(255) NOT NULL,
  PRIMARY KEY (`stageId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `stagestep`
--

CREATE TABLE IF NOT EXISTS `stagestep` (
  `stagestepId` int(11) NOT NULL AUTO_INCREMENT,
  `stageId` int(11) NOT NULL,
  `stepno` int(11) NOT NULL,
  `operationId` int(11) NOT NULL,
  PRIMARY KEY (`stagestepId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `store`
--

CREATE TABLE IF NOT EXISTS `store` (
  `storeId` int(11) NOT NULL AUTO_INCREMENT,
  `storeName` varchar(256) NOT NULL,
  `storeDate` date NOT NULL,
  `storeDescription` text,
  `conditions` int(1) NOT NULL,
  `userId` int(11) NOT NULL,
  `treeId` int(11) NOT NULL DEFAULT '0',
  `treeIdBetween` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`storeId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `storedetail`
--

CREATE TABLE IF NOT EXISTS `storedetail` (
  `storedetailid` int(11) NOT NULL AUTO_INCREMENT,
  `productid` int(11) NOT NULL,
  `storeid` int(11) NOT NULL,
  `productquantity` decimal(10,2) NOT NULL,
  `userid` int(11) NOT NULL,
  `storedetaildate` date NOT NULL,
  `unittype` int(11) NOT NULL DEFAULT '0',
  `inUse` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 free - 1 in use means to stop changing debt till it is free again',
  PRIMARY KEY (`storedetailid`),
  KEY `productid` (`productid`,`storeid`),
  KEY `storeid` (`storeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `storemovement`
--

CREATE TABLE IF NOT EXISTS `storemovement` (
  `transferproductid` int(11) NOT NULL AUTO_INCREMENT,
  `storeidfrom` int(11) NOT NULL,
  `storeidto` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `transferproductamount` decimal(10,2) NOT NULL,
  `transferproductdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `comment` text NOT NULL,
  `operationnum` bigint(20) NOT NULL DEFAULT '0',
  `deloperationnum` int(11) NOT NULL DEFAULT '-1',
  `driverid` int(11) DEFAULT NULL,
  `drivertimeout` int(11) DEFAULT NULL,
  `driverdate` datetime DEFAULT NULL,
  `delivererid` int(11) DEFAULT NULL,
  `deliverdate` datetime DEFAULT NULL,
  `storetype` int(11) DEFAULT '0' COMMENT '0=>',
  `priceType` varchar(191) NOT NULL DEFAULT '',
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',`price` decimal(10,2) NOT NULL DEFAULT '0',
  `buyPricesHistoryBookData` text NOT NULL,
  `expireDate` TEXT NOT NULL DEFAULT '',
  `expireDateTo` TEXT NOT NULL DEFAULT '',
  `maincomment` TEXT NOT NULL DEFAULT '',
  `isPrepared` tinyint(4) NOT NULL DEFAULT '0',
  `useridPrepared` int(11) NOT NULL DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `recieveType` tinyint(4) NOT NULL,
  `recieveUserid` int(11) NOT NULL,
  `recieveTime` datetime NOT NULL,
  PRIMARY KEY (`transferproductid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `storereport`
--

CREATE TABLE IF NOT EXISTS `storereport` (
  `storereportid` int(11) NOT NULL AUTO_INCREMENT,
  `productid` int(11) NOT NULL,
  `storeid` int(11) NOT NULL,
  `productquantity` decimal(10,3) NOT NULL,
  `storereporttype` int(11) NOT NULL COMMENT '0 => plus- 1 => minus',
  `storereportmodelid` int(11) NOT NULL,
  `processname` varchar(256) NOT NULL,
  `tablename` varchar(256) NOT NULL,
  `productbefore` decimal(10,3) NOT NULL,
  `productafter` decimal(10,3) NOT NULL,
  `userid` int(11) NOT NULL,
  `storereportdate` date NOT NULL,
  `sizeid` int(11) NOT NULL DEFAULT '0',
  `colorid` int(11) NOT NULL DEFAULT '0',
  `unittype` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`storereportid`),
  KEY `productid` (`productid`,`storeid`),
  KEY `storeid` (`storeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `studentabsences`
--

CREATE TABLE IF NOT EXISTS `studentabsences` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `onlys` int(11) UNSIGNED DEFAULT NULL,
  `del` int(11) UNSIGNED DEFAULT NULL,
  `arrivedtime` int(11) UNSIGNED DEFAULT NULL,
  `addtoday` datetime DEFAULT NULL,
  `adduserid` double DEFAULT NULL,
  `uniqid` int(11) UNSIGNED DEFAULT NULL,
  `studentid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `todaysend` date DEFAULT NULL,
  `timesend` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deviceid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectgroupid` int(11) UNSIGNED DEFAULT NULL,
  `studentaddsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `studentaddsubjectdetailid` int(11) UNSIGNED DEFAULT NULL,
  `deltoday` datetime DEFAULT NULL,
  `deluserid` double DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `studentaddsubjectdetails`
--

CREATE TABLE IF NOT EXISTS `studentaddsubjectdetails` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `del` int(11) UNSIGNED DEFAULT NULL,
  `addtoday` datetime DEFAULT NULL,
  `adduserid` double DEFAULT NULL,
  `studentid` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectgroupid` int(11) UNSIGNED DEFAULT NULL,
  `studentaddsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `deltoday` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deluserid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `studentname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `studentphone` int(11) UNSIGNED DEFAULT NULL,
  `deviceid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `subjectname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `subjectprice` tinyint(1) UNSIGNED DEFAULT NULL,
  `subjectgroupname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `subjectgroupprice` int(11) UNSIGNED DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `studentaddsubjects`
--

CREATE TABLE IF NOT EXISTS `studentaddsubjects` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `del` int(11) UNSIGNED DEFAULT NULL,
  `addtoday` datetime DEFAULT NULL,
  `adduserid` double DEFAULT NULL,
  `deltoday` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deluserid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `studentsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectgroupid` int(11) UNSIGNED DEFAULT NULL,
  `studentid` text COLLATE utf8mb4_unicode_ci,
  `deviceid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
-- --------------------------------------------------------

--
-- Table structure for table `students`
--

CREATE TABLE IF NOT EXISTS `students` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `del` int(11) UNSIGNED DEFAULT NULL,
  `addtoday` datetime DEFAULT NULL,
  `adduserid` double DEFAULT NULL,
  `deltoday` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deluserid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `studentname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `studentdatebirth` double DEFAULT NULL,
  `studentnumber` double DEFAULT NULL,
  `idnumber` double DEFAULT NULL,
  `studentphone` double DEFAULT NULL,
  `parentsname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `parentsphone` double DEFAULT NULL,
  `studentaddress` tinyint(1) UNSIGNED DEFAULT NULL,
  `clientid` int(11) UNSIGNED DEFAULT NULL,
  `branchid` double DEFAULT NULL,
  `studentimage` tinyint(1) UNSIGNED DEFAULT NULL,
  `studentnote` tinyint(1) UNSIGNED DEFAULT NULL,
  `studentaddsubjectid` tinyint(1) UNSIGNED DEFAULT NULL,
  `studentsubjectid` tinyint(1) UNSIGNED DEFAULT NULL,
  `studentsubjectgroupid` tinyint(1) UNSIGNED DEFAULT NULL,
  `studentspaymentsystemid` tinyint(1) UNSIGNED DEFAULT NULL,
  `studentaddsubjectdetailid` tinyint(1) UNSIGNED DEFAULT NULL,
  `paymonths` int(11) UNSIGNED DEFAULT NULL,
  `paytype` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `paytypenum` int(11) UNSIGNED DEFAULT NULL,
  `payprice` int(11) UNSIGNED DEFAULT NULL,
  `countmonths` tinyint(1) UNSIGNED DEFAULT NULL,
  `newprice` tinyint(1) UNSIGNED DEFAULT NULL,
  `paystartdate` date DEFAULT NULL,
  `payenddate` date DEFAULT NULL,
  `studentspayid` int(11) UNSIGNED DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


-- --------------------------------------------------------

--
-- Table structure for table `studentsetting`
--

CREATE TABLE IF NOT EXISTS `studentsetting` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `updateuserid` double DEFAULT NULL,
  `studentorplayer` tinyint(1) UNSIGNED DEFAULT NULL,
  `paymentsystems1` int(11) UNSIGNED DEFAULT NULL,
  `paymentsystems2` tinyint(1) UNSIGNED DEFAULT NULL,
  `paymentsystems3` tinyint(1) UNSIGNED DEFAULT NULL,
  `showdel` tinyint(1) UNSIGNED DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


-- --------------------------------------------------------

--
-- Table structure for table `studentsexams`
--

CREATE TABLE IF NOT EXISTS `studentsexams` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deltoday` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deluserid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `del` int(11) UNSIGNED DEFAULT NULL,
  `addtoday` datetime DEFAULT NULL,
  `adduserid` double DEFAULT NULL,
  `studentaddsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectgroupid` int(11) UNSIGNED DEFAULT NULL,
  `studentid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `examname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `greatdegree` int(11) UNSIGNED DEFAULT NULL,
  `examsstudent` int(11) UNSIGNED DEFAULT NULL,
  `updatetoday` datetime DEFAULT NULL,
  `updateuserid` double DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `studentsexamsval`
--

CREATE TABLE IF NOT EXISTS `studentsexamsval` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `studentid` int(11) UNSIGNED DEFAULT NULL,
  `examsvalue` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `examspresence` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `studentaddsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectgroupid` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `del` int(11) UNSIGNED DEFAULT NULL,
  `addtoday` datetime DEFAULT NULL,
  `adduserid` double DEFAULT NULL,
  `deltoday` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deluserid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `studentsexamid` int(11) UNSIGNED DEFAULT NULL,
  `updatetoday` datetime DEFAULT NULL,
  `updateuserid` double DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `studentspaymentsystems`
--

CREATE TABLE IF NOT EXISTS `studentspaymentsystems` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `del` int(11) UNSIGNED DEFAULT NULL,
  `addtoday` datetime DEFAULT NULL,
  `adduserid` double DEFAULT NULL,
  `deltoday` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deluserid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `paymentname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `paymentprice` int(11) UNSIGNED DEFAULT NULL,
  `paymentmonth` int(11) UNSIGNED DEFAULT NULL,
  `studentaddsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectid` int(11) UNSIGNED DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `studentspays`
--

CREATE TABLE IF NOT EXISTS`studentspays` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `del` int(11) UNSIGNED DEFAULT NULL,
  `addtoday` datetime DEFAULT NULL,
  `adduserid` double DEFAULT NULL,
  `deltoday` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deluserid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `studentaddsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectgroupid` int(11) UNSIGNED DEFAULT NULL,
  `studentspaymentsystemid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `studentaddsubjectdetailid` int(11) UNSIGNED DEFAULT NULL,
  `studentid` int(11) UNSIGNED DEFAULT NULL,
  `paymonths` int(11) UNSIGNED DEFAULT NULL,
  `paytype` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `paytypenum` int(11) UNSIGNED DEFAULT NULL,
  `payprice` int(11) UNSIGNED DEFAULT NULL,
  `countmonths` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `newprice` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `paystartdate` date DEFAULT NULL,
  `payenddate` date DEFAULT NULL,
  `paytypered` tinyint(1) UNSIGNED DEFAULT NULL,
  `paykind` int(11) UNSIGNED DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `studentsubjectgroupdays`
--

CREATE TABLE IF NOT EXISTS `studentsubjectgroupdays` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `del` int(11) UNSIGNED DEFAULT NULL,
  `addtoday` datetime DEFAULT NULL,
  `adduserid` double DEFAULT NULL,
  `deltoday` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deluserid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `studentsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `studentsubjectgroupid` int(11) UNSIGNED DEFAULT NULL,
  `dayar` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `dayen` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `day` int(11) UNSIGNED DEFAULT NULL,
  `timeform` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `timeto` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `useit` int(11) UNSIGNED DEFAULT NULL,
  `updatetoday` datetime DEFAULT NULL,
  `updateuserid` double DEFAULT NULL,
  `deviceid` tinyint(1) UNSIGNED DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `studentsubjectgroups`
--

CREATE TABLE IF NOT EXISTS `studentsubjectgroups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `del` int(11) UNSIGNED DEFAULT NULL,
  `addtoday` datetime DEFAULT NULL,
  `adduserid` double DEFAULT NULL,
  `deltoday` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deluserid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `studentsubjectid` int(11) UNSIGNED DEFAULT NULL,
  `subjectgroupname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `subjectgroupprice` int(11) UNSIGNED DEFAULT NULL,
  `useit` int(11) UNSIGNED DEFAULT NULL,
  `updatetoday` datetime DEFAULT NULL,
  `updateuserid` double DEFAULT NULL,
  `deviceid` tinyint(1) UNSIGNED DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `studentsubjects`
--

CREATE TABLE IF NOT EXISTS `studentsubjects` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `del` int(11) UNSIGNED DEFAULT NULL,
  `addtoday` datetime DEFAULT NULL,
  `adduserid` double DEFAULT NULL,
  `deltoday` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deluserid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `subjectname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `subjectprice` int(11) UNSIGNED DEFAULT NULL,
  `ipaddress` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deviceid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `useit` int(11) UNSIGNED DEFAULT NULL,
  `incometypeid` int(11) UNSIGNED DEFAULT NULL,
  `updatetoday` datetime DEFAULT NULL,
  `updateuserid` double DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `suppay`
--

CREATE TABLE IF NOT EXISTS `suppay` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idsupdeptchange` int(11) NOT NULL,
  `paytype` int(11) NOT NULL DEFAULT '0',
  `accountid` int(11) DEFAULT NULL,
  `del` int(11) NOT NULL DEFAULT '0',
  `bankid` int(11) DEFAULT NULL,
  `checkno` int(11) DEFAULT NULL,
  `beneficiaryname` varchar(255) DEFAULT NULL,
  `chckdate` date DEFAULT NULL,
  `chckimage` varchar(255) DEFAULT NULL,
  `senderbank` varchar(50) DEFAULT NULL,
  `details` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `supplier`
--

CREATE TABLE IF NOT EXISTS `supplier` (
  `supplierid` int(11) NOT NULL AUTO_INCREMENT,
  `suppliername` varchar(256) NOT NULL,
  `supplieraddress` varchar(256) DEFAULT NULL,
  `supplierphone` varchar(20) DEFAULT NULL,
  `suppliercurrentDebt` decimal(10,2) DEFAULT '0',
  `supplierdetails` text,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `userid` int(11) NOT NULL,
  `supplierdate` date NOT NULL,
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `category_id` varchar(200) DEFAULT NULL,
  `typesupplier_id` varchar(200) DEFAULT NULL,
  `linkedClientId` int(11) NOT NULL DEFAULT '0',
  `inUse` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 free - 1 in use means to stop changing debt till it is free again',
  `suppliercode` varchar(256) NOT NULL,
  `goverareaid` varchar(256) NOT NULL,
  `namepayeecheck` varchar(256) NOT NULL,
  `suppliermobile` varchar(256) NOT NULL,
  `warrantyOfficer` varchar(256) NOT NULL,
  `warrantymobile` varchar(256) NOT NULL,
  `sellername` varchar(256) NOT NULL,
  `sellermobile` varchar(256) NOT NULL,
  `taxnumber` varchar(255) DEFAULT NULL,
  `supplierTypeForTree` tinyint(4) NOT NULL DEFAULT '0' COMMENT '',
  `treeId` int(11) NOT NULL DEFAULT '0',
  `sullpierCurrencyid` int(11) NOT NULL DEFAULT '1',
  `suppliercurrentDebtInCurrency` decimal(10,2) DEFAULT '0',
  PRIMARY KEY (`supplierid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `supplierdebtchange`
--

CREATE TABLE IF NOT EXISTS `supplierdebtchange` (
  `supplierdebtchangeid` int(11) NOT NULL AUTO_INCREMENT,
  `supplierid` int(11) NOT NULL,
  `supplierdebtchangebefore` decimal(10,2) NOT NULL,
  `supplierdebtchangeamount` decimal(10,2) NOT NULL,
  `supplierdebtchangetype` int(11) NOT NULL COMMENT '0 => plus- 1 => minus',
  `processname` varchar(256) NOT NULL,
  `supplierdebtchangemodelid` int(11) NOT NULL,
  `supplierdebtchangeafter` decimal(10,2) NOT NULL,
  `supplierdebtchangedate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `tablename` varchar(500) NOT NULL,
  `comment` text,
  `del` int(11) NOT NULL DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `saveid` int(11) DEFAULT NULL,
  `costcenterid` int(11) DEFAULT NULL,
  `currencyId` int(11) NOT NULL,
  `conversionFactor` float NOT NULL,
  `payedInCurrency` decimal(10,2) NOT NULL,
  `saveConversionFactor` float NOT NULL,
  `debtchangbeforeInSupplierCurrency` decimal(10,2) NOT NULL,
  `debtchangamountInSupplierCurrency` decimal(10,2) NOT NULL,
  `debtchangafterInSupplierCurrency` decimal(10,2) NOT NULL,
  PRIMARY KEY (`supplierdebtchangeid`),
  KEY `idx_supplierdebtchange` (`tablename`(255)),
  KEY `supplierid` (`supplierid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `suppliersopen`
--

CREATE TABLE IF NOT EXISTS `supplieropen` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` float NOT NULL,
  `treeId` int(11) NOT NULL,
  `dailyentryid` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `supplieropendebtchange`
--

CREATE TABLE IF NOT EXISTS `supplieropendebtchange` (
  `supplieropendebtchangeid` int(11) NOT NULL AUTO_INCREMENT,
  `opensupplierid` int(11) NOT NULL,
  `supplierdebtchangebefore` decimal(10,2) NOT NULL,
  `supplierdebtchangeamount` decimal(10,2) NOT NULL,
  `supplierdebtchangetype` int(11) NOT NULL COMMENT '0 => plus- 1 => minus',
  `processname` varchar(256) NOT NULL,
  `supplierdebtchangemodelid` int(11) NOT NULL,
  `supplierdebtchangeafter` decimal(10,2) NOT NULL,
  `supplierdebtchangedate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `tablename` varchar(500) NOT NULL,
  `comment` text,
  `del` int(11) NOT NULL DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `saveid` int(11) DEFAULT NULL,
  `costcenterid` int(11) DEFAULT NULL,
  `currencyId` int(11) NOT NULL,
  `conversionFactor` float NOT NULL,
  `payedInCurrency` decimal(10,2) NOT NULL,
  `saveConversionFactor` float NOT NULL,
  PRIMARY KEY (`supplieropendebtchangeid`),
  KEY `idx_supplierdebtchange` (`tablename`(255)),
  KEY `supplierid` (`opensupplierid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `supplieropenexchangeorclosing`
--

CREATE TABLE IF NOT EXISTS `supplieropenexchangeorclosing` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `thetype` tinyint(4) NOT NULL COMMENT '0 exchange , 1 closing',
  `supplieropenid` int(11) NOT NULL,
  `saveid` int(11) NOT NULL,
  `assetorexpense` tinyint(4) NOT NULL COMMENT '0 asset, 1 expense',
  `assetorexpenseid` int(11) NOT NULL,
  `val` float NOT NULL,
  `dailyentryid` int(11) NOT NULL,
  `note` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `tamweenbill`
--

CREATE TABLE IF NOT EXISTS `tamweenbill` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clientid` int(11) NOT NULL,
  `quantity` int(11) NOT NULL,
  `billdate` datetime NOT NULL,
  `billMonthDays` int(11) NOT NULL,
  `comment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `tamweenclientdetail`
--

CREATE TABLE IF NOT EXISTS `tamweenclientdetail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clientid` int(11) NOT NULL,
  `noOfPersonsTamween` int(11) NOT NULL,
  `noOfPersonsDa3m` int(11) NOT NULL,
  `cardNum` varchar(30) NOT NULL,
  `cardPassword` varchar(6) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `tamweenda3mstatus`
--

CREATE TABLE IF NOT EXISTS `tamweenda3mstatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clientid` int(11) NOT NULL,
  `month` date NOT NULL,
  `tamweenStatus` tinyint(4) NOT NULL COMMENT '0 client didnot take it,1 client take it',
  `da3mStatus` tinyint(4) NOT NULL COMMENT '0 client didnot take it,1 client take it,   bread is in da3m',
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  `useridTamween` int(11) NOT NULL,
  `sysdateTamween` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `tamweenremainstatus`
--

CREATE TABLE IF NOT EXISTS `tamweenremainstatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clientid` int(11) NOT NULL,
  `month` date NOT NULL,
  `remainstatus` tinyint(4) NOT NULL COMMENT '0 didnot take it, 1 take it',
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `del` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `taskorder`
--

CREATE TABLE IF NOT EXISTS `taskorder` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `startdate` date NOT NULL,
  `enddate` date NOT NULL,
  `productId` int(11) NOT NULL,
  `num` decimal(10,2) NOT NULL,
  `userId` int(11) NOT NULL,
  `thedate` date NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0' COMMENT '0 for notdel- 1for del',
  `clientid` int(11) NOT NULL,
  `file` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `taskorderproducts`
--

CREATE TABLE IF NOT EXISTS `taskorderproducts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `taskorderid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `unitid` int(11) NOT NULL,
  `quantity` decimal(10,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `taskscases`
--

CREATE TABLE IF NOT EXISTS `taskscases` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `del` int(11) unsigned DEFAULT NULL,
  `taskcase` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

--
-- Dumping data for table `taskscases`
--

INSERT INTO `taskscases` (`id`, `del`, `taskcase`) VALUES
(1, 0, 'Ù…Ù‡Ù…Ø© Ø¬Ø¯ÙŠØ¯Ù‡'),
(2, 0, 'ØªØ­Øª Ø§Ù„ØªÙ†ÙÙŠØ°'),
(3, 0, 'ØªÙ… Ø§Ù„ØªÙ†ÙÙŠØ°'),
(4, 0, 'Ù„Ù… ÙŠØªÙ… Ø§Ù„ØªÙ†ÙÙŠØ°'),
(5, 0, 'ØªÙ… Ø§Ù„Ø§Ù„ØºØ§Ø¡');

-- --------------------------------------------------------
--
-- Table structure for table `temreturnsellbill`
--

CREATE TABLE IF NOT EXISTS `temreturnsellbill` (
  `returnsellbillid` int(11) NOT NULL AUTO_INCREMENT,
  `returnsellbilldate` date DEFAULT NULL,
  `returnsellbillserial` varchar(255) DEFAULT NULL,
  `returnsellbillclientid` int(11) NOT NULL,
  `returnsellbilltotaldeptbefor` decimal(10,2) NOT NULL,
  `returnsellbilltotaldeptafter` decimal(10,2) NOT NULL,
  `returnsellbilldiscount` varchar(255) NOT NULL DEFAULT '',
  `returnsellbilldiscounttype` int(11) NOT NULL DEFAULT '1' COMMENT '1 for direct- 2 for percent',
  `returnsellbilltotalbill` decimal(10,2) NOT NULL,
  `returnsellbillaftertotalbill` decimal(10,2) NOT NULL,
  `returnsellbilltotalpayed` decimal(10,2) NOT NULL,
  `returnsellbillfinalbill` decimal(10,2) NOT NULL,
  `returnsellbillstoreid` int(11) NOT NULL,
  `returnsellbillsysdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `returnsellbillclientname` text NOT NULL,
  `returnsellbillsaveid` int(11) NOT NULL,
  `returnsellbildirectpayment` int(11) NOT NULL DEFAULT '0' COMMENT '',
  `billnameid` int(11) NOT NULL,
  `sellerid` int(11) NOT NULL,
  `tempclientName` varchar(255) NOT NULL,
  `returnsellQuantity` decimal(10,2) NOT NULL COMMENT '',
  `deletedsellid` int(11) NOT NULL DEFAULT '0',
  `controlname` varchar(255) NOT NULL DEFAULT '0',
  `tax` decimal(10,2) NOT NULL DEFAULT '0',
  PRIMARY KEY (`returnsellbillid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `temreturnsellbilldetail`
--

CREATE TABLE IF NOT EXISTS `temreturnsellbilldetail` (
  `returnsellbilldetailid` int(11) NOT NULL AUTO_INCREMENT,
  `buyprice` decimal(10,2) NOT NULL,
  `parcode` varchar(256) NOT NULL DEFAULT '',
  `returnsellbillid` int(11) NOT NULL,
  `returnsellbilldetailcatid` int(11) NOT NULL,
  `returnsellbilldetailproductid` int(11) NOT NULL,
  `returnsellbilldetailquantity` decimal(10,2) NOT NULL,
  `returnsellbilldetailprice` decimal(10,2) NOT NULL,
  `returnsellbilldetailtotalprice` decimal(10,2) NOT NULL,
  `conditions` decimal(10,2) NOT NULL,
  `note` varchar(256) DEFAULT NULL,
  `pricetype` tinyint NOT NULL DEFAULT '0',
  `discountvalue` decimal(10,2) NOT NULL,
  `productunitid` int(11) NOT NULL,
  `buydiscount` decimal(10,2) NOT NULL,
  `buydiscounttype` int(11) NOT NULL,
  `storeid` int(11) NOT NULL DEFAULT '0',
  `actualqty` int(11) NOT NULL,
  PRIMARY KEY (`returnsellbilldetailid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `temsellandruternbilldetail`
--

CREATE TABLE IF NOT EXISTS `temsellandruternbilldetail` (
  `buyprice` decimal(10,2) NOT NULL,
  `parcode` varchar(256) NOT NULL DEFAULT '',
  `sellbilldetailid` int(11) NOT NULL AUTO_INCREMENT,
  `sellbillid` int(11) NOT NULL,
  `sellbilldetailcatid` int(11) NOT NULL,
  `sellbilldetailproductid` int(11) NOT NULL,
  `sellbilldetailquantity` decimal(10,2) NOT NULL,
  `sellbilldetailprice` decimal(10,2) NOT NULL,
  `sellbilldetailtotalprice` decimal(10,2) NOT NULL,
  `discountvalue` decimal(10,2) NOT NULL,
  `note` varchar(256) DEFAULT NULL,
  `pricetype` tinyint NOT NULL DEFAULT '0',
  `sellbilldetaildate` date NOT NULL,
  `selltype` int(11) NOT NULL COMMENT '0 for sell 1 for return',
  `productunitid` int(11) NOT NULL,
  `buydiscount` decimal(10,2) NOT NULL,
  `buydiscounttype` int(11) NOT NULL,
  `storeid` int(11) NOT NULL DEFAULT '0',
  `actualqty` int(11) NOT NULL,
  PRIMARY KEY (`sellbilldetailid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `temsellbill`
--

CREATE TABLE IF NOT EXISTS `temsellbill` (
  `sellbillid` int(11) NOT NULL AUTO_INCREMENT,
  `sellbilldate` date DEFAULT NULL,
  `sellbillserial` varchar(255) DEFAULT NULL,
  `sellbillclientid` int(11) NOT NULL DEFAULT '0',
  `sellbilltotaldeptbefor` decimal(10,2) NOT NULL,
  `sellbilltotaldeptafter` decimal(10,2) NOT NULL,
  `sellbilldiscount` varchar(255) NOT NULL DEFAULT '',
  `sellbilldiscounttype` int(11) NOT NULL DEFAULT '0',
  `sellbilltotalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbillaftertotalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbilltotalpayed` decimal(10,2) NOT NULL COMMENT '',
  `sellbillfinalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbillstoreid` int(11) NOT NULL,
  `sellbillsysdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `sellbillclientname` text NOT NULL,
  `sellbillsaveid` int(11) NOT NULL,
  `sellbildirectpayment` int(11) NOT NULL COMMENT '',
  `billnameid` int(11) NOT NULL,
  `sellerid` int(11) NOT NULL,
  `tempclientName` varchar(255) NOT NULL,
  `sellQuantity` decimal(10,2) NOT NULL COMMENT '',
  `deletedsellid` int(11) NOT NULL,
  `controlname` varchar(255) NOT NULL,
  `tax` decimal(10,2) NOT NULL DEFAULT '0',
  PRIMARY KEY (`sellbillid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `temsellbillandrutern`
--

CREATE TABLE IF NOT EXISTS `temsellbillandrutern` (
  `sellbillid` int(11) NOT NULL AUTO_INCREMENT,
  `sellbilldate` date DEFAULT NULL,
  `sellbillserial` varchar(255) DEFAULT NULL,
  `sellbillclientid` int(11) NOT NULL DEFAULT '0',
  `sellbilltotaldeptbefor` decimal(10,2) NOT NULL,
  `sellbilltotaldeptafter` decimal(10,2) NOT NULL,
  `sellbilldiscount` varchar(255) NOT NULL DEFAULT '',
  `sellbilldiscounttype` int(11) NOT NULL DEFAULT '0',
  `sellbilltotalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbillaftertotalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbilltotalpayed` decimal(10,2) NOT NULL COMMENT '',
  `sellbillfinalbill` decimal(10,2) NOT NULL COMMENT '',
  `sellbillstoreid` int(11) NOT NULL,
  `sellbillsysdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `sellbillclientname` text NOT NULL,
  `sellbillsaveid` int(11) NOT NULL,
  `sellbildirectpayment` int(11) NOT NULL COMMENT '',
  `billnameid` int(11) NOT NULL,
  `sellerid` int(11) NOT NULL,
  `sellbillprice` decimal(10,2) NOT NULL,
  `returnsellbillprice` decimal(10,2) NOT NULL,
  `tempclientName` varchar(255) NOT NULL,
  `sellQuantity` decimal(10,2) NOT NULL COMMENT '',
  `returnsellQuantity` decimal(10,2) NOT NULL COMMENT '',
  `deletedsellid` int(11) NOT NULL,
  `controlname` varchar(255) NOT NULL,
  `tax` decimal(10,2) NOT NULL DEFAULT '0',
  PRIMARY KEY (`sellbillid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `temsellbilldetail`
--

CREATE TABLE IF NOT EXISTS `temsellbilldetail` (
  `buyprice` decimal(10,2) NOT NULL,
  `parcode` varchar(256) NOT NULL DEFAULT '',
  `sellbilldetailid` int(11) NOT NULL AUTO_INCREMENT,
  `sellbillid` int(11) NOT NULL,
  `sellbilldetailcatid` int(11) NOT NULL,
  `sellbilldetailproductid` int(11) NOT NULL,
  `sellbilldetailquantity` decimal(10,2) NOT NULL,
  `sellbilldetailprice` decimal(10,2) NOT NULL,
  `sellbilldetailtotalprice` decimal(10,2) NOT NULL,
  `discountvalue` decimal(10,2) NOT NULL,
  `note` varchar(256) DEFAULT NULL,
  `pricetype` tinyint NOT NULL DEFAULT '0',
  `sellbilldetaildate` date NOT NULL,
  `productunitid` int(11) NOT NULL,
  `buydiscount` decimal(10,2) NOT NULL,
  `buydiscounttype` int(11) NOT NULL,
  `storeid` int(11) NOT NULL DEFAULT '0',
  `actualqty` int(11) NOT NULL,
  PRIMARY KEY (`sellbilldetailid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `toworkshoporder`
--

CREATE TABLE IF NOT EXISTS `toworkshoporder` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `driverIdBack` int(11) NOT NULL,
  `deliverIdBack` int(11) NOT NULL,
  `orderNo` varchar(100) NOT NULL,
  `driverId` int(11) NOT NULL,
  `workshopId` int(11) NOT NULL,
  `productNo` int(11) NOT NULL,
  `deliverWorkshopDate` datetime NOT NULL,
  `deliverId` int(11) NOT NULL,
  `branchId` int(11) NOT NULL,
  `orderStatus` int(11) NOT NULL,
  `sysDate` datetime NOT NULL,
  `del` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `recieveWorkshopDate` datetime NOT NULL,
  `deliverBranchDate` datetime NOT NULL,
  `recieveBranchDate` datetime NOT NULL,
  `drivertimeout` int(11) NOT NULL DEFAULT '0',
  `driverdelay` int(11) NOT NULL DEFAULT '0',
  `workshoptimeout` int(11) NOT NULL DEFAULT '0',
  `workshopdelay` int(11) NOT NULL DEFAULT '0',
  `drivertimeoutback` int(11) NOT NULL DEFAULT '0',
  `driverdelayback` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `toworkshoporderbill`
--

CREATE TABLE IF NOT EXISTS `toworkshoporderbill` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `toworkshoporderid` int(11) NOT NULL,
  `billid` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `transferbtweenbankaccount`
--

CREATE TABLE IF NOT EXISTS `transferbtweenbankaccount` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `bankidfrom` int(11) NOT NULL,
  `accountidfrom` int(11) NOT NULL,
  `bankidto` int(11) NOT NULL,
  `accountidto` int(11) NOT NULL,
  `transfervalue` decimal(10,2) NOT NULL,
  `transferdate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` tinyint(4) NOT NULL,
  `dailyentryid` int(11) NOT NULL,
  `comment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `transfermoney`
--

CREATE TABLE IF NOT EXISTS `transfermoney` (
  `transfermoneyid` int(11) NOT NULL AUTO_INCREMENT,
  `saveidfrom` int(11) NOT NULL,
  `saveidto` int(11) NOT NULL,
  `transfermoneyvalue` decimal(10,2) NOT NULL,
  `transfermoneydate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `comment` varchar(255) DEFAULT NULL,
  `currencyId` int(11) NOT NULL,
  `conversionFactor` float NOT NULL,
  `conversionFactorFrom` float NOT NULL,
  `conversionFactorTo` float NOT NULL,
  `transfermoneyvalueInCurrency` decimal(10,2) NOT NULL,
  PRIMARY KEY (`transfermoneyid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `unit`
--

CREATE TABLE IF NOT EXISTS `unit` (
  `unitId` int(11) NOT NULL AUTO_INCREMENT,
  `unitName` varchar(256) NOT NULL,
  `unitSymbol` varchar(256) DEFAULT NULL COMMENT '',
  `unitDescription` text,
  `unitDate` date NOT NULL,
  `conditions` int(1) NOT NULL DEFAULT '0',
  `userId` int(11) NOT NULL,
  PRIMARY KEY (`unitId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `user`
--

CREATE TABLE IF NOT EXISTS `user` (
  `userid` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `usergroupid` int(11) NOT NULL,
  `employeename` varchar(256) NOT NULL,
  `currentdate` date NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `saveid` int(11) NOT NULL,
  `userstoreid` int(11) NOT NULL DEFAULT '0',
  `awardrate` decimal(10,2) NOT NULL DEFAULT '0' COMMENT '',
  `searchinonesave` int(11) NOT NULL DEFAULT '0' COMMENT '0 no 1 yes',
  `branchId` int(11) NOT NULL,
  `question` text NOT NULL,
  `answer` text NOT NULL,
  `blockedByLimits` int(11) NOT NULL COMMENT '1 blocked by user no in license',
  `loginip` varchar(50) NOT NULL,
  `lastactivetime` datetime NOT NULL,
  `directSaveBills` tinyint(4) NOT NULL DEFAULT '0',
  `userstoreidDef` int(11) NOT NULL DEFAULT '0',
  `deviceType` varchar(10) NOT NULL,
  `empid` int(11) NOT NULL DEFAULT '0',
  `obygyDoctorId` int(11) NOT NULL DEFAULT '0',
  `lang` varchar(191) NOT NULL,
  `allowRemoteAccess` tinyint(4) NOT NULL DEFAULT '0',
  `allowRemoteAccessMobile` tinyint(4) NOT NULL DEFAULT '0',
  `viewclients` tinyint(4) NOT NULL DEFAULT '1',
  `viewbills` tinyint(4) NOT NULL DEFAULT '1',
  `storeSupervisor` tinyint(4) NOT NULL DEFAULT '0',
  `storeSupervisorStores` varchar(255) NOT NULL,
  `projectids` varchar(255) NOT NULL DEFAULT '0',
  `bankids` varchar(255) NOT NULL DEFAULT '0',
  `saveids` varchar(255) NOT NULL DEFAULT '0',
  `searchinonestorebalance` tinyint(4) NOT NULL DEFAULT '0',
  `storeids` varchar(255) NOT NULL DEFAULT '0',
  `webApiId` int(11) NOT NULL DEFAULT '0',
  `closeSavid` int(11) NOT NULL,
  `charityids` VARCHAR(255) NOT NULL DEFAULT '0',
  PRIMARY KEY (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `usergroup`
--

CREATE TABLE IF NOT EXISTS `usergroup` (
  `usergroupid` int(11) NOT NULL AUTO_INCREMENT,
  `usergroupname` varchar(255) NOT NULL DEFAULT '',
  `usergroupdescription` text,
  `currentdate` date NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `startpage` varchar(255) NOT NULL,
  `level` int(11) NOT NULL,
  `savedailydate` int(11) NOT NULL DEFAULT '0' COMMENT '0 for no 1 for yes',
  `hidemenu` int(11) NOT NULL DEFAULT '0' COMMENT '0 for hide 1 for  display',
  `hidecat` int(11) NOT NULL DEFAULT '0' COMMENT '0 for hide 1 for  display',
  `clientnegative` int(11) NOT NULL DEFAULT '1' COMMENT '1 for yes 0 for no',
  `suplliernegative` int(11) NOT NULL DEFAULT '1' COMMENT '1 for yes 0 for no',
  `storenegative` int(11) NOT NULL DEFAULT '1' COMMENT '1 for yes 0 for no',
  `directDiscount` decimal(10,2) NOT NULL DEFAULT '0',
  `percentageDiscount` decimal(10,2) NOT NULL DEFAULT '0',
  `priceupdate` int(11) NOT NULL DEFAULT '0' COMMENT '0 for not update 1 for updat',
  `allowEditDelInBills` int(11) NOT NULL DEFAULT '0' COMMENT '0allowed - 1 not allowed',
  `allowEditDelInBuyBills` int(11) NOT NULL DEFAULT '0',
  `showsStorerQuantity` int(11) NOT NULL DEFAULT '0',
  `showSellAllPrice` int(11) NOT NULL DEFAULT '0',
  `showSellHalfPrice` int(11) NOT NULL DEFAULT '0',
  `showSellUnitPrice` int(11) NOT NULL DEFAULT '0',
  `showBuyPrice` int(11) NOT NULL DEFAULT '0',
  `productno` int(11) NOT NULL DEFAULT '0',
  `kempilano` int(11) NOT NULL DEFAULT '0',
  `productnotsellno` int(11) NOT NULL DEFAULT '0',
  `clientcheckno` int(11) DEFAULT '0',
  `suppliercheckno` int(11) NOT NULL DEFAULT '0',
  `productRequist` int(11) NOT NULL DEFAULT '0',
  `otherRequist` int(11) NOT NULL DEFAULT '0',
  `toWorkShopOrder` int(11) NOT NULL DEFAULT '0',
  `insuranceBill` int(11) NOT NULL DEFAULT '0',
  `sellreportpricetype` int(11) NOT NULL DEFAULT '0',
  `netprofit` int(11) NOT NULL DEFAULT '0',
  `hideproductcatid` int(11) DEFAULT '0',
  `directSaveBills` tinyint(4) NOT NULL DEFAULT '0',
  `seeAllHalls` tinyint(4) NOT NULL DEFAULT '0',
  `homePageIcon` tinyint(4) DEFAULT '0',
  `sendKitchen` tinyint(4) NOT NULL,
  `printKitchen` tinyint(4) NOT NULL,
  `endBill` tinyint(4) NOT NULL,
  `endPrintBill` tinyint(4) NOT NULL,
  `showManualBackup` int(11) NOT NULL,
  `autoKitchenPrint` tinyint(4) NOT NULL DEFAULT '0',
  `takeAway` tinyint(4) NOT NULL DEFAULT '0',
  `delivery` tinyint(4) NOT NULL DEFAULT '0',
  `hall` tinyint(4) NOT NULL DEFAULT '0',
  `deleteMovementManage` tinyint(4) NOT NULL DEFAULT '0',
  `allowBillDelete` tinyint(4) NOT NULL,
  `billDeletePassword` varchar(255) NOT NULL,
  `reviewBillsAllowedTables` varchar(20) NOT NULL,
  `downloadClientPhones` tinyint(4) NOT NULL DEFAULT '0',
  `showstoredetailprice` tinyint(4) NOT NULL DEFAULT '0',
  `stopDiscountOfTotalControl` tinyint(4) NOT NULL DEFAULT '0',
  `discountOfTotalControlEditable` tinyint(4) NOT NULL DEFAULT '0',
  `discountOfTotalControlMTGDA` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'MTGDA is MTGDA more than group discount Allowed',
  `kitchenPayedVal` tinyint(4) NOT NULL DEFAULT '0',
  `kitchenPayedChange` tinyint(4) NOT NULL DEFAULT '0',
  `showsIndexStatistics` tinyint(4) NOT NULL DEFAULT '1',
  `restaurantplaystationpalyBtn` tinyint(4) NOT NULL DEFAULT '0',
  `restaurantDefaultPage` tinyint(4) NOT NULL DEFAULT '0',
  `mandobMethod` tinyint(4) NOT NULL DEFAULT '0',
  `showsIndexCharts` tinyint(4) NOT NULL DEFAULT '1',
  `addClientInBill` tinyint(4) NOT NULL DEFAULT '0',
  `addsupplierInBill` tinyint(4) NOT NULL DEFAULT '0',
  `hideBillPrices` tinyint(4) NOT NULL DEFAULT '0',
  `editUserPrivlage` tinyint(4) NOT NULL DEFAULT '0',
  `showSerializeBtn` tinyint(4) NOT NULL DEFAULT '0',
  `showClientAndSupplierOne` tinyint(4) NOT NULL DEFAULT '0',
  `allowStoreMoveUpdateDel` tinyint(4) NOT NULL DEFAULT '0',
  `showsIndexProductBelowLimitReport` tinyint(4) NOT NULL DEFAULT '0',
  `storeSupervisorShow` tinyint(4) NOT NULL DEFAULT '0',
  `showProfitInsideBill` tinyint(4) NOT NULL DEFAULT '0',
  `showSaveBalanceAfterClose` tinyint(4) NOT NULL DEFAULT '0',
  `dontChooseStore` tinyint(4) NOT NULL DEFAULT '0',
  `canEditAddDiscountPercentage` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`usergroupid`),
  UNIQUE KEY `grouppermsionid_UNIQUE` (`usergroupid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `usergroupadmin`
--

CREATE TABLE IF NOT EXISTS `usergroupadmin` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `propertyid` int(11) NOT NULL,
  `isallowed` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 allowed,1not allowed',
  PRIMARY KEY (`id`),
  UNIQUE KEY `propertyid` (`propertyid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `vatpayment`
--

CREATE TABLE IF NOT EXISTS `vatpayment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `amount` decimal(10,2) NOT NULL,
  `saveid` int(11) NOT NULL,
  `comment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL,
  `conditions` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `workshop`
--

CREATE TABLE IF NOT EXISTS `workshop` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `thedate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `del` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `workstation`
--

CREATE TABLE IF NOT EXISTS `workstation` (
  `workstationid` int(11) NOT NULL AUTO_INCREMENT,
  `workname` varchar(255) NOT NULL,
  `workerhours` decimal(10,2) NOT NULL,
  `assetshours` decimal(10,2) NOT NULL,
  `date` varchar(255) NOT NULL COMMENT '',
  `conditions` int(11) NOT NULL DEFAULT '0' COMMENT '0del-1-notdel',
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`workstationid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `workstationassets`
--

CREATE TABLE IF NOT EXISTS `workstationassets` (
  `workstationassetsId` int(11) NOT NULL AUTO_INCREMENT,
  `workstationid` int(11) NOT NULL,
  `assetsId` varchar(255) NOT NULL,
  `workhours` decimal(10,2) NOT NULL,
  `efficiency` decimal(10,2) NOT NULL,
  PRIMARY KEY (`workstationassetsId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `workstationworker`
--

CREATE TABLE IF NOT EXISTS `workstationworker` (
  `workstationworkerId` int(11) NOT NULL AUTO_INCREMENT,
  `workstationid` int(11) NOT NULL,
  `employeeId` varchar(255) NOT NULL,
  `workhours` decimal(10,2) NOT NULL,
  `efficiency` decimal(10,2) NOT NULL,
  PRIMARY KEY (`workstationworkerId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `typeclient`
--

CREATE TABLE IF NOT EXISTS `typeclient` (
  `typeId` int(11) NOT NULL AUTO_INCREMENT,
  `typeName` varchar(255) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `comments` text NOT NULL,
  `typeDate` date NOT NULL,
  PRIMARY KEY (`typeId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `typesimpotencetreatment`
--

CREATE TABLE IF NOT EXISTS `typesimpotencetreatment` (
  `typesimpotencetreatmentid` int(11) NOT NULL AUTO_INCREMENT,
  `typesimpotencetreatmentname` varchar(256) DEFAULT NULL,
  `typesimpotencetreatmentdate` datetime NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(1) NOT NULL,
  `typesimpotencetreatmentcomment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`typesimpotencetreatmentid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

-- --------------------------------------------------------

--
-- Table structure for table `typesupplier`
--

CREATE TABLE IF NOT EXISTS `typesupplier` (
  `typeId` int(11) NOT NULL AUTO_INCREMENT,
  `typeName` varchar(100) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `comments` text NOT NULL,
  `typeDate` date NOT NULL,
  `category_id` varchar(50) DEFAULT NULL,
    PRIMARY KEY (`typeId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `premium`
--

CREATE TABLE IF NOT EXISTS `premium` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `value` int(11) NOT NULL,
  `premiumclient_id` int(11) NOT NULL,
  `payed` int(11) NOT NULL DEFAULT '0',
  `conditions` int(11) NOT NULL DEFAULT '0',
  `rest` int(11) NOT NULL DEFAULT '0',
  `payment_date` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `premiumclient`
--

CREATE TABLE IF NOT EXISTS `premiumclient` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `client_id` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `date` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `premiumautomatic`
--

CREATE TABLE IF NOT EXISTS `premiumautomatic` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Totalinstallment` decimal(10,2) NOT NULL,
  `presenter_dir` decimal(10,2) NOT NULL,
  `presenter_per` decimal(10,2) NOT NULL,
  `date` date NOT NULL,
  `remain_amount` decimal(10,2) NOT NULL,
  `installment_nos` int(11) NOT NULL,
  `installment_months` int(11) NOT NULL,
  `installment_days` int(11) NOT NULL,
  `premiumclient_id` int(11) NOT NULL,
  `client_id` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


-- --------------------------------------------------------

--
-- Table structure for table `premiuminstallments`
--

CREATE TABLE IF NOT EXISTS `premiuminstallments` (
  `id_installment` int(11) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `value` int(11) NOT NULL,
  `premiumauo_id` int(11) NOT NULL,
  `payed` int(11) NOT NULL DEFAULT '0',
  `conditions` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id_installment`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=24 ;

-- --------------------------------------------------------

--
-- Table structure for table `faida`
--

CREATE TABLE IF NOT EXISTS `faida` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `client_id` int(11) NOT NULL,
  `premmium` varchar(100) NOT NULL,
  `comment` text NOT NULL,
  `user_id` int(11) NOT NULL,
  `store_id` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0' COMMENT '(0=all) (1=approval)(2=refusal)',
  `installment_duration` int(11) NOT NULL,
  `total_amount` int(11) NOT NULL,
  `presenter` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;


-- --------------------------------------------------------


--
-- Table structure for table `faidaproduct`
--

CREATE TABLE IF NOT EXISTS `faidaproduct` (
  `faida_prod_id` int(11) NOT NULL AUTO_INCREMENT,
  `parcode` int(11) DEFAULT NULL,
  `comment` text,
  `productunit` float DEFAULT NULL,
  `pronum` float DEFAULT NULL,
  `scunitname` int(11) DEFAULT NULL,
  `bouns` float DEFAULT NULL,
  `pricetypepro` int(11) DEFAULT NULL,
  `proprice` int(11) DEFAULT NULL,
  `discounttype` float DEFAULT NULL,
  `Faida_id` int(11) DEFAULT NULL,
  `product_id` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `faidaproducttotalprice` decimal(10,2) NOT NULL,
  PRIMARY KEY (`faida_prod_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

-- --------------------------------------------------------


--
-- Table structure for table `faidadirector`
--

CREATE TABLE IF NOT EXISTS `faidadirector` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
  `faida_id` int(11) NOT NULL,
  `conditions` int(11) DEFAULT '0' COMMENT '(0=>Approval)(1=>Refusal)',
  `comment` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- --------------------------------------------------------


--
-- Table structure for table `resturantcategory`
--

CREATE TABLE IF NOT EXISTS `resturantcategory` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category_id` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `product_id` int(11) DEFAULT NULL,
  `date` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `resturantcategory`
--


-- --------------------------------------------------------


--
-- Table structure for table `languages`
--

CREATE TABLE IF NOT EXISTS `languages` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `locale` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` tinyint(1) unsigned DEFAULT NULL,
  `is_default` smallint(1) NOT NULL DEFAULT '0',
  `lang_dir` tinyint(1) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=3 ;

--
-- Dumping data for table `languages`
--

-- --------------------------------------------------------


--
-- Table structure for table `youtube_link`
--

CREATE TABLE IF NOT EXISTS `youtube_link` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `url` varchar(255) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `transferclientaccounts`
--

CREATE TABLE IF NOT EXISTS `transferclientaccounts` (
  `transferid` int(11) NOT NULL AUTO_INCREMENT,
  `clientidfrom` int(11) NOT NULL,
  `clientidto` int(11) NOT NULL,
  `transfervalue` decimal(10,2) NOT NULL,
  `transferdate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `comment` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`transferid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `knownways`
--

CREATE TABLE IF NOT EXISTS `knownways` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `sellbillstatus`
--

CREATE TABLE IF NOT EXISTS `sellbillstatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sellbillid` int(11) NOT NULL,
  `status` varchar(255) NOT NULL COMMENT 'new - prepare - shipped - deliver - refused',
  `userid` int(11) NOT NULL,
  `sysdate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `saveclose`
--

CREATE TABLE IF NOT EXISTS `saveclose` (
  `savecloseid` int(11) NOT NULL AUTO_INCREMENT,
  `saveidfrom` int(11) NOT NULL,
  `saveidto` int(11) NOT NULL,
  `saveclosevalue` decimal(10,2) NOT NULL,
  `saveclosedate` date NOT NULL,
  `userid` int(11) NOT NULL,
  `conditions` int(11) NOT NULL DEFAULT '0',
  `dailyentryid` int(11) NOT NULL DEFAULT '0',
  `comment` varchar(255) DEFAULT NULL,
  `currencyId` int(11) NOT NULL,
  `conversionFactor` float NOT NULL,
  `conversionFactorFrom` float NOT NULL,
  `conversionFactorTo` float NOT NULL,
  `saveclosevalueInCurrency` decimal(10,2) NOT NULL,
  PRIMARY KEY (`savecloseid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------
--
-- Table structure for table `charities`
--
CREATE TABLE IF NOT EXISTS `charities` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `del` int(11) unsigned DEFAULT NULL,
  `sysdate` datetime DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `del_date` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deluserid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `charityname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `charitynumber` int(11) unsigned DEFAULT NULL,
  `charityphone` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `charityaddress` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `charityimage` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `charitynote` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `update_date` datetime DEFAULT NULL,
  `updateuserid` double DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `beneficiaries`
--

CREATE TABLE IF NOT EXISTS `beneficiaries` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `del` int(11) unsigned DEFAULT NULL,
  `sysdate` datetime DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `del_date` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deluserid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `area_id` int(11) unsigned DEFAULT NULL,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nickname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone_no` int(11) unsigned DEFAULT NULL,
  `address` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `age` int(11) unsigned DEFAULT NULL,
  `idnumber` int(11) unsigned DEFAULT NULL,
  `marital_status` int(11) unsigned DEFAULT NULL,
  `work` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `workplace` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `diseas` VARCHAR(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status_description` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `social_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `health_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `floors_no` int(11) unsigned DEFAULT NULL,
  `rooms_no` int(11) unsigned DEFAULT NULL,
  `rent` int(11) unsigned DEFAULT NULL,
  `bathroom` tinyint(1) unsigned DEFAULT NULL,
  `flooring` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ceiling` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `walls` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `lighting` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `hall` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `bedroom` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `bathroom_desc` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kitchen` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `cooker` tinyint(1) unsigned DEFAULT NULL,
  `cooker_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `cooker_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `cooker_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `washer` tinyint(1) unsigned DEFAULT NULL,
  `washer_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `washer_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `washer_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `fridge` tinyint(1) unsigned DEFAULT NULL,
  `fridge_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `fridge_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `fridge_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `fan` tinyint(1) unsigned DEFAULT NULL,
  `fan_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `fan_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `fan_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone` int(11) unsigned DEFAULT NULL,
  `phone_nu` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `casset` int(11) unsigned DEFAULT NULL,
  `casset_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `casset_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `casset_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `blender` tinyint(1) unsigned DEFAULT NULL,
  `blender_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `blender_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `blender_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tv` tinyint(1) unsigned DEFAULT NULL,
  `tv_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tv_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tv_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `machine_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `machine_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `machine_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `machine_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `bed` tinyint(1) unsigned DEFAULT NULL,
  `bed_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `bed_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `bed_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `wardrobe` tinyint(1) unsigned DEFAULT NULL,
  `wardrobe_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `wardrobe_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `wardrobe_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `couch` tinyint(1) unsigned DEFAULT NULL,
  `couch_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `couch_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `couch_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `salon` tinyint(1) unsigned DEFAULT NULL,
  `salon_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `salon_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `salon_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `chair` tinyint(1) unsigned DEFAULT NULL,
  `chair_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `chair_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `chair_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `library` int(11) unsigned DEFAULT NULL,
  `library_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `library_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `library_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `carpet` tinyint(1) unsigned DEFAULT NULL,
  `carpet_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `carpet_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `carpet_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `mat` tinyint(1) unsigned DEFAULT NULL,
  `mat_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `mat_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `mat_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `blanket` tinyint(1) unsigned DEFAULT NULL,
  `blanket_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `blanket_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `blanket_notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `beneficiaries_needs` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `observer_needs` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nearest_shop` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nearest_neighbour` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `other_opinion` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `observer_opinion` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `final_opinion` int(11) unsigned DEFAULT NULL,
  `reasons` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `update_date` datetime DEFAULT NULL,
  `updateuserid` double DEFAULT NULL,
  `charity_id` int(11) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `beneficiaries_family`
--

CREATE TABLE IF NOT EXISTS `beneficiaries_family` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `beneficiaries_id` int(11) unsigned DEFAULT NULL,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `relation` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `age` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `id_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `job` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `salary` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `health_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `education_status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `health__status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `beneficiaries_eco`
--

CREATE TABLE IF NOT EXISTS `beneficiaries_eco` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `beneficiaries_id` int(11) unsigned DEFAULT NULL,
  `income` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `paying` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1;
-- --------------------------------------------------------

--
-- Table structure for table `disease`
--

CREATE TABLE IF NOT EXISTS `disease` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `sysdate` date DEFAULT NULL,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1;

-- --------------------------------------------------------

--
-- Table structure for table `area`
--

CREATE TABLE IF NOT EXISTS `area` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `sysdate` date DEFAULT NULL,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1;
-- --------------------------------------------------------

--
-- Table structure for table `subvention`
--

CREATE TABLE IF NOT EXISTS `subvention` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `del` int(11) unsigned DEFAULT NULL,
  `sysdate` datetime DEFAULT NULL,
  `user_id` int(11) unsigned DEFAULT NULL,
  `charity_id` int(11) unsigned DEFAULT NULL,
  `beneficier_id` int(11) unsigned DEFAULT NULL,
  `financial_aid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `inkind_aid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `guarantee_type_id` int(11) unsigned DEFAULT NULL,
  `notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `subventionpay`
--

CREATE TABLE IF NOT EXISTS `subventionpay` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `del` int(11) unsigned DEFAULT NULL,
  `sysdate` datetime DEFAULT NULL,
  `user_id` int(11) unsigned DEFAULT NULL,
  `charity_id` int(11) unsigned DEFAULT NULL,
  `benefeciary_id` int(11) unsigned DEFAULT NULL,
  `financial_aid` int(11) unsigned DEFAULT NULL,
  `inkind_aid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `month` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `onlinecat`
--

CREATE TABLE IF NOT EXISTS `onlinecat` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(256) NOT NULL,
  `name_en` varchar(255) DEFAULT NULL,
  `sysdate` date NOT NULL,
  `parentid` int(11) NOT NULL DEFAULT '0',
  `user_id` int(11) NOT NULL,
  `conditions` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------

--
-- Table structure for table `searchfilters`
--

CREATE TABLE IF NOT EXISTS `searchfilters` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(256) NOT NULL,
  `name_en` varchar(255) DEFAULT NULL,
  `sysdate` date NOT NULL,
  `parentid` int(11) NOT NULL DEFAULT '0',
  `user_id` int(11) NOT NULL,
  `conditions` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------


--
-- Structure for view `returnsellbillview`
--
-- DROP TABLE IF EXISTS `returnsellbillview`;

-- CREATE VIEW `returnsellbillview` AS select `returnsellbill`.`returnsellbillid` AS `returnsellbillid`,`returnsellbill`.`returnsellbillserial` AS `returnsellbillserial`,`returnsellbill`.`returnsellbillaftertotalbill` AS `returnsellbillaftertotalbill`,`returnsellbill`.`returnsellbilldate` AS `returnsellbilldate`,`returnsellbill`.`returnsellbilltotalpayed` AS `returnsellbilltotalpayed`,`returnsellbill`.`returnsellbillfinalbill` AS `returnsellbillfinalbill`,`returnsellbill`.`conditions` AS `conditions`,`returnsellbill`.`returnsellbillclientid` AS `returnsellbillclientid`,`returnsellbill`.`sellerid` AS `sellerid`,`returnsellbill`.`userid` AS `userid`,`returnsellbill`.`returnsellbillstoreid` AS `returnsellbillstoreid`,`returnsellbill`.`returnsellbillsaveid` AS `returnsellbillsaveid`,`client`.`clientname` AS `clientname`,`editedbill`.`returnsellbillid` AS `newSellbillidAfterEdit`,`returnsellbill`.`dailyentryid` AS `dailyentryid` from ((`returnsellbill` left join `client` on((`returnsellbill`.`returnsellbillclientid` = `client`.`clientid`))) left join `returnsellbill` `editedbill` on((`returnsellbill`.`returnsellbillid` = `editedbill`.`deletedsellid`)));

-- --------------------------------------------------------

--
-- Structure for view `sellbillandruternview`
--
-- DROP TABLE IF EXISTS `sellbillandruternview`;

-- CREATE VIEW `sellbillandruternview` AS select `sellbillandrutern`.`sellbillid` AS `sellbillid`,`sellbillandrutern`.`sellbillaftertotalbill` AS `sellbillaftertotalbill`,`sellbillandrutern`.`sellbilldate` AS `sellbilldate`,`sellbillandrutern`.`sellbilltotalpayed` AS `sellbilltotalpayed`,`sellbillandrutern`.`sellbillfinalbill` AS `sellbillfinalbill`,`sellbillandrutern`.`conditions` AS `conditions`,`sellbillandrutern`.`sellbillclientid` AS `sellbillclientid`,`sellbillandrutern`.`sellerid` AS `sellerid`,`sellbillandrutern`.`userid` AS `userid`,`sellbillandrutern`.`sellbillstoreid` AS `sellbillstoreid`,`sellbillandrutern`.`sellbillsaveid` AS `sellbillsaveid`,`client`.`clientname` AS `clientname`,`editedbill`.`sellbillid` AS `newSellbillidAfterEdit`,`sellbillandrutern`.`dailyentryid` AS `dailyentryid` from ((`sellbillandrutern` left join `client` on((`sellbillandrutern`.`sellbillclientid` = `client`.`clientid`))) left join `sellbillandrutern` `editedbill` on((`sellbillandrutern`.`sellbillid` = `editedbill`.`deletedsellid`)));

-- --------------------------------------------------------

--
-- Structure for view `sellbillview`
--
-- DROP TABLE IF EXISTS `sellbillview`;

-- CREATE VIEW `sellbillview` AS select `sellbill`.`sellbillid` AS `sellbillid`,`sellbill`.`sellbillserial` AS `sellbillserial`,`sellbill`.`sellbillaftertotalbill` AS `sellbillaftertotalbill`,`sellbill`.`sellbilldate` AS `sellbilldate`,`sellbill`.`sellbilltotalpayed` AS `sellbilltotalpayed`,`sellbill`.`sellbillfinalbill` AS `sellbillfinalbill`,`sellbill`.`conditions` AS `conditions`,`sellbill`.`sellbillclientid` AS `sellbillclientid`,`sellbill`.`sellerid` AS `sellerid`,`sellbill`.`userid` AS `userid`,`sellbill`.`sellbillstoreid` AS `sellbillstoreid`,`sellbill`.`sellbillsaveid` AS `sellbillsaveid`,`client`.`clientname` AS `clientname`,`editedbill`.`sellbillid` AS `newSellbillidAfterEdit`,`sellbill`.`dailyentryid` AS `dailyentryid` from ((`sellbill` left join `client` on((`sellbill`.`sellbillclientid` = `client`.`clientid`))) left join `sellbill` `editedbill` on((`sellbill`.`sellbillid` = `editedbill`.`deletedsellid`)));

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


-- sql needed to be executed once ----------------------------------------------
-- ALTER TABLE `relusergroupproperties` DROP INDEX `usergroupid`, ADD UNIQUE `usergroupid` ( `usergroupid`, `propertyid`);
-- ALTER TABLE `sizecolorstoredetail` DROP INDEX `prosizecolor_unique`, ADD UNIQUE `prosizecolor_unique` (`storeid`, `productid`,`sizeid`,`colorid`);
-- ALTER TABLE `programsettings` CHANGE `parcodeDigits` `parcodeDigits` INT(11) NOT NULL DEFAULT '5';
-- ALTER TABLE `restaurantplaystation` DROP `theType`;
UPDATE productunit join product on product.productId = productunit.productid SET proUnitParcode = CONCAT(LPAD(product.productId,5,0) , LPAD(productunit.unitid,2,0)) ,proUnitSellAllPrice = (product.productSellAllPrice*productunit.productnumber),proUnitSellHalfPrice = (product.productSellHalfPrice*productunit.productnumber),proUnitSellUnitPrice = (product.productSellUnitPrice*productunit.productnumber),proUnitBuyPrice = (product.productBuyPrice*productunit.productnumber) where productunit.proUnitParcode = '';
-- ALTER TABLE `buypriceshistorybook` ADD CONSTRAINT `theDate` UNIQUE( `theDate`, `storeId`, `productid`, `sizeid`, `colorid`);
-- ALTER TABLE `restaurantplaystationplay` DROP `psCard`;
update sellbill JOIN sellbilldetail ON sellbilldetail.sellbillid = sellbill.sellbillid set sellbill.pricetype = sellbilldetail.pricetype;
update supplier set suppliercurrentDebtInCurrency =suppliercurrentDebt where sullpierCurrencyid=1;
-- for eman
UPDATE programsettings SET importproduct = '1';
-- -----------------------------------------------------------------------------
-- alter table employee add empCode int(11) NOT NULL;
-- update employee set empCode = employeeId;
-- alter table employee add unique(empCode);
-- -------------------------------------------------------------------------------