-- Table structure for table `ug_video`
--

CREATE TABLE `ug_video` (
  `ID` int(11) NOT NULL,
  `ugID` int(11) NOT NULL,
  `title` varchar(64) NOT NULL,
  `videoLink` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `ug_video`
--

INSERT INTO `ug_video` VALUES (58,304,'How to make a video intro','/ug_video/How_to_make_a_Video_Intro_online_Intro_Maker_IntroMaker.mp4'),(59,304,'hello world','/ug_video/How_to_make_a_Video_Intro_online_Intro_Maker_IntroMaker.mp4'),(60,306,'How To Start','/ug_video/how to start.avi'),(62,1,'welcome','/ug_video/video-sps.mp4'),(63,1,'Are you ready?','/ug_video/Final-Mia-video.mp4'),(58,304,'How to make a video intro','/ug_video/How_to_make_a_Video_Intro_online_Intro_Maker_IntroMaker.mp4'),(59,304,'hello world','/ug_video/How_to_make_a_Video_Intro_online_Intro_Maker_IntroMaker.mp4'),(60,306,'How To Start','/ug_video/how to start.avi'),(62,1,'welcome','/ug_video/video-sps.mp4'),(63,1,'Are you ready?','/ug_video/Final-Mia-video.mp4');

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

CREATE TABLE `user` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `userName` varchar(32) NOT NULL,
  `password` varchar(64) NOT NULL,
  `fullName` varchar(64) NOT NULL,
  `telephoneNo` varchar(16) NOT NULL,
  `emailAddress` varchar(16) NOT NULL,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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


--
-- Table structure for table `user_module_access`
--

CREATE TABLE `user_module_access` (
  `ID` int(11) NOT NULL,
  `companyID` int(11) DEFAULT NULL,
  `userID` int(11) NOT NULL,
  `moduleID` int(11) NOT NULL,
  `transaction` smallint(2) NOT NULL DEFAULT '0',
  `reports` smallint(2) NOT NULL DEFAULT '0',
  `setup` smallint(2) NOT NULL DEFAULT '0',
  `accessRight` int(11) NOT NULL,
  `createdBy` int(11) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `user_module_access`
--

INSERT INTO `user_module_access` VALUES (1,1,1,1,1,1,1,0,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(2,1,1,2,1,1,1,0,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(3,1,1,3,1,1,1,0,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(4,1,1,4,1,1,1,0,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(5,1,1,5,1,1,1,0,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(6,1,1,6,1,1,1,0,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(7,1,1,7,1,1,1,0,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(8,1,1,8,1,1,1,0,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(9,1,1,9,1,1,1,0,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(10,1,1,10,1,1,1,0,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(11,1,1,0,0,0,0,0,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(12,2,2,1,1,1,1,0,1,'2015-04-01 20:01:55',1,'2015-04-01 20:02:17'),(13,2,2,2,1,1,1,0,1,'2015-04-01 20:01:55',1,'2015-04-01 20:02:17'),(14,2,2,3,1,1,1,0,1,'2015-04-01 20:01:55',1,'2015-04-01 20:02:17'),(15,2,2,4,1,1,1,0,1,'2015-04-01 20:01:56',1,'2015-04-01 20:02:17'),(16,2,2,5,1,1,1,0,1,'2015-04-01 20:01:56',1,'2015-04-01 20:02:17'),(17,2,2,6,1,1,1,0,1,'2015-04-01 20:01:56',2,'2015-07-27 23:10:22'),(18,2,2,7,1,1,1,0,1,'2015-04-01 20:01:56',1,'2015-04-01 20:02:18'),(19,2,2,8,1,1,1,0,1,'2015-04-01 20:01:56',1,'2015-04-01 20:02:18'),(20,2,2,9,1,1,1,0,1,'2015-04-01 20:01:56',1,'2015-04-01 20:02:18'),(21,2,2,10,1,1,1,0,1,'2015-04-01 20:01:57',1,'2015-04-01 20:02:18'),(22,2,3,1,1,1,1,0,2,'2015-04-29 23:49:52',2,'2015-04-30 01:38:16'),(23,2,3,2,1,1,1,0,2,'2015-04-29 23:49:52',2,'2015-04-30 01:38:17'),(24,2,3,3,1,1,1,0,2,'2015-04-29 23:49:53',2,'2015-04-30 01:38:17'),(25,2,3,4,1,1,1,0,2,'2015-04-29 23:49:54',2,'2015-04-30 01:38:17'),(26,2,3,5,1,1,1,0,2,'2015-04-29 23:49:54',2,'2015-04-30 01:38:17'),(27,2,3,6,1,1,1,0,2,'2015-04-29 23:49:54',2,'2015-04-30 01:38:18'),(28,2,3,7,1,1,1,0,2,'2015-04-29 23:49:54',2,'2015-04-30 01:38:18'),(29,2,3,8,1,1,1,0,2,'2015-04-29 23:49:54',2,'2015-04-30 01:38:18'),(30,2,3,9,0,0,0,0,2,'2015-04-29 23:49:55',2,'2015-12-23 03:56:58'),(31,2,3,10,0,0,0,0,2,'2015-04-29 23:49:55',2,'2015-12-23 03:56:58');

--
-- Table structure for table `user_module_access_details`
--

CREATE TABLE `user_module_access_details` (
  `ID` int(11) NOT NULL,
  `companyID` int(11) DEFAULT NULL,
  `userID` int(11) NOT NULL,
  `menuCode` varchar(8) NOT NULL,
  `accessRight` int(11) NOT NULL,
  `createdBy` int(11) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `user_module_access_details`
--

INSERT INTO `user_module_access_details` VALUES (0,2,3,'ARHISTCU',1,2,'2015-12-23 03:56:54',0,'2015-12-23 03:56:54'),(1,1,1,'ARINVLST',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(2,1,1,'ARDBNLST',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(3,1,1,'ARCDNLST',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(4,1,1,'ARRCVPLS',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(5,1,1,'ARCUSTST',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(6,1,1,'APSUPPAY',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(7,1,1,'APPURDN',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(8,1,1,'APPURCN',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(9,1,1,'APPURDNC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(10,1,1,'APPURCNC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(11,1,1,'APOPWI',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(12,1,1,'APOPWIC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(13,1,1,'APOPWOI',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(14,1,1,'APPURINV',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(15,1,1,'APDIRINV',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(16,1,1,'APCPYPI',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(17,1,1,'APBANKRE',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(18,1,1,'APPAYCFM',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(19,1,1,'APPAYICM',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(20,1,1,'APDRNOTE',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(21,1,1,'GLTRJRNL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(22,1,1,'GLTRJlCY',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(23,1,1,'GLTRJlRV',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(24,1,1,'GLTRPOST',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(25,1,1,'GLRPBS',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(26,1,1,'GLRPTB',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(27,1,1,'GLRPJLPS',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(28,1,1,'GLRPJLUP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(29,1,1,'GLRPTBFC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(30,1,1,'GLRPABSM',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(31,1,1,'GLRPPNLM',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(32,1,1,'GLRPBGLT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(33,1,1,'GLMCAL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(34,1,1,'GLMCALL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(35,1,1,'GLSTCOA',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(36,1,1,'GLSTBDGT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(37,1,1,'GLSTCURC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(38,1,1,'ARSALINV',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(39,1,1,'ARSDBN',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(40,1,1,'ARDBNC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(41,1,1,'ARSCN',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(42,1,1,'ARSCNC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(43,1,1,'ARRCVP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(44,1,1,'ARRCVPC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(45,1,1,'ARDSLINV',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(46,1,1,'ARDRSINV',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(47,1,1,'ARCPYSI',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(48,1,1,'ARSETCUS',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(49,1,1,'MSTRSUPP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(50,1,1,'APPURDNL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(51,1,1,'APPURCNL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(52,1,1,'APRPTOPW',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(53,1,1,'APRPTSTL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(54,1,1,'APTRETCR',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(55,1,1,'APTRPYIE',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(56,1,1,'UM',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(57,1,1,'UML',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(58,1,1,'MUL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(59,1,1,'LOGRPT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(60,1,1,'UMACCSS',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(61,1,1,'MSCL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(62,1,1,'MSSL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(63,1,1,'MSTRCOMP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(64,1,1,'PROJECT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(65,1,1,'TERM',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(66,1,1,'MSMTRCD',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(67,1,1,'EMP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(68,1,1,'AGENTSTP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(69,1,1,'BNKSETUP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(70,1,1,'ADMMENU',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(71,1,1,'APTRPYOE',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(72,1,1,'INVPLNRP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(73,1,1,'INVVALRP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(74,1,1,'INVSTORP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(75,1,1,'INVOUTRP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(76,1,1,'INVMOVRP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(77,1,1,'INVLSTRP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(78,1,1,'IVSTCKCS',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(79,1,1,'LTL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(80,1,1,'ICAA',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(81,1,1,'MSLM',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(82,1,1,'ITEMCAT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(83,1,1,'ITEMTYP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(84,1,1,'ITEMSET',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(85,1,1,'INVUM',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(86,1,1,'INVUMCOV',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(87,1,1,'INUMCVLS',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(88,1,1,'ICSTIDTL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(89,1,1,'ARNWCUST',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(90,1,1,'ARSHIP2L',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(91,1,1,'ARSHIP2N',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(92,1,1,'ADMBNKMS',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(93,1,1,'ARTRINED',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(94,1,1,'AREDSLDR',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(95,1,1,'AREDCR',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(96,1,1,'ARPAYEDT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(97,1,1,'PURORDER',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(98,1,1,'PURRCV',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(99,1,1,'PURORDCF',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(100,1,1,'PURRCVC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(101,1,1,'GSPRJNW',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(102,1,1,'ZKTSTGRP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(103,1,1,'ZKTSTNSB',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(104,1,1,'ZKTSTNSD',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(105,1,1,'ZKSTCNTR',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(106,1,1,'WKSTMSTR',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(107,1,1,'WCQCNTR',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(108,1,1,'APNEWSUP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(109,1,1,'APNWSHP2',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(110,1,1,'GLTRYECL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(111,1,1,'INVLOCTR',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(112,1,1,'INVSALEP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(113,1,1,'INVPURPR',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(114,1,1,'INVITEMC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(115,1,1,'INVLOCTC',0,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(116,1,1,'INVITCC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(117,1,1,'INVSALC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(118,1,1,'INVPURCC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(119,1,1,'ItemDetR',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(120,1,1,'INEDITEM',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(121,1,1,'INNWITEM',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(122,1,1,'PURSTSPL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(123,1,1,'PURSTUM',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(124,1,1,'PURSTUMC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(125,1,1,'UMCONVNW',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(126,1,1,'SOSTSLPC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(127,1,1,'PURORLST',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(128,1,1,'PURRCVLS',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(129,1,1,'PUROUTGR',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(130,1,1,'PUPRRPT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(131,1,1,'TERMNEW',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(132,1,1,'APDRINVC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(133,1,1,'SOQUOT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(134,1,1,'SOTRNWSO',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(135,1,1,'SOTRDO',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(136,1,1,'DELCNFRM',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(137,1,1,'ZKTTRCAL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(138,1,1,'WKFCAL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(139,1,1,'ZKTRGPLT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(140,1,1,'ZKRPCTRL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(141,1,1,'ZKRPNBLT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(142,1,1,'ZKRPSMLT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(143,1,1,'WKFLST',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(144,1,1,'WCQCTRNW',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(145,1,1,'TXTRPROC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(146,1,1,'GST03',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(147,1,1,'gstrpt',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(148,1,1,'null',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(149,1,1,'GSTMSTR',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(150,1,1,'GSTTYPE',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(151,1,1,'GSTGROUP',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(152,1,1,'SOTRQOLT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(153,1,1,'SORPPCLT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(154,1,1,'SOTRDOLT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(155,1,1,'SOTRSOLT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(156,1,1,'SORPSOCU',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(157,1,1,'SORPYRSL',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(158,1,1,'SORPSLIT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(159,1,1,'SORPORCT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(160,1,1,'SORPSOIT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(161,1,1,'SORPOROT',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(162,1,1,'ARCUSTAG',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(163,1,1,'GSTCLASS',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(164,1,1,'TAXMSNW',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(165,1,1,'SOSLSPRC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(166,1,1,'ARCASH',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(167,1,1,'ARCASHSC',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(168,1,1,'OTRPAY',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(169,1,1,'OTHRCV',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(170,1,1,'OTRCVCON',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(171,1,1,'ARCSHS',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(172,1,1,'OTRCVLST',1,1,'2015-03-29 19:55:19',1,'2015-03-29 19:55:19'),(173,2,2,'GLTRJRNL',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(174,2,2,'GLTRJlCY',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(175,2,2,'GLTRJlRV',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(176,2,2,'GLTRPOST',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(177,2,2,'APOPWOI',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(178,2,2,'GLTRYECL',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(179,2,2,'OTRPAY',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(180,2,2,'OTHRCV',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(181,2,2,'OTRCVCON',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(182,2,2,'GLRPBS',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(183,2,2,'GLRPTB',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(184,2,2,'GLRPJLPS',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(185,2,2,'GLRPJLUP',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(186,2,2,'GLRPTBFC',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(187,2,2,'GLRPABSM',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(188,2,2,'GLRPPNLM',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(189,2,2,'APRPTOPW',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(190,2,2,'GLRPBGLT',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(191,2,2,'APBANKRE',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(192,2,2,'OTRCVLST',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(193,2,2,'GLBNKRCL',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(194,2,2,'TRSCSUMM',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(195,2,2,'GLMCAL',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(196,2,2,'GLMCALL',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(197,2,2,'GLSTCOA',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(198,2,2,'GLSTBDGT',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(199,2,2,'GLSTCURC',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(200,2,2,'GLOPNBAL',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(201,2,2,'GLUNPRES',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(202,2,2,'ARSALINV',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(203,2,2,'ARSDBN',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(204,2,2,'ARDBNC',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(205,2,2,'ARSCN',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(206,2,2,'ARSCNC',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(207,2,2,'ARRCVP',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(208,2,2,'ARRCVPC',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(209,2,2,'ARDSLINV',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(210,2,2,'ARDRSINV',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(211,2,2,'ARCPYSI',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(212,2,2,'ARTRINED',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(213,2,2,'AREDSLDR',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(214,2,2,'AREDCR',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(215,2,2,'ARPAYEDT',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(216,2,2,'ARCASH',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(217,2,2,'ARCASHSC',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(218,2,2,'ARINVLST',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(219,2,2,'ARDBNLST',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(220,2,2,'ARCDNLST',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(221,2,2,'ARRCVPLS',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(222,2,2,'ARCUSTST',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(223,2,2,'ARCUSTAG',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(224,2,2,'ARCSHS',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(225,2,2,'ARSETCUS',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(226,2,2,'ARNWCUST',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(227,2,2,'ARSHIP2L',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(228,2,2,'ARSHIP2N',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(229,2,2,'APSUPPAY',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(230,2,2,'APPURDN',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(231,2,2,'APPURCN',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(232,2,2,'APPURDNC',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(233,2,2,'APPURCNC',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(234,2,2,'APPAYCFM',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(235,2,2,'APOPWI',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(236,2,2,'APPAYICM',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(237,2,2,'APPURINV',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(238,2,2,'APDIRINV',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(239,2,2,'APDRINVC',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(240,2,2,'APCPYPI',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(241,2,2,'APDRNOTE',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(242,2,2,'APTRETCR',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(243,2,2,'APTRPYIE',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(244,2,2,'APTRPYOE',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(245,2,2,'APPURDNL',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(246,2,2,'APPURCNL',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(247,2,2,'APRPTSTL',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(248,2,2,'MSTRSUPP',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(249,2,2,'APNEWSUP',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(250,2,2,'APNWSHP2',1,1,'2015-04-01 20:01:55',0,'2015-04-01 20:01:55'),(251,2,2,'INVLOCTR',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(252,2,2,'INVITEMC',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(253,2,2,'INVLOCTC',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(254,2,2,'INVITCC',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(255,2,2,'INVPLNRP',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(256,2,2,'INVVALRP',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(257,2,2,'INVSTORP',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(258,2,2,'INVOUTRP',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(259,2,2,'INVMOVRP',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(260,2,2,'INVLSTRP',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(261,2,2,'IVSTCKCS',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(262,2,2,'LTL',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(263,2,2,'ICAA',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(264,2,2,'ItemDetR',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(265,2,2,'MSLM',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(266,2,2,'ITEMCAT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(267,2,2,'ITEMTYP',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(268,2,2,'ITEMSET',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(269,2,2,'INVUM',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(270,2,2,'INEDITEM',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(271,2,2,'INNWITEM',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(272,2,2,'IVUNTMSR',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(273,2,2,'OPNBALIN',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(274,2,2,'SOQUOT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(275,2,2,'SOTRNWSO',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(276,2,2,'SOTRDO',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(277,2,2,'DELCNFRM',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(278,2,2,'SOTRQOLT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(279,2,2,'SORPPCLT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(280,2,2,'SOTRDOLT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(281,2,2,'SOTRSOLT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(282,2,2,'SORPSOCU',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(283,2,2,'SORPYRSL',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(284,2,2,'SORPSLIT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(285,2,2,'SORPORCT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(286,2,2,'SORPSOIT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(287,2,2,'SORPOROT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(288,2,2,'SOSTSLPC',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(289,2,2,'TXTRPROC',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(290,2,2,'GSBADRLF',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(291,2,2,'BADBTRLC',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(292,2,2,'GSBADBTR',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(293,2,2,'BDEBRCCO',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(294,2,2,'GST03',1,1,'2015-04-01 20:01:56',2,'2015-07-27 23:10:22'),(295,2,2,'GSTRPT01',1,1,'2015-04-01 20:01:56',2,'2015-07-27 23:10:25'),(296,2,2,'BDRETRPT',1,1,'2015-04-01 20:01:56',2,'2015-07-27 23:10:25'),(297,2,2,'BDRCVRPT',1,1,'2015-04-01 20:01:56',2,'2015-07-27 23:10:25'),(298,2,2,'GSTMSTR',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(299,2,2,'GSTCLASS',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(300,2,2,'GSTGROUP',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(301,2,2,'GSTTYPE',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(302,2,2,'ZKTTRCAL',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(303,2,2,'WKFCAL',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(304,2,2,'ZKTRGPLT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(305,2,2,'ZKRPCTRL',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(306,2,2,'ZKRPNBLT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(307,2,2,'ZKRPSMLT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(308,2,2,'WKFLST',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(309,2,2,'ZKTSTGRP',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(310,2,2,'ZKTSTNSB',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(311,2,2,'ZKTSTNSD',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(312,2,2,'ZKSTCNTR',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(313,2,2,'WKSTMSTR',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(314,2,2,'WCQCNTR',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(315,2,2,'PURORDER',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(316,2,2,'PURRCV',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(317,2,2,'PURORDCF',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(318,2,2,'PURRCVC',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(319,2,2,'PURORLST',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(320,2,2,'PURRCVLS',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(321,2,2,'PUROUTGR',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(322,2,2,'PUPRRPT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(323,2,2,'PURCNCL',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(324,2,2,'PURRCVCA',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(325,2,2,'PURSTSPL',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(326,2,2,'INVPURPR',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(327,2,2,'UMCONVNW',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(328,2,2,'PURUOMLS',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(329,2,2,'UM',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(330,2,2,'UML',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(331,2,2,'MUL',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(332,2,2,'LOGRPT',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(333,2,2,'UMACCSS',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(334,2,2,'ADMMENU',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(335,2,2,'USRADD',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(336,2,2,'BACKUP',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(337,2,2,'updversi',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(338,2,2,'upgraden',1,1,'2015-04-01 20:01:56',0,'2015-04-01 20:01:56'),(339,2,2,'MSTRCOMP',1,1,'2015-04-01 20:01:57',0,'2015-04-01 20:01:57'),(340,2,2,'PROJECT',1,1,'2015-04-01 20:01:57',0,'2015-04-01 20:01:57'),(341,2,2,'TERM',1,1,'2015-04-01 20:01:57',0,'2015-04-01 20:01:57'),(342,2,2,'MSMTRCD',1,1,'2015-04-01 20:01:57',0,'2015-04-01 20:01:57'),(343,2,2,'EMP',1,1,'2015-04-01 20:01:57',0,'2015-04-01 20:01:57'),(344,2,2,'AGENTSTP',1,1,'2015-04-01 20:01:57',0,'2015-04-01 20:01:57'),(345,2,2,'BNKSETUP',1,1,'2015-04-01 20:01:57',0,'2015-04-01 20:01:57'),(346,2,2,'ShipToST',1,1,'2015-04-01 20:01:57',0,'2015-04-01 20:01:57'),(347,2,3,'GLTRJRNL',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(348,2,3,'GLTRJlCY',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(349,2,3,'GLTRJlRV',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(350,2,3,'GLTRPOST',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(351,2,3,'APOPWOI',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(352,2,3,'GLTRYECL',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(353,2,3,'OTRPAY',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(354,2,3,'OTHRCV',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(355,2,3,'OTRCVCON',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(356,2,3,'GLRPBS',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(357,2,3,'GLRPTB',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(358,2,3,'GLRPJLPS',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(359,2,3,'GLRPJLUP',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(360,2,3,'GLRPTBFC',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(361,2,3,'GLRPABSM',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(362,2,3,'GLRPPNLM',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(363,2,3,'APRPTOPW',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(364,2,3,'GLRPBGLT',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(365,2,3,'APBANKRE',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(366,2,3,'OTRCVLST',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(367,2,3,'GLBNKRCL',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(368,2,3,'TRSCSUMM',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(369,2,3,'GLMCAL',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(370,2,3,'GLMCALL',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(371,2,3,'GLSTCOA',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(372,2,3,'GLSTBDGT',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(373,2,3,'GLSTCURC',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(374,2,3,'GLOPNBAL',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(375,2,3,'GLUNPRES',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:16'),(376,2,3,'ARSALINV',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(377,2,3,'ARSDBN',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(378,2,3,'ARDBNC',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(379,2,3,'ARSCN',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(380,2,3,'ARSCNC',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(381,2,3,'ARRCVP',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(382,2,3,'ARRCVPC',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(383,2,3,'ARDSLINV',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(384,2,3,'ARDRSINV',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(385,2,3,'ARCPYSI',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(386,2,3,'ARTRINED',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(387,2,3,'AREDSLDR',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(388,2,3,'AREDCR',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(389,2,3,'ARPAYEDT',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(390,2,3,'ARCASH',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(391,2,3,'ARCASHSC',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(392,2,3,'ARINVLST',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(393,2,3,'ARDBNLST',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(394,2,3,'ARCDNLST',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(395,2,3,'ARRCVPLS',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(396,2,3,'ARCUSTST',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(397,2,3,'ARCUSTAG',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(398,2,3,'ARCSHS',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(399,2,3,'ARSETCUS',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(400,2,3,'ARNWCUST',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(401,2,3,'ARSHIP2L',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(402,2,3,'ARSHIP2N',1,2,'2015-04-29 23:49:52',0,'2015-04-30 01:38:17'),(403,2,3,'APSUPPAY',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(404,2,3,'APPURDN',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(405,2,3,'APPURCN',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(406,2,3,'APPURDNC',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(407,2,3,'APPURCNC',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(408,2,3,'APPAYCFM',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(409,2,3,'APOPWI',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(410,2,3,'APPAYICM',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(411,2,3,'APPURINV',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(412,2,3,'APDIRINV',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(413,2,3,'APDRINVC',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(414,2,3,'APCPYPI',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(415,2,3,'APDRNOTE',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(416,2,3,'APTRETCR',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(417,2,3,'APTRPYIE',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(418,2,3,'APTRPYOE',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(419,2,3,'APPURDNL',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(420,2,3,'APPURCNL',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(421,2,3,'APRPTSTL',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(422,2,3,'MSTRSUPP',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(423,2,3,'APNEWSUP',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(424,2,3,'APNWSHP2',1,2,'2015-04-29 23:49:53',0,'2015-04-30 01:38:17'),(425,2,3,'INVLOCTR',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(426,2,3,'INVITEMC',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(427,2,3,'INVLOCTC',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(428,2,3,'INVITCC',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(429,2,3,'INVPLNRP',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(430,2,3,'INVVALRP',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(431,2,3,'INVSTORP',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(432,2,3,'INVOUTRP',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(433,2,3,'INVMOVRP',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(434,2,3,'INVLSTRP',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(435,2,3,'IVSTCKCS',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(436,2,3,'LTL',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(437,2,3,'ICAA',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(438,2,3,'ItemDetR',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(439,2,3,'MSLM',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(440,2,3,'ITEMCAT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(441,2,3,'ITEMTYP',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(442,2,3,'ITEMSET',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(443,2,3,'INVUM',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(444,2,3,'INEDITEM',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(445,2,3,'INNWITEM',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(446,2,3,'IVUNTMSR',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(447,2,3,'OPNBALIN',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(448,2,3,'SOQUOT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(449,2,3,'SOTRNWSO',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(450,2,3,'SOTRDO',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(451,2,3,'DELCNFRM',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(452,2,3,'SOTRQOLT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(453,2,3,'SORPPCLT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:17'),(454,2,3,'SOTRDOLT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(455,2,3,'SOTRSOLT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(456,2,3,'SORPSOCU',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(457,2,3,'SORPYRSL',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(458,2,3,'SORPSLIT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(459,2,3,'SORPORCT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(460,2,3,'SORPSOIT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(461,2,3,'SORPOROT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(462,2,3,'SOSTSLPC',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(463,2,3,'TXTRPROC',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(464,2,3,'GSBADRLF',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(465,2,3,'BADBTRLC',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(466,2,3,'GSBADBTR',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(467,2,3,'BDEBRCCO',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(468,2,3,'GST03',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(469,2,3,'GSTRPT01',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(470,2,3,'BDRETRPT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(471,2,3,'BDRCVRPT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(472,2,3,'GSTMSTR',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(473,2,3,'GSTCLASS',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(474,2,3,'GSTGROUP',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(475,2,3,'GSTTYPE',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(476,2,3,'ZKTTRCAL',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(477,2,3,'WKFCAL',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(478,2,3,'ZKTRGPLT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(479,2,3,'ZKRPCTRL',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(480,2,3,'ZKRPNBLT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(481,2,3,'ZKRPSMLT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(482,2,3,'WKFLST',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(483,2,3,'ZKTSTGRP',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(484,2,3,'ZKTSTNSB',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(485,2,3,'ZKTSTNSD',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(486,2,3,'ZKSTCNTR',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(487,2,3,'WKSTMSTR',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(488,2,3,'WCQCNTR',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(489,2,3,'PURORDER',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(490,2,3,'PURRCV',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(491,2,3,'PURORDCF',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(492,2,3,'PURRCVC',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(493,2,3,'PURORLST',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(494,2,3,'PURRCVLS',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(495,2,3,'PUROUTGR',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(496,2,3,'PUPRRPT',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(497,2,3,'PURCNCL',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(498,2,3,'PURRCVCA',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(499,2,3,'PURSTSPL',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(500,2,3,'INVPURPR',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(501,2,3,'UMCONVNW',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(502,2,3,'PURUOMLS',1,2,'2015-04-29 23:49:54',0,'2015-04-30 01:38:18'),(503,2,3,'UM',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(504,2,3,'UML',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(505,2,3,'MUL',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(506,2,3,'LOGRPT',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(507,2,3,'UMACCSS',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(508,2,3,'ADMMENU',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(509,2,3,'USRADD',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(510,2,3,'BACKUP',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(511,2,3,'updversi',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(512,2,3,'upgraden',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(513,2,3,'MSTRCOMP',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(514,2,3,'PROJECT',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(515,2,3,'TERM',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(516,2,3,'MSMTRCD',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(517,2,3,'EMP',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:58'),(518,2,3,'AGENTSTP',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:59'),(519,2,3,'BNKSETUP',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:59'),(520,2,3,'ShipToST',0,2,'2015-04-29 23:49:55',0,'2015-12-23 03:56:59'),(521,2,3,'GTSJNL',1,2,'2015-06-07 17:38:00',0,'2015-06-07 17:38:00'),(522,2,3,'GSTJCNF',1,2,'2015-06-07 17:38:00',0,'2015-06-07 17:38:00'),(523,2,2,'GSTRPTSU',1,2,'2015-07-27 23:10:25',0,'2015-07-27 23:10:25'),(524,2,2,'GST03SUM',1,2,'2015-07-27 23:10:26',2,'2015-07-28 17:54:13'),(525,2,2,'GSTRTSUM',1,2,'2015-07-28 17:54:14',0,'2015-07-28 17:54:14');

--
-- Temporary view structure for view `view_account_balance`
--

/*!50001 DROP VIEW IF EXISTS `view_account_balance`*/;
/*!50001 CREATE VIEW `view_account_balance` AS SELECT 
 1 AS `companyID`,
 1 AS `acctID`,
 1 AS `acctName`,
 1 AS `year`,
 1 AS `period`,
 1 AS `closing`*/;

--
-- Temporary view structure for view `view_ar_inventory`
--

/*!50001 DROP VIEW IF EXISTS `view_ar_inventory`*/;
/*!50001 CREATE VIEW `view_ar_inventory` AS SELECT 
 1 AS `companyID`,
 1 AS `customerID`,
 1 AS `formNo`,
 1 AS `salesinvoiceDate`,
 1 AS `totalReceivable`*/;

--
-- Temporary view structure for view `view_ar_open_position`
--

/*!50001 DROP VIEW IF EXISTS `view_ar_open_position`*/;
/*!50001 CREATE VIEW `view_ar_open_position` AS SELECT 
 1 AS `companyID`,
 1 AS `customerID`,
 1 AS `customerName`,
 1 AS `phoneNumber1`,
 1 AS `email`,
 1 AS `due120`,
 1 AS `due90`,
 1 AS `due60`,
 1 AS `due30`,
 1 AS `due0`,
 1 AS `pastDue30`,
 1 AS `pastDue60`,
 1 AS `pastDue90`,
 1 AS `pastDue120`,
 1 AS `pastDue`*/;

--
-- Temporary view structure for view `view_balance_sheet`
--

/*!50001 DROP VIEW IF EXISTS `view_balance_sheet`*/;
/*!50001 CREATE VIEW `view_balance_sheet` AS SELECT 
 1 AS `acctCode`,
 1 AS `acctName`,
 1 AS `acctGroupID`,
 1 AS `currentyeardebit`,
 1 AS `currentyearcredit`,
 1 AS `lastyeardebit`,
 1 AS `lastyearcredit`*/;

--
-- Temporary view structure for view `view_bank_reconcile`
--

/*!50001 DROP VIEW IF EXISTS `view_bank_reconcile`*/;
/*!50001 CREATE VIEW `view_bank_reconcile` AS SELECT 
 1 AS `ID`,
 1 AS `companyid`,
 1 AS `tableName`,
 1 AS `bankid`,
 1 AS `referenceNo`,
 1 AS `transDate`,
 1 AS `formNo`,
 1 AS `description`,
 1 AS `debitAmount`,
 1 AS `creditAmount`*/;

--
-- Temporary view structure for view `view_bank_reconcile_reverse`
--

/*!50001 DROP VIEW IF EXISTS `view_bank_reconcile_reverse`*/;
/*!50001 CREATE VIEW `view_bank_reconcile_reverse` AS SELECT 
 1 AS `bankReconcileID`,
 1 AS `ID`,
 1 AS `companyID`,
 1 AS `tableName`,
 1 AS `bankID`,
 1 AS `referenceNo`,
 1 AS `transDate`,
 1 AS `formNo`,
 1 AS `description`,
 1 AS `debitAmount`,
 1 AS `creditAmount`*/;

--
-- Temporary view structure for view `view_chart_of_acct_updateable`
--

/*!50001 DROP VIEW IF EXISTS `view_chart_of_acct_updateable`*/;
/*!50001 CREATE VIEW `view_chart_of_acct_updateable` AS SELECT 
 1 AS `ID`,
 1 AS `companyID`,
 1 AS `acctGroupID`,
 1 AS `acctCode`,
 1 AS `acctName`,
 1 AS `acctDesc`,
 1 AS `updateable`*/;

--
-- Temporary view structure for view `view_comp_acc_det`
--

/*!50001 DROP VIEW IF EXISTS `view_comp_acc_det`*/;
/*!50001 CREATE VIEW `view_comp_acc_det` AS SELECT 
 1 AS `ID`,
 1 AS `companyID`,
 1 AS `acctGroupID`,
 1 AS `acctID`,
 1 AS `year`,
 1 AS `period`,
 1 AS `amountdr`,
 1 AS `amountcr`,
 1 AS `total`,
 1 AS `createdBy`,
 1 AS `createdTS`,
 1 AS `updatedBy`,
 1 AS `updatedTS`,
 1 AS `is_delete`*/;

--
-- Temporary view structure for view `view_customer_aging`
--

/*!50001 DROP VIEW IF EXISTS `view_customer_aging`*/;
/*!50001 CREATE VIEW `view_customer_aging` AS SELECT 
 1 AS `companyID`,
 1 AS `customerID`,
 1 AS `customerName`,
 1 AS `phoneNumber1`,
 1 AS `email`,
 1 AS `current`,
 1 AS `month1`,
 1 AS `month2`,
 1 AS `month3`,
 1 AS `month4`,
 1 AS `month5`,
 1 AS `month6`,
 1 AS `month7`,
 1 AS `month8`,
 1 AS `month9`,
 1 AS `month10`,
 1 AS `month11`*/;

--
-- Temporary view structure for view `view_customer_statement`
--

/*!50001 DROP VIEW IF EXISTS `view_customer_statement`*/;
/*!50001 CREATE VIEW `view_customer_statement` AS SELECT 
 1 AS `ID`,
 1 AS `parent`,
 1 AS `companyID`,
 1 AS `customerID`,
 1 AS `transType`,
 1 AS `transDate`,
 1 AS `refNo`,
 1 AS `formNo`,
 1 AS `dr`,
 1 AS `cr`,
 1 AS `seq`*/;

--
-- Temporary view structure for view `view_expence_and_income`
--

/*!50001 DROP VIEW IF EXISTS `view_expence_and_income`*/;
/*!50001 CREATE VIEW `view_expence_and_income` AS SELECT 
 1 AS `companyid`,
 1 AS `year`,
 1 AS `period`,
 1 AS `groupID`,
 1 AS `acctType`,
 1 AS `totalDr`,
 1 AS `totalCr`,
 1 AS `balance`*/;

--
-- Temporary view structure for view `view_gaf`
--

/*!50001 DROP VIEW IF EXISTS `view_gaf`*/;
/*!50001 CREATE VIEW `view_gaf` AS SELECT 
 1 AS `companyID`,
 1 AS `col1`,
 1 AS `col2`,
 1 AS `col3`,
 1 AS `col4`,
 1 AS `col5`,
 1 AS `col6`,
 1 AS `col7`,
 1 AS `col8`,
 1 AS `col9`,
 1 AS `col10`,
 1 AS `col11`,
 1 AS `col12`,
 1 AS `col13`,
 1 AS `col14`*/;

--
-- Temporary view structure for view `view_grn_report`
--

/*!50001 DROP VIEW IF EXISTS `view_grn_report`*/;
/*!50001 CREATE VIEW `view_grn_report` AS SELECT 
 1 AS `companyID`,
 1 AS `unitMesure`,
 1 AS `ID`,
 1 AS `itemCode`,
 1 AS `itemName`,
 1 AS `poNo`,
 1 AS `PoDate`,
 1 AS `unitPrice`,
 1 AS `quantityOrder`,
 1 AS `total`,
 1 AS `totalRcv`,
 1 AS `QtyLeft`,
 1 AS `itemID`*/;

--
-- Temporary view structure for view `view_gst_report`
--

/*!50001 DROP VIEW IF EXISTS `view_gst_report`*/;
/*!50001 CREATE VIEW `view_gst_report` AS SELECT 
 1 AS `companyid`,
 1 AS `gstRegisteredDate`,
 1 AS `taxablePeriod`,
 1 AS `financialYear`,
 1 AS `startDate`,
 1 AS `endDate`,
 1 AS `period`,
 1 AS `A1`,
 1 AS `A2`,
 1 AS `B5a`,
 1 AS `B5b`,
 1 AS `B6a`,
 1 AS `B6b`,
 1 AS `B7`,
 1 AS `B8`,
 1 AS `C10`,
 1 AS `C11`,
 1 AS `C12`,
 1 AS `C13`,
 1 AS `C14`,
 1 AS `C15`,
 1 AS `C16`,
 1 AS `C17`,
 1 AS `month6`,
 1 AS `C18`*/;

--
-- Temporary view structure for view `view_gst_tax`
--

/*!50001 DROP VIEW IF EXISTS `view_gst_tax`*/;
/*!50001 CREATE VIEW `view_gst_tax` AS SELECT 
 1 AS `lineNo`,
 1 AS `companyID`,
 1 AS `taxClass`,
 1 AS `taxClassName`,
 1 AS `taxGroup`,
 1 AS `taxGroupName`,
 1 AS `taxType`,
 1 AS `taxTypeName`,
 1 AS `transType`,
 1 AS `ref`,
 1 AS `transDate`,
 1 AS `customerID`,
 1 AS `customerName`,
 1 AS `itemName`,
 1 AS `amountExcludedTax`,
 1 AS `taxRate`,
 1 AS `taxAmount`,
 1 AS `amountIncludedTax`,
 1 AS `taxID`,
 1 AS `gst`,
 1 AS `journalID`,
 1 AS `formNo`*/;

--
-- Temporary view structure for view `view_inventory_statement`
--

/*!50001 DROP VIEW IF EXISTS `view_inventory_statement`*/;
/*!50001 CREATE VIEW `view_inventory_statement` AS SELECT 
 1 AS `companyID`,
 1 AS `transactionDate`,
 1 AS `itemID`,
 1 AS `name`,
 1 AS `supplierCustomer`,
 1 AS `transactionCode`,
 1 AS `transactionType`,
 1 AS `formNo`,
 1 AS `locationID`,
 1 AS `location`,
 1 AS `unitOfMeasure`,
 1 AS `quantityIn`,
 1 AS `quantityOut`,
 1 AS `updateable`*/;

--
-- Temporary view structure for view `view_inventory_transaction`
--

/*!50001 DROP VIEW IF EXISTS `view_inventory_transaction`*/;
/*!50001 CREATE VIEW `view_inventory_transaction` AS SELECT 
 1 AS `indexing`,
 1 AS `ID`,
 1 AS `companyID`,
 1 AS `itemID`,
 1 AS `locationID`,
 1 AS `createdTS`,
 1 AS `supplierName`,
 1 AS `formNo`,
 1 AS `transDate`,
 1 AS `um`,
 1 AS `transType`,
 1 AS `qtyIn`,
 1 AS `qtyOut`*/;

--
-- Temporary view structure for view `view_inventorylist_subtotal`
--

/*!50001 DROP VIEW IF EXISTS `view_inventorylist_subtotal`*/;
/*!50001 CREATE VIEW `view_inventorylist_subtotal` AS SELECT 
 1 AS `companyid`,
 1 AS `quantity`,
 1 AS `locationid`,
 1 AS `itemID`,
 1 AS `itemName`,
 1 AS `category`,
 1 AS `description`,
 1 AS `stockValue`*/;

--
-- Temporary view structure for view `view_item_details`
--

/*!50001 DROP VIEW IF EXISTS `view_item_details`*/;
/*!50001 CREATE VIEW `view_item_details` AS SELECT 
 1 AS `companyid`,
 1 AS `itemid`,
 1 AS `itemName`,
 1 AS `description`,
 1 AS `locationid`,
 1 AS `onHandQty`,
 1 AS `umID`,
 1 AS `acctID`,
 1 AS `location`,
 1 AS `unitOfMeasure`*/;

--
-- Temporary view structure for view `view_item_quantityonhand`
--

/*!50001 DROP VIEW IF EXISTS `view_item_quantityonhand`*/;
/*!50001 CREATE VIEW `view_item_quantityonhand` AS SELECT 
 1 AS `companyID`,
 1 AS `locationID`,
 1 AS `itemID`,
 1 AS `itemCode`,
 1 AS `itemName`,
 1 AS `umID`,
 1 AS `quantityOnHand`*/;

--
-- Temporary view structure for view `view_item_quantityonhand_confirm`
--

/*!50001 DROP VIEW IF EXISTS `view_item_quantityonhand_confirm`*/;
/*!50001 CREATE VIEW `view_item_quantityonhand_confirm` AS SELECT 
 1 AS `companyID`,
 1 AS `locationID`,
 1 AS `itemID`,
 1 AS `itemCode`,
 1 AS `itemName`,
 1 AS `umID`,
 1 AS `quantityOnHand`*/;

--
-- Temporary view structure for view `view_journal_table`
--

/*!50001 DROP VIEW IF EXISTS `view_journal_table`*/;
/*!50001 CREATE VIEW `view_journal_table` AS SELECT 
 1 AS `ID`,
 1 AS `companyID`,
 1 AS `referenceNo`,
 1 AS `tableName`,
 1 AS `journalID`,
 1 AS `formNo`*/;

--
-- Temporary view structure for view `view_open_ar_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_open_ar_invoice`*/;
/*!50001 CREATE VIEW `view_open_ar_invoice` AS SELECT 
 1 AS `companyID`,
 1 AS `salesInvoiceDate`,
 1 AS `salesYear`,
 1 AS `salesMonth`,
 1 AS `slsMonth`,
 1 AS `totalAmount`*/;

--
-- Temporary view structure for view `view_salescreditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_salescreditnote`*/;
/*!50001 CREATE VIEW `view_salescreditnote` AS SELECT 
 1 AS `invoiceDetailID`,
 1 AS `unitOfMeasure`,
 1 AS `ID`,
 1 AS `invoiceID`,
 1 AS `doID`,
 1 AS `lineNo`,
 1 AS `itemID`,
 1 AS `umID`,
 1 AS `quantity`,
 1 AS `unitPrice`,
 1 AS `amountExcludedTax`,
 1 AS `taxID`,
 1 AS `taxRate`,
 1 AS `taxAmount`,
 1 AS `amountIncludedTax`,
 1 AS `accountID`,
 1 AS `createdBy`,
 1 AS `createdTS`,
 1 AS `updatedBy`,
 1 AS `updatedTS`,
 1 AS `code`,
 1 AS `itemCode`,
 1 AS `name`,
 1 AS `description`,
 1 AS `exactQty`*/;

--
-- Temporary view structure for view `view_salesdebitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_salesdebitnote`*/;
/*!50001 CREATE VIEW `view_salesdebitnote` AS SELECT 
 1 AS `invoiceDetailID`,
 1 AS `unitOfMeasure`,
 1 AS `ID`,
 1 AS `invoiceID`,
 1 AS `doID`,
 1 AS `lineNo`,
 1 AS `itemID`,
 1 AS `umID`,
 1 AS `quantity`,
 1 AS `unitPrice`,
 1 AS `amountExcludedTax`,
 1 AS `taxID`,
 1 AS `taxRate`,
 1 AS `taxAmount`,
 1 AS `amountIncludedTax`,
 1 AS `accountID`,
 1 AS `createdBy`,
 1 AS `createdTS`,
 1 AS `updatedBy`,
 1 AS `updatedTS`,
 1 AS `code`,
 1 AS `itemCode`,
 1 AS `name`,
 1 AS `description`,
 1 AS `exactQty`*/;

--
-- Temporary view structure for view `view_search`
--

/*!50001 DROP VIEW IF EXISTS `view_search`*/;
/*!50001 CREATE VIEW `view_search` AS SELECT 
 1 AS `ID`,
 1 AS `companyID`,
 1 AS `searchLink`,
 1 AS `searchKey`,
 1 AS `transDate`*/;

--
-- Temporary view structure for view `view_serial_comp_cash_sales`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_cash_sales`*/;
/*!50001 CREATE VIEW `view_serial_comp_cash_sales` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_delivery_order`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_delivery_order`*/;
/*!50001 CREATE VIEW `view_serial_comp_delivery_order` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_gst_transaction`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_gst_transaction`*/;
/*!50001 CREATE VIEW `view_serial_comp_gst_transaction` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_historical_customer_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_historical_customer_invoice`*/;
/*!50001 CREATE VIEW `view_serial_comp_historical_customer_invoice` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_historical_supplier_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_historical_supplier_invoice`*/;
/*!50001 CREATE VIEW `view_serial_comp_historical_supplier_invoice` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_location_transfer`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_location_transfer`*/;
/*!50001 CREATE VIEW `view_serial_comp_location_transfer` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_payment`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_payment`*/;
/*!50001 CREATE VIEW `view_serial_comp_payment` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_payment_others`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_payment_others`*/;
/*!50001 CREATE VIEW `view_serial_comp_payment_others` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_purchase_order`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_purchase_order`*/;
/*!50001 CREATE VIEW `view_serial_comp_purchase_order` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_quotation`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_quotation`*/;
/*!50001 CREATE VIEW `view_serial_comp_quotation` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_receive_item`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_receive_item`*/;
/*!50001 CREATE VIEW `view_serial_comp_receive_item` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_receive_payment`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_receive_payment`*/;
/*!50001 CREATE VIEW `view_serial_comp_receive_payment` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_receive_payment_others`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_receive_payment_others`*/;
/*!50001 CREATE VIEW `view_serial_comp_receive_payment_others` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_sales_creditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_creditnote`*/;
/*!50001 CREATE VIEW `view_serial_comp_sales_creditnote` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_sales_debitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_debitnote`*/;
/*!50001 CREATE VIEW `view_serial_comp_sales_debitnote` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_sales_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_invoice`*/;
/*!50001 CREATE VIEW `view_serial_comp_sales_invoice` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_sales_order`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_order`*/;
/*!50001 CREATE VIEW `view_serial_comp_sales_order` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_supplier_creditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_supplier_creditnote`*/;
/*!50001 CREATE VIEW `view_serial_comp_supplier_creditnote` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_supplier_debitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_supplier_debitnote`*/;
/*!50001 CREATE VIEW `view_serial_comp_supplier_debitnote` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_serial_comp_supplier_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_supplier_invoice`*/;
/*!50001 CREATE VIEW `view_serial_comp_supplier_invoice` AS SELECT 
 1 AS `companyID`,
 1 AS `nextSerialNo`*/;

--
-- Temporary view structure for view `view_supplier_aging`
--

/*!50001 DROP VIEW IF EXISTS `view_supplier_aging`*/;
/*!50001 CREATE VIEW `view_supplier_aging` AS SELECT 
 1 AS `companyID`,
 1 AS `supplierID`,
 1 AS `current`,
 1 AS `month1`,
 1 AS `month2`,
 1 AS `month3`,
 1 AS `month4`,
 1 AS `month5`,
 1 AS `month6`,
 1 AS `month7`,
 1 AS `month8`,
 1 AS `month9`,
 1 AS `month10`,
 1 AS `month11`*/;

--
-- Temporary view structure for view `view_supplier_statement`
--

/*!50001 DROP VIEW IF EXISTS `view_supplier_statement`*/;
/*!50001 CREATE VIEW `view_supplier_statement` AS SELECT 
 1 AS `ID`,
 1 AS `parent`,
 1 AS `companyID`,
 1 AS `supplierID`,
 1 AS `transType`,
 1 AS `transDate`,
 1 AS `refNo`,
 1 AS `formNo`,
 1 AS `dr`,
 1 AS `cr`,
 1 AS `seq`*/;

--
-- Temporary view structure for view `view_suppliercreditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_suppliercreditnote`*/;
/*!50001 CREATE VIEW `view_suppliercreditnote` AS SELECT 
 1 AS `invoiceDetailID`,
 1 AS `invoiceUm`,
 1 AS `ID`,
 1 AS `invoiceID`,
 1 AS `receiveID`,
 1 AS `lineNo`,
 1 AS `itemID`,
 1 AS `itemname`,
 1 AS `itemdescription`,
 1 AS `umID`,
 1 AS `quantity`,
 1 AS `unitPrice`,
 1 AS `amountExcludedTax`,
 1 AS `taxID`,
 1 AS `taxRate`,
 1 AS `taxAmount`,
 1 AS `amountIncludedTax`,
 1 AS `accountID`,
 1 AS `createdBy`,
 1 AS `createdTS`,
 1 AS `updatedBy`,
 1 AS `updatedTS`,
 1 AS `exactQty`,
 1 AS `unitOfMeasure`,
 1 AS `receiveDetailID`,
 1 AS `code`,
 1 AS `itemCode`,
 1 AS `name`,
 1 AS `description`*/;

--
-- Temporary view structure for view `view_supplierdebitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_supplierdebitnote`*/;
/*!50001 CREATE VIEW `view_supplierdebitnote` AS SELECT 
 1 AS `invoiceDetailID`,
 1 AS `ID`,
 1 AS `invoiceID`,
 1 AS `receiveID`,
 1 AS `lineNo`,
 1 AS `itemID`,
 1 AS `itemname`,
 1 AS `itemdescription`,
 1 AS `umID`,
 1 AS `quantity`,
 1 AS `unitPrice`,
 1 AS `amountExcludedTax`,
 1 AS `taxID`,
 1 AS `taxRate`,
 1 AS `taxAmount`,
 1 AS `amountIncludedTax`,
 1 AS `accountID`,
 1 AS `createdBy`,
 1 AS `createdTS`,
 1 AS `updatedBy`,
 1 AS `updatedTS`,
 1 AS `unitOfMeasure`,
 1 AS `receiveDetailID`,
 1 AS `code`,
 1 AS `itemCode`,
 1 AS `name`,
 1 AS `description`,
 1 AS `exactQty`*/;

--
-- Temporary view structure for view `view_total_comp_sales_creditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_total_comp_sales_creditnote`*/;
/*!50001 CREATE VIEW `view_total_comp_sales_creditnote` AS SELECT 
 1 AS `ID`,
 1 AS `totalTaxAmount`,
 1 AS `totalAmount`*/;

--
-- Temporary view structure for view `view_total_comp_sales_debitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_total_comp_sales_debitnote`*/;
/*!50001 CREATE VIEW `view_total_comp_sales_debitnote` AS SELECT 
 1 AS `ID`,
 1 AS `totalTaxAmount`,
 1 AS `totalAmount`*/;

--
-- Temporary view structure for view `view_total_comp_sales_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_total_comp_sales_invoice`*/;
/*!50001 CREATE VIEW `view_total_comp_sales_invoice` AS SELECT 
 1 AS `ID`,
 1 AS `totalTaxAmount`,
 1 AS `totalAmount`*/;

--
-- Temporary view structure for view `view_total_comp_supplier_creditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_total_comp_supplier_creditnote`*/;
/*!50001 CREATE VIEW `view_total_comp_supplier_creditnote` AS SELECT 
 1 AS `ID`,
 1 AS `totalTaxAmount`,
 1 AS `totalAmount`*/;

--
-- Temporary view structure for view `view_total_comp_supplier_debitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_total_comp_supplier_debitnote`*/;
/*!50001 CREATE VIEW `view_total_comp_supplier_debitnote` AS SELECT 
 1 AS `ID`,
 1 AS `totalTaxAmount`,
 1 AS `totalAmount`*/;

--
-- Temporary view structure for view `view_total_comp_supplier_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_total_comp_supplier_invoice`*/;
/*!50001 CREATE VIEW `view_total_comp_supplier_invoice` AS SELECT 
 1 AS `ID`,
 1 AS `totalTaxAmount`,
 1 AS `totalAmount`*/;

--
-- Temporary view structure for view `view_transaction_summary`
--

/*!50001 DROP VIEW IF EXISTS `view_transaction_summary`*/;
/*!50001 CREATE VIEW `view_transaction_summary` AS SELECT 
 1 AS `tableName`,
 1 AS `transID`,
 1 AS `companyid`,
 1 AS `year`,
 1 AS `Jan`,
 1 AS `Feb`,
 1 AS `Mar`,
 1 AS `Apr`,
 1 AS `may`,
 1 AS `Jun`,
 1 AS `Jul`,
 1 AS `Aug`,
 1 AS `Sept`,
 1 AS `Oct`,
 1 AS `Nov`,
 1 AS `Dec`*/;

--
-- Temporary view structure for view `view_unpost_ap_creditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ap_creditnote`*/;
/*!50001 CREATE VIEW `view_unpost_ap_creditnote` AS SELECT 
 1 AS `supplier`,
 1 AS `creditnoteID`,
 1 AS `lineNo`,
 1 AS `projectID`,
 1 AS `supplierInvoiceID`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `supplierID`,
 1 AS `supplierInvoiceNo`,
 1 AS `locationID`,
 1 AS `umID`,
 1 AS `quantity`,
 1 AS `itemID`,
 1 AS `itemName`,
 1 AS `amountExcludedtax`,
 1 AS `taxid`,
 1 AS `taxamount`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drTaxAccountID`,
 1 AS `crTaxAccountID`*/;

--
-- Temporary view structure for view `view_unpost_ap_debitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ap_debitnote`*/;
/*!50001 CREATE VIEW `view_unpost_ap_debitnote` AS SELECT 
 1 AS `supplier`,
 1 AS `debitnoteID`,
 1 AS `lineNo`,
 1 AS `projectID`,
 1 AS `typeID`,
 1 AS `typeDetailID`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `supplierID`,
 1 AS `supplierInvoiceNo`,
 1 AS `locationID`,
 1 AS `umID`,
 1 AS `quantity`,
 1 AS `itemID`,
 1 AS `itemName`,
 1 AS `amountExcludedtax`,
 1 AS `taxid`,
 1 AS `taxamount`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drTaxAccountID`,
 1 AS `crTaxAccountID`,
 1 AS `cogsAcctID`,
 1 AS `inventoriesAcctID`*/;

--
-- Temporary view structure for view `view_unpost_ap_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ap_invoice`*/;
/*!50001 CREATE VIEW `view_unpost_ap_invoice` AS SELECT 
 1 AS `supplier`,
 1 AS `invoiceID`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `supplierID`,
 1 AS `lineNo`,
 1 AS `itemID`,
 1 AS `itemName`,
 1 AS `amountExcludedtax`,
 1 AS `taxid`,
 1 AS `taxamount`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drTaxAccountID`,
 1 AS `crTaxAccountID`*/;

--
-- Temporary view structure for view `view_unpost_ar_creditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_creditnote`*/;
/*!50001 CREATE VIEW `view_unpost_ar_creditnote` AS SELECT 
 1 AS `customer`,
 1 AS `salesinvoiceID`,
 1 AS `creditnoteID`,
 1 AS `projectID`,
 1 AS `typeID`,
 1 AS `typeDetailID`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `customerID`,
 1 AS `locationID`,
 1 AS `salesInvoiceNo`,
 1 AS `lineNo`,
 1 AS `itemID`,
 1 AS `umID`,
 1 AS `quantity`,
 1 AS `itemName`,
 1 AS `amountExcludedtax`,
 1 AS `taxid`,
 1 AS `taxamount`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drTaxAccountID`,
 1 AS `crTaxAccountID`,
 1 AS `cogsAcctID`,
 1 AS `inventoriesAcctID`*/;

--
-- Temporary view structure for view `view_unpost_ar_debitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_debitnote`*/;
/*!50001 CREATE VIEW `view_unpost_ar_debitnote` AS SELECT 
 1 AS `customer`,
 1 AS `salesinvoiceID`,
 1 AS `debitnoteID`,
 1 AS `projectID`,
 1 AS `typeID`,
 1 AS `typeDetailID`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `customerID`,
 1 AS `locationID`,
 1 AS `salesInvoiceNo`,
 1 AS `lineNo`,
 1 AS `itemID`,
 1 AS `umID`,
 1 AS `quantity`,
 1 AS `itemName`,
 1 AS `amountExcludedtax`,
 1 AS `taxid`,
 1 AS `taxamount`,
 1 AS `currencyID`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drTaxAccountID`,
 1 AS `crTaxAccountID`,
 1 AS `cogsAcctID`,
 1 AS `inventoriesAcctID`*/;

--
-- Temporary view structure for view `view_unpost_ar_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_invoice`*/;
/*!50001 CREATE VIEW `view_unpost_ar_invoice` AS SELECT 
 1 AS `projectID`,
 1 AS `customer`,
 1 AS `invoiceID`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `customerID`,
 1 AS `itemID`,
 1 AS `lineNo`,
 1 AS `itemName`,
 1 AS `amountExcludedtax`,
 1 AS `taxid`,
 1 AS `taxamount`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drTaxAccountID`,
 1 AS `crTaxAccountID`*/;

--
-- Temporary view structure for view `view_unpost_ar_payment`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_payment`*/;
/*!50001 CREATE VIEW `view_unpost_ar_payment` AS SELECT 
 1 AS `paymentID`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `customerID`,
 1 AS `purchaseInvoiceID`,
 1 AS `customerName`,
 1 AS `lineNo`,
 1 AS `paymentDetailID`,
 1 AS `item`,
 1 AS `amtPaid_amtAppl`,
 1 AS `discount_bankCharges`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drDiscountAccountID`,
 1 AS `crDiscountAccountID`*/;

--
-- Temporary view structure for view `view_unpost_cash_purchase`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_cash_purchase`*/;
/*!50001 CREATE VIEW `view_unpost_cash_purchase` AS SELECT 
 1 AS `lineNo`,
 1 AS `quantity`,
 1 AS `unitPrice`,
 1 AS `itemID`,
 1 AS `itemdescription`,
 1 AS `umID`,
 1 AS `locationID`,
 1 AS `othersPaymentID`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `supplierID`,
 1 AS `purchaseInvoiceID`,
 1 AS `paymentDetailID`,
 1 AS `supplierInvoiceNo`,
 1 AS `ID`,
 1 AS `itemName`,
 1 AS `amountExcludedTax`,
 1 AS `taxid`,
 1 AS `taxAmount`,
 1 AS `projectID`,
 1 AS `itemTypeID`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drDiscountAccountID`,
 1 AS `crDiscountAccountID`*/;

--
-- Temporary view structure for view `view_unpost_cash_sale`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_cash_sale`*/;
/*!50001 CREATE VIEW `view_unpost_cash_sale` AS SELECT 
 1 AS `projectID`,
 1 AS `customer`,
 1 AS `invoiceID`,
 1 AS `typeID`,
 1 AS `typeDetailID`,
 1 AS `locationID`,
 1 AS `quantity`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `itemID`,
 1 AS `umID`,
 1 AS `lineNo`,
 1 AS `currencyID`,
 1 AS `itemName`,
 1 AS `amountExcludedtax`,
 1 AS `taxid`,
 1 AS `taxamount`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drTaxAccountID`,
 1 AS `crTaxAccountID`,
 1 AS `cogsAcctID`,
 1 AS `inventoriesAcctID`*/;

--
-- Temporary view structure for view `view_unpost_do`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_do`*/;
/*!50001 CREATE VIEW `view_unpost_do` AS SELECT 
 1 AS `deliveryOrderID`,
 1 AS `customerID`,
 1 AS `projectID`,
 1 AS `customer`,
 1 AS `invoiceID`,
 1 AS `typeID`,
 1 AS `typeDetailID`,
 1 AS `locationID`,
 1 AS `quantity`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `itemID`,
 1 AS `itemName`,
 1 AS `amountExcludedtax`,
 1 AS `taxid`,
 1 AS `taxamount`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drTaxAccountID`,
 1 AS `crTaxAccountID`,
 1 AS `cogsAcctID`,
 1 AS `inventoriesAcctID`*/;

--
-- Temporary view structure for view `view_unpost_gst_transaction`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_gst_transaction`*/;
/*!50001 CREATE VIEW `view_unpost_gst_transaction` AS SELECT 
 1 AS `paymentID`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `supplierID`,
 1 AS `purchaseInvoiceID`,
 1 AS `supplierName`,
 1 AS `lineNo`,
 1 AS `paymentDetailID`,
 1 AS `supplierInvoiceNo`,
 1 AS `item`,
 1 AS `amtPaid_amtAppl`,
 1 AS `discount_bankCharges`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drDiscountAccountID`,
 1 AS `crDiscountAccountID`*/;

--
-- Temporary view structure for view `view_unpost_other_payment`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_other_payment`*/;
/*!50001 CREATE VIEW `view_unpost_other_payment` AS SELECT 
 1 AS `othersPaymentID`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `supplierID`,
 1 AS `purchaseInvoiceID`,
 1 AS `paymentDetailID`,
 1 AS `supplierInvoiceNo`,
 1 AS `lineNo`,
 1 AS `itemdescription`,
 1 AS `amountExcludedtax`,
 1 AS `taxid`,
 1 AS `taxamount`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drTaxAccountID`,
 1 AS `crTaxAccountID`*/;

--
-- Temporary view structure for view `view_unpost_other_receive`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_other_receive`*/;
/*!50001 CREATE VIEW `view_unpost_other_receive` AS SELECT 
 1 AS `projectID`,
 1 AS `receiveFrom`,
 1 AS `otherReceiveID`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `NULL`,
 1 AS `itemdescription`,
 1 AS `amountExcludedtax`,
 1 AS `taxid`,
 1 AS `taxamount`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drTaxAccountID`,
 1 AS `crTaxAccountID`*/;

--
-- Temporary view structure for view `view_unpost_payment`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_payment`*/;
/*!50001 CREATE VIEW `view_unpost_payment` AS SELECT 
 1 AS `paymentID`,
 1 AS `formNo`,
 1 AS `companyID`,
 1 AS `supplierID`,
 1 AS `purchaseInvoiceID`,
 1 AS `supplierName`,
 1 AS `lineNo`,
 1 AS `paymentDetailID`,
 1 AS `supplierInvoiceNo`,
 1 AS `item`,
 1 AS `amtPaid_amtAppl`,
 1 AS `discount_bankCharges`,
 1 AS `drAccountID`,
 1 AS `crAccountID`,
 1 AS `drDiscountAccountID`,
 1 AS `crDiscountAccountID`*/;

--
-- Temporary view structure for view `view_unpost_receive_item`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_receive_item`*/;
/*!50001 CREATE VIEW `view_unpost_receive_item` AS SELECT 
 1 AS `receiveID`,
 1 AS `companyID`,
 1 AS `locationID`,
 1 AS `transactionDate`,
 1 AS `supplierID`,
 1 AS `formNo`,
 1 AS `lineNo`,
 1 AS `itemID`,
 1 AS `itemName`,
 1 AS `exchangeRate`,
 1 AS `unitPrice`,
 1 AS `quantityReceived`,
 1 AS `umID`,
 1 AS `amount`,
 1 AS `drAccountID`,
 1 AS `crAccountID`*/;

--
-- Temporary view structure for view `view_wakaf_accrual`
--

/*!50001 DROP VIEW IF EXISTS `view_wakaf_accrual`*/;
/*!50001 CREATE VIEW `view_wakaf_accrual` AS SELECT 
 1 AS `companyID`,
 1 AS `acctID`,
 1 AS `year`,
 1 AS `totalAmount`*/;

--
-- Temporary view structure for view `view_wakaf_from_profit`
--

/*!50001 DROP VIEW IF EXISTS `view_wakaf_from_profit`*/;
/*!50001 CREATE VIEW `view_wakaf_from_profit` AS SELECT 
 1 AS `companyid`,
 1 AS `year`,
 1 AS `acctType`,
 1 AS `totalDr`,
 1 AS `totalCr`*/;

--
-- Table structure for table `wakaf`
--

CREATE TABLE `wakaf` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `waqifID` int(11) NOT NULL COMMENT 'link to mastercode',
  `wakafCenterID` int(11) NOT NULL,
  `allocation` tinyint(4) NOT NULL COMMENT '0=lumpsum,1=percentage',
  `periodYear` smallint(6) NOT NULL,
  `periodFrom` tinyint(4) NOT NULL,
  `periodTo` tinyint(4) NOT NULL,
  `amountAllocated` double NOT NULL,
  `createdBy` int(11) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `wakaf`
--


--
-- Table structure for table `wakaf_acrual`
--

CREATE TABLE `wakaf_acrual` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `salesAccountID` int(11) NOT NULL,
  `from` date NOT NULL,
  `to` date NOT NULL,
  `wakafPercent` decimal(10,0) NOT NULL,
  `createdBy` int(11) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `wakaf_acrual`
--


--
-- Table structure for table `wakaf_beneficiaries`
--

CREATE TABLE `wakaf_beneficiaries` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `shortName` varchar(12) NOT NULL DEFAULT '0',
  `name` varchar(128) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `createdBy` int(11) NOT NULL,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `wakaf_beneficiaries`
--


--
-- Table structure for table `wakaf_center`
--

CREATE TABLE `wakaf_center` (
  `ID` int(11) NOT NULL,
  `shortName` varchar(12) NOT NULL DEFAULT '0',
  `name` varchar(128) NOT NULL,
  `line1` varchar(128) NOT NULL,
  `line2` varchar(128) NOT NULL,
  `line3` varchar(128) NOT NULL,
  `city` varchar(64) NOT NULL,
  `postCode` varchar(8) NOT NULL,
  `stateID` int(11) NOT NULL,
  `countryID` int(11) NOT NULL,
  `noTel` varchar(50) NOT NULL,
  `noFax` varchar(50) NOT NULL,
  `email` varchar(128) NOT NULL,
  `website` varchar(128) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `createdBy` int(11) NOT NULL,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` smallint(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `wakaf_center`
--

INSERT INTO `wakaf_center` VALUES (1,'MAIPS','Baitulmal Unit Wakaf, Majlis Agama Islam dan Adat Istiadat Melayu Perlis','A2,','Taman Pengkalan Asam,','Jalan Kangar- Alor Setar','Kangar','01000',1928,458,'','','','','2015-03-29 19:55:19',0,0,'0000-00-00 00:00:00',0),(2,'MAIKS','Bahagian Wakaf, Majlis Agama Islam Negeri Kedah','','Bangunan Wan Mat Saman','','Alor Setar','05000',1923,458,'','','','','2015-03-29 19:55:19',0,0,'0000-00-00 00:00:00',0),(3,'MAINPP','Bahagian Wakaf, Majlis Agama Islam Pulau Pinang','Tingkat 8 & 9','Menara UMNO,','128 Jalan Macalister','','10400',1929,458,'','','','','2015-03-29 19:55:19',0,0,'0000-00-00 00:00:00',0),(4,'MAIAMP','Majlis Agama Islam dan Adat Melayu Perak','Tingkat 1','Kompleks Islam Darul Ridzuan,','Jalan Panglima BUkit Gantang Wahab','Ipoh','30000',0,458,'034567894','','','','2015-03-29 19:55:19',0,1,'0000-00-00 00:00:00',0),(5,'MAIWP','Bahagian Baitulmal Majlis Agama Islam Wilayah Persekutuan ','Bangunan Daruzzakah Lorong Haji Hussein 2 ','','',' KUALA LUMPUR','50676',1933,458,'603-2617 5222','603-2617 5252','baitulmal@maiwp.gov.my','http://www.maiwp.gov.my/','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(6,'MAIS(PWS)','Perbadanan Wakaf Selangor Majlis Agama Islam Selangor','Tingkat 10 Menara Selatan,',' Bangunan Sultan Idris Shah','','Shah Alam',' 40000 ',1931,458,'603-5514 3758 / 3759','603-5514 3759','wakaf@wakafselangor.gov.my','www.wakafselangor.gov.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(7,'MAIM','Majlis Agama Islam Melaka','Pusat Islam Melaka ','Bukit Palah','','Melaka','75400 ',1924,458,'606-283 7416, 283 2077, 284 9809','606-282 6033','admin@maim.gov.my','www.maim.gov.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(8,'MAIJ','Pejabat Wakaf Majlis Agama Islam Negeri Johor','Jalan Abdul Rahman Andak','','','Johor Bahru','80100',1921,458,'607-2221655','607-2221677','wakaf@maij.gov.my','www.maij.gov.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(9,'MAIK','Majlis Agama Islam Dan Adat Istiadat Melayu Kelantan','Kompleks Balai Islam  Lundang','','','Kota Bharu','15200',1923,458,'609-7481512 ','609-7485512','maik@e-maik.my','www.e-maik.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(10,'MAIDAM','Majlis Agama Islam dan Adat Melayu Terengganu','Pusat Pentadbiran Islam Negeri','Kompleks Seri Iman','Jalan Sultan Mohamad','Kuala Terengganu','20676 ',1932,458,'609-6303030 / 6252525','609-6248134 / 6235185',' info@maidam.gov.my','www.maidam.gov.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(11,'MUIP','Majlis Ugama Islam Dan Adat Resam Melayu Pahang','Kompleks Islam Sultan Haji Ahmad Shah',' Jalan Istana Permai','',' Pekan','26600',1926,458,'609-4221311','609-4221885','info@muip.gov.my','www.muip.gov.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(12,'TBS','Tabung Baitulmal Majlis Islam Sarawak','Tabung Baitulmal Sarawak Bangunan Baitulmal',' Lot 71, Seksyen 8, KTLD',' Jalan Haji Muhamad Kassim','Kuching','93400 ',1930,458,' 6082-415563',' 6082-253786','','www.tbs.org.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(13,'MUIS','Pusat Zakat Sabah Majlis Ugama Islam Sabah','Tingkat 1, Blok A & B','Wisma MUIS','Peti Surat 11666','Kota Kibabalu','88818',1935,458,'6088-240 160','6088-260 246','','www.zakat@sabah.gov.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(14,'JWM','Yayasan Waqaf Malaysia','No. 13, Jalan Diplomatik 2/2','Presint Diplomatik Putrajaya','',' Putrajaya',' 62050',0,458,'603-8890 4071 / 72 / 73','603-8890 1010 / 2091',' info@ywm.gov.my','www.ywm.gov.my','2015-03-29 19:55:19',0,29,'0000-00-00 00:00:00',0),(1,'MAIPS','Baitulmal Unit Wakaf, Majlis Agama Islam dan Adat Istiadat Melayu Perlis','A2,','Taman Pengkalan Asam,','Jalan Kangar- Alor Setar','Kangar','01000',1928,458,'','','','','2015-03-29 19:55:19',0,0,'0000-00-00 00:00:00',0),(2,'MAIKS','Bahagian Wakaf, Majlis Agama Islam Negeri Kedah','','Bangunan Wan Mat Saman','','Alor Setar','05000',1923,458,'','','','','2015-03-29 19:55:19',0,0,'0000-00-00 00:00:00',0),(3,'MAINPP','Bahagian Wakaf, Majlis Agama Islam Pulau Pinang','Tingkat 8 & 9','Menara UMNO,','128 Jalan Macalister','','10400',1929,458,'','','','','2015-03-29 19:55:19',0,0,'0000-00-00 00:00:00',0),(4,'MAIAMP','Majlis Agama Islam dan Adat Melayu Perak','Tingkat 1','Kompleks Islam Darul Ridzuan,','Jalan Panglima BUkit Gantang Wahab','Ipoh','30000',0,458,'034567894','','','','2015-03-29 19:55:19',0,1,'0000-00-00 00:00:00',0),(5,'MAIWP','Bahagian Baitulmal Majlis Agama Islam Wilayah Persekutuan ','Bangunan Daruzzakah Lorong Haji Hussein 2 ','','',' KUALA LUMPUR','50676',1933,458,'603-2617 5222','603-2617 5252','baitulmal@maiwp.gov.my','http://www.maiwp.gov.my/','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(6,'MAIS(PWS)','Perbadanan Wakaf Selangor Majlis Agama Islam Selangor','Tingkat 10 Menara Selatan,',' Bangunan Sultan Idris Shah','','Shah Alam',' 40000 ',1931,458,'603-5514 3758 / 3759','603-5514 3759','wakaf@wakafselangor.gov.my','www.wakafselangor.gov.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(7,'MAIM','Majlis Agama Islam Melaka','Pusat Islam Melaka ','Bukit Palah','','Melaka','75400 ',1924,458,'606-283 7416, 283 2077, 284 9809','606-282 6033','admin@maim.gov.my','www.maim.gov.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(8,'MAIJ','Pejabat Wakaf Majlis Agama Islam Negeri Johor','Jalan Abdul Rahman Andak','','','Johor Bahru','80100',1921,458,'607-2221655','607-2221677','wakaf@maij.gov.my','www.maij.gov.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(9,'MAIK','Majlis Agama Islam Dan Adat Istiadat Melayu Kelantan','Kompleks Balai Islam  Lundang','','','Kota Bharu','15200',1923,458,'609-7481512 ','609-7485512','maik@e-maik.my','www.e-maik.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(10,'MAIDAM','Majlis Agama Islam dan Adat Melayu Terengganu','Pusat Pentadbiran Islam Negeri','Kompleks Seri Iman','Jalan Sultan Mohamad','Kuala Terengganu','20676 ',1932,458,'609-6303030 / 6252525','609-6248134 / 6235185',' info@maidam.gov.my','www.maidam.gov.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(11,'MUIP','Majlis Ugama Islam Dan Adat Resam Melayu Pahang','Kompleks Islam Sultan Haji Ahmad Shah',' Jalan Istana Permai','',' Pekan','26600',1926,458,'609-4221311','609-4221885','info@muip.gov.my','www.muip.gov.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(12,'TBS','Tabung Baitulmal Majlis Islam Sarawak','Tabung Baitulmal Sarawak Bangunan Baitulmal',' Lot 71, Seksyen 8, KTLD',' Jalan Haji Muhamad Kassim','Kuching','93400 ',1930,458,' 6082-415563',' 6082-253786','','www.tbs.org.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(13,'MUIS','Pusat Zakat Sabah Majlis Ugama Islam Sabah','Tingkat 1, Blok A & B','Wisma MUIS','Peti Surat 11666','Kota Kibabalu','88818',1935,458,'6088-240 160','6088-260 246','','www.zakat@sabah.gov.my','2015-03-29 19:55:19',0,16,'0000-00-00 00:00:00',0),(14,'JWM','Yayasan Waqaf Malaysia','No. 13, Jalan Diplomatik 2/2','Presint Diplomatik Putrajaya','',' Putrajaya',' 62050',0,458,'603-8890 4071 / 72 / 73','603-8890 1010 / 2091',' info@ywm.gov.my','www.ywm.gov.my','2015-03-29 19:55:19',0,29,'0000-00-00 00:00:00',0);

--
-- Table structure for table `wakaf_details_allocation`
--

CREATE TABLE `wakaf_details_allocation` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `wakafID` varchar(64) NOT NULL DEFAULT '0',
  `accountID` int(11) NOT NULL,
  `saleAmount` double NOT NULL,
  `contributionPercentage` double NOT NULL,
  `amount` double NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `createdBy` int(11) NOT NULL,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `wakaf_details_allocation`
--


--
-- Table structure for table `wakaf_details_distribution`
--

CREATE TABLE `wakaf_details_distribution` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `wakafID` varchar(64) NOT NULL DEFAULT '0',
  `beneficiariesID` int(11) NOT NULL,
  `description` varchar(128) NOT NULL,
  `contributionPercentage` double NOT NULL,
  `amount` double NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `createdBy` int(11) NOT NULL,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `wakaf_details_distribution`
--


--
-- Table structure for table `wakaf_master`
--

CREATE TABLE `wakaf_master` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL DEFAULT '0',
  `waqif` varchar(64) NOT NULL DEFAULT '0',
  `category` varchar(24) NOT NULL,
  `allocationID` int(11) NOT NULL,
  `beneficiariesID` int(11) NOT NULL,
  `description` varchar(128) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `createdBy` int(11) NOT NULL,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `wakaf_master`
--


--
-- Table structure for table `zakat_center`
--

CREATE TABLE `zakat_center` (
  `ID` int(11) NOT NULL,
  `shortName` varchar(12) NOT NULL DEFAULT '0',
  `name` varchar(128) NOT NULL,
  `line1` varchar(128) NOT NULL,
  `line2` varchar(128) NOT NULL,
  `line3` varchar(128) NOT NULL,
  `city` varchar(64) NOT NULL,
  `postCode` varchar(8) NOT NULL,
  `stateID` int(11) NOT NULL,
  `countryID` int(11) NOT NULL,
  `noTel` varchar(50) NOT NULL,
  `noFax` varchar(50) NOT NULL,
  `email` varchar(128) NOT NULL,
  `website` varchar(128) NOT NULL,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0',
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `createdBy` int(11) NOT NULL,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `zakat_center`
--

INSERT INTO `zakat_center` VALUES (1,'LZS','Lembaga Zakat Selangor','3-01-1, Presint ALAMi,','Pusat Perniagaan Worldwide 2, ','Persiaran Akuatik, Seksyen 13, ','Shah Alam','40100',1931,458,'03-5522 7700','03-5522 7722','','http://www.e-zakat.com.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(2,'PPZ','Pusat Pungutan Zakat, Majlis Agama Islam Wilayah Persekutuan','xx','','','Kuala Lumpur','12345678',1933,458,'+603.9289.5757','+603.9289.5758','info@zakat.com.my','http://www.zakat.com.my/',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(7,'MAIPS','Majlis Agama Islam & Adat Istiadat Melayu Perlis','A2, Taman Pengkalan Asam','Jalan Kangar- Alor Setar','','Kangar','01000',1928,458,'04-9794439','04-9782400','','www.maips.gov.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(8,'JZNK','Jabatan Zakat Negeri Kedah','Jabatan Zakat Negeri Kedah Darulaman Aras 3',' Menara Zakat','Jalan Teluk Wanjah','Alor Setar','05000',1922,458,'04-733 1740','','','',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(9,'MAIK','Majlis Agama Islam Dan Adat Istiadat Melayu Kelantan','Kompleks Balai Islam Lundang','','','Kota Bharu','15200',1923,458,'09 7481512','09 7485512','maik@e-maik.my','www.e-maik.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(10,'PZM','Pusat Zakat Melaka','No. 1 & 3,Jalan KPAA 1',' Kompleks Perniagaan Al-Azim ','','Bukit Baru','75150',1924,458,'1-300-88-0233','06-2818154','',' www.izakat.com',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(11,'MAINS','Pusat Zakat Negeri Sembilan','No. 25, Betaria Business Centre','Jalan Durian Emas 4','Off Jalan Dato\' Siamang Gagap','Seremban','70100 ',1925,458,'06-765 1402 ','06-765 1407','info@zakatns.com.my','www.zakatns.com.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(12,'MAIPk',' MAJLIS AGAMA ISLAM DAN ADAT MELAYU PERAK','Tingkat 1, Kompleks Islam Darul Ridzuan','Jalan Panglima BUkit Gantang Wahab','','Ipoh','30000',1927,458,'05-208 400',' 05-241 4257','korporat@maiamp.gov.my','www.maiamp.gov.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(13,'MUIP','Majlis Ugama Islam Dan Adat Resam Melayu Pahang','No.111A, Tingkat 1 ','Bangunan MUIP','Jalan Mahkota','Kuantan','25000 ',1926,458,'09-5131515',' 09-5152541','info@muip.gov.my','www.zakatpahang.my/v2',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(14,'ZPP','Zakat Pulau Pinang','No.4 Jalan Perda Selatan','Bandar Perda','','Bukit Mertajam','14000 ',1929,458,'04-549 8088','04 530 6466','admin@zakatpenang.com','www.zakatpenang.com',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(15,'MAIDAM','Majlis Agama Islam dan Adat Melayu Terengganu','Pusat Pentadbiran Islam Negeri','Kompleks Seri Iman',' Jalan Sultan Mohamad',' Kuala Terengganu','20676 ',1932,458,'09-6303030 / 09-6252525','09-6248134 / 09-6235185','info@maidam.gov.my','www.maidam.gov.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(16,'MUIS','Pusat Zakat Sabah','Tingkat 1, Blok A & B','Wisma MUIS','Peti Surat 11666','Kota Kinabalu','88818 ',1935,458,'088-240 160','088-260 246','www.zakat@sabah.gov.my','www.zakat.sabah.gov.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(17,'TBS','Tabung Baitulmal Sarawak','Bangunan Baitulmal','Lot 71, Seksyen 8, KTLD','Jalan Haji Muhamad Kassim','Kuching','93400 ',1930,458,'082-415563','082-253786','admin@tbs.org.my','www.tbs.org.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(18,'MAIJ','Majlis Agama Islam Negeri Johor','Aras 5, Blok ‘B’, Pusat Islam Iskandar Johor',' Jalan Masjid Abu Bakar','Karung Berkunci 725',' Johor Bahru','80990',1921,458,'07-2282929 / 07-2282937','07-2238752 / 07-2275173','zakat@maij.gov.my','www.maij.gov.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(1,'LZS','Lembaga Zakat Selangor','3-01-1, Presint ALAMi,','Pusat Perniagaan Worldwide 2, ','Persiaran Akuatik, Seksyen 13, ','Shah Alam','40100',1931,458,'03-5522 7700','03-5522 7722','','http://www.e-zakat.com.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(2,'PPZ','Pusat Pungutan Zakat, Majlis Agama Islam Wilayah Persekutuan','xx','','','Kuala Lumpur','12345678',1933,458,'+603.9289.5757','+603.9289.5758','info@zakat.com.my','http://www.zakat.com.my/',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(7,'MAIPS','Majlis Agama Islam & Adat Istiadat Melayu Perlis','A2, Taman Pengkalan Asam','Jalan Kangar- Alor Setar','','Kangar','01000',1928,458,'04-9794439','04-9782400','','www.maips.gov.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(8,'JZNK','Jabatan Zakat Negeri Kedah','Jabatan Zakat Negeri Kedah Darulaman Aras 3',' Menara Zakat','Jalan Teluk Wanjah','Alor Setar','05000',1922,458,'04-733 1740','','','',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(9,'MAIK','Majlis Agama Islam Dan Adat Istiadat Melayu Kelantan','Kompleks Balai Islam Lundang','','','Kota Bharu','15200',1923,458,'09 7481512','09 7485512','maik@e-maik.my','www.e-maik.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(10,'PZM','Pusat Zakat Melaka','No. 1 & 3,Jalan KPAA 1',' Kompleks Perniagaan Al-Azim ','','Bukit Baru','75150',1924,458,'1-300-88-0233','06-2818154','',' www.izakat.com',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(11,'MAINS','Pusat Zakat Negeri Sembilan','No. 25, Betaria Business Centre','Jalan Durian Emas 4','Off Jalan Dato\' Siamang Gagap','Seremban','70100 ',1925,458,'06-765 1402 ','06-765 1407','info@zakatns.com.my','www.zakatns.com.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(12,'MAIPk',' MAJLIS AGAMA ISLAM DAN ADAT MELAYU PERAK','Tingkat 1, Kompleks Islam Darul Ridzuan','Jalan Panglima BUkit Gantang Wahab','','Ipoh','30000',1927,458,'05-208 400',' 05-241 4257','korporat@maiamp.gov.my','www.maiamp.gov.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(13,'MUIP','Majlis Ugama Islam Dan Adat Resam Melayu Pahang','No.111A, Tingkat 1 ','Bangunan MUIP','Jalan Mahkota','Kuantan','25000 ',1926,458,'09-5131515',' 09-5152541','info@muip.gov.my','www.zakatpahang.my/v2',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(14,'ZPP','Zakat Pulau Pinang','No.4 Jalan Perda Selatan','Bandar Perda','','Bukit Mertajam','14000 ',1929,458,'04-549 8088','04 530 6466','admin@zakatpenang.com','www.zakatpenang.com',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(15,'MAIDAM','Majlis Agama Islam dan Adat Melayu Terengganu','Pusat Pentadbiran Islam Negeri','Kompleks Seri Iman',' Jalan Sultan Mohamad',' Kuala Terengganu','20676 ',1932,458,'09-6303030 / 09-6252525','09-6248134 / 09-6235185','info@maidam.gov.my','www.maidam.gov.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(16,'MUIS','Pusat Zakat Sabah','Tingkat 1, Blok A & B','Wisma MUIS','Peti Surat 11666','Kota Kinabalu','88818 ',1935,458,'088-240 160','088-260 246','www.zakat@sabah.gov.my','www.zakat.sabah.gov.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(17,'TBS','Tabung Baitulmal Sarawak','Bangunan Baitulmal','Lot 71, Seksyen 8, KTLD','Jalan Haji Muhamad Kassim','Kuching','93400 ',1930,458,'082-415563','082-253786','admin@tbs.org.my','www.tbs.org.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00'),(18,'MAIJ','Majlis Agama Islam Negeri Johor','Aras 5, Blok ‘B’, Pusat Islam Iskandar Johor',' Jalan Masjid Abu Bakar','Karung Berkunci 725',' Johor Bahru','80990',1921,458,'07-2282929 / 07-2282937','07-2238752 / 07-2275173','zakat@maij.gov.my','www.maij.gov.my',0,'2015-03-29 19:55:19',1,0,'0000-00-00 00:00:00');

--
-- Table structure for table `zakat_details`
--

CREATE TABLE `zakat_details` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `zakatSummaryID` int(11) NOT NULL,
  `compAcctDetailID` int(11) NOT NULL,
  `acctGroup` varchar(64) DEFAULT NULL,
  `desc` varchar(64) DEFAULT NULL,
  `amount` double DEFAULT NULL,
  `createdBy` int(11) DEFAULT NULL,
  `createdTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBy` int(11) DEFAULT NULL,
  `updatedTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `zakat_details`
--


--
-- Table structure for table `zakat_group`
--

CREATE TABLE `zakat_group` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL DEFAULT '1',
  `name` varchar(50) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `parentID` int(11) DEFAULT '0',
  `sequence` int(11) DEFAULT NULL,
  `createdBy` int(11) DEFAULT NULL,
  `createdTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBy` int(11) DEFAULT NULL,
  `updatedTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `zakat_group`
--


--
-- Table structure for table `zakat_group_details`
--

CREATE TABLE `zakat_group_details` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL DEFAULT '1',
  `groupID` int(11) DEFAULT NULL,
  `acctID` int(11) DEFAULT NULL,
  `createdBy` int(11) DEFAULT NULL,
  `createdTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBy` int(11) DEFAULT NULL,
  `updatedTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `zakat_group_details`
--


--
-- Table structure for table `zakat_nisab`
--

CREATE TABLE `zakat_nisab` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL DEFAULT '0',
  `centerID` int(11) DEFAULT NULL,
  `year` year(4) DEFAULT NULL,
  `nisab` double DEFAULT NULL,
  `createdBy` int(11) DEFAULT NULL,
  `createdTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBy` int(11) DEFAULT NULL,
  `updatedTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `zakat_nisab`
--


--
-- Table structure for table `zakat_summary`
--

CREATE TABLE `zakat_summary` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL DEFAULT '1',
  `centerID` int(11) NOT NULL DEFAULT '1',
  `year` varchar(4) DEFAULT NULL,
  `calculationMethod` varchar(32) NOT NULL,
  `muslimOwnershipShare` double NOT NULL,
  `nisab` double NOT NULL,
  `netCurrentAsset` double NOT NULL,
  `totalDueForZakat` double NOT NULL,
  `zakatPayableForTheYear` double NOT NULL,
  `monthlyZakatPayable` double NOT NULL,
  `totalAmount` double DEFAULT NULL,
  `totalZakatPaid` double DEFAULT NULL,
  `createdBy` int(11) DEFAULT NULL,
  `createdTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBy` int(11) DEFAULT NULL,
  `updatedTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` int(11) NOT NULL DEFAULT '0',
  `updateAble` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `zakat_summary`
--


--
-- Final view structure for view `view_account_balance`
--

/*!50001 DROP VIEW IF EXISTS `view_account_balance`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_account_balance` AS select `a`.`companyID` AS `companyID`,`a`.`acctID` AS `acctID`,concat(left(`b`.`acctCode`,4),'-',substr(`b`.`acctCode`,4,3),'-',right(`b`.`acctCode`,2),' ',`b`.`acctName`) AS `acctName`,`a`.`year` AS `year`,`a`.`period` AS `period`,sum(`a`.`total`) AS `closing` from (`comp_acc_det` `a` join `comp_chart_of_acct` `b`) where (`b`.`ID` = `a`.`acctID`) group by `a`.`companyID`,`a`.`acctID`,`b`.`acctName`,`a`.`year`,`a`.`period` */;

--
-- Final view structure for view `view_ar_inventory`
--

/*!50001 DROP VIEW IF EXISTS `view_ar_inventory`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_ar_inventory` AS select `comp_sales_invoice`.`companyID` AS `companyID`,`comp_sales_invoice`.`customerID` AS `customerID`,concat(`comp_sales_invoice`.`formNo`,'[',convert(lpad(`comp_sales_invoice`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`comp_sales_invoice`.`salesInvoiceDate` AS `salesinvoiceDate`,`comp_sales_invoice`.`totalReceivable` AS `totalReceivable` from `comp_sales_invoice` where (`comp_sales_invoice`.`totalReceivable` > 0) */;

--
-- Final view structure for view `view_ar_open_position`
--

/*!50001 DROP VIEW IF EXISTS `view_ar_open_position`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_ar_open_position` AS select `a`.`companyID` AS `companyID`,`a`.`ID` AS `customerID`,`a`.`customerName` AS `customerName`,`a`.`phoneNumber1` AS `phoneNumber1`,`a`.`email` AS `email`,(select sum(`inv`.`totalReceivable`) from (`comp_sales_invoice` `inv` join `terms`) where ((`inv`.`termsID` = `terms`.`ID`) and (`inv`.`companyID` = `a`.`companyID`) and (`inv`.`customerID` = `a`.`ID`) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) <= -(90)))) AS `due120`,(select sum(`inv`.`totalReceivable`) from (`comp_sales_invoice` `inv` join `terms`) where ((`inv`.`termsID` = `terms`.`ID`) and (`inv`.`companyID` = `a`.`companyID`) and (`inv`.`customerID` = `a`.`ID`) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) > -(90)) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) <= -(60)))) AS `due90`,(select sum(`inv`.`totalReceivable`) from (`comp_sales_invoice` `inv` join `terms`) where ((`inv`.`termsID` = `terms`.`ID`) and (`inv`.`companyID` = `a`.`companyID`) and (`inv`.`customerID` = `a`.`ID`) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) > -(60)) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) <= -(30)))) AS `due60`,(select sum(`inv`.`totalReceivable`) from (`comp_sales_invoice` `inv` join `terms`) where ((`inv`.`termsID` = `terms`.`ID`) and (`inv`.`companyID` = `a`.`companyID`) and (`inv`.`customerID` = `a`.`ID`) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) > -(30)) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) <= -(5)))) AS `due30`,(select sum(`inv`.`totalReceivable`) from (`comp_sales_invoice` `inv` join `terms`) where ((`inv`.`termsID` = `terms`.`ID`) and (`inv`.`companyID` = `a`.`companyID`) and (`inv`.`customerID` = `a`.`ID`) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) > -(5)) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) <= 5))) AS `due0`,(select sum(`inv`.`totalReceivable`) from (`comp_sales_invoice` `inv` join `terms`) where ((`inv`.`termsID` = `terms`.`ID`) and (`inv`.`companyID` = `a`.`companyID`) and (`inv`.`customerID` = `a`.`ID`) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) > 5) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) <= 30))) AS `pastDue30`,(select sum(`inv`.`totalReceivable`) from (`comp_sales_invoice` `inv` join `terms`) where ((`inv`.`termsID` = `terms`.`ID`) and (`inv`.`companyID` = `a`.`companyID`) and (`inv`.`customerID` = `a`.`ID`) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) > 30) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) <= 60))) AS `pastDue60`,(select sum(`inv`.`totalReceivable`) from (`comp_sales_invoice` `inv` join `terms`) where ((`inv`.`termsID` = `terms`.`ID`) and (`inv`.`companyID` = `a`.`companyID`) and (`inv`.`customerID` = `a`.`ID`) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) > 60) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) <= 90))) AS `pastDue90`,(select sum(`inv`.`totalReceivable`) from (`comp_sales_invoice` `inv` join `terms`) where ((`inv`.`termsID` = `terms`.`ID`) and (`inv`.`companyID` = `a`.`companyID`) and (`inv`.`customerID` = `a`.`ID`) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) > 90) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) <= 120))) AS `pastDue120`,(select sum(`inv`.`totalReceivable`) from (`comp_sales_invoice` `inv` join `terms`) where ((`inv`.`termsID` = `terms`.`ID`) and (`inv`.`companyID` = `a`.`companyID`) and (`inv`.`customerID` = `a`.`ID`) and ((timestampdiff(DAY,`inv`.`salesInvoiceDate`,now()) - `terms`.`dueDays`) > 120))) AS `pastDue` from `customer` `a` */;

--
-- Final view structure for view `view_balance_sheet`
--

/*!50001 DROP VIEW IF EXISTS `view_balance_sheet`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_balance_sheet` AS select `a`.`acctCode` AS `acctCode`,`a`.`acctName` AS `acctName`,`a`.`acctGroupID` AS `acctGroupID`,sum(`b`.`amountdr`) AS `currentyeardebit`,sum(`b`.`amountcr`) AS `currentyearcredit`,sum(`c`.`amountdr`) AS `lastyeardebit`,sum(`c`.`amountcr`) AS `lastyearcredit` from ((`comp_chart_of_acct` `a` left join `comp_acc_det` `b` on(((`b`.`acctID` = `a`.`ID`) and (`b`.`year` = 2014) and (`b`.`period` <= 9)))) left join `comp_acc_det` `c` on(((`c`.`acctID` = `a`.`ID`) and (`c`.`year` < 2014)))) where (`a`.`companyID` = '110') group by `a`.`acctCode` */;

--
-- Final view structure for view `view_bank_reconcile`
--

/*!50001 DROP VIEW IF EXISTS `view_bank_reconcile`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_bank_reconcile` AS select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyid`,'comp_journal_detail' AS `tableName`,`b`.`ID` AS `bankid`,(select max(`view_journal_table`.`referenceNo`) AS `referenceNo` from `view_journal_table` where ((`view_journal_table`.`journalID` = `a`.`journalID`) and (`view_journal_table`.`companyID` = `a`.`companyID`))) AS `referenceNo`,`c`.`effective_date` AS `transDate`,`a`.`journalID` AS `formNo`,`a`.`description` AS `description`,`a`.`amount_dr` AS `debitAmount`,`a`.`amount_cr` AS `creditAmount` from ((`comp_journal_detail` `a` left join `comp_bank` `b` on((`a`.`acctCode` = `b`.`linkAccountID`))) left join `comp_journal` `c` on(((`c`.`journalID` = `a`.`journalID`) and (`c`.`companyID` = `a`.`companyID`)))) where ((`a`.`bankReconcileID` = 0) and (`c`.`status` = 1)) */;

--
-- Final view structure for view `view_bank_reconcile_reverse`
--

/*!50001 DROP VIEW IF EXISTS `view_bank_reconcile_reverse`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_bank_reconcile_reverse` AS select `a`.`bankReconcileID` AS `bankReconcileID`,`a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,'comp_cash_sales' AS `tableName`,`a`.`bankID` AS `bankID`,`a`.`referenceNo` AS `referenceNo`,`a`.`salesInvoiceDate` AS `transDate`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`a`.`paymentFrom` AS `description`,`a`.`totalAmountIncludeTax` AS `debitAmount`,0 AS `creditAmount` from `comp_cash_sales` `a` where (`a`.`bankReconcileID` <> 0) union select `a`.`bankReconcileID` AS `bankReconcileID`,`a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,'comp_receive_payment' AS `tableName`,`a`.`bankID` AS `bankID`,`a`.`referenceNo` AS `referenceNo`,`a`.`receivePaymentDate` AS `transDate`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`b`.`customerName` AS `description`,`a`.`totalReceived` AS `debitAmount`,0 AS `creditAmount` from (`comp_receive_payment` `a` join `customer` `b`) where ((`a`.`bankReconcileID` <> 0) and (`a`.`customerID` = `b`.`ID`)) union select `a`.`bankReconcileID` AS `bankReconcileID`,`a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,'comp_receive_payment_others' AS `tableName`,`a`.`bankID` AS `bankID`,`a`.`referenceNo` AS `referenceNo`,`a`.`receivePaymentDate` AS `transDate`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`a`.`receiveFrom` AS `description`,`a`.`totalReceived` AS `debitAmount`,0 AS `creditAmount` from `comp_receive_payment_others` `a` where (`a`.`bankReconcileID` <> 0) union select `a`.`bankReconcileID` AS `bankReconcileID`,`a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,'comp_receive_payment_others' AS `tableName`,`a`.`bankID` AS `bankID`,`a`.`referenceNo` AS `referenceNo`,`a`.`receivePaymentDate` AS `transDate`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`a`.`receiveFrom` AS `description`,`a`.`totalReceived` AS `debitAmount`,0 AS `creditAmount` from `comp_receive_payment_others` `a` where (`a`.`bankReconcileID` <> 0) union select `a`.`bankReconcileID` AS `bankReconcileID`,`a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,'comp_payment' AS `tableName`,`a`.`bankID` AS `bankID`,`a`.`referenceNo` AS `referenceNo`,`a`.`paymentDate` AS `transDate`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`b`.`supplierName` AS `description`,0 AS `debitAmount`,`a`.`totalPaid` AS `creditAmount` from (`comp_payment` `a` join `supplier` `b`) where ((`a`.`bankReconcileID` <> 0) and (`a`.`supplierID` = `b`.`ID`)) union select `a`.`bankReconcileID` AS `bankReconcileID`,`a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,'comp_payment_others' AS `tableName`,`a`.`bankId` AS `bankID`,`a`.`referenceNo` AS `referenceNo`,`a`.`paymentDate` AS `transDate`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`a`.`payTo` AS `description`,0 AS `debitAmount`,`a`.`amountPaid` AS `creditAmount` from `comp_payment_others` `a` where (`a`.`bankReconcileID` <> 0) */;

--
-- Final view structure for view `view_chart_of_acct_updateable`
--

/*!50001 DROP VIEW IF EXISTS `view_chart_of_acct_updateable`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_chart_of_acct_updateable` AS select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`a`.`acctGroupID` AS `acctGroupID`,`a`.`acctCode` AS `acctCode`,`a`.`acctName` AS `acctName`,`a`.`acctDesc` AS `acctDesc`,if((((select count(`comp_journal_detail`.`ID`) from `comp_journal_detail` where (`comp_journal_detail`.`acctCode` = `a`.`ID`)) + (select count(`comp_opening_balance`.`ID`) from `comp_opening_balance` where ((`comp_opening_balance`.`accountID` = `a`.`ID`) and ((`comp_opening_balance`.`debit` + `comp_opening_balance`.`credit`) > 0)))) > 0),10,1) AS `updateable` from `comp_chart_of_acct` `a` */;

--
-- Final view structure for view `view_comp_acc_det`
--

/*!50001 DROP VIEW IF EXISTS `view_comp_acc_det`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_comp_acc_det` AS select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`a`.`acctGroupID` AS `acctGroupID`,`a`.`acctID` AS `acctID`,`a`.`year` AS `year`,`a`.`period` AS `period`,(select coalesce(sum(`comp_journal_detail`.`amount_dr`),0) from `comp_journal_detail` where ((`comp_journal_detail`.`companyID` = `a`.`companyID`) and (`comp_journal_detail`.`acctCode` = `a`.`acctID`) and (`comp_journal_detail`.`period` = `a`.`period`) and (`comp_journal_detail`.`year` = `a`.`year`) and (`comp_journal_detail`.`status` = 1) and (`comp_journal_detail`.`is_delete` = 0))) AS `amountdr`,(select coalesce(sum(`comp_journal_detail`.`amount_cr`),0) from `comp_journal_detail` where ((`comp_journal_detail`.`companyID` = `a`.`companyID`) and (`comp_journal_detail`.`acctCode` = `a`.`acctID`) and (`comp_journal_detail`.`period` = `a`.`period`) and (`comp_journal_detail`.`year` = `a`.`year`) and (`comp_journal_detail`.`status` = 1) and (`comp_journal_detail`.`is_delete` = 0))) AS `amountcr`,(select (coalesce(sum(`comp_journal_detail`.`amount_dr`),0) - coalesce(sum(`comp_journal_detail`.`amount_cr`),0)) from `comp_journal_detail` where ((`comp_journal_detail`.`companyID` = `a`.`companyID`) and (`comp_journal_detail`.`acctCode` = `a`.`acctID`) and (`comp_journal_detail`.`period` = `a`.`period`) and (`comp_journal_detail`.`year` = `a`.`year`) and (`comp_journal_detail`.`status` = 1) and (`comp_journal_detail`.`is_delete` = 0))) AS `total`,`a`.`createdBy` AS `createdBy`,`a`.`createdTS` AS `createdTS`,`a`.`updatedBy` AS `updatedBy`,`a`.`updatedTS` AS `updatedTS`,`a`.`is_delete` AS `is_delete` from `comp_acc_det` `a` where ((`a`.`companyID` > 0) and (`a`.`acctID` > 0) and (`a`.`year` > 0) and (`a`.`period` > 0)) */;

--
-- Final view structure for view `view_customer_aging`
--

/*!50001 DROP VIEW IF EXISTS `view_customer_aging`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_customer_aging` AS select `a`.`companyID` AS `companyID`,`a`.`ID` AS `customerID`,`a`.`customerName` AS `customerName`,`a`.`phoneNumber1` AS `phoneNumber1`,`a`.`email` AS `email`,((ifnull((select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 0) and (`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_sales_debitnote`.`total`) from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`companyID` = `a`.`companyID`) and (`comp_sales_debitnote`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_debitnote`.`debitNoteDate`,now()) = 0) and (`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_customer_invoice`.`totalReceivable`) from `comp_historical_customer_invoice` where ((`comp_historical_customer_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_customer_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_customer_invoice`.`salesInvoiceDate`,now()) = 0) and (`comp_historical_customer_invoice`.`updateAble` = 0) and (`comp_historical_customer_invoice`.`is_delete` = 0))),0)) AS `current`,((ifnull((select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 1) and (`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_sales_debitnote`.`total`) from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`companyID` = `a`.`companyID`) and (`comp_sales_debitnote`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_debitnote`.`debitNoteDate`,now()) = 1) and (`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_customer_invoice`.`totalReceivable`) from `comp_historical_customer_invoice` where ((`comp_historical_customer_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_customer_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_customer_invoice`.`salesInvoiceDate`,now()) = 1) and (`comp_historical_customer_invoice`.`updateAble` = 0) and (`comp_historical_customer_invoice`.`is_delete` = 0))),0)) AS `month1`,((ifnull((select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 2) and (`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_sales_debitnote`.`total`) from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`companyID` = `a`.`companyID`) and (`comp_sales_debitnote`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_debitnote`.`debitNoteDate`,now()) = 2) and (`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_customer_invoice`.`totalReceivable`) from `comp_historical_customer_invoice` where ((`comp_historical_customer_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_customer_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_customer_invoice`.`salesInvoiceDate`,now()) = 2) and (`comp_historical_customer_invoice`.`updateAble` = 0) and (`comp_historical_customer_invoice`.`is_delete` = 0))),0)) AS `month2`,((ifnull((select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 3) and (`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_sales_debitnote`.`total`) from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`companyID` = `a`.`companyID`) and (`comp_sales_debitnote`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_debitnote`.`debitNoteDate`,now()) = 3) and (`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_customer_invoice`.`totalReceivable`) from `comp_historical_customer_invoice` where ((`comp_historical_customer_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_customer_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_customer_invoice`.`salesInvoiceDate`,now()) = 3) and (`comp_historical_customer_invoice`.`updateAble` = 0) and (`comp_historical_customer_invoice`.`is_delete` = 0))),0)) AS `month3`,((ifnull((select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 4) and (`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_sales_debitnote`.`total`) from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`companyID` = `a`.`companyID`) and (`comp_sales_debitnote`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_debitnote`.`debitNoteDate`,now()) = 4) and (`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_customer_invoice`.`totalReceivable`) from `comp_historical_customer_invoice` where ((`comp_historical_customer_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_customer_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_customer_invoice`.`salesInvoiceDate`,now()) = 4) and (`comp_historical_customer_invoice`.`updateAble` = 0) and (`comp_historical_customer_invoice`.`is_delete` = 0))),0)) AS `month4`,((ifnull((select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 5) and (`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_sales_debitnote`.`total`) from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`companyID` = `a`.`companyID`) and (`comp_sales_debitnote`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_debitnote`.`debitNoteDate`,now()) = 5) and (`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_customer_invoice`.`totalReceivable`) from `comp_historical_customer_invoice` where ((`comp_historical_customer_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_customer_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_customer_invoice`.`salesInvoiceDate`,now()) = 5) and (`comp_historical_customer_invoice`.`updateAble` = 0) and (`comp_historical_customer_invoice`.`is_delete` = 0))),0)) AS `month5`,((ifnull((select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 6) and (`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_sales_debitnote`.`total`) from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`companyID` = `a`.`companyID`) and (`comp_sales_debitnote`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_debitnote`.`debitNoteDate`,now()) = 6) and (`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_customer_invoice`.`totalReceivable`) from `comp_historical_customer_invoice` where ((`comp_historical_customer_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_customer_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_customer_invoice`.`salesInvoiceDate`,now()) = 6) and (`comp_historical_customer_invoice`.`updateAble` = 0) and (`comp_historical_customer_invoice`.`is_delete` = 0))),0)) AS `month6`,((ifnull((select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 7) and (`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_sales_debitnote`.`total`) from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`companyID` = `a`.`companyID`) and (`comp_sales_debitnote`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_debitnote`.`debitNoteDate`,now()) = 7) and (`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_customer_invoice`.`totalReceivable`) from `comp_historical_customer_invoice` where ((`comp_historical_customer_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_customer_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_customer_invoice`.`salesInvoiceDate`,now()) = 7) and (`comp_historical_customer_invoice`.`updateAble` = 0) and (`comp_historical_customer_invoice`.`is_delete` = 0))),0)) AS `month7`,((ifnull((select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 8) and (`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_sales_debitnote`.`total`) from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`companyID` = `a`.`companyID`) and (`comp_sales_debitnote`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_debitnote`.`debitNoteDate`,now()) = 8) and (`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_customer_invoice`.`totalReceivable`) from `comp_historical_customer_invoice` where ((`comp_historical_customer_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_customer_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_customer_invoice`.`salesInvoiceDate`,now()) = 8) and (`comp_historical_customer_invoice`.`updateAble` = 0) and (`comp_historical_customer_invoice`.`is_delete` = 0))),0)) AS `month8`,((ifnull((select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 9) and (`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_sales_debitnote`.`total`) from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`companyID` = `a`.`companyID`) and (`comp_sales_debitnote`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_debitnote`.`debitNoteDate`,now()) = 9) and (`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_customer_invoice`.`totalReceivable`) from `comp_historical_customer_invoice` where ((`comp_historical_customer_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_customer_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_customer_invoice`.`salesInvoiceDate`,now()) = 9) and (`comp_historical_customer_invoice`.`updateAble` = 0) and (`comp_historical_customer_invoice`.`is_delete` = 0))),0)) AS `month9`,((ifnull((select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 10) and (`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_sales_debitnote`.`total`) from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`companyID` = `a`.`companyID`) and (`comp_sales_debitnote`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_debitnote`.`debitNoteDate`,now()) = 10) and (`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_customer_invoice`.`totalReceivable`) from `comp_historical_customer_invoice` where ((`comp_historical_customer_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_customer_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_customer_invoice`.`salesInvoiceDate`,now()) = 10) and (`comp_historical_customer_invoice`.`updateAble` = 0) and (`comp_historical_customer_invoice`.`is_delete` = 0))),0)) AS `month10`,((ifnull((select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) > 10) and (`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_sales_debitnote`.`total`) from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`companyID` = `a`.`companyID`) and (`comp_sales_debitnote`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_debitnote`.`debitNoteDate`,now()) > 10) and (`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_customer_invoice`.`totalReceivable`) from `comp_historical_customer_invoice` where ((`comp_historical_customer_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_customer_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_customer_invoice`.`salesInvoiceDate`,now()) > 10) and (`comp_historical_customer_invoice`.`updateAble` = 0) and (`comp_historical_customer_invoice`.`is_delete` = 0))),0)) AS `month11` from `customer` `a` */;

--
-- Final view structure for view `view_customer_statement`
--

/*!50001 DROP VIEW IF EXISTS `view_customer_statement`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_customer_statement` AS select `comp_sales_invoice`.`ID` AS `ID`,`comp_sales_invoice`.`ID` AS `parent`,`comp_sales_invoice`.`companyID` AS `companyID`,`comp_sales_invoice`.`customerID` AS `customerID`,'Invoice' AS `transType`,`comp_sales_invoice`.`salesInvoiceDate` AS `transDate`,`comp_sales_invoice`.`customerPoNo` AS `refNo`,concat(concat(concat(`comp_sales_invoice`.`formNo`,'['),convert(lpad(`comp_sales_invoice`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`comp_sales_invoice`.`totalamount` AS `dr`,NULL AS `cr`,1 AS `seq` from `comp_sales_invoice` where ((`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0)) union select `a`.`ID` AS `ID`,`a`.`salesInvoiceID` AS `parent`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,'DebitNote' AS `transType`,`a`.`debitNoteDate` AS `transDate`,concat(concat(concat(`b`.`formNo`,'['),convert(lpad(`b`.`serialNo`,8,'0') using latin1)),']') AS `refno`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`totalAmount` AS `dr`,NULL AS `cr`,2 AS `seq` from (`comp_sales_debitnote` `a` join `comp_sales_invoice` `b`) where ((`a`.`updateAble` = 0) and (`a`.`is_delete` = 0) and (`b`.`ID` = `a`.`salesInvoiceID`)) union select `a`.`ID` AS `ID`,`a`.`salesInvoiceID` AS `parent`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,'CreditNote' AS `transType`,`a`.`creditNoteDate` AS `transDate`,concat(concat(concat(`b`.`formNo`,'['),convert(lpad(`b`.`serialNo`,8,'0') using latin1)),']') AS `refno`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,NULL AS `dr`,`a`.`totalAmount` AS `cr`,3 AS `seq` from (`comp_sales_creditnote` `a` join `comp_sales_invoice` `b`) where ((`a`.`updateAble` = 0) and (`a`.`is_delete` = 0) and (`b`.`ID` = `a`.`salesInvoiceID`)) union select `b`.`ID` AS `ID`,0 AS `parent`,`b`.`companyID` AS `companyID`,`b`.`customerID` AS `customerID`,if((`b`.`updateAble` = 0),'Payment','** Payment') AS `transType`,`b`.`receivePaymentDate` AS `transDate`,`b`.`referenceNo` AS `refNo`,concat(concat(concat(`b`.`formNo`,'['),convert(lpad(`b`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,NULL AS `dr`,`b`.`totalReceived` AS `cr`,4 AS `seq` from `comp_receive_payment` `b` where (`b`.`is_delete` = 0) union select `b`.`ID` AS `ID`,0 AS `parent`,`b`.`companyID` AS `companyID`,`b`.`customerID` AS `customerID`,'Discount' AS `transType`,`b`.`receivePaymentDate` AS `transDate`,NULL AS `refNo`,concat(concat(concat(`b`.`formNo`,'['),convert(lpad(`b`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,NULL AS `dr`,`b`.`totalDiscount` AS `cr`,4 AS `seq` from `comp_receive_payment` `b` where ((`b`.`totalDiscount` > 0) and (`b`.`updateAble` = 0) and (`b`.`is_delete` = 0)) union select `b`.`ID` AS `ID`,0 AS `parent`,`b`.`companyID` AS `companyID`,`b`.`customerID` AS `customerID`,'Historical Invoice' AS `transType`,`b`.`salesInvoiceDate` AS `transDate`,NULL AS `refNo`,concat(concat(concat(`b`.`formNo`,'['),convert(lpad(`b`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`b`.`totalAmount` AS `dr`,NULL AS `cr`,1 AS `seq` from `comp_historical_customer_invoice` `b` where ((`b`.`updateAble` = 0) and (`b`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_expence_and_income`
--

/*!50001 DROP VIEW IF EXISTS `view_expence_and_income`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_expence_and_income` AS select `a`.`companyID` AS `companyid`,`a`.`year` AS `year`,`a`.`period` AS `period`,`c`.`ID` AS `groupID`,`c`.`acctTypeID` AS `acctType`,coalesce(sum(`a`.`amountdr`),0) AS `totalDr`,coalesce(sum(`a`.`amountcr`),0) AS `totalCr`,if((`c`.`acctTypeID` = 3),(coalesce(sum(`a`.`amountcr`),0) - coalesce(sum(`a`.`amountdr`),0)),(coalesce(sum(`a`.`amountdr`),0) - coalesce(sum(`a`.`amountcr`),0))) AS `balance` from ((`comp_acc_det` `a` join `comp_chart_of_acct` `b`) join `_ref_acct_group` `c`) where ((`b`.`ID` = `a`.`acctID`) and (`c`.`ID` = `b`.`acctGroupID`) and (`c`.`acctTypeID` in (3,4)) and (`c`.`title` = 1) and (`a`.`period` > 0) and (`b`.`companyID` > 0)) group by `a`.`companyID`,`a`.`year`,`a`.`period`,`acctType` */;

--
-- Final view structure for view `view_gaf`
--

/*!50001 DROP VIEW IF EXISTS `view_gaf`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_gaf` AS select `a`.`companyID` AS `companyID`,'P' AS `col1`,`a`.`supplierName` AS `col2`,`a`.`supplierCompanyNo` AS `col3`,`b`.`invoiceDate` AS `col4`,concat(`b`.`formNo`,'[',convert(lpad(`b`.`serialNo`,8,'0') using latin1),']') AS `col5`,'import declaration number' AS `col6`,`c`.`lineNo` AS `col7`,`c`.`itemdescription` AS `col8`,(`c`.`amountExcludedTax` * `b`.`exchangeRate`) AS `col9`,(`c`.`taxAmount` * `b`.`exchangeRate`) AS `col10`,`e`.`code` AS `col11`,`d`.`fldcurr_code` AS `col12`,`c`.`amountExcludedTax` AS `col13`,`c`.`taxAmount` AS `col14` from ((((`supplier` `a` join `comp_supplier_invoice` `b`) join `comp_supplier_invoice_detail` `c`) join `_ref_currency` `d`) join `tax_master` `e`) where ((`a`.`ID` = `b`.`supplierID`) and (`b`.`ID` = `c`.`invoiceID`) and (`d`.`fldid` = `a`.`currencyID`) and (`e`.`ID` = `c`.`taxID`)) union select `a`.`companyID` AS `companyID`,'P' AS `col1`,`a`.`supplierName` AS `col2`,`a`.`supplierCompanyNo` AS `col3`,`b`.`invoiceDate` AS `col4`,concat(`b`.`formNo`,'[',convert(lpad(`b`.`serialNo`,8,'0') using latin1),']') AS `col5`,'import declaration number' AS `col6`,`c`.`lineNo` AS `col7`,`c`.`itemdescription` AS `col8`,(`c`.`amountExcludedTax` * `b`.`exchangeRate`) AS `col9`,(`c`.`taxAmount` * `b`.`exchangeRate`) AS `col10`,`e`.`code` AS `col11`,`d`.`fldcurr_code` AS `col12`,`c`.`amountExcludedTax` AS `col13`,`c`.`taxAmount` AS `col14` from ((((`supplier` `a` join `comp_supplier_invoice` `b`) join `comp_supplier_invoice_charges` `c`) join `_ref_currency` `d`) join `tax_master` `e`) where ((`a`.`ID` = `b`.`supplierID`) and (`b`.`ID` = `c`.`invoiceID`) and (`d`.`fldid` = `a`.`currencyID`) and (`e`.`ID` = `c`.`taxID`)) union select `a`.`companyID` AS `companyID`,'P' AS `col1`,`a`.`supplierName` AS `col2`,`a`.`supplierCompanyNo` AS `col3`,`b`.`debitNoteDate` AS `col4`,concat(`b`.`formNo`,'[',convert(lpad(`b`.`serialNo`,8,'0') using latin1),']') AS `col5`,'import declaration number' AS `col6`,`c`.`lineNo` AS `col7`,`c`.`itemdescription` AS `col8`,(`c`.`amountExcludedTax` * `b`.`exchangeRate`) AS `col9`,(`c`.`taxAmount` * `b`.`exchangeRate`) AS `col10`,`e`.`code` AS `col11`,`d`.`fldcurr_code` AS `col12`,`c`.`amountExcludedTax` AS `col13`,`c`.`taxAmount` AS `col14` from ((((`supplier` `a` join `comp_supplier_debitnote` `b`) join `comp_supplier_debitnote_detail` `c`) join `_ref_currency` `d`) join `tax_master` `e`) where ((`a`.`ID` = `b`.`supplierID`) and (`b`.`ID` = `c`.`debitnoteID`) and (`d`.`fldid` = `a`.`currencyID`) and (`e`.`ID` = `c`.`taxID`)) union select `a`.`companyID` AS `companyID`,'P' AS `col1`,`a`.`supplierName` AS `col2`,`a`.`supplierCompanyNo` AS `col3`,`b`.`creditNoteDate` AS `col4`,concat(`b`.`formNo`,'[',convert(lpad(`b`.`serialNo`,8,'0') using latin1),']') AS `col5`,'import declaration number' AS `col6`,`c`.`lineNo` AS `col7`,`c`.`itemdescription` AS `col8`,(`c`.`amountExcludedTax` * `b`.`exchangeRate`) AS `col9`,(`c`.`taxAmount` * `b`.`exchangeRate`) AS `col10`,`e`.`code` AS `col11`,`d`.`fldcurr_code` AS `col12`,`c`.`amountExcludedTax` AS `col13`,`c`.`taxAmount` AS `col14` from ((((`supplier` `a` join `comp_supplier_creditnote` `b`) join `comp_supplier_creditnote_detail` `c`) join `_ref_currency` `d`) join `tax_master` `e`) where ((`a`.`ID` = `b`.`supplierID`) and (`b`.`ID` = `c`.`creditnoteID`) and (`d`.`fldid` = `a`.`currencyID`) and (`e`.`ID` = `c`.`taxID`)) union select `a`.`companyID` AS `companyID`,'S' AS `col1`,`a`.`customerName` AS `col2`,`a`.`customerCompanyNo` AS `col3`,`b`.`salesInvoiceDate` AS `col4`,concat(`b`.`formNo`,'[',convert(lpad(`b`.`serialNo`,8,'0') using latin1),']') AS `col5`,`c`.`lineNo` AS `col6`,`g`.`description` AS `col7`,(`c`.`amountExcludedTax` * `b`.`exchangeRate`) AS `col8`,(`c`.`taxAmount` * `b`.`exchangeRate`) AS `col9`,`e`.`code` AS `col10`,`f`.`fldcountry` AS `col11`,`d`.`fldcurr_code` AS `col12`,`c`.`amountExcludedTax` AS `col13`,`c`.`taxAmount` AS `col14` from ((((((`customer` `a` join `comp_sales_invoice` `b`) join `comp_sales_invoice_detail` `c`) join `_ref_currency` `d`) join `tax_master` `e`) join `_ref_country` `f`) join `item` `g`) where ((`a`.`ID` = `b`.`customerID`) and (`b`.`ID` = `c`.`invoiceID`) and (`d`.`fldid` = `a`.`currencyID`) and (`e`.`ID` = `c`.`taxID`) and (`f`.`fldid` = `a`.`customerCountryID`) and (`g`.`ID` = `c`.`itemID`)) union select `a`.`companyID` AS `companyID`,'S' AS `col1`,`a`.`customerName` AS `col2`,`a`.`customerCompanyNo` AS `col3`,`b`.`salesInvoiceDate` AS `col4`,concat(`b`.`formNo`,'[',convert(lpad(`b`.`serialNo`,8,'0') using latin1),']') AS `col5`,`c`.`lineNo` AS `col6`,`c`.`chargeDescription` AS `col7`,(`c`.`amountExcludedTax` * `b`.`exchangeRate`) AS `col8`,(`c`.`taxAmount` * `b`.`exchangeRate`) AS `col9`,`e`.`code` AS `col10`,`f`.`fldcountry` AS `col11`,`d`.`fldcurr_code` AS `col12`,`c`.`amountExcludedTax` AS `col13`,`c`.`taxAmount` AS `col14` from (((((`customer` `a` join `comp_sales_invoice` `b`) join `comp_sales_invoice_charges` `c`) join `_ref_currency` `d`) join `tax_master` `e`) join `_ref_country` `f`) where ((`a`.`ID` = `b`.`customerID`) and (`b`.`ID` = `c`.`invoiceID`) and (`d`.`fldid` = `a`.`currencyID`) and (`e`.`ID` = `c`.`taxID`) and (`f`.`fldid` = `a`.`customerCountryID`)) union select `a`.`companyID` AS `companyID`,'S' AS `col1`,`a`.`customerName` AS `col2`,`a`.`customerCompanyNo` AS `col3`,`b`.`debitNoteDate` AS `col4`,concat(`b`.`formNo`,'[',convert(lpad(`b`.`serialNo`,8,'0') using latin1),']') AS `col5`,`c`.`lineNo` AS `col6`,`c`.`itemdescription` AS `col7`,(`c`.`amountExcludedTax` * `b`.`exchangeRate`) AS `col8`,(`c`.`taxAmount` * `b`.`exchangeRate`) AS `col9`,`e`.`code` AS `col10`,`f`.`fldcountry` AS `col11`,`d`.`fldcurr_code` AS `col12`,`c`.`amountExcludedTax` AS `col13`,`c`.`taxAmount` AS `col14` from (((((`customer` `a` join `comp_sales_debitnote` `b`) join `comp_sales_debitnote_detail` `c`) join `_ref_currency` `d`) join `tax_master` `e`) join `_ref_country` `f`) where ((`a`.`ID` = `b`.`customerID`) and (`b`.`ID` = `c`.`debitnoteID`) and (`d`.`fldid` = `a`.`currencyID`) and (`e`.`ID` = `c`.`taxID`) and (`f`.`fldid` = `a`.`customerCountryID`)) union select `a`.`companyID` AS `companyID`,'S' AS `col1`,`a`.`customerName` AS `col2`,`a`.`customerCompanyNo` AS `col3`,`b`.`creditNoteDate` AS `col4`,concat(`b`.`formNo`,'[',convert(lpad(`b`.`serialNo`,8,'0') using latin1),']') AS `col5`,`c`.`lineNo` AS `col6`,`c`.`itemdescription` AS `col7`,(`c`.`amountExcludedTax` * `b`.`exchangeRate`) AS `col8`,(`c`.`taxAmount` * `b`.`exchangeRate`) AS `col9`,`e`.`code` AS `col10`,`f`.`fldcountry` AS `col11`,`d`.`fldcurr_code` AS `col12`,`c`.`amountExcludedTax` AS `col13`,`c`.`taxAmount` AS `col14` from (((((`customer` `a` join `comp_sales_creditnote` `b`) join `comp_sales_creditnote_detail` `c`) join `_ref_currency` `d`) join `tax_master` `e`) join `_ref_country` `f`) where ((`a`.`ID` = `b`.`customerID`) and (`b`.`ID` = `c`.`creditnoteID`) and (`d`.`fldid` = `a`.`currencyID`) and (`e`.`ID` = `c`.`taxID`) and (`f`.`fldid` = `a`.`customerCountryID`)) */;

--
-- Final view structure for view `view_grn_report`
--

/*!50001 DROP VIEW IF EXISTS `view_grn_report`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_grn_report` AS select `po`.`companyID` AS `companyID`,`um`.`code` AS `unitMesure`,`podet`.`ID` AS `ID`,`i`.`itemCode` AS `itemCode`,`i`.`name` AS `itemName`,concat(`po`.`formNo`,'[',convert(lpad(`po`.`serialNo`,8,0) using latin1),']') AS `poNo`,date_format(`po`.`poDate`,'%d-%m-%Y') AS `PoDate`,`podet`.`unitPrice` AS `unitPrice`,`podet`.`quantityOrder` AS `quantityOrder`,((`podet`.`quantityOrder` - `podet`.`quantityReceivedTotal`) * `podet`.`unitPrice`) AS `total`,sum(round((`ridet`.`quantityReceived` / ifnull(`umconv`.`factor`,1)),0)) AS `totalRcv`,(`podet`.`quantityOrder` - ifnull(sum(round((`ridet`.`quantityReceived` / ifnull(`umconv`.`factor`,1)),0)),0)) AS `QtyLeft`,`podet`.`itemID` AS `itemID` from ((((((`comp_purchase_order_detail` `podet` left join `comp_purchase_order` `po` on((`po`.`ID` = `podet`.`purchaseOrderID`))) left join `comp_receive_item_detail` `ridet` on((`ridet`.`poDetailID` = `podet`.`ID`))) left join `comp_receive_item` `ri` on((`ri`.`ID` = `ridet`.`receiveID`))) left join `item` `i` on((`i`.`ID` = `podet`.`itemID`))) left join `_sys_um` `um` on((`um`.`fldid` = `podet`.`umID`))) left join `_sys_um_conv` `umconv` on(((`umconv`.`itemID` = `podet`.`itemID`) and (`umconv`.`from_um` = `ridet`.`standUM`) and (`umconv`.`to_um` = `ridet`.`umID`) and (`umconv`.`companyID` = `po`.`companyID`)))) where ((`po`.`updateAble` = 0) and (`ri`.`updateAble` = 0)) group by `podet`.`ID` */;

--
-- Final view structure for view `view_gst_report`
--

/*!50001 DROP VIEW IF EXISTS `view_gst_report`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_gst_report` AS select `a`.`companyID` AS `companyid`,`b`.`gstRegisteredDate` AS `gstRegisteredDate`,`b`.`taxablePeriod` AS `taxablePeriod`,`a`.`financialYear` AS `financialYear`,`a`.`startDate` AS `startDate`,`a`.`endDate` AS `endDate`,`a`.`period` AS `period`,`b`.`gstRegisteredNo` AS `A1`,`b`.`companyName` AS `A2`,(select sum(`view_gst_tax`.`amountExcludedTax`) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('SR','DS','IMS')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) AS `B5a`,(select sum(`view_gst_tax`.`taxAmount`) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('SR','DS','AJS','IMS')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) AS `B5b`,(select sum(`view_gst_tax`.`amountExcludedTax`) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('TX','TX-CG','IM','IMS','TX-E43','TX-RE')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) AS `B6a`,(select sum(`view_gst_tax`.`taxAmount`) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('AJP','TX','TX-CG','IM','IMS','TX-E43','TX-RE')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) AS `B6b`,if(((select coalesce(sum(`view_gst_tax`.`taxAmount`),0) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('SR','DS','AJS','IMS')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) > (select coalesce(sum(`view_gst_tax`.`taxAmount`),0) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('TX','TX-CG','IM','IMS','TX-E43','TX-RE')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`)))),((select coalesce(sum(`view_gst_tax`.`taxAmount`),0) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('SR','DS','AJS','IMS')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) - (select coalesce(sum(`view_gst_tax`.`taxAmount`),0) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('TX','TX-CG','IM','IMS','TX-E43','TX-RE')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`)))),0) AS `B7`,if(((select coalesce(sum(`view_gst_tax`.`taxAmount`),0) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('TX','TX-CG','IM','IMS','TX-E43','TX-RE')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) > (select coalesce(sum(`view_gst_tax`.`taxAmount`),0) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('SR','DS','AJS','IMS')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`)))),((select coalesce(sum(`view_gst_tax`.`taxAmount`),0) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('TX','TX-CG','IM','IMS','TX-E43','TX-RE')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) - (select coalesce(sum(`view_gst_tax`.`taxAmount`),0) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('SR','DS','AJS','IMS')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`)))),0) AS `B8`,(select sum(`view_gst_tax`.`amountExcludedTax`) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` = 'ZRL') and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) AS `C10`,(select sum(`view_gst_tax`.`amountExcludedTax`) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` = 'ZRE') and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) AS `C11`,(select sum(`view_gst_tax`.`amountExcludedTax`) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` in ('ES','ES43')) and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) AS `C12`,(select sum(`view_gst_tax`.`amountExcludedTax`) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` = 'RS') and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) AS `C13`,(select sum(`view_gst_tax`.`amountExcludedTax`) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` = 'IS') and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) AS `C14`,(select sum((`view_gst_tax`.`amountExcludedTax` * 0.06)) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` = 'IS') and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) AS `C15`,(select sum(`view_gst_tax`.`amountExcludedTax`) from `view_gst_tax` where ((`view_gst_tax`.`companyID` = `a`.`companyID`) and (`view_gst_tax`.`gst` = 'TX-CG') and (`view_gst_tax`.`transDate` between `a`.`startDate` and `a`.`endDate`))) AS `C16`,(select sum(`comp_sales_bad_debt`.`valueBadDebt`) from `comp_sales_bad_debt` where ((`comp_sales_bad_debt`.`companyID` = `a`.`companyID`) and (`comp_sales_bad_debt`.`transDate` between `a`.`startDate` and `a`.`endDate`) and (`comp_sales_bad_debt`.`updateAble` = 0))) AS `C17`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) >= 6))) AS `month6`,(select sum(`comp_sales_debt_recover`.`valueDebtRecover`) from `comp_sales_debt_recover` where ((`comp_sales_debt_recover`.`companyID` = `a`.`companyID`) and (`comp_sales_debt_recover`.`transDate` between `a`.`startDate` and `a`.`endDate`) and (`comp_sales_debt_recover`.`updateAble` = 0))) AS `C18` from (`comp_financial_year` `a` join `company` `b`) where ((`b`.`ID` = `a`.`companyID`) and (`a`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_gst_tax`
--

/*!50001 DROP VIEW IF EXISTS `view_gst_tax`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_gst_tax` AS select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Sales Invoice' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`salesInvoiceDate` AS `transDate`,`a`.`customerID` AS `customerID`,`d`.`customerName` AS `customerName`,concat(`e`.`name`,' / ',`e`.`itemCode`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,`b`.`taxAmount` AS `taxAmount`,`b`.`amountIncludedTax` AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from ((((((((`comp_sales_invoice` `a` join `comp_sales_invoice_detail` `b`) join `customer` `d`) join `item` `e`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`invoiceID`) and (`a`.`customerID` = `d`.`ID`) and (`e`.`ID` = `b`.`itemID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`e`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Sales Invoice' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`salesInvoiceDate` AS `transDate`,`a`.`customerID` AS `customerID`,`d`.`customerName` AS `customerName`,`b`.`chargeDescription` AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,`b`.`taxAmount` AS `taxAmount`,`b`.`amountIncludedTax` AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from (((((((`comp_sales_invoice` `a` join `comp_sales_invoice_charges` `b`) join `customer` `d`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`invoiceID`) and (`a`.`customerID` = `d`.`ID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Sales Credit Note' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`creditNoteDate` AS `transDate`,`a`.`customerID` AS `customerID`,`d`.`customerName` AS `customerName`,concat(`e`.`name`,' / ',`e`.`itemCode`) AS `itemName`,(`b`.`amountExcludedTax` * -(1)) AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,(`b`.`taxAmount` * -(1)) AS `taxAmount`,(`b`.`amountIncludedTax` * -(1)) AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from ((((((((`comp_sales_creditnote` `a` join `comp_sales_creditnote_detail` `b`) join `customer` `d`) join `item` `e`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`creditnoteID`) and (`a`.`customerID` = `d`.`ID`) and (`e`.`ID` = `b`.`itemID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`e`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Sales Credit Note' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`creditNoteDate` AS `transDate`,`a`.`customerID` AS `customerID`,`d`.`customerName` AS `customerName`,`b`.`chargeDescription` AS `itemName`,(`b`.`amountExcludedTax` * -(1)) AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,(`b`.`taxAmount` * -(1)) AS `taxAmount`,(`b`.`amountIncludedTax` * -(1)) AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from (((((((`comp_sales_creditnote` `a` join `comp_sales_creditnote_charges` `b`) join `customer` `d`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`creditNoteID`) and (`a`.`customerID` = `d`.`ID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`d`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Sales Debit note' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`debitNoteDate` AS `transDate`,`a`.`customerID` AS `customerID`,`d`.`customerName` AS `customerName`,concat(`e`.`name`,' / ',`e`.`itemCode`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,`b`.`taxAmount` AS `taxAmount`,`b`.`amountIncludedTax` AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from ((((((((`comp_sales_debitnote` `a` join `comp_sales_debitnote_detail` `b`) join `customer` `d`) join `item` `e`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`debitnoteID`) and (`a`.`customerID` = `d`.`ID`) and (`e`.`ID` = `b`.`itemID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`e`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Sales Debit Note' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`debitNoteDate` AS `transDate`,`a`.`customerID` AS `customerID`,`d`.`customerName` AS `customerName`,`b`.`chargeDescription` AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,`b`.`taxAmount` AS `taxAmount`,`b`.`amountIncludedTax` AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from (((((((`comp_sales_debitnote` `a` join `comp_sales_debitnote_charges` `b`) join `customer` `d`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`debitNoteID`) and (`a`.`customerID` = `d`.`ID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`d`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Purchase Invoice' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`invoiceDate` AS `transDate`,`a`.`supplierID` AS `supplierID`,`d`.`supplierName` AS `supplierName`,concat(`e`.`name`,' / ',`e`.`itemCode`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,`b`.`taxAmount` AS `taxAmount`,`b`.`amountIncludedTax` AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from ((((((((`comp_supplier_invoice` `a` join `comp_supplier_invoice_detail` `b`) join `supplier` `d`) join `item` `e`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`invoiceID`) and (`a`.`supplierID` = `d`.`ID`) and (`e`.`ID` = `b`.`itemID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`e`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Purchase Invoice' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`invoiceDate` AS `transDate`,`a`.`supplierID` AS `supplierID`,`d`.`supplierName` AS `supplierName`,`b`.`chargeDescription` AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,`b`.`taxAmount` AS `taxAmount`,`b`.`amountIncludedTax` AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from (((((((`comp_supplier_invoice` `a` join `comp_supplier_invoice_charges` `b`) join `supplier` `d`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`invoiceID`) and (`a`.`supplierID` = `d`.`ID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`d`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Purchase Credit Note' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`creditNoteDate` AS `transDate`,`a`.`supplierID` AS `supplierID`,`d`.`supplierName` AS `supplierName`,concat(`e`.`name`,' / ',`e`.`itemCode`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,`b`.`taxAmount` AS `taxAmount`,`b`.`amountIncludedTax` AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from ((((((((`comp_supplier_creditnote` `a` join `comp_supplier_creditnote_detail` `b`) join `supplier` `d`) join `item` `e`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`creditnoteID`) and (`a`.`supplierID` = `d`.`ID`) and (`e`.`ID` = `b`.`itemID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`e`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Purchase Credit Note' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`creditNoteDate` AS `transDate`,`a`.`supplierID` AS `supplierID`,`d`.`supplierName` AS `supplierName`,`b`.`itemdescription` AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,`b`.`taxAmount` AS `taxAmount`,`b`.`amountIncludedTax` AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from (((((((`comp_supplier_creditnote` `a` join `comp_supplier_creditnote_charges` `b`) join `supplier` `d`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`creditNoteID`) and (`a`.`supplierID` = `d`.`ID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`d`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Purchase Debit note' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`debitNoteDate` AS `transDate`,`a`.`supplierID` AS `supplierID`,`d`.`supplierName` AS `supplierName`,concat(`e`.`name`,' / ',`e`.`itemCode`) AS `itemName`,(`b`.`amountExcludedTax` * -(1)) AS `b.amountExcludedTax * -1`,`b`.`taxRate` AS `taxRate`,(`b`.`taxAmount` * -(1)) AS `b.taxAmount * -1`,(`b`.`amountIncludedTax` * -(1)) AS `b.amountIncludedTax * -1`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from ((((((((`comp_supplier_debitnote` `a` join `comp_supplier_debitnote_detail` `b`) join `supplier` `d`) join `item` `e`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`debitnoteID`) and (`a`.`supplierID` = `d`.`ID`) and (`e`.`ID` = `b`.`itemID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`e`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Purchase Debit Note' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`debitNoteDate` AS `transDate`,`a`.`supplierID` AS `supplierID`,`d`.`supplierName` AS `supplierName`,`b`.`itemdescription` AS `itemName`,(`b`.`amountExcludedTax` * -(1)) AS `b.amountExcludedTax * -1`,`b`.`taxRate` AS `taxRate`,(`b`.`taxAmount` * -(1)) AS `b.taxAmount * -1`,(`b`.`amountIncludedTax` * -(1)) AS `b.amountIncludedTax * -1`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from (((((((`comp_supplier_debitnote` `a` join `comp_supplier_debitnote_charges` `b`) join `supplier` `d`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`debitNoteID`) and (`a`.`supplierID` = `d`.`ID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`d`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Other Payment' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`paymentDate` AS `transDate`,NULL AS `NULL`,`a`.`payTo` AS `supplierName`,`b`.`itemdescription` AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,`b`.`taxAmount` AS `taxAmount`,`b`.`amountIncludedTax` AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from ((((((`comp_payment_others` `a` join `comp_payment_others_without_item` `b`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`otherPaymentID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Cash Sales' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`salesInvoiceDate` AS `transDate`,NULL AS `customerID`,`a`.`paymentFrom` AS `customerName`,concat(`e`.`name`,' / ',`e`.`itemCode`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,`b`.`taxAmount` AS `taxAmount`,`b`.`amountIncludedTax` AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from (((((((`comp_cash_sales` `a` join `comp_cash_sales_detail` `b`) join `item` `e`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`invoiceID`) and (`e`.`ID` = `b`.`itemID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`e`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Other Receive' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`receivePaymentDate` AS `transDate`,NULL AS `customerID`,`a`.`receiveFrom` AS `customerName`,`b`.`description` AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,`b`.`taxAmount` AS `taxAmount`,`b`.`amountIncludedTax` AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from ((((((`comp_receive_payment_others` `a` join `comp_receive_payment_others_detail` `b`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`receivePaymentOthersID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `b`.`ID` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,`a`.`type` AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`date` AS `transDate`,NULL AS `supplierID`,`a`.`vendor_cust_name` AS `supplierName`,`b`.`description` AS `itemName`,if((`a`.`reverse` > 0),(`a`.`based_amount` * -(1)),`a`.`based_amount`) AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,if((`a`.`reverse` > 0),(if((`b`.`taxAmountDr` > 0),`b`.`taxAmountDr`,`b`.`taxAmountCr`) * -(1)),if((`b`.`taxAmountDr` > 0),`b`.`taxAmountDr`,`b`.`taxAmountCr`)) AS `taxAmount`,if((`a`.`reverse` > 0),((if((`b`.`taxAmountDr` > 0),`b`.`taxAmountDr`,`b`.`taxAmountCr`) + `a`.`based_amount`) * -(1)),(if((`b`.`taxAmountDr` > 0),`b`.`taxAmountDr`,`b`.`taxAmountCr`) + `a`.`based_amount`)) AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from ((((((`comp_gst_transaction` `a` join `comp_gst_transaction_detail` `b`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`gstTransID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`a`.`isDelete` = 0)) union select `b`.`lineNo` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Cash Purchase' AS `transType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `ref`,`a`.`paymentDate` AS `transDate`,NULL AS `supplierID`,`a`.`payTo` AS `supplierName`,concat(`e`.`name`,' / ',`e`.`itemCode`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxRate` AS `taxRate`,`b`.`taxAmount` AS `taxAmount`,`b`.`amountIncludedTax` AS `amountIncludedTax`,`b`.`taxID` AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from (((((((`comp_payment_others` `a` join `comp_payment_others_with_item` `b`) join `item` `e`) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`a`.`ID` = `b`.`otherPaymentID`) and (`e`.`ID` = `b`.`itemID`) and (`f`.`ID` = `b`.`taxID`) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`f`.`taxClass` = 1) and (`b`.`taxID` > 0) and (`a`.`updateAble` = 0) and (`e`.`companyID` = `a`.`companyID`) and (`f`.`companyID` = `a`.`companyID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8)) and (`j`.`status` = 1) and (`a`.`is_delete` = 0)) union select `a`.`ID` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Bad debt relief' AS `transType`,`a`.`journalNo` AS `ref`,`a`.`transDate` AS `transDate`,NULL AS `supplierID`,`c`.`customerName` AS `supplierName`,concat(`b`.`formNo`,'[',convert(lpad(`b`.`serialNo`,8,'0') using latin1),']') AS `itemName`,round((((((round(`b`.`totalReceivable`,2) / round(`b`.`totalamount`,2)) * round(`b`.`totalTaxAmount`,2)) * 106) / 6) - ((round(`b`.`totalReceivable`,2) / round(`b`.`totalamount`,2)) * round(`b`.`totalTaxAmount`,2))),2) AS `amountExcludedTax`,`f`.`taxPercentage` AS `taxRate`,round(((`b`.`totalReceivable` / `b`.`totalamount`) * `b`.`totalTaxAmount`),2) AS `taxAmount`,round((round((((((`b`.`totalReceivable` / `b`.`totalamount`) * `b`.`totalTaxAmount`) * 106) / 6) - ((`b`.`totalReceivable` / `b`.`totalamount`) * `b`.`totalTaxAmount`)),2) + ((`b`.`totalReceivable` / `b`.`totalamount`) * `b`.`totalTaxAmount`)),2) AS `amountIncludedTax`,NULL AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from (((((((`comp_sales_bad_debt` `a` join `comp_sales_invoice` `b` on((`b`.`badDebtID` = `a`.`ID`))) join `customer` `c` on((`c`.`ID` = `a`.`custID`))) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`f`.`companyID` = `a`.`companyID`) and (`f`.`code` = 'AJP') and (`a`.`updateAble` = 0) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`a`.`updateAble` = 0) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8))) union select `a`.`ID` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Bad debt Recover' AS `transType`,`a`.`journalNo` AS `ref`,`a`.`transDate` AS `transDate`,NULL AS `supplierID`,`c`.`customerName` AS `supplierName`,concat(`y`.`formNo`,'[',convert(lpad(`y`.`serialNo`,8,'0') using latin1),']') AS `itemName`,round((((((round(`b`.`amountApplied`,2) / round(`y`.`totalamount`,2)) * round(`y`.`totalTaxAmount`,2)) * 106) / 6) - ((round(`b`.`amountApplied`,2) / round(`y`.`totalamount`,2)) * round(`y`.`totalTaxAmount`,2))),2) AS `amountExcludedTax`,`f`.`taxPercentage` AS `taxRate`,round(((`b`.`amountApplied` / `y`.`totalamount`) * `y`.`totalTaxAmount`),2) AS `taxAmount`,round((round((((((`b`.`amountApplied` / `y`.`totalamount`) * `y`.`totalTaxAmount`) * 106) / 6) - ((`b`.`amountApplied` / `y`.`totalamount`) * `y`.`totalTaxAmount`)),2) + ((`b`.`amountApplied` / `y`.`totalamount`) * `y`.`totalTaxAmount`)),2) AS `amountIncludedTax`,NULL AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from ((((((((`comp_sales_debt_recover` `a` join `comp_receive_payment_detail` `b` on((`b`.`debtRecoverID` = `a`.`ID`))) left join `comp_sales_invoice` `y` on((`y`.`ID` = `b`.`invoiceID`))) join `customer` `c` on((`c`.`ID` = `a`.`custID`))) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`f`.`companyID` = `a`.`companyID`) and (`f`.`code` = 'AJS') and (`a`.`updateAble` = 0) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8))) union select `a`.`ID` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Supplier Bad debt relief' AS `transType`,`a`.`journalNo` AS `ref`,`a`.`transDate` AS `transDate`,`a`.`supplierID` AS `supplierID`,`c`.`supplierName` AS `supplierName`,concat(`b`.`formNo`,'[',convert(lpad(`b`.`serialNo`,8,'0') using latin1),']') AS `itemName`,round((((((round((`b`.`totalPayable` + ifnull(sum(`p`.`amountApplied`),0)),2) / round(`b`.`totalAmount`,2)) * round(`b`.`totalTaxAmount`,2)) * 106) / 6) - ((round((`b`.`totalPayable` + ifnull(sum(`p`.`amountApplied`),0)),2) / round(`b`.`totalAmount`,2)) * round(`b`.`totalTaxAmount`,2))),2) AS `amountExcludedTax`,`f`.`taxPercentage` AS `taxRate`,round((((`b`.`totalPayable` + ifnull(sum(`p`.`amountApplied`),0)) / `b`.`totalAmount`) * `b`.`totalTaxAmount`),2) AS `taxAmount`,(round((((((round((`b`.`totalPayable` + ifnull(sum(`p`.`amountApplied`),0)),2) / round(`b`.`totalAmount`,2)) * round(`b`.`totalTaxAmount`,2)) * 106) / 6) - ((round((`b`.`totalPayable` + ifnull(sum(`p`.`amountApplied`),0)),2) / round(`b`.`totalAmount`,2)) * round(`b`.`totalTaxAmount`,2))),2) + round((((`b`.`totalPayable` + ifnull(sum(`p`.`amountApplied`),0)) / `b`.`totalAmount`) * `b`.`totalTaxAmount`),2)) AS `amountIncludedTax`,NULL AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from (((((((((`comp_purchase_bad_debt` `a` join `comp_supplier_invoice` `b` on((`b`.`badDebtID` = `a`.`ID`))) join `comp_payment_detail` `p` on((`p`.`purchaseInvoiceID` = `b`.`ID`))) join `comp_payment` `pay` on(((`pay`.`ID` = `p`.`paymentID`) and (`pay`.`paymentDate` > `a`.`transDate`)))) join `supplier` `c` on((`c`.`ID` = `a`.`supplierID`))) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`f`.`companyID` = `a`.`companyID`) and (`f`.`code` = 'AJS') and (`a`.`updateAble` = 0) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8))) group by `p`.`purchaseInvoiceID` union select `a`.`ID` AS `lineNo`,`a`.`companyID` AS `companyID`,`f`.`taxClass` AS `taxClass`,`h`.`description` AS `taxClassName`,`f`.`taxGroup` AS `taxGroup`,`i`.`description` AS `taxGroupName`,`f`.`taxType` AS `taxType`,`g`.`description` AS `taxTypeName`,'Supplier Bad debt Recover' AS `transType`,`a`.`journalNo` AS `ref`,`a`.`transDate` AS `transDate`,`a`.`suppID` AS `supplierID`,`c`.`supplierName` AS `supplierName`,concat(`y`.`formNo`,'[',convert(lpad(`y`.`serialNo`,8,'0') using latin1),']') AS `itemName`,round((((((round(`b`.`amountApplied`,2) / round(`y`.`totalAmount`,2)) * round(`y`.`totalTaxAmount`,2)) * 106) / 6) - ((round(`b`.`amountApplied`,2) / round(`y`.`totalAmount`,2)) * round(`y`.`totalTaxAmount`,2))),2) AS `amountExcludedTax`,`f`.`taxPercentage` AS `taxRate`,round(((`b`.`amountApplied` / `y`.`totalAmount`) * `y`.`totalTaxAmount`),2) AS `taxAmount`,round((round((((((`b`.`amountApplied` / `y`.`totalAmount`) * `y`.`totalTaxAmount`) * 106) / 6) - ((`b`.`amountApplied` / `y`.`totalAmount`) * `y`.`totalTaxAmount`)),2) + ((`b`.`amountApplied` / `y`.`totalAmount`) * `y`.`totalTaxAmount`)),2) AS `amountIncludedTax`,NULL AS `taxID`,`f`.`code` AS `gst`,`j`.`journalID` AS `journalID`,`j`.`formNo` AS `formNo` from ((((((((`comp_purchase_debt_recover` `a` join `comp_payment_detail` `b` on((`b`.`debtRecoverID` = `a`.`ID`))) left join `comp_supplier_invoice` `y` on((`y`.`ID` = `b`.`purchaseInvoiceID`))) join `supplier` `c` on((`c`.`ID` = `a`.`suppID`))) join `tax_master` `f`) join `tax_type` `g`) join `tax_class` `h`) join `tax_group` `i`) join `comp_journal` `j`) where ((`f`.`companyID` = `a`.`companyID`) and (`f`.`code` = 'AJP') and (`a`.`updateAble` = 0) and (`f`.`taxType` = `g`.`ID`) and (`f`.`taxClass` = `h`.`ID`) and (`f`.`taxGroup` = `i`.`ID`) and (`j`.`companyID` = `a`.`companyID`) and (`j`.`journalID` = convert(`a`.`journalNo` using utf8))) */;

--
-- Final view structure for view `view_inventory_statement`
--

/*!50001 DROP VIEW IF EXISTS `view_inventory_statement`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_inventory_statement` AS select `a`.`companyID` AS `companyID`,`a`.`deliveryDate` AS `transactionDate`,`b`.`itemID` AS `itemID`,`c`.`name` AS `name`,`g`.`supplierName` AS `supplierCustomer`,1 AS `transactionCode`,'Purchase' AS `transactionType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`a`.`locationID` AS `locationID`,`d`.`desc` AS `location`,`e`.`desc` AS `unitOfMeasure`,`b`.`quantityReceived` AS `quantityIn`,NULL AS `quantityOut`,`a`.`updateAble` AS `updateable` from ((((((`comp_receive_item` `a` left join `comp_receive_item_detail` `b` on((`a`.`ID` = `b`.`receiveID`))) left join `item` `c` on((`b`.`itemID` = `c`.`ID`))) left join `item_details` `f` on((`c`.`ID` = `f`.`itemID`))) join `tbl_location` `d`) join `_sys_um` `e`) join `supplier` `g`) where ((`f`.`locationID` = `d`.`fldid`) and (`e`.`fldid` = `c`.`unitOfMeasureID`) and (`a`.`supplierID` = `f`.`ID`)) union select `a`.`companyID` AS `companyID`,`a`.`adjustmentDate` AS `transactionDate`,`b`.`itemID` AS `itemID`,`c`.`name` AS `name`,`d`.`desc` AS `supplierCustomer`,2 AS `transactionCode`,'stockAdjustment' AS `transactionType`,`a`.`formNo` AS `formNo`,`a`.`locationID` AS `locationID`,`d`.`desc` AS `location`,`e`.`desc` AS `unitOfMeasure`,if(((`b`.`counted` - `b`.`qtyOnHand`) > 0),(`b`.`counted` - `b`.`qtyOnHand`),NULL) AS `quantityIn`,if(((`b`.`counted` - `b`.`qtyOnHand`) < 0),(`b`.`counted` - `b`.`qtyOnHand`),NULL) AS `quantityOut`,`a`.`updateAble` AS `updateable` from (((((`item_adjustment` `a` left join `item_adjustment_detail` `b` on((`a`.`ID` = `b`.`adjustmentID`))) left join `item` `c` on((`b`.`itemID` = `c`.`ID`))) left join `item_details` `f` on((`c`.`ID` = `f`.`itemID`))) left join `tbl_location` `d` on((`d`.`fldid` = `a`.`locationID`))) left join `_sys_um` `e` on((`e`.`fldid` = `b`.`unitOfMeasureID`))) union select `a`.`companyID` AS `companyID`,`a`.`deliveryOrderDate` AS `transactionDate`,`b`.`itemID` AS `itemID`,`c`.`name` AS `name`,`g`.`customerName` AS `supplierCustomer`,3 AS `transactionCode`,'Sale' AS `transactionType`,`a`.`formNo` AS `formNo`,`a`.`locationID` AS `locationID`,`d`.`desc` AS `location`,`e`.`desc` AS `unitOfMeasure`,NULL AS `quantityIn`,(`b`.`quantitySent` * -(1)) AS `quantityOut`,`a`.`updateAble` AS `updateable` from ((((((`comp_delivery_order` `a` left join `comp_delivery_detail` `b` on((`a`.`ID` = `b`.`deliveryID`))) left join `item` `c` on((`b`.`itemID` = `c`.`ID`))) left join `item_details` `f` on((`c`.`ID` = `f`.`itemID`))) join `tbl_location` `d`) join `_sys_um` `e`) join `customer` `g`) where ((`a`.`locationID` = `d`.`fldid`) and (`e`.`fldid` = `c`.`unitOfMeasureID`) and (`a`.`customerID` = `f`.`ID`)) union select `a`.`companyID` AS `companyID`,`a`.`dateTransfer` AS `transactionDate`,`b`.`itemID` AS `itemID`,`c`.`name` AS `name`,`d`.`desc` AS `supplierCustomer`,4 AS `transactionCode`,'TransferOut' AS `transactionType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`ID`,8,'0') using latin1),']') AS `formNo`,`a`.`fromLocationID` AS `locationID`,`d`.`desc` AS `location`,`e`.`desc` AS `unitOfMeasure`,NULL AS `quantityIn`,(`b`.`quantity` * -(1)) AS `quantityOut`,`a`.`updateable` AS `updateable` from ((((`comp_location_transfer` `a` left join `comp_location_transfer_detail` `b` on((`a`.`ID` = `b`.`locationTransferID`))) left join `item` `c` on((`b`.`itemID` = `c`.`ID`))) join `tbl_location` `d`) join `_sys_um` `e`) where ((`a`.`fromLocationID` = `d`.`fldid`) and (`e`.`fldid` = `c`.`unitOfMeasureID`)) union select `a`.`companyID` AS `companyID`,`a`.`dateTransfer` AS `transactionDate`,`b`.`itemID` AS `itemID`,`c`.`name` AS `name`,`d`.`desc` AS `supplierCustomer`,5 AS `transactionCode`,'TransferIn' AS `transactionType`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`ID`,8,'0') using latin1),']') AS `formNo`,`a`.`toLocationID` AS `locationID`,`d`.`desc` AS `location`,`e`.`desc` AS `unitOfMeasure`,`b`.`quantity` AS `quantityIn`,NULL AS `quantityOut`,`a`.`updateable` AS `updateable` from ((((`comp_location_transfer` `a` left join `comp_location_transfer_detail` `b` on((`a`.`ID` = `b`.`locationTransferID`))) left join `item` `c` on((`b`.`itemID` = `c`.`ID`))) join `tbl_location` `d`) join `_sys_um` `e`) where ((`a`.`fromLocationID` = `d`.`fldid`) and (`e`.`fldid` = `c`.`unitOfMeasureID`)) */;

--
-- Final view structure for view `view_inventory_transaction`
--

/*!50001 DROP VIEW IF EXISTS `view_inventory_transaction`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_inventory_transaction` AS select `ridet`.`ID` AS `indexing`,`ri`.`ID` AS `ID`,`ri`.`companyID` AS `companyID`,`ridet`.`itemID` AS `itemID`,`ri`.`locationID` AS `locationID`,`ridet`.`createdTS` AS `createdTS`,`s`.`supplierName` AS `supplierName`,if((`ri`.`purchaseOrderID` = '-1'),`ri`.`formNo`,concat(`ri`.`formNo`,'[',convert(lpad(`ri`.`serialNo`,8,'0') using latin1),']')) AS `formNo`,`ri`.`deliveryDate` AS `transDate`,`um`.`desc` AS `um`,'Transfer In' AS `transType`,`ridet`.`quantityReceived` AS `qtyIn`,'0' AS `qtyOut` from ((((`comp_receive_item_detail` `ridet` left join `comp_receive_item` `ri` on((`ri`.`ID` = `ridet`.`receiveID`))) left join `supplier` `s` on((`s`.`ID` = `ri`.`supplierID`))) left join `item` `i` on((`i`.`ID` = `ridet`.`itemID`))) left join `_sys_um` `um` on((`um`.`fldid` = `ridet`.`umID`))) where (`ri`.`updateAble` = 0) union select `outdet`.`ID` AS `indexing`,`do`.`ID` AS `ID`,`do`.`companyID` AS `companyID`,`dodet`.`itemID` AS `itemID`,`do`.`locationID` AS `locationID`,`outdet`.`createdTS` AS `createdTS`,`c`.`customerName` AS `supplierName`,concat(`do`.`formNo`,'[',convert(lpad(`do`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`do`.`deliveryOrderDate` AS `transDate`,`um`.`desc` AS `um`,'Transfer Out' AS `transType`,'0' AS `qtyIn`,`outdet`.`qty` AS `qtyOut` from (((((`comp_receive_delivery_conn` `outdet` left join `comp_delivery_detail` `dodet` on((`dodet`.`ID` = `outdet`.`deliveryDetailID`))) left join `comp_delivery_order` `do` on((`do`.`ID` = `dodet`.`deliveryID`))) left join `customer` `c` on((`c`.`ID` = `do`.`customerID`))) left join `item` `i` on((`i`.`ID` = `dodet`.`itemID`))) left join `_sys_um` `um` on((`um`.`fldid` = `i`.`unitOfMeasureID`))) where (`outdet`.`type` = 1) union select `outdet`.`ID` AS `indexing`,`loc`.`ID` AS `ID`,`loc`.`companyID` AS `companyID`,`locdet`.`itemID` AS `itemID`,`loc`.`fromLocationID` AS `locationID`,`outdet`.`createdTS` AS `createdTS`,`user`.`username` AS `supplierName`,concat(`loc`.`formNo`,'[',convert(lpad(`loc`.`ID`,8,'0') using latin1),']') AS `formNo`,`loc`.`dateTransfer` AS `transDate`,`um`.`desc` AS `um`,'Transfer Out' AS `transType`,'0' AS `qtyIn`,`outdet`.`qty` AS `qtyOut` from (((((`comp_receive_delivery_conn` `outdet` left join `comp_location_transfer_detail` `locdet` on((`locdet`.`ID` = `outdet`.`deliveryDetailID`))) left join `comp_location_transfer` `loc` on((`loc`.`ID` = `locdet`.`locationTransferID`))) left join `tbl_usermaster` `user` on((`user`.`fldid` = `loc`.`createdby`))) left join `item` `i` on((`i`.`ID` = `locdet`.`itemID`))) left join `_sys_um` `um` on((`um`.`fldid` = `i`.`unitOfMeasureID`))) where (`outdet`.`type` = 2) union select `outdet`.`ID` AS `indexing`,`loc`.`ID` AS `ID`,`loc`.`companyID` AS `companyID`,`locdet`.`itemID` AS `itemID`,`si`.`locationID` AS `locationID`,`outdet`.`createdTS` AS `createdTS`,`c`.`customerName` AS `supplierName`,concat(`loc`.`formNo`,'[',convert(lpad(`loc`.`ID`,8,'0') using latin1),']') AS `formNo`,`loc`.`debitNoteDate` AS `transDate`,`um`.`desc` AS `um`,'Transfer Out' AS `transType`,'0' AS `qtyIn`,`outdet`.`qty` AS `qtyOut` from (((((((`comp_receive_delivery_conn` `outdet` left join `comp_sales_debitnote_detail` `locdet` on((`locdet`.`ID` = `outdet`.`deliveryDetailID`))) left join `comp_sales_debitnote` `loc` on((`loc`.`ID` = `locdet`.`debitnoteID`))) left join `comp_sales_invoice_detail` `sidet` on((`sidet`.`ID` = `locdet`.`invoiceDetailID`))) left join `comp_sales_invoice` `si` on((`si`.`ID` = `sidet`.`invoiceID`))) left join `customer` `c` on((`c`.`ID` = `si`.`customerID`))) left join `item` `i` on((`i`.`ID` = `locdet`.`itemID`))) left join `_sys_um` `um` on((`um`.`fldid` = `i`.`unitOfMeasureID`))) where (`outdet`.`type` = 3) union select `outdet`.`ID` AS `indexing`,`loc`.`ID` AS `ID`,`loc`.`companyID` AS `companyID`,`locdet`.`itemID` AS `itemID`,if((`si`.`purchaseInvoiceCodeID` = '1'),`ri`.`locationID`,`si`.`locationID`) AS `locationID`,`outdet`.`createdTS` AS `createdTS`,`s`.`supplierName` AS `supplierName`,concat(`loc`.`formNo`,'[',convert(lpad(`loc`.`ID`,8,'0') using latin1),']') AS `formNo`,`loc`.`debitNoteDate` AS `transDate`,`um`.`desc` AS `um`,'Transfer Out' AS `transType`,'0' AS `qtyIn`,`outdet`.`qty` AS `qtyOut` from (((((((((`comp_receive_delivery_conn` `outdet` left join `comp_supplier_debitnote_detail` `locdet` on((`locdet`.`ID` = `outdet`.`deliveryDetailID`))) left join `comp_supplier_debitnote` `loc` on((`loc`.`ID` = `locdet`.`debitnoteID`))) left join `comp_supplier_invoice` `si` on((`si`.`ID` = `loc`.`supplierInvoiceID`))) left join `comp_supplier_invoice_detail` `sidet` on((`sidet`.`ID` = `locdet`.`invoiceDetailID`))) left join `comp_receive_item_detail` `ridet` on((`ridet`.`ID` = `sidet`.`receiveID`))) left join `comp_receive_item` `ri` on((`ri`.`ID` = `ridet`.`receiveID`))) left join `supplier` `s` on((`s`.`ID` = `si`.`supplierID`))) left join `item` `i` on((`i`.`ID` = `locdet`.`itemID`))) left join `_sys_um` `um` on((`um`.`fldid` = `i`.`unitOfMeasureID`))) where (`outdet`.`type` = 4) union select `outdet`.`ID` AS `indexing`,`loc`.`ID` AS `ID`,`loc`.`companyID` AS `companyID`,`locdet`.`itemID` AS `itemID`,`loc`.`locationID` AS `locationID`,`outdet`.`createdTS` AS `createdTS`,`loc`.`paymentFrom` AS `supplierName`,concat(`loc`.`formNo`,'[',convert(lpad(`loc`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`loc`.`salesInvoiceDate` AS `transDate`,`um`.`desc` AS `um`,'Transfer Out' AS `transType`,'0' AS `qtyIn`,`outdet`.`qty` AS `qtyOut` from ((((`comp_receive_delivery_conn` `outdet` left join `comp_cash_sales_detail` `locdet` on((`locdet`.`ID` = `outdet`.`deliveryDetailID`))) left join `comp_cash_sales` `loc` on((`loc`.`ID` = `locdet`.`invoiceID`))) left join `item` `i` on((`i`.`ID` = `locdet`.`itemID`))) left join `_sys_um` `um` on((`um`.`fldid` = `i`.`unitOfMeasureID`))) where (`outdet`.`type` = 5) union select `outdet`.`ID` AS `indexing`,`loc`.`ID` AS `ID`,`loc`.`companyID` AS `companyID`,`locdet`.`itemID` AS `itemID`,`loc`.`locationID` AS `locationID`,`outdet`.`createdTS` AS `createdTS`,`user`.`username` AS `supplierName`,concat(`loc`.`formNo`,'[',convert(lpad(`loc`.`ID`,8,'0') using latin1),']') AS `formNo`,`loc`.`adjustmentDate` AS `transDate`,`um`.`desc` AS `um`,'Transfer Out' AS `transType`,'0' AS `qtyIn`,`outdet`.`qty` AS `qtyOut` from (((((`comp_receive_delivery_conn` `outdet` left join `item_adjustment_detail` `locdet` on((`locdet`.`ID` = `outdet`.`deliveryDetailID`))) left join `item_adjustment` `loc` on((`loc`.`ID` = `locdet`.`adjustmentID`))) left join `tbl_usermaster` `user` on((`user`.`fldid` = `loc`.`createdBy`))) left join `item` `i` on((`i`.`ID` = `locdet`.`itemID`))) left join `_sys_um` `um` on((`um`.`fldid` = `i`.`unitOfMeasureID`))) where (`outdet`.`type` = 6) order by `formNo` */;

--
-- Final view structure for view `view_inventorylist_subtotal`
--

/*!50001 DROP VIEW IF EXISTS `view_inventorylist_subtotal`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_inventorylist_subtotal` AS select `a`.`companyID` AS `companyid`,sum(`b`.`balanceItem`) AS `quantity`,`a`.`locationID` AS `locationid`,`b`.`itemID` AS `itemID`,concat('[',`c`.`itemCode`,']',`c`.`name`) AS `itemName`,`d`.`name` AS `category`,`b`.`description` AS `description`,sum((`b`.`balanceItem` * `b`.`unitPrice`)) AS `stockValue` from (((`comp_receive_item` `a` join `comp_receive_item_detail` `b`) join `item` `c`) join `comp_item_category` `d`) where ((`a`.`ID` = `b`.`receiveID`) and (`b`.`balanceItem` > 0) and (`c`.`ID` = `b`.`itemID`) and (`c`.`itemCategoryID` = `d`.`ID`)) group by `a`.`companyID`,`a`.`locationID`,`b`.`itemID`,`b`.`itemName`,`category`,`b`.`description` */;

--
-- Final view structure for view `view_item_details`
--

/*!50001 DROP VIEW IF EXISTS `view_item_details`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_item_details` AS select `b`.`companyID` AS `companyid`,`a`.`itemID` AS `itemid`,concat('[',`c`.`itemCode`,']',`c`.`name`) AS `itemName`,`c`.`description` AS `description`,`b`.`locationID` AS `locationid`,sum(`a`.`balanceItem`) AS `onHandQty`,`a`.`umID` AS `umID`,`c`.`inventoriesID` AS `acctID`,`d`.`code` AS `location`,`e`.`code` AS `unitOfMeasure` from ((((`comp_receive_item_detail` `a` join `comp_receive_item` `b`) join `item` `c`) join `tbl_location` `d`) join `_sys_um` `e`) where ((`a`.`receiveID` = `b`.`ID`) and (`a`.`itemID` = `c`.`ID`) and (`d`.`fldid` = `b`.`locationID`) and (`e`.`fldid` = `a`.`umID`) and (`a`.`balanceItem` > 0)) group by `b`.`companyID`,`a`.`itemID`,`a`.`itemName`,`c`.`description`,`b`.`locationID`,`a`.`umID`,`acctID`,`location`,`unitOfMeasure` */;

--
-- Final view structure for view `view_item_quantityonhand`
--

/*!50001 DROP VIEW IF EXISTS `view_item_quantityonhand`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_item_quantityonhand` AS select `a`.`companyID` AS `companyID`,`a`.`locationID` AS `locationID`,`b`.`itemID` AS `itemID`,`b`.`itemCode` AS `itemCode`,`b`.`itemName` AS `itemName`,`b`.`umID` AS `umID`,sum(`b`.`balanceItem`) AS `quantityOnHand` from (`comp_receive_item` `a` left join `comp_receive_item_detail` `b` on(((`a`.`ID` = `b`.`receiveID`) and (`b`.`balanceItem` > 0)))) group by `a`.`companyID`,`a`.`locationID`,`b`.`itemID`,`b`.`itemCode`,`b`.`itemName`,`b`.`umID` */;

--
-- Final view structure for view `view_item_quantityonhand_confirm`
--

/*!50001 DROP VIEW IF EXISTS `view_item_quantityonhand_confirm`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_item_quantityonhand_confirm` AS select `a`.`companyID` AS `companyID`,`a`.`locationID` AS `locationID`,`b`.`itemID` AS `itemID`,`b`.`itemCode` AS `itemCode`,`b`.`itemName` AS `itemName`,`b`.`umID` AS `umID`,sum(`b`.`balanceItem`) AS `quantityOnHand` from (`comp_receive_item` `a` left join `comp_receive_item_detail` `b` on((`a`.`ID` = `b`.`receiveID`))) where ((`a`.`updateAble` = 0) and (`b`.`balanceItem` > 0)) group by `a`.`companyID`,`a`.`locationID`,`b`.`itemID`,`b`.`itemCode`,`b`.`itemName`,`b`.`umID` */;

--
-- Final view structure for view `view_journal_table`
--

/*!50001 DROP VIEW IF EXISTS `view_journal_table`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_journal_table` AS select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`a`.`referenceNo` AS `referenceNo`,'comp_cash_sales' AS `tableName`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_cash_sales` `a` join `comp_journal` `b`) where ((convert(`a`.`journalNo` using utf8) = `b`.`journalID`) and (`a`.`is_delete` = 0)) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`a`.`referenceNo` AS `referenceNo`,'comp_payment' AS `comp_payment`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_payment` `a` join `comp_journal` `b`) where ((convert(`a`.`journalNo` using utf8) = `b`.`journalID`) and (`a`.`is_delete` = 0)) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`a`.`referenceNo` AS `referenceNo`,'comp_payment_others' AS `comp_payment_others`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_payment_others` `a` join `comp_journal` `b`) where ((convert(`a`.`journalNo` using utf8) = `b`.`journalID`) and (`a`.`is_delete` = 0)) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`a`.`formNo` AS `referenceNo`,'comp_purchase_order' AS `comp_purchase_order`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_purchase_order` `a` join `comp_journal` `b`) where ((convert(`a`.`journalNo` using utf8) = `b`.`journalID`) and (`a`.`is_delete` = 0)) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`a`.`referenceNo` AS `referenceNo`,'comp_receive_payment' AS `comp_receive_payment`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_receive_payment` `a` join `comp_journal` `b`) where ((convert(`a`.`journalNo` using utf8) = `b`.`journalID`) and (`a`.`is_delete` = 0)) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`a`.`referenceNo` AS `referenceNo`,'comp_receive_payment_others' AS `comp_receive_payment_others`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_receive_payment_others` `a` join `comp_journal` `b`) where ((convert(`a`.`journalNo` using utf8) = `b`.`journalID`) and (`a`.`is_delete` = 0)) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`b`.`formNo` AS `referenceNo`,'comp_sales_creditnote' AS `comp_sales_creditnote`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_sales_creditnote` `a` join `comp_journal` `b`) where ((convert(`a`.`journalNo` using utf8) = `b`.`journalID`) and (`a`.`is_delete` = 0)) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`b`.`formNo` AS `referenceNo`,'comp_sales_debitnote' AS `comp_sales_debitnote`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_sales_debitnote` `a` join `comp_journal` `b`) where ((convert(`a`.`journalNo` using utf8) = `b`.`journalID`) and (`a`.`is_delete` = 0)) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`a`.`customerPoNo` AS `referenceNo`,'comp_sales_invoice' AS `comp_sales_invoice`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_sales_invoice` `a` join `comp_journal` `b`) where ((convert(`a`.`journalNo` using utf8) = `b`.`journalID`) and (`a`.`is_delete` = 0)) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`b`.`formNo` AS `referenceNo`,'comp_supplier_creditnote' AS `comp_supplier_creditnote`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_supplier_creditnote` `a` join `comp_journal` `b`) where ((convert(`a`.`journalNo` using utf8) = `b`.`journalID`) and (`a`.`is_delete` = 0)) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`b`.`formNo` AS `referenceNo`,'comp_supplier_debitnote' AS `comp_supplier_debitnote`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_supplier_debitnote` `a` join `comp_journal` `b`) where ((convert(`a`.`journalNo` using utf8) = `b`.`journalID`) and (`a`.`is_delete` = 0)) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`a`.`supplierInvoiceNo` AS `referenceNo`,'comp_supplier_invoice' AS `comp_supplier_invoice`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_supplier_invoice` `a` join `comp_journal` `b`) where ((convert(`a`.`journalNo` using utf8) = `b`.`journalID`) and (`a`.`is_delete` = 0)) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`b`.`formNo` AS `referenceNo`,'comp_delivery_order' AS `comp_delivery_order`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_delivery_order` `a` join `comp_journal` `b`) where (convert(`a`.`journalNo` using utf8) = `b`.`journalID`) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`a`.`reference` AS `referenceNo`,'comp_gst_transaction' AS `comp_gst_transaction`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_gst_transaction` `a` join `comp_journal` `b`) where (convert(`a`.`journalNo` using utf8) = `b`.`journalID`) union select distinct `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,`a`.`supplierDoNo` AS `referenceNo`,'comp_receive_item' AS `comp_receive_item`,`b`.`journalID` AS `journalID`,`b`.`formNo` AS `formNo` from (`comp_receive_item` `a` join `comp_journal` `b`) where (convert(`a`.`journalNo` using utf8) = `b`.`journalID`) */;

--
-- Final view structure for view `view_open_ar_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_open_ar_invoice`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_open_ar_invoice` AS select `comp_sales_invoice`.`companyID` AS `companyID`,`comp_sales_invoice`.`salesInvoiceDate` AS `salesInvoiceDate`,date_format(`comp_sales_invoice`.`salesInvoiceDate`,'%Y') AS `salesYear`,date_format(`comp_sales_invoice`.`salesInvoiceDate`,'%m') AS `salesMonth`,date_format(`comp_sales_invoice`.`salesInvoiceDate`,'%b') AS `slsMonth`,(`comp_sales_invoice`.`totalReceivable` * if((`comp_sales_invoice`.`exchangeRate` = 0),1,`comp_sales_invoice`.`exchangeRate`)) AS `totalAmount` from `comp_sales_invoice` where (`comp_sales_invoice`.`totalReceivable` <> 0) */;

--
-- Final view structure for view `view_salescreditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_salescreditnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_salescreditnote` AS select `si`.`ID` AS `invoiceDetailID`,`_sys_um`.`code` AS `unitOfMeasure`,`si`.`ID` AS `ID`,`si`.`invoiceID` AS `invoiceID`,`si`.`doID` AS `doID`,`si`.`lineNo` AS `lineNo`,`si`.`itemID` AS `itemID`,`si`.`umID` AS `umID`,`si`.`quantity` AS `quantity`,`si`.`unitPrice` AS `unitPrice`,`si`.`amountExcludedTax` AS `amountExcludedTax`,`si`.`taxID` AS `taxID`,`si`.`taxRate` AS `taxRate`,`si`.`taxAmount` AS `taxAmount`,`si`.`amountIncludedTax` AS `amountIncludedTax`,`si`.`accountID` AS `accountID`,`si`.`createdBy` AS `createdBy`,`si`.`createdTS` AS `createdTS`,`si`.`updatedBy` AS `updatedBy`,`si`.`updatedTS` AS `updatedTS`,`tax_master`.`code` AS `code`,`item`.`itemCode` AS `itemCode`,`item`.`name` AS `name`,`si`.`itemdescription` AS `description`,((`si`.`quantity` + ifnull((select sum(`dnd`.`quantity`) from `comp_sales_debitnote_detail` `dnd` where (`si`.`ID` = `dnd`.`invoiceDetailID`)),0)) - ifnull((select sum(`scd`.`quantity`) from `comp_sales_creditnote_detail` `scd` where (`scd`.`invoiceDetailID` = `si`.`ID`)),0)) AS `exactQty` from (((`comp_sales_invoice_detail` `si` left join `tax_master` on((`tax_master`.`ID` = `si`.`taxID`))) left join `item` on((`si`.`itemID` = `item`.`ID`))) left join `_sys_um` on((`_sys_um`.`fldid` = `si`.`umID`))) */;

--
-- Final view structure for view `view_salesdebitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_salesdebitnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_salesdebitnote` AS select `si`.`ID` AS `invoiceDetailID`,`_sys_um`.`code` AS `unitOfMeasure`,`si`.`ID` AS `ID`,`si`.`invoiceID` AS `invoiceID`,`si`.`doID` AS `doID`,`si`.`lineNo` AS `lineNo`,`si`.`itemID` AS `itemID`,`si`.`umID` AS `umID`,`si`.`quantity` AS `quantity`,`si`.`unitPrice` AS `unitPrice`,`si`.`amountExcludedTax` AS `amountExcludedTax`,`si`.`taxID` AS `taxID`,`si`.`taxRate` AS `taxRate`,`si`.`taxAmount` AS `taxAmount`,`si`.`amountIncludedTax` AS `amountIncludedTax`,`si`.`accountID` AS `accountID`,`si`.`createdBy` AS `createdBy`,`si`.`createdTS` AS `createdTS`,`si`.`updatedBy` AS `updatedBy`,`si`.`updatedTS` AS `updatedTS`,`tax_master`.`code` AS `code`,`item`.`itemCode` AS `itemCode`,`item`.`name` AS `name`,`si`.`itemdescription` AS `description`,((`si`.`quantity` + ifnull((select sum(`dnd`.`quantity`) from `comp_sales_debitnote_detail` `dnd` where (`si`.`ID` = `dnd`.`invoiceDetailID`)),0)) - ifnull((select sum(`scd`.`quantity`) from `comp_sales_creditnote_detail` `scd` where (`scd`.`invoiceDetailID` = `si`.`ID`)),0)) AS `exactQty` from (((`comp_sales_invoice_detail` `si` left join `tax_master` on((`tax_master`.`ID` = `si`.`taxID`))) left join `item` on((`si`.`itemID` = `item`.`ID`))) left join `_sys_um` on((`_sys_um`.`fldid` = `si`.`umID`))) */;

--
-- Final view structure for view `view_search`
--

/*!50001 DROP VIEW IF EXISTS `view_search`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_search` AS select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateAble` = 1),'arTransaction/editcashsale/','arReports/cashsalelistDetail/'),`a`.`ID`) AS `searchLink`,concat('Cash Sale&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`salesInvoiceDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`paymentFrom`) AS `searchKey`,`a`.`salesInvoiceDate` AS `transDate` from `comp_cash_sales` `a` union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateAble` = 1),'sotransaction/SalesDO/','soreport/DeliveryOrderDetail/'),`a`.`ID`) AS `searchLink`,concat('Delivery Order&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`deliveryOrderDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`customerName`) AS `searchKey`,`a`.`deliveryOrderDate` AS `transDate` from (`comp_delivery_order` `a` join `customer` `b`) where (`a`.`customerID` = `b`.`ID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateable` = 1),'locationtransfer/edit/','locationtransfer/reportdetail/'),`a`.`ID`) AS `searchLink`,concat('Inventory Transfer&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(`a`.`formNo` using utf8),'[',convert(lpad(`a`.`serialNo`,8,'0') using utf8),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`dateTransfer`,'%d/%m/%Y') using utf8),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`code`,'&nbsp',`b`.`desc`) AS `searchKey`,`a`.`dateTransfer` AS `transDate` from (`comp_location_transfer` `a` join `tbl_location` `b`) where (`a`.`fromLocationID` = `b`.`fldid`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateAble` = 1),'aptransaction/editPayment/','Apreports/supplierpaymentDetail/'),`a`.`ID`) AS `searchLink`,concat('Payment&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`paymentDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`supplierName`) AS `searchKey`,`a`.`paymentDate` AS `transDate` from (`comp_payment` `a` join `supplier` `b`) where (`a`.`supplierID` = `b`.`ID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateAble` = 1),'othersPayment/editPayWithoutItem/','othersPayment/otherpaywithoutDetail/'),`a`.`ID`) AS `searchLink`,concat('Payment Others&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`paymentDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`payTo`) AS `searchKey`,`a`.`paymentDate` AS `transDate` from `comp_payment_others` `a` union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateAble` = 1),'PO_Transaction/edit/','purchaseReports/PODetails/'),`a`.`ID`) AS `searchLink`,concat('Purchase Order&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`poDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`supplierName`) AS `searchKey`,`a`.`poDate` AS `transDate` from (`comp_purchase_order` `a` join `supplier` `b`) where (`a`.`supplierID` = `b`.`ID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat('soreport/SalesQuotationDetail/',`a`.`ID`) AS `searchLink`,concat('Quotation&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`quotationDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`customerName`) AS `searchKey`,`a`.`quotationDate` AS `transDate` from (`comp_quotation` `a` join `customer` `b`) where (`a`.`customerID` = `b`.`ID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateAble` = 1),'receiveItems/editReceiveItem/','receiveItems/ReceiveItemDetails/'),`a`.`ID`) AS `searchLink`,concat('Receive Item&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`deliveryDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`supplierName`) AS `searchKey`,`a`.`deliveryDate` AS `transDate` from (`comp_receive_item` `a` join `supplier` `b`) where (`a`.`supplierID` = `b`.`ID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateAble` = 1),'artransaction/editReceivePayment/','arReports/compRecPaymentDetail/'),`a`.`ID`) AS `searchLink`,concat('Receive Payment&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`receivePaymentDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`customerName`) AS `searchKey`,`a`.`receivePaymentDate` AS `transDate` from (`comp_receive_payment` `a` join `customer` `b`) where (`a`.`customerID` = `b`.`ID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateAble` = 1),'gltransaction/editotherreceive/','glreports/otherReceiveAdviceRpt/'),`a`.`ID`) AS `searchLink`,concat('Receive Payment Others&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`receivePaymentDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`receiveFrom`) AS `searchKey`,`a`.`receivePaymentDate` AS `transDate` from `comp_receive_payment_others` `a` union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateAble` = 1),'artransaction/editSaleCreditNote/','arreports/salescreditnoteDetail/'),`a`.`ID`) AS `searchLink`,concat('Sales Credit Note&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`creditNoteDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`customerName`) AS `searchKey`,`a`.`creditNoteDate` AS `transDate` from (`comp_sales_creditnote` `a` join `customer` `b`) where (`a`.`customerID` = `b`.`ID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateAble` = 1),'artransaction/editSaleDebitNote/','arreports/salesdebitnoteDetail/'),`a`.`ID`) AS `searchLink`,concat('Sales Debit Note&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`debitNoteDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`customerName`) AS `searchKey`,`a`.`debitNoteDate` AS `transDate` from (`comp_sales_debitnote` `a` join `customer` `b`) where (`a`.`customerID` = `b`.`ID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat('arReports/salesInvoiceDetail/',`a`.`ID`) AS `searchLink`,concat('Sales Invoice&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`salesInvoiceDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`customerName`) AS `searchKey`,`a`.`salesInvoiceDate` AS `transDate` from (`comp_sales_invoice` `a` join `customer` `b`) where (`a`.`customerID` = `b`.`ID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat('soreport/SalesOrderDetail/',`a`.`ID`) AS `searchLink`,concat('Sales Order&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`salesOrderDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`customerName`) AS `searchKey`,`a`.`salesOrderDate` AS `transDate` from (`comp_sales_order` `a` join `customer` `b`) where (`a`.`customerID` = `b`.`ID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateAble` = 1),'aptransaction/editCreditNote/','Apreports/creditNoteDetail/'),`a`.`ID`) AS `searchLink`,concat('Supplier Credit Note&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`creditNoteDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`supplierName`) AS `searchKey`,`a`.`creditNoteDate` AS `transDate` from (`comp_supplier_creditnote` `a` join `supplier` `b`) where (`a`.`supplierID` = `b`.`ID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat(if((`a`.`updateAble` = 1),'aptransaction/editDebitNote/','Apreports/debitNoteDetail/'),`a`.`ID`) AS `searchLink`,concat('Supplier Debit Note&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`debitNoteDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`supplierName`) AS `searchKey`,`a`.`debitNoteDate` AS `transDate` from (`comp_supplier_debitnote` `a` join `supplier` `b`) where (`a`.`supplierID` = `b`.`ID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat('apreports/purchaseInvoiceDetail/',`a`.`ID`) AS `searchLink`,concat('Purchase Invoice&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',convert(date_format(`a`.`invoiceDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`supplierName`) AS `searchKey`,`a`.`invoiceDate` AS `transDate` from (`comp_supplier_invoice` `a` join `supplier` `b`) where (`a`.`supplierID` = `b`.`ID`) */;

--
-- Final view structure for view `view_serial_comp_cash_sales`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_cash_sales`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_cash_sales` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_cash_sales` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 121))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_delivery_order`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_delivery_order`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_delivery_order` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_delivery_order` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 49))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_gst_transaction`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_gst_transaction`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_gst_transaction` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_gst_transaction` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 118))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_historical_customer_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_historical_customer_invoice`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_historical_customer_invoice` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_historical_customer_invoice` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 41))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_historical_supplier_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_historical_supplier_invoice`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_historical_supplier_invoice` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_historical_supplier_invoice` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 41))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_location_transfer`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_location_transfer`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_location_transfer` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_location_transfer` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 46))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_payment`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_payment`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_payment` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_payment` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 44))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_payment_others`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_payment_others`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_payment_others` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_payment_others` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 55))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_purchase_order`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_purchase_order`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_purchase_order` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`po`.`serialNo`) from `comp_purchase_order` `po` where (`c`.`ID` = `po`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 40))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_quotation`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_quotation`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_quotation` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_quotation` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 47))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_receive_item`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_receive_item`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_receive_item` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_receive_item` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 54))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_receive_payment`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_receive_payment`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_receive_payment` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_receive_payment` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 53))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_receive_payment_others`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_receive_payment_others`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_receive_payment_others` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_receive_payment_others` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 56))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_sales_creditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_creditnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_sales_creditnote` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_sales_creditnote` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 52))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_sales_debitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_debitnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_sales_debitnote` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_sales_debitnote` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 51))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_sales_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_invoice`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_sales_invoice` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_sales_invoice` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 50))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_sales_order`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_order`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_sales_order` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_sales_order` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 48))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_supplier_creditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_supplier_creditnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_supplier_creditnote` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_supplier_creditnote` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 43))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_supplier_debitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_supplier_debitnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_supplier_debitnote` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_supplier_debitnote` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 42))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_serial_comp_supplier_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_supplier_invoice`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_serial_comp_supplier_invoice` AS select `c`.`ID` AS `companyID`,ifnull(((select max(`t`.`serialNo`) from `comp_supplier_invoice` `t` where (`c`.`ID` = `t`.`companyID`)) + 1),ifnull((select `frm`.`formInitialNo` from `comp_form_control` `frm` where ((`frm`.`companyID` = `c`.`ID`) and (`frm`.`formID` = 41))),1)) AS `nextSerialNo` from `company` `c` */;

--
-- Final view structure for view `view_supplier_aging`
--

/*!50001 DROP VIEW IF EXISTS `view_supplier_aging`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_supplier_aging` AS select `a`.`companyID` AS `companyID`,`a`.`ID` AS `supplierID`,((ifnull((select sum(`comp_supplier_invoice`.`totalPayable`) from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_invoice`.`invoiceDate`,now()) = 0) and (`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_supplier_creditnote`.`total`) from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`companyID` = `a`.`companyID`) and (`comp_supplier_creditnote`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_creditnote`.`creditNoteDate`,now()) = 0) and (`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_supplier_invoice`.`totalPayable`) from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_supplier_invoice`.`invoiceDate`,now()) = 0) and (`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0))),0)) AS `current`,((ifnull((select sum(`comp_supplier_invoice`.`totalPayable`) from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_invoice`.`invoiceDate`,now()) = 1) and (`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_supplier_creditnote`.`total`) from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`companyID` = `a`.`companyID`) and (`comp_supplier_creditnote`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_creditnote`.`creditNoteDate`,now()) = 1) and (`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_supplier_invoice`.`totalPayable`) from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_supplier_invoice`.`invoiceDate`,now()) = 1) and (`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0))),0)) AS `month1`,((ifnull((select sum(`comp_supplier_invoice`.`totalPayable`) from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_invoice`.`invoiceDate`,now()) = 2) and (`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_supplier_creditnote`.`total`) from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`companyID` = `a`.`companyID`) and (`comp_supplier_creditnote`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_creditnote`.`creditNoteDate`,now()) = 2) and (`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_supplier_invoice`.`totalPayable`) from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_supplier_invoice`.`invoiceDate`,now()) = 2) and (`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0))),0)) AS `month2`,((ifnull((select sum(`comp_supplier_invoice`.`totalPayable`) from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_invoice`.`invoiceDate`,now()) = 3) and (`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_supplier_creditnote`.`total`) from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`companyID` = `a`.`companyID`) and (`comp_supplier_creditnote`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_creditnote`.`creditNoteDate`,now()) = 3) and (`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_supplier_invoice`.`totalPayable`) from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_supplier_invoice`.`invoiceDate`,now()) = 3) and (`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0))),0)) AS `month3`,((ifnull((select sum(`comp_supplier_invoice`.`totalPayable`) from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_invoice`.`invoiceDate`,now()) = 4) and (`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_supplier_creditnote`.`total`) from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`companyID` = `a`.`companyID`) and (`comp_supplier_creditnote`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_creditnote`.`creditNoteDate`,now()) = 4) and (`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_supplier_invoice`.`totalPayable`) from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_supplier_invoice`.`invoiceDate`,now()) = 4) and (`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0))),0)) AS `month4`,((ifnull((select sum(`comp_supplier_invoice`.`totalPayable`) from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_invoice`.`invoiceDate`,now()) = 5) and (`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_supplier_creditnote`.`total`) from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`companyID` = `a`.`companyID`) and (`comp_supplier_creditnote`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_creditnote`.`creditNoteDate`,now()) = 5) and (`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_supplier_invoice`.`totalPayable`) from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_supplier_invoice`.`invoiceDate`,now()) = 5) and (`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0))),0)) AS `month5`,((ifnull((select sum(`comp_supplier_invoice`.`totalPayable`) from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_invoice`.`invoiceDate`,now()) = 6) and (`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_supplier_creditnote`.`total`) from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`companyID` = `a`.`companyID`) and (`comp_supplier_creditnote`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_creditnote`.`creditNoteDate`,now()) = 6) and (`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_supplier_invoice`.`totalPayable`) from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_supplier_invoice`.`invoiceDate`,now()) = 6) and (`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0))),0)) AS `month6`,((ifnull((select sum(`comp_supplier_invoice`.`totalPayable`) from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_invoice`.`invoiceDate`,now()) = 7) and (`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_supplier_creditnote`.`total`) from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`companyID` = `a`.`companyID`) and (`comp_supplier_creditnote`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_creditnote`.`creditNoteDate`,now()) = 7) and (`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_supplier_invoice`.`totalPayable`) from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_supplier_invoice`.`invoiceDate`,now()) = 7) and (`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0))),0)) AS `month7`,((ifnull((select sum(`comp_supplier_invoice`.`totalPayable`) from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_invoice`.`invoiceDate`,now()) = 8) and (`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_supplier_creditnote`.`total`) from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`companyID` = `a`.`companyID`) and (`comp_supplier_creditnote`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_creditnote`.`creditNoteDate`,now()) = 8) and (`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_supplier_invoice`.`totalPayable`) from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_supplier_invoice`.`invoiceDate`,now()) = 8) and (`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0))),0)) AS `month8`,((ifnull((select sum(`comp_supplier_invoice`.`totalPayable`) from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_invoice`.`invoiceDate`,now()) = 9) and (`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_supplier_creditnote`.`total`) from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`companyID` = `a`.`companyID`) and (`comp_supplier_creditnote`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_creditnote`.`creditNoteDate`,now()) = 9) and (`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_supplier_invoice`.`totalPayable`) from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_supplier_invoice`.`invoiceDate`,now()) = 9) and (`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0))),0)) AS `month9`,((ifnull((select sum(`comp_supplier_invoice`.`totalPayable`) from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_invoice`.`invoiceDate`,now()) = 10) and (`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_supplier_creditnote`.`total`) from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`companyID` = `a`.`companyID`) and (`comp_supplier_creditnote`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_creditnote`.`creditNoteDate`,now()) = 10) and (`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_supplier_invoice`.`totalPayable`) from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_supplier_invoice`.`invoiceDate`,now()) = 10) and (`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0))),0)) AS `month10`,((ifnull((select sum(`comp_supplier_invoice`.`totalPayable`) from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_invoice`.`invoiceDate`,now()) > 10) and (`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0))),0) + ifnull((select sum(`comp_supplier_creditnote`.`total`) from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`companyID` = `a`.`companyID`) and (`comp_supplier_creditnote`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_supplier_creditnote`.`creditNoteDate`,now()) > 10) and (`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0))),0)) + ifnull((select sum(`comp_historical_supplier_invoice`.`totalPayable`) from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`companyID` = `a`.`companyID`) and (`comp_historical_supplier_invoice`.`supplierID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_historical_supplier_invoice`.`invoiceDate`,now()) > 10) and (`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0))),0)) AS `month11` from `supplier` `a` */;

--
-- Final view structure for view `view_supplier_statement`
--

/*!50001 DROP VIEW IF EXISTS `view_supplier_statement`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_supplier_statement` AS select `comp_supplier_invoice`.`ID` AS `ID`,`comp_supplier_invoice`.`ID` AS `parent`,`comp_supplier_invoice`.`companyID` AS `companyID`,`comp_supplier_invoice`.`supplierID` AS `supplierID`,'Invoice' AS `transType`,`comp_supplier_invoice`.`invoiceDate` AS `transDate`,`comp_supplier_invoice`.`supplierInvoiceNo` AS `refNo`,concat(concat(concat(`comp_supplier_invoice`.`formNo`,'['),convert(lpad(`comp_supplier_invoice`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,NULL AS `dr`,`comp_supplier_invoice`.`totalAmount` AS `cr`,1 AS `seq` from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0)) union select `a`.`ID` AS `ID`,`a`.`supplierInvoiceID` AS `parent`,`a`.`companyID` AS `companyID`,`a`.`supplierID` AS `supplierID`,'DebitNote' AS `transType`,`a`.`debitNoteDate` AS `transDate`,concat(concat(concat(`b`.`formNo`,'['),convert(lpad(`b`.`serialNo`,8,'0') using latin1)),']') AS `refno`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`totalAmount` AS `dr`,NULL AS `cr`,2 AS `seq` from (`comp_supplier_debitnote` `a` join `comp_supplier_invoice` `b`) where ((`a`.`updateAble` = 0) and (`a`.`is_delete` = 0) and (`a`.`supplierInvoiceID` = `b`.`ID`)) union select `a`.`ID` AS `ID`,`a`.`supplierInvoiceID` AS `parent`,`a`.`companyID` AS `companyID`,`a`.`supplierID` AS `supplierID`,'CreditNote' AS `transType`,`a`.`creditNoteDate` AS `transDate`,concat(concat(concat(`b`.`formNo`,'['),convert(lpad(`b`.`serialNo`,8,'0') using latin1)),']') AS `refno`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,NULL AS `dr`,`a`.`totalAmount` AS `cr`,3 AS `seq` from (`comp_supplier_creditnote` `a` join `comp_supplier_invoice` `b`) where ((`a`.`updateAble` = 0) and (`a`.`is_delete` = 0) and (`a`.`supplierInvoiceID` = `b`.`ID`)) union select `b`.`ID` AS `ID`,NULL AS `parent`,`b`.`companyID` AS `companyID`,`b`.`supplierID` AS `supplierID`,if((`b`.`updateAble` = 0),'Payment','** Payment') AS `transType`,`b`.`paymentDate` AS `transDate`,`b`.`referenceNo` AS `refNo`,concat(concat(concat(`b`.`formNo`,'['),convert(lpad(`b`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`b`.`amountPaid` AS `dr`,NULL AS `cr`,4 AS `seq` from `comp_payment` `b` where (`b`.`is_delete` = 0) union select `b`.`ID` AS `ID`,NULL AS `parent`,`b`.`companyID` AS `companyID`,`b`.`supplierID` AS `supplierID`,'Discount' AS `transType`,`b`.`paymentDate` AS `transDate`,`b`.`referenceNo` AS `refNo`,concat(concat(concat(`b`.`formNo`,'['),convert(lpad(`b`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`b`.`totalDiscount` AS `dr`,NULL AS `cr`,4 AS `seq` from `comp_payment` `b` where ((`b`.`updateAble` = 0) and (`b`.`is_delete` = 0)) union select `comp_historical_supplier_invoice`.`ID` AS `ID`,`comp_historical_supplier_invoice`.`ID` AS `parent`,`comp_historical_supplier_invoice`.`companyID` AS `companyID`,`comp_historical_supplier_invoice`.`supplierID` AS `supplierID`,'Historical Invoice' AS `transType`,`comp_historical_supplier_invoice`.`invoiceDate` AS `transDate`,`comp_historical_supplier_invoice`.`supplierInvoiceNo` AS `refNo`,concat(concat(concat(`comp_historical_supplier_invoice`.`formNo`,'['),convert(lpad(`comp_historical_supplier_invoice`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,NULL AS `dr`,`comp_historical_supplier_invoice`.`totalAmount` AS `cr`,1 AS `seq` from `comp_historical_supplier_invoice` where ((`comp_historical_supplier_invoice`.`updateAble` = 0) and (`comp_historical_supplier_invoice`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_suppliercreditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_suppliercreditnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_suppliercreditnote` AS select `si`.`ID` AS `invoiceDetailID`,`si`.`umID` AS `invoiceUm`,`si`.`ID` AS `ID`,`si`.`invoiceID` AS `invoiceID`,`si`.`receiveID` AS `receiveID`,`si`.`lineNo` AS `lineNo`,`si`.`itemID` AS `itemID`,`si`.`itemname` AS `itemname`,`si`.`itemdescription` AS `itemdescription`,`si`.`umID` AS `umID`,`si`.`quantity` AS `quantity`,`si`.`unitPrice` AS `unitPrice`,`si`.`amountExcludedTax` AS `amountExcludedTax`,`si`.`taxID` AS `taxID`,`si`.`taxRate` AS `taxRate`,`si`.`taxAmount` AS `taxAmount`,`si`.`amountIncludedTax` AS `amountIncludedTax`,`si`.`accountID` AS `accountID`,`si`.`createdBy` AS `createdBy`,`si`.`createdTS` AS `createdTS`,`si`.`updatedBy` AS `updatedBy`,`si`.`updatedTS` AS `updatedTS`,((`si`.`quantity` - ifnull((select sum(`dnd`.`quantity`) from `comp_supplier_debitnote_detail` `dnd` where (`si`.`ID` = `dnd`.`invoiceDetailID`)),0)) + ifnull((select sum(`scd`.`quantity`) from `comp_supplier_creditnote_detail` `scd` where (`si`.`ID` = `scd`.`invoiceDetailID`)),0)) AS `exactQty`,`_sys_um`.`code` AS `unitOfMeasure`,`si`.`receiveID` AS `receiveDetailID`,`tax_master`.`code` AS `code`,`item`.`itemCode` AS `itemCode`,`item`.`name` AS `name`,`si`.`itemdescription` AS `description` from (((`comp_supplier_invoice_detail` `si` left join `tax_master` on((`tax_master`.`ID` = `si`.`taxID`))) left join `item` on((`si`.`itemID` = `item`.`ID`))) left join `_sys_um` on((`_sys_um`.`fldid` = `si`.`umID`))) */;

--
-- Final view structure for view `view_supplierdebitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_supplierdebitnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_supplierdebitnote` AS select `si`.`ID` AS `invoiceDetailID`,`si`.`ID` AS `ID`,`si`.`invoiceID` AS `invoiceID`,`si`.`receiveID` AS `receiveID`,`si`.`lineNo` AS `lineNo`,`si`.`itemID` AS `itemID`,`si`.`itemname` AS `itemname`,`si`.`itemdescription` AS `itemdescription`,`si`.`umID` AS `umID`,`si`.`quantity` AS `quantity`,`si`.`unitPrice` AS `unitPrice`,`si`.`amountExcludedTax` AS `amountExcludedTax`,`si`.`taxID` AS `taxID`,`si`.`taxRate` AS `taxRate`,`si`.`taxAmount` AS `taxAmount`,`si`.`amountIncludedTax` AS `amountIncludedTax`,`si`.`accountID` AS `accountID`,`si`.`createdBy` AS `createdBy`,`si`.`createdTS` AS `createdTS`,`si`.`updatedBy` AS `updatedBy`,`si`.`updatedTS` AS `updatedTS`,`_sys_um`.`code` AS `unitOfMeasure`,`si`.`receiveID` AS `receiveDetailID`,`tax_master`.`code` AS `code`,`item`.`itemCode` AS `itemCode`,`item`.`name` AS `name`,`si`.`itemdescription` AS `description`,((`si`.`quantity` - ifnull((select sum(`dnd`.`quantity`) from `comp_supplier_debitnote_detail` `dnd` where (`si`.`ID` = `dnd`.`invoiceDetailID`)),0)) + ifnull((select sum(`scd`.`quantity`) from `comp_supplier_creditnote_detail` `scd` where (`si`.`ID` = `scd`.`invoiceDetailID`)),0)) AS `exactQty` from (((`comp_supplier_invoice_detail` `si` left join `tax_master` on((`tax_master`.`ID` = `si`.`taxID`))) left join `item` on((`si`.`itemID` = `item`.`ID`))) left join `_sys_um` on((`_sys_um`.`fldid` = `si`.`umID`))) */;

--
-- Final view structure for view `view_total_comp_sales_creditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_total_comp_sales_creditnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_total_comp_sales_creditnote` AS select distinct `a`.`ID` AS `ID`,((select ifnull(sum(`comp_sales_creditnote_charges`.`taxAmount`),0) from `comp_sales_creditnote_charges` where (`comp_sales_creditnote_charges`.`creditNoteID` = `a`.`ID`)) + (select ifnull(sum(`comp_sales_creditnote_detail`.`taxAmount`),0) from `comp_sales_creditnote_detail` where (`comp_sales_creditnote_detail`.`creditnoteID` = `a`.`ID`))) AS `totalTaxAmount`,((select ifnull(sum(`comp_sales_creditnote_detail`.`amountIncludedTax`),0) from `comp_sales_creditnote_detail` where (`comp_sales_creditnote_detail`.`creditnoteID` = `a`.`ID`)) + (select ifnull(sum(`comp_sales_creditnote_charges`.`amountIncludedTax`),0) from `comp_sales_creditnote_charges` where (`comp_sales_creditnote_charges`.`creditNoteID` = `a`.`ID`))) AS `totalAmount` from `comp_sales_creditnote` `a` group by `a`.`ID` */;

--
-- Final view structure for view `view_total_comp_sales_debitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_total_comp_sales_debitnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_total_comp_sales_debitnote` AS select distinct `a`.`ID` AS `ID`,((select ifnull(sum(`comp_sales_debitnote_charges`.`taxAmount`),0) from `comp_sales_debitnote_charges` where (`comp_sales_debitnote_charges`.`debitNoteID` = `a`.`ID`)) + (select ifnull(sum(`comp_sales_debitnote_detail`.`taxAmount`),0) from `comp_sales_debitnote_detail` where (`comp_sales_debitnote_detail`.`debitnoteID` = `a`.`ID`))) AS `totalTaxAmount`,((select ifnull(sum(`comp_sales_debitnote_charges`.`amountIncludedTax`),0) from `comp_sales_debitnote_charges` where (`comp_sales_debitnote_charges`.`debitNoteID` = `a`.`ID`)) + (select ifnull(sum(`comp_sales_debitnote_detail`.`amountIncludedTax`),0) from `comp_sales_debitnote_detail` where (`comp_sales_debitnote_detail`.`debitnoteID` = `a`.`ID`))) AS `totalAmount` from `comp_sales_debitnote` `a` group by `a`.`ID` */;

--
-- Final view structure for view `view_total_comp_sales_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_total_comp_sales_invoice`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_total_comp_sales_invoice` AS select distinct `a`.`ID` AS `ID`,((select ifnull(sum(`comp_sales_invoice_charges`.`taxAmount`),0) from `comp_sales_invoice_charges` where (`comp_sales_invoice_charges`.`invoiceID` = `a`.`ID`)) + (select ifnull(sum(`comp_sales_invoice_detail`.`taxAmount`),0) from `comp_sales_invoice_detail` where (`comp_sales_invoice_detail`.`invoiceID` = `a`.`ID`))) AS `totalTaxAmount`,((select ifnull(sum(`comp_sales_invoice_charges`.`amountIncludedTax`),0) from `comp_sales_invoice_charges` where (`comp_sales_invoice_charges`.`invoiceID` = `a`.`ID`)) + (select ifnull(sum(`comp_sales_invoice_detail`.`amountIncludedTax`),0) from `comp_sales_invoice_detail` where (`comp_sales_invoice_detail`.`invoiceID` = `a`.`ID`))) AS `totalAmount` from `comp_sales_invoice` `a` group by `a`.`ID` */;

--
-- Final view structure for view `view_total_comp_supplier_creditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_total_comp_supplier_creditnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_total_comp_supplier_creditnote` AS select distinct `a`.`ID` AS `ID`,((select ifnull(sum(`comp_supplier_creditnote_charges`.`taxAmount`),0) from `comp_supplier_creditnote_charges` where (`comp_supplier_creditnote_charges`.`creditNoteID` = `a`.`ID`)) + (select ifnull(sum(`comp_supplier_creditnote_detail`.`taxAmount`),0) from `comp_supplier_creditnote_detail` where (`comp_supplier_creditnote_detail`.`creditnoteID` = `a`.`ID`))) AS `totalTaxAmount`,((select ifnull(sum(`comp_supplier_creditnote_charges`.`amountIncludedTax`),0) from `comp_supplier_creditnote_charges` where (`comp_supplier_creditnote_charges`.`creditNoteID` = `a`.`ID`)) + (select ifnull(sum(`comp_supplier_creditnote_detail`.`amountIncludedTax`),0) from `comp_supplier_creditnote_detail` where (`comp_supplier_creditnote_detail`.`creditnoteID` = `a`.`ID`))) AS `totalAmount` from `comp_supplier_creditnote` `a` group by `a`.`ID` */;

--
-- Final view structure for view `view_total_comp_supplier_debitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_total_comp_supplier_debitnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_total_comp_supplier_debitnote` AS select distinct `a`.`ID` AS `ID`,((select ifnull(sum(`comp_supplier_debitnote_charges`.`taxAmount`),0) from `comp_supplier_debitnote_charges` where (`comp_supplier_debitnote_charges`.`debitNoteID` = `a`.`ID`)) + (select ifnull(sum(`comp_supplier_debitnote_detail`.`taxAmount`),0) from `comp_supplier_debitnote_detail` where (`comp_supplier_debitnote_detail`.`debitnoteID` = `a`.`ID`))) AS `totalTaxAmount`,((select ifnull(sum(`comp_supplier_debitnote_charges`.`amountIncludedTax`),0) from `comp_supplier_debitnote_charges` where (`comp_supplier_debitnote_charges`.`debitNoteID` = `a`.`ID`)) + (select ifnull(sum(`comp_supplier_debitnote_detail`.`amountIncludedTax`),0) from `comp_supplier_debitnote_detail` where (`comp_supplier_debitnote_detail`.`debitnoteID` = `a`.`ID`))) AS `totalAmount` from `comp_supplier_debitnote` `a` group by `a`.`ID` */;

--
-- Final view structure for view `view_total_comp_supplier_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_total_comp_supplier_invoice`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_total_comp_supplier_invoice` AS select distinct `a`.`ID` AS `ID`,((select ifnull(sum(`comp_supplier_invoice_charges`.`taxAmount`),0) from `comp_supplier_invoice_charges` where (`comp_supplier_invoice_charges`.`invoiceID` = `a`.`ID`)) + (select ifnull(sum(`comp_supplier_invoice_detail`.`taxAmount`),0) from `comp_supplier_invoice_detail` where (`comp_supplier_invoice_detail`.`invoiceID` = `a`.`ID`))) AS `totalTaxAmount`,((select ifnull(sum(`comp_supplier_invoice_charges`.`amountIncludedTax`),0) from `comp_supplier_invoice_charges` where (`comp_supplier_invoice_charges`.`invoiceID` = `a`.`ID`)) + (select ifnull(sum(`comp_supplier_invoice_detail`.`amountIncludedTax`),0) from `comp_supplier_invoice_detail` where (`comp_supplier_invoice_detail`.`invoiceID` = `a`.`ID`))) AS `totalAmount` from `comp_supplier_invoice` `a` group by `a`.`ID` */;

--
-- Final view structure for view `view_transaction_summary`
--

/*!50001 DROP VIEW IF EXISTS `view_transaction_summary`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_transaction_summary` AS select 'comp_purchase_order' AS `tableName`,100 AS `transID`,`comp_purchase_order`.`companyID` AS `companyid`,date_format(`comp_purchase_order`.`poDate`,'%Y') AS `year`,count(if((month(`comp_purchase_order`.`poDate`) = 1),1,NULL)) AS `Jan`,count(if((month(`comp_purchase_order`.`poDate`) = 2),1,NULL)) AS `Feb`,count(if((month(`comp_purchase_order`.`poDate`) = 3),1,NULL)) AS `Mar`,count(if((month(`comp_purchase_order`.`poDate`) = 4),1,NULL)) AS `Apr`,count(if((month(`comp_purchase_order`.`poDate`) = 5),1,NULL)) AS `may`,count(if((month(`comp_purchase_order`.`poDate`) = 6),1,NULL)) AS `Jun`,count(if((month(`comp_purchase_order`.`poDate`) = 7),1,NULL)) AS `Jul`,count(if((month(`comp_purchase_order`.`poDate`) = 8),1,NULL)) AS `Aug`,count(if((month(`comp_purchase_order`.`poDate`) = 9),1,NULL)) AS `Sept`,count(if((month(`comp_purchase_order`.`poDate`) = 10),1,NULL)) AS `Oct`,count(if((month(`comp_purchase_order`.`poDate`) = 11),1,NULL)) AS `Nov`,count(if((month(`comp_purchase_order`.`poDate`) = 12),1,NULL)) AS `Dec` from `comp_purchase_order` where ((`comp_purchase_order`.`updateAble` = 0) and (`comp_purchase_order`.`is_delete` = 0)) group by `comp_purchase_order`.`companyID`,`year` union select 'comp_receive_item' AS `comp_receive_item`,200 AS `200`,`comp_receive_item`.`companyID` AS `companyid`,date_format(`comp_receive_item`.`deliveryDate`,'%Y') AS `year`,count(if((month(`comp_receive_item`.`deliveryDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_receive_item`.`deliveryDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_receive_item`.`deliveryDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_receive_item`.`deliveryDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_receive_item`.`deliveryDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_receive_item`.`deliveryDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_receive_item`.`deliveryDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_receive_item`.`deliveryDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_receive_item`.`deliveryDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_receive_item`.`deliveryDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_receive_item`.`deliveryDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_receive_item`.`deliveryDate`) = 12),1,NULL)) AS `12` from `comp_receive_item` where ((`comp_receive_item`.`updateAble` = 0) and (`comp_receive_item`.`isDelete` = 0)) group by `comp_receive_item`.`companyID`,`year` union select 'comp_supplier_invoice' AS `comp_supplier_invoice`,300 AS `300`,`comp_supplier_invoice`.`companyID` AS `companyid`,date_format(`comp_supplier_invoice`.`invoiceDate`,'%Y') AS `year`,count(if((month(`comp_supplier_invoice`.`invoiceDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_supplier_invoice`.`invoiceDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_supplier_invoice`.`invoiceDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_supplier_invoice`.`invoiceDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_supplier_invoice`.`invoiceDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_supplier_invoice`.`invoiceDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_supplier_invoice`.`invoiceDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_supplier_invoice`.`invoiceDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_supplier_invoice`.`invoiceDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_supplier_invoice`.`invoiceDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_supplier_invoice`.`invoiceDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_supplier_invoice`.`invoiceDate`) = 12),1,NULL)) AS `12` from `comp_supplier_invoice` where ((`comp_supplier_invoice`.`updateAble` = 0) and (`comp_supplier_invoice`.`is_delete` = 0)) group by `comp_supplier_invoice`.`companyID`,`year` union select 'comp_supplier_debitNote' AS `comp_supplier_debitNote`,400 AS `400`,`comp_supplier_debitnote`.`companyID` AS `companyid`,date_format(`comp_supplier_debitnote`.`debitNoteDate`,'%Y') AS `year`,count(if((month(`comp_supplier_debitnote`.`debitNoteDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_supplier_debitnote`.`debitNoteDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_supplier_debitnote`.`debitNoteDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_supplier_debitnote`.`debitNoteDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_supplier_debitnote`.`debitNoteDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_supplier_debitnote`.`debitNoteDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_supplier_debitnote`.`debitNoteDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_supplier_debitnote`.`debitNoteDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_supplier_debitnote`.`debitNoteDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_supplier_debitnote`.`debitNoteDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_supplier_debitnote`.`debitNoteDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_supplier_debitnote`.`debitNoteDate`) = 12),1,NULL)) AS `12` from `comp_supplier_debitnote` where ((`comp_supplier_debitnote`.`updateAble` = 0) and (`comp_supplier_debitnote`.`is_delete` = 0)) group by `comp_supplier_debitnote`.`companyID`,`year` union select 'comp_supplier_creditNote' AS `comp_supplier_creditNote`,500 AS `500`,`comp_supplier_creditnote`.`companyID` AS `companyid`,date_format(`comp_supplier_creditnote`.`creditNoteDate`,'%Y') AS `year`,count(if((month(`comp_supplier_creditnote`.`creditNoteDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_supplier_creditnote`.`creditNoteDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_supplier_creditnote`.`creditNoteDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_supplier_creditnote`.`creditNoteDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_supplier_creditnote`.`creditNoteDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_supplier_creditnote`.`creditNoteDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_supplier_creditnote`.`creditNoteDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_supplier_creditnote`.`creditNoteDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_supplier_creditnote`.`creditNoteDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_supplier_creditnote`.`creditNoteDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_supplier_creditnote`.`creditNoteDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_supplier_creditnote`.`creditNoteDate`) = 12),1,NULL)) AS `12` from `comp_supplier_creditnote` where ((`comp_supplier_creditnote`.`updateAble` = 0) and (`comp_supplier_creditnote`.`is_delete` = 0)) group by `comp_supplier_creditnote`.`companyID`,`year` union select 'comp_payment' AS `comp_payment`,600 AS `600`,`comp_payment`.`companyID` AS `companyid`,date_format(`comp_payment`.`paymentDate`,'%Y') AS `year`,count(if((month(`comp_payment`.`paymentDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_payment`.`paymentDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_payment`.`paymentDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_payment`.`paymentDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_payment`.`paymentDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_payment`.`paymentDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_payment`.`paymentDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_payment`.`paymentDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_payment`.`paymentDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_payment`.`paymentDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_payment`.`paymentDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_payment`.`paymentDate`) = 12),1,NULL)) AS `12` from `comp_payment` where ((`comp_payment`.`updateAble` = 0) and (`comp_payment`.`is_delete` = 0)) group by `comp_payment`.`companyID`,`year` union select 'comp_payment_others' AS `comp_payment_others`,700 AS `700`,`comp_payment_others`.`companyID` AS `companyid`,date_format(`comp_payment_others`.`paymentDate`,'%Y') AS `year`,count(if((month(`comp_payment_others`.`paymentDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_payment_others`.`paymentDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_payment_others`.`paymentDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_payment_others`.`paymentDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_payment_others`.`paymentDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_payment_others`.`paymentDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_payment_others`.`paymentDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_payment_others`.`paymentDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_payment_others`.`paymentDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_payment_others`.`paymentDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_payment_others`.`paymentDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_payment_others`.`paymentDate`) = 12),1,NULL)) AS `12` from `comp_payment_others` where ((`comp_payment_others`.`updateAble` = 0) and (`comp_payment_others`.`is_delete` = 0) and (`comp_payment_others`.`otherPaymentType` = 1)) group by `comp_payment_others`.`companyID`,`year` union select 'comp_payment_others' AS `comp_payment_others`,750 AS `750`,`comp_payment_others`.`companyID` AS `companyid`,date_format(`comp_payment_others`.`paymentDate`,'%Y') AS `year`,count(if((month(`comp_payment_others`.`paymentDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_payment_others`.`paymentDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_payment_others`.`paymentDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_payment_others`.`paymentDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_payment_others`.`paymentDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_payment_others`.`paymentDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_payment_others`.`paymentDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_payment_others`.`paymentDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_payment_others`.`paymentDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_payment_others`.`paymentDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_payment_others`.`paymentDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_payment_others`.`paymentDate`) = 12),1,NULL)) AS `12` from `comp_payment_others` where ((`comp_payment_others`.`updateAble` = 0) and (`comp_payment_others`.`is_delete` = 0) and (`comp_payment_others`.`otherPaymentType` = 0)) group by `comp_payment_others`.`companyID`,`year` union select 'comp_sales_order' AS `comp_sales_order`,800 AS `800`,`comp_sales_order`.`companyID` AS `companyid`,date_format(`comp_sales_order`.`salesOrderDate`,'%Y') AS `year`,count(if((month(`comp_sales_order`.`salesOrderDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_sales_order`.`salesOrderDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_sales_order`.`salesOrderDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_sales_order`.`salesOrderDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_sales_order`.`salesOrderDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_sales_order`.`salesOrderDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_sales_order`.`salesOrderDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_sales_order`.`salesOrderDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_sales_order`.`salesOrderDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_sales_order`.`salesOrderDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_sales_order`.`salesOrderDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_sales_order`.`salesOrderDate`) = 12),1,NULL)) AS `12` from `comp_sales_order` where (`comp_sales_order`.`is_delete` = 0) group by `comp_sales_order`.`companyID`,`year` union select 'comp_delivery_order' AS `comp_delivery_order`,900 AS `900`,`comp_delivery_order`.`companyID` AS `companyid`,date_format(`comp_delivery_order`.`deliveryOrderDate`,'%Y') AS `year`,count(if((month(`comp_delivery_order`.`deliveryOrderDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_delivery_order`.`deliveryOrderDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_delivery_order`.`deliveryOrderDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_delivery_order`.`deliveryOrderDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_delivery_order`.`deliveryOrderDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_delivery_order`.`deliveryOrderDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_delivery_order`.`deliveryOrderDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_delivery_order`.`deliveryOrderDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_delivery_order`.`deliveryOrderDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_delivery_order`.`deliveryOrderDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_delivery_order`.`deliveryOrderDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_delivery_order`.`deliveryOrderDate`) = 12),1,NULL)) AS `12` from `comp_delivery_order` where ((`comp_delivery_order`.`updateAble` = 0) and (`comp_delivery_order`.`isDelete` = 0)) group by `comp_delivery_order`.`companyID`,`year` union select 'comp_sales_invoice' AS `comp_sales_invoice`,1000 AS `1000`,`comp_sales_invoice`.`companyID` AS `companyid`,date_format(`comp_sales_invoice`.`salesInvoiceDate`,'%Y') AS `year`,count(if((month(`comp_sales_invoice`.`salesInvoiceDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_sales_invoice`.`salesInvoiceDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_sales_invoice`.`salesInvoiceDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_sales_invoice`.`salesInvoiceDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_sales_invoice`.`salesInvoiceDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_sales_invoice`.`salesInvoiceDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_sales_invoice`.`salesInvoiceDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_sales_invoice`.`salesInvoiceDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_sales_invoice`.`salesInvoiceDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_sales_invoice`.`salesInvoiceDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_sales_invoice`.`salesInvoiceDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_sales_invoice`.`salesInvoiceDate`) = 12),1,NULL)) AS `12` from `comp_sales_invoice` where ((`comp_sales_invoice`.`updateAble` = 0) and (`comp_sales_invoice`.`is_delete` = 0)) group by `comp_sales_invoice`.`companyID`,`year` union select 'comp_sales_debitNote' AS `comp_sales_debitNote`,1100 AS `1100`,`comp_sales_debitnote`.`companyID` AS `companyid`,date_format(`comp_sales_debitnote`.`debitNoteDate`,'%Y') AS `year`,count(if((month(`comp_sales_debitnote`.`debitNoteDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_sales_debitnote`.`debitNoteDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_sales_debitnote`.`debitNoteDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_sales_debitnote`.`debitNoteDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_sales_debitnote`.`debitNoteDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_sales_debitnote`.`debitNoteDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_sales_debitnote`.`debitNoteDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_sales_debitnote`.`debitNoteDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_sales_debitnote`.`debitNoteDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_sales_debitnote`.`debitNoteDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_sales_debitnote`.`debitNoteDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_sales_debitnote`.`debitNoteDate`) = 12),1,NULL)) AS `12` from `comp_sales_debitnote` where ((`comp_sales_debitnote`.`updateAble` = 0) and (`comp_sales_debitnote`.`is_delete` = 0)) group by `comp_sales_debitnote`.`companyID`,`year` union select 'comp_sales_creditNote' AS `comp_sales_creditNote`,1200 AS `1200`,`comp_sales_creditnote`.`companyID` AS `companyid`,date_format(`comp_sales_creditnote`.`creditNoteDate`,'%Y') AS `year`,count(if((month(`comp_sales_creditnote`.`creditNoteDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_sales_creditnote`.`creditNoteDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_sales_creditnote`.`creditNoteDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_sales_creditnote`.`creditNoteDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_sales_creditnote`.`creditNoteDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_sales_creditnote`.`creditNoteDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_sales_creditnote`.`creditNoteDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_sales_creditnote`.`creditNoteDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_sales_creditnote`.`creditNoteDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_sales_creditnote`.`creditNoteDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_sales_creditnote`.`creditNoteDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_sales_creditnote`.`creditNoteDate`) = 12),1,NULL)) AS `12` from `comp_sales_creditnote` where ((`comp_sales_creditnote`.`updateAble` = 0) and (`comp_sales_creditnote`.`is_delete` = 0)) group by `comp_sales_creditnote`.`companyID`,`year` union select 'comp_receive_payment' AS `comp_receive_payment`,1300 AS `1300`,`comp_receive_payment`.`companyID` AS `companyid`,date_format(`comp_receive_payment`.`receivePaymentDate`,'%Y') AS `year`,count(if((month(`comp_receive_payment`.`receivePaymentDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_receive_payment`.`receivePaymentDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_receive_payment`.`receivePaymentDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_receive_payment`.`receivePaymentDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_receive_payment`.`receivePaymentDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_receive_payment`.`receivePaymentDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_receive_payment`.`receivePaymentDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_receive_payment`.`receivePaymentDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_receive_payment`.`receivePaymentDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_receive_payment`.`receivePaymentDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_receive_payment`.`receivePaymentDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_receive_payment`.`receivePaymentDate`) = 12),1,NULL)) AS `12` from `comp_receive_payment` where ((`comp_receive_payment`.`updateAble` = 0) and (`comp_receive_payment`.`is_delete` = 0)) group by `comp_receive_payment`.`companyID`,`year` union select 'comp_receive_payment_others' AS `comp_receive_payment_others`,1400 AS `1400`,`comp_receive_payment_others`.`companyID` AS `companyid`,date_format(`comp_receive_payment_others`.`receivePaymentDate`,'%Y') AS `year`,count(if((month(`comp_receive_payment_others`.`receivePaymentDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_receive_payment_others`.`receivePaymentDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_receive_payment_others`.`receivePaymentDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_receive_payment_others`.`receivePaymentDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_receive_payment_others`.`receivePaymentDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_receive_payment_others`.`receivePaymentDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_receive_payment_others`.`receivePaymentDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_receive_payment_others`.`receivePaymentDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_receive_payment_others`.`receivePaymentDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_receive_payment_others`.`receivePaymentDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_receive_payment_others`.`receivePaymentDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_receive_payment_others`.`receivePaymentDate`) = 12),1,NULL)) AS `12` from `comp_receive_payment_others` where ((`comp_receive_payment_others`.`updateAble` = 0) and (`comp_receive_payment_others`.`is_delete` = 0)) group by `comp_receive_payment_others`.`companyID`,`year` union select 'comp_cash_sales' AS `comp_cash_sales`,1500 AS `1500`,`comp_cash_sales`.`companyID` AS `companyid`,date_format(`comp_cash_sales`.`salesInvoiceDate`,'%Y') AS `year`,count(if((month(`comp_cash_sales`.`salesInvoiceDate`) = 1),1,NULL)) AS `1`,count(if((month(`comp_cash_sales`.`salesInvoiceDate`) = 2),1,NULL)) AS `2`,count(if((month(`comp_cash_sales`.`salesInvoiceDate`) = 3),1,NULL)) AS `3`,count(if((month(`comp_cash_sales`.`salesInvoiceDate`) = 4),1,NULL)) AS `4`,count(if((month(`comp_cash_sales`.`salesInvoiceDate`) = 5),1,NULL)) AS `5`,count(if((month(`comp_cash_sales`.`salesInvoiceDate`) = 6),1,NULL)) AS `6`,count(if((month(`comp_cash_sales`.`salesInvoiceDate`) = 7),1,NULL)) AS `7`,count(if((month(`comp_cash_sales`.`salesInvoiceDate`) = 8),1,NULL)) AS `8`,count(if((month(`comp_cash_sales`.`salesInvoiceDate`) = 9),1,NULL)) AS `9`,count(if((month(`comp_cash_sales`.`salesInvoiceDate`) = 10),1,NULL)) AS `10`,count(if((month(`comp_cash_sales`.`salesInvoiceDate`) = 11),1,NULL)) AS `11`,count(if((month(`comp_cash_sales`.`salesInvoiceDate`) = 12),1,NULL)) AS `12` from `comp_cash_sales` where ((`comp_cash_sales`.`updateAble` = 0) and (`comp_cash_sales`.`is_delete` = 0)) group by `comp_cash_sales`.`companyID`,`year` union select 'comp_journal' AS `comp_journal`,1600 AS `1600`,`comp_journal`.`companyID` AS `companyid`,date_format(`comp_journal`.`effective_date`,'%Y') AS `year`,count(if((month(`comp_journal`.`effective_date`) = 1),1,NULL)) AS `1`,count(if((month(`comp_journal`.`effective_date`) = 2),1,NULL)) AS `2`,count(if((month(`comp_journal`.`effective_date`) = 3),1,NULL)) AS `3`,count(if((month(`comp_journal`.`effective_date`) = 4),1,NULL)) AS `4`,count(if((month(`comp_journal`.`effective_date`) = 5),1,NULL)) AS `5`,count(if((month(`comp_journal`.`effective_date`) = 6),1,NULL)) AS `6`,count(if((month(`comp_journal`.`effective_date`) = 7),1,NULL)) AS `7`,count(if((month(`comp_journal`.`effective_date`) = 8),1,NULL)) AS `8`,count(if((month(`comp_journal`.`effective_date`) = 9),1,NULL)) AS `9`,count(if((month(`comp_journal`.`effective_date`) = 10),1,NULL)) AS `10`,count(if((month(`comp_journal`.`effective_date`) = 11),1,NULL)) AS `11`,count(if((month(`comp_journal`.`effective_date`) = 12),1,NULL)) AS `12` from `comp_journal` where ((`comp_journal`.`is_delete` = 0) and isnull(`comp_journal`.`formNo`)) group by `comp_journal`.`companyID`,`comp_journal`.`year` */;

--
-- Final view structure for view `view_unpost_ap_creditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ap_creditnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_ap_creditnote` AS select `e`.`supplierName` AS `supplier`,`a`.`ID` AS `creditnoteID`,`b`.`lineNo` AS `lineNo`,`c`.`projectID` AS `projectID`,`a`.`supplierInvoiceID` AS `supplierInvoiceID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`supplierID` AS `supplierID`,`c`.`supplierInvoiceNo` AS `supplierInvoiceNo`,if((`c`.`purchaseInvoiceCodeID` = 1),(select `cri`.`locationID` from (`comp_receive_item_detail` `crid` left join `comp_receive_item` `cri` on((`cri`.`ID` = `crid`.`receiveID`))) where (`crid`.`ID` = `g`.`receiveID`)),`c`.`locationID`) AS `locationID`,`b`.`umID` AS `umID`,`b`.`quantity` AS `quantity`,`b`.`itemID` AS `itemID`,concat('[',`d`.`itemCode`,']',`d`.`name`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,(select `item`.`inventoriesID` from `item` where (`item`.`ID` = `b`.`itemID`)) AS `drAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `crAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `drTaxAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `crTaxAccountID` from (((`comp_supplier_creditnote` `a` join (`comp_supplier_creditnote_detail` `b` left join `item` `d` on((`b`.`itemID` = `d`.`ID`)))) join (`comp_supplier_invoice` `c` left join `comp_supplier_invoice_detail` `g` on((`c`.`ID` = `g`.`invoiceID`)))) join `supplier` `e`) where ((`a`.`ID` = `b`.`creditnoteID`) and (`a`.`supplierInvoiceID` = `c`.`ID`) and (`e`.`ID` = `a`.`supplierID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) union select `e`.`supplierName` AS `supplier`,`a`.`ID` AS `creditnoteID`,`b`.`lineNo` AS `lineNo`,`c`.`projectID` AS `projectID`,`a`.`supplierInvoiceID` AS `supplierInvoiceID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`supplierID` AS `supplierID`,`c`.`supplierInvoiceNo` AS `supplierInvoiceNo`,`c`.`locationID` AS `locationID`,`b`.`umID` AS `umID`,`b`.`quantity` AS `quantity`,NULL AS `itemID`,`b`.`itemdescription` AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,`b`.`accountNoID` AS `drAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `crAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `drTaxAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `crTaxAccountID` from (((`comp_supplier_creditnote` `a` join `comp_supplier_creditnote_charges` `b`) join `comp_supplier_invoice` `c`) join `supplier` `e`) where ((`a`.`ID` = `b`.`creditNoteID`) and (`a`.`supplierInvoiceID` = `c`.`ID`) and (`e`.`ID` = `a`.`supplierID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_unpost_ap_debitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ap_debitnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_ap_debitnote` AS select `e`.`supplierName` AS `supplier`,`a`.`ID` AS `debitnoteID`,`b`.`lineNo` AS `lineNo`,`c`.`projectID` AS `projectID`,4 AS `typeID`,`b`.`ID` AS `typeDetailID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`supplierID` AS `supplierID`,`c`.`supplierInvoiceNo` AS `supplierInvoiceNo`,if((`c`.`purchaseInvoiceCodeID` = 1),(select `cri`.`locationID` from (`comp_receive_item_detail` `crid` left join `comp_receive_item` `cri` on((`cri`.`ID` = `crid`.`receiveID`))) where (`crid`.`ID` = `g`.`receiveID`)),`c`.`locationID`) AS `locationID`,`b`.`umID` AS `umID`,`b`.`quantity` AS `quantity`,`b`.`itemID` AS `itemID`,concat('[',`d`.`itemCode`,']',`b`.`itemdescription`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `drAccountID`,(select `item`.`inventoriesID` from `item` where (`item`.`ID` = `b`.`itemID`)) AS `crAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `drTaxAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `crTaxAccountID`,NULL AS `cogsAcctID`,NULL AS `inventoriesAcctID` from (((`comp_supplier_debitnote` `a` join (`comp_supplier_debitnote_detail` `b` left join `item` `d` on((`b`.`itemID` = `d`.`ID`)))) join (`comp_supplier_invoice` `c` left join `comp_supplier_invoice_detail` `g` on((`c`.`ID` = `g`.`invoiceID`)))) join `supplier` `e`) where ((`a`.`ID` = `b`.`debitnoteID`) and (`a`.`supplierID` = `e`.`ID`) and (`a`.`supplierInvoiceID` = `c`.`ID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) union select `e`.`supplierName` AS `supplier`,`a`.`ID` AS `debitnoteID`,`b`.`lineNo` AS `lineNo`,`c`.`projectID` AS `projectID`,4 AS `typeID`,`b`.`ID` AS `typeDetailID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`supplierID` AS `supplierID`,`c`.`supplierInvoiceNo` AS `supplierInvoiceNo`,`c`.`locationID` AS `locationID`,`b`.`umID` AS `umID`,`b`.`quantity` AS `quantity`,NULL AS `itemID`,`b`.`itemdescription` AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `drAccountID`,`b`.`accountNoID` AS `crAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `drTaxAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `crTaxAccountID`,NULL AS `cogsAcctID`,NULL AS `inventoriesAcctID` from (((`comp_supplier_debitnote` `a` join `comp_supplier_debitnote_charges` `b`) join `comp_supplier_invoice` `c`) join `supplier` `e`) where ((`a`.`ID` = `b`.`debitNoteID`) and (`a`.`supplierID` = `e`.`ID`) and (`a`.`supplierInvoiceID` = `c`.`ID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_unpost_ap_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ap_invoice`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_ap_invoice` AS select `d`.`supplierName` AS `supplier`,`a`.`ID` AS `invoiceID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`supplierID` AS `supplierID`,`b`.`lineNo` AS `lineNo`,`b`.`itemID` AS `itemID`,concat('[',`c`.`itemCode`,']',`b`.`itemname`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'unInvoiceAP'))) AS `drAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `crAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `drTaxAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `crTaxAccountID` from (((`comp_supplier_invoice` `a` left join `comp_supplier_invoice_detail` `b` on((`a`.`ID` = `b`.`invoiceID`))) left join `item` `c` on((`b`.`itemID` = `c`.`ID`))) join `supplier` `d` on((`d`.`ID` = `a`.`supplierID`))) where ((`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) union select `d`.`supplierName` AS `supplier`,`a`.`ID` AS `invoiceID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`supplierID` AS `supplierID`,(`b`.`lineNo` + (select ifnull(max(`comp_supplier_invoice_detail`.`lineNo`),0) from `comp_supplier_invoice_detail` where (`comp_supplier_invoice_detail`.`invoiceID` = `a`.`ID`))) AS `lineNo`,NULL AS `itemID`,`b`.`chargeDescription` AS `itemname`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,`b`.`accountNoID` AS `drAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `crAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `drTaxAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `crTaxAccountID` from ((`comp_supplier_invoice` `a` join `comp_supplier_invoice_charges` `b` on((`a`.`ID` = `b`.`invoiceID`))) left join `supplier` `d` on((`d`.`ID` = `a`.`supplierID`))) where ((`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_unpost_ar_creditnote`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_creditnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_ar_creditnote` AS select `f`.`customerName` AS `customer`,`a`.`salesInvoiceID` AS `salesinvoiceID`,`a`.`ID` AS `creditnoteID`,`a`.`projectID` AS `projectID`,0 AS `typeID`,`b`.`ID` AS `typeDetailID`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,if((`c`.`invoiceCodeID` = 1),(select `dord`.`locationID` from (`comp_delivery_detail` `ddet` left join `comp_delivery_order` `dord` on((`dord`.`ID` = `ddet`.`deliveryID`))) where (`ddet`.`ID` = `g`.`doID`)),`c`.`locationID`) AS `locationID`,concat(`c`.`formNo`,'[',convert(lpad(`c`.`serialNo`,8,'0') using latin1),']') AS `salesInvoiceNo`,`b`.`lineNo` AS `lineNo`,`b`.`itemID` AS `itemID`,`b`.`umID` AS `umID`,`b`.`quantity` AS `quantity`,concat('[',`d`.`itemCode`,']',`b`.`itemname`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,(select `item`.`incomeID` from `item` where (`item`.`ID` = `b`.`itemID`)) AS `drAccountID`,ifnull(`f`.`linkedAPAccountID`,`e`.`accountID`) AS `crAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `drTaxAccountID`,ifnull(`f`.`linkedAPAccountID`,`e`.`accountID`) AS `crTaxAccountID`,(select `item`.`cogsID` from `item` where (`item`.`ID` = `b`.`itemID`)) AS `cogsAcctID`,(select `item`.`inventoriesID` from `item` where (`item`.`ID` = `b`.`itemID`)) AS `inventoriesAcctID` from ((((((`comp_sales_creditnote` `a` left join `comp_sales_creditnote_detail` `b` on((`a`.`ID` = `b`.`creditnoteID`))) left join `item` `d` on((`b`.`itemID` = `d`.`ID`))) left join `comp_sales_invoice` `c` on((`c`.`ID` = `a`.`salesInvoiceID`))) left join `comp_sales_invoice_detail` `g` on((`c`.`ID` = `g`.`invoiceID`))) join `customer` `f`) join `comp_control_acct_setup` `e`) where ((`a`.`ID` = `b`.`creditnoteID`) and (`a`.`customerID` = `f`.`ID`) and (`e`.`companyID` = `a`.`companyID`) and (`e`.`accountCode` = 'rcvacct') and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) union select `f`.`customerName` AS `customer`,`a`.`salesInvoiceID` AS `salesinvoiceID`,`a`.`ID` AS `creditnoteID`,`c`.`projectID` AS `projectID`,0 AS `typeID`,`b`.`ID` AS `typeDetailID`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,`c`.`locationID` AS `locationID`,concat(`c`.`formNo`,'[',convert(lpad(`c`.`serialNo`,8,'0') using latin1),']') AS `salesInvoiceNo`,`b`.`lineNo` AS `lineNo`,NULL AS `itemID`,NULL AS `umID`,1 AS `quantity`,`b`.`chargeDescription` AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,`b`.`accountNoID` AS `drAccountID`,ifnull(`f`.`linkedAPAccountID`,`e`.`accountID`) AS `crAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `drTaxAccountID`,ifnull(`f`.`linkedAPAccountID`,`e`.`accountID`) AS `crTaxAccountID`,NULL AS `cogsAcctID`,NULL AS `inventoriesAcctID` from ((((`comp_sales_creditnote` `a` left join `comp_sales_invoice` `c` on((`c`.`ID` = `a`.`salesInvoiceID`))) join `customer` `f`) join `comp_control_acct_setup` `e`) join `comp_sales_creditnote_charges` `b`) where ((`a`.`ID` = `b`.`creditNoteID`) and (`a`.`customerID` = `f`.`ID`) and (`e`.`companyID` = `a`.`companyID`) and (`e`.`accountCode` = 'rcvacct') and (`a`.`ID` = `b`.`creditNoteID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_unpost_ar_debitnote`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_debitnote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_ar_debitnote` AS select `f`.`customerName` AS `customer`,`a`.`salesInvoiceID` AS `salesinvoiceID`,`a`.`ID` AS `debitnoteID`,`c`.`projectID` AS `projectID`,3 AS `typeID`,`b`.`ID` AS `typeDetailID`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,if((`c`.`invoiceCodeID` = 1),(select `do`.`locationID` from (`comp_delivery_detail` `ddet` left join `comp_delivery_order` `do` on((`do`.`ID` = `ddet`.`deliveryID`))) where (`ddet`.`ID` = `g`.`doID`)),`c`.`locationID`) AS `locationID`,concat(`c`.`formNo`,'[',convert(lpad(`c`.`serialNo`,8,'0') using latin1),']') AS `salesInvoiceNo`,`b`.`lineNo` AS `lineNo`,`b`.`itemID` AS `itemID`,`b`.`umID` AS `umID`,`b`.`quantity` AS `quantity`,concat('[',`d`.`itemCode`,']',`b`.`itemname`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,`c`.`currencyID` AS `currencyID`,ifnull(`f`.`linkedAPAccountID`,`e`.`accountID`) AS `drAccountID`,(select `item`.`incomeID` from `item` where (`item`.`ID` = `b`.`itemID`)) AS `crAccountID`,ifnull(`f`.`linkedAPAccountID`,`e`.`accountID`) AS `drTaxAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `crTaxAccountID`,`d`.`cogsID` AS `cogsAcctID`,`d`.`inventoriesID` AS `inventoriesAcctID` from ((((((`comp_sales_debitnote` `a` join `comp_sales_debitnote_detail` `b` on((`a`.`ID` = `b`.`debitnoteID`))) left join `item` `d` on((`b`.`itemID` = `d`.`ID`))) left join `comp_sales_invoice` `c` on((`c`.`ID` = `a`.`salesInvoiceID`))) left join `comp_sales_invoice_detail` `g` on((`c`.`ID` = `g`.`invoiceID`))) join `customer` `f`) join `comp_control_acct_setup` `e`) where ((`a`.`ID` = `b`.`debitnoteID`) and (`a`.`customerID` = `f`.`ID`) and (`e`.`companyID` = `a`.`companyID`) and (`e`.`accountCode` = 'rcvacct') and (`a`.`ID` = `b`.`debitnoteID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) union select `f`.`customerName` AS `customer`,`a`.`salesInvoiceID` AS `salesinvoiceID`,`a`.`ID` AS `debitnoteID`,`c`.`projectID` AS `projectID`,0 AS `typeID`,`b`.`ID` AS `typeDetailID`,concat(`a`.`formNo`,'[',convert(lpad(`a`.`serialNo`,8,'0') using latin1),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,`c`.`locationID` AS `locationID`,concat(`c`.`formNo`,'[',convert(lpad(`c`.`serialNo`,8,'0') using latin1),']') AS `salesInvoiceNo`,`b`.`lineNo` AS `lineNo`,NULL AS `itemID`,NULL AS `umID`,1 AS `quantity`,`b`.`chargeDescription` AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,`c`.`currencyID` AS `currencyID`,ifnull(`f`.`linkedAPAccountID`,`e`.`accountID`) AS `drAccountID`,`b`.`accountNoID` AS `crAccountID`,ifnull(`f`.`linkedAPAccountID`,`e`.`accountID`) AS `drTaxAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `crTaxAccountID`,NULL AS `cogsAcctID`,NULL AS `inventoriesAcctID` from ((((`comp_sales_debitnote` `a` left join `comp_sales_invoice` `c` on((`c`.`ID` = `a`.`salesInvoiceID`))) join `customer` `f`) join `comp_control_acct_setup` `e`) join `comp_sales_debitnote_charges` `b`) where ((`a`.`ID` = `b`.`debitNoteID`) and (`a`.`customerID` = `f`.`ID`) and (`e`.`companyID` = `a`.`companyID`) and (`e`.`accountCode` = 'rcvacct') and (`a`.`ID` = `b`.`debitNoteID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_unpost_ar_invoice`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_invoice`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_ar_invoice` AS select `a`.`projectID` AS `projectID`,`e`.`customerName` AS `customer`,`a`.`ID` AS `invoiceID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,`b`.`itemID` AS `itemID`,`b`.`lineNo` AS `lineNo`,concat('[',`c`.`itemCode`,']',`c`.`description`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,(select `customer`.`linkedAPAccountID` from `customer` where (`customer`.`ID` = `a`.`customerID`)) AS `drAccountID`,(select `item`.`incomeID` from `item` where (`item`.`ID` = `b`.`itemID`)) AS `crAccountID`,(select `customer`.`linkedAPAccountID` from `customer` where (`customer`.`ID` = `a`.`customerID`)) AS `drTaxAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `crTaxAccountID` from ((`comp_sales_invoice` `a` join (`comp_sales_invoice_detail` `b` left join `item` `c` on((`b`.`itemID` = `c`.`ID`)))) join `customer` `e`) where ((`a`.`ID` = `b`.`invoiceID`) and (`a`.`customerID` = `e`.`ID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) union select `a`.`projectID` AS `projectID`,`e`.`customerName` AS `customer`,`a`.`ID` AS `invoiceID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,`b`.`itemID` AS `itemID`,`b`.`lineNo` AS `lineNo`,concat('[',`c`.`itemCode`,']',`c`.`description`) AS `itemName`,(select sum((`crid`.`unitPrice` * `crdc`.`qty`)) from (`comp_receive_item_detail` `crid` join `comp_receive_delivery_conn` `crdc`) where ((`crid`.`ID` = `crdc`.`receiveDetailID`) and (`crdc`.`deliveryDetailID` = `do`.`ID`))) AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,NULL AS `taxamount`,(select `item`.`cogsID` from `item` where (`item`.`ID` = `b`.`itemID`)) AS `drAccountID`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'uninvoiceAR'))) AS `crAccountID`,NULL AS `drTaxAccountID`,NULL AS `crTaxAccountID` from ((`comp_sales_invoice` `a` join ((`comp_sales_invoice_detail` `b` left join `item` `c` on((`b`.`itemID` = `c`.`ID`))) left join `comp_delivery_detail` `do` on(((`do`.`invoiceID` = `b`.`invoiceID`) and (`do`.`itemID` = `b`.`itemID`) and (`do`.`umID` = `b`.`umID`))))) join `customer` `e`) where ((`a`.`ID` = `b`.`invoiceID`) and (`a`.`customerID` = `e`.`ID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0) and (`a`.`invoiceCodeID` <> 2)) union select `a`.`projectID` AS `projectID`,`e`.`customerName` AS `customer`,`a`.`ID` AS `invoiceID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,NULL AS `NULL`,`b`.`lineNo` AS `lineNo`,`b`.`chargeDescription` AS `chargedescription`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,(select `customer`.`linkedAPAccountID` from `customer` where (`customer`.`ID` = `a`.`customerID`)) AS `drAccountID`,`b`.`accountNoID` AS `crAccountID`,(select `customer`.`linkedAPAccountID` from `customer` where (`customer`.`ID` = `a`.`customerID`)) AS `drTaxAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `crTaxAccountID` from ((`comp_sales_invoice` `a` join `comp_sales_invoice_charges` `b`) join `customer` `e`) where ((`a`.`ID` = `b`.`invoiceID`) and (`e`.`ID` = `a`.`customerID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) union select `a`.`projectID` AS `projectID`,`e`.`customerName` AS `customer`,`a`.`ID` AS `invoiceID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,NULL AS `NULL`,`b`.`lineNo` AS `lineNo`,'comission' AS `itemName`,((sum(`b`.`amountExcludedTax`) * `d`.`commisionRate`) / 100) AS `comissionAmount`,0 AS `taxID`,0 AS `taxAmount`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'commissionexp'))) AS `drAccountID`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'commissionpay'))) AS `crAccountID`,NULL AS `drTaxAccountID`,NULL AS `crTaxAccountID` from (((`comp_sales_invoice` `a` join `comp_sales_invoice_detail` `b`) join `comp_sales_agent` `d`) join `customer` `e`) where ((`a`.`companyID` = `d`.`companyID`) and (`a`.`ID` = `b`.`invoiceID`) and (`a`.`agentID` = `d`.`ID`) and (`a`.`customerID` = `e`.`ID`) and (`a`.`agentID` > 0) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) group by `a`.`ID` union select `a`.`projectID` AS `projectID`,`e`.`customerName` AS `customer`,`a`.`ID` AS `invoiceID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,NULL AS `NULL`,`b`.`lineNo` AS `lineNo`,'wakaf' AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedtax`,0 AS `taxID`,0 AS `taxAmount`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'wakafExpense'))) AS `drAccountID`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'wakafAcrual'))) AS `crAccountID`,NULL AS `drTaxAccountID`,NULL AS `crTaxAccountID` from ((((`comp_sales_invoice` `a` join `comp_sales_invoice_detail` `b`) join `wakaf_acrual` `c`) join `item` `d`) join `customer` `e`) where ((`a`.`ID` = `b`.`invoiceID`) and (`a`.`customerID` = `e`.`ID`) and (`a`.`companyID` = `c`.`companyID`) and (`b`.`itemID` = `d`.`ID`) and (`d`.`incomeID` = `c`.`salesAccountID`) and (`a`.`salesInvoiceDate` between `c`.`from` and `c`.`to`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_unpost_ar_payment`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_payment`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_ar_payment` AS select `a`.`ID` AS `paymentID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,NULL AS `purchaseInvoiceID`,`b`.`customerName` AS `customerName`,0 AS `lineNo`,NULL AS `paymentDetailID`,`a`.`referenceNo` AS `item`,`a`.`bankCharges` AS `amtPaid_amtAppl`,0 AS `discount_bankCharges`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'bankchargesAccount'))) AS `drAccountID`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankID`)) AS `crAccountID`,NULL AS `drDiscountAccountID`,NULL AS `crDiscountAccountID` from (`comp_receive_payment` `a` join `customer` `b`) where ((`a`.`customerID` = `b`.`ID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) union select `a`.`ID` AS `paymentID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,`b`.`invoiceID` AS `invoiceID`,`e`.`customerName` AS `customerName`,`b`.`lineNo` AS `lineNo`,`b`.`ID` AS `paymentDetailID`,concat(concat(concat(`d`.`formNo`,'['),convert(lpad(`d`.`serialNo`,8,'0') using latin1)),']') AS `item`,(`b`.`amountApplied` - `b`.`discount`) AS `amtPaid_amtAppl`,`b`.`discount` AS `discount_bankCharges`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankID`)) AS `drAccountID`,(select `customer`.`linkedAPAccountID` from `customer` where (`customer`.`ID` = `a`.`customerID`)) AS `crAccountID`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'saledisacct'))) AS `drDiscountAccountID`,(select `customer`.`linkedAPAccountID` from `customer` where (`customer`.`ID` = `a`.`customerID`)) AS `crDiscountAccountID` from (((`comp_receive_payment` `a` join (`comp_receive_payment_detail` `b` left join `comp_sales_invoice` `d` on((`d`.`ID` = `b`.`invoiceID`)))) join `comp_sales_invoice` `c`) join `customer` `e`) where ((`a`.`customerID` = `e`.`ID`) and (`a`.`ID` = `b`.`receivePaymentID`) and (`c`.`ID` = `b`.`invoiceID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) union select `a`.`ID` AS `paymentID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`customerID` AS `customerID`,`b`.`historicalinvoiceID` AS `invoiceID`,`e`.`customerName` AS `customerName`,`b`.`ID` AS `lineNo`,`b`.`ID` AS `paymentDetailID`,concat(concat(concat(`d`.`formNo`,'['),convert(lpad(`d`.`serialNo`,8,'0') using latin1)),']') AS `item`,`b`.`amountApplied` AS `amtPaid_amtAppl`,NULL AS `discount_bankCharges`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankID`)) AS `drAccountID`,(select `customer`.`linkedAPAccountID` from `customer` where (`customer`.`ID` = `a`.`customerID`)) AS `crAccountID`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'saledisacct'))) AS `drDiscountAccountID`,(select `customer`.`linkedAPAccountID` from `customer` where (`customer`.`ID` = `a`.`customerID`)) AS `crDiscountAccountID` from (((`comp_receive_payment` `a` join (`comp_receive_payment_detail_historical_invoice` `b` left join `comp_historical_customer_invoice` `d` on((`d`.`ID` = `b`.`historicalinvoiceID`)))) join `comp_historical_customer_invoice` `c`) join `customer` `e`) where ((`a`.`customerID` = `e`.`ID`) and (`a`.`ID` = `b`.`paymentID`) and (`c`.`ID` = `b`.`historicalinvoiceID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_unpost_cash_purchase`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_cash_purchase`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_cash_purchase` AS select `b`.`lineNo` AS `lineNo`,`b`.`quantity` AS `quantity`,`b`.`unitPrice` AS `unitPrice`,`b`.`itemID` AS `itemID`,`b`.`itemdescription` AS `itemdescription`,`b`.`umID` AS `umID`,`a`.`locationID` AS `locationID`,`a`.`ID` AS `othersPaymentID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`ID`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,NULL AS `supplierID`,NULL AS `purchaseInvoiceID`,`b`.`ID` AS `paymentDetailID`,NULL AS `supplierInvoiceNo`,`b`.`lineNo` AS `ID`,`b`.`itemname` AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedTax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxAmount`,`a`.`projectID` AS `projectID`,`c`.`itemTypeID` AS `itemTypeID`,if((`c`.`itemTypeID` = 23),`c`.`cogsID`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'uninvoiceAP')))) AS `drAccountID`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankId`)) AS `crAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `drDiscountAccountID`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankId`)) AS `crDiscountAccountID` from ((`comp_payment_others` `a` join `comp_payment_others_with_item` `b`) left join `item` `c` on((`c`.`ID` = `b`.`itemID`))) where ((`a`.`ID` = `b`.`otherPaymentID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_unpost_cash_sale`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_cash_sale`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_cash_sale` AS select `a`.`projectID` AS `projectID`,`a`.`paymentFrom` AS `customer`,`a`.`ID` AS `invoiceID`,5 AS `typeID`,`b`.`ID` AS `typeDetailID`,`a`.`locationID` AS `locationID`,`b`.`quantity` AS `quantity`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`b`.`itemID` AS `itemID`,`b`.`umID` AS `umID`,`b`.`lineNo` AS `lineNo`,`d`.`currencyID` AS `currencyID`,concat('[',`c`.`itemCode`,']',`c`.`description`) AS `itemName`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankID`)) AS `drAccountID`,`c`.`incomeID` AS `crAccountID`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankID`)) AS `drTaxAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `crTaxAccountID`,`c`.`cogsID` AS `cogsAcctID`,`c`.`inventoriesID` AS `inventoriesAcctID` from ((`comp_cash_sales` `a` join (`comp_cash_sales_detail` `b` left join `item` `c` on((`b`.`itemID` = `c`.`ID`)))) join `company` `d`) where ((`a`.`ID` = `b`.`invoiceID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0) and (`a`.`companyID` = `d`.`ID`)) */;

--
-- Final view structure for view `view_unpost_do`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_do`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_do` AS select `a`.`ID` AS `deliveryOrderID`,`a`.`customerID` AS `customerID`,NULL AS `projectID`,NULL AS `customer`,`a`.`ID` AS `invoiceID`,1 AS `typeID`,`b`.`ID` AS `typeDetailID`,`a`.`locationID` AS `locationID`,`b`.`quantitySent` AS `quantity`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`b`.`itemID` AS `itemID`,concat('[',`c`.`itemCode`,']',`c`.`description`) AS `itemName`,0 AS `amountExcludedtax`,NULL AS `taxid`,0 AS `taxamount`,NULL AS `drAccountID`,NULL AS `crAccountID`,NULL AS `drTaxAccountID`,NULL AS `crTaxAccountID`,if((`b`.`invoiceID` > 0),`c`.`cogsID`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'unInvoiceAR')))) AS `cogsAcctID`,`c`.`inventoriesID` AS `inventoriesAcctID` from (`comp_delivery_order` `a` join (`comp_delivery_detail` `b` left join `item` `c` on((`b`.`itemID` = `c`.`ID`)))) where ((`a`.`ID` = `b`.`deliveryID`) and (`a`.`updateAble` = 1) and (`a`.`isDelete` = 0)) */;

--
-- Final view structure for view `view_unpost_gst_transaction`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_gst_transaction`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_gst_transaction` AS select `a`.`ID` AS `paymentID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,NULL AS `supplierID`,NULL AS `purchaseInvoiceID`,concat(`a`.`Description`,'[',`a`.`vendor_cust_name`,']') AS `supplierName`,0 AS `lineNo`,NULL AS `paymentDetailID`,NULL AS `supplierInvoiceNo`,`a`.`reference` AS `item`,`b`.`taxAmountDr` AS `amtPaid_amtAppl`,0 AS `discount_bankCharges`,`b`.`accountID` AS `drAccountID`,(select `comp_gst_transaction_detail`.`accountID` from `comp_gst_transaction_detail` where ((`comp_gst_transaction_detail`.`gstTransID` = `a`.`ID`) and (`comp_gst_transaction_detail`.`taxAmountCr` > 0))) AS `crAccountID`,NULL AS `drDiscountAccountID`,NULL AS `crDiscountAccountID` from (`comp_gst_transaction` `a` join `comp_gst_transaction_detail` `b`) where ((`a`.`ID` = `b`.`gstTransID`) and (`b`.`taxAmountDr` > 0) and (`a`.`updateAble` = 1) and (`a`.`isDelete` = 0)) */;

--
-- Final view structure for view `view_unpost_other_payment`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_other_payment`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_other_payment` AS select `a`.`ID` AS `othersPaymentID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,NULL AS `supplierID`,NULL AS `purchaseInvoiceID`,`b`.`ID` AS `paymentDetailID`,NULL AS `supplierInvoiceNo`,`b`.`lineNo` AS `lineNo`,`b`.`itemdescription` AS `itemdescription`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,`b`.`accountID` AS `drAccountID`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankId`)) AS `crAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `drTaxAccountID`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankId`)) AS `crTaxAccountID` from (`comp_payment_others` `a` join `comp_payment_others_without_item` `b`) where ((`a`.`ID` = `b`.`otherPaymentID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_unpost_other_receive`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_other_receive`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_other_receive` AS select `a`.`projectID` AS `projectID`,`a`.`receiveFrom` AS `receiveFrom`,`a`.`ID` AS `otherReceiveID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,NULL AS `NULL`,`b`.`description` AS `itemdescription`,`b`.`amountExcludedTax` AS `amountExcludedtax`,`b`.`taxID` AS `taxid`,`b`.`taxAmount` AS `taxamount`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankID`)) AS `drAccountID`,`b`.`accountNoID` AS `crAccountID`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankID`)) AS `drTaxAccountID`,(select `tax_master`.`taxAccount` from `tax_master` where (`tax_master`.`ID` = `b`.`taxID`)) AS `crTaxAccountID` from (`comp_receive_payment_others` `a` join `comp_receive_payment_others_detail` `b`) where ((`a`.`ID` = `b`.`receivePaymentOthersID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_unpost_payment`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_payment`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_payment` AS select `a`.`ID` AS `paymentID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`supplierID` AS `supplierID`,NULL AS `purchaseInvoiceID`,`b`.`supplierName` AS `supplierName`,0 AS `lineNo`,NULL AS `paymentDetailID`,NULL AS `supplierInvoiceNo`,`a`.`referenceNo` AS `item`,`a`.`bankCharges` AS `amtPaid_amtAppl`,0 AS `discount_bankCharges`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'bankchargesAccount'))) AS `drAccountID`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankID`)) AS `crAccountID`,NULL AS `drDiscountAccountID`,NULL AS `crDiscountAccountID` from (`comp_payment` `a` join `supplier` `b`) where ((`a`.`supplierID` = `b`.`ID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) union select `a`.`ID` AS `paymentID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`supplierID` AS `supplierID`,`b`.`purchaseInvoiceID` AS `purchaseInvoiceID`,`e`.`supplierName` AS `supplierName`,`b`.`lineNo` AS `lineNo`,`b`.`ID` AS `paymentDetailID`,`c`.`supplierInvoiceNo` AS `supplierInvoiceNo`,concat(concat(concat(`d`.`formNo`,'['),convert(lpad(`d`.`serialNo`,8,'0') using latin1)),']') AS `item`,(`b`.`amountApplied` - `b`.`discount`) AS `amtPaid_amtAppl`,`b`.`discount` AS `discount_bankCharges`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `drAccountID`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankID`)) AS `crAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `drDiscountAccountID`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'payDisc'))) AS `crDiscountAccountID` from (((`comp_payment` `a` join (`comp_payment_detail` `b` left join `comp_supplier_invoice` `d` on((`d`.`ID` = `b`.`purchaseInvoiceID`)))) join `comp_supplier_invoice` `c`) join `supplier` `e`) where ((`a`.`supplierID` = `e`.`ID`) and (`a`.`ID` = `b`.`paymentID`) and (`c`.`ID` = `b`.`purchaseInvoiceID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) union select `a`.`ID` AS `paymentID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`supplierID` AS `supplierID`,`b`.`historicalinvoiceID` AS `purchaseInvoiceID`,`e`.`supplierName` AS `supplierName`,`b`.`ID` AS `lineNo`,`b`.`ID` AS `paymentDetailID`,`c`.`supplierInvoiceNo` AS `supplierInvoiceNo`,concat(concat(concat(`d`.`formNo`,'['),convert(lpad(`d`.`serialNo`,8,'0') using latin1)),']') AS `item`,`b`.`amountApplied` AS `amtPaid_amtAppl`,NULL AS `discount_bankCharges`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `drAccountID`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankID`)) AS `crAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `drDiscountAccountID`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'payDisc'))) AS `crDiscountAccountID` from (((`comp_payment` `a` join (`comp_payment_detail_historical_invoice` `b` left join `comp_historical_supplier_invoice` `d` on((`d`.`ID` = `b`.`historicalinvoiceID`)))) join `comp_historical_supplier_invoice` `c`) join `supplier` `e`) where ((`a`.`supplierID` = `e`.`ID`) and (`a`.`ID` = `b`.`paymentID`) and (`c`.`ID` = `b`.`historicalinvoiceID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) union select `a`.`ID` AS `paymentID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`a`.`companyID` AS `companyID`,`a`.`supplierID` AS `supplierID`,`b`.`creditnoteID` AS `purchaseInvoiceID`,`e`.`supplierName` AS `supplierName`,`b`.`ID` AS `lineNo`,`b`.`ID` AS `paymentDetailID`,`c`.`supplierInvoiceID` AS `supplierInvoiceNo`,concat(concat(concat(`d`.`formNo`,'['),convert(lpad(`d`.`serialNo`,8,'0') using latin1)),']') AS `item`,`b`.`amountApplied` AS `amtPaid_amtAppl`,NULL AS `discount_bankCharges`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `drAccountID`,(select `comp_bank`.`linkAccountID` from `comp_bank` where (`comp_bank`.`ID` = `a`.`bankID`)) AS `crAccountID`,(select `supplier`.`linkedAPAccountID` from `supplier` where (`supplier`.`ID` = `a`.`supplierID`)) AS `drDiscountAccountID`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'payDisc'))) AS `crDiscountAccountID` from (((`comp_payment` `a` join (`comp_payment_detail_creditnote` `b` left join `comp_supplier_creditnote` `d` on((`d`.`ID` = `b`.`creditnoteID`)))) join `comp_supplier_creditnote` `c`) join `supplier` `e`) where ((`a`.`supplierID` = `e`.`ID`) and (`a`.`ID` = `b`.`paymentID`) and (`c`.`ID` = `b`.`creditnoteID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) */;

--
-- Final view structure for view `view_unpost_receive_item`
--

/*!50001 DROP VIEW IF EXISTS `view_unpost_receive_item`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_unpost_receive_item` AS select `a`.`ID` AS `receiveID`,`a`.`companyID` AS `companyID`,`a`.`locationID` AS `locationID`,`a`.`deliveryDate` AS `transactionDate`,`a`.`supplierID` AS `supplierID`,concat(concat(concat(`a`.`formNo`,'['),convert(lpad(`a`.`serialNo`,8,'0') using latin1)),']') AS `formNo`,`b`.`lineNo` AS `lineNo`,`b`.`itemID` AS `itemID`,concat('[',`c`.`itemCode`,']',`c`.`name`) AS `itemName`,`a`.`exchangeRate` AS `exchangeRate`,`b`.`unitPrice` AS `unitPrice`,`b`.`quantityReceived` AS `quantityReceived`,`b`.`umID` AS `umID`,`b`.`amount` AS `amount`,ifnull((select `item`.`inventoriesID` from `item` where (`item`.`ID` = `b`.`itemID`)),(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'invAcct')))) AS `drAccountID`,(select `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where ((`comp_control_acct_setup`.`companyID` = `a`.`companyID`) and (`comp_control_acct_setup`.`accountCode` = 'unInvoiceAP'))) AS `crAccountID` from ((`comp_receive_item` `a` join `comp_receive_item_detail` `b`) join `item` `c`) where ((`a`.`updateAble` = 1) and (`a`.`ID` = `b`.`receiveID`) and (`b`.`itemID` = `c`.`ID`)) */;

--
-- Final view structure for view `view_wakaf_accrual`
--

/*!50001 DROP VIEW IF EXISTS `view_wakaf_accrual`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_wakaf_accrual` AS select `b`.`companyID` AS `companyID`,`b`.`acctID` AS `acctID`,`b`.`year` AS `year`,sum(`b`.`total`) AS `totalAmount` from (`company` `a` join `comp_acc_det` `b`) where ((`a`.`ID` = `b`.`companyID`) and `b`.`acctID` in (select distinct `comp_control_acct_setup`.`accountID` from `comp_control_acct_setup` where (`comp_control_acct_setup`.`accountCode` = 'wakafAcrual'))) group by `b`.`companyID`,`b`.`acctID`,`b`.`year` */;

--
-- Final view structure for view `view_wakaf_from_profit`
--

/*!50001 DROP VIEW IF EXISTS `view_wakaf_from_profit`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_wakaf_from_profit` AS select `a`.`companyID` AS `companyid`,`a`.`year` AS `year`,`c`.`ID` AS `acctType`,sum(`a`.`amountdr`) AS `totalDr`,sum(`a`.`amountcr`) AS `totalCr` from ((`comp_acc_det` `a` join `comp_chart_of_acct` `b`) join `_ref_acct_group` `c`) where ((`b`.`ID` = `a`.`acctID`) and (`c`.`ID` = `b`.`acctGroupID`) and (`c`.`ID` in (3,4))) group by `a`.`companyID`,`a`.`year`,`acctType` */;


