-- Table structure for table `faq`
--

CREATE TABLE `faq` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `MAINCATEGORY` int NOT NULL DEFAULT '0',
  `NAMEEN` varchar(100) NOT NULL DEFAULT '',
  `NAMEFR` varchar(100) NOT NULL DEFAULT '',
  `CONTENTEN` varchar(2000) NOT NULL DEFAULT '',
  `CONTENTFR` varchar(2000) NOT NULL DEFAULT '',
  `LINKS` varchar(100) NOT NULL DEFAULT '',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `faq`
--


--
-- Table structure for table `itemPricing`
--

CREATE TABLE `itemPricing` (
  `ITEMID` int NOT NULL,
  `QTY` int NOT NULL,
  `PRICE` decimal(19,4) NOT NULL,
  `LENGTH` decimal(19,4) NOT NULL,
  `WIDTH` decimal(19,4) NOT NULL,
  `HEIGHT` decimal(19,4) NOT NULL,
  `WEIGHT` decimal(19,6) NOT NULL,
  `PIECES` int NOT NULL,
  `ITEMOPTION` varchar(30) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`ITEMID`,`QTY`,`ITEMOPTION`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `itemPricing`
--

INSERT INTO `itemPricing` VALUES (4000000,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000002,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000003,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000007,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000008,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000035,1000,195.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000036,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000037,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000062,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000063,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000064,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000068,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000069,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000071,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000081,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000082,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000083,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000087,500,140.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000087,1000,165.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000087,1500,190.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000087,2000,215.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000087,5000,365.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000094,500,140.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000094,1000,165.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000094,1500,190.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000094,2000,215.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000094,5000,365.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000099,500,140.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000099,1000,165.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000099,1500,190.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000099,2000,215.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000099,5000,365.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000102,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000103,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000104,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000105,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000106,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000107,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000109,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000112,500,116.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000112,1000,240.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000112,1500,305.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000113,1000,170.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000115,500,116.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000115,1000,155.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000115,1500,185.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000116,500,116.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000116,1000,155.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000116,1500,185.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000120,500,140.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000120,1000,165.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000120,1500,190.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000120,2000,215.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000120,5000,365.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000126,500,116.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000126,1000,240.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000126,1500,305.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000128,500,116.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000128,1000,240.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000128,1500,305.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000132,500,116.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000132,1000,240.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000132,1500,305.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000133,500,140.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000133,1000,165.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000133,1500,190.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000133,2000,215.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000133,5000,365.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000134,500,140.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000134,1000,165.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000134,1500,190.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000134,2000,215.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000134,5000,365.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000258,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000391,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000436,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000437,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000438,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000439,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000440,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000441,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000442,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000443,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000453,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000454,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000455,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000456,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000457,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000460,500,0.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000460,1000,0.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000460,1500,0.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000460,2000,0.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000461,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000462,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000479,1000,150.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000479,2000,225.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000480,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000480,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000481,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000481,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000483,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000483,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000484,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000484,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000485,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000485,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000486,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000486,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000487,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000487,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000488,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000488,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000489,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000489,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000490,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000490,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000491,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000491,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000492,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000492,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000493,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000493,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000494,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000494,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000495,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000495,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000496,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000496,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000498,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000498,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000499,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000499,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000500,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000500,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000501,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000501,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000502,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000502,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000503,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000503,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000504,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000504,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000505,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000505,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000506,1000,120.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000506,2000,148.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000507,500,138.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000507,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000507,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000507,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000507,5000,305.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000510,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000510,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000510,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000510,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000510,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000511,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000511,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000511,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000511,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000511,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000512,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000512,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000512,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000512,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000512,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000516,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000516,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000516,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000516,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000516,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000517,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000517,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000517,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000517,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000517,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000518,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000518,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000518,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000518,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000518,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000520,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000520,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000520,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000520,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000520,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000523,-1,0.0000,0.0000,0.0000,0.0000,0.000000,1,''),(4000526,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000526,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000526,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000526,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000526,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000527,500,140.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000527,1000,165.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000527,1500,190.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000527,2000,215.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000527,5000,365.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000528,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000528,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000528,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000528,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000528,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000529,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000529,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000529,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000529,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000529,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000530,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000530,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000530,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000530,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000530,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000531,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000531,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000531,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000531,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000531,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000532,500,135.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000532,1000,158.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000532,1500,182.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000532,2000,205.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000532,5000,340.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000543,1000,215.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000543,1500,232.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000543,2000,256.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000544,1000,216.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000544,1500,232.0000,0.0000,0.0000,0.0000,0.000000,0,''),(4000544,2000,256.0000,0.0000,0.0000,0.0000,0.000000,0,''),(5000082,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000082,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000084,500,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000084,1000,78.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000085,500,40.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000085,1000,55.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000089,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000089,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000090,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000090,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000091,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000091,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000092,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000092,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000093,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000093,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000094,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000094,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000095,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000095,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000096,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000096,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000097,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000097,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000098,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000098,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000099,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000099,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000100,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000100,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000101,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000101,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000102,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000102,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000103,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000103,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000104,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000104,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000105,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000105,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000106,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000106,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000107,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000107,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000108,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000108,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000109,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000109,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000112,500,40.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000112,1000,55.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000113,500,40.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000113,1000,55.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000114,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000114,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000115,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000115,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000116,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000116,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000117,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000117,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000118,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000118,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000119,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000119,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000120,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000120,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000121,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000121,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000122,500,35.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000122,1000,40.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000123,500,40.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000123,1000,55.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000124,500,40.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000124,1000,55.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000125,500,40.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000125,1000,55.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000126,250,0.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000126,500,0.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000126,1000,0.0000,12.0000,9.0000,3.0000,6.000000,1,''),(5000130,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000130,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000130,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000131,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000131,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000131,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000132,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000132,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000132,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000133,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000133,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000133,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000134,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000134,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000134,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000135,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000135,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000135,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000136,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000136,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000136,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000137,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000137,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000137,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000138,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000138,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000138,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000139,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000139,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000139,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000140,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000140,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000140,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000141,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000141,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000141,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000142,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000142,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000142,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000143,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000143,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000143,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000144,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000144,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000144,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000145,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000145,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000145,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000146,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000146,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000146,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000147,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000147,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000147,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000148,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000148,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000148,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000149,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000149,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000149,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000150,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000150,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000150,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000151,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000151,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000151,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000152,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000152,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000152,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000153,250,231.0000,12.0000,9.0000,3.0000,5.000000,1,''),(5000153,500,327.0000,12.0000,9.0000,6.0000,8.000000,1,''),(5000153,750,417.0000,12.0000,9.0000,6.0000,13.000000,2,''),(5000153,1000,510.0000,12.0000,9.0000,6.0000,16.000000,2,''),(5000154,500,152.0000,12.0000,9.0000,3.0000,9.000000,1,''),(5000154,1000,178.0000,12.0000,9.0000,6.0000,18.000000,1,''),(5000154,1500,213.0000,12.0000,9.0000,9.0000,27.000000,1,''),(5000154,2000,238.0000,12.0000,9.0000,6.0000,36.000000,2,''),(5000155,500,152.0000,12.0000,9.0000,3.0000,9.000000,1,''),(5000155,1000,178.0000,12.0000,9.0000,6.0000,18.000000,1,''),(5000155,1500,213.0000,12.0000,9.0000,9.0000,27.000000,1,''),(5000155,2000,238.0000,12.0000,9.0000,6.0000,36.000000,2,''),(5000156,500,152.0000,12.0000,9.0000,3.0000,9.000000,1,''),(5000156,1000,178.0000,12.0000,9.0000,6.0000,18.000000,1,''),(5000156,1500,213.0000,12.0000,9.0000,9.0000,27.000000,1,''),(5000156,2000,238.0000,12.0000,9.0000,6.0000,36.000000,2,''),(5000157,500,136.0000,12.0000,9.0000,3.0000,5.000000,1,''),(5000157,1000,176.0000,12.0000,9.0000,3.0000,10.000000,2,''),(5000157,1500,225.0000,12.0000,9.0000,3.0000,15.000000,3,''),(5000157,2000,273.0000,12.0000,9.0000,3.0000,20.000000,4,''),(5000158,500,143.0000,12.0000,9.0000,3.0000,5.000000,1,''),(5000158,1000,188.0000,12.0000,9.0000,3.0000,10.000000,2,''),(5000158,1500,243.0000,12.0000,9.0000,3.0000,15.000000,3,''),(5000158,2000,297.0000,12.0000,9.0000,3.0000,20.000000,4,''),(5000159,250,231.0000,12.0000,9.0000,3.0000,5.000000,1,''),(5000159,500,327.0000,12.0000,9.0000,6.0000,8.000000,1,''),(5000159,750,417.0000,12.0000,9.0000,6.0000,13.000000,2,''),(5000159,1000,510.0000,12.0000,9.0000,6.0000,16.000000,2,''),(5000160,250,231.0000,12.0000,9.0000,3.0000,5.000000,1,''),(5000160,500,327.0000,12.0000,9.0000,6.0000,8.000000,1,''),(5000160,750,417.0000,12.0000,9.0000,6.0000,13.000000,2,''),(5000160,1000,510.0000,12.0000,9.0000,6.0000,16.000000,2,''),(5000161,250,231.0000,12.0000,9.0000,3.0000,5.000000,1,''),(5000161,500,327.0000,12.0000,9.0000,6.0000,8.000000,1,''),(5000161,750,417.0000,12.0000,9.0000,6.0000,13.000000,2,''),(5000161,1000,510.0000,12.0000,9.0000,6.0000,16.000000,2,''),(5000162,50,167.0000,12.0000,9.0000,3.0000,5.000000,1,''),(5000162,100,179.0000,12.0000,9.0000,3.0000,5.000000,1,''),(5000162,250,231.0000,12.0000,9.0000,3.0000,5.000000,1,''),(5000162,500,327.0000,12.0000,9.0000,6.0000,8.000000,1,''),(5000162,750,417.0000,12.0000,9.0000,6.0000,13.000000,2,''),(5000162,1000,510.0000,12.0000,9.0000,6.0000,16.000000,2,''),(5000163,50,167.0000,12.0000,9.0000,3.0000,5.000000,1,''),(5000163,100,179.0000,12.0000,9.0000,3.0000,5.000000,1,''),(5000163,250,231.0000,12.0000,9.0000,3.0000,5.000000,1,''),(5000163,500,327.0000,12.0000,9.0000,6.0000,8.000000,1,''),(5000163,750,417.0000,12.0000,9.0000,6.0000,13.000000,2,''),(5000163,1000,510.0000,12.0000,9.0000,6.0000,16.000000,2,''),(5000164,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000164,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000164,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000165,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000165,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000165,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000166,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000166,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000166,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000167,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000167,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000167,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000168,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000168,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000168,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000169,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000169,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000169,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000170,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000170,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000170,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000171,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000171,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000171,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000172,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000172,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000172,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000173,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000173,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000173,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000174,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000174,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000174,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,''),(5000175,250,55.0000,9.0000,6.0000,3.0000,3.000000,1,''),(5000175,500,65.0000,9.0000,6.0000,3.0000,5.000000,1,''),(5000175,1000,90.0000,12.0000,9.0000,3.0000,8.000000,1,'');

--
-- Table structure for table `items`
--

CREATE TABLE `items` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `TYPE` int NOT NULL DEFAULT '0',
  `CODE` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `DESCRIPTION` varchar(200) COLLATE utf8mb3_unicode_ci NOT NULL,
  `SIZE` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `NUMPAGES` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `STATUS` int NOT NULL DEFAULT '1',
  `MINLEVEL` int NOT NULL DEFAULT '0',
  `LEADTIME` int NOT NULL DEFAULT '0',
  `DISPLAYIMAGENAME` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `DISPLAYIMAGEPATH` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `PROOFPDFNAME` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `PROOFPDFPATH` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `PREVIEWIMAGENAME` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `PREVIEWIMAGEPATH` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `PARENTITEM` int DEFAULT '0',
  `ARCHIVED` int DEFAULT '0',
  `GENERATEDBY` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ASSETAPPROVED` int DEFAULT '1',
  `PARAMETERSFILENAME` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `PARAMETERSFILEPATH` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `APPROVALLINK` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `PRODUCEDETAIL` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPBOXINSLEEVE` int NOT NULL DEFAULT '0',
  `SKIPPDFPERMISSIONCHECK` int NOT NULL DEFAULT '0',
  `DLSUGGESTIONS` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `CREATED` datetime DEFAULT CURRENT_TIMESTAMP,
  `MODIFIED` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `PRINTINGTYPE` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `STOCK` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=5000176 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `items`
--

INSERT INTO `items` VALUES (5000130,2,'BTID_BCard_EN','Business Card Template - English','3.5\" x 2\"','2',1,0,0,'BT1D_BCard_EN.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_BCard_EN.png','BT1D_BCard_EN.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_BCard_EN.pdf','','',0,0,NULL,1,'5000130_genfile.txt','/companyResources/BREAKTHROUGH/uploadFiles/5000130_genfile.txt',NULL,'',0,0,'','2025-01-14 15:43:31','2025-01-15 01:12:45','4+4','100lb Uncoated Cover'),(5000131,2,'BTID_BCard_BIL','Business Card Template - Bilingual','3.5\" x 2\"','2',1,0,0,'BT1D_BCard_BIL.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_BCard_BIL.png','BT1D_BCard_BIL.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_BCard_BIL.pdf','','',0,0,NULL,1,'5000131_genfile.txt','/companyResources/BREAKTHROUGH/uploadFiles/5000131_genfile.txt',NULL,'',0,0,'','2025-01-15 01:11:37','2025-01-15 19:11:14','4+4','100lb Uncoated Cover'),(5000132,3,'BTID_BCard_EN-00001','Business Card Template - English','3.5\" x 2\"','2',1,0,0,'BRE-5000132-CPDI-BTID_BCard_EN-00001.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000132-CPDI-BTID_BCard_EN-00001.jpg','BRE-5000132-CPDI-BTID_BCard_EN-00001.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000132-CPDI-BTID_BCard_EN-00001.pdf','BRE-5000132-CPDI-BTID_BCard_EN-00001.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000132-CPDI-BTID_BCard_EN-00001.pdf',5000130,1,'Peggy',1,'','',NULL,'',0,0,'','2025-01-15 01:47:25','2025-01-22 22:39:24',NULL,NULL),(5000133,3,'BTID_BCard_EN-00002','Business Card Template - English  (Demo Demo)','3.5\" x 2\"','2',1,0,0,'BRE-5000133-CPDI-BTID_BCard_EN-00002.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000133-CPDI-BTID_BCard_EN-00002.jpg','BRE-5000133-CPDI-BTID_BCard_EN-00002.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000133-CPDI-BTID_BCard_EN-00002.pdf','BRE-5000133-CPDI-BTID_BCard_EN-00002.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000133-CPDI-BTID_BCard_EN-00002.pdf',5000130,0,'Peggy',1,'','',NULL,'',0,0,'','2025-01-15 01:49:13','2025-01-15 01:49:13',NULL,NULL),(5000134,3,'BTID_BCard_BIL-00001','Business Card Template - Bilingual  (Linda Bell, CFRE)','3.5\" x 2\"','2',1,0,0,'BRE-5000134-CPDI-BTID_BCard_BIL-00001.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000134-CPDI-BTID_BCard_BIL-00001.jpg','BRE-5000134-CPDI-BTID_BCard_BIL-00001.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000134-CPDI-BTID_BCard_BIL-00001.pdf','BRE-5000134-CPDI-BTID_BCard_BIL-00001.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000134-CPDI-BTID_BCard_BIL-00001.pdf',5000131,0,'Peggy',1,'','',NULL,'',0,0,'','2025-01-22 22:37:53','2025-01-22 22:37:54',NULL,NULL),(5000135,3,'BTID_BCard_EN-00003','Business Card Template - English  (Sonia Mancini)','3.5\" x 2\"','2',1,0,0,'BRE-5000135-CPDI-BTID_BCard_EN-00003.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000135-CPDI-BTID_BCard_EN-00003.jpg','BRE-5000135-CPDI-BTID_BCard_EN-00003.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000135-CPDI-BTID_BCard_EN-00003.pdf','BRE-5000135-CPDI-BTID_BCard_EN-00003.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000135-CPDI-BTID_BCard_EN-00003.pdf',5000130,0,'Peggy',1,'','',NULL,'',0,0,'','2025-01-22 22:39:16','2025-01-22 22:39:16',NULL,NULL),(5000136,3,'BTID_BCard_EN-00004','Business Card Template - English  (Patrick Sinn)','3.5\" x 2\"','2',1,0,0,'BRE-5000136-CPDI-BTID_BCard_EN-00004.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000136-CPDI-BTID_BCard_EN-00004.jpg','BRE-5000136-CPDI-BTID_BCard_EN-00004.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000136-CPDI-BTID_BCard_EN-00004.pdf','BRE-5000136-CPDI-BTID_BCard_EN-00004.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000136-CPDI-BTID_BCard_EN-00004.pdf',5000130,0,'patrick',1,'','',NULL,'',0,0,'','2025-01-29 15:35:52','2025-01-29 15:35:52',NULL,NULL),(5000137,3,'BTID_BCard_EN-00005','Business Card Template - English  (Test Only)','3.5\" x 2\"','2',1,0,0,'BRE-5000137-900-BTID_BCard_EN-00005.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000137-900-BTID_BCard_EN-00005.jpg','BRE-5000137-900-BTID_BCard_EN-00005.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000137-900-BTID_BCard_EN-00005.pdf','BRE-5000137-900-BTID_BCard_EN-00005.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000137-900-BTID_BCard_EN-00005.pdf',5000130,1,'Jaden',1,'','',NULL,'',0,0,'','2025-01-30 21:03:25','2025-01-31 13:32:47',NULL,NULL),(5000138,3,'BTID_BCard_EN-00006','Business Card Template - English  (Test)','3.5\" x 2\"','2',1,0,0,'BRE-5000138-900-BTID_BCard_EN-00006.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000138-900-BTID_BCard_EN-00006.jpg','BRE-5000138-900-BTID_BCard_EN-00006.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000138-900-BTID_BCard_EN-00006.pdf','BRE-5000138-900-BTID_BCard_EN-00006.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000138-900-BTID_BCard_EN-00006.pdf',5000130,1,'Jaden',1,'','',NULL,'',0,0,'','2025-01-31 13:30:49','2025-01-31 16:03:44',NULL,NULL),(5000139,3,'BTID_BCard_EN-00007','Business Card Template - English  (Raj Patara)','3.5\" x 2\"','2',1,0,0,'BRE-5000139-900-BTID_BCard_EN-00007.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000139-900-BTID_BCard_EN-00007.jpg','BRE-5000139-900-BTID_BCard_EN-00007.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000139-900-BTID_BCard_EN-00007.pdf','BRE-5000139-900-BTID_BCard_EN-00007.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000139-900-BTID_BCard_EN-00007.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-01-31 16:30:58','2025-01-31 16:30:58',NULL,NULL),(5000140,3,'BTID_BCard_EN-00008','Business Card Template - English  (Colin Edington)','3.5\" x 2\"','2',1,0,0,'BRE-5000140-900-BTID_BCard_EN-00008.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000140-900-BTID_BCard_EN-00008.jpg','BRE-5000140-900-BTID_BCard_EN-00008.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000140-900-BTID_BCard_EN-00008.pdf','BRE-5000140-900-BTID_BCard_EN-00008.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000140-900-BTID_BCard_EN-00008.pdf',5000130,1,'Jaden',1,'','',NULL,'',0,0,'','2025-01-31 16:46:43','2025-01-31 17:34:39',NULL,NULL),(5000141,3,'BTID_BCard_EN-00009','Business Card Template - English  (Colin Edington)','3.5\" x 2\"','2',1,0,0,'BRE-5000141-900-BTID_BCard_EN-00009.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000141-900-BTID_BCard_EN-00009.jpg','BRE-5000141-900-BTID_BCard_EN-00009.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000141-900-BTID_BCard_EN-00009.pdf','BRE-5000141-900-BTID_BCard_EN-00009.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000141-900-BTID_BCard_EN-00009.pdf',5000130,1,'Jaden',1,'','',NULL,'',0,0,'','2025-01-31 17:38:22','2025-02-20 20:30:40',NULL,NULL),(5000142,3,'BTID_BCard_EN-00010','Business Card Template - English  (Scott McRae)','3.5\" x 2\"','2',1,0,0,'BRE-5000142-900-BTID_BCard_EN-00010.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000142-900-BTID_BCard_EN-00010.jpg','BRE-5000142-900-BTID_BCard_EN-00010.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000142-900-BTID_BCard_EN-00010.pdf','BRE-5000142-900-BTID_BCard_EN-00010.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000142-900-BTID_BCard_EN-00010.pdf',5000130,1,'Jaden',1,'','',NULL,'',0,0,'','2025-02-03 13:59:02','2025-02-03 17:08:01',NULL,NULL),(5000143,3,'BTID_BCard_EN-00011','Business Card Template - English  (Miriam Dos Anjos)','3.5\" x 2\"','2',1,0,0,'BRE-5000143-900-BTID_BCard_EN-00011.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000143-900-BTID_BCard_EN-00011.jpg','BRE-5000143-900-BTID_BCard_EN-00011.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000143-900-BTID_BCard_EN-00011.pdf','BRE-5000143-900-BTID_BCard_EN-00011.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000143-900-BTID_BCard_EN-00011.pdf',5000130,1,'Jaden',1,'','',NULL,'',0,0,'','2025-02-03 14:17:29','2025-02-20 20:31:18',NULL,NULL),(5000144,3,'BTID_BCard_EN-00012','Business Card Template - English  (Scott McRae)','3.5\" x 2\"','2',1,0,0,'BRE-5000144-900-BTID_BCard_EN-00012.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000144-900-BTID_BCard_EN-00012.jpg','BRE-5000144-900-BTID_BCard_EN-00012.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000144-900-BTID_BCard_EN-00012.pdf','BRE-5000144-900-BTID_BCard_EN-00012.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000144-900-BTID_BCard_EN-00012.pdf',5000130,1,'Jaden',1,'','',NULL,'',0,0,'','2025-02-03 17:11:23','2025-02-20 20:31:41',NULL,NULL),(5000145,3,'BTID_BCard_EN-00013','Business Card Template - English  (Tayler Taglione)','3.5\" x 2\"','2',1,0,0,'BRE-5000145-900-BTID_BCard_EN-00013.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000145-900-BTID_BCard_EN-00013.jpg','BRE-5000145-900-BTID_BCard_EN-00013.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000145-900-BTID_BCard_EN-00013.pdf','BRE-5000145-900-BTID_BCard_EN-00013.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000145-900-BTID_BCard_EN-00013.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-02-04 20:43:16','2025-02-04 20:43:16',NULL,NULL),(5000146,3,'BTID_BCard_BIL-00002','Business Card Template - Bilingual  (Melanie Rose)','3.5\" x 2\"','2',1,0,0,'BRE-5000146-900-BTID_BCard_BIL-00002.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000146-900-BTID_BCard_BIL-00002.jpg','BRE-5000146-900-BTID_BCard_BIL-00002.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000146-900-BTID_BCard_BIL-00002.pdf','BRE-5000146-900-BTID_BCard_BIL-00002.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000146-900-BTID_BCard_BIL-00002.pdf',5000131,0,'Jaden',1,'','',NULL,'',0,0,'','2025-02-07 16:56:00','2025-02-07 16:56:01',NULL,NULL),(5000147,3,'BTID_BCard_BIL-00003','Business Card Template - Bilingual  (Jonathan Cassin)','3.5\" x 2\"','2',1,0,0,'BRE-5000147-900-BTID_BCard_BIL-00003.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000147-900-BTID_BCard_BIL-00003.jpg','BRE-5000147-900-BTID_BCard_BIL-00003.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000147-900-BTID_BCard_BIL-00003.pdf','BRE-5000147-900-BTID_BCard_BIL-00003.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000147-900-BTID_BCard_BIL-00003.pdf',5000131,0,'Jaden',1,'','',NULL,'',0,0,'','2025-02-14 16:27:41','2025-02-14 16:27:41',NULL,NULL),(5000148,3,'BTID_BCard_EN-00014','Business Card Template - English  (Dori Gibbon)','3.5\" x 2\"','2',1,0,0,'BRE-5000148-900-BTID_BCard_EN-00014.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000148-900-BTID_BCard_EN-00014.jpg','BRE-5000148-900-BTID_BCard_EN-00014.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000148-900-BTID_BCard_EN-00014.pdf','BRE-5000148-900-BTID_BCard_EN-00014.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000148-900-BTID_BCard_EN-00014.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-02-20 20:27:40','2025-02-20 20:27:41',NULL,NULL),(5000149,3,'BTID_BCard_EN-00015','Business Card Template - English  (Nicole Adolph)','3.5\" x 2\"','2',1,0,0,'BRE-5000149-900-BTID_BCard_EN-00015.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000149-900-BTID_BCard_EN-00015.jpg','BRE-5000149-900-BTID_BCard_EN-00015.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000149-900-BTID_BCard_EN-00015.pdf','BRE-5000149-900-BTID_BCard_EN-00015.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000149-900-BTID_BCard_EN-00015.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-02-20 21:12:22','2025-02-20 21:12:23',NULL,NULL),(5000150,3,'BTID_BCard_EN-00016','Business Card Template - English  (Jenna Lachance Marchak)','3.5\" x 2\"','2',1,0,0,'BRE-5000150-900-BTID_BCard_EN-00016.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000150-900-BTID_BCard_EN-00016.jpg','BRE-5000150-900-BTID_BCard_EN-00016.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000150-900-BTID_BCard_EN-00016.pdf','BRE-5000150-900-BTID_BCard_EN-00016.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000150-900-BTID_BCard_EN-00016.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-02-20 22:46:13','2025-02-20 22:46:14',NULL,NULL),(5000151,3,'BTID_BCard_BIL-00004','Business Card Template - Bilingual  (Rosalie Sarasua, M.A. CVA)','3.5\" x 2\"','2',1,0,0,'BRE-5000151-900-BTID_BCard_BIL-00004.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000151-900-BTID_BCard_BIL-00004.jpg','BRE-5000151-900-BTID_BCard_BIL-00004.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000151-900-BTID_BCard_BIL-00004.pdf','BRE-5000151-900-BTID_BCard_BIL-00004.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000151-900-BTID_BCard_BIL-00004.pdf',5000131,0,'Jaden',1,'','',NULL,'',0,0,'','2025-02-21 19:22:22','2025-02-21 19:22:23',NULL,NULL),(5000152,3,'BTID_BCard_EN-00017','Business Card Template - English  (Carol-Lynne Quintin)','3.5\" x 2\"','2',1,0,0,'BRE-5000152-900-BTID_BCard_EN-00017.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000152-900-BTID_BCard_EN-00017.jpg','BRE-5000152-900-BTID_BCard_EN-00017.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000152-900-BTID_BCard_EN-00017.pdf','BRE-5000152-900-BTID_BCard_EN-00017.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000152-900-BTID_BCard_EN-00017.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-02-24 15:25:56','2025-02-24 15:25:56',NULL,NULL),(5000153,1,'BT1D_Card_InHonour_EN','In Honour Card with Envelope (with logo) - English verison','7” x 10” to 7” x 5”','1',1,0,0,'BT1D_Card_InHonour_EN.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Card_InHonour_EN.png','BT1D_Card_InHonour_EN.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Card_InHonour_EN.pdf','','',0,0,NULL,1,'','',NULL,'',0,0,'','2025-02-26 22:26:06','2025-03-04 17:55:02','','100lb Uncoated Cover'),(5000154,1,'BT1D_Letterhead_EN','Letterhead - English','8.5\" x 11\"','1',1,0,0,'BT1D_Letterhead_EN.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Letterhead_EN.png','BT1D_Letterhead_EN.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Letterhead_EN.pdf','','',0,0,NULL,1,'','',NULL,'',0,0,'','2025-02-28 17:44:05','2025-02-28 17:44:05','',''),(5000155,1,'BT1D_Letterhead_FR','Letterhead - French','8.5\" x 11\"','1',1,0,0,'BT1D_Letterhead_FR.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Letterhead_FR.png','BT1D_Letterhead_FR.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Letterhead_FR.pdf','','',0,0,NULL,1,'','',NULL,'',0,0,'','2025-02-28 18:49:31','2025-03-04 17:32:31','',''),(5000156,1,'BT1D_Letterhead_BIL','Letterhead - Bilingual','8.5\" x 11\"','1',1,0,0,'BT1D_Letterhead_BIL.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Letterhead_BIL.png','BT1D_Letterhead_BIL.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Letterhead_BIL.pdf','','',0,0,NULL,1,'','',NULL,'',0,0,'','2025-03-04 17:34:41','2025-03-04 17:35:09','',''),(5000157,1,'BT1D_NonWinEnv_BIL','No. 10 Non Window Envelope - Bilingual','9.5\" x 4.125\"','1',1,0,0,'BT1D_NonWinEnv_BIL.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_NonWinEnv_BIL.png','BT1D_NonWinEnv_BIL.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_NonWinEnv_BIL.pdf','','',0,0,NULL,1,'','',NULL,'',0,0,'','2025-03-04 17:51:22','2025-03-04 17:51:22','',''),(5000158,1,'BT1D_WinEnv_BIL','No. 10 Window Envelope - Bilingual','9.5\" x 4.125\"','1',1,0,0,'BT1D_WinEnv_BIL.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_WinEnv_BIL.png','BT1D_WinEnv_BIL.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_WinEnv_BIL.pdf','','',0,0,NULL,1,'','',NULL,'',0,0,'','2025-03-04 17:52:42','2025-03-04 17:53:55','',''),(5000159,1,'BT1D_Card_InHonour_FR','In Honour Card with Envelope (with logo) - French verison','7” x 10” to 7” x 5”','1',1,0,0,'BT1D_Card_InHonour_FR.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Card_InHonour_FR.png','BT1D_Card_InHonour_FR.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Card_InHonour_FR.pdf','','',0,0,NULL,1,'','',NULL,'',0,0,'','2025-03-04 17:57:45','2025-03-04 17:58:32','','100lb Uncoated Cover'),(5000160,1,'BT1D_Card_InMemory_EN','In Memory Card with Envelope (with logo) - English verison','7” x 10” to 7” x 5”','1',1,0,0,'BT1D_Card_InMemory_EN.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Card_InMemory_EN.png','BT1D_Card_InMemory_EN.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Card_InMemory_EN.pdf','','',0,0,NULL,1,'','',NULL,'',0,0,'','2025-03-04 18:01:25','2025-03-04 18:02:09','','100lb Uncoated Cover'),(5000161,1,'BT1D_Card_InMemory_FR','In Memory Card with Envelope (with logo) - French verison','7” x 10” to 7” x 5”','1',1,0,0,'BT1D_Card_InMemory_FR.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Card_InMemory_FR.png','BT1D_Card_InMemory_FR.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Card_InMemory_FR.pdf','','',0,0,NULL,1,'','',NULL,'',0,0,'','2025-03-04 18:02:53','2025-03-04 18:03:11','','100lb Uncoated Cover'),(5000162,1,'BT1D_Card_ThankYou_EN','Thank you Card with Envelope (with logo) - English verison','7” x 10” to 7” x 5”','1',1,0,0,'BT1D_Card_ThankYou_EN.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Card_ThankYou_EN.png','BT1D_Card_ThankYou_EN.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Card_ThankYou_EN.pdf','','',0,0,NULL,1,'','',NULL,'',0,0,'','2025-03-04 18:05:03','2025-07-28 16:18:26','','100lb Uncoated Cover'),(5000163,1,'BT1D_Card_ThankYou_FR','Thank you Card with Envelope (with logo) - French verison','7” x 10” to 7” x 5”','1',1,0,0,'BT1D_Card_ThankYou_FR.png','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Card_ThankYou_FR.png','BT1D_Card_ThankYou_FR.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BT1D_Card_ThankYou_FR.pdf','','',0,0,NULL,1,'','',NULL,'',0,0,'','2025-03-04 18:05:33','2025-07-28 16:18:33','','100lb Uncoated Cover'),(5000164,3,'BTID_BCard_BIL-00005','Business Card Template - Bilingual  (dd)','3.5\" x 2\"','2',1,0,0,'BRE-5000164-CPDI-BTID_BCard_BIL-00005.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000164-CPDI-BTID_BCard_BIL-00005.jpg','BRE-5000164-CPDI-BTID_BCard_BIL-00005.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000164-CPDI-BTID_BCard_BIL-00005.pdf','BRE-5000164-CPDI-BTID_BCard_BIL-00005.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000164-CPDI-BTID_BCard_BIL-00005.pdf',5000131,0,'Peggy',1,'','',NULL,'',0,0,'','2025-03-24 18:12:48','2025-03-24 18:12:49',NULL,NULL),(5000165,3,'BTID_BCard_EN-00018','Business Card Template - English  (Danielle Rana)','3.5\" x 2\"','2',1,0,0,'BRE-5000165-900-BTID_BCard_EN-00018.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000165-900-BTID_BCard_EN-00018.jpg','BRE-5000165-900-BTID_BCard_EN-00018.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000165-900-BTID_BCard_EN-00018.pdf','BRE-5000165-900-BTID_BCard_EN-00018.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000165-900-BTID_BCard_EN-00018.pdf',5000130,1,'Jaden',1,'','',NULL,'',0,0,'','2025-04-25 13:08:33','2025-04-25 15:07:10',NULL,NULL),(5000166,3,'BTID_BCard_EN-00019','Business Card Template - English  (Danielle Rana)','3.5\" x 2\"','2',1,0,0,'BRE-5000166-900-BTID_BCard_EN-00019.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000166-900-BTID_BCard_EN-00019.jpg','BRE-5000166-900-BTID_BCard_EN-00019.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000166-900-BTID_BCard_EN-00019.pdf','BRE-5000166-900-BTID_BCard_EN-00019.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000166-900-BTID_BCard_EN-00019.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-04-25 15:15:54','2025-04-25 15:15:55',NULL,NULL),(5000167,3,'BTID_BCard_EN-00020','Business Card Template - English  (Heather Haldane)','3.5\" x 2\"','2',1,0,0,'BRE-5000167-900-BTID_BCard_EN-00020.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000167-900-BTID_BCard_EN-00020.jpg','BRE-5000167-900-BTID_BCard_EN-00020.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000167-900-BTID_BCard_EN-00020.pdf','BRE-5000167-900-BTID_BCard_EN-00020.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000167-900-BTID_BCard_EN-00020.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-04-28 12:20:06','2025-04-28 12:20:07',NULL,NULL),(5000168,3,'BTID_BCard_EN-00021','Business Card Template - English  (Amanda Brown)','3.5\" x 2\"','2',1,0,0,'BRE-5000168-900-BTID_BCard_EN-00021.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000168-900-BTID_BCard_EN-00021.jpg','BRE-5000168-900-BTID_BCard_EN-00021.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000168-900-BTID_BCard_EN-00021.pdf','BRE-5000168-900-BTID_BCard_EN-00021.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000168-900-BTID_BCard_EN-00021.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-04-28 12:23:00','2025-04-28 12:23:01',NULL,NULL),(5000169,3,'BTID_BCard_EN-00022','Business Card Template - English  (Claudia Canchaya)','3.5\" x 2\"','2',1,0,0,'BRE-5000169-900-BTID_BCard_EN-00022.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000169-900-BTID_BCard_EN-00022.jpg','BRE-5000169-900-BTID_BCard_EN-00022.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000169-900-BTID_BCard_EN-00022.pdf','BRE-5000169-900-BTID_BCard_EN-00022.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000169-900-BTID_BCard_EN-00022.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-04-28 19:07:45','2025-04-28 19:07:45',NULL,NULL),(5000170,3,'BTID_BCard_EN-00023','Business Card Template - English  (Connor Shull)','3.5\" x 2\"','2',1,0,0,'BRE-5000170-900-BTID_BCard_EN-00023.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000170-900-BTID_BCard_EN-00023.jpg','BRE-5000170-900-BTID_BCard_EN-00023.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000170-900-BTID_BCard_EN-00023.pdf','BRE-5000170-900-BTID_BCard_EN-00023.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000170-900-BTID_BCard_EN-00023.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-05-05 15:26:54','2025-05-05 15:26:54',NULL,NULL),(5000171,3,'BTID_BCard_EN-00024','Business Card Template - English  (Jaden Winfree)','3.5\" x 2\"','2',1,0,0,'BRE-5000171-900-BTID_BCard_EN-00024.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000171-900-BTID_BCard_EN-00024.jpg','BRE-5000171-900-BTID_BCard_EN-00024.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000171-900-BTID_BCard_EN-00024.pdf','BRE-5000171-900-BTID_BCard_EN-00024.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000171-900-BTID_BCard_EN-00024.pdf',5000130,1,'Jaden',1,'','',NULL,'',0,0,'','2025-07-07 20:34:53','2025-07-07 20:57:08',NULL,NULL),(5000172,3,'BTID_BCard_EN-00025','Business Card Template - English  (Jaden Winfree)','3.5\" x 2\"','2',1,0,0,'BRE-5000172-900-BTID_BCard_EN-00025.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000172-900-BTID_BCard_EN-00025.jpg','BRE-5000172-900-BTID_BCard_EN-00025.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000172-900-BTID_BCard_EN-00025.pdf','BRE-5000172-900-BTID_BCard_EN-00025.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000172-900-BTID_BCard_EN-00025.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-07-07 21:12:53','2025-07-07 21:12:53',NULL,NULL),(5000173,3,'BTID_BCard_BIL-00006','Business Card Template - Bilingual  (Jaden Winfree)','3.5\" x 2\"','2',1,0,0,'BRE-5000173-900-BTID_BCard_BIL-00006.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000173-900-BTID_BCard_BIL-00006.jpg','BRE-5000173-900-BTID_BCard_BIL-00006.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000173-900-BTID_BCard_BIL-00006.pdf','BRE-5000173-900-BTID_BCard_BIL-00006.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000173-900-BTID_BCard_BIL-00006.pdf',5000131,0,'Jaden',1,'','',NULL,'',0,0,'','2025-07-08 17:40:53','2025-07-08 17:40:54',NULL,NULL),(5000174,3,'BTID_BCard_BIL-00007','Business Card Template - Bilingual  (Kimberley Hanson)','3.5\" x 2\"','2',1,0,0,'BRE-5000174-900-BTID_BCard_BIL-00007.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000174-900-BTID_BCard_BIL-00007.jpg','BRE-5000174-900-BTID_BCard_BIL-00007.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000174-900-BTID_BCard_BIL-00007.pdf','BRE-5000174-900-BTID_BCard_BIL-00007.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000174-900-BTID_BCard_BIL-00007.pdf',5000131,0,'Jaden',1,'','',NULL,'',0,0,'','2025-10-22 19:37:26','2025-10-22 19:37:27',NULL,NULL),(5000175,3,'BTID_BCard_EN-00026','Business Card Template - English  (Sarah Hill)','3.5\" x 2\"','2',1,0,0,'BRE-5000175-900-BTID_BCard_EN-00026.jpg','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000175-900-BTID_BCard_EN-00026.jpg','BRE-5000175-900-BTID_BCard_EN-00026.pdf','/companyResources/BREAKTHROUGH/printAssets/BRE-5000175-900-BTID_BCard_EN-00026.pdf','BRE-5000175-900-BTID_BCard_EN-00026.pdf','/companyResources/BREAKTHROUGH/uploadFiles/BRE-5000175-900-BTID_BCard_EN-00026.pdf',5000130,0,'Jaden',1,'','',NULL,'',0,0,'','2025-11-17 13:35:38','2025-11-17 13:35:38',NULL,NULL);

--
-- Table structure for table `itemsAdjustmentLog`
--

CREATE TABLE `itemsAdjustmentLog` (
  `ADJID` int NOT NULL AUTO_INCREMENT,
  `ITEMID` int NOT NULL,
  `QTY` int NOT NULL,
  `ADJDATE` datetime NOT NULL,
  `REASON` varchar(200) COLLATE utf8mb3_unicode_ci NOT NULL,
  PRIMARY KEY (`ADJID`)
) ENGINE=InnoDB AUTO_INCREMENT=87 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `itemsAdjustmentLog`
--

INSERT INTO `itemsAdjustmentLog` VALUES (1,4000000,650,'2019-09-28 13:15:30','Initial Inventory Load'),(2,4000002,250,'2019-09-28 13:15:30','Initial Inventory Load'),(3,4000003,500,'2019-09-28 13:15:30','Initial Inventory Load'),(4,4000036,85,'2019-09-28 13:15:30','Initial Inventory Load'),(5,4000037,30,'2019-09-28 13:15:30','Initial Inventory Load'),(6,4000064,450,'2019-09-28 13:15:30','Initial Inventory Load'),(7,4000069,250,'2019-09-28 13:15:30','Initial Inventory Load'),(8,4000069,250,'2019-09-28 13:15:30','Initial Inventory Load'),(9,4000081,800,'2019-09-28 13:15:30','Initial Inventory Load'),(10,4000082,250,'2019-09-28 13:15:30','Initial Inventory Load'),(11,4000083,20,'2019-09-28 13:15:30','Initial Inventory Load'),(12,4000102,2500,'2019-09-28 13:15:30','Initial Inventory Load'),(13,4000103,1400,'2019-09-28 13:15:30','Initial Inventory Load'),(14,4000104,650,'2019-09-28 13:15:30','Initial Inventory Load'),(15,4000105,500,'2019-09-28 13:15:30','Initial Inventory Load'),(16,4000106,1400,'2019-09-28 13:15:30','Initial Inventory Load'),(17,4000107,500,'2019-09-28 13:15:30','Initial Inventory Load'),(18,4000109,2000,'2019-09-28 13:15:30','Initial Inventory Load'),(19,4000391,50,'2019-09-28 13:15:30','Initial Inventory Load'),(20,4000438,150,'2019-09-28 13:15:30','Initial Inventory Load'),(21,4000439,100,'2019-09-28 13:15:30','Initial Inventory Load'),(22,4000440,50,'2019-09-28 13:15:30','Initial Inventory Load'),(23,4000441,100,'2019-09-28 13:15:30','Initial Inventory Load'),(24,4000442,50,'2019-09-28 13:15:30','Initial Inventory Load'),(25,4000443,100,'2019-09-28 13:15:30','Initial Inventory Load'),(26,4000457,100,'2019-09-28 13:15:30','Initial Inventory Load'),(27,4000461,1000,'2019-09-28 13:15:30','Initial Inventory Load'),(28,4000462,1800,'2019-09-28 13:15:30','Initial Inventory Load'),(32,5000091,-500,'2019-10-15 13:51:10','Shipment for Order# 3010393 Ship# 1'),(33,4000479,-2000,'2019-10-15 20:49:05','Shipment for Order# 3010392 Ship# 2'),(34,4000094,-2000,'2019-10-15 20:49:05','Shipment for Order# 3010392 Ship# 2'),(35,5000094,-500,'2019-12-10 21:43:51','Shipment for Order# 3010395 Ship# 3'),(36,5000096,-500,'2019-12-10 21:43:51','Shipment for Order# 3010395 Ship# 3'),(37,5000097,-500,'2019-12-10 21:43:51','Shipment for Order# 3010395 Ship# 3'),(38,5000103,-500,'2019-12-10 21:43:51','Shipment for Order# 3010395 Ship# 3'),(39,5000102,-500,'2019-12-10 21:44:01','Shipment for Order# 3010396 Ship# 4'),(40,5000100,-500,'2019-12-10 21:44:20','Shipment for Order# 3010397 Ship# 5'),(41,5000101,-500,'2019-12-10 21:44:20','Shipment for Order# 3010397 Ship# 5'),(42,5000107,-500,'2020-02-04 17:23:32','Shipment for Order# 3010400 Ship# 6'),(43,5000108,-500,'2020-02-04 17:23:32','Shipment for Order# 3010400 Ship# 6'),(44,5000109,-500,'2020-02-04 17:23:33','Shipment for Order# 3010400 Ship# 6'),(45,5000104,-500,'2020-02-04 17:24:29','Shipment for Order# 3010398 Ship# 7'),(46,5000105,-500,'2020-02-04 17:24:36','Shipment for Order# 3010399 Ship# 8'),(47,5000112,-500,'2020-03-16 20:34:47','Shipment for Order# 3010401 Ship# 9'),(48,5000113,-500,'2020-03-16 20:34:47','Shipment for Order# 3010401 Ship# 9'),(49,5000116,-500,'2020-03-18 13:21:45','Shipment for Order# 3010402 Ship# 10'),(50,4000113,-1000,'2020-03-18 13:52:14','Shipment for Order# 3010403 Ship# 11'),(51,5000118,-500,'2021-06-10 11:28:08','Shipment for Order# 3010404 Ship# 12'),(52,5000119,-500,'2021-08-25 09:34:32','Shipment for Order# 3010405 Ship# 13'),(53,4000102,-500,'2021-11-24 15:51:39','Offline ship to Melanie - order by Angela Nov2021'),(54,4000106,-1000,'2021-11-24 15:52:21','Offline ship to Melanie & Jaden (500 each) - order by Angela Nov2021'),(55,5000120,-500,'2022-03-15 12:30:16','Shipment for Order# 3010406 Ship# 14'),(56,5000121,-500,'2022-03-17 10:13:19','Shipment for Order# 3010407 Ship# 15'),(57,5000122,-500,'2022-03-17 10:13:19','Shipment for Order# 3010407 Ship# 15'),(58,5000124,-500,'2022-10-19 12:16:24','Shipment for Order# 3010409 Ship# 16'),(59,5000123,-500,'2022-10-19 12:16:24','Shipment for Order# 3010409 Ship# 16'),(60,5000112,-250,'2023-03-24 13:29:05','Shipment for Order# 3010410 Ship# 17'),(61,5000126,-500,'2023-05-12 15:44:44','Shipment for Order# 3010411 Ship# 18'),(62,5000137,-250,'2025-01-30 21:11:33','Shipment for Order# 3010419 Ship# 19'),(63,5000138,-250,'2025-01-31 15:52:24','Shipment for Order# 3010422 Ship# 20'),(64,5000138,-250,'2025-01-31 15:52:24','Shipment for Order# 3010422 Ship# 20'),(65,5000138,-250,'2025-01-31 15:52:24','Shipment for Order# 3010422 Ship# 20'),(66,5000134,-250,'2025-02-05 20:18:52','Shipment for Order# 3010416 Ship# 21'),(67,5000135,-250,'2025-02-05 20:18:52','Shipment for Order# 3010416 Ship# 21'),(68,5000141,-500,'2025-02-07 18:25:54','Shipment for Order# 3010424 Ship# 22'),(69,5000144,-1000,'2025-02-07 18:29:25','Shipment for Order# 3010426 Ship# 23'),(70,5000143,-250,'2025-02-07 18:31:59','Shipment for Order# 3010425 Ship# 24'),(71,5000139,-250,'2025-02-07 18:34:31','Shipment for Order# 3010423 Ship# 25'),(72,5000145,-250,'2025-02-07 18:36:54','Shipment for Order# 3010427 Ship# 26'),(73,5000146,-250,'2025-02-12 19:02:01','Shipment for Order# 3010430 Ship# 27'),(74,5000151,-250,'2025-03-03 19:07:58','Shipment for Order# 3010434 Ship# 28'),(75,5000152,-500,'2025-03-05 16:26:06','Shipment for Order# 3010435 Ship# 29'),(76,5000150,-500,'2025-03-05 16:26:06','Shipment for Order# 3010435 Ship# 29'),(77,5000149,-500,'2025-03-05 16:26:06','Shipment for Order# 3010435 Ship# 29'),(78,5000148,-500,'2025-03-05 16:26:06','Shipment for Order# 3010435 Ship# 29'),(79,5000147,-250,'2025-03-14 18:56:25','Shipment for Order# 3010433 Ship# 30'),(80,5000166,-250,'2025-04-30 19:03:56','Shipment for Order# 3010439 Ship# 31'),(81,5000167,-250,'2025-04-30 19:04:37','Shipment for Order# 3010440 Ship# 32'),(82,5000168,-250,'2025-04-30 19:05:02','Shipment for Order# 3010441 Ship# 33'),(83,5000169,-250,'2025-05-02 18:16:11','Shipment for Order# 3010442 Ship# 34'),(84,5000170,-250,'2025-05-12 18:47:22','Shipment for Order# 3010443 Ship# 35'),(85,5000174,-500,'2025-10-29 17:02:54','Shipment for Order# 3010446 Ship# 36'),(86,5000175,-250,'2025-11-20 20:28:33','Shipment for Order# 3010447 Ship# 37');

--
-- Table structure for table `itemsBranchesLink`
--

CREATE TABLE `itemsBranchesLink` (
  `ITEMID` int NOT NULL,
  `BRANCHCODE` varchar(20) COLLATE utf8mb3_unicode_ci NOT NULL,
  PRIMARY KEY (`ITEMID`,`BRANCHCODE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `itemsBranchesLink`
--

INSERT INTO `itemsBranchesLink` VALUES (4000000,'900'),(4000000,'CPDI'),(4000002,'900'),(4000002,'CPDI'),(4000003,'CPDI'),(4000007,'900'),(4000007,'CPDI'),(4000008,'900'),(4000008,'CPDI'),(4000035,'CPDI'),(4000036,'CPDI'),(4000037,'CPDI'),(4000062,'900'),(4000062,'CPDI'),(4000063,'900'),(4000063,'CPDI'),(4000064,'CPDI'),(4000068,'900'),(4000068,'CPDI'),(4000069,'100'),(4000069,'121'),(4000069,'122'),(4000069,'13'),(4000069,'131'),(4000069,'200'),(4000069,'210'),(4000069,'227'),(4000069,'300'),(4000069,'310'),(4000069,'320'),(4000069,'38'),(4000069,'400'),(4000069,'410'),(4000069,'421'),(4000069,'441'),(4000069,'500'),(4000069,'511'),(4000069,'531'),(4000069,'600'),(4000069,'700'),(4000069,'721'),(4000069,'800'),(4000069,'821'),(4000069,'831'),(4000069,'841'),(4000069,'900'),(4000069,'CPDI'),(4000069,'OROM'),(4000071,'900'),(4000071,'CPDI'),(4000081,'CPDI'),(4000082,'900'),(4000082,'CPDI'),(4000083,'CPDI'),(4000087,'700'),(4000087,'CPDI'),(4000094,'900'),(4000094,'CPDI'),(4000099,'511'),(4000099,'CPDI'),(4000102,'900'),(4000102,'CPDI'),(4000103,'900'),(4000103,'CPDI'),(4000104,'100'),(4000104,'121'),(4000104,'122'),(4000104,'13'),(4000104,'131'),(4000104,'200'),(4000104,'210'),(4000104,'227'),(4000104,'300'),(4000104,'310'),(4000104,'320'),(4000104,'38'),(4000104,'400'),(4000104,'410'),(4000104,'421'),(4000104,'441'),(4000104,'500'),(4000104,'511'),(4000104,'531'),(4000104,'600'),(4000104,'700'),(4000104,'721'),(4000104,'800'),(4000104,'821'),(4000104,'831'),(4000104,'841'),(4000104,'900'),(4000104,'CPDI'),(4000104,'OROM'),(4000105,'600'),(4000105,'700'),(4000105,'721'),(4000105,'900'),(4000105,'CPDI'),(4000106,'900'),(4000106,'CPDI'),(4000107,'900'),(4000107,'CPDI'),(4000109,'100'),(4000109,'121'),(4000109,'122'),(4000109,'13'),(4000109,'131'),(4000109,'200'),(4000109,'210'),(4000109,'227'),(4000109,'300'),(4000109,'310'),(4000109,'320'),(4000109,'38'),(4000109,'400'),(4000109,'410'),(4000109,'421'),(4000109,'441'),(4000109,'500'),(4000109,'511'),(4000109,'531'),(4000109,'600'),(4000109,'700'),(4000109,'721'),(4000109,'800'),(4000109,'821'),(4000109,'831'),(4000109,'841'),(4000109,'900'),(4000109,'CPDI'),(4000109,'OROM'),(4000112,'900'),(4000112,'CPDI'),(4000113,'900'),(4000113,'CPDI'),(4000115,'700'),(4000115,'CPDI'),(4000116,'700'),(4000116,'CPDI'),(4000120,'100'),(4000120,'CPDI'),(4000126,'900'),(4000126,'CPDI'),(4000128,'100'),(4000128,'CPDI'),(4000132,'800'),(4000132,'CPDI'),(4000133,'800'),(4000133,'CPDI'),(4000134,'600'),(4000134,'CPDI'),(4000258,'100'),(4000258,'121'),(4000258,'122'),(4000258,'13'),(4000258,'131'),(4000258,'200'),(4000258,'210'),(4000258,'227'),(4000258,'300'),(4000258,'310'),(4000258,'320'),(4000258,'38'),(4000258,'400'),(4000258,'410'),(4000258,'421'),(4000258,'441'),(4000258,'500'),(4000258,'511'),(4000258,'531'),(4000258,'600'),(4000258,'700'),(4000258,'721'),(4000258,'800'),(4000258,'821'),(4000258,'831'),(4000258,'841'),(4000258,'900'),(4000258,'CPDI'),(4000258,'OROM'),(4000391,'CPDI'),(4000436,'900'),(4000436,'CPDI'),(4000437,'900'),(4000437,'CPDI'),(4000438,'100'),(4000438,'121'),(4000438,'122'),(4000438,'13'),(4000438,'131'),(4000438,'200'),(4000438,'210'),(4000438,'227'),(4000438,'300'),(4000438,'310'),(4000438,'320'),(4000438,'38'),(4000438,'400'),(4000438,'410'),(4000438,'421'),(4000438,'441'),(4000438,'500'),(4000438,'511'),(4000438,'531'),(4000438,'600'),(4000438,'700'),(4000438,'721'),(4000438,'800'),(4000438,'821'),(4000438,'831'),(4000438,'841'),(4000438,'900'),(4000438,'CPDI'),(4000438,'OROM'),(4000439,'600'),(4000439,'700'),(4000439,'721'),(4000439,'900'),(4000439,'CPDI'),(4000440,'900'),(4000440,'CPDI'),(4000441,'900'),(4000441,'CPDI'),(4000442,'900'),(4000442,'CPDI'),(4000443,'900'),(4000443,'CPDI'),(4000453,'CPDI'),(4000454,'CPDI'),(4000455,'CPDI'),(4000456,'100'),(4000456,'121'),(4000456,'122'),(4000456,'13'),(4000456,'131'),(4000456,'200'),(4000456,'210'),(4000456,'227'),(4000456,'300'),(4000456,'310'),(4000456,'320'),(4000456,'38'),(4000456,'400'),(4000456,'410'),(4000456,'421'),(4000456,'441'),(4000456,'500'),(4000456,'511'),(4000456,'531'),(4000456,'600'),(4000456,'700'),(4000456,'721'),(4000456,'800'),(4000456,'821'),(4000456,'831'),(4000456,'841'),(4000456,'900'),(4000456,'CPDI'),(4000456,'OROM'),(4000457,'600'),(4000457,'700'),(4000457,'721'),(4000457,'900'),(4000457,'CPDI'),(4000460,'900'),(4000460,'CPDI'),(4000461,'900'),(4000461,'CPDI'),(4000462,'900'),(4000462,'CPDI'),(4000479,'900'),(4000479,'CPDI'),(4000480,'200'),(4000480,'CPDI'),(4000481,'531'),(4000481,'CPDI'),(4000483,'210'),(4000483,'CPDI'),(4000484,'800'),(4000484,'CPDI'),(4000485,'410'),(4000485,'CPDI'),(4000486,'122'),(4000486,'CPDI'),(4000487,'121'),(4000487,'CPDI'),(4000488,'421'),(4000488,'CPDI'),(4000489,'511'),(4000489,'CPDI'),(4000490,'821'),(4000490,'CPDI'),(4000491,'700'),(4000491,'CPDI'),(4000492,'13'),(4000492,'CPDI'),(4000493,'600'),(4000493,'CPDI'),(4000494,'721'),(4000494,'CPDI'),(4000495,'38'),(4000495,'CPDI'),(4000496,'320'),(4000496,'CPDI'),(4000498,'831'),(4000498,'CPDI'),(4000499,'310'),(4000499,'CPDI'),(4000500,'841'),(4000500,'CPDI'),(4000501,'500'),(4000501,'CPDI'),(4000502,'100'),(4000502,'CPDI'),(4000503,'131'),(4000503,'CPDI'),(4000504,'400'),(4000504,'CPDI'),(4000505,'441'),(4000505,'CPDI'),(4000506,'300'),(4000506,'CPDI'),(4000507,'900'),(4000507,'CPDI'),(4000508,'CPDI'),(4000509,'CPDI'),(4000510,'210'),(4000510,'CPDI'),(4000511,'800'),(4000511,'CPDI'),(4000512,'410'),(4000512,'CPDI'),(4000513,'CPDI'),(4000514,'CPDI'),(4000515,'CPDI'),(4000516,'511'),(4000516,'CPDI'),(4000517,'821'),(4000517,'CPDI'),(4000518,'700'),(4000518,'CPDI'),(4000519,'CPDI'),(4000520,'600'),(4000520,'CPDI'),(4000521,'CPDI'),(4000522,'CPDI'),(4000523,'CPDI'),(4000524,'CPDI'),(4000525,'CPDI'),(4000526,'841'),(4000526,'CPDI'),(4000527,'500'),(4000527,'CPDI'),(4000528,'100'),(4000528,'CPDI'),(4000529,'131'),(4000529,'CPDI'),(4000530,'400'),(4000530,'CPDI'),(4000531,'441'),(4000531,'CPDI'),(4000532,'300'),(4000532,'CPDI'),(4000543,'700'),(4000543,'CPDI'),(4000544,'721'),(4000544,'CPDI'),(5000082,'ALL_BRANCHES'),(5000084,'600'),(5000084,'700'),(5000084,'721'),(5000084,'CPDI'),(5000085,'227'),(5000085,'600'),(5000085,'700'),(5000085,'721'),(5000085,'900'),(5000085,'CPDI'),(5000085,'OROM'),(5000089,'200'),(5000090,'900'),(5000091,'900'),(5000092,'300'),(5000093,'210'),(5000094,'210'),(5000095,'210'),(5000096,'210'),(5000097,'210'),(5000098,'300'),(5000099,'300'),(5000100,'900'),(5000101,'900'),(5000102,'200'),(5000103,'210'),(5000104,'100'),(5000105,'100'),(5000106,'300'),(5000107,'300'),(5000108,'300'),(5000109,'300'),(5000112,'700'),(5000112,'CPDI'),(5000113,'700'),(5000114,'900'),(5000115,'900'),(5000116,'121'),(5000117,'121'),(5000118,'121'),(5000119,'300'),(5000120,'CPDI'),(5000121,'900'),(5000122,'900'),(5000123,'CPDI'),(5000124,'CPDI'),(5000125,'CPDI'),(5000126,'CPDI'),(5000130,'ALL_BRANCHES'),(5000131,'ALL_BRANCHES'),(5000132,'CPDI'),(5000133,'CPDI'),(5000134,'CPDI'),(5000135,'CPDI'),(5000136,'CPDI'),(5000137,'900'),(5000138,'900'),(5000139,'900'),(5000140,'900'),(5000141,'900'),(5000142,'900'),(5000143,'900'),(5000144,'900'),(5000145,'900'),(5000146,'900'),(5000147,'900'),(5000148,'900'),(5000149,'900'),(5000150,'900'),(5000151,'900'),(5000152,'900'),(5000153,'ALL_BRANCHES'),(5000154,'ALL_BRANCHES'),(5000155,'ALL_BRANCHES'),(5000156,'ALL_BRANCHES'),(5000157,'ALL_BRANCHES'),(5000158,'ALL_BRANCHES'),(5000159,'ALL_BRANCHES'),(5000160,'ALL_BRANCHES'),(5000161,'ALL_BRANCHES'),(5000162,'ALL_BRANCHES'),(5000163,'ALL_BRANCHES'),(5000164,'CPDI'),(5000165,'900'),(5000166,'900'),(5000167,'900'),(5000168,'900'),(5000169,'900'),(5000170,'900'),(5000171,'900'),(5000172,'900'),(5000173,'900'),(5000174,'900'),(5000175,'900');

--
-- Table structure for table `itemsInventory`
--

CREATE TABLE `itemsInventory` (
  `ITEMID` int NOT NULL,
  `QTYONHAND` int NOT NULL DEFAULT '0',
  PRIMARY KEY (`ITEMID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `itemsInventory`
--

INSERT INTO `itemsInventory` VALUES (4000000,650),(4000002,250),(4000003,500),(4000036,85),(4000037,30),(4000064,450),(4000069,250),(4000081,800),(4000082,250),(4000083,20),(4000102,2000),(4000103,1400),(4000104,650),(4000105,500),(4000106,400),(4000107,500),(4000109,2000),(4000391,50),(4000438,150),(4000439,100),(4000440,50),(4000441,100),(4000442,50),(4000443,100),(4000457,100),(4000461,1000),(4000462,1800);

--
-- Table structure for table `itemsPrintDefinition`
--

CREATE TABLE `itemsPrintDefinition` (
  `ID` int NOT NULL,
  `PRESS` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `NUMPAGES` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `BLEEDS` int DEFAULT NULL,
  `COLOURS` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `FLATSIZE` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `FINISHSIZE` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `STOCK` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `PARENTSHEETSIZE` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `PRESSSHEETSIZE` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `NUMUP` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `LAYOUTORIENTATION` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `COATING` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `CONTOURCUT` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `LAMINATION` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `FINISHING` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ACCESSORY` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SPECIALINSTRUCTIONS` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `PACKAGELOCATION` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `OUT` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `FINISHED` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `OVERS` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `GROSS` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `MEMO` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `itemsPrintDefinitioncol` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `itemsPrintDefinition`
--

INSERT INTO `itemsPrintDefinition` VALUES (4000113,'QM','1',0,'1/0','6.5\" x 4.75\"','6.5\" x 4.75\"','24lb A6 White Wove Envelope','','','','Sheetwork','','','','','','','','1','1000','','1000','',NULL),(5000082,'iGen4','1',0,'4 + 0','3.5\" x 2\"','3.5\" x 2\"','JDRF Business Card Shell  (100lb Cougar Cover)','','','20','Sheetwork','','','','Trim','','','','','','','','',NULL),(5000084,'iGen4','1',1,'4 + 0','3.5\" x 2\"','3.5\" x 2\"','100lb Cougar Cover','','','20','','','','','Trim to size','','','','','','','','',NULL),(5000085,'iGen4','2',0,'4 + 0','3.5\" x 2\" ','3.5\" x 2\" ','JDRF Business Card Shell  (100lb Cougar Cover)','','','20','','','','','','','','','','','','','',NULL),(5000130,'iGen5','2',1,'4+4','3.5\" x 2\"','3.5\" x 2\"','100lb Cougar Cover','','','','','','','','Trim to size','','','','','','','','',NULL),(5000131,'iGen5','2',1,'4+4','3.5\" x 2\"','3.5\" x 2\"','100lb Cougar Cover','','','','','','','','Trim to size','','','','','','','','',NULL),(5000153,'iGen5 / QM','1',1,'Card - 4+0 / Env - 1+0',' 7” x 5”','7” x 10”','Card - 100lb Uncoated Cover / Envelop - 24lb White Envelope - 7.25” x 5.25”','','','','','','','','Trim Score x 1 and Leave Flat with Envelope','','Envelope file name: BTTID_ Env_7.25x5.25_EN.pdf','','','','','','Quote# Q05168',NULL),(5000154,'QM','1',0,'2 PMS (Navy 3581 & Blue 2728)','8.5\" x 11\"','8.5\" x 11\"','70lb Uncoated Text','17\" x 11\"','17\" x 11\"','2up','Sheetwork','','','','Trim to size','','','','','','','','',NULL),(5000155,'QM','1',0,'2 PMS (Navy 3581 & Blue 2728)','8.5\" x 11\"','8.5\" x 11\"','70lb Uncoated Text','17\" x 11\"','17\" x 11\"','2up','Sheetwork','','','','Trim to size','','','',NULL,NULL,NULL,NULL,NULL,NULL),(5000156,'QM','1',0,'2 PMS (Navy 3581 & Blue 2728)','8.5\" x 11\"','8.5\" x 11\"','70lb Uncoated Text','17\" x 11\"','17\" x 11\"','2up','Sheetwork','','','','Trim to size','','','',NULL,NULL,NULL,NULL,NULL,NULL),(5000157,'QM','1',1,'PMS - Navy 3581 & Blue 2728','9.5\" x 4.125\"','9.5\" x 4.125\"','No. 10 Non Window Envelope','','','','','','','','','','','','','','','','',NULL),(5000158,'QM','1',1,'PMS - Navy 3581 & Blue 2728','9.5\" x 4.125\"','9.5\" x 4.125\"','No. 10 Window Envelope','','','','','','','','','','','','','','','','',NULL),(5000159,'iGen5 / QM','1',1,'Card - 4+0 / Env - 1+0',' 7” x 5”','7” x 10”','Card - 100lb Uncoated Cover / Envelop - 24lb White Envelope - 7.25” x 5.25”','','','','','','','','Trim Score x 1 and Leave Flat with Envelope','','Envelope file name: BTTID_ Env_7.25x5.25_EN.pdf','','','','','','',NULL),(5000160,'iGen5 / QM','1',1,'Card - 4+0 / Env - 1+0',' 7” x 5”','7” x 10”','Card - 100lb Uncoated Cover / Envelop - 24lb White Envelope - 7.25” x 5.25”','','','','','','','','Trim Score x 1 and Leave Flat with Envelope','','Envelope file name: BTTID_ Env_7.25x5.25_EN.pdf','','','','','','',NULL),(5000161,'iGen5 / QM','1',1,'Card - 4+0 / Env - 1+0',' 7” x 5”','7” x 10”','Card - 100lb Uncoated Cover / Envelop - 24lb White Envelope - 7.25” x 5.25”','','','','','','','','Trim Score x 1 and Leave Flat with Envelope','','Envelope file name: BTTID_ Env_7.25x5.25_EN.pdf','',NULL,NULL,NULL,NULL,NULL,NULL),(5000162,'iGen5 / QM','1',1,'Card - 4+0 / Env - 1+0',' 7” x 5”','7” x 10”','Card - 100lb Uncoated Cover / Envelop - 24lb White Envelope - 7.25” x 5.25”','','','','','','','','Trim Score x 1 and Leave Flat with Envelope','','Envelope file name: BTTID_ Env_7.25x5.25_EN.pdf','',NULL,NULL,NULL,NULL,NULL,NULL),(5000163,'iGen5 / QM','1',1,'Card - 4+0 / Env - 1+0',' 7” x 5”','7” x 10”','Card - 100lb Uncoated Cover / Envelop - 24lb White Envelope - 7.25” x 5.25”','','','','','','','','Trim Score x 1 and Leave Flat with Envelope','','Envelope file name: BTTID_ Env_7.25x5.25_EN.pdf','',NULL,NULL,NULL,NULL,NULL,NULL);

--
-- Table structure for table `itemsSubcategoryLink`
--

CREATE TABLE `itemsSubcategoryLink` (
  `ITEMID` int NOT NULL,
  `SUBCATID` int NOT NULL,
  PRIMARY KEY (`ITEMID`,`SUBCATID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `itemsSubcategoryLink`
--

INSERT INTO `itemsSubcategoryLink` VALUES (4000000,39),(4000002,40),(4000003,40),(4000007,39),(4000008,40),(4000035,64),(4000036,39),(4000037,40),(4000062,39),(4000063,40),(4000064,39),(4000068,40),(4000069,39),(4000069,40),(4000071,39),(4000081,39),(4000082,40),(4000083,39),(4000087,64),(4000094,64),(4000099,64),(4000102,39),(4000103,40),(4000106,39),(4000107,40),(4000109,39),(4000112,70),(4000113,64),(4000115,64),(4000116,64),(4000120,64),(4000126,70),(4000128,70),(4000132,70),(4000133,64),(4000134,64),(4000258,39),(4000391,39),(4000436,39),(4000437,40),(4000438,39),(4000439,40),(4000440,39),(4000441,40),(4000442,39),(4000443,40),(4000453,39),(4000454,40),(4000455,39),(4000455,40),(4000456,39),(4000457,40),(4000460,39),(4000461,39),(4000462,39),(4000479,54),(4000480,54),(4000481,54),(4000483,54),(4000484,54),(4000485,54),(4000486,54),(4000487,54),(4000488,54),(4000489,54),(4000490,54),(4000491,54),(4000492,54),(4000493,54),(4000494,54),(4000495,54),(4000496,54),(4000498,54),(4000499,54),(4000500,54),(4000501,54),(4000502,54),(4000503,54),(4000504,54),(4000505,54),(4000506,54),(4000507,64),(4000508,64),(4000509,64),(4000510,64),(4000511,64),(4000512,64),(4000513,64),(4000514,64),(4000515,64),(4000516,64),(4000517,64),(4000518,64),(4000519,64),(4000520,64),(4000521,64),(4000522,64),(4000523,64),(4000524,64),(4000525,64),(4000526,64),(4000527,64),(4000528,64),(4000529,64),(4000530,64),(4000531,64),(4000532,64),(4000543,54),(4000544,54),(5000082,22),(5000084,22),(5000085,22),(5000085,71),(5000089,22),(5000090,22),(5000091,22),(5000092,22),(5000093,22),(5000094,22),(5000095,22),(5000096,22),(5000097,22),(5000098,22),(5000099,22),(5000100,22),(5000101,22),(5000102,22),(5000103,22),(5000104,22),(5000105,22),(5000106,22),(5000107,22),(5000108,22),(5000109,22),(5000112,22),(5000113,22),(5000114,22),(5000115,22),(5000116,22),(5000117,22),(5000118,22),(5000119,22),(5000120,22),(5000121,22),(5000122,22),(5000123,22),(5000123,71),(5000124,22),(5000124,71),(5000125,22),(5000125,71),(5000126,22),(5000130,22),(5000131,22),(5000132,22),(5000133,22),(5000134,22),(5000135,22),(5000136,22),(5000137,22),(5000138,22),(5000139,22),(5000140,22),(5000141,22),(5000142,22),(5000143,22),(5000144,22),(5000145,22),(5000146,22),(5000147,22),(5000148,22),(5000149,22),(5000150,22),(5000151,22),(5000152,22),(5000153,39),(5000154,54),(5000155,54),(5000156,54),(5000157,64),(5000158,64),(5000159,39),(5000160,39),(5000161,39),(5000162,39),(5000163,39),(5000164,22),(5000165,22),(5000166,22),(5000167,22),(5000168,22),(5000169,22),(5000170,22),(5000171,22),(5000172,22),(5000173,22),(5000174,22),(5000175,22);

--
-- Table structure for table `newsItems`
--

CREATE TABLE `newsItems` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `STARTDATE` date NOT NULL,
  `ENDDATE` date NOT NULL,
  `LANGUAGE` varchar(2) COLLATE utf8mb3_unicode_ci NOT NULL,
  `TITLE` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL,
  `MESSAGE` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `newsItems`
--


--
-- Table structure for table `orderDetail`
--

CREATE TABLE `orderDetail` (
  `ITEMLINE` int NOT NULL AUTO_INCREMENT,
  `ORDERID` int NOT NULL,
  `ITEMID` int NOT NULL,
  `ITEMCODE` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `ITEMDESC` varchar(200) COLLATE utf8mb3_unicode_ci NOT NULL,
  `ITEMOPTION` varchar(30) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ORDERQTY` int NOT NULL,
  `SHIPTODATEQTY` int NOT NULL,
  `UNITPRICE` decimal(19,4) DEFAULT NULL,
  `EXTPRICE` decimal(19,4) DEFAULT NULL,
  `TAXAMT1` decimal(19,4) DEFAULT NULL,
  `TAXAMT2` decimal(19,4) DEFAULT NULL,
  `TAXAMT3` decimal(19,4) DEFAULT NULL,
  `TAXAMT4` decimal(19,4) DEFAULT NULL,
  `TAXAMT5` decimal(19,4) DEFAULT NULL,
  `ITEMLENGTH` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ITEMWIDTH` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ITEMHEIGHT` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ITEMWEIGHT` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ITEMPIECES` int DEFAULT NULL,
  `PROOFCONFIRMATION` varchar(200) COLLATE utf8mb3_unicode_ci NOT NULL,
  `DOWNLOADLINK` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`ITEMLINE`,`ORDERID`)
) ENGINE=InnoDB AUTO_INCREMENT=1781 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `orderDetail`
--

INSERT INTO `orderDetail` VALUES (1737,3010415,5000133,'BTID_BCard_EN-00002','Business Card Template - English  (Demo Demo)','',0,0,0.1300,65.0000,8.4500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','5.000000',1,'d',NULL),(1738,3010416,5000134,'BTID_BCard_BIL-00001','Business Card Template - Bilingual  (Linda Bell, CFRE)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'s',NULL),(1739,3010416,5000135,'BTID_BCard_EN-00003','Business Card Template - English  (Sonia Mancini)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'d',NULL),(1742,3010419,5000137,'BTID_BCard_EN-00005','Business Card Template - English  (Test Only)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Test Only',NULL),(1745,3010421,5000138,'BTID_BCard_EN-00006','Business Card Template - English  (Test)','',0,0,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1747,3010422,5000138,'BTID_BCard_EN-00006','Business Card Template - English  (Test)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'d',NULL),(1748,3010422,5000138,'BTID_BCard_EN-00006','Business Card Template - English  (Test)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1749,3010422,5000138,'BTID_BCard_EN-00006','Business Card Template - English  (Test)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1750,3010423,5000139,'BTID_BCard_EN-00007','Business Card Template - English  (Raj Patara)','',250,250,0.2200,55.0000,2.7500,3.8500,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1751,3010424,5000141,'BTID_BCard_EN-00009','Business Card Template - English  (Colin Edington)','',500,500,0.1300,65.0000,3.2500,4.5500,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','5.000000',1,'Jaden Winfree',NULL),(1752,3010425,5000143,'BTID_BCard_EN-00011','Business Card Template - English  (Miriam Dos Anjos)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1753,3010426,5000144,'BTID_BCard_EN-00012','Business Card Template - English  (Scott McRae)','',1000,1000,0.0900,90.0000,4.5000,0.0000,0.0000,0.0000,0.0000,'12.0000','9.0000','3.0000','8.000000',1,'Jaden Winfree',NULL),(1754,3010427,5000145,'BTID_BCard_EN-00013','Business Card Template - English  (Tayler Taglione)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1757,3010430,5000146,'BTID_BCard_BIL-00002','Business Card Template - Bilingual  (Melanie Rose)','',250,250,0.2200,55.0000,2.7500,5.4890,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1760,3010433,5000147,'BTID_BCard_BIL-00003','Business Card Template - Bilingual  (Jonathan Cassin)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1761,3010434,5000151,'BTID_BCard_BIL-00004','Business Card Template - Bilingual  (Rosalie Sarasua, M.A. CVA)','',250,250,0.2200,55.0000,2.7500,5.4890,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1762,3010435,5000152,'BTID_BCard_EN-00017','Business Card Template - English  (Carol-Lynne Quintin)','',500,500,0.1300,65.0000,3.2500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','5.000000',1,'Jaden Winfree',NULL),(1763,3010435,5000150,'BTID_BCard_EN-00016','Business Card Template - English  (Jenna Lachance Marchak)','',500,500,0.1300,65.0000,3.2500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','5.000000',1,'Jaden Winfree',NULL),(1764,3010435,5000149,'BTID_BCard_EN-00015','Business Card Template - English  (Nicole Adolph)','',500,500,0.1300,65.0000,3.2500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','5.000000',1,'Jaden Winfree',NULL),(1765,3010435,5000148,'BTID_BCard_EN-00014','Business Card Template - English  (Dori Gibbon)','',500,500,0.1300,65.0000,3.2500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','5.000000',1,'Jaden Winfree',NULL),(1766,3010436,5000153,'BT1D_Card_InHonour_EN','In Honour Card with Envelopes(with logo) - English verison','',0,0,0.9240,231.0000,30.0300,0.0000,0.0000,0.0000,0.0000,'12.0000','9.0000','3.0000','5.000000',1,'s',NULL),(1767,3010437,5000153,'BT1D_Card_InHonour_EN','In Honour Card with Envelopes(with logo) - English verison','',0,0,0.9240,231.0000,30.0300,0.0000,0.0000,0.0000,0.0000,'12.0000','9.0000','3.0000','5.000000',1,'w',NULL),(1769,3010439,5000166,'BTID_BCard_EN-00019','Business Card Template - English  (Danielle Rana)','',250,250,0.2200,55.0000,2.7500,3.8500,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1770,3010440,5000167,'BTID_BCard_EN-00020','Business Card Template - English  (Heather Haldane)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1771,3010441,5000168,'BTID_BCard_EN-00021','Business Card Template - English  (Amanda Brown)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1772,3010442,5000169,'BTID_BCard_EN-00022','Business Card Template - English  (Claudia Canchaya)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1773,3010443,5000170,'BTID_BCard_EN-00023','Business Card Template - English  (Connor Shull)','',250,250,0.2200,55.0000,7.1500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL),(1779,3010446,5000174,'BTID_BCard_BIL-00007','Business Card Template - Bilingual  (Kimberley Hanson)','',500,500,0.1300,65.0000,8.4500,0.0000,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','5.000000',1,'Jaden Winfree',NULL),(1780,3010447,5000175,'BTID_BCard_EN-00026','Business Card Template - English  (Sarah Hill)','',250,250,0.2200,55.0000,2.7500,3.8500,0.0000,0.0000,0.0000,'9.0000','6.0000','3.0000','3.000000',1,'Jaden Winfree',NULL);

--
-- Table structure for table `orderHeader`
--

CREATE TABLE `orderHeader` (
  `ORDERID` int NOT NULL AUTO_INCREMENT,
  `USERNAME` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `ORDERDATE` datetime NOT NULL,
  `ORDERMODIFIED` datetime NOT NULL,
  `PONUMBER` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPCONTACTFIRSTNAME` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPCONTACTLASTNAME` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPCONTACTPHONE` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPCONTACTFAX` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPCONTACTEMAIL` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPNAME` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPADDRESS` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPADDRESS2` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPCITY` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPPROVINCE` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPCOUNTRY` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPPOSTAL` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ORDERSTATUS` varchar(20) COLLATE utf8mb3_unicode_ci NOT NULL,
  `TAXNAME1` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `TAXNAME2` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `TAXNAME3` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `TAXNAME4` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `TAXNAME5` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `TAXRATE1` decimal(19,4) DEFAULT NULL,
  `TAXRATE2` decimal(19,4) DEFAULT NULL,
  `TAXRATE3` decimal(19,4) DEFAULT NULL,
  `TAXRATE4` decimal(19,4) DEFAULT NULL,
  `TAXRATE5` decimal(19,4) DEFAULT NULL,
  `SHIPPINGCOST` decimal(19,4) NOT NULL DEFAULT '0.0000',
  `SPECIALINSTRUCTIONS` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `RECEIVERINSTRUCTIONS` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `APPROVALLINK` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `EXPDATE` datetime DEFAULT NULL,
  `SHIPTAXGROUP` varchar(6) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ORDERREF` int DEFAULT NULL,
  `PAYMENTREF` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPSTOREID` varchar(20) COLLATE utf8mb3_unicode_ci NOT NULL,
  `SHIPPINGCOSTTAXAMT1` decimal(19,4) DEFAULT '0.0000',
  `SHIPPINGCOSTTAXAMT2` decimal(19,4) DEFAULT '0.0000',
  `SHIPPINGCOSTTAXAMT3` decimal(19,4) DEFAULT '0.0000',
  `SHIPPINGCOSTTAXAMT4` decimal(19,4) DEFAULT '0.0000',
  `SHIPPINGCOSTTAXAMT5` decimal(19,4) DEFAULT '0.0000',
  `SHIPPINGMETHOD` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT 'N/A',
  `REQCONTACTFIRSTNAME` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `REQCONTACTLASTNAME` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `REQCONTACTPHONE` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `REQCONTACTFAX` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `REQNAME` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `REQADDRESS` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `REQADDRESS2` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `REQCITY` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `REQPROVINCE` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `REQCOUNTRY` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `REQPOSTAL` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `EXTRADATA1` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `APPROVALDATE` datetime DEFAULT NULL,
  `BILLINGCATEGORY` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`ORDERID`)
) ENGINE=InnoDB AUTO_INCREMENT=3010448 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `orderHeader`
--

INSERT INTO `orderHeader` VALUES (3010415,'Peggy','2025-01-15 01:50:27','2025-01-15 01:50:27','','Peggy','Cheng','905.709.9609','905.709.9610','peggy@creativepath.com','Creative Path Digital Imaging Inc.','1455-16Avenue, Unit 1 & 2','','Richmond Hill','ON','Canada','L4B 4W5','CANCELLED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,0.0000,'20250115015140','',NULL,'2025-01-23 01:50:27','ON',10000,'BHO','CPDI',0.0000,0.0000,0.0000,0.0000,0.0000,'Ground','Peggy','Cheng','905.709.9609','905.709.9610','Creative Path Digital Imaging Inc.','1455-16Avenue, Unit 1 & 2','','Richmond Hill','ON','Canada','L4B 4W5',NULL,NULL,''),(3010416,'Peggy','2025-01-27 16:37:27','2025-01-27 16:37:27','','Michelle',' van Vliet','905.709.9609','905.709.9610','mvanvliet@BreakthroughT1D.ca','Creative Path Digital Imaging Inc.','1455-16Avenue, Unit 1 & 2','','Richmond Hill','ON','Canada','L4B 4W5','SHIPPED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,0.0000,'Please ship to 208-1379 Costigan Rd, Milton ON, L9T 2K6. Attn: Sonia Mancini. GL for invoicing is: 1160-80063','',NULL,'2025-02-04 16:37:27','ON',10001,'BHO','CPDI',0.0000,0.0000,0.0000,0.0000,0.0000,'Ground','Peggy','Cheng','905.709.9609','905.709.9610','Creative Path Digital Imaging Inc.','1455-16Avenue, Unit 1 & 2','','Richmond Hill','ON','Canada','L4B 4W5',NULL,NULL,''),(3010419,'Jaden','2025-01-30 21:05:20','2025-01-30 21:05:20','','Test ','Only','647-789-2000','','jwinfree@breakthrought1d.ca','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8','SHIPPED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,0.0000,'TEST ONLY','',NULL,'2025-02-07 21:05:20','ON',10002,'BHO','900',0.0000,0.0000,0.0000,0.0000,0.0000,'Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010421,'Jaden','2025-01-31 13:40:30','2025-01-31 13:40:30','','Test','Test','647-789-2000','','jwinfree@breakthrought1d.ca','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8','CANCELLED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,0.0000,'20250131155208','',NULL,'2025-02-08 13:40:30','ON',10003,'BHO','900',0.0000,0.0000,0.0000,0.0000,0.0000,'Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010422,'Jaden','2025-01-31 15:51:00','2025-01-31 15:51:00','','Test','Test','1231234','','jwinfree@breakthrought1d.ca','Test','123 No Address','','Toronto','ON','Canada','M3M 1H8','SHIPPED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,0.0000,'Test','',NULL,'2025-02-08 15:51:00','ON',10004,'BHO','',0.0000,0.0000,0.0000,0.0000,0.0000,'Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010423,'Jaden','2025-01-31 16:52:19','2025-01-31 16:52:19','','Raj','Patara','604-292-2775','','Rpatara@breathroughT1D.ca','Raj Patara','32354 Cordova Avenue','','Abbotsford','BC','Canada','V2T 4M6','SHIPPED','GST','PST','','','',0.0500,0.0700,0.0000,0.0000,0.0000,0.0000,'','',NULL,'2025-02-08 16:52:19','BC',10005,'BHO','',0.0000,0.0000,0.0000,0.0000,0.0000,'Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010424,'Jaden','2025-01-31 17:52:34','2025-01-31 17:52:34','','Colin','Edington','(778) 839-0682','','cedington@breakthrought1d.ca','Colin Edington','1002-1108 Pendrell Street','','Vancouver','BC','Canada','V6E 0C7','SHIPPED','GST','PST','','','',0.0500,0.0700,0.0000,0.0000,0.0000,0.0000,'','',NULL,'2025-02-08 17:52:34','BC',10006,'BHO','',0.0000,0.0000,0.0000,0.0000,0.0000,'Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010425,'Jaden','2025-02-03 14:26:36','2025-02-03 14:26:36','','Miriam','Dos Anjos','647-789-2039','','mdosanjos@breakthrought1d.ca','Miriam Dos Anjos','24 Baywell Cres','','Aurora','ON','Canada','L4G 7M7','SHIPPED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,0.0000,'N/A','N/A',NULL,'2025-02-11 14:26:36','ON',10007,'BHO','',0.0000,0.0000,0.0000,0.0000,0.0000,'Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010426,'Jaden','2025-02-03 17:16:04','2025-02-03 17:16:04','','Scott','McRae','403-255-7127','','smcrae@breakthrought1d.ca','Scott McRae','311 Hawthorn Dr NW','','Calgary','AB','Canada','T2K 3M6','SHIPPED','GST','','','','',0.0500,0.0000,0.0000,0.0000,0.0000,0.0000,'N/A','N/A',NULL,'2025-02-11 17:16:04','AB',10008,'BHO','',0.0000,0.0000,0.0000,0.0000,0.0000,'Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010427,'Jaden','2025-02-04 20:49:37','2025-02-04 20:49:37','','Tayler','Taglione','647.789.2980','','ttaglione@breakthroughT1D.ca','Tayler Taglione','2-15A Claxton Blvd','','Toronto','ON','Canada','M6C 1L7','SHIPPED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,0.0000,'N/A','N/A',NULL,'2025-02-12 20:49:37','ON',10009,'BHO','',0.0000,0.0000,0.0000,0.0000,0.0000,'Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010430,'Jaden','2025-02-07 19:51:17','2025-02-07 19:51:17','','Melanie','Rose','514-744-1079','','mrose@breakthroughT1D.ca','Melanie Rose','235 rue Du Sentier','','Pincourt','QC','Canada','J7W 9P6','SHIPPED','GST','QST','','','',0.0500,0.0998,0.0000,0.0000,0.0000,0.0000,'N/A','',NULL,'2025-02-15 19:51:17','QC',10010,'BHO','',0.0000,0.0000,0.0000,0.0000,0.0000,'Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010433,'Jaden','2025-02-20 13:29:42','2025-02-20 13:29:42','','Jonathan','Cassin','647-789-2006','','jcassin@breakthrought1d.ca','Jonathan Cassin','10630 The Gore Rd.','','Brampton','ON','Canada','L6P 0A5','SHIPPED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,18.6500,'N/A','',NULL,'2025-02-28 13:29:42','ON',10011,'BHO','',2.4200,0.0000,0.0000,0.0000,0.0000,'Purolator Express','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010434,'Jaden','2025-02-21 19:43:27','2025-02-21 19:43:27','','Rosalie','Sarasua','514-744-2971','','rsarasua@breakthroughT1D.ca','Rosalie Sarasua','502 Westminster','','Dollard des Ormeaux','QC','Canada','H9G 1E5','SHIPPED','GST','QST','','','',0.0500,0.0998,0.0000,0.0000,0.0000,32.9400,'N/A','',NULL,'2025-03-01 19:43:27','QC',10012,'BHO','',1.6500,3.2900,0.0000,0.0000,0.0000,'Purolator Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010435,'Jaden','2025-02-24 15:32:16','2025-02-24 15:32:16','','Scott','McRae','403.255.7127','','smcrae@BreakthroughT1D.ca','Scott McRae','311 Hawthorn Dr NW','','Calgary','AB','Canada','T2K 3M6','SHIPPED','GST','','','','',0.0500,0.0000,0.0000,0.0000,0.0000,52.9800,'N/A','',NULL,'2025-03-04 15:32:16','AB',10013,'BHO','',2.6500,0.0000,0.0000,0.0000,0.0000,'Purolator Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010436,'Peggy','2025-02-26 22:30:17','2025-02-26 22:30:17','','Peggy','Cheng','905.709.9609','905.709.9610','peggy@creativepath.com','Creative Path Digital Imaging Inc.','1455-16Avenue, Unit 1 & 2','','Richmond Hill','ON','Canada','L4B 4W5','CANCELLED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,17.3700,'20250226223136','',NULL,'2025-03-06 22:30:17','ON',10014,'BHO','CPDI',2.2600,0.0000,0.0000,0.0000,0.0000,'Purolator Ground','Peggy','Cheng','905.709.9609','905.709.9610','Creative Path Digital Imaging Inc.','1455-16Avenue, Unit 1 & 2','','Richmond Hill','ON','Canada','L4B 4W5',NULL,NULL,''),(3010437,'Peggy','2025-02-26 22:35:34','2025-02-26 22:35:34','','Peggy','Cheng','905.709.9609','905.709.9610','peggy@creativepath.com','Creative Path Digital Imaging Inc.','1455-16Avenue, Unit 1 & 2','','Richmond Hill','ON','Canada','L4B 4W5','CANCELLED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,17.3700,'20250226223654','',NULL,'2025-03-06 22:35:34','ON',10015,'BHO','CPDI',2.2600,0.0000,0.0000,0.0000,0.0000,'Purolator Ground','Peggy','Cheng','905.709.9609','905.709.9610','Creative Path Digital Imaging Inc.','1455-16Avenue, Unit 1 & 2','','Richmond Hill','ON','Canada','L4B 4W5',NULL,NULL,''),(3010439,'Jaden','2025-04-25 15:21:00','2025-04-25 15:21:00','','Danielle','Rana','778-228-1649','','drana@breakthroughT1D.ca','Danielle Rana','388 Kaslo Street','Unit 519 (Buzzer# 2034)','Vancouver','BC','Canada','V5K 0G6','SHIPPED','GST','PST','','','',0.0500,0.0700,0.0000,0.0000,0.0000,37.1600,'','',NULL,'2025-05-03 15:21:00','BC',10016,'BHO','',1.8600,2.6000,0.0000,0.0000,0.0000,'Purolator Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010440,'Jaden','2025-04-28 13:31:45','2025-04-28 13:31:45','','Heather','Haldane','289-768-6727','','hhaldane@breakthrought1d.ca','Heather Haldane','358 Parrott Place','','Woodstock','ON','Canada','N4T 1V4','SHIPPED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,33.1600,'','',NULL,'2025-05-06 13:31:45','ON',10017,'BHO','',4.3100,0.0000,0.0000,0.0000,0.0000,'Purolator Express','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010441,'Jaden','2025-04-28 13:45:23','2025-04-28 13:45:23','','Amanda ','Brown','647-789-2020','','abrown@breakthrought1d.ca','Amanda Brown','18 Loyalist Road','','Etobicoke','ON','Canada','M9A 3P3','SHIPPED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,18.7800,'','',NULL,'2025-05-06 13:45:23','ON',10018,'BHO','',2.4400,0.0000,0.0000,0.0000,0.0000,'Purolator Express','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010442,'Jaden','2025-04-28 20:43:00','2025-04-28 20:43:00','','Claudia','Canchaya','437-254-7047','','ccanchaya@breakthroughT1D.ca','Claudia Canchaya','102-12 Heather St','','Barrie','ON','Canada','L4N 5J3','SHIPPED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,24.4000,'Instructions for Courier:  Please call 437-254-7047 when you arrive.  Thank-you!','',NULL,'2025-05-06 20:43:00','ON',10019,'BHO','',3.1700,0.0000,0.0000,0.0000,0.0000,'Purolator Express','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010443,'Jaden','2025-05-06 16:55:52','2025-05-06 16:55:52','','Connor','Shull','647-991-1447','','cshull@breakthrought1d.ca','Connor Shull','15 Windermere Avenue','Apt#902','Toronto','ON','Canada','M6S 5A2','SHIPPED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,18.3600,'','',NULL,'2025-05-14 16:55:52','ON',10020,'BHO','',2.3900,0.0000,0.0000,0.0000,0.0000,'Purolator Express','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010446,'Jaden','2025-10-22 19:44:39','2025-10-22 19:44:39','','Kimberley','Hanson','613-294-3287','','khanson@BreakthroughT1D.ca','Kimberley Hanson','5623 Van Vliet Rd','','Manotick','ON','Canada','K4M 1J4','SHIPPED','HST','','','','',0.1300,0.0000,0.0000,0.0000,0.0000,67.7200,'','',NULL,'2025-10-30 19:44:39','ON',10021,'BHO','',8.8000,0.0000,0.0000,0.0000,0.0000,'Canpar Express','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,''),(3010447,'Jaden','2025-11-17 15:21:05','2025-11-17 15:21:05','','Sarah','Hill','204-953-4472','','shill@breakthroughT1D.ca','Sarah Hill','84 Egerton Road','','Winnipeg','MB','Canada','R2M 2V8','SHIPPED','GST','PST','','','',0.0500,0.0700,0.0000,0.0000,0.0000,46.4600,'','',NULL,'2025-11-25 15:21:05','MB',10022,'BHO','',2.3200,3.2500,0.0000,0.0000,0.0000,'Canpar Ground','Jaden','Winfree','647-789-2000','','National Support Office (NSO)','235 Yorkland Blvd, Suite 1201','','Toronto','ON','Canada','M2J 4Y8',NULL,NULL,'');

--
-- Table structure for table `orderPromos`
--

CREATE TABLE `orderPromos` (
  `ORDERID` int NOT NULL,
  `PROMOCODE` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `PROMONAME` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `PROMOTYPE` varchar(12) COLLATE utf8mb3_unicode_ci NOT NULL,
  `SINGLEITEM` int NOT NULL DEFAULT '0',
  `PROMOVALUE` decimal(19,2) NOT NULL,
  `CALCDISCOUNT` decimal(19,2) NOT NULL,
  `TAXAMT1` decimal(19,2) NOT NULL,
  `TAXAMT2` decimal(19,2) NOT NULL,
  `TAXAMT3` decimal(19,2) NOT NULL,
  `TAXAMT4` decimal(19,2) NOT NULL,
  `TAXAMT5` decimal(19,2) NOT NULL,
  PRIMARY KEY (`ORDERID`,`PROMOCODE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `orderPromos`
--


--
-- Table structure for table `preOrderDefinition`
--

CREATE TABLE `preOrderDefinition` (
  `CODE` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `ITEMNAME` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `SHORTDESC` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `FULLDESC` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `COMPONENTINPUTS` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `DISPLAYIMAGEPATH` varchar(200) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `ACTIVE` int NOT NULL DEFAULT '1',
  `BRAND` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT 'ALL',
  `EMAILDESC` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `AVAILABLELANGS` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT 'English|Bilingual',
  PRIMARY KEY (`CODE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `preOrderDefinition`
--


--
-- Table structure for table `preOrderDefinitionV2`
--

CREATE TABLE `preOrderDefinitionV2` (
  `ACTIVE` int NOT NULL DEFAULT '1',
  `CODE` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `BRAND` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT 'ALL',
  `ITEMNAME` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `INTRODESC` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `INTRODESC_EMAIL` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `ELIGIBLEQUESTION` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `ELIGIBLENO` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `AVAILABLELANGS` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT 'English|Bilingual',
  `SECTION1NAME` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION1INTRO` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION1INTRO_EMAIL` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION1COMPONENT` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION1FOOTER` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION2NAME` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION2INTRO` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION2INTRO_EMAIL` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION2COMPONENT` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION2FOOTER` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION3NAME` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION3INTRO` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION3INTRO_EMAIL` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION3COMPONENT` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SECTION3FOOTER` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `SUBMITMESSAGE` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `BANNERIMAGE` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT '',
  PRIMARY KEY (`CODE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `preOrderDefinitionV2`
--


--
-- Table structure for table `preOrders`
--

CREATE TABLE `preOrders` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `CODE` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `USERNAME` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `BRANCH` varchar(20) COLLATE utf8mb3_unicode_ci NOT NULL,
  `SKIN` varchar(20) COLLATE utf8mb3_unicode_ci NOT NULL,
  `STORENAME` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ADDRESS` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ADDRESS2` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `CITY` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `PROVINCE` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `COUNTRY` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `POSTALCODE` varchar(20) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `CONTACTNAME` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `CONTACTEMAIL` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `BASEQTY` int NOT NULL DEFAULT '1',
  `COMPONENTS` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `LANGUAGE` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `preOrders`
--


--
-- Table structure for table `preOrdersV2`
--

CREATE TABLE `preOrdersV2` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `CODE` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `USERNAME` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `BRANCH` varchar(20) COLLATE utf8mb3_unicode_ci NOT NULL,
  `SKIN` varchar(20) COLLATE utf8mb3_unicode_ci NOT NULL,
  `STORENAME` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ADDRESS` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ADDRESS2` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `CITY` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `PROVINCE` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `COUNTRY` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `POSTALCODE` varchar(20) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `CONTACTNAME` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `CONTACTEMAIL` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `CONTACTPHONE` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `COMPONENTS1` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `COMPONENTS2` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `COMPONENTS3` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `LANGUAGE` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `preOrdersV2`
--


--
-- Table structure for table `promos`
--

CREATE TABLE `promos` (
  `CODE` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `NAME` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `CODETYPE` varchar(12) COLLATE utf8mb3_unicode_ci NOT NULL,
  `STARTDATE` date NOT NULL,
  `ENDDATE` date NOT NULL,
  `SINGLEUSE` int NOT NULL DEFAULT '0',
  `REDEEMED` int NOT NULL DEFAULT '0',
  `PROMOVALUE` decimal(19,2) NOT NULL DEFAULT '0.00',
  `SINGLEITEM` int NOT NULL DEFAULT '0',
  `MAXQTY` int DEFAULT '0',
  `MINQTY` int DEFAULT '0',
  `EXACTQTY` int DEFAULT '0',
  `QTYTYPE` varchar(12) COLLATE utf8mb3_unicode_ci NOT NULL,
  PRIMARY KEY (`CODE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `promos`
--


--
-- Table structure for table `promosCategories`
--

CREATE TABLE `promosCategories` (
  `CODE` varchar(50) NOT NULL,
  `CATID` int NOT NULL,
  PRIMARY KEY (`CODE`,`CATID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `promosCategories`
--


--
-- Table structure for table `promosItems`
--

CREATE TABLE `promosItems` (
  `CODE` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `ITEMID` int NOT NULL,
  PRIMARY KEY (`CODE`,`ITEMID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `promosItems`
--


--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `key` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `value` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `settings`
--

INSERT INTO `settings` VALUES ('site_maint','0');

--
-- Table structure for table `shipToAddresses`
--

CREATE TABLE `shipToAddresses` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `STOREID` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `NAME` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `ADDRESS` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL,
  `ADDRESS2` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `CITY` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `PROVINCE` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `COUNTRY` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `POSTAL` varchar(20) COLLATE utf8mb3_unicode_ci NOT NULL,
  `PHONE` varchar(20) COLLATE utf8mb3_unicode_ci NOT NULL,
  `FAX` varchar(20) COLLATE utf8mb3_unicode_ci NOT NULL,
  `TAXGROUP` varchar(6) COLLATE utf8mb3_unicode_ci NOT NULL,
  `SHIPZONE` varchar(6) COLLATE utf8mb3_unicode_ci NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `shipToAddresses`
--


--
-- Table structure for table `shipToAddressesUserList`
--

CREATE TABLE `shipToAddressesUserList` (
  `ID` int NOT NULL,
  `USERNAME` varchar(50) NOT NULL,
  PRIMARY KEY (`ID`,`USERNAME`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `shipToAddressesUserList`
--


--
-- Table structure for table `shipZoneCosts`
--

CREATE TABLE `shipZoneCosts` (
  `WEIGHT` int NOT NULL,
  `None` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone1` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone2` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone3` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone4` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone5` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone6` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone7` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone8` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone9` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone10` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone11` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone12` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone13` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone14` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone15` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone16` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone17` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone18` decimal(16,2) NOT NULL DEFAULT '0.00',
  `Zone19` decimal(16,2) NOT NULL DEFAULT '0.00',
  PRIMARY KEY (`WEIGHT`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `shipZoneCosts`
--

INSERT INTO `shipZoneCosts` VALUES (0,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00);

--
-- Table structure for table `shipmentCostLog`
--

CREATE TABLE `shipmentCostLog` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `CARRIER` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `METHOD` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPFROM_NAME` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPFROM_STREETNUM` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPFROM_STREET` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPFROM_CITY` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPFROM_PROVINCE` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPFROM_COUNTRY` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPFROM_POSTAL` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `TOTALWEIGHT` decimal(19,4) DEFAULT NULL,
  `TOTALBOXES` int DEFAULT NULL,
  `SHIPTO_PROVINCE` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPTO_POSTAL` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `SHIPTO_CITY` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `TOTALPRICE` decimal(19,4) DEFAULT NULL,
  `OURMARKUP` decimal(19,4) DEFAULT NULL,
  `OURSLEEVECHARGE` decimal(19,4) DEFAULT NULL,
  `ORDERID` int DEFAULT NULL,
  `CREATEDATETIME` datetime DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=175 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `shipmentCostLog`
--

INSERT INTO `shipmentCostLog` VALUES (1,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4B 4W5','Richmond Hill',11.8200,1.3000,0.0000,3010431,'2025-02-12 20:04:50'),(2,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4B 4W5','Richmond Hill',12.0400,1.3000,0.0000,3010431,'2025-02-12 20:04:50'),(3,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4B 4W5','Richmond Hill',12.8300,1.3000,0.0000,3010431,'2025-02-12 20:04:51'),(4,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4B 4W5','Richmond Hill',29.1100,1.3000,0.0000,3010431,'2025-02-12 20:04:51'),(5,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4B 4W5','Richmond Hill',12.0400,1.3000,0.0000,3010432,'2025-02-13 15:01:08'),(6,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4B 4W5','Richmond Hill',11.8200,1.3000,0.0000,3010432,'2025-02-13 15:01:08'),(7,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4B 4W5','Richmond Hill',12.8300,1.3000,0.0000,3010432,'2025-02-13 15:01:09'),(8,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4B 4W5','Richmond Hill',29.1100,1.3000,0.0000,3010432,'2025-02-13 15:01:09'),(9,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.8200,1.4500,0.0000,3010433,'2025-02-20 13:25:39'),(10,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',12.0400,1.4500,0.0000,3010433,'2025-02-20 13:25:39'),(11,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',12.8300,1.4500,0.0000,3010433,'2025-02-20 13:25:40'),(12,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',29.1100,1.4500,0.0000,3010433,'2025-02-20 13:25:40'),(13,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L6P 0A5','Brampton',12.6400,1.4500,0.0000,3010433,'2025-02-20 13:27:37'),(14,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L6P 0A5','Brampton',12.8600,1.4500,0.0000,3010433,'2025-02-20 13:27:37'),(15,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L6P 0A5','Brampton',19.3700,1.4500,0.0000,3010433,'2025-02-20 13:27:38'),(16,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L6P 0A5','Brampton',35.6500,1.4500,0.0000,3010433,'2025-02-20 13:27:39'),(17,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L6P 0A5','Brampton',12.6400,1.4500,0.0000,3010433,'2025-02-20 13:29:43'),(18,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L6P 0A5','Brampton',12.8600,1.4500,0.0000,3010433,'2025-02-20 13:29:43'),(19,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L6P 0A5','Brampton',19.3700,1.4500,0.0000,3010433,'2025-02-20 13:29:43'),(20,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L6P 0A5','Brampton',35.6500,1.4500,0.0000,3010433,'2025-02-20 13:29:44'),(21,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.8200,1.4500,0.0000,3010434,'2025-02-21 19:38:25'),(22,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',12.0400,1.4500,0.0000,3010434,'2025-02-21 19:38:25'),(23,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',12.7600,1.4500,0.0000,3010434,'2025-02-21 19:38:33'),(24,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',28.9500,1.4500,0.0000,3010434,'2025-02-21 19:38:34'),(25,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'QC','H9G 1E5','Dollard des Ormeaux',22.7200,1.4500,0.0000,3010434,'2025-02-21 19:41:47'),(26,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'QC','H9G 1E5','Dollard des Ormeaux',23.2500,1.4500,0.0000,3010434,'2025-02-21 19:41:47'),(27,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'QC','H9G 1E5','Dollard des Ormeaux',23.6600,1.4500,0.0000,3010434,'2025-02-21 19:41:48'),(28,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'QC','H9G 1E5','Dollard des Ormeaux',46.7700,1.4500,0.0000,3010434,'2025-02-21 19:41:48'),(29,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'QC','H9G 1E5','Dollard des Ormeaux',23.2500,1.4500,0.0000,3010434,'2025-02-21 19:43:28'),(30,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'QC','H9G 1E5','Dollard des Ormeaux',22.7200,1.4500,0.0000,3010434,'2025-02-21 19:43:28'),(31,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'QC','H9G 1E5','Dollard des Ormeaux',23.6600,1.4500,0.0000,3010434,'2025-02-21 19:43:29'),(32,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'QC','H9G 1E5','Dollard des Ormeaux',46.7700,1.4500,0.0000,3010434,'2025-02-21 19:43:29'),(33,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',20.0000,4,'ON','M2J 4Y8','Toronto',14.8200,1.4500,0.0000,3010435,'2025-02-24 15:28:11'),(34,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',20.0000,4,'ON','M2J 4Y8','Toronto',15.0900,1.4500,0.0000,3010435,'2025-02-24 15:28:11'),(35,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',20.0000,4,'ON','M2J 4Y8','Toronto',17.3000,1.4500,0.0000,3010435,'2025-02-24 15:28:12'),(36,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',20.0000,4,'ON','M2J 4Y8','Toronto',45.1700,1.4500,0.0000,3010435,'2025-02-24 15:28:12'),(37,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',20.0000,4,'AB','T2K 3M6','Calgary',36.5400,1.4500,0.0000,3010435,'2025-02-24 15:30:57'),(38,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',20.0000,4,'AB','T2K 3M6','Calgary',54.4100,1.4500,0.0000,3010435,'2025-02-24 15:30:57'),(39,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',20.0000,4,'AB','T2K 3M6','Calgary',41.9300,1.4500,0.0000,3010435,'2025-02-24 15:30:58'),(40,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',20.0000,4,'AB','T2K 3M6','Calgary',341.2500,1.4500,0.0000,3010435,'2025-02-24 15:30:58'),(41,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',20.0000,4,'AB','T2K 3M6','Calgary',54.4100,1.4500,0.0000,3010435,'2025-02-24 15:32:17'),(42,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',20.0000,4,'AB','T2K 3M6','Calgary',36.5400,1.4500,0.0000,3010435,'2025-02-24 15:32:17'),(43,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',20.0000,4,'AB','T2K 3M6','Calgary',41.9300,1.4500,0.0000,3010435,'2025-02-24 15:32:17'),(44,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',20.0000,4,'AB','T2K 3M6','Calgary',341.2500,1.4500,0.0000,3010435,'2025-02-24 15:32:18'),(45,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',12.2100,1.4500,0.0000,3010436,'2025-02-26 22:29:49'),(46,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',11.9800,1.4500,0.0000,3010436,'2025-02-26 22:29:49'),(47,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',12.7600,1.4500,0.0000,3010436,'2025-02-26 22:29:50'),(48,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',30.3000,1.4500,0.0000,3010436,'2025-02-26 22:29:50'),(49,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',12.2100,1.4500,0.0000,3010436,'2025-02-26 22:30:17'),(50,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',11.9800,1.4500,0.0000,3010436,'2025-02-26 22:30:17'),(51,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',12.7600,1.4500,0.0000,3010436,'2025-02-26 22:30:18'),(52,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',30.3000,1.4500,0.0000,3010436,'2025-02-26 22:30:18'),(53,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',11.9800,1.4500,0.0000,3010437,'2025-02-26 22:35:12'),(54,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',12.2100,1.4500,0.0000,3010437,'2025-02-26 22:35:12'),(55,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',12.7600,1.4500,0.0000,3010437,'2025-02-26 22:35:13'),(56,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',30.3000,1.4500,0.0000,3010437,'2025-02-26 22:35:13'),(57,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',12.2100,1.4500,0.0000,3010437,'2025-02-26 22:35:35'),(58,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',11.9800,1.4500,0.0000,3010437,'2025-02-26 22:35:35'),(59,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',12.7600,1.4500,0.0000,3010437,'2025-02-26 22:35:35'),(60,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',30.3000,1.4500,0.0000,3010437,'2025-02-26 22:35:35'),(61,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4B 4W5','Richmond Hill',12.2200,1.4500,0.0000,3010438,'2025-03-24 18:13:07'),(62,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4B 4W5','Richmond Hill',12.0000,1.4500,0.0000,3010438,'2025-03-24 18:13:07'),(63,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4B 4W5','Richmond Hill',12.6800,1.4500,0.0000,3010438,'2025-03-24 18:13:08'),(64,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4B 4W5','Richmond Hill',28.7800,1.4500,0.0000,3010438,'2025-03-24 18:13:08'),(65,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',12.1300,1.4500,0.0000,3010439,'2025-04-25 15:16:53'),(66,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.9100,1.4500,0.0000,3010439,'2025-04-25 15:16:53'),(67,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.8400,1.4500,0.0000,3010439,'2025-04-25 15:16:53'),(68,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',26.8900,1.4500,0.0000,3010439,'2025-04-25 15:16:54'),(69,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'BC','M2J 4Y8','Vancouver',11.8400,1.4500,0.0000,3010439,'2025-04-25 15:19:09'),(70,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'BC','M2J 4Y8','Vancouver',26.8900,1.4500,0.0000,3010439,'2025-04-25 15:19:09'),(71,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'BC','V5K 0G6','Vancouver',29.2900,1.4500,0.0000,3010439,'2025-04-25 15:19:46'),(72,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'BC','V5K 0G6','Vancouver',25.6300,1.4500,0.0000,3010439,'2025-04-25 15:19:46'),(73,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'BC','V5K 0G6','Vancouver',26.2300,1.4500,0.0000,3010439,'2025-04-25 15:19:46'),(74,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'BC','V5K 0G6','Vancouver',120.0800,1.4500,0.0000,3010439,'2025-04-25 15:19:47'),(75,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'BC','V5K 0G6','Vancouver',29.2900,1.4500,0.0000,3010439,'2025-04-25 15:21:01'),(76,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'BC','V5K 0G6','Vancouver',25.6300,1.4500,0.0000,3010439,'2025-04-25 15:21:01'),(77,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'BC','V5K 0G6','Vancouver',26.2300,1.4500,0.0000,3010439,'2025-04-25 15:21:01'),(78,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'BC','V5K 0G6','Vancouver',120.0800,1.4500,0.0000,3010439,'2025-04-25 15:21:01'),(79,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',12.1300,1.4500,0.0000,3010440,'2025-04-28 13:29:24'),(80,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.9100,1.4500,0.0000,3010440,'2025-04-28 13:29:24'),(81,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.8400,1.4500,0.0000,3010440,'2025-04-28 13:29:26'),(82,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',26.8900,1.4500,0.0000,3010440,'2025-04-28 13:29:26'),(83,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','N4T 1V4','Woodstock',22.4200,1.4500,0.0000,3010440,'2025-04-28 13:30:39'),(84,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','N4T 1V4','Woodstock',22.8700,1.4500,0.0000,3010440,'2025-04-28 13:30:39'),(85,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','N4T 1V4','Woodstock',22.2000,1.4500,0.0000,3010440,'2025-04-28 13:30:40'),(86,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','N4T 1V4','Woodstock',42.5800,1.4500,0.0000,3010440,'2025-04-28 13:30:40'),(87,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','N4T 1V4','Woodstock',22.8700,1.4500,0.0000,3010440,'2025-04-28 13:31:46'),(88,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','N4T 1V4','Woodstock',22.4200,1.4500,0.0000,3010440,'2025-04-28 13:31:46'),(89,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','N4T 1V4','Woodstock',22.2000,1.4500,0.0000,3010440,'2025-04-28 13:31:46'),(90,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','N4T 1V4','Woodstock',42.5800,1.4500,0.0000,3010440,'2025-04-28 13:31:46'),(91,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.9100,1.4500,0.0000,3010441,'2025-04-28 13:43:15'),(92,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',12.1300,1.4500,0.0000,3010441,'2025-04-28 13:43:15'),(93,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.8400,1.4500,0.0000,3010441,'2025-04-28 13:43:15'),(94,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',26.8900,1.4500,0.0000,3010441,'2025-04-28 13:43:15'),(95,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M9A 3P3','Etobicoke',12.7300,1.4500,0.0000,3010441,'2025-04-28 13:44:30'),(96,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M9A 3P3','Etobicoke',12.9500,1.4500,0.0000,3010441,'2025-04-28 13:44:30'),(97,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M9A 3P3','Etobicoke',18.0000,1.4500,0.0000,3010441,'2025-04-28 13:44:30'),(98,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M9A 3P3','Etobicoke',33.0500,1.4500,0.0000,3010441,'2025-04-28 13:44:30'),(99,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M9A 3P3','Etobicoke',12.7300,1.4500,0.0000,3010441,'2025-04-28 13:45:24'),(100,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M9A 3P3','Etobicoke',12.9500,1.4500,0.0000,3010441,'2025-04-28 13:45:24'),(101,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M9A 3P3','Etobicoke',18.0000,1.4500,0.0000,3010441,'2025-04-28 13:45:24'),(102,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M9A 3P3','Etobicoke',33.0500,1.4500,0.0000,3010441,'2025-04-28 13:45:25'),(103,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.9100,1.4500,0.0000,3010442,'2025-04-28 20:39:46'),(104,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',12.1300,1.4500,0.0000,3010442,'2025-04-28 20:39:46'),(105,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.8400,1.4500,0.0000,3010442,'2025-04-28 20:39:46'),(106,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',26.8900,1.4500,0.0000,3010442,'2025-04-28 20:39:46'),(107,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4N 5J3','Barrie',16.5500,1.4500,0.0000,3010442,'2025-04-28 20:41:02'),(108,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4N 5J3','Barrie',16.8300,1.4500,0.0000,3010442,'2025-04-28 20:41:02'),(109,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4N 5J3','Barrie',21.2400,1.4500,0.0000,3010442,'2025-04-28 20:41:02'),(110,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4N 5J3','Barrie',40.1800,1.4500,0.0000,3010442,'2025-04-28 20:41:03'),(111,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4N 5J3','Barrie',16.8300,1.4500,0.0000,3010442,'2025-04-28 20:43:02'),(112,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4N 5J3','Barrie',16.5500,1.4500,0.0000,3010442,'2025-04-28 20:43:02'),(113,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4N 5J3','Barrie',21.2400,1.4500,0.0000,3010442,'2025-04-28 20:43:02'),(114,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','L4N 5J3','Barrie',40.1800,1.4500,0.0000,3010442,'2025-04-28 20:43:02'),(115,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.8500,1.4500,0.0000,3010443,'2025-05-06 16:53:15'),(116,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.6300,1.4500,0.0000,3010443,'2025-05-06 16:53:15'),(117,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.7000,1.4500,0.0000,3010443,'2025-05-06 16:53:16'),(118,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',26.5600,1.4500,0.0000,3010443,'2025-05-06 16:53:16'),(119,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M6S 5A2','Toronto',12.6600,1.4500,0.0000,3010443,'2025-05-06 16:55:08'),(120,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M6S 5A2','Toronto',12.4400,1.4500,0.0000,3010443,'2025-05-06 16:55:08'),(121,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M6S 5A2','Toronto',17.7700,1.4500,0.0000,3010443,'2025-05-06 16:55:08'),(122,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M6S 5A2','Toronto',32.6300,1.4500,0.0000,3010443,'2025-05-06 16:55:08'),(123,'PUROLATOR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M6S 5A2','Toronto',12.6600,1.4500,0.0000,3010443,'2025-05-06 16:55:52'),(124,'PUROLATOR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M6S 5A2','Toronto',12.4400,1.4500,0.0000,3010443,'2025-05-06 16:55:52'),(125,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M6S 5A2','Toronto',17.7700,1.4500,0.0000,3010443,'2025-05-06 16:55:53'),(126,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M6S 5A2','Toronto',32.6300,1.4500,0.0000,3010443,'2025-05-06 16:55:53'),(127,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.7000,1.4500,0.0000,3010444,'2025-07-07 20:44:42'),(128,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',26.5600,1.4500,0.0000,3010444,'2025-07-07 20:44:42'),(129,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',11.7000,1.4500,0.0000,3010444,'2025-07-07 20:44:43'),(130,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',26.5600,1.4500,0.0000,3010444,'2025-07-07 20:44:43'),(131,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','K2B 8L2','Ottawa',21.9200,1.4500,0.0000,3010444,'2025-07-07 20:49:49'),(132,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','K2B 8L2','Ottawa',42.0600,1.4500,0.0000,3010444,'2025-07-07 20:49:49'),(133,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','K2B 8L2','Ottawa',21.9200,1.4500,0.0000,3010444,'2025-07-07 20:49:50'),(134,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','K2B 8L2','Ottawa',42.0600,1.4500,0.0000,3010444,'2025-07-07 20:49:50'),(135,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','K2B 8L2','TEST ONLY',21.9200,1.4500,0.0000,3010444,'2025-07-07 20:50:41'),(136,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','K2B 8L2','TEST ONLY',42.0600,1.4500,0.0000,3010444,'2025-07-07 20:50:41'),(137,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','K2B 8L2','TEST ONLY',21.9200,1.4500,0.0000,3010444,'2025-07-07 20:50:42'),(138,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','K2B 8L2','TEST ONLY',42.0600,1.4500,0.0000,3010444,'2025-07-07 20:50:42'),(139,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',6.0000,2,'ON','K2B 8L2','TEST ONLY',22.7200,1.4500,0.0000,3010444,'2025-07-08 17:41:46'),(140,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',6.0000,2,'ON','K2B 8L2','TEST ONLY',50.0800,1.4500,0.0000,3010444,'2025-07-08 17:41:46'),(141,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',6.0000,2,'ON','K2B 8L2','TEST ONLY',22.7200,1.4500,0.0000,3010444,'2025-07-08 17:41:47'),(142,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',6.0000,2,'ON','K2B 8L2','TEST ONLY',50.0800,1.4500,0.0000,3010444,'2025-07-08 17:41:47'),(143,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',11.9900,1.4500,0.0000,3010445,'2025-07-28 16:11:30'),(144,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',28.5000,1.4500,0.0000,3010445,'2025-07-28 16:11:30'),(145,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',11.9900,1.4500,0.0000,3010445,'2025-07-28 16:11:31'),(146,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','L4B 4W5','Richmond Hill',28.5000,1.4500,0.0000,3010445,'2025-07-28 16:11:31'),(147,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','M2J 4Y8','Toronto',12.2800,1.4500,0.0000,3010446,'2025-10-22 19:40:32'),(148,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','M2J 4Y8','Toronto',29.7400,1.4500,0.0000,3010446,'2025-10-22 19:40:32'),(149,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','M2J 4Y8','Toronto',12.2800,1.4500,0.0000,3010446,'2025-10-22 19:40:33'),(150,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','M2J 4Y8','Toronto',29.7400,1.4500,0.0000,3010446,'2025-10-22 19:40:33'),(151,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','K4M 1J4','Manotick',22.9800,1.4500,0.0000,3010446,'2025-10-22 19:42:23'),(152,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','K4M 1J4','Manotick',46.7000,1.4500,0.0000,3010446,'2025-10-22 19:42:23'),(153,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','K4M 1J4','Manotick',22.9800,1.4500,0.0000,3010446,'2025-10-22 19:42:23'),(154,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','K4M 1J4','Manotick',46.7000,1.4500,0.0000,3010446,'2025-10-22 19:42:24'),(155,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','K4M 1J4','Manotick',22.9800,1.4500,0.0000,3010446,'2025-10-22 19:44:39'),(156,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','K4M 1J4','Manotick',46.7000,1.4500,0.0000,3010446,'2025-10-22 19:44:39'),(157,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','K4M 1J4','Manotick',22.9800,1.4500,0.0000,3010446,'2025-10-22 19:44:39'),(158,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',5.0000,1,'ON','K4M 1J4','Manotick',46.7000,1.4500,0.0000,3010446,'2025-10-22 19:44:40'),(159,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',12.4400,1.4500,0.0000,3010447,'2025-11-17 15:18:21'),(160,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',28.7700,1.4500,0.0000,3010447,'2025-11-17 15:18:21'),(161,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',12.4400,1.4500,0.0000,3010447,'2025-11-17 15:18:22'),(162,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',28.7700,1.4500,0.0000,3010447,'2025-11-17 15:18:22'),(163,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',12.4400,1.4500,0.0000,3010447,'2025-11-17 15:18:33'),(164,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',28.7700,1.4500,0.0000,3010447,'2025-11-17 15:18:33'),(165,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',12.4400,1.4500,0.0000,3010447,'2025-11-17 15:18:33'),(166,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'ON','M2J 4Y8','Toronto',28.7700,1.4500,0.0000,3010447,'2025-11-17 15:18:34'),(167,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'MB','R2M 2V8','Winnipeg',32.0400,1.4500,0.0000,3010447,'2025-11-17 15:19:47'),(168,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'MB','R2M 2V8','Winnipeg',119.1000,1.4500,0.0000,3010447,'2025-11-17 15:19:47'),(169,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'MB','R2M 2V8','Winnipeg',32.0400,1.4500,0.0000,3010447,'2025-11-17 15:19:47'),(170,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'MB','R2M 2V8','Winnipeg',119.1000,1.4500,0.0000,3010447,'2025-11-17 15:19:48'),(171,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'MB','R2M 2V8','Winnipeg',32.0400,1.4500,0.0000,3010447,'2025-11-17 15:21:05'),(172,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'MB','R2M 2V8','Winnipeg',119.1000,1.4500,0.0000,3010447,'2025-11-17 15:21:06'),(173,'CANPAR','Ground','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'MB','R2M 2V8','Winnipeg',32.0400,1.4500,0.0000,3010447,'2025-11-17 15:21:06'),(174,'CANPAR','Express','Creative Path','1455','16th Avenue','Richmond Hill','ON','CA','L4B4W5',3.0000,1,'MB','R2M 2V8','Winnipeg',119.1000,1.4500,0.0000,3010447,'2025-11-17 15:21:06');

--
-- Table structure for table `shipmentDetail`
--

CREATE TABLE `shipmentDetail` (
  `SHIPID` int NOT NULL,
  `SHIPLINE` int NOT NULL AUTO_INCREMENT,
  `ORDERID` int NOT NULL,
  `ORDERLINE` int NOT NULL,
  `SHIPQTY` int NOT NULL,
  PRIMARY KEY (`SHIPLINE`)
) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `shipmentDetail`
--

INSERT INTO `shipmentDetail` VALUES (1,1,3010393,1704,500),(2,2,3010392,1702,2000),(2,3,3010392,1703,2000),(3,4,3010395,1706,500),(3,5,3010395,1707,500),(3,6,3010395,1708,500),(3,7,3010395,1709,500),(4,8,3010396,1710,500),(5,9,3010397,1711,500),(5,10,3010397,1712,500),(6,11,3010400,1715,500),(6,12,3010400,1716,500),(6,13,3010400,1717,500),(7,14,3010398,1713,500),(8,15,3010399,1714,500),(9,16,3010401,1718,500),(9,17,3010401,1719,500),(10,18,3010402,1720,500),(11,19,3010403,1721,1000),(12,20,3010404,1722,500),(13,21,3010405,1723,500),(14,22,3010406,1725,500),(15,23,3010407,1726,500),(15,24,3010407,1727,500),(16,25,3010409,1729,500),(16,26,3010409,1730,500),(17,27,3010410,1731,250),(18,28,3010411,1732,500),(19,29,3010419,1742,250),(20,30,3010422,1747,250),(20,31,3010422,1748,250),(20,32,3010422,1749,250),(21,33,3010416,1738,250),(21,34,3010416,1739,250),(22,35,3010424,1751,500),(23,36,3010426,1753,1000),(24,37,3010425,1752,250),(25,38,3010423,1750,250),(26,39,3010427,1754,250),(27,40,3010430,1757,250),(28,41,3010434,1761,250),(29,42,3010435,1762,500),(29,43,3010435,1763,500),(29,44,3010435,1764,500),(29,45,3010435,1765,500),(30,46,3010433,1760,250),(31,47,3010439,1769,250),(32,48,3010440,1770,250),(33,49,3010441,1771,250),(34,50,3010442,1772,250),(35,51,3010443,1773,250),(36,52,3010446,1779,500),(37,53,3010447,1780,250);

--
-- Table structure for table `shipmentHeader`
--

CREATE TABLE `shipmentHeader` (
  `SHIPID` int NOT NULL AUTO_INCREMENT,
  `ORDERID` int NOT NULL,
  `TRACKNUM` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `SHIPDATE` datetime NOT NULL,
  `SHIPMETHOD` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `SHIPAMOUNT` decimal(16,2) NOT NULL,
  `SHIPWEIGHT` decimal(16,4) NOT NULL,
  `SHIPPIECES` int NOT NULL,
  `SHIPINSTRUCTIONS` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL,
  PRIMARY KEY (`SHIPID`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `shipmentHeader`
--

INSERT INTO `shipmentHeader` VALUES (1,3010393,'1ZRX74092045689681','2019-10-15 13:51:10','Ground',0.00,0.0000,1,''),(2,3010392,'1ZRX74092045965739','2019-10-15 20:49:05','Ground',0.00,0.0000,5,''),(3,3010395,'1ZRX74092043232211','2019-12-10 21:43:51','Ground',0.00,0.0000,1,''),(4,3010396,'1ZRX74092044959006','2019-12-10 21:44:01','Ground',0.00,0.0000,1,''),(5,3010397,'1ZRX74092044069192','2019-12-10 21:44:20','Ground',0.00,0.0000,1,''),(6,3010400,'1ZRX74092044009265','2020-02-04 17:23:32','Courier',0.00,0.0000,1,''),(7,3010398,'1','2020-02-04 17:24:29','Ground',0.00,0.0000,0,''),(8,3010399,'1','2020-02-04 17:24:36','Ground',0.00,0.0000,0,''),(9,3010401,'1ZRX74092045578872','2020-03-16 20:34:46','Ground',0.00,0.0000,1,''),(10,3010402,'1Z RX7409 20 4550 3880','2020-03-18 13:21:45','Ground',0.00,2.0000,1,''),(11,3010403,'1Z RX7409 20 4394 0296','2020-03-18 13:52:14','Ground',0.00,12.0000,2,''),(12,3010404,'1Z88V14V0498443325','2021-06-10 11:28:07','Express',0.00,0.0000,1,''),(13,3010405,'1Z88V14V0498853301','2021-08-25 09:34:32','Express',0.00,0.0000,1,''),(14,3010406,'1Z88V 14V 04 9612 485','2022-03-15 12:30:16','Express',0.00,0.0000,1,''),(15,3010407,'Talyer - 1Z88V 14V 04 9867 6968; Tammy - 1Z88V 14V 04 9676 9577','2022-03-17 10:13:19','Express',0.00,0.0000,2,''),(16,3010409,'D57600225 000 003 495 9001/D57600225 000 003 496 0001','2022-10-19 12:16:24','Ground',0.00,0.0000,2,'shipped to other address'),(17,3010410,'D57600225 000 003 598 2001','2023-03-24 13:29:04','Canpar Ground',0.00,0.0000,1,''),(18,3010411,'D57600225 000 003 668 1001, 2001','2023-05-12 15:44:43','Canpar Ground',0.00,0.0000,2,'total 2 boxes'),(19,3010419,'TEST Tracking 12345676543','2025-01-30 21:11:33','Canpar Ground',0.00,0.0000,1,''),(20,3010422,'Test Tracking#12345678','2025-01-31 15:52:24','Purolator Express',0.00,0.0000,1,''),(21,3010416,'D57600225 000 004 222 7001','2025-02-05 20:18:52','Canpar Ground',0.00,0.0000,1,'Shipped to: 208-1379 COSTIGAN RD, Milton, On, L9T 2K6'),(22,3010424,'D57600225 000 004 224 3001','2025-02-07 18:25:54','Canpar Ground',0.00,0.0000,1,''),(23,3010426,'D57600225 000 004 224 4001','2025-02-07 18:29:25','Canpar Ground',0.00,0.0000,1,''),(24,3010425,'D57600225 000 004 224 5001','2025-02-07 18:31:59','Canpar Ground',0.00,0.0000,1,''),(25,3010423,'D57600225 000 004 224 6001','2025-02-07 18:34:31','Canpar Ground',0.00,0.0000,1,''),(26,3010427,'D57600225 000 004 224 7001','2025-02-07 18:36:54','Canpar Ground',0.00,0.0000,1,''),(27,3010430,'D57600225 000 004 227 7001','2025-02-12 19:02:01','Canpar Ground',0.00,0.0000,1,''),(28,3010434,'609062381569','2025-03-03 19:07:58','Purolator Ground',0.00,0.0000,1,''),(29,3010435,'609062381700','2025-03-05 16:26:06','Purolator Ground',0.00,0.0000,1,''),(30,3010433,'609062384639','2025-03-14 18:56:25','Purolator Express',0.00,0.0000,1,''),(31,3010439,'609062391592','2025-04-30 19:03:56','Purolator Ground',0.00,0.0000,1,''),(32,3010440,'609062391584','2025-04-30 19:04:37','Purolator Express',0.00,0.0000,1,''),(33,3010441,'609062391576','2025-04-30 19:05:02','Purolator Express',0.00,0.0000,1,''),(34,3010442,'609062391618','2025-05-02 18:16:11','Purolator Express',0.00,0.0000,1,''),(35,3010443,'609062392137','2025-05-12 18:47:22','Purolator Express',0.00,0.0000,1,''),(36,3010446,'L57600225 000 000 012 2001','2025-10-29 17:02:54','Canpar Express',0.00,0.0000,1,''),(37,3010447,'610508923105','2025-11-20 20:28:33','Purolator Ground',0.00,0.0000,1,'');

--
-- Table structure for table `shippingGroup`
--

CREATE TABLE `shippingGroup` (
  `SGRPNAME` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `SGRPPIECES` int NOT NULL,
  `SGRPBOXTYPE` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `SGRPWEIGHTPIECE` decimal(19,4) NOT NULL,
  PRIMARY KEY (`SGRPNAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `shippingGroup`
--


--
-- Table structure for table `shippingGroupItems`
--

CREATE TABLE `shippingGroupItems` (
  `SGRPNAME` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `ITEMID` int NOT NULL,
  PRIMARY KEY (`ITEMID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `shippingGroupItems`
--


--
-- Table structure for table `subcategories`
--

CREATE TABLE `subcategories` (
  `SUBCATID` int NOT NULL AUTO_INCREMENT,
  `CATID` int NOT NULL,
  `NAME` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `DESCRIPTION` varchar(200) COLLATE utf8mb3_unicode_ci NOT NULL,
  `PARENTSUBCATID` int NOT NULL DEFAULT '-1',
  `ICONURL` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT '',
  `USERLEVEL` int NOT NULL DEFAULT '0',
  PRIMARY KEY (`SUBCATID`)
) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `subcategories`
--

INSERT INTO `subcategories` VALUES (22,11,'Business Card','Business Card',-1,'icon_businesscard.png',0),(39,24,'Cards','Cards',-1,'icon_corp_market.png',0),(54,26,'Letterhead','Letterhead',-1,'icon_corp_market.png',0),(64,26,'Envelopes','Envelopes',-1,'icon_corp_market.png',0),(70,26,'Mailing Label','Mailing Label',-1,'icon_corp_market.png',0);

--
-- Table structure for table `taxes`
--

CREATE TABLE `taxes` (
  `TAXCODE` varchar(6) COLLATE utf8mb3_unicode_ci NOT NULL,
  `TAXGROUPNAME` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `TAXNAME1` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `TAXNAME2` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `TAXNAME3` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `TAXNAME4` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `TAXNAME5` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
  `TAXRATE1` decimal(19,5) NOT NULL DEFAULT '0.00000',
  `TAXRATE2` decimal(19,5) NOT NULL DEFAULT '0.00000',
  `TAXRATE3` decimal(19,5) NOT NULL DEFAULT '0.00000',
  `TAXRATE4` decimal(19,5) NOT NULL DEFAULT '0.00000',
  `TAXRATE5` decimal(19,5) NOT NULL DEFAULT '0.00000',
  PRIMARY KEY (`TAXCODE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `taxes`
--

INSERT INTO `taxes` VALUES ('AB','AB','GST','','','','',0.05000,0.00000,0.00000,0.00000,0.00000),('BC','BC','GST','PST','','','',0.05000,0.07000,0.00000,0.00000,0.00000),('MB','MB','GST','PST','','','',0.05000,0.07000,0.00000,0.00000,0.00000),('NB','NB','HST','','','','',0.15000,0.00000,0.00000,0.00000,0.00000),('NL','NL','HST','','','','',0.15000,0.00000,0.00000,0.00000,0.00000),('NS','NS','HST','','','','',0.14000,0.00000,0.00000,0.00000,0.00000),('NT','NT','GST','','','','',0.05000,0.00000,0.00000,0.00000,0.00000),('NU','NU','GST','','','','',0.05000,0.00000,0.00000,0.00000,0.00000),('ON','ON','HST','','','','',0.13000,0.00000,0.00000,0.00000,0.00000),('PE','PE','HST','','','','',0.15000,0.00000,0.00000,0.00000,0.00000),('QC','QC','GST','QST','','','',0.05000,0.09975,0.00000,0.00000,0.00000),('SK','SK','GST','PST','','','',0.05000,0.06000,0.00000,0.00000,0.00000),('YT','YT','GST','','','','',0.05000,0.00000,0.00000,0.00000,0.00000);

--
-- Table structure for table `ticketAttachment`
--

CREATE TABLE `ticketAttachment` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `TICKETID` int DEFAULT NULL,
  `MESSAGEID` int DEFAULT NULL,
  `STOREFILENAME` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  `ORIGFILENAME` varchar(200) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `ticketAttachment`
--


--
-- Table structure for table `ticketDetail`
--

CREATE TABLE `ticketDetail` (
  `MESSAGEID` int NOT NULL AUTO_INCREMENT,
  `TICKETID` int NOT NULL,
  `DATEENTERED` datetime NOT NULL,
  `ENTEREDBY` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `CLIENTMESSAGE` int NOT NULL,
  `MESSAGE` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL,
  PRIMARY KEY (`MESSAGEID`,`TICKETID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `ticketDetail`
--

INSERT INTO `ticketDetail` VALUES (1,1,'2024-10-17 16:09:02','Peggy',1,'TEST');

--
-- Table structure for table `ticketHeader`
--

CREATE TABLE `ticketHeader` (
  `ID` int NOT NULL AUTO_INCREMENT,
  `ENTEREDBY` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `DATEENTERED` datetime NOT NULL,
  `STATUS` int NOT NULL,
  `TITLE` varchar(1000) COLLATE utf8mb3_unicode_ci NOT NULL,
  `DATECLOSED` datetime DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `ticketHeader`
--

INSERT INTO `ticketHeader` VALUES (1,'Peggy','2024-10-17 16:09:02',0,'TEST','2024-10-17 16:09:31');

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

CREATE TABLE `user` (
  `USERNAME` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `BRANCH` varchar(20) COLLATE utf8mb3_unicode_ci NOT NULL,
  `PASSWORD` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `PLAINPASSWORD` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
  `FIRSTNAME` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `LASTNAME` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `EMAIL` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
  `LANGUAGE` varchar(2) COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT 'EN',
  `USERLEVEL` int NOT NULL DEFAULT '0',
  `CREATEDDATE` datetime DEFAULT NULL,
  `MODIFIEDDATE` datetime DEFAULT NULL,
  `STATUS` int NOT NULL,
  `COMMENTS` varchar(1000) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`USERNAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

--
-- Dumping data for table `user`
--

INSERT INTO `user` VALUES ('Ashley','900','*09F1E20E1ACCBB65F79A281B0E5132475A196D43','BT1Dac','Ashley','Cavanagh','acavanagh@breakthroughT1D.ca','EN',30,'2025-01-30 19:45:30','2025-01-31 16:21:31',1,''),('demojdrf','CPDI','*C142FB215B6E05B7C134B1A653AD4B455157FD79','demo','demo','demo','patrick@creativepath.com','EN',1,NULL,'2025-01-30 21:35:54',1,''),('Eric','CPDI','*C5EC559C0EA7C49430B0006B94ACD3B9DD1D4F9D','E6359S','Eric','Sinn','erics@creativepath.com','EN',81,'2020-01-09 16:01:14','2021-04-15 13:50:24',1,''),('Jaden','900','*6FB85D7CAB88A39D5B5FE3C86AA53EFA3E268ACD','BT1Djw','Jaden','Winfree','jwinfree@breakthroughT1D.ca ','EN',30,'2024-10-29 14:57:43','2025-01-31 15:27:31',1,''),('jen','CPDI','*1B971235F80D472237329258498BAF8F1D43BE0D','Hl5982','Jen','Lor','jennifer@cpfulfillment.com','EN',81,'2022-04-22 12:43:31','2025-01-30 21:36:00',1,''),('Joseph','900','*DE7AB8AAC77E910114BF1BEBDED1A7AD42FC2C06','BT1Djk','Joseph','Knowles','jknowles@breakthroughT1D.ca','EN',30,'2024-10-29 14:58:13','2025-01-31 16:21:39',1,''),('Karen','900','*23D2420BFF6F455B793CF5581BE253417AFCC1C3','BT1Dkc','Karen','Caniago','kcaniago@breakthroughT1D.ca','EN',30,'2025-01-30 19:11:30','2025-01-31 16:21:45',1,''),('Michelle','900','*53758D7F72D4C2A60DD426CFBD289FEA68D3E302','BT1Dmv','Michelle van','Vliet','mvanvliet@breakthroughT1D.ca','EN',30,'2024-10-29 14:58:48','2025-01-31 16:21:52',1,''),('patrick','CPDI','*04AE7ABE88B8C7F153AD654C1410AFFC6072339B','cpdi905711','Patrick','Sinn','patrick@creativepath.com','EN',99,'2008-10-16 00:00:00','2021-04-15 14:01:12',1,''),('Peggy','CPDI','*A45967DAC55BE870539FA0BA1B8AF799AD65EBB8','momo73449','Peggy','Cheng','peggy@creativepath.com','EN',99,NULL,'2024-05-27 13:46:51',1,''),('Sam','CPDI','*48910925EF9C280FA11348D3968E9F9B2E98E539','sam8500','Sam','Stratigeas','sam@samstratigeas.ca','EN',99,'2022-04-18 14:37:05','2022-04-18 14:37:20',1,''),('winnie','CPDI','*C73E4236C7E560BC595364AE42A790AC5A9166A9','cpdi236','Winnie','Wu','winnie@creativepath.com','EN',81,NULL,NULL,1,''),('zoeyc','CPDI','*C7C2E49F12068D26F3FB0709B11EBB4516B3BE98','zc5689','Zoey','Cui','zoeyc@cpfulfillment.com','EN',99,'2023-06-26 13:26:36','2023-06-26 13:26:54',1,'');

--
-- Dumping routines for database 'cpfulfillment_PrintOS_Breakthrought1d'
--
/*!50003 DROP PROCEDURE IF EXISTS `AddDownloadLogEntry` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `AddDownloadLogEntry`(__USERNAME VARCHAR(50), __ITEMID INT)
BEGIN
	INSERT INTO 
		downloadLog
        (USERNAME,BRANCHCODE,ITEMID,LOGTIME)
	SELECT
		USERNAME,
        BRANCH,
        __ITEMID,
        CURRENT_TIMESTAMP
	FROM
		user
	WHERE
		USERNAME = __USERNAME;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `AddItemToCart` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `AddItemToCart`(__USERNAME VARCHAR(50), __ITEMID INT, __PROOF VARCHAR(200), __QTY INT, __ITEMOPTION VARCHAR(30), __ADDCOST DECIMAL)
BEGIN



SELECT @ORDERNUM := COUNT(*) FROM orderHeader WHERE USERNAME = __USERNAME AND ORDERSTATUS = 'CART';


SELECT @LOTPRICE := COUNT(*) FROM itemPricing WHERE ITEMID = __ITEMID AND QTY = __QTY AND ITEMOPTION = __ITEMOPTION;
SELECT @VARPRICE := COUNT(*) FROM itemPricing WHERE ITEMID = __ITEMID AND QTY = -1 AND ITEMOPTION = __ITEMOPTION;


IF @ORDERNUM = 0 THEN
 INSERT INTO
 orderHeader
 (USERNAME,ORDERDATE,ORDERMODIFIED,PONUMBER,SHIPCONTACTFIRSTNAME,SHIPCONTACTLASTNAME,SHIPCONTACTPHONE,SHIPCONTACTFAX,SHIPCONTACTEMAIL,
 SHIPNAME,SHIPADDRESS,SHIPADDRESS2,SHIPCITY,SHIPPROVINCE,SHIPCOUNTRY,SHIPPOSTAL,SHIPTAXGROUP,ORDERSTATUS,SHIPSTOREID,
 REQCONTACTFIRSTNAME,REQCONTACTLASTNAME,REQCONTACTPHONE,REQCONTACTFAX,
 REQNAME,REQADDRESS,REQADDRESS2,REQCITY,REQPROVINCE,REQCOUNTRY,REQPOSTAL)
 SELECT
 __USERNAME AS USERNAME ,
 CURRENT_TIMESTAMP AS ORDERDATE,
 CURRENT_TIMESTAMP AS ORDERMODIFIED,
 '' AS PONUMBER,
 USER.FIRSTNAME AS SHIPCONTACTFIRSTNAME,
 USER.LASTNAME AS SHIPCONTACTLASTNAME,
 BADDR.PHONE AS SHIPCONTACTPHONE,
 BADDR.FAX AS SHIPCONTACTFAX,
 USER.EMAIL AS SHIPCONTACTEMAIL,
 BINFO.NAME AS SHIPNAME,
 BADDR.ADDRESS AS SHIPADDRESS,
 BADDR.ADDRESS2 AS SHIPADDRESS2,
 BADDR.CITY AS SHIPCITY,
 BADDR.PROVINCE AS SHIPPROVINCE,
 BADDR.COUNTRY AS SHIPCOUNTRY,
 BADDR.POSTALCODE AS SHIPPOSTAL,
 BINFO.TAXGROUP AS SHIPTAXGROUP,
        'CART' AS ORDERSTATUS,
        BINFO.CODE AS SHIPSTOREID,
		USER.FIRSTNAME AS REQCONTACTFIRSTNAME,
        USER.LASTNAME AS REQCONTACTLASTNAME,
        BADDR.PHONE AS REQCONTACTPHONE,
        BADDR.FAX AS REQCONTACTFAX,
		BINFO.NAME AS REQNAME,
        BADDR.ADDRESS AS REQADDRESS,
        BADDR.ADDRESS2 AS REQADDRESS2,
        BADDR.CITY AS REQCITY,
        BADDR.PROVINCE AS REQPROVINCE,
        BADDR.COUNTRY AS REQCOUNTRY,
        BADDR.POSTALCODE AS REQPOSTAL        
	FROM
		user USER
	INNER JOIN
		branches BINFO ON 
			USER.BRANCH = BINFO.CODE
	INNER JOIN
		branchesAddresses BADDR ON 
			USER.BRANCH = BADDR.CODE 
	WHERE
		USER.USERNAME  = __USERNAME AND
        BADDR.ISMAIN = 1
    ;
END IF;


SELECT @ORDERID := ORDERID FROM orderHeader WHERE USERNAME = __USERNAME AND ORDERSTATUS = 'CART';


IF @LOTPRICE > 0 THEN

	INSERT INTO
		orderDetail
			(ORDERID,ITEMID,ITEMCODE,ITEMDESC,ORDERQTY,SHIPTODATEQTY,UNITPRICE,EXTPRICE,
             TAXAMT1,TAXAMT2,TAXAMT3,TAXAMT4,TAXAMT5,ITEMLENGTH,ITEMWIDTH,ITEMHEIGHT,ITEMWEIGHT,ITEMPIECES,PROOFCONFIRMATION,ITEMOPTION)
	SELECT
		@ORDERID AS ORDERID,
        ITEM.ID AS ITEMID,
        ITEM.CODE AS ITEMCODE,
        ITEM.DESCRIPTION AS ITEMDESC,
        ITEMPRICE.QTY AS ORDERQTY,
        0 AS SHIPTODATEQTY,
        (ITEMPRICE.PRICE / ITEMPRICE.QTY) + (__ADDCOST / ITEMPRICE.QTY) AS UNITPRICE,
        ITEMPRICE.PRICE + __ADDCOST AS EXTPRICE,
		0 AS TAXAMT1,
        0 AS TAXAMT2,
        0 AS TAXAMT3,
        0 AS TAXAMT4,
        0 AS TAXAMT5,
        ITEMPRICE.LENGTH AS ITEMLENGTH,
        ITEMPRICE.WIDTH AS ITEMWIDTH,
        ITEMPRICE.HEIGHT AS ITEMHEIGHT,
        ITEMPRICE.WEIGHT AS ITEMWEIGHT,
        ITEMPRICE.PIECES AS ITEMPIECES,
        __PROOF AS PROOFCONFIRMATION,
        ITEMPRICE.ITEMOPTION AS ITEMOPTION
	FROM
		items ITEM
	INNER JOIN
		itemPricing ITEMPRICE ON 
			ITEM.ID = ITEMPRICE.ITEMID
	WHERE
		ITEM.ID = __ITEMID AND
        ITEMPRICE.QTY = __QTY AND
        ITEMPRICE.ITEMOPTION = __ITEMOPTION;
        
ELSEIF @VARPRICE > 0 AND @LOTPRICE = 0 THEN

INSERT INTO
		orderDetail
			(ORDERID,ITEMID,ITEMCODE,ITEMDESC,ORDERQTY,SHIPTODATEQTY,UNITPRICE,EXTPRICE,
             TAXAMT1,TAXAMT2,TAXAMT3,TAXAMT4,TAXAMT5,ITEMLENGTH,ITEMWIDTH,ITEMHEIGHT,ITEMWEIGHT,ITEMPIECES,PROOFCONFIRMATION,ITEMOPTION)
	SELECT
		@ORDERID AS ORDERID,
        ITEM.ID AS ITEMID,
        ITEM.CODE AS ITEMCODE,
        ITEM.DESCRIPTION AS ITEMDESC,
        __QTY AS ORDERQTY,
        0 AS SHIPTODATEQTY,
        ITEMPRICE.PRICE + __ADDCOST AS UNITPRICE,
        (ITEMPRICE.PRICE + __ADDCOST) * __QTY AS EXTPRICE,
		0 AS TAXAMT1,
        0 AS TAXAMT2,
        0 AS TAXAMT3,
        0 AS TAXAMT4,
        0 AS TAXAMT5,
        ITEMPRICE.LENGTH AS ITEMLENGTH,
        ITEMPRICE.WIDTH AS ITEMWIDTH,
        ITEMPRICE.HEIGHT AS ITEMHEIGHT,
        ITEMPRICE.WEIGHT * __QTY AS ITEMWEIGHT,
        ITEMPRICE.PIECES AS ITEMPIECES,
        __PROOF AS PROOFCONFIRMATION,
        ITEMPRICE.ITEMOPTION AS ITEMOPTION
	FROM
		items ITEM
	INNER JOIN
		itemPricing ITEMPRICE ON 
			ITEM.ID = ITEMPRICE.ITEMID
	WHERE
		ITEM.ID = __ITEMID AND
        ITEMPRICE.QTY = -1 AND 
        ITEMPRICE.ITEMOPTION = __ITEMOPTION;

ELSE 
	SIGNAL SQLSTATE '45000'
		SET MESSAGE_TEXT = 'Invalid Pricing Found For Item';
END IF;  

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `AddReportingExtraData` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `AddReportingExtraData`(__USERNAME VARCHAR(20), __EXTRADATA VARCHAR(100))
BEGIN

SET SQL_SAFE_UPDATES = 0;

UPDATE
	orderHeader
SET
	EXTRADATA1 = __EXTRADATA
WHERE 
	USERNAME  = __USERNAME AND 
    ORDERSTATUS = 'CART';

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `AddShipmentCostEntry` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `AddShipmentCostEntry`(__CARRIER VARCHAR(100), __METHOD VARCHAR(100),
__SHIPFROM_NAME VARCHAR(100), __SHIPFROM_STREETNUM VARCHAR(100), __SHIPFROM_STREET VARCHAR(100),
__SHIPFROM_CITY VARCHAR(100), __SHIPFROM_PROVINCE VARCHAR(100), __SHIPFROM_COUNTRY VARCHAR(100),
__SHIPFROM_POSTAL VARCHAR(100), __TOTALWEIGHT DECIMAL(19,4), __TOTALBOXES DECIMAL(19,4),
__SHIPTO_PROVINCE VARCHAR(100), __SHIPTO_POSTAL VARCHAR(100), __SHIPTO_CITY VARCHAR(100),
__TOTALPRICE DECIMAL(19,4), __OURMARUP DECIMAL(19,4), __OURSLEEVECHARGE DECIMAL(19,4),
__ORDERID INT)
BEGIN
INSERT INTO `shipmentCostLog`
(
`CARRIER`,
`METHOD`,
`SHIPFROM_NAME`,
`SHIPFROM_STREETNUM`,
`SHIPFROM_STREET`,
`SHIPFROM_CITY`,
`SHIPFROM_PROVINCE`,
`SHIPFROM_COUNTRY`,
`SHIPFROM_POSTAL`,
`TOTALWEIGHT`,
`TOTALBOXES`,
`SHIPTO_PROVINCE`,
`SHIPTO_POSTAL`,
`SHIPTO_CITY`,
`TOTALPRICE`,
`OURMARKUP`,
`OURSLEEVECHARGE`,
`ORDERID`,
`CREATEDATETIME`)
VALUES
(
__CARRIER,
__METHOD,
__SHIPFROM_NAME,
__SHIPFROM_STREETNUM,
__SHIPFROM_STREET,
__SHIPFROM_CITY,
__SHIPFROM_PROVINCE,
__SHIPFROM_COUNTRY,
__SHIPFROM_POSTAL,
__TOTALWEIGHT,
__TOTALBOXES,
__SHIPTO_PROVINCE,
__SHIPTO_POSTAL,
__SHIPTO_CITY,
__TOTALPRICE,
__OURMARUP,
__OURSLEEVECHARGE,
__ORDERID,
CURRENT_TIMESTAMP);
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `AdjustItemQty` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `AdjustItemQty`(__ITEMID INT, __QTY INT, __REASON VARCHAR(200))
BEGIN
	UPDATE 
		itemsInventory
	SET
		QTYONHAND = QTYONHAND + __QTY
	WHERE
		ITEMID = __ITEMID;
            
	INSERT INTO 
		itemsAdjustmentLog
       (ITEMID,QTY,ADJDATE,REASON)
	VALUES 
		(__ITEMID,__QTY,CURRENT_TIMESTAMP,__REASON);
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `ApplyPromoCode` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `ApplyPromoCode`(__USERNAME VARCHAR(50), __PROMO VARCHAR(50))
BEGIN
 SET @RESULT = '';
 
 SET @ORDERID = (SELECT ORDERID FROM orderHeader WHERE ORDERSTATUS = 'CART' AND USERNAME = __USERNAME);
 SET @PROMOTYPE= (SELECT CODETYPE FROM promos WHERE CODE = __PROMO);
 SET @CHKCOUNT= (SELECT COUNT(*) FROM promos WHERE CODE = __PROMO);
 SET @CHKREDEEMED= (SELECT COUNT(*) FROM promos WHERE CODE = __PROMO AND REDEEMED = 0);
 SET @CHKDATES= (SELECT COUNT(*) FROM promos WHERE CODE = __PROMO AND STARTDATE <= CURRENT_TIMESTAMP AND ENDDATE >= CURRENT_TIMESTAMP);
 SET @CHKPROMOCOUNT= (SELECT COUNT(*) FROM orderPromos WHERE ORDERID = @ORDERID);
 SET @CHKITEMCOUNT= (SELECT COUNT(*) 
 FROM orderDetail D 
 INNER JOIN items I ON D.ITEMID = I.ID 
 INNER JOIN promosItems PI ON (PI.ITEMID = I.ID OR PI.ITEMID = I.PARENTITEM) 
 INNER JOIN promos PIHDR ON PI.CODE = PIHDR.CODE
 WHERE 
 ORDERID = @ORDERID AND 
 PI.CODE = __PROMO AND
 ((PIHDR.QTYTYPE = '' AND (PIHDR.MAXQTY = 0 OR ORDERQTY <= PIHDR.MAXQTY)) OR PIHDR.QTYTYPE = 'NOLIMIT' OR (PIHDR.QTYTYPE = 'EXACT' AND ORDERQTY = PIHDR.EXACTQTY) OR (PIHDR.QTYTYPE = 'RANGE' AND PIHDR.MINQTY <= ORDERQTY AND ORDERQTY <= PIHDR.MAXQTY))
 ); 
SET @CHKALLCATCOUNT= (SELECT
COUNT(*)
FROM orderDetail D 
INNER JOIN items I ON D.ITEMID = I.ID 
INNER JOIN itemsSubcategoryLink ISL ON I.ID = ISL.ITEMID
INNER JOIN subcategories SUBCATS ON ISL.SUBCATID = SUBCATS.SUBCATID
CROSS JOIN (SELECT * FROM promos WHERE CODE = __PROMO) PROMO 
WHERE
D.ORDERID = @ORDERID AND 
SUBCATS.CATID NOT IN (SELECT CATID FROM promos PIHDR INNER JOIN promosCategories PC ON PC.CODE = PIHDR.CODE WHERE PC.CODE = __PROMO) AND
((PROMO.QTYTYPE = '' AND (PROMO.MAXQTY = 0 OR ORDERQTY <= PROMO.MAXQTY)) OR PROMO.QTYTYPE = 'NOLIMIT' OR (PROMO.QTYTYPE = 'EXACT' AND ORDERQTY = PROMO.EXACTQTY) OR (PROMO.QTYTYPE = 'RANGE' AND PROMO.MINQTY <= ORDERQTY AND ORDERQTY <= PROMO.MAXQTY))
);
SET @CHKNOTITEMCOUNT= (SELECT COUNT(*)
 FROM orderDetail D 
 INNER JOIN items I ON D.ITEMID = I.ID 
 INNER JOIN promos PIHDR ON PIHDR.CODE = __PROMO
 LEFT OUTER JOIN promosItems PI ON (PI.ITEMID = I.ID OR PI.ITEMID = I.PARENTITEM) 
 WHERE 
 ORDERID = @ORDERID AND 
 PI.ITEMID IS NULL AND 
 ((PIHDR.QTYTYPE = '' AND (PIHDR.MAXQTY = 0 OR ORDERQTY <= PIHDR.MAXQTY)) OR PIHDR.QTYTYPE = 'NOLIMIT' OR (PIHDR.QTYTYPE = 'EXACT' AND ORDERQTY = PIHDR.EXACTQTY) OR (PIHDR.QTYTYPE = 'RANGE' AND PIHDR.MINQTY <= ORDERQTY AND ORDERQTY <= PIHDR.MAXQTY))
 ); 

  IF @CHKCOUNT=0 THEN
    SET @RESULT = 'NOEXIST';
  ELSEIF @CHKDATES = 0 THEN 
    SET @RESULT = 'NOTACTIVEDATE';
  ELSEIF @CHKREDEEMED = 0 THEN 
    SET @RESULT = 'ALREADYREDEEMED';        
  ELSEIF @CHKPROMOCOUNT > 0 THEN 
    SET @RESULT = 'ALREADYPROMO';   
  ELSEIF @CHKITEMCOUNT = 0 AND (@PROMOTYPE = 'ITM$DISC' OR @PROMOTYPE = 'ITM%DISC') THEN
    SET @RESULT = 'NOVALIDITEMS';
  ELSEIF @CHKALLCATCOUNT = 0 AND (@PROMOTYPE = 'ALLCAT$DISC' OR @PROMOTYPE = 'ALLCAT%DISC') THEN
    SET @RESULT = 'NOVALIDITEMS'; 
  ELSEIF @CHKNOTITEMCOUNT = 0 AND (@PROMOTYPE = 'ALLITM$DISC' OR @PROMOTYPE = 'ALLITM%DISC') THEN
    SET @RESULT = 'NOVALIDITEMS';
  ELSE
    SET @RESULT = 'OK';
        INSERT INTO orderPromos
        (ORDERID,PROMOCODE,PROMONAME,SINGLEITEM,PROMOTYPE,PROMOVALUE,CALCDISCOUNT,
         TAXAMT1,TAXAMT2,TAXAMT3,TAXAMT4,TAXAMT5)
    SELECT
      @ORDERID,CODE,NAME,SINGLEITEM,CODETYPE,PROMOVALUE,0.00,0.00,0.00,0.00,0.00,0.00
    FROM
      promos
    WHERE 
      CODE = __PROMO;
        
        UPDATE promos SET REDEEMED = 1 WHERE CODE = __PROMO AND SINGLEUSE = 1;
        
  END IF;

  SELECT @RESULT AS RESULT;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `ApproveItem` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ApproveItem`(__CODE VARCHAR(200))
BEGIN

	SELECT
		ITEM.ID AS ITEMID,
        USERS.EMAIL AS USEREMAIL,
        ITEM.DISPLAYIMAGEPATH
	FROM
		items ITEM 
	INNER JOIN
		user USERS ON 
			USERS.USERNAME = ITEM.GENERATEDBY
	WHERE 
		APPROVALLINK = __CODE;

	UPDATE
		items
	SET
		ASSETAPPROVED = 1,
        APPROVALLINK = NULL
	WHERE
		APPROVALLINK = __CODE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `ApproveOrder` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `ApproveOrder`(__APPROVALLINK NVARCHAR(100))
BEGIN

SET @ORDERREF = IFNULL((SELECT MAX(ORDERREF)+1 FROM orderHeader),10000);
UPDATE orderDetail
    SET 
        SHIPTODATEQTY = ORDERQTY,
        DOWNLOADLINK = CONCAT(ORDERID,'-',ITEMLINE,'-',MD5(MD5(MD5(NOW())+ORDERID)+ITEMLINE))
  WHERE
    ORDERQTY = -2 AND
        ORDERID IN (SELECT ORDERID FROM orderHeader WHERE APPROVALLINK  COLLATE utf8_unicode_ci = __APPROVALLINK AND APPROVALLINK IS NOT NULL);    

UPDATE
  orderHeader
SET
  ORDERREF = @ORDERREF
WHERE
  APPROVALLINK  COLLATE utf8_unicode_ci = __APPROVALLINK AND
    APPROVALLINK IS NOT NULL;


SELECT
  HDR.*,
    DTL.*,
    ITEM.TYPE,
    USER.FIRSTNAME AS USER_FIRSTNAME,
    USER.LASTNAME AS USER_LASTNAME,
    USER.EMAIL AS USER_EMAIL,
    USER.LANGUAGE AS USER_LANGUAGE,
    BRANCH.NAME AS BRANCH_NAME,
    BRANCH.MANAGEMENTEMAIL AS BRANCH_MANAGEMENTEMAIL,
    COALESCE(BRANCHADDRESS.LANGUAGE,'EN') AS BRANCH_LANGUAGE,
    'ACTIVE' AS REALSTATUS,
    COALESCE(ITEM.DLSUGGESTIONS,'') AS DLSUGGESTIONS
FROM
  orderHeader HDR
INNER JOIN
  orderDetail DTL ON 
    HDR.ORDERID = DTL.ORDERID
INNER JOIN
  items ITEM ON 
    DTL.ITEMID = ITEM.ID        
INNER JOIN
  user USER ON 
    HDR.USERNAME = USER.USERNAME
INNER JOIN
  branches BRANCH ON 
    USER.BRANCH = BRANCH.CODE
LEFT OUTER JOIN
  (SELECT * FROM branchesAddresses WHERE ISMAIN = 1) BRANCHADDRESS ON 
    BRANCH.CODE = BRANCHADDRESS.CODE
WHERE
  HDR.APPROVALLINK  COLLATE utf8_unicode_ci = __APPROVALLINK AND
    HDR.APPROVALLINK IS NOT NULL;
      
SELECT @SHIPLINECOUNT := COUNT(*) FROM orderDetail 
    WHERE ORDERQTY <> -2 AND
        ORDERID IN (SELECT ORDERID FROM orderHeader WHERE APPROVALLINK  COLLATE utf8_unicode_ci = __APPROVALLINK AND APPROVALLINK IS NOT NULL);
      
      
UPDATE
  orderHeader
SET
  APPROVALLINK = NULL,
    ORDERSTATUS = CASE WHEN @SHIPLINECOUNT = 0 THEN 'SHIPPED' ELSE 'ACTIVE' END,
    ORDERMODIFIED = CURRENT_TIMESTAMP,
    APPROVALDATE = CURRENT_TIMESTAMP
WHERE
  APPROVALLINK  COLLATE utf8_unicode_ci = __APPROVALLINK AND
    APPROVALLINK IS NOT NULL; 

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `ArchiveItem` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ArchiveItem`(__ITEMID INT, __USERNAME VARCHAR(50))
BEGIN

	UPDATE
		items
	SET
		ARCHIVED = 1
	WHERE
		ID = __ITEMID AND
        ID IN (SELECT ITEMID FROM itemsBranchesLink LINK INNER JOIN user USR ON LINK.BRANCHCODE = USR.BRANCH WHERE USR.USERNAME = __USERNAME);

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CancelRemaindingOrder` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CancelRemaindingOrder`(__ORDERID INT)
BEGIN

UPDATE
	orderHeader
SET
	ORDERSTATUS = 'CANCELLED',
    SPECIALINSTRUCTIONS = 'Order Cancelled on ' + CURRENT_TIMESTAMP
    
WHERE
	ORDERID = __ORDERID;

UPDATE
	orderDetail
SET
	ORDERQTY = SHIPTODATEQTY
WHERE
	ORDERID = __ORDERID;
    
SELECT * FROM orderHeader WHERE ORDERID = __ORDERID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `ChangeAccountTicketStatus` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ChangeAccountTicketStatus`(__TICKETID INT, __STATUS INT)
BEGIN

	UPDATE
		accountMgrHeader
	SET
		STATUS = __STATUS,
        DATECLOSED = CURRENT_TIMESTAMP
	WHERE
		ID = __TICKETID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `ChangeOrderShipToAddress` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ChangeOrderShipToAddress`(__USERNAME VARCHAR(50), __ID VARCHAR(50))
BEGIN


SET SQL_SAFE_UPDATES = 0;

UPDATE
	orderHeader
SET
	SHIPNAME = ( SELECT NAME FROM ( SELECT 'S' AS RC, ID,NAME FROM shipToAddresses UNION ALL SELECT 'B' AS RC,B.CODE,NAME FROM branches B INNER JOIN branchesAddresses BB ON B.CODE = BB.CODE WHERE ISMAIN = 1) ADDR WHERE CONCAT(ADDR.RC,'-',ADDR.ID) = __ID ),
    SHIPADDRESS = ( SELECT ADDRESS FROM ( SELECT 'S' AS RC, ID,ADDRESS FROM shipToAddresses UNION ALL SELECT 'B' AS RC,CODE,ADDRESS FROM branchesAddresses WHERE ISMAIN = 1) ADDR WHERE CONCAT(ADDR.RC,'-',ADDR.ID) = __ID ),
    SHIPADDRESS2 = ( SELECT ADDRESS2 FROM ( SELECT 'S' AS RC, ID,ADDRESS2 FROM shipToAddresses UNION ALL SELECT 'B' AS RC,CODE,ADDRESS2 FROM branchesAddresses WHERE ISMAIN = 1) ADDR WHERE CONCAT(ADDR.RC,'-',ADDR.ID) = __ID ),
    SHIPCITY = ( SELECT CITY FROM ( SELECT 'S' AS RC, ID,CITY FROM shipToAddresses UNION ALL SELECT 'B' AS RC,CODE,CITY FROM branchesAddresses WHERE ISMAIN = 1) ADDR WHERE CONCAT(ADDR.RC,'-',ADDR.ID) = __ID ),
	SHIPPROVINCE = ( SELECT PROVINCE FROM ( SELECT 'S' AS RC, ID,PROVINCE FROM shipToAddresses UNION ALL SELECT 'B' AS RC,CODE,PROVINCE FROM branchesAddresses WHERE ISMAIN = 1) ADDR WHERE CONCAT(ADDR.RC,'-',ADDR.ID) = __ID ),
    SHIPCOUNTRY = ( SELECT COUNTRY FROM ( SELECT 'S' AS RC, ID,COUNTRY FROM shipToAddresses UNION ALL SELECT 'B' AS RC,CODE,COUNTRY FROM branchesAddresses WHERE ISMAIN = 1) ADDR WHERE CONCAT(ADDR.RC,'-',ADDR.ID) = __ID ),
    SHIPPOSTAL = ( SELECT POSTAL FROM ( SELECT 'S' AS RC, ID,POSTAL FROM shipToAddresses UNION ALL SELECT 'B' AS RC,CODE,POSTALCODE FROM branchesAddresses WHERE ISMAIN = 1) ADDR WHERE CONCAT(ADDR.RC,'-',ADDR.ID) = __ID ),
	SHIPCONTACTPHONE = ( SELECT PHONE FROM ( SELECT 'S' AS RC, ID,PHONE FROM shipToAddresses UNION ALL SELECT 'B' AS RC,CODE,PHONE FROM branchesAddresses WHERE ISMAIN = 1) ADDR WHERE CONCAT(ADDR.RC,'-',ADDR.ID) = __ID ),
    SHIPCONTACTFAX = ( SELECT FAX FROM ( SELECT 'S' AS RC, ID,FAX FROM shipToAddresses UNION ALL SELECT 'B' AS RC,CODE,FAX FROM branchesAddresses WHERE ISMAIN = 1) ADDR WHERE CONCAT(ADDR.RC,'-',ADDR.ID) = __ID ),
    SHIPTAXGROUP = ( SELECT TAXGROUP FROM ( SELECT 'S' AS RC, ID,TAXGROUP FROM shipToAddresses UNION ALL SELECT 'B' AS RC,B.CODE,TAXGROUP FROM branches B INNER JOIN branchesAddresses BB ON B.CODE = BB.CODE WHERE ISMAIN = 1) ADDR WHERE CONCAT(ADDR.RC,'-',ADDR.ID) = __ID ),
    SHIPSTOREID = ( SELECT STOREID FROM ( SELECT 'S' AS RC, ID,STOREID FROM shipToAddresses UNION ALL SELECT 'B' AS RC,B.CODE,B.CODE AS STOREID FROM branches B INNER JOIN branchesAddresses BB ON B.CODE = BB.CODE WHERE ISMAIN = 1) ADDR WHERE CONCAT(ADDR.RC,'-',ADDR.ID) = __ID )
WHERE 
	USERNAME  = __USERNAME AND 
    ORDERSTATUS = 'CART';


END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `ChangeTicketStatus` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ChangeTicketStatus`(__TICKETID INT, __STATUS INT)
BEGIN

	UPDATE
		ticketHeader
	SET
		STATUS = __STATUS,
        DATECLOSED = CURRENT_TIMESTAMP
	WHERE
		ID = __TICKETID;

	
    SELECT 
		HDR.*,
        USR.EMAIL,
        USR.LANGUAGE
	FROM 
		ticketHeader HDR 
	LEFT OUTER JOIN
		user USR ON 
			HDR.ENTEREDBY = USR.USERNAME
	WHERE 
    ID = __TICKETID; 

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CheckCartItemDuplicates` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CheckCartItemDuplicates`(__USERNAME VARCHAR(50), __ITEMID INT)
BEGIN

SET @RECCNT := (SELECT 
					COUNT(*) 
				FROM 
					orderHeader HDR 
				INNER JOIN 
					orderDetail DTL ON 
						HDR.ORDERID = DTL.ORDERID 
				WHERE 
					HDR.USERNAME = __USERNAME AND
                    HDR.ORDERSTATUS = 'CART' AND
                    DTL.ITEMID = __ITEMID
				);

IF @RECCNT > 0 THEN
	SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Cannot add the same item to the cart.';
END IF;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CheckCartItemLowInventory` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CheckCartItemLowInventory`(__USERNAME VARCHAR(50), __ITEMID INT, __QTY INT)
BEGIN

	SELECT
		ITM.ID,
        IFNULL(ITMINV.QTYONHAND,0) AS INVQTY,
        IFNULL(ONORDER.ONORDER,0) AS ALLOCATEDQTY,
        CASE 
			WHEN 
				ITM.TYPE <> 0 THEN 1
			ELSE
				CASE WHEN __QTY <= IFNULL(ITMINV.QTYONHAND,0) - IFNULL(ONORDER.ONORDER,0) THEN 1 ELSE 0 END
		END AS ENOUGHQTY
	FROM
		items ITM
	LEFT OUTER JOIN
		itemsInventory ITMINV ON 
			ITM.ID = ITMINV.ITEMID
	LEFT OUTER JOIN
		( SELECT ITEMID,SUM(ORDERQTY-SHIPTODATEQTY) AS ONORDER FROM orderDetail
		  WHERE ORDERID IN (SELECT ORDERID FROM orderHeader WHERE ORDERSTATUS IN ('ACTIVE'))
          GROUP BY ITEMID) ONORDER ON
			ITM.ID = ONORDER.ITEMID
	WHERE
		ITM.ID = __ITEMID;


END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CheckForLowLevelItems` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CheckForLowLevelItems`(__ORDERID INT)
BEGIN
	SELECT
		THISORDER.ORDERID,
        THISORDER.ORDERREF,
		ITEM.ID,
		ITEM.CODE,
        ITEM.DESCRIPTION,
        THISORDER.REMQTY AS ORDERQTY,
        COALESCE(OTHORDER.REMQTY,0) AS OTHQTY,
        ITEM.TYPE,
        COALESCE(ITEM.MINLEVEL,0) AS MINLEVEL,
        COALESCE(INV.QTYONHAND,0) AS QTYONHAND
	FROM
		( SELECT H.ORDERID, H.ORDERREF, ITEMID,SUM(ORDERQTY-SHIPTODATEQTY) AS REMQTY FROM orderHeader H INNER JOIN orderDetail D ON H.ORDERID = D.ORDERID WHERE  H.ORDERID = __ORDERID GROUP BY H.ORDERID, H.ORDERREF, D.ITEMID) THISORDER  
	INNER JOIN
		items ITEM ON 
			THISORDER.ITEMID = ITEM.ID
	LEFT OUTER JOIN
		itemsInventory INV ON 
			THISORDER.ITEMID = INV.ITEMID
	LEFT OUTER JOIN
		( SELECT ITEMID,SUM(ORDERQTY-SHIPTODATEQTY) AS REMQTY FROM orderHeader H INNER JOIN orderDetail D ON H.ORDERID = D.ORDERID WHERE ORDERSTATUS = 'ACTIVE' AND H.ORDERID <> __ORDERID GROUP BY D.ITEMID) OTHORDER ON 
			OTHORDER.ITEMID = THISORDER.ITEMID
	WHERE
		COALESCE(INV.QTYONHAND,0) - COALESCE(ITEM.MINLEVEL,0) - COALESCE(OTHORDER.REMQTY,0) - THISORDER.REMQTY <= 0
	ORDER BY
		ITEM.TYPE,
		ITEM.CODE;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CheckIfItemAppliesPromo` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CheckIfItemAppliesPromo`(__ORDERID INT, __PROMO VARCHAR(50), __ITEMID INT)
BEGIN

SELECT 
 PI.* 
FROM 
 orderDetail D 
INNER JOIN 
 items I ON D.ITEMID = I.ID 
INNER JOIN 
 promosItems PI ON (PI.ITEMID = I.ID OR PI.ITEMID = I.PARENTITEM)
INNER JOIN 
	promos PIHDR ON PI.CODE = PIHDR.CODE AND (PIHDR.MAXQTY = 0 OR D.ORDERQTY <= PIHDR.MAXQTY)
WHERE 
	ORDERID = __ORDERID AND PI.CODE = __PROMO AND D.ITEMID = __ITEMID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CheckIfItemAppliesPromoCat` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `CheckIfItemAppliesPromoCat`(__ORDERID INT, __PROMO VARCHAR(50), __ITEMID INT)
BEGIN

SELECT
 D.*
FROM orderDetail D 
INNER JOIN items I ON D.ITEMID = I.ID 
INNER JOIN itemsSubcategoryLink ISL ON I.ID = ISL.ITEMID
INNER JOIN subcategories SUBCATS ON ISL.SUBCATID = SUBCATS.SUBCATID
CROSS JOIN (SELECT * FROM promos WHERE CODE = __PROMO) PROMO 
WHERE
D.ORDERID = __ORDERID AND 
D.ITEMID = __ITEMID AND
SUBCATS.CATID NOT IN (SELECT CATID FROM promos PIHDR INNER JOIN promosCategories PC ON PC.CODE = PIHDR.CODE WHERE PC.CODE = __PROMO) AND
(PROMO.MAXQTY = 0 OR ORDERQTY <= PROMO.MAXQTY);


END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CheckIfItemAppliesPromoExceptionList` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `CheckIfItemAppliesPromoExceptionList`(__ORDERID INT, __PROMO VARCHAR(50), __ITEMID INT)
BEGIN

SELECT 
 PIHDR.* 
FROM 
 orderDetail D 
INNER JOIN 
 items I ON D.ITEMID = I.ID 
INNER JOIN 
  promos PIHDR ON PIHDR.CODE = __PROMO AND (PIHDR.MAXQTY = 0 OR D.ORDERQTY <= PIHDR.MAXQTY)
LEFT OUTER JOIN 
  promosItems PI ON (PI.ITEMID = I.ID OR PI.ITEMID = I.PARENTITEM)
WHERE 
  ORDERID = __ORDERID AND D.ITEMID = __ITEMID AND PI.ITEMID IS NULL;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CheckUserAccount` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CheckUserAccount`(IN `UNAME` VARCHAR(50), IN `PASS` VARCHAR(50))
BEGIN
	SELECT 
		USERS.*,
        COALESCE(SKINDEF.STYLEFILENAME,'DEFAULT') AS SKIN,
        COALESCE(BRANCH.SKIN,'DEFAULT') AS BANNER
	FROM 
		user USERS
	LEFT OUTER JOIN
		branches BRANCH ON 
			USERS.BRANCH = BRANCH.CODE
	LEFT OUTER JOIN
		branchSkinDefinition SKINDEF ON 
			BRANCH.SKIN = SKINDEF.SKINNAME
	WHERE USERNAME=UNAME AND PASSWORD=CONCAT('*', UPPER(SHA1(UNHEX(SHA1(PASS))))) AND USERS.STATUS=1;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CheckUserAccount_ByIdBranch` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CheckUserAccount_ByIdBranch`(__USERNAME VARCHAR(50), __BRANCHNAME VARCHAR(100))
BEGIN

	SELECT 
		USERS.*,
        COALESCE(SKINDEF.STYLEFILENAME,'DEFAULT') AS SKIN,
        COALESCE(BRANCH.SKIN,'DEFAULT') AS BANNER
	FROM 
		user USERS
	LEFT OUTER JOIN
		branches BRANCH ON 
			USERS.BRANCH = BRANCH.CODE
	LEFT OUTER JOIN
		branchSkinDefinition SKINDEF ON 
			BRANCH.SKIN = SKINDEF.SKINNAME
	WHERE 
        USERNAME=__USERNAME AND 
        USERS.STATUS=1 AND 
        USERS.USERLEVEL < 90;
    
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `ClearAllAdBrandLink` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ClearAllAdBrandLink`(__ID INT)
BEGIN
	DELETE FROM AdItemsBrand WHERE ID = __ID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `ClearAllCategoryBrandLink` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ClearAllCategoryBrandLink`(__CATID INT)
BEGIN
	DELETE FROM categoriesBrand WHERE CATID = __CATID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateAccountTicket` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateAccountTicket`(__ENTEREDBY VARCHAR(50), __LANGUAGE VARCHAR(20), __ACCOUNT VARCHAR(20), __BANNER VARCHAR(20),
__BRANCHNUMBER VARCHAR(20), __BRANCHNAME VARCHAR(100), __ADDRESS VARCHAR(1000), __CITY VARCHAR(100), __PROVINCE VARCHAR(100),
__POSTAL VARCHAR(100), __COUNTRY VARCHAR(100), __PHONE VARCHAR(100), __FAX VARCHAR(100), __APPOINTMENTPHONE VARCHAR(100),
__CONTACTFIRST VARCHAR(100), __CONTACTLAST VARCHAR(100), __EMAIL VARCHAR(100), __NOTE VARCHAR(1000),
__BOUTIQUEFIRST VARCHAR(100), __BOUTIQUELAST VARCHAR(100), __TAGLINENAME VARCHAR(100), __AFFILIATEDNAME VARCHAR(100),
__PHARMLEGALNAME VARCHAR(100), __PHARMPHOTONAME VARCHAR(100))
BEGIN

DECLARE __TICKETID INT;

INSERT INTO accountMgrHeader
(ENTEREDBY,DATEENTERED,STATUS,TITLE,DATECLOSED,LANGUAGE,ACCOUNT,BANNER,BRANCHNUMBER,ADDRESS,CITY,PROVINCE,COUNTRY,POSTAL,
PHONE,FAX,APPOINTMENTPHONE,CONTACTFIRST,CONTACTLAST,EMAIL,NOTE,BOUTIQUEFIRST,BOUTIQUELAST,TAGLINENAME,AFFILIATEDNAME,PHARMLEGALNAME,PHARMPHOTONAME)
VALUES
(__ENTEREDBY,CURRENT_TIMESTAMP,1,__BRANCHNAME,NULL,__LANGUAGE,__ACCOUNT,__BANNER,__BRANCHNUMBER,
__ADDRESS,__CITY,__PROVINCE,__COUNTRY,__POSTAL,__PHONE,__FAX,__APPOINTMENTPHONE,__CONTACTFIRST,__CONTACTLAST,__EMAIL,__NOTE,
__BOUTIQUEFIRST,__BOUTIQUELAST,__TAGLINENAME,__AFFILIATEDNAME, __PHARMLEGALNAME, __PHARMPHOTONAME);

SET __TICKETID = LAST_INSERT_ID();

SELECT *,UNIX_TIMESTAMP(DATEENTERED) AS UNIX_DATEENTERED FROM accountMgrHeader WHERE ID = __TICKETID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateAccountTicketReply` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateAccountTicketReply`(__TICKETID INT, __MESSAGE VARCHAR(1000), __ENTEREDBY VARCHAR(50))
BEGIN

 DECLARE __TICCHECK INT;
 SELECT COUNT(*) INTO __TICCHECK FROM accountMgrHeader WHERE ( ENTEREDBY = __ENTEREDBY OR __ENTEREDBY IN (SELECT USERNAME FROM user WHERE USERLEVEL >= 99)) AND ID = __TICKETID;
 
 IF __TICCHECK > 0 THEN

 INSERT INTO
 accountMgrMessages
 (TICKETID,DATEENTERED,ENTEREDBY,CLIENTMESSAGE,MESSAGE)
 VALUES
 (
 __TICKETID,
 CURRENT_TIMESTAMP,
 __ENTEREDBY,
 CASE WHEN __ENTEREDBY IN (SELECT USERNAME FROM user WHERE USERLEVEL >= 99) THEN 0 ELSE 1 END,
 __MESSAGE
 );
 
 SELECT 
 HDR.*,
 DTL.MESSAGE,
 DTL.DATEENTERED AS RDATEENTERED,
 USR.FIRSTNAME,
 USR.LASTNAME,
 USR.EMAIL,
 USR.LANGUAGE,
 USR2.FIRSTNAME AS RFIRSTNAME, 
 USR2.LASTNAME AS RLASTNAME,
 USR2.EMAIL AS REMAIL 
 FROM 
 accountMgrHeader HDR 
 LEFT OUTER JOIN
 accountMgrMessages DTL ON 
 HDR.ID = DTL.TICKETID
 LEFT OUTER JOIN
 user USR ON 
 HDR.ENTEREDBY = USR.USERNAME
 LEFT OUTER JOIN
 user USR2 ON 
 DTL.ENTEREDBY = USR2.USERNAME                
		WHERE 
		ID = __TICKETID AND
        DTL.MESSAGEID = LAST_INSERT_ID();
        
	END IF;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateAdBrandLink` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateAdBrandLink`(__ADID INT, __BRANDNAME VARCHAR(20))
BEGIN
	INSERT INTO AdItemsBrand (ID,BRANDNAME)
    VALUES (__ADID,__BRANDNAME);
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateCategoryBrandLink` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateCategoryBrandLink`(__CATID INT, __BRANDNAME VARCHAR(20))
BEGIN
	INSERT INTO categoriesBrand (CATID,BRANDNAME)
    VALUES (__CATID,__BRANDNAME);
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateItemBranchLink` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateItemBranchLink`(__ITEMID INT, __BRANCHCODE VARCHAR(20))
BEGIN
	INSERT INTO
		itemsBranchesLink
		(ITEMID,BRANCHCODE)
	VALUES
		(__ITEMID,__BRANCHCODE);
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateItemCategoryLink` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateItemCategoryLink`(__ITEMID INT, __SUBCATID INT)
BEGIN
	INSERT INTO 
		itemsSubcategoryLink
		(ITEMID,SUBCATID)
	VALUES
		(__ITEMID,__SUBCATID);
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateItemPricing` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateItemPricing`(__ITEMID INT, __QTY INT, __ITEMOPTION VARCHAR(30), __PRICE DECIMAL(19,4), __LENGTH DECIMAL(19,4), __WIDTH DECIMAL(19,4), __HEIGHT DECIMAL(19,4), __WEIGHT DECIMAL(19,4), __PIECES INT)
BEGIN
	INSERT INTO
		itemPricing
		(ITEMID,QTY,PRICE,LENGTH,WIDTH,HEIGHT,WEIGHT,PIECES,ITEMOPTION)
	VALUES
		(__ITEMID,__QTY,__PRICE,__LENGTH,__WIDTH,__HEIGHT,__WEIGHT,__PIECES,__ITEMOPTION);
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateNewAd` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateNewAd`(__NAME VARCHAR(1000), __STARTDATE DATE, __ENDDATE DATE, __LANGUAGE VARCHAR(2), __SORTORDER INT, __URL VARCHAR(500), __ADPATH VARCHAR(200))
BEGIN

	INSERT INTO 
		AdItems
        (`NAME`,STARTDATE,ENDDATE,`LANGUAGE`,SORTORDER,IMAGEPATH,URL)
	VALUES
		(__NAME,__STARTDATE,__ENDDATE,__LANGUAGE,__SORTORDER,__ADPATH,__URL);

	SELECT LAST_INSERT_ID() AS ADID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateNewBranch` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateNewBranch`(__CODE VARCHAR(20), __NAME VARCHAR(100), __MGREMAIL VARCHAR(100), __TREEMAIL VARCHAR(100), __TAXGROUP VARCHAR(6), __SKIN VARCHAR(20), __STATUS INTEGER, __COMMENTS VARCHAR(1000), __SHIPZONE VARCHAR(20))
BEGIN
INSERT INTO
	branches (CODE,NAME,MANAGEMENTEMAIL,TREASUREREMAIL,TAXGROUP,SKIN,STATUS,COMMENTS,SHIPZONE)
VALUES
	(__CODE, __NAME, __MGREMAIL, __TREEMAIL,__TAXGROUP,__SKIN, __STATUS, __COMMENTS, __SHIPZONE);

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateNewBranchAddress` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateNewBranchAddress`(__CODE VARCHAR(20), __LANG VARCHAR(2), __ISMAIN INTEGER, __ADDRESS VARCHAR(1000), __ADDRESS2 VARCHAR(1000), __CITY VARCHAR(100), __PROVINCE VARCHAR(100), __COUNTRY VARCHAR(100), __POSTALCODE VARCHAR(20), __PHONE VARCHAR(20), __FAX VARCHAR(20))
BEGIN

INSERT INTO
	branchesAddresses
		(CODE, LANGUAGE, ISMAIN, ADDRESS, ADDRESS2, CITY, PROVINCE, COUNTRY, POSTALCODE, PHONE, FAX)
VALUES
	(__CODE, __LANG, __ISMAIN, __ADDRESS, __ADDRESS2, __CITY, __PROVINCE, __COUNTRY, __POSTALCODE, __PHONE, __FAX);

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateNewCategory` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateNewCategory`(__NAME VARCHAR(50), __DESCRIPTION VARCHAR(200), __LANGUAGE VARCHAR(2), __ICON VARCHAR(200), __USERLEVEL INTEGER, __COMMENTS VARCHAR(1000))
BEGIN

	INSERT	INTO
		categories
        (NAME,DESCRIPTION,ICONURL,LANGUAGE,USERLEVEL,COMMENTS,CREATEDDATE,MODIFIEDDATE)
	VALUES
		(__NAME,__DESCRIPTION,__ICON,__LANGUAGE,__USERLEVEL,__COMMENTS,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP);

	SELECT LAST_INSERT_ID() AS CATID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateNewItem` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `CreateNewItem`(IN `__TYPE` INT, IN `__CODE` VARCHAR(50), IN `__DESCRIPTION` VARCHAR(200), IN `__PRODUCEDETAIL` VARCHAR(1000), IN `__SIZE` VARCHAR(50), IN `__NUMPAGES` VARCHAR(50), IN `__PRINTINGTYPE` VARCHAR(50), IN `__STOCK` VARCHAR(50), IN `__STATUS` INT, IN `__MINLEVEL` INT, IN `__LEADTIME` INT, IN `__INITIALQTY` INT, IN `__DISPLAYNAME` VARCHAR(1000), IN `__PROOFNAME` VARCHAR(1000), IN `__PARAMETERSNAME` VARCHAR(1000), IN `__UPLOADDIR` VARCHAR(1000), IN `__PREVIEWNAME` VARCHAR(1000), IN `__SHIPBOXINSLEEVE` INT, IN `__SKIPPDFPERMISSIONCHECK` INT, IN `__DLSUGGESTIONS` VARCHAR(1000))
BEGIN
        INSERT INTO 
                items
                (TYPE,CODE,DESCRIPTION,PRODUCEDETAIL,SIZE,NUMPAGES,PRINTINGTYPE,STOCK,STATUS,MINLEVEL,LEADTIME,DISPLAYIMAGENAME,PROOFPDFNAME,PARAMETERSFILENAME,PREVIEWIMAGENAME,DISPLAYIMAGEPATH,PROOFPDFPATH,PARAMETERSFILEPATH,PREVIEWIMAGEPATH,SHIPBOXINSLEEVE,SKIPPDFPERMISSIONCHECK,DLSUGGESTIONS)
        VALUES
                (__TYPE,__CODE,__DESCRIPTION,__PRODUCEDETAIL,__SIZE,__NUMPAGES,__PRINTINGTYPE,__STOCK,__STATUS,__MINLEVEL,__LEADTIME,__DISPLAYNAME,__PROOFNAME,__PARAMETERSNAME,__PREVIEWNAME,
         CASE WHEN LENGTH(__DISPLAYNAME) > 0 THEN CONCAT(__UPLOADDIR,__DISPLAYNAME) ELSE '' END,
         CASE WHEN LENGTH(__PROOFNAME) > 0 THEN CONCAT(__UPLOADDIR,__PROOFNAME) ELSE '' END,
         CASE WHEN LENGTH(__PARAMETERSNAME) > 0 THEN CONCAT(__UPLOADDIR,__PARAMETERSNAME) ELSE '' END,
         CASE WHEN LENGTH(__PREVIEWNAME) > 0 THEN CONCAT(__UPLOADDIR,__PREVIEWNAME) ELSE '' END,
         __SHIPBOXINSLEEVE,
         __SKIPPDFPERMISSIONCHECK,
         __DLSUGGESTIONS
                );
 
        SELECT LAST_INSERT_ID() AS ITEMID;
           
        IF __TYPE = 0 THEN
                INSERT INTO 
                        itemsInventory
                        (ITEMID,QTYONHAND)
                VALUES (LAST_INSERT_ID(),0);
        END IF;
 
        IF __INITIALQTY > 0 THEN
                UPDATE 
                        itemsInventory
                SET
                        QTYONHAND = __INITIALQTY
                WHERE
                        ITEMID = LAST_INSERT_ID();
            
                INSERT INTO 
                        itemsAdjustmentLog
            (ITEMID,QTY,ADJDATE,REASON)
                VALUES (LAST_INSERT_ID(),__INITIALQTY,CURRENT_TIMESTAMP,'Initial Inventory');
    END IF;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateNewNewsItem` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateNewNewsItem`(__STARTDATE DATE, __ENDDATE DATE, __LANGUAGE VARCHAR(2), __TITLE VARCHAR(1000), __MESSAGE VARCHAR(1000))
BEGIN
	INSERT INTO 
		newsItems
		(STARTDATE,ENDDATE,LANGUAGE,TITLE,MESSAGE)
	VALUES
		(__STARTDATE,__ENDDATE,__LANGUAGE,__TITLE,__MESSAGE);
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateNewPromo` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `CreateNewPromo`(__NAME VARCHAR(100), __CODE VARCHAR(50), __CODETYPE VARCHAR(12), __PROMOVALUE DECIMAL(19,2), __QTYTYPE VARCHAR(12), __MAXQTY INT, __MINQTY INT, __EXACTQTY INT, __STARTDATE DATE, __ENDDATE DATE, __SINGLEUSE INT, __REDEEMED INT, __SINGLEITEM INT)
BEGIN

 INSERT INTO 
 promos
 (NAME,CODE,CODETYPE,PROMOVALUE,QTYTYPE,MAXQTY,MINQTY,EXACTQTY,STARTDATE,ENDDATE,SINGLEUSE,REDEEMED,SINGLEITEM)
 VALUES
 (__NAME,__CODE,__CODETYPE,__PROMOVALUE,__QTYTYPE,__MAXQTY,__MINQTY,__EXACTQTY,__STARTDATE,__ENDDATE,__SINGLEUSE,__REDEEMED,__SINGLEITEM);

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateNewShipToAddress` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `CreateNewShipToAddress`(__NAME VARCHAR(100), __STOREID VARCHAR(20), __ADDRESS VARCHAR(1000), __ADDRESS2 VARCHAR(1000), __CITY VARCHAR(100),
__PROVINCE VARCHAR(100), __COUNTRY VARCHAR(100), __POSTAL VARCHAR(20), __PHONE VARCHAR(20), __FAX VARCHAR(20),
__TAXGROUP VARCHAR(6), __SHIPZONE VARCHAR(6))
BEGIN

INSERT INTO
	shipToAddresses
    (NAME,STOREID,ADDRESS,ADDRESS2,CITY,PROVINCE,COUNTRY,POSTAL,PHONE,FAX,TAXGROUP,SHIPZONE)
VALUES
	(__NAME,__STOREID,__ADDRESS,__ADDRESS2,__CITY,__PROVINCE,__COUNTRY,__POSTAL,__PHONE,__FAX,__TAXGROUP,__SHIPZONE);

SELECT LAST_INSERT_ID() AS SHIPID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateNewSubCategory` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `CreateNewSubCategory`(__CATID INTEGER, __PARENTSUBCATID INTEGER, __NAME VARCHAR(50), __DESCRIPTION VARCHAR(200), __ICONURL VARCHAR(200), __USERLEVEL INT)
BEGIN
    INSERT INTO subcategories (CATID,PARENTSUBCATID,NAME,DESCRIPTION,ICONURL,USERLEVEL)
    VALUES (__CATID,__PARENTSUBCATID,__NAME,__DESCRIPTION, __ICONURL, __USERLEVEL);
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateNewUser` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateNewUser`(IN `UNAME` VARCHAR(50), IN `__BRANCH` VARCHAR(20), IN `PASS` VARCHAR(50), IN `FNAME` VARCHAR(50), IN `LNAME` VARCHAR(50), IN `LANG` VARCHAR(2), IN `STAT` INT, IN `USERLVL` INT, IN `COMMENTS` VARCHAR(1000), IN `EMAIL` VARCHAR(100))
BEGIN

INSERT INTO 
	`user` (`USERNAME`,`BRANCH`,`PASSWORD`,`PLAINPASSWORD`,`FIRSTNAME`,`LASTNAME`,`LANGUAGE`,`STATUS`,`USERLEVEL`,`COMMENTS`,`EMAIL`) 
VALUES 
  (UNAME,__BRANCH,CONCAT('*', UPPER(SHA1(UNHEX(SHA1(PASS))))),PASS,FNAME,LNAME,LANG,STAT,USERLVL,COMMENTS,EMAIL);
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateShipmentHeader` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateShipmentHeader`(__ORDERID INT, __TRACKNUM VARCHAR(100), __METHOD VARCHAR(100), __AMOUNT DECIMAL(16,2), __WEIGHT DECIMAL(16,2), __PIECES INT, __INSTRUCTIONS VARCHAR(1000))
BEGIN

	INSERT INTO 
		shipmentHeader
        (ORDERID,TRACKNUM,SHIPDATE,SHIPMETHOD,SHIPAMOUNT,SHIPWEIGHT,SHIPPIECES,SHIPINSTRUCTIONS)
	VALUES
		(__ORDERID,__TRACKNUM,CURRENT_TIMESTAMP,__METHOD,__AMOUNT,__WEIGHT,__PIECES,__INSTRUCTIONS);
    
    SELECT
		SHIPID,
        ORDERID
	FROM
		shipmentHeader
	WHERE
		SHIPID = LAST_INSERT_ID();
    
    
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateShipmentLine` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateShipmentLine`(__SHIPID INT, __ORDERID INT, __ORDERLINE INT, __SHIPQTY INT)
BEGIN

	INSERT INTO
		shipmentDetail
		(SHIPID,ORDERID,ORDERLINE,SHIPQTY)
	VALUES
		(__SHIPID,__ORDERID,__ORDERLINE,__SHIPQTY);
        
	UPDATE
		orderDetail
	SET
		SHIPTODATEQTY = SHIPTODATEQTY + __SHIPQTY
	WHERE
		ORDERID = __ORDERID AND
        ITEMLINE = __ORDERLINE;
        
	UPDATE
		itemsInventory
	SET
		QTYONHAND = QTYONHAND - __SHIPQTY
	WHERE
		ITEMID IN (SELECT ITEMID FROM orderDetail WHERE ORDERID = __ORDERID AND ITEMLINE = __ORDERLINE);
        
	INSERT INTO 
		itemsAdjustmentLog
			(ITEMID,QTY,ADJDATE,REASON)
	SELECT
		ITEMID,
        __SHIPQTY * -1 AS QTY,
        CURRENT_TIMESTAMP AS ADJDATE,
        CONCAT('Shipment for Order# ', ORDERID, ' Ship# ', __SHIPID) AS REASON
	FROM
		orderDetail
	WHERE
		ORDERID = __ORDERID AND
        ITEMLINE = __ORDERLINE;  
        
	UPDATE
		orderHeader
	SET
		ORDERSTATUS = 'SHIPPED'
	WHERE
		ORDERID = __ORDERID AND
        ORDERID IN (SELECT ORDERID FROM orderDetail WHERE ORDERID = __ORDERID GROUP BY ORDERID HAVING SUM(ORDERQTY) = SUM(SHIPTODATEQTY));

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateShipToAddressUserLink` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `CreateShipToAddressUserLink`(__shipid INT, __username VARCHAR(30))
BEGIN

	INSERT INTO shipToAddressesUserList (ID,USERNAME) VALUES (__shipid, __username); 

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateSupportTicket` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateSupportTicket`(__TITLE VARCHAR(1000), __MESSAGE VARCHAR(1000), __ENTEREDBY VARCHAR(50))
BEGIN
 
 DECLARE __TICKETID INT;

 
 INSERT INTO ticketHeader
 (ENTEREDBY,DATEENTERED,STATUS,TITLE,DATECLOSED)
 VALUES
 (__ENTEREDBY,CURRENT_TIMESTAMP,1,__TITLE,NULL);
 
 
 SET __TICKETID = LAST_INSERT_ID();
 
 
 INSERT INTO ticketDetail
 (TICKETID,DATEENTERED,ENTEREDBY,CLIENTMESSAGE,MESSAGE)
 VALUES
 (__TICKETID,CURRENT_TIMESTAMP,__ENTEREDBY,1,__MESSAGE);
 
 
 SELECT 
 HDR.*,
 DTL.MESSAGEID,
 DTL.MESSAGE,
 USR.FIRSTNAME,
 USR.LASTNAME,
 USR.EMAIL,
 USR.LANGUAGE,
 UNIX_TIMESTAMP(DTL.DATEENTERED) AS UNIX_DATEENTERED
 FROM 
 ticketHeader HDR 
 LEFT OUTER JOIN
 ticketDetail DTL ON 
 HDR.ID = DTL.TICKETID
 LEFT OUTER JOIN
 user USR ON 
 HDR.ENTEREDBY = USR.USERNAME
 WHERE 
 ID = __TICKETID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateSupportTicketAttachment` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateSupportTicketAttachment`(__TICKETID INT, __MESSAGEID INT, __STORENAME VARCHAR(200), __FILENAME VARCHAR(200))
BEGIN

INSERT INTO ticketAttachment (TICKETID,MESSAGEID, STOREFILENAME,ORIGFILENAME)
VALUES (__TICKETID, __MESSAGEID, __STORENAME,__FILENAME);
	

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CreateSupportTicketReply` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `CreateSupportTicketReply`(__TICKETID INT, __MESSAGE VARCHAR(1000), __ENTEREDBY VARCHAR(50))
BEGIN

DECLARE __TICCHECK INT;
 SELECT COUNT(*) INTO __TICCHECK FROM ticketHeader WHERE ( ENTEREDBY = __ENTEREDBY OR __ENTEREDBY IN (SELECT USERNAME FROM user WHERE USERLEVEL >= 81)) AND ID = __TICKETID;
 
 IF __TICCHECK > 0 THEN

		INSERT INTO
			ticketDetail
			(TICKETID,DATEENTERED,ENTEREDBY,CLIENTMESSAGE,MESSAGE)
		VALUES
			(
				__TICKETID,
				CURRENT_TIMESTAMP,
				__ENTEREDBY,
				CASE WHEN __ENTEREDBY IN (SELECT USERNAME FROM user WHERE USERLEVEL >= 81) THEN 0 ELSE 1 END,
				__MESSAGE
			);
            
		SELECT 
			HDR.*,
			DTL.MESSAGE,
			DTL.DATEENTERED AS RDATEENTERED,
			USR.FIRSTNAME,
			USR.LASTNAME,
			USR.EMAIL,
            USR.LANGUAGE,
			USR2.FIRSTNAME AS RFIRSTNAME, 
			USR2.LASTNAME AS RLASTNAME,
			USR2.EMAIL AS REMAIL            
		FROM 
			ticketHeader HDR 
		LEFT OUTER JOIN
			ticketDetail DTL ON 
				HDR.ID = DTL.TICKETID
		LEFT OUTER JOIN
			user USR ON 
				HDR.ENTEREDBY = USR.USERNAME
		LEFT OUTER JOIN
			user USR2 ON 
				DTL.ENTEREDBY = USR2.USERNAME                
		WHERE 
		ID = __TICKETID AND
        DTL.MESSAGEID = LAST_INSERT_ID();
        
	END IF;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteAdItem` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DeleteAdItem`(__ID INT)
BEGIN
	DELETE FROM AdItems WHERE ID = __ID;
    DELETE FROM AdItemsBrand WHERE ID = __ID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteAllBranchLinks` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DeleteAllBranchLinks`(__ITEMID INT)
BEGIN
	DELETE FROM itemsBranchesLink WHERE ITEMID = __ITEMID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteAllItemCategoryLinks` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DeleteAllItemCategoryLinks`(__ITEMID INT)
BEGIN
	DELETE FROM itemsSubcategoryLink WHERE ITEMID = __ITEMID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteAllPricingLinks` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DeleteAllPricingLinks`(__ITEMID INT)
BEGIN
	DELETE FROM itemPricing WHERE ITEMID = __ITEMID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteAllShipToAddressUserLinks` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `DeleteAllShipToAddressUserLinks`(__shipid INT)
BEGIN
	DELETE FROM shipToAddressesUserList WHERE ID = __shipid; 
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteBranchAddress` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DeleteBranchAddress`(__CODE VARCHAR(20), __LANG VARCHAR(2))
BEGIN
	DELETE FROM branchesAddresses WHERE CODE = __CODE AND LANGUAGE = __LANG;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteBranchProfile` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DeleteBranchProfile`(__CODE VARCHAR(20))
BEGIN
	DELETE FROM branches WHERE CODE = __CODE;
    DELETE FROM branchesAddresses WHERE CODE = __CODE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteCategoryProfile` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DeleteCategoryProfile`(__CATID INTEGER)
BEGIN
	DELETE FROM categories WHERE CATID = __CATID;
    DELETE FROM subcategories WHERE CATID = __CATID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteItem` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DeleteItem`(__ITEMID INT)
BEGIN
  DELETE FROM items WHERE ID = __ITEMID;
    DELETE FROM itemPricing WHERE ITEMID = __ITEMID;
    DELETE FROM itemsBranchesLink WHERE ITEMID = __ITEMID;
    DELETE FROM itemsSubcategoryLink WHERE ITEMID = __ITEMID;
    DELETE FROM itemsInventory WHERE ITEMID = __ITEMID;
    DELETE FROM itemsPrintDefinition WHERE ID = __ITEMID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteNewsItem` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DeleteNewsItem`(__ID INTEGER)
BEGIN
	DELETE FROM newsItems WHERE ID = __ID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeletePromoCategories` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `DeletePromoCategories`(__CODE VARCHAR(50))
BEGIN
  DELETE FROM promosCategories WHERE CODE = __CODE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeletePromoItems` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DeletePromoItems`(__CODE VARCHAR(50))
BEGIN
	DELETE FROM promosItems WHERE CODE = __CODE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeletePromoProfile` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `DeletePromoProfile`(__CODE VARCHAR(50))
BEGIN
  DELETE FROM promosCategories WHERE CODE = __CODE;
    DELETE FROM promosItems WHERE CODE = __CODE;
  DELETE FROM promos WHERE CODE = __CODE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteShipToAddress` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `DeleteShipToAddress`(__ID INT)
BEGIN

DELETE FROM shipToAddressesUserList WHERE ID = __ID;
DELETE FROM shipToAddresses WHERE ID = __ID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteSubCategoryProfile` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DeleteSubCategoryProfile`(__SUBCATID INTEGER)
BEGIN
	DELETE FROM subcategories WHERE SUBCATID = __SUBCATID;
    DELETE FROM subcategories WHERE PARENTSUBCATID = __SUBCATID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteUserProfile` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DeleteUserProfile`(UNAME VARCHAR(100))
BEGIN

DELETE FROM user WHERE USERNAME = UNAME;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DuplicateBranchProfile` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DuplicateBranchProfile`(__CODE VARCHAR(20), __NEWCODE VARCHAR(20))
BEGIN

	INSERT INTO
		branches
        (CODE,NAME,MANAGEMENTEMAIL,TREASUREREMAIL,TAXGROUP,STATUS,COMMENTS,CREATEDDATE,MODIFIEDDATE,SHIPZONE)
	SELECT
		__NEWCODE AS CODE,
        NAME,
        MANAGEMENTEMAIL,
        TREASUREREMAIL,
        TAXGROUP,
        STATUS,
        COMMENTS,
        CURRENT_TIMESTAMP AS CREATEDDATE,
        CURRENT_TIMESTAMP AS MODIFIEDDATE,
        SHIPZONE
	FROM
		branches
	WHERE
		CODE = __CODE;
        
	INSERT INTO
		branchesAddresses
        (CODE,LANGUAGE,ISMAIN,ADDRESS,CITY,PROVINCE,COUNTRY,POSTALCODE,PHONE,FAX)
	SELECT
		__NEWCODE AS CODE,
        LANGUAGE,
        ISMAIN,
        ADDRESS,
        CITY,
        PROVINCE,
        COUNTRY,
        POSTALCODE,
        PHONE,
        FAX
	FROM
		branchesAddresses
	WHERE
		CODE = __CODE;

	INSERT INTO
		branchesAssetData
        (BRANCHCODE,TAG,VALUE)
    SELECT
		__NEWCODE AS BRANCHCODE,
        TAG,
        VALUE
	FROM
		branchesAssetData
	WHERE
		BRANCHCODE = __CODE;

	INSERT INTO
		itemsBranchesLink
        (ITEMID,BRANCHCODE)
	SELECT
		ITEMID,
        __NEWCODE AS BRANCHCODE
	FROM
		itemsBranchesLink
	WHERE
		BRANCHCODE = __CODE;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DuplicateCategoryProfile` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DuplicateCategoryProfile`(__CATID INT)
BEGIN

INSERT INTO
	categories
	(NAME,DESCRIPTION,ICONURL,LANGUAGE,USERLEVEL,COMMENTS,CREATEDDATE,MODIFIEDDATE)
SELECT
	CONCAT(NAME,' **DUP**') AS NAME,
    DESCRIPTION,
    ICONURL,
    LANGUAGE,
    USERLEVEL,
    COMMENTS,
    CURRENT_TIMESTAMP AS CREATEDDATE,
    CURRENT_TIMESTAMP AS MODIFIEDDATE
FROM
	categories
WHERE
	CATID = __CATID;
    
SET @CATID = LAST_INSERT_ID();    
   
INSERT INTO categoriesBrand (CATID,BRANDNAME)
SELECT @CATID,BRANDNAME FROM categoriesBrand WHERE CATID = __CATID;
    
SELECT @CATID AS CATID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DuplicateItem` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DuplicateItem`(__ITEMID INT)
BEGIN

  INSERT INTO 
    items
        (TYPE,CODE,DESCRIPTION,SIZE,NUMPAGES,STATUS,MINLEVEL,LEADTIME,PARENTITEM,
         ARCHIVED,GENERATEDBY,ASSETAPPROVED,SHIPBOXINSLEEVE,PRINTINGTYPE,STOCK) 
  SELECT
    TYPE,
        CONCAT(CODE,' **DUP**'),
        DESCRIPTION,
        SIZE,
        NUMPAGES,
        STATUS,
        MINLEVEL,
        LEADTIME,
        PARENTITEM,
        ARCHIVED,
        GENERATEDBY,
        ASSETAPPROVED,
        SHIPBOXINSLEEVE,
        PRINTINGTYPE,
        STOCK
  FROM
    items
  WHERE
    ID = __ITEMID;
        
  SET @ITEMID = LAST_INSERT_ID();
 
  INSERT INTO
    itemPricing
        (ITEMID,QTY,PRICE,LENGTH,WIDTH,HEIGHT,WEIGHT,PIECES,ITEMOPTION)
  SELECT
    @ITEMID AS ITEMID,
        QTY,
        PRICE,
        LENGTH,
        WIDTH,
        HEIGHT,
        WEIGHT,
        PIECES,
        ITEMOPTION
  FROM
    itemPricing
  WHERE
    ITEMID = __ITEMID;
 
  INSERT INTO
    itemsBranchesLink
        (ITEMID,BRANCHCODE)
  SELECT
    @ITEMID AS ITEMID,
        BRANCHCODE
  FROM
    itemsBranchesLink
  WHERE
    ITEMID = __ITEMID;
        
  INSERT INTO
    itemsInventory
        (ITEMID,QTYONHAND)
  SELECT
    @ITEMID AS ITEMID,
        0 AS QTYONHAND
  FROM
    itemsInventory
  WHERE
    ITEMID = __ITEMID;
        
  INSERT INTO
    itemsSubcategoryLink
        (ITEMID,SUBCATID)
  SELECT
    @ITEMID AS ITEMID,
        SUBCATID
  FROM
    itemsSubcategoryLink
  WHERE
    ITEMID = __ITEMID;
        
  INSERT INTO
    itemsPrintDefinition
        (ID,PRESS,NUMPAGES,BLEEDS,COLOURS,FLATSIZE,FINISHSIZE,STOCK,PARENTSHEETSIZE,
         PRESSSHEETSIZE,NUMUP,LAYOUTORIENTATION,COATING,CONTOURCUT,LAMINATION,FINISHING,
         ACCESSORY,SPECIALINSTRUCTIONS,PACKAGELOCATION)
  SELECT
    @ITEMID AS ID,
        PRESS,NUMPAGES,BLEEDS,COLOURS,FLATSIZE,FINISHSIZE,STOCK,PARENTSHEETSIZE,
    PRESSSHEETSIZE,NUMUP,LAYOUTORIENTATION,COATING,CONTOURCUT,LAMINATION,FINISHING,
    ACCESSORY,SPECIALINSTRUCTIONS,PACKAGELOCATION
  FROM
    itemsPrintDefinition
  WHERE
    ID = __ITEMID;        
  
        
  SELECT @ITEMID AS ID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DuplicateShipToAddress` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `DuplicateShipToAddress`(__ID INT)
BEGIN

	INSERT INTO
		shipToAddresses
		(NAME,ADDRESS,CITY,PROVINCE,COUNTRY,POSTAL,PHONE,FAX,TAXGROUP,SHIPZONE)
	SELECT
		NAME,
        ADDRESS,
        CITY,
        PROVINCE,
        COUNTRY,
        POSTAL,
        PHONE,
        FAX,
        TAXGROUP,
        SHIPZONE
	FROM
		shipToAddresses
	WHERE
		ID = __ID;
        
	SELECT @SHIPID := LAST_INSERT_ID() AS ID;
    
    INSERT INTO 
		shipToAddressesUserList
        (ID,USERNAME)
	SELECT
		@SHIPID,
        USERNAME
	FROM
		shipToAddressesUserList
	WHERE
		ID = __ID;
    

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DuplicateUserProfile` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DuplicateUserProfile`(__USERNAME VARCHAR(50), __NEWUSERNAME VARCHAR(50))
BEGIN

	INSERT INTO
		user
        (USERNAME,BRANCH,PASSWORD,PLAINPASSWORD,FIRSTNAME,LASTNAME,EMAIL,LANGUAGE,USERLEVEL,CREATEDDATE,MODIFIEDDATE,STATUS,COMMENTS)
	SELECT
		__NEWUSERNAME AS USERNAME,
        BRANCH,
        PASSWORD,
        PLAINPASSWORD,
        FIRSTNAME,
        LASTNAME,
        EMAIL,
        LANGUAGE,
        USERLEVEL,
        CURRENT_TIMESTAMP AS CREATEDDATE,
        CURRENT_TIMESTAMP AS MODIFIEDDATE,
        STATUS,
        COMMENTS
	FROM
		user
	WHERE
		USERNAME = __USERNAME;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `ExpireDownloadLinks` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ExpireDownloadLinks`()
BEGIN

UPDATE
	orderDetail
SET
	DOWNLOADLINK = NULL
WHERE
	DOWNLOADLINK IS NOT NULL AND
    ORDERID IN (SELECT ORDERID FROM orderHeader WHERE ORDERDATE < DATE_ADD(CURRENT_TIMESTAMP,INTERVAL -30 DAY));



END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_branchAssetDefinition` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_branchAssetDefinition`()
BEGIN
	SELECT * FROM branchAssetDefinition;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_branches` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_branches`()
BEGIN
	SELECT
		*
	FROM
		branches;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_branchesAddresses` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_branchesAddresses`()
BEGIN
	SELECT
		*
	FROM
		branchesAddresses;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_branchesAssetData` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_branchesAssetData`()
BEGIN
	SELECT
		*
	FROM
		branchesAssetData;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_branchesFixtures` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `extractTableData_branchesFixtures`()
BEGIN
	SELECT * FROM branchesFixtures ORDER BY BRANCHCODE,FIXTURECODE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_branchSkinDefinition` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_branchSkinDefinition`()
BEGIN

	SELECT
		*
	FROM
		branchSkinDefinition;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_campaign_fixtures` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `extractTableData_campaign_fixtures`()
BEGIN
	SELECT * FROM campaign_fixtures;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_categories` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_categories`()
BEGIN
	SELECT
		*
	FROM
		categories;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_itemPricing` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_itemPricing`()
BEGIN
SELECT * FROM itemPricing left outer join items on itemPricing.ITEMID = items.ID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_items` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_items`()
BEGIN
SELECT
		*
	FROM
		items;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_itemsBranchesLink` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_itemsBranchesLink`()
BEGIN
SELECT
		*
	FROM
		itemsBranchesLink;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_itemsInventory` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_itemsInventory`()
BEGIN
SELECT
		*
	FROM
		itemsInventory;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_itemsPrintDefinition` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_itemsPrintDefinition`()
BEGIN 
  SELECT items.CODE, items.DESCRIPTION, itemsPrintDefinition.* from itemsPrintDefinition left join items on itemsPrintDefinition.ID = items.ID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_itemsSubcategoryLink` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_itemsSubcategoryLink`()
BEGIN
SELECT
		*
	FROM
		itemsSubcategoryLink;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_newsItems` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_newsItems`()
BEGIN
SELECT
		*
	FROM
		newsItems;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_promos` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_promos`()
BEGIN
	SELECT * FROM promos;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_promosCategories` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `extractTableData_promosCategories`()
BEGIN
SELECT * FROM promosCategories;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_promosItems` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_promosItems`()
BEGIN
	SELECT * FROM promosItems;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_shipToAddresses` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_shipToAddresses`()
BEGIN
	SELECT
		*
	FROM
		shipToAddresses;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_shipToAddressesUserList` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `extractTableData_shipToAddressesUserList`()
BEGIN
SELECT * FROM shipToAddressesUserList;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_shipZoneCosts` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_shipZoneCosts`()
BEGIN
SELECT
		*
	FROM
		shipZoneCosts;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_subcategories` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_subcategories`()
BEGIN
SELECT
		*
	FROM
		subcategories;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_taxes` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_taxes`()
BEGIN
SELECT
		*
	FROM
		taxes;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extractTableData_user` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extractTableData_user`()
BEGIN
SELECT
		*
	FROM
		user;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `extract_TableData_branchAssetDefinition` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `extract_TableData_branchAssetDefinition`()
BEGIN
	SELECT * FROM branchAssetDefinition;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetAccountTicket` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetAccountTicket`(__TICKETID INT)
BEGIN

SELECT 
 HDR.*,
 DTL.*,
 USR.FIRSTNAME,
 USR.LASTNAME,
 UNIX_TIMESTAMP(DTL.DATEENTERED) AS UNIX_DATEENTERED 
FROM 
 accountMgrHeader HDR
LEFT OUTER JOIN
 accountMgrMessages DTL ON 
 HDR.ID = DTL.TICKETID
LEFT OUTER JOIN
user USR ON 
 DTL.ENTEREDBY = USR.USERNAME 
WHERE 
 ID = __TICKETID
ORDER BY
 DTL.DATEENTERED DESC;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetAccountTicketList` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetAccountTicketList`(__USERNAME VARCHAR(50))
BEGIN

	SELECT
		*,
        UNIX_TIMESTAMP(HDR.DATEENTERED) AS UNIX_DATEENTERED
	FROM
		accountMgrHeader HDR
	WHERE
		( HDR.STATUS = 1 OR (HDR.STATUS = 0 AND DATECLOSED >= DATE_ADD(NOW(), INTERVAL -14 DAY)) ) AND
        ( HDR.ENTEREDBY = __USERNAME OR __USERNAME IN (SELECT USERNAME FROM user WHERE USERLEVEL >= 99))
	ORDER BY
		HDR.STATUS DESC,
		HDR.DATEENTERED DESC;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetActiveAdItems` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetActiveAdItems`(__LANGUAGE VARCHAR(2), __SKIN VARCHAR(20))
BEGIN
	SELECT DISTINCT
		ADS.*
	FROM
		AdItems ADS
	INNER JOIN
		AdItemsBrand ADSBRAND ON 
			ADS.ID = ADSBRAND.ID
	WHERE
		(LANGUAGE = '--' OR LANGUAGE = __LANGUAGE) AND
        (ADSBRAND.BRANDNAME = 'ALL' OR ADSBRAND.BRANDNAME = __SKIN) AND
        CURRENT_TIMESTAMP >= STARTDATE AND CURRENT_TIMESTAMP <= ENDDATE
	ORDER BY
		COALESCE(SORTORDER,999);        
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetActiveNewsItems` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetActiveNewsItems`(__LANGUAGE VARCHAR(2))
BEGIN
	SELECT
		*
	FROM
		newsItems
	WHERE
		(LANGUAGE = '--' OR LANGUAGE = __LANGUAGE) AND
        CURRENT_TIMESTAMP >= STARTDATE AND CURRENT_TIMESTAMP <= ENDDATE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetAdBrandInformation` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetAdBrandInformation`(__ID INT)
BEGIN

SELECT 
	BSD.SKINNAME AS BRANDNAME,
    CASE WHEN ADB.BRANDNAME IS NOT NULL THEN 1 ELSE 0 END AS SELECTED
FROM
	(
		SELECT SKINNAME FROM branchSkinDefinition UNION ALL
        SELECT 'ALL' UNION ALL
        SELECT ''
	) BSD
LEFT OUTER JOIN
	(SELECT * FROM AdItemsBrand WHERE ID = __ID ) ADB ON 
		BSD.SKINNAME = ADB.BRANDNAME
ORDER BY 
	BSD.SKINNAME;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetAdItem` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetAdItem`(__ID INT)
BEGIN
	SELECT * FROM AdItems WHERE ID = __ID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetAllAdItems` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetAllAdItems`()
BEGIN
	SELECT 
		*
	FROM	
		AdItems;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetAllNewsItems` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetAllNewsItems`()
BEGIN
	SELECT
		*
	FROM
		newsItems;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetAllShipToAddresses` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetAllShipToAddresses`(__USEBRANCHES BOOLEAN, __USERNAME VARCHAR(30))
BEGIN

  SELECT
    RECTYPE,ID,NAME,ADDRESS,STOREID
  FROM
    (
  SELECT
    'S' AS RECTYPE,SADDR.ID, SADDR.NAME,SADDR.ADDRESS,CASE WHEN IFNULL(SADDR.STOREID,'') = '' THEN 'NA' ELSE STOREID END AS STOREID
  FROM
    shipToAddresses SADDR
  WHERE
    SADDR.ID IN (SELECT ID FROM shipToAddressesUserList WHERE USERNAME = '**ALL**' OR USERNAME = 'ALL' OR USERNAME = __USERNAME) 
        
  UNION ALL
    
    SELECT
    'B' AS RECTYPE,BRANCH.CODE,BRANCH.NAME,BADDR.ADDRESS,BRANCH.CODE AS STOREID
    FROM
    branches BRANCH
  INNER JOIN
    branchesAddresses BADDR ON 
      BRANCH.CODE = BADDR.CODE
  WHERE
    __USEBRANCHES = 1 AND
        BRANCH.STATUS = 1 AND
        BADDR.ISMAIN = 1
    ) ADDR
    ORDER BY
    NAME;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetAvailableShippingZones` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetAvailableShippingZones`()
BEGIN
	SELECT  * FROM shipZoneCosts LIMIT 1;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetBranchAddressInformation` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetBranchAddressInformation`(__CODE VARCHAR(20))
BEGIN
	SELECT
		*
	FROM
		branchesAddresses
	WHERE
		CODE = __CODE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetBranchAssets` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetBranchAssets`(__CODE VARCHAR(20))
BEGIN

	SELECT
		BAD.TAG,
        BAD.TYPE,
        BAD.NAME,
	IFNULL(BAD.VALIDATEPATTERN,'') AS VALIDATEPATTERN,
	IFNULL(BAD.VALIDATEERRORMSG,'') AS VALIDATEERRORMSG,
        IFNULL(BDATA.VALUE,'') AS VALUE
	FROM
		branchAssetDefinition BAD
	LEFT OUTER JOIN
		(SELECT * FROM branchesAssetData WHERE BRANCHCODE = __CODE) BDATA ON 
			BAD.TAG = BDATA.TAG
	ORDER BY
		BAD.DISPLAYORDER;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetBranchDropDown` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetBranchDropDown`()
BEGIN
	SELECT CODE,NAME FROM branches WHERE STATUS = 1 ORDER BY NAME;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetBranchInformation` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetBranchInformation`(__CODE VARCHAR(20))
BEGIN
	SELECT * FROM branches WHERE CODE = __CODE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetBranchProfile` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetBranchProfile`(IN `__USERNAME` VARCHAR(50))
    NO SQL
SELECT
		BRANCH.NAME,
		BADDR.*
	FROM
		branches BRANCH
	INNER JOIN
		branchesAddresses BADDR ON 
			BRANCH.CODE = BADDR.CODE
	WHERE
		ISMAIN = 1 AND
		BRANCH.CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetCartCheckoutInformation` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetCartCheckoutInformation`(__USERNAME VARCHAR(20))
BEGIN

SET SQL_SAFE_UPDATES = 0;

UPDATE
	orderHeader
SET
	ORDERDATE = CURRENT_TIMESTAMP,
    ORDERMODIFIED = CURRENT_TIMESTAMP,
    EXPDATE = DATE_ADD(CURRENT_TIMESTAMP,INTERVAL 8 DAY),
    TAXNAME1 = (SELECT TAXNAME1 FROM taxes TAXES  WHERE SHIPTAXGROUP = TAXES.TAXCODE),
    TAXNAME2 = (SELECT TAXNAME2 FROM taxes TAXES  WHERE SHIPTAXGROUP = TAXES.TAXCODE),
    TAXNAME3 = (SELECT TAXNAME3 FROM taxes TAXES  WHERE SHIPTAXGROUP = TAXES.TAXCODE),
    TAXNAME4 = (SELECT TAXNAME4 FROM taxes TAXES  WHERE SHIPTAXGROUP = TAXES.TAXCODE),
    TAXNAME5 = (SELECT TAXNAME5 FROM taxes TAXES  WHERE SHIPTAXGROUP = TAXES.TAXCODE),
    TAXRATE1 = (SELECT TAXRATE1 FROM taxes TAXES  WHERE SHIPTAXGROUP = TAXES.TAXCODE),
    TAXRATE2 = (SELECT TAXRATE2 FROM taxes TAXES  WHERE SHIPTAXGROUP = TAXES.TAXCODE),
    TAXRATE3 = (SELECT TAXRATE3 FROM taxes TAXES  WHERE SHIPTAXGROUP = TAXES.TAXCODE),
    TAXRATE4 = (SELECT TAXRATE4 FROM taxes TAXES  WHERE SHIPTAXGROUP = TAXES.TAXCODE),
    TAXRATE5 = (SELECT TAXRATE5 FROM taxes TAXES  WHERE SHIPTAXGROUP = TAXES.TAXCODE)
WHERE 
	USERNAME  = __USERNAME AND 
    ORDERSTATUS = 'CART';

UPDATE 
	orderDetail I 
INNER JOIN 
(
	SELECT
		DTL.ITEMLINE,
        DTL.EXTPRICE * HDR.TAXRATE1 AS TAXAMT1,
        DTL.EXTPRICE * HDR.TAXRATE2 AS TAXAMT2,
        DTL.EXTPRICE * HDR.TAXRATE3 AS TAXAMT3,
        DTL.EXTPRICE * HDR.TAXRATE4 AS TAXAMT4,
        DTL.EXTPRICE * HDR.TAXRATE5 AS TAXAMT5
	FROM
		orderHeader HDR
	INNER JOIN
		orderDetail DTL ON
			HDR.ORDERID = DTL.ORDERID
	WHERE
		USERNAME = __USERNAME AND 
		ORDERSTATUS = 'CART'		
) II ON 
	I.ITEMLINE = II.ITEMLINE
SET
	I.TAXAMT1 = II.TAXAMT1,
    I.TAXAMT2 = II.TAXAMT2,
    I.TAXAMT3 = II.TAXAMT3,
    I.TAXAMT4 = II.TAXAMT4,
    I.TAXAMT5 = II.TAXAMT5
;

SELECT
	HDR.*,
    DTL.*,
    ITEM.*,
    COALESCE(SGROUP.SGRPNAME,'') AS SGRPNAME,
    COALESCE(SGROUP.SGRPPIECES,1) AS SGRPPIECES,
    COALESCE(SGROUP.SGRPBOXTYPE,'') AS SGRPBOXTYPE,
    COALESCE(SGROUP.SGRPWEIGHTPIECE,1.0) AS SGRPWEIGHTPIECE
FROM
	orderHeader HDR
INNER JOIN
	orderDetail DTL ON 
		HDR.ORDERID = DTL.ORDERID
INNER JOIN
	items ITEM ON 
		DTL.ITEMID = ITEM.ID
LEFT OUTER JOIN
	shippingGroupItems SGROUPITEMS ON 
		ITEM.ID = SGROUPITEMS.ITEMID
LEFT OUTER JOIN 
	shippingGroup SGROUP ON 
		SGROUPITEMS.SGRPNAME = SGROUP.SGRPNAME
WHERE 
	USERNAME  = __USERNAME AND 
    ORDERSTATUS = 'CART';
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetCartDiscountCodes` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetCartDiscountCodes`(__ORDERID INT)
BEGIN
	SELECT * FROM orderPromos WHERE ORDERID = __ORDERID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetCartItems` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetCartItems`(__USERNAME NVARCHAR(20))
BEGIN

SELECT 
	DTL.*
FROM 
	orderHeader HDR
INNER JOIN
	orderDetail DTL ON 
		HDR.ORDERID = DTL.ORDERID
WHERE 
	USERNAME COLLATE utf8_unicode_ci = __USERNAME AND 
    ORDERSTATUS = 'CART';


END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetCategoriesBySearchTerm` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetCategoriesBySearchTerm`(__TERM VARCHAR(50))
BEGIN

SELECT
  CATID,
    CONCAT(NAME, ' - ', DESCRIPTION) AS CATNAME
FROM
  categories
WHERE
  (
  NAME LIKE CONCAT('%',__TERM,'%') OR 
    DESCRIPTION LIKE CONCAT('%',__TERM,'%')
    ) 
ORDER BY 
  NAME,DESCRIPTION
LIMIT 20;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetCategoriesListByUsername` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetCategoriesListByUsername`(__USERNAME VARCHAR(50))
BEGIN
	SELECT
		CATS.*
	FROM
		categories CATS
	CROSS JOIN
		( SELECT * FROM user WHERE USERNAME = __USERNAME) USERS
	WHERE
		USERS.USERLEVEL >= CATS.USERLEVEL AND
        CATS.LANGUAGE IN (SELECT BADDR.LANGUAGE FROM user USERS INNER JOIN branchesAddresses BADDR ON USERS.BRANCH = BADDR.CODE  WHERE USERS.USERNAME = __USERNAME) AND
        CATS.CATID IN (
						SELECT CC.CATID 
						FROM categories CC 
                        INNER JOIN categoriesBrand CCC ON CC.CATID = CCC.CATID
                        INNER JOIN ( SELECT SKIN FROM branches BB INNER JOIN user UU ON BB.CODE = UU.BRANCH WHERE USERNAME = __USERNAME) UBS ON 
							(UBS.SKIN = CCC.BRANDNAME OR CCC.BRANDNAME = 'ALL')
                            )
	ORDER BY
		CATS.NAME
	;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetCategoryAndSubCatDropDown` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetCategoryAndSubCatDropDown`()
BEGIN
	SELECT
		SUBCATS.SUBCATID,
		CASE 
			WHEN SUBCATS_2.SUBCATID IS NOT NULL THEN CONCAT(CATS.NAME," - ", SUBCATS_2.NAME," - ",SUBCATS.NAME)
            ELSE CONCAT(CATS.NAME," - ",SUBCATS.NAME) 
		END AS  NAME
	FROM
		categories CATS
	INNER JOIN
		subcategories SUBCATS ON 
			CATS.CATID = SUBCATS.CATID
	LEFT OUTER JOIN
		subcategories SUBCATS_2 ON 
			SUBCATS.PARENTSUBCATID = SUBCATS_2.SUBCATID
	WHERE
		SUBCATS.SUBCATID NOT IN (SELECT DISTINCT PARENTSUBCATID FROM subcategories)
	ORDER BY
		CATS.NAME,
		SUBCATS_2.NAME,
        SUBCATS.NAME
	;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetCategoryBrandInformation` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetCategoryBrandInformation`(__CATID INT)
BEGIN

SELECT 
	BSD.SKINNAME AS BRANDNAME,
    CASE WHEN CB.BRANDNAME IS NOT NULL THEN 1 ELSE 0 END AS SELECTED
FROM
	(
		SELECT SKINNAME FROM branchSkinDefinition UNION ALL
        SELECT 'ALL' UNION ALL
        SELECT ''
	) BSD
LEFT OUTER JOIN
	(SELECT * FROM categoriesBrand WHERE CATID = __CATID ) CB ON 
		BSD.SKINNAME = CB.BRANDNAME
ORDER BY 
	BSD.SKINNAME;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetCategoryInformation` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetCategoryInformation`(__CATID INTEGER)
BEGIN
	SELECT * FROM categories WHERE CATID = __CATID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetCategoryItems` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetCategoryItems`(__USERNAME VARCHAR(50), __CATID INT, __SUBCATID INT)
BEGIN
    SELECT 
        CATS.NAME AS CATNAME,
        CATS.DESCRIPTION AS CATDESC,
        CASE WHEN ITEMS.TYPE = 2 THEN -99 ELSE SUBCATS.SUBCATID END AS SUBCATID,
        CASE WHEN ITEMS.TYPE = 2 THEN '{{!GENERATE!}}' ELSE SUBCATS.NAME END AS SUBCATNAME,
        CASE WHEN ITEMS.TYPE = 2 THEN CONCAT('{{!CUST_ART!}} ',SUBCATS.NAME) ELSE SUBCATS.DESCRIPTION END AS SUBCATDESC,
      SUBCATS.SUBCATID AS REALSUBCATID,
        ITEMS.ID AS ITEMID,
        ITEMS.CODE AS ITEMCODE,
        ITEMS.DESCRIPTION AS ITEMDESC,
        ITEMS.DISPLAYIMAGEPATH,
        ITEMS.PROOFPDFNAME,
        ITEMS.SIZE,
        ITEMS.NUMPAGES,
        ITEMS.MINLEVEL,
        ITEMS.STATUS,
        ITEMS.TYPE AS ITEMTYPE,
        COALESCE(ONORDERSTAT.TOTORDERQTY,0) AS ONORDER, 
        COALESCE(DATE(ONORDERSTAT.ORDERDATE),'') AS LASTORDERED,
        CASE WHEN ITEMS.TYPE = 3 THEN 1 WHEN BRANCHLINK.ITEMID IS NULL THEN 0 ELSE 1 END AS PARTOFBRANCH,
        COALESCE(ITEMINV.QTYONHAND,0) AS INSTOCK,
        ITEMS.ASSETAPPROVED
    FROM
        categories CATS
    LEFT OUTER JOIN
        subcategories SUBCATS ON 
            CATS.CATID = SUBCATS.CATID
    LEFT OUTER JOIN
        itemsSubcategoryLink SCTOI ON
            SCTOI.SUBCATID = SUBCATS.SUBCATID
    LEFT OUTER JOIN
        items ITEMS ON 
            ITEMS.ID = SCTOI.ITEMID
    LEFT OUTER JOIN
    
    (SELECT DISTINCT 
        ITEMID 
     FROM
        (
            SELECT 
                ITOB.ITEMID 
            FROM 
                user USERS 
            INNER JOIN 
                itemsBranchesLink ITOB ON USERS.BRANCH = ITOB.BRANCHCODE 
            WHERE 
                USERS.USERNAME = __USERNAME
                
            UNION ALL 
            SELECT ITOB.ITEMID FROM itemsBranchesLink ITOB WHERE ITOB.BRANCHCODE = 'ALL_BRANCHES'
            
            UNION ALL
            SELECT ITOB.ITEMID FROM user UU INNER JOIN branches BB ON UU.BRANCH = BB.CODE
            INNER JOIN itemsBranchesLink ITOB ON CONCAT('BRN_',BB.SKIN) = ITOB.BRANCHCODE 
            WHERE UU.USERNAME = __USERNAME
        ) LINKS
    )  BRANCHLINK ON 
            BRANCHLINK.ITEMID = ITEMS.ID
    LEFT OUTER JOIN
        (SELECT ITEMID, SUM(CASE WHEN ORDERQTY-SHIPTODATEQTY < 0 THEN 0 ELSE ORDERQTY-SHIPTODATEQTY END) AS TOTORDERQTY, MAX(ORDERDATE) AS ORDERDATE FROM orderHeader HDR INNER JOIN orderDetail DTL ON HDR.ORDERID = DTL.ORDERID WHERE ORDERSTATUS NOT IN ('WAITMA','CART', 'CANCELLED') GROUP BY ITEMID) ONORDERSTAT ON
            ONORDERSTAT.ITEMID = SCTOI.ITEMID  
    LEFT OUTER JOIN
        itemsInventory ITEMINV ON 
            ITEMS.ID = ITEMINV.ITEMID
    CROSS JOIN
        ( SELECT * FROM user WHERE USERNAME = __USERNAME) USERS                
    WHERE
        (__SUBCATID = -1 OR __SUBCATID = SUBCATS.SUBCATID OR __SUBCATID = SUBCATS.PARENTSUBCATID) AND
        CATS.CATID = __CATID AND
        IFNULL(ITEMS.ARCHIVED,0) = 0 AND
        (BRANCHLINK.ITEMID IS NOT NULL OR (ITEMS.TYPE = 3 AND __USERNAME IN (SELECT USERNAME FROM user WHERE USERLEVEL >= 99))) AND
        USERS.USERLEVEL >= CATS.USERLEVEL AND
        USERS.USERLEVEL >= SUBCATS.USERLEVEL 
    ORDER BY
        CASE WHEN ITEMS.TYPE = 2 THEN 1 ELSE 99 END, 
        SUBCATS.NAME,
        CASE WHEN PARENTITEM = 0 THEN 1 ELSE 99 END, 
        ITEMS.CODE
    ;
    



END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetCategorySubcategoryTiles` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetCategorySubcategoryTiles`(__USERNAME VARCHAR(50), __CATID INT)
BEGIN

    SELECT
        CATS.CATID,
        CATS.NAME AS CATNAME,
        CATS.DESCRIPTION AS CATDESC,
        SUBCATS.SUBCATID  AS SUBCATID,
        SUBCATS.NAME  AS SUBCATNAME,
        SUBCATS.DESCRIPTION  AS SUBCATDESC,
        SUBCATS.ICONURL AS SUBCATICONURL
    FROM
        categories CATS
    LEFT OUTER JOIN
        subcategories SUBCATS ON 
            CATS.CATID = SUBCATS.CATID  
    CROSS JOIN
        ( SELECT * FROM user WHERE USERNAME = __USERNAME) USERS            
    WHERE
        CATS.CATID = __CATID AND
        SUBCATS.PARENTSUBCATID = -1 AND
        USERS.USERLEVEL >= CATS.USERLEVEL AND
        USERS.USERLEVEL >= SUBCATS.USERLEVEL
    ORDER BY
        SUBCATS.NAME
    ;            

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetDownloadFileData` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetDownloadFileData`(__ID VARCHAR(200))
BEGIN
	SELECT * FROM ticketAttachment WHERE STOREFILENAME = __ID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetDownloadItem` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetDownloadItem`(__DOWNLOADLINK VARCHAR(100))
BEGIN

SELECT
  ITEM.*,
    OH.USERNAME
FROM
  orderDetail OD
INNER JOIN
  items ITEM ON 
    ITEM.ID = OD.ITEMID
INNER JOIN 
  orderHeader OH ON OD.ORDERID = OH.ORDERID
WHERE
  OD.DOWNLOADLINK = __DOWNLOADLINK;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetDownloadLog` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetDownloadLog`()
BEGIN
	SELECT 
		LOG.*,
        ITEM.CODE AS ITEMCODE,
        ITEM.DESCRIPTION AS ITEMDESCRIPTION
	FROM
		downloadLog LOG
	INNER JOIN
		items ITEM ON 
			LOG.ITEMID = ITEM.ID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetFaqBySearchTerm` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetFaqBySearchTerm`(__TERM VARCHAR(50),__LANG VARCHAR(2))
BEGIN

  SELECT 
    ID,
        CASE WHEN __LANG = 'EN' THEN NAMEEN ELSE NAMEFR END AS NAME 
  FROM
    faq 
  WHERE
    (
    ID = __TERM OR 
        ( __LANG = 'EN' AND NAMEEN LIKE CONCAT('%',__TERM,'%')) OR 
        ( __LANG = 'FR' AND NAMEFR LIKE CONCAT('%',__TERM,'%')) OR 
        ( __LANG = 'EN' AND CONTENTEN LIKE CONCAT('%',__TERM,'%')) OR 
        ( __LANG = 'FR' AND CONTENTFR LIKE CONCAT('%',__TERM,'%'))
    )
  ORDER BY 
    NAMEEN
  LIMIT 20;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetGeneratorBranchVariables` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetGeneratorBranchVariables`(__USERNAME VARCHAR(50))
BEGIN

SELECT
	'Param-BranchName' AS TAG,
    NAME AS TAGVALUE
FROM
	branches
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) 

UNION ALL

SELECT
	'Param-Address1' AS TAG,
    ADDRESS AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    ISMAIN = 1
    
UNION ALL

SELECT
	'Param-Address1Ext' AS TAG,
    ADDRESS2 AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    ISMAIN = 1    

UNION ALL

SELECT
	'Param-Address2' AS TAG,
    CONCAT(CITY,', ',PROVINCE,', ', COUNTRY, '  ', POSTALCODE) AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    ISMAIN = 1

UNION ALL

SELECT
	'Param-City' AS TAG,
    CITY AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    ISMAIN = 1
   
UNION ALL
   
SELECT
	'Param-Prov' AS TAG,
    PROVINCE AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    ISMAIN = 1   
    
UNION ALL
   
SELECT
	'Param-Country' AS TAG,
    COUNTRY AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    ISMAIN = 1      

UNION ALL

SELECT
	'Param-CityProvPostal' AS TAG,
    CONCAT(CITY,', ',PROVINCE,' ', POSTALCODE) AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    ISMAIN = 1
    
UNION ALL

SELECT
	'Param-CityProv' AS TAG,
    CONCAT(CITY,', ',PROVINCE) AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    ISMAIN = 1 
    
UNION ALL

SELECT
	'Param-Postal' AS TAG,
    POSTALCODE AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    ISMAIN = 1      

UNION ALL

SELECT
	'Param-AddressAll' AS TAG,
    CONCAT(ADDRESS, ', ', CITY,', ',PROVINCE, '  ', POSTALCODE) AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    ISMAIN = 1

UNION ALL

SELECT
	'Param-BranchPhone' AS TAG,
    PHONE AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    ISMAIN = 1
    
UNION ALL

SELECT
	'Param-BranchFax' AS TAG,
    FAX AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    ISMAIN = 1    

UNION ALL
   
SELECT
	'Param-Address1EN' AS TAG,
    ADDRESS AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'EN'
    
UNION ALL
   
SELECT
	'Param-Address1ExtEN' AS TAG,
    ADDRESS2 AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'EN'    

UNION ALL

SELECT
	'Param-Address2EN' AS TAG,
    CONCAT(CITY,', ',PROVINCE,', ', COUNTRY, '  ', POSTALCODE) AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'EN' 
    
UNION ALL

SELECT
	'Param-AddressAllEN' AS TAG,
    CONCAT(ADDRESS, ', ', CITY,', ',PROVINCE, '  ', POSTALCODE) AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'EN' 

UNION ALL

SELECT
	'Param-CityEN' AS TAG,
    CITY AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'EN' 

UNION ALL
   
SELECT
	'Param-ProvEN' AS TAG,
    PROVINCE AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'EN'   
    
UNION ALL
   
SELECT
	'Param-CountryEN' AS TAG,
    COUNTRY AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'EN'   

UNION ALL

SELECT
	'Param-CityProvPostalEN' AS TAG,
    CONCAT(CITY,', ',PROVINCE,' ', POSTALCODE) AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'EN' 
    
UNION ALL

SELECT
	'Param-CityProvEN' AS TAG,
    CONCAT(CITY,', ',PROVINCE) AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'EN'   
    
UNION ALL

SELECT
	'Param-PostalEN' AS TAG,
    POSTALCODE AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'EN'      

UNION ALL

SELECT
	'Param-BranchPhoneEN' AS TAG,
    PHONE AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'EN'
    
UNION ALL

SELECT
	'Param-BranchFaxEN' AS TAG,
    FAX AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'EN'    

UNION ALL
   
SELECT
	'Param-Address1FR' AS TAG,
    ADDRESS AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'FR'
    
UNION ALL
   
SELECT
	'Param-Address1ExtFR' AS TAG,
    ADDRESS2 AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'FR'    

UNION ALL

SELECT
	'Param-Address2FR' AS TAG,
    CONCAT(CITY,', ',PROVINCE,', ', COUNTRY, '  ', POSTALCODE) AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'FR'    
    
UNION ALL

SELECT
	'Param-AddressAllFR' AS TAG,
    CONCAT(ADDRESS, ', ', CITY,', ',PROVINCE, '  ', POSTALCODE) AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'FR'     
 
UNION ALL

SELECT
	'Param-CityFR' AS TAG,
    CITY AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'FR'  

UNION ALL
   
SELECT
	'Param-ProvFR' AS TAG,
    PROVINCE AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'FR'   
    
UNION ALL
   
SELECT
	'Param-CountryFR' AS TAG,
    COUNTRY AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'FR'   
 
UNION ALL

SELECT
	'Param-CityProvPostalFR' AS TAG,
    CONCAT(CITY,', ',PROVINCE,' ', POSTALCODE) AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'FR' 
    
UNION ALL

SELECT
	'Param-CityProvFR' AS TAG,
    CONCAT(CITY,', ',PROVINCE) AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'FR'  
    
UNION ALL

SELECT
	'Param-PostalFR' AS TAG,
    POSTALCODE AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'FR'       
    
UNION ALL

SELECT
	'Param-BranchPhoneFR' AS TAG,
    PHONE AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'FR'
    
UNION ALL

SELECT
	'Param-BranchFaxFR' AS TAG,
    FAX AS TAGVALUE
FROM
	branchesAddresses
WHERE
	CODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME) AND
    LANGUAGE = 'FR'    

UNION ALL

SELECT
	CONCAT('Param-',TAG) AS TAG,
	VALUE
FROM
	branchesAssetData
WHERE
	BRANCHCODE IN (SELECT BRANCH FROM user WHERE USERNAME = __USERNAME);


END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetInventoryData` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetInventoryData`(__INVTYPE INT)
BEGIN

IF __INVTYPE = 1 THEN
	
	SELECT
		ITEMS.ID,
        ITEMS.CODE,
        ITEMS.DESCRIPTION,
        COALESCE(INV.QTYONHAND,0) AS STOCK,
        COALESCE(ONORDERSTAT.TOTORDERQTY,0) AS ONORDER, 
        ITEMS.MINLEVEL,
        COALESCE(DATE(ONORDERSTAT.ORDERDATE),'') AS LASTORDERED,
        COALESCE(DATE(SHIPSTAT.SHIPDATE),'') AS LASTSHIPPED,
        COALESCE(SUBCATNAME.NAME,'') AS L2CAT,
		COALESCE(SUBCATNAME1.NAME,'') AS L1CAT,
		COALESCE(CAT1.NAME,'') AS L0CAT        
	FROM
		items ITEMS
	LEFT OUTER JOIN
		itemsInventory INV ON 
			ITEMS.ID = INV.ITEMID
	LEFT OUTER JOIN
		(SELECT ITEMID, SUM(ORDERQTY-SHIPTODATEQTY) AS TOTORDERQTY, MAX(ORDERDATE) AS ORDERDATE FROM orderHeader HDR INNER JOIN orderDetail DTL ON HDR.ORDERID = DTL.ORDERID WHERE ORDERSTATUS NOT IN ('WAITMA','CART') GROUP BY ITEMID) ONORDERSTAT ON
			ONORDERSTAT.ITEMID = ITEMS.ID
	LEFT OUTER JOIN
		(SELECT ITEMID, MAX(SHIPDATE) AS SHIPDATE FROM orderHeader HDR INNER JOIN orderDetail DTL ON HDR.ORDERID = DTL.ORDERID INNER JOIN shipmentDetail SDTL ON DTL.ORDERID = SDTL.ORDERID AND DTL.ITEMLINE = SDTL.ORDERLINE INNER JOIN shipmentHeader SHDR ON SDTL.SHIPID = SHDR.SHIPID WHERE ORDERSTATUS NOT IN ('WAITMA','CART') GROUP BY ITEMID) SHIPSTAT ON
			SHIPSTAT.ITEMID = ITEMS.ID   
	LEFT OUTER JOIN 
		(SELECT ITEMID,MIN(SUBCATID) AS SUBCATID FROM itemsSubcategoryLink GROUP BY ITEMID) SUBCAT ON 
			ITEMS.ID = SUBCAT.ITEMID
	LEFT OUTER JOIN 
		subcategories SUBCATNAME ON 
			SUBCAT.SUBCATID = SUBCATNAME.SUBCATID
	LEFT OUTER JOIN 
		subcategories SUBCATNAME1 ON 
			SUBCATNAME.PARENTSUBCATID = SUBCATNAME1.SUBCATID            
	LEFT OUTER JOIN 
		categories CAT1 ON 
			SUBCATNAME.CATID = CAT1.CATID 
	;
	
ELSEIF __INVTYPE = 2 THEN 
	
	SELECT
		ITEMS.ID,
        ITEMS.CODE,
        ITEMS.DESCRIPTION,
        COALESCE(INV.QTYONHAND,0) AS STOCK,
        COALESCE(ONORDERSTAT.TOTORDERQTY,0) AS ONORDER, 
        ITEMS.MINLEVEL,
        COALESCE(DATE(ONORDERSTAT.ORDERDATE),'') AS LASTORDERED,
        COALESCE(DATE(SHIPSTAT.SHIPDATE),'') AS LASTSHIPPED,
        COALESCE(SUBCATNAME.NAME,'') AS L2CAT,
		COALESCE(SUBCATNAME1.NAME,'') AS L1CAT,
		COALESCE(CAT1.NAME,'') AS L0CAT        
	FROM
		items ITEMS
	INNER JOIN
		itemsInventory INV ON 
			ITEMS.ID = INV.ITEMID
	LEFT OUTER JOIN
		(SELECT ITEMID, SUM(ORDERQTY-SHIPTODATEQTY) AS TOTORDERQTY, MAX(ORDERDATE) AS ORDERDATE FROM orderHeader HDR INNER JOIN orderDetail DTL ON HDR.ORDERID = DTL.ORDERID WHERE ORDERSTATUS NOT IN ('WAITMA','CART') GROUP BY ITEMID) ONORDERSTAT ON
			ONORDERSTAT.ITEMID = ITEMS.ID 
	LEFT OUTER JOIN
		(SELECT ITEMID, MAX(SHIPDATE) AS SHIPDATE FROM orderHeader HDR INNER JOIN orderDetail DTL ON HDR.ORDERID = DTL.ORDERID INNER JOIN shipmentDetail SDTL ON DTL.ORDERID = SDTL.ORDERID AND DTL.ITEMLINE = SDTL.ORDERLINE INNER JOIN shipmentHeader SHDR ON SDTL.SHIPID = SHDR.SHIPID WHERE ORDERSTATUS NOT IN ('WAITMA','CART') GROUP BY ITEMID) SHIPSTAT ON
			SHIPSTAT.ITEMID = ITEMS.ID
	LEFT OUTER JOIN 
		(SELECT ITEMID,MIN(SUBCATID) AS SUBCATID FROM itemsSubcategoryLink GROUP BY ITEMID) SUBCAT ON 
			ITEMS.ID = SUBCAT.ITEMID
	LEFT OUTER JOIN 
		subcategories SUBCATNAME ON 
			SUBCAT.SUBCATID = SUBCATNAME.SUBCATID
	LEFT OUTER JOIN 
		subcategories SUBCATNAME1 ON 
			SUBCATNAME.PARENTSUBCATID = SUBCATNAME1.SUBCATID            
	LEFT OUTER JOIN 
		categories CAT1 ON 
			SUBCATNAME.CATID = CAT1.CATID             
	WHERE 
		INV.QTYONHAND > 0;
        
        
ELSEIF __INVTYPE = 3 THEN
	
	SELECT
		ITEMS.ID,
        ITEMS.CODE,
        ITEMS.DESCRIPTION,
        COALESCE(INV.QTYONHAND,0) AS STOCK,
        COALESCE(ONORDERSTAT.TOTORDERQTY,0) AS ONORDER, 
        ITEMS.MINLEVEL,
        COALESCE(DATE(ONORDERSTAT.ORDERDATE),'') AS LASTORDERED,
        COALESCE(DATE(SHIPSTAT.SHIPDATE),'') AS LASTSHIPPED,
        COALESCE(SUBCATNAME.NAME,'') AS L2CAT,
		COALESCE(SUBCATNAME1.NAME,'') AS L1CAT,
		COALESCE(CAT1.NAME,'') AS L0CAT        
	FROM
		items ITEMS
	INNER JOIN
		itemsInventory INV ON 
			ITEMS.ID = INV.ITEMID
	LEFT OUTER JOIN
		(SELECT ITEMID, SUM(ORDERQTY-SHIPTODATEQTY) AS TOTORDERQTY, MAX(ORDERDATE) AS ORDERDATE FROM orderHeader HDR INNER JOIN orderDetail DTL ON HDR.ORDERID = DTL.ORDERID WHERE ORDERSTATUS NOT IN ('WAITMA','CART') GROUP BY ITEMID) ONORDERSTAT ON
			ONORDERSTAT.ITEMID = ITEMS.ID  
	LEFT OUTER JOIN
		(SELECT ITEMID, MAX(SHIPDATE) AS SHIPDATE FROM orderHeader HDR INNER JOIN orderDetail DTL ON HDR.ORDERID = DTL.ORDERID INNER JOIN shipmentDetail SDTL ON DTL.ORDERID = SDTL.ORDERID AND DTL.ITEMLINE = SDTL.ORDERLINE INNER JOIN shipmentHeader SHDR ON SDTL.SHIPID = SHDR.SHIPID WHERE ORDERSTATUS NOT IN ('WAITMA','CART') GROUP BY ITEMID) SHIPSTAT ON
			SHIPSTAT.ITEMID = ITEMS.ID
	LEFT OUTER JOIN 
		(SELECT ITEMID,MIN(SUBCATID) AS SUBCATID FROM itemsSubcategoryLink GROUP BY ITEMID) SUBCAT ON 
			ITEMS.ID = SUBCAT.ITEMID
	LEFT OUTER JOIN 
		subcategories SUBCATNAME ON 
			SUBCAT.SUBCATID = SUBCATNAME.SUBCATID
	LEFT OUTER JOIN 
		subcategories SUBCATNAME1 ON 
			SUBCATNAME.PARENTSUBCATID = SUBCATNAME1.SUBCATID            
	LEFT OUTER JOIN 
		categories CAT1 ON 
			SUBCATNAME.CATID = CAT1.CATID             
	WHERE 
		INV.QTYONHAND <= 0;

ELSE

	
	SELECT
		ITEMS.ID,
        ITEMS.CODE,
        ITEMS.DESCRIPTION,
        COALESCE(INV.QTYONHAND,0) AS STOCK,
        COALESCE(ONORDERSTAT.TOTORDERQTY,0) AS ONORDER, 
        ITEMS.MINLEVEL,
        COALESCE(DATE(ONORDERSTAT.ORDERDATE),'') AS LASTORDERED,
        COALESCE(DATE(SHIPSTAT.SHIPDATE),'') AS LASTSHIPPED,
        COALESCE(SUBCATNAME.NAME,'') AS L2CAT,
		COALESCE(SUBCATNAME1.NAME,'') AS L1CAT,
		COALESCE(CAT1.NAME,'') AS L0CAT        
	FROM
		items ITEMS
	INNER JOIN
		itemsInventory INV ON 
			ITEMS.ID = INV.ITEMID
	LEFT OUTER JOIN
		(SELECT ITEMID, SUM(ORDERQTY-SHIPTODATEQTY) AS TOTORDERQTY, MAX(ORDERDATE) AS ORDERDATE FROM orderHeader HDR INNER JOIN orderDetail DTL ON HDR.ORDERID = DTL.ORDERID WHERE ORDERSTATUS NOT IN ('WAITMA','CART') GROUP BY ITEMID) ONORDERSTAT ON
			ONORDERSTAT.ITEMID = ITEMS.ID   
	LEFT OUTER JOIN
		(SELECT ITEMID, MAX(SHIPDATE) AS SHIPDATE FROM orderHeader HDR INNER JOIN orderDetail DTL ON HDR.ORDERID = DTL.ORDERID INNER JOIN shipmentDetail SDTL ON DTL.ORDERID = SDTL.ORDERID AND DTL.ITEMLINE = SDTL.ORDERLINE INNER JOIN shipmentHeader SHDR ON SDTL.SHIPID = SHDR.SHIPID WHERE ORDERSTATUS NOT IN ('WAITMA','CART') GROUP BY ITEMID) SHIPSTAT ON
			SHIPSTAT.ITEMID = ITEMS.ID 
	LEFT OUTER JOIN 
		(SELECT ITEMID,MIN(SUBCATID) AS SUBCATID FROM itemsSubcategoryLink GROUP BY ITEMID) SUBCAT ON 
			ITEMS.ID = SUBCAT.ITEMID
	LEFT OUTER JOIN 
		subcategories SUBCATNAME ON 
			SUBCAT.SUBCATID = SUBCATNAME.SUBCATID
	LEFT OUTER JOIN 
		subcategories SUBCATNAME1 ON 
			SUBCATNAME.PARENTSUBCATID = SUBCATNAME1.SUBCATID            
	LEFT OUTER JOIN 
		categories CAT1 ON 
			SUBCATNAME.CATID = CAT1.CATID             
	WHERE 
		INV.QTYONHAND < ITEMS.MINLEVEL;

END IF;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetInventoryMovementHistory` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetInventoryMovementHistory`(IN `__STARTDATE` DATE, IN `__ENDDATE` DATE)
BEGIN
	SELECT
		ITEM.ID,
        ITEM.CODE,
        ITEM.DESCRIPTION,
        LOG.ADJID,
        LOG.QTY,
        CAST(LOG.ADJDATE AS DATE) AS ADJDATE,
        LOG.REASON
	FROM
		items ITEM
	INNER JOIN
		itemsAdjustmentLog LOG ON 
			ITEM.ID = LOG.ITEMID
	WHERE
		LOG.ADJDATE BETWEEN __STARTDATE AND DATE_ADD(__ENDDATE,INTERVAL 1 DAY) AND
            ITEM.TYPE = 0
	ORDER BY
		ITEM.ID,
        LOG.ADJDATE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetItemBranches` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetItemBranches`(__ITEMID INT)
BEGIN
	SELECT
		*
	FROM
		itemsBranchesLink
	WHERE
		ITEMID = __ITEMID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetItemCategories` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetItemCategories`(__ITEMID INT)
BEGIN
	SELECT
		*
	FROM
		itemsSubcategoryLink
	WHERE
		ITEMID = __ITEMID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetItemData` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetItemData`(__ITEMID INT)
BEGIN
	SELECT * FROM items WHERE ID = __ITEMID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetItemDataByConfirmCode` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetItemDataByConfirmCode`(__CODE VARCHAR(200))
BEGIN
	SELECT * FROM items WHERE APPROVALLINK = __CODE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetItemPricing` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetItemPricing`(__ITEMID INT)
BEGIN


	SELECT
		*,
        ROUND((LENGTH*WIDTH*HEIGHT)/172 * PIECES,0) AS DIMWEIGHT
	FROM
		itemPricing
	WHERE
		ITEMID = __ITEMID
	ORDER BY 
		CASE WHEN QTY = -2 THEN 9999 ELSE QTY END;  
        
        
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetItemsBySearchTerm` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetItemsBySearchTerm`(__TERM VARCHAR(50))
BEGIN

SELECT
	ID,
    CONCAT(CODE, ' - ', DESCRIPTION) AS ITEMNAME
FROM
	items
WHERE
	(
	CODE LIKE CONCAT('%',__TERM,'%') OR 
    DESCRIPTION LIKE CONCAT('%',__TERM,'%')
    ) AND
    TYPE NOT IN (3)
ORDER BY 
	CODE,DESCRIPTION
LIMIT 20;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetItemZonePricing` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetItemZonePricing`(__ITEMID INT, __QTY INT, __BRANCH VARCHAR(20), __ITEMOPTION VARCHAR(30))
BEGIN

 SET @BRANCHZONE := (SELECT SHIPZONE FROM branches WHERE CODE = __BRANCH);
 SET @ITEMWEIGHT := (SELECT CASE WHEN ROUND((LENGTH*WIDTH*HEIGHT)/172 * PIECES,0) > WEIGHT THEN ROUND((LENGTH*WIDTH*HEIGHT)/172 * PIECES,0) ELSE WEIGHT END AS WEIGHT FROM itemPricing WHERE ITEMID = __ITEMID AND (QTY = __QTY OR QTY = -1 OR QTY = -2) AND ITEMOPTION = __ITEMOPTION ORDER BY QTY DESC LIMIT 1);

 SELECT
 @BRANCHZONE AS BRANCHZONE,
		ZONECOSTS.*
	FROM
		shipZoneCosts ZONECOSTS
	WHERE
		ZONECOSTS.WEIGHT <= @ITEMWEIGHT
	ORDER BY
		WEIGHT DESC;	

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetNewsItem` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetNewsItem`(__ID INTEGER)
BEGIN
	SELECT * FROM newsItems WHERE ID = __ID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetOrderDataForShipment` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetOrderDataForShipment`(__ORDERID INT)
BEGIN
	SELECT
		HDR.*,
        DTL.*,
        ITEM.*,
        DATE(ORDERDATE) AS FMTORDERDATE,
        DATE(EXPDATE) AS FMTEXPDATE,
		USER.FIRSTNAME AS USER_FIRSTNAME,
		USER.LASTNAME AS USER_LASTNAME,
		USER.EMAIL AS USER_EMAIL,
		USER.LANGUAGE AS USER_LANGUAGE
	FROM
		orderHeader HDR
	INNER JOIN
		orderDetail DTL ON 
			HDR.ORDERID = DTL.ORDERID
	LEFT OUTER JOIN
		items ITEM ON 
			DTL.ITEMID = ITEM.ID
	INNER JOIN
		user USER ON 
			HDR.USERNAME = USER.USERNAME            
	WHERE 
		HDR.ORDERID = __ORDERID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetOrderInformationForEmail` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetOrderInformationForEmail`(__USERNAME VARCHAR(100), __ORDERID INT)
BEGIN

SELECT
	HDR.*,
    DTL.*,
    ITEM.TYPE,
    USER.FIRSTNAME AS USER_FIRSTNAME,
    USER.LASTNAME AS USER_LASTNAME,
    USER.EMAIL AS USER_EMAIL,
    USER.LANGUAGE AS USER_LANGUAGE,
    BRANCH.NAME AS BRANCH_NAME,
    BRANCH.MANAGEMENTEMAIL AS BRANCH_MANAGEMENTEMAIL,
    COALESCE(BRANCHADDRESS.LANGUAGE,'EN') AS BRANCH_LANGUAGE,
    ORDERSTATUS AS REALSTATUS
FROM
	orderHeader HDR
INNER JOIN
	orderDetail DTL ON 
		HDR.ORDERID = DTL.ORDERID
INNER JOIN
	items ITEM ON 
		DTL.ITEMID = ITEM.ID
INNER JOIN
	user USER ON 
		HDR.USERNAME = USER.USERNAME
INNER JOIN
	branches BRANCH ON 
		USER.BRANCH = BRANCH.CODE
LEFT OUTER JOIN
	(SELECT * FROM branchesAddresses WHERE ISMAIN = 1) BRANCHADDRESS ON 
		BRANCH.CODE = BRANCHADDRESS.CODE
WHERE 
	HDR.USERNAME = __USERNAME AND 
    HDR.ORDERID = __ORDERID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetPaypalPaymentInformation` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetPaypalPaymentInformation`(__USERNAME VARCHAR(100))
BEGIN

SELECT
	HDR.ORDERID,
	SHIPCONTACTFIRSTNAME AS FIRSTNAME,
    SHIPCONTACTLASTNAME AS LASTNAME,
    SHIPCONTACTEMAIL AS EMAIL,
    SPECIALINSTRUCTIONS AS SPECINSTR,
    RECEIVERINSTRUCTIONS AS RECINSTR,
    SHIPPINGMETHOD AS SHIPPINGMETHOD,
    SHIPPINGCOST AS SHIPPINGCOST,
	SHIPNAME AS SHIPNAME,
    BILLINGCATEGORY AS BILLINGCATEGORY,
    PONUMBER AS PONUMBER,
    ROUND(COALESCE(PROMODISC,0)+COALESCE(ITEMTOT,0)+SHIPPINGCOST+SHIPPINGCOSTTAXAMT1+SHIPPINGCOSTTAXAMT2+SHIPPINGCOSTTAXAMT3+SHIPPINGCOSTTAXAMT4+SHIPPINGCOSTTAXAMT5,2) AS AMT
FROM
	orderHeader HDR
INNER JOIN
	( SELECT ORDERID,SUM(EXTPRICE+TAXAMT1+TAXAMT2+TAXAMT3+TAXAMT4+TAXAMT5) AS ITEMTOT FROM orderDetail GROUP BY ORDERID) DTL ON 
		HDR.ORDERID = DTL.ORDERID
LEFT OUTER JOIN
	( SELECT ORDERID,SUM(CALCDISCOUNT+TAXAMT1+TAXAMT2+TAXAMT3+TAXAMT4+TAXAMT5) AS PROMODISC FROM 
      orderPromos GROUP BY ORDERID ) PROMOS ON 
		HDR.ORDERID = PROMOS.ORDERID
WHERE 
	USERNAME  = __USERNAME AND 
    ORDERSTATUS = 'CART';
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetPendingOrders` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetPendingOrders`(__USERNAME VARCHAR(20))
BEGIN

	SELECT
		HDR.*,
        CAST(HDR.ORDERDATE AS DATE) AS SHORTDATE,
        DTL.TOTAMT+HDR.SHIPPINGCOST+HDR.SHIPPINGCOSTTAXAMT1+HDR.SHIPPINGCOSTTAXAMT2+HDR.SHIPPINGCOSTTAXAMT3+HDR.SHIPPINGCOSTTAXAMT4+HDR.SHIPPINGCOSTTAXAMT5 AS ORDERAMOUNT
	FROM
		orderHeader HDR
	INNER JOIN
		(SELECT ORDERID, SUM(EXTPRICE+TAXAMT1+TAXAMT2+TAXAMT3+TAXAMT4+TAXAMT5) AS TOTAMT FROM orderDetail GROUP BY ORDERID) DTL ON 
			HDR.ORDERID = DTL.ORDERID
	WHERE
		USERNAME = __USERNAME AND
        ORDERSTATUS IN ('WAITMA');
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetPromoProfile` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetPromoProfile`(__CODE VARCHAR(50))
BEGIN
	SELECT * FROM promos WHERE CODE = __CODE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetPromoProfileCategories` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetPromoProfileCategories`(__CODE VARCHAR(50))
BEGIN

  SELECT
    PROMOS.CATID,
        CONCAT(CATS.NAME, ' - ', CATS.DESCRIPTION) AS CATNAME
  FROM
    promosCategories PROMOS
  INNER JOIN 
    categories CATS ON 
      PROMOS.CATID = CATS.CATID
  WHERE
    PROMOS.CODE = __CODE;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetPromoProfileItems` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetPromoProfileItems`(__CODE VARCHAR(50))
BEGIN
	SELECT 
		PROMOS.ITEMID,
		CONCAT(ITEMS.CODE,' - ',DESCRIPTION) AS ITEMNAME
	FROM 
		promosItems PROMOS
	INNER JOIN 
		items ITEMS ON 
			PROMOS.ITEMID = ITEMS.ID
	WHERE 
		PROMOS.CODE = __CODE;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetSearchItems` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetSearchItems`(__USERNAME VARCHAR(50), __TERM NVARCHAR(200))
BEGIN
    SELECT DISTINCT
        ITEMS.ID AS ITEMID,
        ITEMS.CODE AS ITEMCODE,
        ITEMS.DESCRIPTION AS ITEMDESC,
        ITEMS.DISPLAYIMAGEPATH,
        ITEMS.PROOFPDFNAME,
        ITEMS.SIZE,
        ITEMS.NUMPAGES,
        ITEMS.MINLEVEL,
        ITEMS.STATUS,
        ITEMS.TYPE AS ITEMTYPE,
        COALESCE(ONORDERSTAT.TOTORDERQTY,0) AS ONORDER, 
        COALESCE(DATE(ONORDERSTAT.ORDERDATE),'') AS LASTORDERED,
        COALESCE(ITEMINV.QTYONHAND,0) AS INSTOCK,
        MIN(SUBCATS.CATID) AS CATID,
        MIN(SUBCATS.SUBCATID) AS SUBCATID
    FROM
        categories CATS
    LEFT OUTER JOIN
        subcategories SUBCATS ON 
            CATS.CATID = SUBCATS.CATID
    LEFT OUTER JOIN
        itemsSubcategoryLink SCTOI ON
            SCTOI.SUBCATID = SUBCATS.SUBCATID
    LEFT OUTER JOIN
        items ITEMS ON 
            ITEMS.ID = SCTOI.ITEMID
    LEFT OUTER JOIN
        (SELECT ITEMID, SUM(CASE WHEN ORDERQTY-SHIPTODATEQTY < 0 THEN 0 ELSE ORDERQTY-SHIPTODATEQTY END) AS TOTORDERQTY, MAX(ORDERDATE) AS ORDERDATE FROM orderHeader HDR INNER JOIN orderDetail DTL ON HDR.ORDERID = DTL.ORDERID WHERE ORDERSTATUS NOT IN ('WAITMA','CART','CANCELLED') GROUP BY ITEMID) ONORDERSTAT ON
            ONORDERSTAT.ITEMID = SCTOI.ITEMID  
    LEFT OUTER JOIN
        itemsInventory ITEMINV ON 
            ITEMS.ID = ITEMINV.ITEMID
    INNER JOIN 
        (SELECT DISTINCT 
            ITEMID 
         FROM
            (
                SELECT 
                    ITOB.ITEMID 
                FROM 
                    user USERS 
                INNER JOIN 
                    itemsBranchesLink ITOB ON USERS.BRANCH = ITOB.BRANCHCODE 
                WHERE 
                    USERS.USERNAME = __USERNAME
                    
                UNION ALL 
                SELECT ITOB.ITEMID FROM itemsBranchesLink ITOB WHERE ITOB.BRANCHCODE = 'ALL_BRANCHES'
                
                UNION ALL
                SELECT ITOB.ITEMID FROM user UU INNER JOIN branches BB ON UU.BRANCH = BB.CODE
                INNER JOIN itemsBranchesLink ITOB ON CONCAT('BRN_',BB.SKIN) = ITOB.BRANCHCODE 
                WHERE UU.USERNAME = __USERNAME                
            ) LINKS
        )  BRANCHLINK ON 
                BRANCHLINK.ITEMID = ITEMS.ID  
    CROSS JOIN
        ( SELECT * FROM user WHERE USERNAME = __USERNAME) USERS                        
    WHERE
        (
            ITEMS.CODE COLLATE utf8_unicode_ci LIKE CONCAT('%',__TERM,'%') OR 
            ITEMS.DESCRIPTION COLLATE utf8_unicode_ci LIKE CONCAT('%',__TERM,'%')
        ) AND 
        ITEMS.ARCHIVED = 0 AND
        ITEMS.ASSETAPPROVED = 1 AND
        CATS.CATID IN (
                        SELECT CC.CATID 
                        FROM categories CC 
                        INNER JOIN categoriesBrand CCC ON CC.CATID = CCC.CATID
                        INNER JOIN ( SELECT SKIN FROM branches BB INNER JOIN user UU ON BB.CODE = UU.BRANCH WHERE USERNAME COLLATE utf8_unicode_ci = __USERNAME) UBS ON 
                            (UBS.SKIN = CCC.BRANDNAME OR CCC.BRANDNAME = 'ALL')
                            ) AND
        CATS.USERLEVEL <= COALESCE((SELECT USERLEVEL FROM user WHERE USERNAME = __USERNAME LIMIT 1),0) AND
        USERS.USERLEVEL >= SUBCATS.USERLEVEL
    GROUP BY
        ITEMS.ID ,
        ITEMS.CODE ,
        ITEMS.DESCRIPTION ,
        ITEMS.DISPLAYIMAGEPATH,
        ITEMS.PROOFPDFNAME,
        ITEMS.SIZE,
        ITEMS.NUMPAGES,
        ITEMS.MINLEVEL,
        ITEMS.STATUS,
        ITEMS.TYPE ,
        COALESCE(ONORDERSTAT.TOTORDERQTY,0) , 
        COALESCE(DATE(ONORDERSTAT.ORDERDATE),'') ,
        COALESCE(ITEMINV.QTYONHAND,0) 
    ORDER BY
        ITEMS.CODE
    ;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetSettingsValue` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetSettingsValue`(SETTING_KEY VARCHAR(100))
BEGIN
	SELECT 
		*
	FROM
		settings
	WHERE
		`KEY` = SETTING_KEY;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetShipmentInfo` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetShipmentInfo`(__SHIPID INT)
BEGIN

	SELECT
		SHIPHDR.*,
        SHIPDTL.*,
        ORDHDR.*,
        ORDDTL.*,
        ORDDTL.ORDERQTY - ORDDTL.SHIPTODATEQTY AS BOQTY,
		USER.EMAIL AS USER_EMAIL,
		USER.LANGUAGE AS USER_LANGUAGE,
		BRANCH.MANAGEMENTEMAIL AS BRANCH_MANAGEMENTEMAIL,
		COALESCE(BRANCHADDRESS.LANGUAGE,'EN') AS BRANCH_LANGUAGE,
        ITEM.TYPE
	FROM
		shipmentHeader SHIPHDR
	INNER JOIN
		shipmentDetail SHIPDTL ON
			SHIPHDR.SHIPID = SHIPDTL.SHIPID
	INNER JOIN
		orderDetail ORDDTL ON 
			SHIPDTL.ORDERID = ORDDTL.ORDERID AND
            SHIPDTL.ORDERLINE = ORDDTL.ITEMLINE
	INNER JOIN
		items ITEM ON 
			ORDDTL.ITEMID = ITEM.ID
	INNER JOIN
		orderHeader ORDHDR ON 
			SHIPHDR.ORDERID = ORDHDR.ORDERID 
	INNER JOIN
		user USER ON 
			ORDHDR.USERNAME = USER.USERNAME 
	INNER JOIN
		branches BRANCH ON 
			USER.BRANCH = BRANCH.CODE 
	LEFT OUTER JOIN
		(SELECT * FROM branchesAddresses WHERE ISMAIN = 1) BRANCHADDRESS ON 
			BRANCH.CODE = BRANCHADDRESS.CODE
	WHERE
		SHIPHDR.SHIPID = __SHIPID;            

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetShipToAddress` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetShipToAddress`(__ID VARCHAR(50), __USEBRANCHES BOOLEAN)
BEGIN
	SELECT
		NAME,ADDRESS,ADDRESS2,CITY,PROVINCE,COUNTRY,POSTAL,PHONE,FAX
	FROM
    (
	SELECT
		'S' AS RECTYPE,ID,NAME,ADDRESS,ADDRESS2,CITY,PROVINCE,COUNTRY,POSTAL,PHONE,FAX
	FROM
		shipToAddresses
        
	UNION ALL
    
    SELECT
		'B' AS RECTYPE,BRANCH.CODE,NAME,ADDRESS,ADDRESS2,CITY,PROVINCE,COUNTRY,POSTALCODE,PHONE,FAX
    FROM
		branches BRANCH
	INNER JOIN
		branchesAddresses BADDR ON 
			BRANCH.CODE = BADDR.CODE
	WHERE
		__USEBRANCHES = 1 AND
        BRANCH.STATUS = 1 AND
        BADDR.ISMAIN = 1
    ) ADDR
    WHERE
		CONCAT(ADDR.RECTYPE,'-',ADDR.ID) = __ID
    ;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetShipToAddressInformation` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetShipToAddressInformation`(__ID INT)
BEGIN

	SELECT
		*
	FROM
		shipToAddresses
	WHERE
		ID = __ID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetShipToAddressUsersList` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetShipToAddressUsersList`(__SHIPTOID INT)
BEGIN
	SELECT 
		USERS.USERNAME,
		USERS.FIRSTNAME,
		USERS.LASTNAME,
		CASE WHEN USERADDR.ID IS NOT NULL THEN 1 ELSE 0 END AS SELECTED
	FROM
		( SELECT 'ALL' AS USERNAME, 'All' AS FIRSTNAME, 'Users' AS LASTNAME UNION ALL
          SELECT USERNAME,FIRSTNAME,LASTNAME FROM user
        ) USERS 
	LEFT OUTER JOIN 
		(SELECT * FROM shipToAddressesUserList WHERE ID = __SHIPTOID) USERADDR ON 
			USERS.USERNAME = USERADDR.USERNAME
	ORDER BY 
		USERS.USERNAME;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetShipTosBySearchTerm` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetShipTosBySearchTerm`(__USEBRANCHES BOOLEAN, __TERM VARCHAR(50), __USERNAME VARCHAR(30))
BEGIN

	SELECT
		CONCAT(RECTYPE,'-',ID) AS ID,
        CONCAT(NAME, ' - ', ADDRESS) AS SHIPDESC
	FROM
    (
	SELECT
		'S' AS RECTYPE,
        ID, 
        NAME,
        ADDRESS,
        ADDRESS2,
        CITY,
        POSTAL AS POSTALCODE,        
        CASE WHEN IFNULL(STOREID,'') = '' THEN 'NA' ELSE STOREID END AS STOREID
	FROM
		shipToAddresses
	WHERE
		ID IN (SELECT ID FROM shipToAddressesUserList WHERE USERNAME = '**ALL**' OR USERNAME = __USERNAME) 
        
	UNION ALL
    
    SELECT
		'B' AS RECTYPE,
        BRANCH.CODE,
        BRANCH.NAME,
        BADDR.ADDRESS,
        BADDR.ADDRESS2,
        BADDR.CITY,
        BADDR.POSTALCODE,
        BRANCH.CODE AS STOREID
    FROM
		branches BRANCH
	INNER JOIN
		branchesAddresses BADDR ON 
			BRANCH.CODE = BADDR.CODE
	WHERE
		__USEBRANCHES = 1 AND
        BRANCH.STATUS = 1 AND
        BADDR.ISMAIN = 1
    ) ADDR
    WHERE
	(
	ADDR.NAME LIKE CONCAT('%',__TERM,'%') OR 
    ADDR.ADDRESS LIKE CONCAT('%',__TERM,'%') OR
    ADDR.ADDRESS2 LIKE CONCAT('%',__TERM,'%') OR
    ADDR.CITY LIKE CONCAT('%',__TERM,'%') OR
    ADDR.POSTALCODE LIKE CONCAT('%',__TERM,'%') OR 
    ADDR.STOREID LIKE CONCAT('%',__TERM,'%')
    ) 
    ORDER BY
		NAME;	

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetSkinOptions` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetSkinOptions`()
BEGIN
	SELECT
		*
	FROM
		branchSkinDefinition
	ORDER BY
		SKINNAME;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetSubCategoryInformation` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetSubCategoryInformation`(__SUBCATID INTEGER)
BEGIN
	SELECT * FROM subcategories WHERE SUBCATID = __SUBCATID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetSupportTicketAttachments` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetSupportTicketAttachments`(__TICKETID INT)
BEGIN
	SELECT * FROM ticketAttachment WHERE TICKETID = __TICKETID ORDER BY
    ID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetSupportTicketData` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetSupportTicketData`(__TICKETID INT, __USERNAME VARCHAR(50))
BEGIN

	SELECT
	HDR.TITLE,
	HDR.STATUS,
		DTL.*,
        USR.FIRSTNAME,
        USR.LASTNAME,
        UNIX_TIMESTAMP(DTL.DATEENTERED) AS UNIX_DATEENTERED
	FROM
		ticketHeader HDR
	INNER JOIN
		ticketDetail DTL ON 
			HDR.ID = DTL.TICKETID
	LEFT OUTER JOIN
		user USR ON 
			DTL.ENTEREDBY = USR.USERNAME
	WHERE
        ( HDR.ENTEREDBY = __USERNAME OR __USERNAME IN (SELECT USERNAME FROM user WHERE USERLEVEL >= 81)) AND
        ( DTL.TICKETID = __TICKETID )
	ORDER BY
		DTL.DATEENTERED DESC;
		

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetSupportTicketList` */;
DELIMITER ;;
CREATE DEFINER=`admin`@`localhost` PROCEDURE `GetSupportTicketList`(__USERNAME VARCHAR(50))
BEGIN

	SELECT
		*,
        UNIX_TIMESTAMP(HDR.DATEENTERED) AS UNIX_DATEENTERED
	FROM
		ticketHeader HDR
	WHERE
		( HDR.STATUS = 1 OR (HDR.STATUS = 0 AND DATECLOSED >= DATE_ADD(NOW(), INTERVAL -14 DAY)) ) AND
        ( HDR.ENTEREDBY = __USERNAME OR __USERNAME IN (SELECT USERNAME FROM user WHERE USERLEVEL >= 81))
	ORDER BY
		HDR.STATUS DESC,
		HDR.DATEENTERED DESC;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetTaxRecords` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetTaxRecords`()
BEGIN
	SELECT * FROM taxes;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `GetUserBranchAssets` */;
