-- Dumping data for table `comp_supplier_invoice_detail`
--


--
-- Table structure for table `comp_supplier_statement`
--

CREATE TABLE `comp_supplier_statement` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `debit` double NOT NULL,
  `credit` double NOT NULL,
  `balance` double NOT NULL,
  `supplierCode` int(11) NOT NULL,
  `supplierName` varchar(16) NOT NULL,
  `description` varchar(255) NOT NULL,
  `referenceNo` varchar(5) NOT NULL,
  `is_delete` smallint(16) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `comp_supplier_statement`
--


--
-- Table structure for table `comp_unpresented_check`
--

CREATE TABLE `comp_unpresented_check` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `transDate` date NOT NULL,
  `transNo` varchar(255) NOT NULL,
  `desc` text NOT NULL,
  `referenceNo` varchar(255) NOT NULL,
  `bankID` int(11) NOT NULL,
  `debit` double NOT NULL,
  `credit` double NOT NULL,
  `bankReconcileID` int(11) NOT NULL DEFAULT '0',
  `is_delete` int(11) NOT NULL DEFAULT '0',
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `createdBy` int(11) DEFAULT NULL,
  `updateTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `updatedBy` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `comp_unpresented_check`
--


--
-- Table structure for table `company`
--

CREATE TABLE `company` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyName` varchar(128) NOT NULL,
  `companyNo` varchar(16) NOT NULL,
  `incorporateDate` date NOT NULL,
  `businessTypeID` int(11) NOT NULL,
  `line1` varchar(128) NOT NULL,
  `line2` varchar(128) NOT NULL,
  `line3` varchar(128) NOT NULL,
  `city` varchar(128) NOT NULL,
  `companyPostCode` varchar(8) NOT NULL,
  `companyStateID` int(11) NOT NULL,
  `phoneNo` varchar(16) NOT NULL,
  `faxNo` varchar(16) NOT NULL,
  `email` varchar(32) NOT NULL,
  `website` varchar(32) NOT NULL,
  `uploadLogo` varchar(64) NOT NULL,
  `currencyID` int(11) NOT NULL,
  `languageID` int(11) NOT NULL,
  `countryID` int(11) NOT NULL,
  `muslimShareholder` double NOT NULL,
  `gstRegisteredNo` varchar(16) NOT NULL,
  `gstRegisteredDate` date DEFAULT NULL,
  `gstSubmissionBuffer` int(16) NOT NULL,
  `taxablePeriod` smallint(6) NOT NULL,
  `masterMSIC` int(12) NOT NULL,
  `dateFormat` int(16) NOT NULL DEFAULT '1',
  `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` smallint(6) NOT NULL,
  `keyCode` varchar(128) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `company`
--

INSERT INTO `company` VALUES (1,'Demo Demo Demo Sdn Bhd','demo','2015-11-11',1,'demo demo demo ','off jalan line 2,','main road jalan 3,','Bt Caves','68100',1931,'603-61859970','603-61857788','puterakatak29@gmail.com','0','1.JPG',1,0,458,12,'012345678901','2014-12-05',6,0,0,1,0,'2014-04-23 20:32:22',0,'2015-12-08 11:51:35',0,''),(3,'Ahmed ENT','','0000-00-00',5,'sfffsfsafsa','asfasfasfa','asfasfasfa','asfasfasfa','asfasfas',1930,'4234321','34234234','phoe_nix291@yahoo.com','','',1,0,4,0,'',NULL,0,0,0,1,0,'0000-00-00 00:00:00',0,'2015-12-08 11:00:19',0,''),(4,'Yusuf ENT','','0000-00-00',1,'sadasdasd','asdasdasdasd','','','',0,'','','','','',1,0,0,0,'',NULL,0,0,0,1,0,'0000-00-00 00:00:00',0,'2015-12-08 11:00:31',0,''),(7,'ALI ENT','','0000-00-00',2,'kl sentralA','klA','A','bangsarA','59100121',1928,'016990876812121','0355287498','izuwanA@gmail.com','','',1,0,32,0,'',NULL,0,0,0,1,0,'0000-00-00 00:00:00',0,'2015-12-08 11:00:02',0,''),(9,'ABC ENT','','0000-00-00',1,'suite 2A-1','LEVEL 2A','PLAZA KL GOMBAK ','gombak','68100',1933,'03-61888000','03-61888111','beez@gmai.com','','',1,0,458,0,'',NULL,0,0,0,1,0,'0000-00-00 00:00:00',0,'2015-12-08 10:58:36',0,''),(10,'ABU ENT','','0000-00-00',1,'Gombak','Gombak','Gombak','Gombak','16100',1933,'019999999','099999999','faridfirdauszukpeli@gmail.com','','',1,0,458,0,'',NULL,0,0,0,1,0,'0000-00-00 00:00:00',0,'2015-12-08 10:59:02',0,'');

--
-- Table structure for table `customer`
--

CREATE TABLE `customer` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `customerName` varchar(128) NOT NULL,
  `accountCode` varchar(8) NOT NULL,
  `customerCompanyNo` varchar(32) NOT NULL,
  `line1` varchar(128) NOT NULL,
  `line2` varchar(128) NOT NULL,
  `line3` varchar(128) NOT NULL,
  `city` varchar(128) NOT NULL,
  `customerPostCode` varchar(8) NOT NULL,
  `customerStateID` int(11) NOT NULL,
  `customerCountryID` int(11) NOT NULL,
  `attention` varchar(16) NOT NULL,
  `website` varchar(32) NOT NULL,
  `phoneNumber1` varchar(50) NOT NULL,
  `phoneNumber2` varchar(50) NOT NULL,
  `fax` varchar(50) NOT NULL,
  `generalNote` varchar(255) NOT NULL,
  `gstRegNo` varchar(16) NOT NULL,
  `termsID` int(11) NOT NULL,
  `creditLimit` int(8) NOT NULL,
  `creditLimitAlert` tinyint(1) NOT NULL,
  `linkedAPAccountID` varchar(11) NOT NULL,
  `createdDate` date NOT NULL,
  `currencyID` int(11) NOT NULL,
  `email` varchar(64) NOT NULL,
  `termstatus` 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 '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` int(16) NOT NULL,
  `position` varchar(16) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `customer`
--


--
-- Table structure for table `customer_address`
--

CREATE TABLE `customer_address` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `customerID` int(11) NOT NULL,
  `addressCode` varchar(50) NOT NULL,
  `addressName` varchar(128) NOT NULL,
  `line1` varchar(128) NOT NULL,
  `line2` varchar(128) NOT NULL,
  `line3` varchar(128) NOT NULL,
  `city` varchar(128) NOT NULL,
  `postCode` varchar(8) NOT NULL,
  `stateID` int(11) NOT NULL,
  `countryID` 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 '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `customer_address`
--


--
-- Table structure for table `customer_contact`
--

CREATE TABLE `customer_contact` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `customerID` int(11) NOT NULL,
  `customer_contact_name` varchar(128) NOT NULL,
  `position` varchar(32) NOT NULL,
  `telOffice` varchar(32) NOT NULL,
  `telHp` varchar(32) NOT NULL,
  `email` varchar(64) NOT NULL,
  `remaks` text NOT NULL,
  `createdID` 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 `customer_contact`
--


--
-- Table structure for table `gl_setup`
--

CREATE TABLE `gl_setup` (
  `ID` int(11) NOT NULL,
  `companyID` int(11) NOT NULL,
  `accountTypeID` int(11) NOT NULL,
  `accountNoID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `gl_setup`
--


--
-- Table structure for table `item`
--

CREATE TABLE `item` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `itemCode` varchar(32) NOT NULL,
  `name` varchar(64) NOT NULL,
  `description` text NOT NULL,
  `itemCategoryID` int(11) NOT NULL,
  `itemTypeID` int(11) NOT NULL,
  `quantity` int(11) NOT NULL,
  `unitOfMeasureID` int(11) NOT NULL,
  `editDescription` tinyint(1) NOT NULL,
  `imageFile` varchar(64) NOT NULL,
  `itemStatusID` tinyint(4) NOT NULL DEFAULT '1' COMMENT 'default to active=1',
  `reorderLevel` int(11) NOT NULL,
  `incomeID` int(11) NOT NULL,
  `cogsID` int(11) NOT NULL,
  `inventoriesID` int(11) NOT NULL,
  `inputTaxID` int(11) NOT NULL,
  `outputTaxID` int(11) NOT NULL,
  `supplierID` int(11) NOT NULL,
  `memo` text NOT NULL,
  `locationID` int(11) NOT NULL,
  `is_delete` smallint(6) NOT NULL,
  `updateable` smallint(6) NOT NULL,
  `totalAmount` double NOT NULL,
  `totalPayable` 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,
  `supplierPrice` double NOT NULL,
  `salesPrice` double NOT NULL,
  `currencyID` int(11) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `item`
--

DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `trigger_before_insert_item` BEFORE INSERT ON `item`

 FOR EACH ROW begin

if new.incomeID = 0 or new.incomeID is null then 

set new.incomeID = (select accountID from comp_control_acct_setup where ID > 0 and companyID = new.companyID and accountCode='saleacct'); 

end if;

if new.cogsID = 0 or new.cogsID is null then 

set new.cogsID = (select accountID from comp_control_acct_setup where id>0 and companyID = new.companyID and accountCode = 'saleacct');

end if;



end */;;
DELIMITER ;

--
-- Table structure for table `item_adjustment`
--

CREATE TABLE `item_adjustment` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `locationID` int(11) NOT NULL,
  `formNo` varchar(32) NOT NULL,
  `updateAble` smallint(11) NOT NULL DEFAULT '1',
  `adjustmentDate` date NOT NULL,
  `createdBy` varchar(50) 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 `item_adjustment`
--


--
-- Table structure for table `item_adjustment_detail`
--

CREATE TABLE `item_adjustment_detail` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `adjustmentID` int(11) NOT NULL,
  `itemID` int(11) NOT NULL,
  `lineNo` int(11) NOT NULL,
  `unitOfMeasureID` int(11) NOT NULL,
  `umID` int(11) NOT NULL,
  `qtyOnHand` double NOT NULL COMMENT 'The number of items on the time of Adjustment',
  `counted` double NOT NULL COMMENT 'The actual number of items on the time of adjustment',
  `onDatePrice` double NOT NULL,
  `updateAble` smallint(11) NOT NULL DEFAULT '1',
  `adjustmentDate` date NOT NULL,
  `createdBy` varchar(50) 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 `item_adjustment_detail`
--


--
-- Table structure for table `item_details`
--

CREATE TABLE `item_details` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) DEFAULT NULL,
  `itemID` int(11) DEFAULT NULL,
  `locationID` int(11) DEFAULT NULL,
  `onHandQty` double DEFAULT NULL,
  `umID` 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,
  `is_delete` smallint(6) DEFAULT NULL,
  PRIMARY KEY (`ID`),
  KEY `Index 2` (`companyID`,`acctID`,`locationID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `item_details`
--


--
-- Table structure for table `master`
--

CREATE TABLE `master` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) NOT NULL,
  `description` varchar(128) NOT NULL,
  `updatedby` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `usedBySystem` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `master`
--

INSERT INTO `master` VALUES (1,'Status','status active or inactive',0,'2014-07-17 16:41:14',1),(2,'Shipping Method','',0,'2014-04-23 21:01:05',0),(3,'State','State',0,'2014-07-17 16:41:09',1),(4,'Module','Application module',1,'2014-07-17 16:40:55',1),(5,'Gender','Gender Male or Female',1,'2014-07-17 16:41:01',1),(6,'Bank','List of bank',0,'2014-07-17 17:09:23',1),(7,'Payment Method','List of payment method',0,'2014-04-21 18:24:46',0),(8,'Item Category','List of item category',0,'2014-07-24 23:51:05',1),(9,'Item Type','List of item type - product or service',0,'2014-07-24 23:47:36',1),(10,'Language','Language selection English or Bahasa Malasyia',1,'2014-07-17 16:41:25',1),(11,'Accounting Method','Accounting Closing/Opening method monthly or yearly',0,'2014-08-14 00:53:25',1),(12,'Unit of Measure','Unit of measurement such as kg, feet, meter, cubic',1,'2014-07-17 16:41:31',1),(13,'Account Type','Account type for chart of accounts',0,'2014-08-14 00:53:53',1),(14,'Business Type','Business type based on industry selected',0,'2014-07-17 17:09:15',1),(15,'Industry','List of industry classification - retail, manufacturing, service, others',0,'2014-07-17 16:41:53',1),(16,'Invoice Purchase Code','',1,'2014-07-17 17:07:51',1),(17,'Invoice Sales Code','',1,'2014-07-17 17:07:38',1),(18,'System Form','',1,'2014-07-17 16:53:35',1),(19,'Address','List of address type',0,'2014-08-14 00:54:44',1),(20,'Movement Type','List of inventory movement type',1,'2014-05-27 17:40:05',0),(21,'General Setup','General Setup Parameters',1,'2014-07-17 16:42:24',1),(22,'Waqif','Waqif',0,'2014-07-17 17:38:46',0);

--
-- Table structure for table `master_code`
--

CREATE TABLE `master_code` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `masterID` int(11) NOT NULL,
  `parentFilterID` int(11) DEFAULT NULL,
  `code` varchar(4) NOT NULL,
  `name` varchar(64) NOT NULL,
  `shortName` varchar(8) NOT NULL,
  `description` varchar(128) NOT NULL,
  `orderNo` int(11) NOT NULL,
  `createdBy` int(11) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updateBy` int(11) NOT NULL,
  `updateTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` smallint(6) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=164 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `master_code`
--

INSERT INTO `master_code` VALUES (1,1,NULL,'0','Active','Active','',1,0,'2014-05-07 02:01:04',0,'2014-05-15 02:17:57',0),(2,1,NULL,'1','Inactive','Inactive','',2,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(3,2,NULL,'FR','Freight','Freight','',1,0,'2014-05-07 02:01:04',0,'2014-04-23 21:05:19',0),(4,2,4,'FE','FedEx','FE','farhana',2,0,'2014-05-07 02:01:04',0,'2014-05-14 19:25:38',0),(5,2,NULL,'UPS','UPS','UPS','',3,0,'2014-05-07 02:01:04',0,'2014-08-20 19:08:39',1),(6,2,NULL,'CLNK','CityLink','CLNK','',2,0,'2014-05-07 02:01:04',0,'2014-04-23 21:05:19',0),(8,2,NULL,'DHL','DHL','DHL','',4,0,'2014-05-07 02:01:04',0,'2014-04-23 21:05:19',0),(9,5,NULL,'M','Male','Male','',1,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(10,5,NULL,'F','Female','','',2,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(11,15,NULL,'MFC','Manufacturing','MFC','',1,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(12,15,NULL,'RT','Retail','RT','',2,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(13,15,NULL,'SERV','Service','SERV','',3,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(14,15,NULL,'OTH','Others','OTH','',4,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(15,10,NULL,'ENG','English','ENG','',1,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(16,10,NULL,'BM','Bahasa Malaysia','BM','',2,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(17,11,NULL,'MTH','Monthly','MTH','',0,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(18,11,NULL,'YR','Yearly','YR','',0,0,'2014-05-07 02:01:04',0,'2014-04-21 19:18:53',0),(19,8,NULL,'E','Electrical Appliance','EA','',5,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(20,8,NULL,'S','Stationary','ST','',10,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(21,8,NULL,'I','IT','IT','',15,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(22,9,NULL,'P','Product','Product','Physical product range',1,0,'2014-05-07 02:01:04',0,'2014-05-25 16:33:45',0),(23,9,NULL,'S','Services','Services','Services product range',5,0,'2014-05-07 02:01:04',0,'2014-05-25 16:34:04',1),(30,8,NULL,'F','Furniture','FR','',1,0,'2014-05-07 02:01:04',0,'0000-00-00 00:00:00',0),(31,16,NULL,'1','Purchase Invoice','','',10,0,'2014-05-07 02:01:04',1,'0000-00-00 00:00:00',0),(32,16,NULL,'2','Direct Purchase Invcoice','','',20,0,'2014-05-07 02:01:04',1,'0000-00-00 00:00:00',0),(33,16,NULL,'3','Debit Note','','Purchase Invoice Debit Note (Adjustment)',30,0,'2014-05-07 02:01:04',1,'0000-00-00 00:00:00',0),(34,16,NULL,'4','Credit Note','','Purchase Invoice Credit Note (Adjustment)',40,0,'2014-05-07 02:01:04',1,'0000-00-00 00:00:00',0),(35,17,NULL,'1','Sales Invoice','','',10,0,'2014-05-07 02:01:04',0,'2014-05-06 18:23:53',0),(36,17,NULL,'2','Direct Sales Invcoice','','',20,0,'2014-05-07 02:01:04',0,'2014-05-06 18:23:58',0),(37,17,NULL,'3','Debit Note','','Sales Invoice Debit Note (Adjustment)',30,0,'2014-05-07 02:01:04',0,'2014-05-06 18:24:02',0),(38,17,NULL,'4','Credit Note','','Sales Invoice Credit Note (Adjustment)',40,0,'2014-05-07 02:01:04',0,'2014-05-06 18:24:07',0),(39,18,NULL,'PR','Purchase Request','PR','Purchase Request Form',90,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(40,18,NULL,'PO','Purchase Order','PO','Purchase Order Form',100,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(41,18,NULL,'PI','Purchase Invoice','PURINV','Form Purchase Invoice',110,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(42,18,NULL,'PDN','Purchase Debit Note','PDN','Purchase Debit Note Form',120,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(43,18,NULL,'PCN','Purchase Credit Note','PCN','Purchase Credit Note Form',140,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(44,18,NULL,'PP','Purchase Payment','PP','Purchase Payment Form',150,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(45,18,NULL,'GRN','Good Received Note','PP','Godd Received Note Form',160,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(46,18,NULL,'LT','Inventory Movement','LT','Inventory Movement Form',170,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(47,18,NULL,'SQN','Sales Quotation','SQN','Sales Quotation Form',180,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(48,18,NULL,'SON','Sales Order','SON','Sales Order Form',190,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(49,18,NULL,'SDN','Delivery Order','DO','Delivery Order Form',200,1,'2014-05-07 02:01:25',0,'2014-08-13 20:15:15',0),(50,18,NULL,'INV','Invoice','INV','Invoice Form',210,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(51,18,NULL,'SDN','Sales Debit Note','PDN','Sales Debit Note Form',230,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(52,18,NULL,'SCN','Sales Credit Note','PCN','Sales Credit Note Form',240,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(53,18,NULL,'RP','Receive Payment','RP','Receive Payment Form',250,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(54,18,NULL,'GRN','General Transaction','PP','General Transaction Form',260,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(55,18,NULL,'OPN','Others Payment','OPN','Others Payment Form',270,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(56,18,NULL,'ORI','Others Receive','ORI','Others Receive Form',280,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(57,18,NULL,'SLR','Sales Return','SLR','Sales Return Form',290,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(58,18,NULL,'IA','Item Adjustment','IA','Item Adjustment Form',300,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(59,12,NULL,'KG','Kilogram','','',10,1,'2014-05-09 03:30:04',0,'0000-00-00 00:00:00',0),(60,12,NULL,'G','gram','','',20,1,'2014-05-09 03:30:04',0,'0000-00-00 00:00:00',0),(61,12,NULL,'l','liter','','',30,1,'2014-05-09 03:30:04',0,'0000-00-00 00:00:00',0),(62,12,NULL,'Tonn','tonne','','',40,1,'2014-05-09 03:30:04',0,'0000-00-00 00:00:00',0),(63,12,NULL,'Unit','unit','','',50,1,'2014-05-09 03:30:04',0,'0000-00-00 00:00:00',0),(64,12,NULL,'ml','mili liter','','',60,1,'2014-05-09 03:30:04',0,'0000-00-00 00:00:00',0),(65,12,NULL,'m','meter','','',70,1,'2014-05-09 03:30:04',0,'0000-00-00 00:00:00',0),(66,12,NULL,'cm','centimeter','','',80,1,'2014-05-09 03:30:04',0,'0000-00-00 00:00:00',0),(67,12,NULL,'cc','cubic cm','','',90,1,'2014-05-09 03:30:04',0,'0000-00-00 00:00:00',0),(68,7,NULL,'','Cash','','',10,0,'2014-05-14 00:59:32',0,'2014-07-17 17:19:34',0),(69,7,NULL,'','Cheque','','',20,0,'2014-05-14 00:59:32',0,'2014-07-17 17:19:38',0),(70,0,NULL,'3333','fad','fad','fad',0,0,'2014-05-14 01:12:00',0,'0000-00-00 00:00:00',0),(71,10,NULL,'ARB','Arabic','AR','Bahasa Ar',3,0,'2014-05-14 17:46:45',0,'2014-05-15 18:52:26',0),(72,18,0,'ZK','ZAKAT','sy','desc',7,0,'2014-05-14 17:59:07',0,'2014-06-04 19:51:49',0),(73,2,4,'FE','FedEx','FE','fad',2,0,'2014-05-14 19:03:42',0,'0000-00-00 00:00:00',0),(74,2,0,'FE','FedEx','FE','akmal',2,0,'2014-05-14 19:17:14',0,'2014-05-25 17:27:52',0),(75,19,0,'1','Billing Address','','',10,0,'2014-05-15 20:48:35',0,'2014-05-16 02:51:41',0),(76,19,0,'2','HQ','','Main Addr',10,0,'2014-05-15 20:52:07',0,'0000-00-00 00:00:00',0),(77,19,0,'3','Ship to','','Ship to',30,0,'2014-05-15 20:53:25',0,'0000-00-00 00:00:00',0),(78,20,NULL,'B','Bulk','Bulk','',10,0,'2014-05-27 17:32:05',0,'0000-00-00 00:00:00',0),(79,20,NULL,'S','Small','Small','',20,0,'2014-05-27 17:32:05',0,'0000-00-00 00:00:00',0),(80,21,1,'','retainedEarnings','','Retained Earnings',1,1,'2014-06-03 01:33:20',0,'2014-08-01 01:04:34',0),(81,21,1,'','profitlostYear','','Profit/Loss Year',10,1,'2014-06-03 01:33:20',0,'2014-08-01 01:04:38',0),(82,21,1,'','exchangeVariances','','Exchange Variances Account',20,1,'2014-06-03 01:33:20',0,'2014-08-01 01:04:42',0),(83,21,1,'','bankchargesAccount','','Bank Charges Account',30,1,'2014-06-03 01:33:20',0,'2014-08-01 01:04:47',0),(84,21,2,'','rcvacct','','Receivable Account',40,1,'2014-06-03 01:33:20',0,'2014-08-01 01:05:01',0),(85,21,2,'','saleacct','','Sales Account',50,1,'2014-06-03 01:33:20',0,'2014-08-01 01:05:07',0),(86,21,2,'','saledisacct','','Sales Discount Account',60,1,'2014-06-03 01:33:20',0,'2014-08-01 01:05:11',0),(87,21,2,'','promptpaydisacct','','Prompt Payment Discount Account',70,1,'2014-06-03 01:33:20',0,'2014-08-01 01:05:18',0),(88,21,2,'','commissionexp','','Commission Expense',80,1,'2014-06-03 01:33:20',0,'2014-08-01 01:05:24',0),(89,21,2,'','commisionpay','','Commission Payable',90,1,'2014-06-03 01:33:20',0,'2014-08-01 01:05:31',0),(90,21,2,'','freightcharges','','Freight Charges',100,1,'2014-06-03 01:33:20',0,'2014-08-01 01:05:36',0),(91,21,2,'','exchangediff','','Exchange Difference',110,1,'2014-06-03 01:33:20',0,'2014-08-01 01:05:41',0),(92,21,3,'','payAcct','','Payable Account',120,1,'2014-06-03 01:33:20',0,'2014-08-01 01:05:46',0),(93,21,3,'','payDisc','','Payable Discount',130,1,'2014-06-03 01:33:20',0,'2014-08-01 01:05:49',0),(94,21,NULL,'','invAcct','','Inventory Account',140,1,'2014-06-03 01:33:20',0,'2014-06-24 20:33:21',0),(95,21,NULL,'','cogs','','C.O.G.S Account',150,1,'2014-06-03 01:33:20',0,'2014-06-24 20:33:21',0),(96,21,NULL,'','invAdjAcct','','Inventory Adjustment Account',160,1,'2014-06-03 01:33:20',0,'2014-06-24 20:33:21',0),(97,21,NULL,'','gstInputTax','','GST-Input Tax',170,1,'2014-06-03 01:33:20',0,'2014-06-24 20:33:21',0),(98,21,NULL,'','gstOutTax','','GST-Output Tax',180,1,'2014-06-03 01:33:20',0,'2014-06-24 20:33:21',0),(99,21,NULL,'','susgstInTax','','Suspense-GST Input Tax',190,1,'2014-06-03 01:33:20',0,'2014-06-24 20:33:21',0),(100,21,NULL,'','susgstOuTax','','Suspense-GST Output Tax',200,1,'2014-06-03 01:33:20',0,'2014-06-24 20:33:21',0),(101,21,NULL,'','gstnoclaim','','GST Not Claimable',210,1,'2014-06-03 01:33:20',0,'2014-06-24 20:33:21',0),(102,21,NULL,'','imdutypay','','Import Duty Payable',220,1,'2014-06-03 01:33:20',0,'2014-06-24 20:33:21',0),(103,21,NULL,'','saletaxpay','','Sale Tax Payable',230,1,'2014-06-03 01:33:20',0,'2014-06-24 20:33:21',0),(104,21,NULL,'','servtaxpay','','Service Tax Payable',240,1,'2014-06-03 01:33:20',0,'2014-06-24 20:33:21',0),(105,21,NULL,'','zakat','','Zakat Expenses',250,1,'2014-06-03 01:33:20',0,'2014-06-24 20:33:21',0),(106,21,NULL,'','uninvoiceAP','','Un-invoice AP',165,1,'2014-06-05 19:28:56',0,'2014-07-02 19:48:46',0),(107,21,1,'','bank','','Banking Account',35,0,'2014-06-24 19:25:00',0,'2014-08-01 01:07:23',0),(108,22,NULL,'','Founder(s)','','',10,1,'2014-07-17 17:43:04',0,'2014-07-17 17:43:32',0),(109,22,NULL,'','Owner(s)/Shareholder(s)','','',20,1,'2014-07-17 17:43:04',0,'2014-07-17 17:43:36',0),(110,22,NULL,'','Director(s)','','',30,0,'2014-07-17 17:44:57',0,'0000-00-00 00:00:00',0),(111,22,NULL,'','Other(s)','','',40,0,'2014-07-17 17:44:57',0,'0000-00-00 00:00:00',0),(112,21,NULL,'','wakafAcrual','','Wakaf Accrual',280,1,'2014-08-01 01:20:26',0,'2014-08-04 17:22:20',0),(114,21,NULL,'','zakatPayable','','zakap payable',260,0,'2014-08-03 23:30:14',0,'2014-08-04 17:21:58',0),(115,21,NULL,'','wakafExpense','','wakaf Expenses',270,0,'2014-08-03 23:30:14',0,'2014-08-04 17:22:11',0),(116,22,0,'waki','new waqif','new','new',5,0,'2014-08-10 13:18:10',0,'0000-00-00 00:00:00',0),(117,7,0,'001','Director Fund','DF','',0,0,'2014-08-20 12:57:18',0,'2014-08-20 18:59:13',1),(118,18,NULL,'GT','GST Transaction','GT','GST Transaction Form',310,1,'2014-05-07 02:01:25',0,'0000-00-00 00:00:00',0),(160,18,NULL,'BD','Bad Debt Relief','BD','Bad Debt Relief Form',311,1,'2014-05-06 18:01:25',0,'0000-00-00 00:00:00',0),(161,18,NULL,'BDR','Bad Debt Recover','DR','Bad Debt Recover Form',312,1,'2014-05-06 18:01:25',0,'2015-06-05 01:16:55',0),(162,18,NULL,'SDR','Supplier Bad Debt Recover','SDR','Supplier Bad Debt Recover Form',313,1,'2014-05-06 18:01:25',0,'2015-06-05 01:16:55',0),(163,18,NULL,'SBD','Supplier Bad Debt Relief','SBD','Supplier Bad Debt Relief Form',314,1,'2014-05-06 18:01:25',0,'0000-00-00 00:00:00',0);

--
-- Table structure for table `module`
--

CREATE TABLE `module` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `parentModuleID` int(11) NOT NULL,
  `moduleName` varchar(64) NOT NULL,
  `description` varchar(254) NOT NULL,
  `orderNo` 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 '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `module`
--

INSERT INTO `module` VALUES (1,0,'GL','General Ledger',10,0,'2014-05-01 16:36:58',0,'2014-10-12 19:03:33'),(2,0,'AR','Account Receivables',20,0,'2014-05-01 16:36:58',0,'2014-10-12 19:03:39'),(3,0,'AP','Account Payables',30,0,'2014-05-01 16:36:58',0,'2014-10-12 19:03:54'),(4,0,'IC','Inventory Control',60,0,'2014-05-01 16:36:58',0,'2014-10-12 19:04:24'),(5,0,'SO','Sales Order',40,0,'2014-05-01 16:36:58',0,'2014-10-12 19:04:04'),(6,0,'GST','Goods & Services Tax',70,0,'2014-05-01 16:36:58',0,'2014-10-12 19:04:40'),(7,0,'ZKT','Zakat & Wakaf',80,0,'2014-05-01 16:36:58',0,'2014-10-12 19:05:26'),(8,0,'PUR','Purchasing',50,0,'2014-05-01 16:36:58',0,'2014-10-12 19:04:08'),(9,0,'ADM','Admin',99,0,'2014-05-01 16:36:58',0,'2014-10-12 19:05:36'),(10,0,'STP','Setup',90,0,'2014-05-01 16:36:58',0,'2014-10-12 19:05:39');

--
-- Table structure for table `person`
--

CREATE TABLE `person` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `name` int(11) NOT NULL,
  `position` varchar(64) NOT NULL,
  `employeeCode` varchar(16) NOT NULL,
  `genderID` int(11) NOT NULL,
  `dateOfBirth` date NOT NULL,
  `dateOfJoint` date NOT NULL,
  `remaks` text 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 `person`
--


--
-- Table structure for table `person_contact`
--

CREATE TABLE `person_contact` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `personID` int(11) NOT NULL,
  `companyID` int(11) NOT NULL,
  `contactType` varchar(32) NOT NULL,
  `contact` tinytext 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 `person_contact`
--


--
-- Table structure for table `poke`
--

CREATE TABLE `poke` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `who` int(11) NOT NULL,
  `whom` int(11) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `poke`
--


--
-- Table structure for table `prospect`
--

CREATE TABLE `prospect` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) NOT NULL,
  `email` varchar(64) NOT NULL,
  `login` varchar(32) NOT NULL,
  `paswd` varchar(32) NOT NULL,
  `tel` varchar(16) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `ip` varchar(32) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `prospect`
--


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

CREATE TABLE `supplier` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `supplierName` varchar(128) NOT NULL,
  `supplierCode` varchar(8) NOT NULL,
  `supplierCompanyNo` varchar(32) NOT NULL,
  `line1` varchar(128) NOT NULL,
  `line2` varchar(128) NOT NULL,
  `line3` varchar(128) NOT NULL,
  `city` varchar(128) NOT NULL,
  `supplierPostCode` varchar(8) NOT NULL,
  `supplierStateID` int(11) NOT NULL,
  `supplierCountryID` int(11) NOT NULL,
  `attention` varchar(100) NOT NULL,
  `website` varchar(32) NOT NULL,
  `phoneNumber1` varchar(50) NOT NULL,
  `phoneNumber2` varchar(50) NOT NULL,
  `fax` varchar(50) NOT NULL,
  `generalNote` varchar(255) NOT NULL,
  `gstRegNo` varchar(16) NOT NULL,
  `termsID` int(11) NOT NULL,
  `creditLimit` double NOT NULL,
  `creditLimitAlert` tinyint(1) NOT NULL,
  `linkedAPAccountID` int(11) NOT NULL,
  `createdDate` date NOT NULL,
  `currencyID` int(11) NOT NULL,
  `email` varchar(64) NOT NULL,
  `termstatus` 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 '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` smallint(16) NOT NULL,
  `approvalNo` varchar(32) NOT NULL,
  `commenceDate` date NOT NULL,
  `ceaseDate` date NOT NULL,
  `verifyDate` date NOT NULL,
  PRIMARY KEY (`ID`),
  KEY `ID` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `supplier`
--

DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `trigger_default_created_date` BEFORE INSERT ON `supplier`

 FOR EACH ROW if ( isnull(new.createddate) ) then

 set new.createddate=curdate();

end if */;;
DELIMITER ;

--
-- Table structure for table `supplier_address`
--

CREATE TABLE `supplier_address` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `supplierID` int(11) NOT NULL,
  `addressCode` varchar(50) DEFAULT NULL,
  `addressName` varchar(128) DEFAULT NULL,
  `line1` varchar(128) DEFAULT NULL,
  `line2` varchar(128) DEFAULT NULL,
  `line3` varchar(128) DEFAULT NULL,
  `city` varchar(128) DEFAULT NULL,
  `postCode` varchar(8) DEFAULT NULL,
  `stateID` int(11) DEFAULT NULL,
  `countryID` 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,
  `is_delete` smallint(16) DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `supplier_address`
--


--
-- Table structure for table `supplier_contact`
--

CREATE TABLE `supplier_contact` (
  `ID` int(11) NOT NULL DEFAULT '0',
  `supplierID` int(11) NOT NULL,
  `personID` int(11) NOT NULL,
  `position` varchar(32) NOT NULL,
  `is_delete` smallint(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `supplier_contact`
--


--
-- Table structure for table `tax_class`
--

CREATE TABLE `tax_class` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(10) DEFAULT NULL,
  `shortName` varchar(10) DEFAULT NULL,
  `description` varchar(128) DEFAULT NULL,
  `taxAccount` 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=latin1;

--
-- Dumping data for table `tax_class`
--


--
-- Table structure for table `tax_group`
--

CREATE TABLE `tax_group` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(10) DEFAULT NULL,
  `description` varchar(128) DEFAULT NULL,
  `taxAccount` 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=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `tax_group`
--


--
-- Table structure for table `tax_master`
--

CREATE TABLE `tax_master` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL DEFAULT '0',
  `code` varchar(10) DEFAULT NULL,
  `name` varchar(128) DEFAULT NULL,
  `taxType` int(11) DEFAULT NULL,
  `taxPercentage` double DEFAULT NULL,
  `taxClass` int(11) DEFAULT NULL,
  `taxGroup` int(11) DEFAULT NULL,
  `description` varchar(128) DEFAULT NULL,
  `taxAccount` int(11) DEFAULT NULL,
  `status` tinyint(1) DEFAULT '0',
  `createdBy` int(11) DEFAULT '0',
  `createdTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBy` int(11) DEFAULT NULL,
  `updatedTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`,`companyID`),
  KEY `FK_tax_master_tax_class` (`taxClass`),
  KEY `FK_tax_master_tax_group` (`taxGroup`),
  KEY `FK_tax_master_tax_type` (`taxType`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tax_master`
--


--
-- Table structure for table `tax_type`
--

CREATE TABLE `tax_type` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(10) DEFAULT NULL,
  `taxGroupID` int(11) DEFAULT NULL,
  `description` varchar(128) DEFAULT NULL,
  `taxClass` int(11) NOT NULL,
  `taxAccount` 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=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `tax_type`
--


--
-- Table structure for table `tax_work_footer`
--

CREATE TABLE `tax_work_footer` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `recordID` varchar(1) DEFAULT NULL COMMENT 'Must be a single character corresponding to record type. Must be ‘F’',
  `purchaseCount` int(11) DEFAULT NULL COMMENT 'Number of P records',
  `purchaseAmount` double DEFAULT NULL COMMENT 'Debit Amount',
  `purchaseAmountGST` double DEFAULT NULL COMMENT 'Purchase GST Amount GST',
  `supplyCount` int(11) DEFAULT NULL COMMENT 'Supply Count',
  `supplyAmountSum` double DEFAULT NULL COMMENT 'Sum of all supplies',
  `supplyAmountSumGst` double DEFAULT NULL COMMENT 'Sum of GST on all supplies',
  `ledgerCount` int(11) DEFAULT NULL COMMENT 'Number of L records',
  `debitSum` double DEFAULT NULL COMMENT 'Debit Sum',
  `creditSum` double DEFAULT NULL COMMENT 'Credit Sum',
  `balanceSum` double DEFAULT NULL COMMENT 'Balance Sum',
  `status` smallint(1) 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=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `tax_work_footer`
--


--
-- Table structure for table `tax_work_gl`
--

CREATE TABLE `tax_work_gl` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `recordID` varchar(1) DEFAULT NULL COMMENT 'Must be a single character corresponding to record type.Must be ‘L’',
  `transactionDate` date DEFAULT NULL COMMENT 'Format: dd/MM/yyyy',
  `Account ID` int(11) DEFAULT NULL COMMENT 'General Ledger Code for individual account',
  `Account Name` varchar(3) DEFAULT NULL COMMENT 'Name of individual General Ledger account',
  `description` varchar(128) DEFAULT NULL COMMENT 'Transaction Description',
  `name` varchar(128) DEFAULT NULL COMMENT 'Name of entity involved (if applicable)',
  `journalID` varchar(128) DEFAULT NULL COMMENT 'A unique number that can group related double entries',
  `documentID` varchar(128) DEFAULT NULL COMMENT 'Source document number to which line relates (For example, cheque number, invoice number, credit note number, trust receipt number) ',
  `type` varchar(128) DEFAULT NULL COMMENT 'Refers to type of transaction such as AR. Refers to the type of transaction such as AR, AP, Inventory, Sales, Purchases, Cash Disbursement, Cash Receipt, General Journal etc.',
  `amount_dr` double DEFAULT NULL COMMENT 'Debit Amount',
  `amount_cr` double DEFAULT NULL COMMENT 'Credit amount',
  `Balance` double DEFAULT NULL COMMENT 'Balance Amount',
  `status` smallint(1) DEFAULT NULL,
  `gafID` 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=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `tax_work_gl`
--


--
-- Table structure for table `tax_work_header`
--

CREATE TABLE `tax_work_header` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `recordID` varchar(1) DEFAULT NULL COMMENT 'Must be a single character corresponding to record type. Must be ‘C’',
  `name` varchar(128) DEFAULT NULL COMMENT 'The name of the company for which this file is reporting on.',
  `BRN` varchar(128) DEFAULT NULL COMMENT 'Business registration number for company',
  `gstNo` varchar(128) DEFAULT NULL COMMENT 'Company GST number',
  `periodStart` date DEFAULT NULL COMMENT 'Filing Period Start Date Must be in format dd/MM/yyyy example: 01/12/2014’',
  `periodEnd` date DEFAULT NULL COMMENT 'Filing Period End Date Must be in format dd/MM/yyyy example: 31/12/2014’',
  `version` varchar(128) DEFAULT NULL COMMENT 'Accounting software name and version Example: XYB Accountsoft v.2.0',
  `GAFversion` varchar(128) DEFAULT NULL COMMENT 'GST Audit File (GAF) version number',
  `status` smallint(1) DEFAULT NULL,
  `gafID` smallint(1) 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=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `tax_work_header`
--


--
-- Table structure for table `tax_work_purchase`
--

CREATE TABLE `tax_work_purchase` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `recordID` varchar(1) DEFAULT NULL COMMENT 'Must be a single character corresponding to record type. Must be ‘P’',
  `name` varchar(128) DEFAULT NULL COMMENT 'AN Name for supplier.',
  `BRN` varchar(128) DEFAULT NULL COMMENT 'BRN for company from which purchase was made.',
  `invoiceDate` date DEFAULT NULL COMMENT 'Invoice Date Format dd/MM/yyyy',
  `invoiceNo` varchar(128) DEFAULT NULL COMMENT 'Invoice Number',
  `importDeclare` varchar(128) DEFAULT NULL COMMENT 'Import Declaration Number. (e.g. Customs Form No. 1 reference',
  `invoiceLine` varchar(3) DEFAULT NULL COMMENT 'Number of Invoice Line',
  `description` varchar(128) DEFAULT NULL COMMENT 'Description for what was purchased',
  `amount` double DEFAULT NULL COMMENT 'Value of purchase excluding GST in Malaysia Ringgit.',
  `taxAmount` double DEFAULT NULL COMMENT 'Value of GST in Malaysia Ringgit.',
  `taxID` int(11) DEFAULT NULL,
  `taxCode` varchar(128) DEFAULT NULL COMMENT 'Tax code for lookup in tables. Please refer to Appendix',
  `currencyID` int(11) DEFAULT NULL,
  `currencyCode` varchar(128) DEFAULT NULL COMMENT 'ISO’s currency codes (3-letter alphabetical code) of foreign Currency. Example: USD',
  `currencyAmount` double DEFAULT NULL COMMENT 'Value of purchase excluding GST in Foreign Currency (If applicable).',
  `taxCurrencyAmount` double DEFAULT NULL COMMENT 'Value of GST in Foreign Currency (If applicable)',
  `status` smallint(2) DEFAULT NULL,
  `gafID` 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=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `tax_work_purchase`
--


--
-- Table structure for table `tax_work_sales`
--

CREATE TABLE `tax_work_sales` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `recordID` varchar(1) DEFAULT NULL COMMENT 'Must be a single character corresponding to record type. Must be ‘S’',
  `name` varchar(128) DEFAULT NULL COMMENT 'Name of customer.',
  `BRN` varchar(128) DEFAULT NULL COMMENT 'BRN for supplier.',
  `invoiceDate` date DEFAULT NULL COMMENT 'Invoice Date Format dd/MM/yyyy',
  `invoiceNo` varchar(128) DEFAULT NULL COMMENT 'Invoice Number',
  `invoiceLine` varchar(3) DEFAULT NULL COMMENT 'Number of Invoice Line',
  `description` varchar(128) DEFAULT NULL COMMENT 'Description for what was sold',
  `amount` double DEFAULT NULL COMMENT 'Value of supply excluding GST in Malaysia Ringgit',
  `taxAmount` double DEFAULT NULL COMMENT 'Value of GST in Malaysia Ringgit',
  `taxID` int(11) DEFAULT NULL,
  `taxCode` varchar(128) DEFAULT NULL COMMENT 'Tax code for lookup in tables. Please refer to Appendix 2Example: SR',
  `countryID` int(11) DEFAULT NULL COMMENT 'Destination of goods being exported. Example: KOREA',
  `currencyID` int(11) DEFAULT NULL,
  `currencyCode` varchar(128) DEFAULT NULL COMMENT 'ISO’s currency codes (3-letter alphabetical code) of foreign Currency. Example: USD',
  `currencyAmount` double DEFAULT NULL COMMENT 'Value of purchase excluding GST in Foreign Currency (If applicable).',
  `taxCurrencyAmount` double DEFAULT NULL COMMENT 'Value of GST in Foreign Currency (If applicable)',
  `status` smallint(1) DEFAULT NULL,
  `gafID` 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=latin1 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `tax_work_sales`
--


--
-- Table structure for table `tbl_department`
--

CREATE TABLE `tbl_department` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `code` varchar(18) DEFAULT NULL,
  `description` varchar(100) DEFAULT NULL,
  `dept_head` int(11) DEFAULT NULL,
  `createdBy` int(11) NOT NULL,
  `is_deleted` tinyint(4) NOT NULL,
  `updatedBy` int(11) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `tbl_department`
--


--
-- Table structure for table `tbl_location`
--

CREATE TABLE `tbl_location` (
  `fldid` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `code` varchar(20) DEFAULT NULL,
  `desc` varchar(100) DEFAULT NULL,
  `address` varchar(200) DEFAULT NULL,
  `line2` varchar(128) NOT NULL,
  `line3` varchar(128) NOT NULL,
  `postcode` varchar(10) DEFAULT NULL,
  `city` varchar(50) DEFAULT NULL,
  `state` int(10) DEFAULT NULL,
  `country` int(10) DEFAULT NULL,
  `phone_no` varchar(25) DEFAULT NULL,
  `fax_no` varchar(25) DEFAULT NULL,
  `create_by` varchar(50) DEFAULT NULL,
  `create_date` date DEFAULT NULL,
  PRIMARY KEY (`fldid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_location`
--


--
-- Table structure for table `tbl_section`
--

CREATE TABLE `tbl_section` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `code` varchar(18) DEFAULT NULL,
  `departmentID` int(11) DEFAULT NULL,
  `description` varchar(100) DEFAULT NULL,
  `section_head` int(11) DEFAULT NULL,
  `createdBy` int(11) NOT NULL,
  `updatedBy` int(11) NOT NULL,
  `is_deleted` tinyint(4) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

--
-- Dumping data for table `tbl_section`
--


--
-- Table structure for table `terms`
--

CREATE TABLE `terms` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `termName` varchar(64) NOT NULL,
  `termDescription` varchar(255) NOT NULL,
  `dueDays` int(11) NOT NULL,
  `termStatusID` 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 '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` smallint(16) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `terms`
--


--
-- Table structure for table `trash_comp_journal`
--

CREATE TABLE `trash_comp_journal` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `oldID` int(11) NOT NULL,
  `companyID` int(11) DEFAULT NULL,
  `journalID` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
  `description` varchar(128) CHARACTER SET utf8 DEFAULT NULL,
  `referrence` varchar(128) CHARACTER SET utf8 DEFAULT NULL,
  `batch` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
  `module` int(11) DEFAULT NULL,
  `effective_date` date DEFAULT NULL,
  `entered_date` date DEFAULT NULL,
  `period` smallint(2) DEFAULT NULL,
  `year` year(4) DEFAULT NULL,
  `total_amount_dr` double DEFAULT NULL,
  `total_amount_cr` double DEFAULT NULL,
  `total_amount` double DEFAULT '0',
  `status` tinyint(4) DEFAULT '0' COMMENT 'unposted = 0, posted = 1',
  `remarks` varchar(128) CHARACTER SET utf8 DEFAULT NULL,
  `createdBy` int(11) DEFAULT NULL,
  `createdTS` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `formNo` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
  `is_delete` smallint(16) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `trash_comp_journal`
--


--
-- Table structure for table `trash_comp_journal_detail`
--

CREATE TABLE `trash_comp_journal_detail` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `trashID` int(11) NOT NULL,
  `oldID` int(11) NOT NULL,
  `companyID` int(11) DEFAULT '0',
  `journalID` varchar(50) CHARACTER SET utf8 DEFAULT '0',
  `sequence` int(11) DEFAULT '0',
  `acctCode` int(11) DEFAULT '0',
  `projectID` int(11) DEFAULT '0',
  `description` varchar(200) CHARACTER SET utf8 DEFAULT '0',
  `amount_cr` double DEFAULT '0',
  `amount_dr` double DEFAULT '0',
  `currencyID` int(11) DEFAULT '0',
  `currency_amount` double DEFAULT '0',
  `exchange_rate` double DEFAULT '0',
  `enter_exchange_rate` double DEFAULT '0',
  `period` smallint(2) DEFAULT '0',
  `year` year(4) DEFAULT NULL,
  `formNo` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
  `supplier` varchar(200) CHARACTER SET utf8 DEFAULT NULL,
  `line` int(11) DEFAULT NULL,
  `status` smallint(2) DEFAULT '0',
  `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` smallint(16) NOT NULL,
  `bankReconcileID` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `trash_comp_journal_detail`
--


--
-- Table structure for table `ug_content`
--

CREATE TABLE `ug_content` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `ugID` int(11) NOT NULL,
  `language` varchar(8) NOT NULL,
  `title` varchar(100) NOT NULL,
  `content` text NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `ug_content`
--


--
-- Table structure for table `ug_relatedtopic`
--

CREATE TABLE `ug_relatedtopic` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `ugID` int(11) NOT NULL,
  `relatedUgID` int(11) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `ug_relatedtopic`
--


--
-- Table structure for table `ug_topic`
--

CREATE TABLE `ug_topic` (
  `fldid` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(8) CHARACTER SET utf8 DEFAULT NULL,
  `name` varchar(30) CHARACTER SET utf8 DEFAULT NULL,
  `parents` varchar(8) CHARACTER SET utf8 DEFAULT '0',
  `module` varchar(8) CHARACTER SET utf8 DEFAULT '0',
  `submenu` smallint(1) DEFAULT '0',
  `urls` varchar(100) CHARACTER SET utf8 DEFAULT '0',
  `urls2` varchar(100) CHARACTER SET utf8 DEFAULT '0',
  `access` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
  `seq` int(11) NOT NULL,
  `display` smallint(1) DEFAULT '1',
  `icons` varchar(32) CHARACTER SET utf8 DEFAULT 'i-film',
  `language` varchar(3) CHARACTER SET utf8 DEFAULT 'EN',
  PRIMARY KEY (`fldid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `ug_topic`
--


--
-- Table structure for table `ug_video`
--

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

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


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

CREATE TABLE `user_module_access` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `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,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=13 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-11-24 11:26:34',1,'2015-12-08 11:58:55'),(2,1,1,2,1,1,1,0,1,'2015-11-24 11:26:34',1,'2015-12-08 11:58:55'),(3,1,1,3,1,1,1,0,1,'2015-11-24 11:26:34',1,'2015-12-08 11:58:55'),(4,1,1,4,1,1,1,0,1,'2015-11-24 11:26:34',1,'2015-12-08 11:58:55'),(5,1,1,5,1,1,1,0,1,'2015-11-24 11:26:34',1,'2015-12-08 11:58:55'),(6,1,1,6,1,1,1,0,1,'2015-11-24 11:26:34',1,'2015-12-08 11:58:55'),(7,1,1,7,1,1,1,0,1,'2015-11-24 11:26:34',1,'2015-12-08 11:58:55'),(8,1,1,8,1,1,1,0,1,'2015-11-24 11:26:34',1,'2015-12-08 11:58:55'),(9,1,1,9,1,1,1,0,1,'2015-11-24 11:26:34',1,'2015-12-08 11:57:59'),(10,1,93,10,1,1,1,0,1,'2015-11-24 11:26:34',1,'2015-12-08 11:04:32'),(11,1,1,0,0,0,0,0,1,'2015-11-24 11:26:34',1,'2015-12-08 11:58:55'),(12,7,84,1,1,1,1,0,0,'2015-12-08 10:41:24',0,'2015-12-08 11:00:37');

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

CREATE TABLE `user_module_access_details` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `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 AUTO_INCREMENT=173 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;

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

INSERT INTO `user_module_access_details` VALUES (1,1,1,'ARINVLST',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(2,1,1,'ARDBNLST',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(3,1,1,'ARCDNLST',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(4,1,1,'ARRCVPLS',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(5,1,1,'ARCUSTST',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(6,1,1,'APSUPPAY',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(7,1,1,'APPURDN',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(8,1,1,'APPURCN',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(9,1,1,'APPURDNC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(10,1,1,'APPURCNC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(11,1,1,'APOPWI',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(12,1,1,'APOPWIC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(13,1,1,'APOPWOI',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(14,1,1,'APPURINV',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(15,1,1,'APDIRINV',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(16,1,1,'APCPYPI',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(17,1,1,'APBANKRE',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(18,1,1,'APPAYCFM',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(19,1,1,'APPAYICM',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(20,1,1,'APDRNOTE',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(21,1,1,'GLTRJRNL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(22,1,1,'GLTRJlCY',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(23,1,1,'GLTRJlRV',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(24,1,1,'GLTRPOST',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(25,1,1,'GLRPBS',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(26,1,1,'GLRPTB',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(27,1,1,'GLRPJLPS',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(28,1,1,'GLRPJLUP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(29,1,1,'GLRPTBFC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(30,1,1,'GLRPABSM',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(31,1,1,'GLRPPNLM',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(32,1,1,'GLRPBGLT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(33,1,1,'GLMCAL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(34,1,1,'GLMCALL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(35,1,1,'GLSTCOA',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(36,1,1,'GLSTBDGT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(37,1,1,'GLSTCURC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(38,1,1,'ARSALINV',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(39,1,1,'ARSDBN',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(40,1,1,'ARDBNC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(41,1,1,'ARSCN',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(42,1,1,'ARSCNC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(43,1,1,'ARRCVP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(44,1,1,'ARRCVPC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(45,1,1,'ARDSLINV',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(46,1,1,'ARDRSINV',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(47,1,1,'ARCPYSI',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(48,1,1,'ARSETCUS',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(49,1,1,'MSTRSUPP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(50,1,1,'APPURDNL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(51,1,1,'APPURCNL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(52,1,1,'APRPTOPW',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(53,1,1,'APRPTSTL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(54,1,1,'APTRETCR',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(55,1,1,'APTRPYIE',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(56,1,1,'UM',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(57,1,1,'UML',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(58,1,1,'MUL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(59,1,1,'LOGRPT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(60,1,1,'UMACCSS',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(61,1,1,'MSCL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(62,1,1,'MSSL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(63,1,1,'MSTRCOMP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(64,1,1,'PROJECT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(65,1,1,'TERM',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(66,1,1,'MSMTRCD',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(67,1,1,'EMP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(68,1,1,'AGENTSTP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(69,1,1,'BNKSETUP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(70,1,1,'ADMMENU',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(71,1,1,'APTRPYOE',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(72,1,1,'INVPLNRP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(73,1,1,'INVVALRP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(74,1,1,'INVSTORP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(75,1,1,'INVOUTRP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(76,1,1,'INVMOVRP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(77,1,1,'INVLSTRP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(78,1,1,'IVSTCKCS',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(79,1,1,'LTL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(80,1,1,'ICAA',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(81,1,1,'MSLM',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(82,1,1,'ITEMCAT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(83,1,1,'ITEMTYP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(84,1,1,'ITEMSET',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(85,1,1,'INVUM',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(86,1,1,'INVUMCOV',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(87,1,1,'INUMCVLS',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(88,1,1,'ICSTIDTL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(89,1,1,'ARNWCUST',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(90,1,1,'ARSHIP2L',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(91,1,1,'ARSHIP2N',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(92,1,1,'ADMBNKMS',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(93,1,1,'ARTRINED',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(94,1,1,'AREDSLDR',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(95,1,1,'AREDCR',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(96,1,1,'ARPAYEDT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(97,1,1,'PURORDER',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(98,1,1,'PURRCV',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(99,1,1,'PURORDCF',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(100,1,1,'PURRCVC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(101,1,1,'GSPRJNW',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(102,1,1,'ZKTSTGRP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(103,1,1,'ZKTSTNSB',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(104,1,1,'ZKTSTNSD',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(105,1,1,'ZKSTCNTR',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(106,1,1,'WKSTMSTR',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(107,1,1,'WCQCNTR',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(108,1,1,'APNEWSUP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(109,1,1,'APNWSHP2',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(110,1,1,'GLTRYECL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(111,1,1,'INVLOCTR',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(112,1,1,'INVSALEP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(113,1,1,'INVPURPR',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(114,1,1,'INVITEMC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(115,1,1,'INVLOCTC',0,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(116,1,1,'INVITCC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(117,1,1,'INVSALC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(118,1,1,'INVPURCC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(119,1,1,'ItemDetR',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(120,1,1,'INEDITEM',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(121,1,1,'INNWITEM',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(122,1,1,'PURSTSPL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(123,1,1,'PURSTUM',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(124,1,1,'PURSTUMC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(125,1,1,'UMCONVNW',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(126,1,1,'SOSTSLPC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(127,1,1,'PURORLST',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(128,1,1,'PURRCVLS',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(129,1,1,'PUROUTGR',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(130,1,1,'PUPRRPT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(131,1,1,'TERMNEW',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(132,1,1,'APDRINVC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(133,1,1,'SOQUOT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(134,1,1,'SOTRNWSO',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(135,1,1,'SOTRDO',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(136,1,1,'DELCNFRM',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(137,1,1,'ZKTTRCAL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(138,1,1,'WKFCAL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(139,1,1,'ZKTRGPLT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(140,1,1,'ZKRPCTRL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(141,1,1,'ZKRPNBLT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(142,1,1,'ZKRPSMLT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(143,1,1,'WKFLST',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(144,1,1,'WCQCTRNW',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(145,1,1,'TXTRPROC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(146,1,1,'GST03',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(147,1,1,'gstrpt',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(148,1,1,'null',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(149,1,1,'GSTMSTR',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(150,1,1,'GSTTYPE',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(151,1,1,'GSTGROUP',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(152,1,1,'SOTRQOLT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(153,1,1,'SORPPCLT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(154,1,1,'SOTRDOLT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(155,1,1,'SOTRSOLT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(156,1,1,'SORPSOCU',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(157,1,1,'SORPYRSL',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(158,1,1,'SORPSLIT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(159,1,1,'SORPORCT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(160,1,1,'SORPSOIT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(161,1,1,'SORPOROT',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(162,1,1,'ARCUSTAG',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(163,1,1,'GSTCLASS',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(164,1,1,'TAXMSNW',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(165,1,1,'SOSLSPRC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(166,1,1,'ARCASH',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(167,1,1,'ARCASHSC',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(168,1,1,'OTRPAY',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(169,1,1,'OTHRCV',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(170,1,1,'OTRCVCON',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(171,1,1,'ARCSHS',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34'),(172,1,1,'OTRCVLST',1,1,'2015-11-24 11:26:34',1,'2015-11-24 11:26:34');

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

/*!50001 DROP VIEW IF EXISTS `view_account_balance`*/;
/*!50001 CREATE TABLE `view_account_balance` (
  `companyID` tinyint NOT NULL,
  `acctID` tinyint NOT NULL,
  `acctName` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `period` tinyint NOT NULL,
  `closing` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_ar_inventory`*/;
/*!50001 CREATE TABLE `view_ar_inventory` (
  `companyID` tinyint NOT NULL,
  `customerID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `salesinvoiceDate` tinyint NOT NULL,
  `totalReceivable` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_ar_open_position`*/;
/*!50001 CREATE TABLE `view_ar_open_position` (
  `companyID` tinyint NOT NULL,
  `customerID` tinyint NOT NULL,
  `customerName` tinyint NOT NULL,
  `phoneNumber1` tinyint NOT NULL,
  `email` tinyint NOT NULL,
  `due120` tinyint NOT NULL,
  `due90` tinyint NOT NULL,
  `due60` tinyint NOT NULL,
  `due30` tinyint NOT NULL,
  `due0` tinyint NOT NULL,
  `pastDue30` tinyint NOT NULL,
  `pastDue60` tinyint NOT NULL,
  `pastDue90` tinyint NOT NULL,
  `pastDue120` tinyint NOT NULL,
  `pastDue` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_asset_report`
--

/*!50001 DROP VIEW IF EXISTS `view_asset_report`*/;
/*!50001 CREATE TABLE `view_asset_report` (
  `acctID` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `acctGroupID` tinyint NOT NULL,
  `acctCode` tinyint NOT NULL,
  `acctName` tinyint NOT NULL,
  `openingBalanceDr` tinyint NOT NULL,
  `openingBalanceCr` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `balanceAsset` tinyint NOT NULL,
  `january` tinyint NOT NULL,
  `february` tinyint NOT NULL,
  `march` tinyint NOT NULL,
  `april` tinyint NOT NULL,
  `may` tinyint NOT NULL,
  `june` tinyint NOT NULL,
  `july` tinyint NOT NULL,
  `august` tinyint NOT NULL,
  `september` tinyint NOT NULL,
  `october` tinyint NOT NULL,
  `november` tinyint NOT NULL,
  `december` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_balance_sheet`*/;
/*!50001 CREATE TABLE `view_balance_sheet` (
  `acctCode` tinyint NOT NULL,
  `acctName` tinyint NOT NULL,
  `acctGroupID` tinyint NOT NULL,
  `currentyeardebit` tinyint NOT NULL,
  `currentyearcredit` tinyint NOT NULL,
  `lastyeardebit` tinyint NOT NULL,
  `lastyearcredit` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_bank_reconcile`*/;
/*!50001 CREATE TABLE `view_bank_reconcile` (
  `ID` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `tableName` tinyint NOT NULL,
  `bankID` tinyint NOT NULL,
  `referenceNo` tinyint NOT NULL,
  `transDate` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `description` tinyint NOT NULL,
  `debitAmount` tinyint NOT NULL,
  `creditAmount` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_bank_reconcile_reverse`*/;
/*!50001 CREATE TABLE `view_bank_reconcile_reverse` (
  `bankReconcileID` tinyint NOT NULL,
  `ID` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `tableName` tinyint NOT NULL,
  `bankID` tinyint NOT NULL,
  `referenceNo` tinyint NOT NULL,
  `transDate` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `description` tinyint NOT NULL,
  `debitAmount` tinyint NOT NULL,
  `creditAmount` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_chart_of_acct_updateable`*/;
/*!50001 CREATE TABLE `view_chart_of_acct_updateable` (
  `ID` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `acctGroupID` tinyint NOT NULL,
  `acctCode` tinyint NOT NULL,
  `acctName` tinyint NOT NULL,
  `acctDesc` tinyint NOT NULL,
  `updateable` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_comp_acc_det`*/;
/*!50001 CREATE TABLE `view_comp_acc_det` (
  `ID` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `acctGroupID` tinyint NOT NULL,
  `acctID` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `period` tinyint NOT NULL,
  `amountdr` tinyint NOT NULL,
  `amountcr` tinyint NOT NULL,
  `total` tinyint NOT NULL,
  `createdBy` tinyint NOT NULL,
  `createdTS` tinyint NOT NULL,
  `updatedBy` tinyint NOT NULL,
  `updatedTS` tinyint NOT NULL,
  `is_delete` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_customer_aging`*/;
/*!50001 CREATE TABLE `view_customer_aging` (
  `companyID` tinyint NOT NULL,
  `customerID` tinyint NOT NULL,
  `customerName` tinyint NOT NULL,
  `phoneNumber1` tinyint NOT NULL,
  `email` tinyint NOT NULL,
  `current` tinyint NOT NULL,
  `month1` tinyint NOT NULL,
  `month2` tinyint NOT NULL,
  `month3` tinyint NOT NULL,
  `month4` tinyint NOT NULL,
  `month5` tinyint NOT NULL,
  `month6` tinyint NOT NULL,
  `month7` tinyint NOT NULL,
  `month8` tinyint NOT NULL,
  `month9` tinyint NOT NULL,
  `month10` tinyint NOT NULL,
  `month11` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_customer_statement`*/;
/*!50001 CREATE TABLE `view_customer_statement` (
  `ID` tinyint NOT NULL,
  `parent` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `customerID` tinyint NOT NULL,
  `transType` tinyint NOT NULL,
  `transDate` tinyint NOT NULL,
  `refNo` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `dr` tinyint NOT NULL,
  `cr` tinyint NOT NULL,
  `seq` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_expence_and_income`*/;
/*!50001 CREATE TABLE `view_expence_and_income` (
  `companyid` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `period` tinyint NOT NULL,
  `groupID` tinyint NOT NULL,
  `acctType` tinyint NOT NULL,
  `totalDr` tinyint NOT NULL,
  `totalCr` tinyint NOT NULL,
  `balance` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_gaf`*/;
/*!50001 CREATE TABLE `view_gaf` (
  `companyID` tinyint NOT NULL,
  `col1` tinyint NOT NULL,
  `col2` tinyint NOT NULL,
  `col3` tinyint NOT NULL,
  `col4` tinyint NOT NULL,
  `col5` tinyint NOT NULL,
  `col6` tinyint NOT NULL,
  `col7` tinyint NOT NULL,
  `col8` tinyint NOT NULL,
  `col9` tinyint NOT NULL,
  `col10` tinyint NOT NULL,
  `col11` tinyint NOT NULL,
  `col12` tinyint NOT NULL,
  `col13` tinyint NOT NULL,
  `col14` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_grn_report`*/;
/*!50001 CREATE TABLE `view_grn_report` (
  `companyID` tinyint NOT NULL,
  `unitMesure` tinyint NOT NULL,
  `ID` tinyint NOT NULL,
  `itemCode` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `poNo` tinyint NOT NULL,
  `PoDate` tinyint NOT NULL,
  `unitPrice` tinyint NOT NULL,
  `quantityOrder` tinyint NOT NULL,
  `total` tinyint NOT NULL,
  `totalRcv` tinyint NOT NULL,
  `QtyLeft` tinyint NOT NULL,
  `itemID` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_gst_03_summary`
--

/*!50001 DROP VIEW IF EXISTS `view_gst_03_summary`*/;
/*!50001 CREATE TABLE `view_gst_03_summary` (
  `companyID` tinyint NOT NULL,
  `financialYear` tinyint NOT NULL,
  `period` tinyint NOT NULL,
  `totalA1` tinyint NOT NULL,
  `totalA2` tinyint NOT NULL,
  `totalB5a` tinyint NOT NULL,
  `totalB5b` tinyint NOT NULL,
  `totalB6a` tinyint NOT NULL,
  `totalB6b` tinyint NOT NULL,
  `totalB7` tinyint NOT NULL,
  `totalB8` tinyint NOT NULL,
  `totalC10` tinyint NOT NULL,
  `totalC11` tinyint NOT NULL,
  `totalC12` tinyint NOT NULL,
  `totalC13` tinyint NOT NULL,
  `totalC14` tinyint NOT NULL,
  `totalC15` tinyint NOT NULL,
  `totalC16` tinyint NOT NULL,
  `totalC17` tinyint NOT NULL,
  `totalMonth6` tinyint NOT NULL,
  `totalC18` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_gst_report`*/;
/*!50001 CREATE TABLE `view_gst_report` (
  `companyid` tinyint NOT NULL,
  `gstRegisteredDate` tinyint NOT NULL,
  `taxablePeriod` tinyint NOT NULL,
  `financialYear` tinyint NOT NULL,
  `startDate` tinyint NOT NULL,
  `endDate` tinyint NOT NULL,
  `period` tinyint NOT NULL,
  `A1` tinyint NOT NULL,
  `A2` tinyint NOT NULL,
  `B5a` tinyint NOT NULL,
  `B5b` tinyint NOT NULL,
  `B6a` tinyint NOT NULL,
  `B6b` tinyint NOT NULL,
  `B7` tinyint NOT NULL,
  `B8` tinyint NOT NULL,
  `C10` tinyint NOT NULL,
  `C11` tinyint NOT NULL,
  `C12` tinyint NOT NULL,
  `C13` tinyint NOT NULL,
  `C14` tinyint NOT NULL,
  `C15` tinyint NOT NULL,
  `C16` tinyint NOT NULL,
  `C17` tinyint NOT NULL,
  `month6` tinyint NOT NULL,
  `C18` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_gst_rpt_summary`
--

/*!50001 DROP VIEW IF EXISTS `view_gst_rpt_summary`*/;
/*!50001 CREATE TABLE `view_gst_rpt_summary` (
  `companyID` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `month` tinyint NOT NULL,
  `taxID` tinyint NOT NULL,
  `gst` tinyint NOT NULL,
  `amtExTax` tinyint NOT NULL,
  `amtTax` tinyint NOT NULL,
  `amtIncTax` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_gst_tax`*/;
/*!50001 CREATE TABLE `view_gst_tax` (
  `lineNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `taxClass` tinyint NOT NULL,
  `taxClassName` tinyint NOT NULL,
  `taxGroup` tinyint NOT NULL,
  `taxGroupName` tinyint NOT NULL,
  `taxType` tinyint NOT NULL,
  `taxTypeName` tinyint NOT NULL,
  `transType` tinyint NOT NULL,
  `ref` tinyint NOT NULL,
  `transDate` tinyint NOT NULL,
  `customerID` tinyint NOT NULL,
  `customerName` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `amountExcludedTax` tinyint NOT NULL,
  `taxRate` tinyint NOT NULL,
  `taxAmount` tinyint NOT NULL,
  `amountIncludedTax` tinyint NOT NULL,
  `taxID` tinyint NOT NULL,
  `gst` tinyint NOT NULL,
  `journalID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_inventory_statement`*/;
/*!50001 CREATE TABLE `view_inventory_statement` (
  `companyID` tinyint NOT NULL,
  `transactionDate` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `supplierCustomer` tinyint NOT NULL,
  `transactionCode` tinyint NOT NULL,
  `transactionType` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `locationID` tinyint NOT NULL,
  `location` tinyint NOT NULL,
  `unitOfMeasure` tinyint NOT NULL,
  `quantityIn` tinyint NOT NULL,
  `quantityOut` tinyint NOT NULL,
  `updateable` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_inventory_transaction`*/;
/*!50001 CREATE TABLE `view_inventory_transaction` (
  `indexing` tinyint NOT NULL,
  `ID` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `locationID` tinyint NOT NULL,
  `createdTS` tinyint NOT NULL,
  `supplierName` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `transDate` tinyint NOT NULL,
  `um` tinyint NOT NULL,
  `transType` tinyint NOT NULL,
  `qtyIn` tinyint NOT NULL,
  `qtyOut` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_inventorylist_subtotal`*/;
/*!50001 CREATE TABLE `view_inventorylist_subtotal` (
  `companyid` tinyint NOT NULL,
  `quantity` tinyint NOT NULL,
  `locationid` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `category` tinyint NOT NULL,
  `description` tinyint NOT NULL,
  `stockValue` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_item_details`*/;
/*!50001 CREATE TABLE `view_item_details` (
  `companyid` tinyint NOT NULL,
  `itemid` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `description` tinyint NOT NULL,
  `locationid` tinyint NOT NULL,
  `onHandQty` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `acctID` tinyint NOT NULL,
  `location` tinyint NOT NULL,
  `unitOfMeasure` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_item_quantityonhand`*/;
/*!50001 CREATE TABLE `view_item_quantityonhand` (
  `companyID` tinyint NOT NULL,
  `locationID` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `itemCode` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `quantityOnHand` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_item_quantityonhand_confirm`*/;
/*!50001 CREATE TABLE `view_item_quantityonhand_confirm` (
  `companyID` tinyint NOT NULL,
  `locationID` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `itemCode` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `quantityOnHand` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_journal_table`*/;
/*!50001 CREATE TABLE `view_journal_table` (
  `ID` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `referenceNo` tinyint NOT NULL,
  `tableName` tinyint NOT NULL,
  `journalID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_loan_report`
--

/*!50001 DROP VIEW IF EXISTS `view_loan_report`*/;
/*!50001 CREATE TABLE `view_loan_report` (
  `acctID` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `acctGroupID` tinyint NOT NULL,
  `acctCode` tinyint NOT NULL,
  `acctName` tinyint NOT NULL,
  `openingBalanceCr` tinyint NOT NULL,
  `balanceLoan` tinyint NOT NULL,
  `newloan` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `january` tinyint NOT NULL,
  `february` tinyint NOT NULL,
  `march` tinyint NOT NULL,
  `april` tinyint NOT NULL,
  `may` tinyint NOT NULL,
  `june` tinyint NOT NULL,
  `july` tinyint NOT NULL,
  `august` tinyint NOT NULL,
  `september` tinyint NOT NULL,
  `october` tinyint NOT NULL,
  `november` tinyint NOT NULL,
  `december` tinyint NOT NULL,
  `lastPaymentDate` tinyint NOT NULL,
  `lastPaymentAmount` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_open_ar_invoice`*/;
/*!50001 CREATE TABLE `view_open_ar_invoice` (
  `companyID` tinyint NOT NULL,
  `salesInvoiceDate` tinyint NOT NULL,
  `salesYear` tinyint NOT NULL,
  `salesMonth` tinyint NOT NULL,
  `slsMonth` tinyint NOT NULL,
  `totalAmount` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_salescreditnote`*/;
/*!50001 CREATE TABLE `view_salescreditnote` (
  `invoiceDetailID` tinyint NOT NULL,
  `unitOfMeasure` tinyint NOT NULL,
  `ID` tinyint NOT NULL,
  `invoiceID` tinyint NOT NULL,
  `doID` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `quantity` tinyint NOT NULL,
  `unitPrice` tinyint NOT NULL,
  `amountExcludedTax` tinyint NOT NULL,
  `taxID` tinyint NOT NULL,
  `taxRate` tinyint NOT NULL,
  `taxAmount` tinyint NOT NULL,
  `amountIncludedTax` tinyint NOT NULL,
  `accountID` tinyint NOT NULL,
  `createdBy` tinyint NOT NULL,
  `createdTS` tinyint NOT NULL,
  `updatedBy` tinyint NOT NULL,
  `updatedTS` tinyint NOT NULL,
  `code` tinyint NOT NULL,
  `itemCode` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `description` tinyint NOT NULL,
  `exactQty` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_salesdebitnote`*/;
/*!50001 CREATE TABLE `view_salesdebitnote` (
  `invoiceDetailID` tinyint NOT NULL,
  `unitOfMeasure` tinyint NOT NULL,
  `ID` tinyint NOT NULL,
  `invoiceID` tinyint NOT NULL,
  `doID` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `quantity` tinyint NOT NULL,
  `unitPrice` tinyint NOT NULL,
  `amountExcludedTax` tinyint NOT NULL,
  `taxID` tinyint NOT NULL,
  `taxRate` tinyint NOT NULL,
  `taxAmount` tinyint NOT NULL,
  `amountIncludedTax` tinyint NOT NULL,
  `accountID` tinyint NOT NULL,
  `createdBy` tinyint NOT NULL,
  `createdTS` tinyint NOT NULL,
  `updatedBy` tinyint NOT NULL,
  `updatedTS` tinyint NOT NULL,
  `code` tinyint NOT NULL,
  `itemCode` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `description` tinyint NOT NULL,
  `exactQty` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_search`*/;
/*!50001 CREATE TABLE `view_search` (
  `ID` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `searchLink` tinyint NOT NULL,
  `searchKey` tinyint NOT NULL,
  `transDate` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_cash_sales`*/;
/*!50001 CREATE TABLE `view_serial_comp_cash_sales` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_delivery_order`*/;
/*!50001 CREATE TABLE `view_serial_comp_delivery_order` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_gst_transaction`*/;
/*!50001 CREATE TABLE `view_serial_comp_gst_transaction` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_historical_customer_invoice`*/;
/*!50001 CREATE TABLE `view_serial_comp_historical_customer_invoice` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_historical_supplier_invoice`*/;
/*!50001 CREATE TABLE `view_serial_comp_historical_supplier_invoice` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_location_transfer`*/;
/*!50001 CREATE TABLE `view_serial_comp_location_transfer` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_payment`*/;
/*!50001 CREATE TABLE `view_serial_comp_payment` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_payment_others`*/;
/*!50001 CREATE TABLE `view_serial_comp_payment_others` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_purchase_order`*/;
/*!50001 CREATE TABLE `view_serial_comp_purchase_order` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_quotation`*/;
/*!50001 CREATE TABLE `view_serial_comp_quotation` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_receive_item`*/;
/*!50001 CREATE TABLE `view_serial_comp_receive_item` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_receive_payment`*/;
/*!50001 CREATE TABLE `view_serial_comp_receive_payment` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_receive_payment_others`*/;
/*!50001 CREATE TABLE `view_serial_comp_receive_payment_others` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_creditnote`*/;
/*!50001 CREATE TABLE `view_serial_comp_sales_creditnote` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_debitnote`*/;
/*!50001 CREATE TABLE `view_serial_comp_sales_debitnote` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_invoice`*/;
/*!50001 CREATE TABLE `view_serial_comp_sales_invoice` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_order`*/;
/*!50001 CREATE TABLE `view_serial_comp_sales_order` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_supplier_creditnote`*/;
/*!50001 CREATE TABLE `view_serial_comp_supplier_creditnote` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_supplier_debitnote`*/;
/*!50001 CREATE TABLE `view_serial_comp_supplier_debitnote` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_serial_comp_supplier_invoice`*/;
/*!50001 CREATE TABLE `view_serial_comp_supplier_invoice` (
  `companyID` tinyint NOT NULL,
  `nextSerialNo` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_sme_cash_flow`
--

/*!50001 DROP VIEW IF EXISTS `view_sme_cash_flow`*/;
/*!50001 CREATE TABLE `view_sme_cash_flow` (
  `companyID` tinyint NOT NULL,
  `acctGroupID` tinyint NOT NULL,
  `acctCode` tinyint NOT NULL,
  `acctName` tinyint NOT NULL,
  `openingBalanceDr` tinyint NOT NULL,
  `openingBalanceCr` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `january` tinyint NOT NULL,
  `february` tinyint NOT NULL,
  `march` tinyint NOT NULL,
  `april` tinyint NOT NULL,
  `may` tinyint NOT NULL,
  `june` tinyint NOT NULL,
  `july` tinyint NOT NULL,
  `august` tinyint NOT NULL,
  `september` tinyint NOT NULL,
  `october` tinyint NOT NULL,
  `november` tinyint NOT NULL,
  `december` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_supplier_aging`*/;
/*!50001 CREATE TABLE `view_supplier_aging` (
  `companyID` tinyint NOT NULL,
  `supplierID` tinyint NOT NULL,
  `current` tinyint NOT NULL,
  `month1` tinyint NOT NULL,
  `month2` tinyint NOT NULL,
  `month3` tinyint NOT NULL,
  `month4` tinyint NOT NULL,
  `month5` tinyint NOT NULL,
  `month6` tinyint NOT NULL,
  `month7` tinyint NOT NULL,
  `month8` tinyint NOT NULL,
  `month9` tinyint NOT NULL,
  `month10` tinyint NOT NULL,
  `month11` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_supplier_statement`*/;
/*!50001 CREATE TABLE `view_supplier_statement` (
  `ID` tinyint NOT NULL,
  `parent` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `supplierID` tinyint NOT NULL,
  `transType` tinyint NOT NULL,
  `transDate` tinyint NOT NULL,
  `refNo` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `dr` tinyint NOT NULL,
  `cr` tinyint NOT NULL,
  `seq` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_suppliercreditnote`*/;
/*!50001 CREATE TABLE `view_suppliercreditnote` (
  `invoiceDetailID` tinyint NOT NULL,
  `invoiceUm` tinyint NOT NULL,
  `ID` tinyint NOT NULL,
  `invoiceID` tinyint NOT NULL,
  `receiveID` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `itemname` tinyint NOT NULL,
  `itemdescription` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `quantity` tinyint NOT NULL,
  `unitPrice` tinyint NOT NULL,
  `amountExcludedTax` tinyint NOT NULL,
  `taxID` tinyint NOT NULL,
  `taxRate` tinyint NOT NULL,
  `taxAmount` tinyint NOT NULL,
  `amountIncludedTax` tinyint NOT NULL,
  `accountID` tinyint NOT NULL,
  `createdBy` tinyint NOT NULL,
  `createdTS` tinyint NOT NULL,
  `updatedBy` tinyint NOT NULL,
  `updatedTS` tinyint NOT NULL,
  `exactQty` tinyint NOT NULL,
  `unitOfMeasure` tinyint NOT NULL,
  `receiveDetailID` tinyint NOT NULL,
  `code` tinyint NOT NULL,
  `itemCode` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `description` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_supplierdebitnote`*/;
/*!50001 CREATE TABLE `view_supplierdebitnote` (
  `invoiceDetailID` tinyint NOT NULL,
  `ID` tinyint NOT NULL,
  `invoiceID` tinyint NOT NULL,
  `receiveID` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `itemname` tinyint NOT NULL,
  `itemdescription` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `quantity` tinyint NOT NULL,
  `unitPrice` tinyint NOT NULL,
  `amountExcludedTax` tinyint NOT NULL,
  `taxID` tinyint NOT NULL,
  `taxRate` tinyint NOT NULL,
  `taxAmount` tinyint NOT NULL,
  `amountIncludedTax` tinyint NOT NULL,
  `accountID` tinyint NOT NULL,
  `createdBy` tinyint NOT NULL,
  `createdTS` tinyint NOT NULL,
  `updatedBy` tinyint NOT NULL,
  `updatedTS` tinyint NOT NULL,
  `unitOfMeasure` tinyint NOT NULL,
  `receiveDetailID` tinyint NOT NULL,
  `code` tinyint NOT NULL,
  `itemCode` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `description` tinyint NOT NULL,
  `exactQty` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_total_comp_sales_creditnote`*/;
/*!50001 CREATE TABLE `view_total_comp_sales_creditnote` (
  `ID` tinyint NOT NULL,
  `totalTaxAmount` tinyint NOT NULL,
  `totalAmount` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_total_comp_sales_debitnote`*/;
/*!50001 CREATE TABLE `view_total_comp_sales_debitnote` (
  `ID` tinyint NOT NULL,
  `totalTaxAmount` tinyint NOT NULL,
  `totalAmount` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_total_comp_sales_invoice`*/;
/*!50001 CREATE TABLE `view_total_comp_sales_invoice` (
  `ID` tinyint NOT NULL,
  `totalTaxAmount` tinyint NOT NULL,
  `totalAmount` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_total_comp_supplier_creditnote`*/;
/*!50001 CREATE TABLE `view_total_comp_supplier_creditnote` (
  `ID` tinyint NOT NULL,
  `totalTaxAmount` tinyint NOT NULL,
  `totalAmount` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_total_comp_supplier_debitnote`*/;
/*!50001 CREATE TABLE `view_total_comp_supplier_debitnote` (
  `ID` tinyint NOT NULL,
  `totalTaxAmount` tinyint NOT NULL,
  `totalAmount` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_total_comp_supplier_invoice`*/;
/*!50001 CREATE TABLE `view_total_comp_supplier_invoice` (
  `ID` tinyint NOT NULL,
  `totalTaxAmount` tinyint NOT NULL,
  `totalAmount` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_total_debitcredit`
--

/*!50001 DROP VIEW IF EXISTS `view_total_debitcredit`*/;
/*!50001 CREATE TABLE `view_total_debitcredit` (
  `ID` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `acctGroupID` tinyint NOT NULL,
  `acctCode` tinyint NOT NULL,
  `acctName` tinyint NOT NULL,
  `openingBalanceDr` tinyint NOT NULL,
  `openingBalanceCr` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `totalDebit` tinyint NOT NULL,
  `totalCredit` tinyint NOT NULL,
  `balance` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_transaction_summary`*/;
/*!50001 CREATE TABLE `view_transaction_summary` (
  `tableName` tinyint NOT NULL,
  `transID` tinyint NOT NULL,
  `companyid` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `Jan` tinyint NOT NULL,
  `Feb` tinyint NOT NULL,
  `Mar` tinyint NOT NULL,
  `Apr` tinyint NOT NULL,
  `may` tinyint NOT NULL,
  `Jun` tinyint NOT NULL,
  `Jul` tinyint NOT NULL,
  `Aug` tinyint NOT NULL,
  `Sept` tinyint NOT NULL,
  `Oct` tinyint NOT NULL,
  `Nov` tinyint NOT NULL,
  `Dec` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_ap_creditnote`*/;
/*!50001 CREATE TABLE `view_unpost_ap_creditnote` (
  `supplier` tinyint NOT NULL,
  `creditnoteID` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `projectID` tinyint NOT NULL,
  `supplierInvoiceID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `supplierID` tinyint NOT NULL,
  `supplierInvoiceNo` tinyint NOT NULL,
  `locationID` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `quantity` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `amountExcludedtax` tinyint NOT NULL,
  `taxid` tinyint NOT NULL,
  `taxamount` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drTaxAccountID` tinyint NOT NULL,
  `crTaxAccountID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_ap_debitnote`*/;
/*!50001 CREATE TABLE `view_unpost_ap_debitnote` (
  `supplier` tinyint NOT NULL,
  `debitnoteID` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `projectID` tinyint NOT NULL,
  `typeID` tinyint NOT NULL,
  `typeDetailID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `supplierID` tinyint NOT NULL,
  `supplierInvoiceNo` tinyint NOT NULL,
  `locationID` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `quantity` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `amountExcludedtax` tinyint NOT NULL,
  `taxid` tinyint NOT NULL,
  `taxamount` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drTaxAccountID` tinyint NOT NULL,
  `crTaxAccountID` tinyint NOT NULL,
  `cogsAcctID` tinyint NOT NULL,
  `inventoriesAcctID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_ap_invoice`*/;
/*!50001 CREATE TABLE `view_unpost_ap_invoice` (
  `supplier` tinyint NOT NULL,
  `invoiceID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `supplierID` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `amountExcludedtax` tinyint NOT NULL,
  `taxid` tinyint NOT NULL,
  `taxamount` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drTaxAccountID` tinyint NOT NULL,
  `crTaxAccountID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_creditnote`*/;
/*!50001 CREATE TABLE `view_unpost_ar_creditnote` (
  `customer` tinyint NOT NULL,
  `salesinvoiceID` tinyint NOT NULL,
  `creditnoteID` tinyint NOT NULL,
  `projectID` tinyint NOT NULL,
  `typeID` tinyint NOT NULL,
  `typeDetailID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `customerID` tinyint NOT NULL,
  `locationID` tinyint NOT NULL,
  `salesInvoiceNo` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `quantity` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `amountExcludedtax` tinyint NOT NULL,
  `taxid` tinyint NOT NULL,
  `taxamount` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drTaxAccountID` tinyint NOT NULL,
  `crTaxAccountID` tinyint NOT NULL,
  `cogsAcctID` tinyint NOT NULL,
  `inventoriesAcctID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_debitnote`*/;
/*!50001 CREATE TABLE `view_unpost_ar_debitnote` (
  `customer` tinyint NOT NULL,
  `salesinvoiceID` tinyint NOT NULL,
  `debitnoteID` tinyint NOT NULL,
  `projectID` tinyint NOT NULL,
  `typeID` tinyint NOT NULL,
  `typeDetailID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `customerID` tinyint NOT NULL,
  `locationID` tinyint NOT NULL,
  `salesInvoiceNo` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `quantity` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `amountExcludedtax` tinyint NOT NULL,
  `taxid` tinyint NOT NULL,
  `taxamount` tinyint NOT NULL,
  `currencyID` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drTaxAccountID` tinyint NOT NULL,
  `crTaxAccountID` tinyint NOT NULL,
  `cogsAcctID` tinyint NOT NULL,
  `inventoriesAcctID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_invoice`*/;
/*!50001 CREATE TABLE `view_unpost_ar_invoice` (
  `projectID` tinyint NOT NULL,
  `customer` tinyint NOT NULL,
  `invoiceID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `customerID` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `amountExcludedtax` tinyint NOT NULL,
  `taxid` tinyint NOT NULL,
  `taxamount` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drTaxAccountID` tinyint NOT NULL,
  `crTaxAccountID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_payment`*/;
/*!50001 CREATE TABLE `view_unpost_ar_payment` (
  `paymentID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `customerID` tinyint NOT NULL,
  `purchaseInvoiceID` tinyint NOT NULL,
  `customerName` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `paymentDetailID` tinyint NOT NULL,
  `item` tinyint NOT NULL,
  `amtPaid_amtAppl` tinyint NOT NULL,
  `discount_bankCharges` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drDiscountAccountID` tinyint NOT NULL,
  `crDiscountAccountID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_cash_purchase`*/;
/*!50001 CREATE TABLE `view_unpost_cash_purchase` (
  `lineNo` tinyint NOT NULL,
  `quantity` tinyint NOT NULL,
  `unitPrice` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `itemdescription` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `locationID` tinyint NOT NULL,
  `othersPaymentID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `supplierID` tinyint NOT NULL,
  `purchaseInvoiceID` tinyint NOT NULL,
  `paymentDetailID` tinyint NOT NULL,
  `supplierInvoiceNo` tinyint NOT NULL,
  `ID` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `amountExcludedTax` tinyint NOT NULL,
  `taxid` tinyint NOT NULL,
  `taxAmount` tinyint NOT NULL,
  `projectID` tinyint NOT NULL,
  `itemTypeID` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drDiscountAccountID` tinyint NOT NULL,
  `crDiscountAccountID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_cash_sale`*/;
/*!50001 CREATE TABLE `view_unpost_cash_sale` (
  `projectID` tinyint NOT NULL,
  `customer` tinyint NOT NULL,
  `invoiceID` tinyint NOT NULL,
  `typeID` tinyint NOT NULL,
  `typeDetailID` tinyint NOT NULL,
  `locationID` tinyint NOT NULL,
  `quantity` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `currencyID` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `amountExcludedtax` tinyint NOT NULL,
  `taxid` tinyint NOT NULL,
  `taxamount` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drTaxAccountID` tinyint NOT NULL,
  `crTaxAccountID` tinyint NOT NULL,
  `cogsAcctID` tinyint NOT NULL,
  `inventoriesAcctID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_do`*/;
/*!50001 CREATE TABLE `view_unpost_do` (
  `deliveryOrderID` tinyint NOT NULL,
  `customerID` tinyint NOT NULL,
  `projectID` tinyint NOT NULL,
  `customer` tinyint NOT NULL,
  `invoiceID` tinyint NOT NULL,
  `typeID` tinyint NOT NULL,
  `typeDetailID` tinyint NOT NULL,
  `locationID` tinyint NOT NULL,
  `quantity` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `amountExcludedtax` tinyint NOT NULL,
  `taxid` tinyint NOT NULL,
  `taxamount` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drTaxAccountID` tinyint NOT NULL,
  `crTaxAccountID` tinyint NOT NULL,
  `cogsAcctID` tinyint NOT NULL,
  `inventoriesAcctID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_gst_transaction`*/;
/*!50001 CREATE TABLE `view_unpost_gst_transaction` (
  `paymentID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `supplierID` tinyint NOT NULL,
  `purchaseInvoiceID` tinyint NOT NULL,
  `supplierName` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `paymentDetailID` tinyint NOT NULL,
  `supplierInvoiceNo` tinyint NOT NULL,
  `item` tinyint NOT NULL,
  `amtPaid_amtAppl` tinyint NOT NULL,
  `discount_bankCharges` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drDiscountAccountID` tinyint NOT NULL,
  `crDiscountAccountID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_other_payment`*/;
/*!50001 CREATE TABLE `view_unpost_other_payment` (
  `othersPaymentID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `supplierID` tinyint NOT NULL,
  `purchaseInvoiceID` tinyint NOT NULL,
  `paymentDetailID` tinyint NOT NULL,
  `supplierInvoiceNo` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `itemdescription` tinyint NOT NULL,
  `amountExcludedtax` tinyint NOT NULL,
  `taxid` tinyint NOT NULL,
  `taxamount` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drTaxAccountID` tinyint NOT NULL,
  `crTaxAccountID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_other_receive`*/;
/*!50001 CREATE TABLE `view_unpost_other_receive` (
  `projectID` tinyint NOT NULL,
  `receiveFrom` tinyint NOT NULL,
  `otherReceiveID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `itemdescription` tinyint NOT NULL,
  `amountExcludedtax` tinyint NOT NULL,
  `taxid` tinyint NOT NULL,
  `taxamount` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drTaxAccountID` tinyint NOT NULL,
  `crTaxAccountID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_payment`*/;
/*!50001 CREATE TABLE `view_unpost_payment` (
  `paymentID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `supplierID` tinyint NOT NULL,
  `purchaseInvoiceID` tinyint NOT NULL,
  `supplierName` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `paymentDetailID` tinyint NOT NULL,
  `supplierInvoiceNo` tinyint NOT NULL,
  `item` tinyint NOT NULL,
  `amtPaid_amtAppl` tinyint NOT NULL,
  `discount_bankCharges` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL,
  `drDiscountAccountID` tinyint NOT NULL,
  `crDiscountAccountID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_unpost_receive_item`*/;
/*!50001 CREATE TABLE `view_unpost_receive_item` (
  `receiveID` tinyint NOT NULL,
  `companyID` tinyint NOT NULL,
  `locationID` tinyint NOT NULL,
  `transactionDate` tinyint NOT NULL,
  `supplierID` tinyint NOT NULL,
  `formNo` tinyint NOT NULL,
  `lineNo` tinyint NOT NULL,
  `itemID` tinyint NOT NULL,
  `itemName` tinyint NOT NULL,
  `exchangeRate` tinyint NOT NULL,
  `unitPrice` tinyint NOT NULL,
  `quantityReceived` tinyint NOT NULL,
  `umID` tinyint NOT NULL,
  `amount` tinyint NOT NULL,
  `drAccountID` tinyint NOT NULL,
  `crAccountID` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_wakaf_accrual`*/;
/*!50001 CREATE TABLE `view_wakaf_accrual` (
  `companyID` tinyint NOT NULL,
  `acctID` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `totalAmount` tinyint NOT NULL
) ENGINE=MyISAM */;

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

/*!50001 DROP VIEW IF EXISTS `view_wakaf_from_profit`*/;
/*!50001 CREATE TABLE `view_wakaf_from_profit` (
  `companyid` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `acctType` tinyint NOT NULL,
  `totalDr` tinyint NOT NULL,
  `totalCr` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- 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 AUTO_INCREMENT,
  `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,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;

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


--
-- 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 AUTO_INCREMENT,
  `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,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;

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


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

CREATE TABLE `zakat_details` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `zakatSummaryID` 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',
  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 TABLE IF EXISTS `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 TABLE IF EXISTS `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 TABLE IF EXISTS `view_ar_open_position`*/;
/*!50001 DROP VIEW IF EXISTS `view_ar_open_position`*/;

--
-- Final view structure for view `view_asset_report`
--

/*!50001 DROP TABLE IF EXISTS `view_asset_report`*/;
/*!50001 DROP VIEW IF EXISTS `view_asset_report`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_asset_report` AS select `a`.`ID` AS `acctID`,`a`.`companyID` AS `companyID`,`a`.`acctGroupID` AS `acctGroupID`,`a`.`acctCode` AS `acctCode`,`a`.`acctName` AS `acctName`,if((year(`a`.`createdTS`) = `c`.`year`),`a`.`openingBalanceDr`,ifnull((select `view_total_debitcredit`.`balance` from `view_total_debitcredit` where ((`view_total_debitcredit`.`ID` = `a`.`ID`) and ((`view_total_debitcredit`.`year` - 1) = `c`.`year`))),0)) AS `openingBalanceDr`,`a`.`openingBalanceCr` AS `openingBalanceCr`,`c`.`year` AS `year`,(if((year(`a`.`createdTS`) = `c`.`year`),`a`.`openingBalanceDr`,ifnull((select `view_total_debitcredit`.`balance` from `view_total_debitcredit` where ((`view_total_debitcredit`.`ID` = `a`.`ID`) and ((`view_total_debitcredit`.`year` - 1) = `c`.`year`))),0)) + ifnull(sum(if((`c`.`formNo` like '%OP-A%'),`c`.`amount_dr`,0)),0)) AS `balanceAsset`,ifnull(sum(if((`c`.`period` = 1),`c`.`amount_dr`,0)),0) AS `january`,ifnull(sum(if((`c`.`period` = 2),`c`.`amount_dr`,0)),0) AS `february`,ifnull(sum(if((`c`.`period` = 3),`c`.`amount_dr`,0)),0) AS `march`,ifnull(sum(if((`c`.`period` = 4),`c`.`amount_dr`,0)),0) AS `april`,ifnull(sum(if((`c`.`period` = 5),`c`.`amount_dr`,0)),0) AS `may`,ifnull(sum(if((`c`.`period` = 6),`c`.`amount_dr`,0)),0) AS `june`,ifnull(sum(if((`c`.`period` = 7),`c`.`amount_dr`,0)),0) AS `july`,ifnull(sum(if((`c`.`period` = 8),`c`.`amount_dr`,0)),0) AS `august`,ifnull(sum(if((`c`.`period` = 9),`c`.`amount_dr`,0)),0) AS `september`,ifnull(sum(if((`c`.`period` = 10),`c`.`amount_dr`,0)),0) AS `october`,ifnull(sum(if((`c`.`period` = 11),`c`.`amount_dr`,0)),0) AS `november`,ifnull(sum(if((`c`.`period` = 12),`c`.`amount_dr`,0)),0) AS `december` from ((`comp_chart_of_acct` `a` left join `comp_journal_detail` `c` on((`a`.`ID` = `c`.`acctCode`))) left join `comp_journal` `b` on(((`b`.`journalID` = `c`.`journalID`) and (`c`.`companyID` = `b`.`companyID`)))) where ((`a`.`is_delete` = 0) and (`b`.`is_delete` = 0) and (`a`.`acctGroupID` = 2)) group by `a`.`companyID`,`a`.`acctGroupID`,`a`.`acctCode`,`a`.`acctName`,`a`.`openingBalanceDr`,`a`.`openingBalanceCr`,`c`.`year` */;

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

/*!50001 DROP TABLE IF EXISTS `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 TABLE IF EXISTS `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_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` join `comp_journal` `b` on((convert(`a`.`journalNo` using utf8) = `b`.`journalID`))) where ((`a`.`bankReconcileID` = 0) and (`b`.`status` = 1)) union select `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 `comp_journal` `c` on((convert(`a`.`journalNo` using utf8) = `c`.`journalID`))) join `customer` `b`) where ((`a`.`bankReconcileID` = 0) and (`a`.`customerID` = `b`.`ID`) and (`c`.`status` = 1)) union select `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` join `comp_journal` `c` on((convert(`a`.`journalNo` using utf8) = `c`.`journalID`))) where ((`a`.`bankReconcileID` = 0) and (`c`.`status` = 1)) union select `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 `comp_journal` `c` on((convert(`a`.`journalNo` using utf8) = `c`.`journalID`))) join `supplier` `b`) where ((`a`.`bankReconcileID` = 0) and (`a`.`supplierID` = `b`.`ID`) and (`c`.`status` = 1)) union select `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` join `comp_journal` `c` on((convert(`a`.`journalNo` using utf8) = `c`.`journalID`))) where ((`a`.`bankReconcileID` = 0) and (`c`.`status` = 1)) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,'comp_journal_detail' AS `tableName`,`b`.`ID` AS `bankID`,`c`.`referrence` 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`))) where ((`a`.`bankReconcileID` = 0) and isnull(`a`.`formNo`) and (`c`.`status` = 1) and (`c`.`module` = 1)) */;

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

/*!50001 DROP TABLE IF EXISTS `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 TABLE IF EXISTS `view_chart_of_acct_updateable`*/;
/*!50001 DROP VIEW IF EXISTS `view_chart_of_acct_updateable`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_comp_acc_det`*/;
/*!50001 DROP VIEW IF EXISTS `view_comp_acc_det`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_customer_aging`*/;
/*!50001 DROP VIEW IF EXISTS `view_customer_aging`*/;

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

/*!50001 DROP TABLE IF EXISTS `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 TABLE IF EXISTS `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 ((`view_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 TABLE IF EXISTS `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 TABLE IF EXISTS `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_03_summary`
--

/*!50001 DROP TABLE IF EXISTS `view_gst_03_summary`*/;
/*!50001 DROP VIEW IF EXISTS `view_gst_03_summary`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_gst_03_summary` AS select `view_gst_report`.`companyid` AS `companyID`,`view_gst_report`.`financialYear` AS `financialYear`,`view_gst_report`.`period` AS `period`,sum(`view_gst_report`.`A1`) AS `totalA1`,sum(`view_gst_report`.`A2`) AS `totalA2`,sum(`view_gst_report`.`B5a`) AS `totalB5a`,sum(`view_gst_report`.`B5b`) AS `totalB5b`,sum(`view_gst_report`.`B6a`) AS `totalB6a`,sum(`view_gst_report`.`B6b`) AS `totalB6b`,sum(`view_gst_report`.`B7`) AS `totalB7`,sum(`view_gst_report`.`B8`) AS `totalB8`,sum(`view_gst_report`.`C10`) AS `totalC10`,sum(`view_gst_report`.`C11`) AS `totalC11`,sum(`view_gst_report`.`C12`) AS `totalC12`,sum(`view_gst_report`.`C13`) AS `totalC13`,sum(`view_gst_report`.`C14`) AS `totalC14`,sum(`view_gst_report`.`C15`) AS `totalC15`,sum(`view_gst_report`.`C16`) AS `totalC16`,sum(`view_gst_report`.`C17`) AS `totalC17`,sum(`view_gst_report`.`month6`) AS `totalMonth6`,sum(`view_gst_report`.`C18`) AS `totalC18` from `view_gst_report` group by `view_gst_report`.`companyid`,`view_gst_report`.`financialYear`,`view_gst_report`.`period` */;

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

/*!50001 DROP TABLE IF EXISTS `view_gst_report`*/;
/*!50001 DROP VIEW IF EXISTS `view_gst_report`*/;

--
-- Final view structure for view `view_gst_rpt_summary`
--

/*!50001 DROP TABLE IF EXISTS `view_gst_rpt_summary`*/;
/*!50001 DROP VIEW IF EXISTS `view_gst_rpt_summary`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_gst_rpt_summary` AS select `view_gst_tax`.`companyID` AS `companyID`,year(`view_gst_tax`.`transDate`) AS `year`,month(`view_gst_tax`.`transDate`) AS `month`,`view_gst_tax`.`taxID` AS `taxID`,`view_gst_tax`.`gst` AS `gst`,sum(`view_gst_tax`.`amountExcludedTax`) AS `amtExTax`,sum(`view_gst_tax`.`taxAmount`) AS `amtTax`,sum(`view_gst_tax`.`amountIncludedTax`) AS `amtIncTax` from `view_gst_tax` group by `view_gst_tax`.`companyID`,year(`view_gst_tax`.`transDate`),month(`view_gst_tax`.`transDate`),`view_gst_tax`.`taxID`,`view_gst_tax`.`gst` */;

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

/*!50001 DROP TABLE IF EXISTS `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 TABLE IF EXISTS `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 TABLE IF EXISTS `view_inventory_transaction`*/;
/*!50001 DROP VIEW IF EXISTS `view_inventory_transaction`*/;

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

/*!50001 DROP TABLE IF EXISTS `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 TABLE IF EXISTS `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 TABLE IF EXISTS `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 TABLE IF EXISTS `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`) and (`b`.`balanceItem` > 0)))) where (`a`.`updateAble` = 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 TABLE IF EXISTS `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_loan_report`
--

/*!50001 DROP TABLE IF EXISTS `view_loan_report`*/;
/*!50001 DROP VIEW IF EXISTS `view_loan_report`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_loan_report` AS select `a`.`ID` AS `acctID`,`a`.`companyID` AS `companyID`,`a`.`acctGroupID` AS `acctGroupID`,`a`.`acctCode` AS `acctCode`,`a`.`acctName` AS `acctName`,if((year(`a`.`createdTS`) = `c`.`year`),`a`.`openingBalanceCr`,ifnull((select `view_total_debitcredit`.`balance` from `view_total_debitcredit` where ((`view_total_debitcredit`.`ID` = `a`.`ID`) and ((`view_total_debitcredit`.`year` - 1) = `c`.`year`))),0)) AS `openingBalanceCr`,((if((year(`a`.`createdTS`) = `c`.`year`),`a`.`openingBalanceCr`,ifnull((select `view_total_debitcredit`.`balance` from `view_total_debitcredit` where ((`view_total_debitcredit`.`ID` = `a`.`ID`) and ((`view_total_debitcredit`.`year` - 1) = `c`.`year`))),0)) + ifnull(sum(if((`c`.`formNo` like '%LR%'),`c`.`amount_cr`,0)),0)) - ifnull(sum(`c`.`amount_dr`),0)) AS `balanceLoan`,ifnull(sum(if((`c`.`formNo` like '%LR%'),`c`.`amount_cr`,0)),0) AS `newloan`,`c`.`year` AS `year`,ifnull(sum(if((`c`.`period` = 1),`c`.`amount_dr`,0)),0) AS `january`,ifnull(sum(if((`c`.`period` = 2),`c`.`amount_dr`,0)),0) AS `february`,ifnull(sum(if((`c`.`period` = 3),`c`.`amount_dr`,0)),0) AS `march`,ifnull(sum(if((`c`.`period` = 4),`c`.`amount_dr`,0)),0) AS `april`,ifnull(sum(if((`c`.`period` = 5),`c`.`amount_dr`,0)),0) AS `may`,ifnull(sum(if((`c`.`period` = 6),`c`.`amount_dr`,0)),0) AS `june`,ifnull(sum(if((`c`.`period` = 7),`c`.`amount_dr`,0)),0) AS `july`,ifnull(sum(if((`c`.`period` = 8),`c`.`amount_dr`,0)),0) AS `august`,ifnull(sum(if((`c`.`period` = 9),`c`.`amount_dr`,0)),0) AS `september`,ifnull(sum(if((`c`.`period` = 10),`c`.`amount_dr`,0)),0) AS `october`,ifnull(sum(if((`c`.`period` = 11),`c`.`amount_dr`,0)),0) AS `november`,ifnull(sum(if((`c`.`period` = 12),`c`.`amount_dr`,0)),0) AS `december`,max(`b`.`effective_date`) AS `lastPaymentDate`,ifnull((select `e`.`amount_dr` from (`comp_journal_detail` `e` join `comp_journal` `s` on((`s`.`journalID` = `e`.`journalID`))) where ((`e`.`acctCode` = `a`.`ID`) and (`e`.`amount_dr` > 0) and (`e`.`formNo` like '%OP-L%')) order by `s`.`effective_date` desc limit 0,1),0) AS `lastPaymentAmount` from (((`comp_chart_of_acct` `a` left join `comp_journal_detail` `c` on((`a`.`ID` = `c`.`acctCode`))) left join `comp_journal` `b` on(((`b`.`journalID` = `c`.`journalID`) and (`c`.`companyID` = `b`.`companyID`) and (`b`.`is_delete` = 0)))) join `view_total_debitcredit` `vt`) where ((`a`.`is_delete` = 0) and (`a`.`acctGroupID` = 4) and (`a`.`ID` = `vt`.`ID`) and (`c`.`year` = `vt`.`year`)) group by `a`.`companyID`,`a`.`acctGroupID`,`a`.`acctCode`,`a`.`acctName`,`a`.`openingBalanceDr`,`a`.`openingBalanceCr`,`c`.`year` */;

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

/*!50001 DROP TABLE IF EXISTS `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 TABLE IF EXISTS `view_salescreditnote`*/;
/*!50001 DROP VIEW IF EXISTS `view_salescreditnote`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_salesdebitnote`*/;
/*!50001 DROP VIEW IF EXISTS `view_salesdebitnote`*/;

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

/*!50001 DROP TABLE IF EXISTS `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`,(case `a`.`formNo` when (`a`.`formNo` like '%OR%') then concat(if((`a`.`updateAble` = 1),'sales/edit_sale/','sales/print_sale/'),`a`.`ID`) when (`a`.`formNo` like '%OP-C%') then concat(if((`a`.`updateAble` = 1),'expenses/addNew/cogs/','expenses/printDetail/'),`a`.`ID`,'/cogs') when (`a`.`formNo` like '%OP-E%') then concat(if((`a`.`updateAble` = 1),'expenses/addNew/expenses/','expenses/printDetail/'),`a`.`ID`,'/operational') when (`a`.`formNo` like '%OP-L%') then concat(if((`a`.`updateAble` = 1),'expenses/addNew/loan/','expenses/printDetail/'),`a`.`ID`,'/loan') when (`a`.`formNo` like '%OP-A%') then concat(if((`a`.`updateAble` = 1),'expenses/addNew/asset/','expenses/printDetail/'),`a`.`ID`,'/asset') when (`a`.`formNo` like '%TT%') then concat(if((`a`.`updateAble` = 1),'transfer/','transfer/print_transfer/'),`a`.`ID`) when (`a`.`formNo` like '%LR%') then concat(if((`a`.`updateAble` = 1),'loanReceive/','loanReceive/print_loanReceive/'),`a`.`ID`) else concat(if((`a`.`updateAble` = 1),'othersPayment/editPayWithoutItem/','othersPayment/otherpaywithoutDetail/'),`a`.`ID`) end) 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`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat('sales/print_sale/',`a`.`ID`) AS `searchLink`,concat('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`.`receivePaymentDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`description`) AS `searchKey`,`a`.`receivePaymentDate` AS `transDate` from (`comp_receive_payment_others` `a` join `comp_receive_payment_others_detail` `b`) where (`a`.`ID` = `b`.`receivePaymentOthersID`) union select `a`.`ID` AS `ID`,`a`.`companyID` AS `companyID`,concat('expenses/printDetail/',`a`.`ID`) AS `searchLink`,concat('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`.`paymentDate`,'%d/%m/%Y') using latin1),'&nbsp<i class="i-play" aria-hidden="true"></i>&nbsp',`b`.`itemdescription`) AS `searchKey`,`a`.`paymentDate` AS `transDate` from (`comp_payment_others` `a` join `comp_payment_others_without_item` `b`) where (`a`.`ID` = `b`.`otherPaymentID`) */;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_cash_sales`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_cash_sales`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_delivery_order`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_delivery_order`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_gst_transaction`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_gst_transaction`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_historical_customer_invoice`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_historical_customer_invoice`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_historical_supplier_invoice`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_historical_supplier_invoice`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_location_transfer`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_location_transfer`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_payment`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_payment`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_payment_others`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_payment_others`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_purchase_order`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_purchase_order`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_quotation`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_quotation`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_receive_item`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_receive_item`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_receive_payment`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_receive_payment`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_receive_payment_others`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_receive_payment_others`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_sales_creditnote`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_creditnote`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_sales_debitnote`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_debitnote`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_sales_invoice`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_invoice`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_sales_order`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_sales_order`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_supplier_creditnote`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_supplier_creditnote`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_supplier_debitnote`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_supplier_debitnote`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_serial_comp_supplier_invoice`*/;
/*!50001 DROP VIEW IF EXISTS `view_serial_comp_supplier_invoice`*/;

--
-- Final view structure for view `view_sme_cash_flow`
--

/*!50001 DROP TABLE IF EXISTS `view_sme_cash_flow`*/;
/*!50001 DROP VIEW IF EXISTS `view_sme_cash_flow`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_sme_cash_flow` AS select `a`.`companyID` AS `companyID`,`a`.`acctGroupID` AS `acctGroupID`,`a`.`acctCode` AS `acctCode`,`a`.`acctName` AS `acctName`,if((year(`a`.`createdTS`) = `c`.`year`),`a`.`openingBalanceDr`,ifnull((select `view_total_debitcredit`.`balance` from `view_total_debitcredit` where ((`view_total_debitcredit`.`ID` = `a`.`ID`) and ((`view_total_debitcredit`.`year` - 1) = `c`.`year`))),0)) AS `openingBalanceDr`,if((year(`a`.`createdTS`) = `c`.`year`),`a`.`openingBalanceCr`,ifnull((select `view_total_debitcredit`.`balance` from `view_total_debitcredit` where ((`view_total_debitcredit`.`ID` = `a`.`ID`) and ((`view_total_debitcredit`.`year` - 1) = `c`.`year`))),0)) AS `openingBalanceCr`,`c`.`year` AS `year`,(ifnull(sum(if((`c`.`period` = 1),`c`.`amount_dr`,0)),0) - ifnull(sum(if(((`c`.`period` = 1) and (`c`.`formNo` like '%TT%')),`c`.`amount_cr`,0)),0)) AS `january`,(ifnull(sum(if((`c`.`period` = 2),`c`.`amount_dr`,0)),0) - ifnull(sum(if(((`c`.`period` = 2) and (`c`.`formNo` like '%TT%')),`c`.`amount_cr`,0)),0)) AS `february`,(ifnull(sum(if((`c`.`period` = 3),`c`.`amount_dr`,0)),0) - ifnull(sum(if(((`c`.`period` = 3) and (`c`.`formNo` like '%TT%')),`c`.`amount_cr`,0)),0)) AS `march`,(ifnull(sum(if((`c`.`period` = 4),`c`.`amount_dr`,0)),0) - ifnull(sum(if(((`c`.`period` = 4) and (`c`.`formNo` like '%TT%')),`c`.`amount_cr`,0)),0)) AS `april`,(ifnull(sum(if((`c`.`period` = 5),`c`.`amount_dr`,0)),0) - ifnull(sum(if(((`c`.`period` = 5) and (`c`.`formNo` like '%TT%')),`c`.`amount_cr`,0)),0)) AS `may`,(ifnull(sum(if((`c`.`period` = 6),`c`.`amount_dr`,0)),0) - ifnull(sum(if(((`c`.`period` = 6) and (`c`.`formNo` like '%TT%')),`c`.`amount_cr`,0)),0)) AS `june`,(ifnull(sum(if((`c`.`period` = 7),`c`.`amount_dr`,0)),0) - ifnull(sum(if(((`c`.`period` = 7) and (`c`.`formNo` like '%TT%')),`c`.`amount_cr`,0)),0)) AS `july`,(ifnull(sum(if((`c`.`period` = 8),`c`.`amount_dr`,0)),0) - ifnull(sum(if(((`c`.`period` = 8) and (`c`.`formNo` like '%TT%')),`c`.`amount_cr`,0)),0)) AS `august`,(ifnull(sum(if((`c`.`period` = 9),`c`.`amount_dr`,0)),0) - ifnull(sum(if(((`c`.`period` = 9) and (`c`.`formNo` like '%TT%')),`c`.`amount_cr`,0)),0)) AS `september`,(ifnull(sum(if((`c`.`period` = 10),`c`.`amount_dr`,0)),0) - ifnull(sum(if(((`c`.`period` = 10) and (`c`.`formNo` like '%TT%')),`c`.`amount_cr`,0)),0)) AS `october`,(ifnull(sum(if((`c`.`period` = 11),`c`.`amount_dr`,0)),0) - ifnull(sum(if(((`c`.`period` = 11) and (`c`.`formNo` like '%TT%')),`c`.`amount_cr`,0)),0)) AS `november`,(ifnull(sum(if((`c`.`period` = 12),`c`.`amount_dr`,0)),0) - ifnull(sum(if(((`c`.`period` = 12) and (`c`.`formNo` like '%TT%')),`c`.`amount_cr`,0)),0)) AS `december` from ((`comp_chart_of_acct` `a` left join `comp_journal_detail` `c` on((`a`.`ID` = `c`.`acctCode`))) left join `comp_journal` `b` on(((`b`.`journalID` = `c`.`journalID`) and (`c`.`companyID` = `b`.`companyID`)))) where ((`a`.`is_delete` = 0) and (`b`.`is_delete` = 0) and (`a`.`acctGroupID` in (2,3,4,8,10))) group by `a`.`companyID`,`a`.`acctGroupID`,`a`.`acctCode`,`a`.`acctName`,`a`.`openingBalanceDr`,`a`.`openingBalanceCr`,`c`.`year` */;

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

/*!50001 DROP TABLE IF EXISTS `view_supplier_aging`*/;
/*!50001 DROP VIEW IF EXISTS `view_supplier_aging`*/;

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

/*!50001 DROP TABLE IF EXISTS `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 TABLE IF EXISTS `view_suppliercreditnote`*/;
/*!50001 DROP VIEW IF EXISTS `view_suppliercreditnote`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_supplierdebitnote`*/;
/*!50001 DROP VIEW IF EXISTS `view_supplierdebitnote`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_total_comp_sales_creditnote`*/;
/*!50001 DROP VIEW IF EXISTS `view_total_comp_sales_creditnote`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_total_comp_sales_debitnote`*/;
/*!50001 DROP VIEW IF EXISTS `view_total_comp_sales_debitnote`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_total_comp_sales_invoice`*/;
/*!50001 DROP VIEW IF EXISTS `view_total_comp_sales_invoice`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_total_comp_supplier_creditnote`*/;
/*!50001 DROP VIEW IF EXISTS `view_total_comp_supplier_creditnote`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_total_comp_supplier_debitnote`*/;
/*!50001 DROP VIEW IF EXISTS `view_total_comp_supplier_debitnote`*/;

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

/*!50001 DROP TABLE IF EXISTS `view_total_comp_supplier_invoice`*/;
/*!50001 DROP VIEW IF EXISTS `view_total_comp_supplier_invoice`*/;

--
-- Final view structure for view `view_total_debitcredit`
--

/*!50001 DROP TABLE IF EXISTS `view_total_debitcredit`*/;
/*!50001 DROP VIEW IF EXISTS `view_total_debitcredit`*/;

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

/*!50001 DROP TABLE IF EXISTS `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 TABLE IF EXISTS `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`,if((`d`.`itemTypeID` = 23),ifnull(`d`.`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` = 'cogs')))),(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 TABLE IF EXISTS `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`,if((`d`.`itemTypeID` = 23),ifnull(`d`.`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` = 'cogs')))),(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 TABLE IF EXISTS `view_unpost_ap_invoice`*/;
/*!50001 DROP VIEW IF EXISTS `view_unpost_ap_invoice`*/;

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

/*!50001 DROP TABLE IF EXISTS `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 TABLE IF EXISTS `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 TABLE IF EXISTS `view_unpost_ar_invoice`*/;
/*!50001 DROP VIEW IF EXISTS `view_unpost_ar_invoice`*/;

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

/*!50001 DROP TABLE IF EXISTS `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)) 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`.`debitnoteID` 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_debitnote` `b` left join `comp_sales_debitnote` `d` on((`d`.`ID` = `b`.`debitnoteID`)))) join `comp_sales_debitnote` `c`) join `customer` `e`) where ((`a`.`customerID` = `e`.`ID`) and (`a`.`ID` = `b`.`paymentID`) and (`c`.`ID` = `b`.`debitnoteID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0)) */;

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

/*!50001 DROP TABLE IF EXISTS `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 TABLE IF EXISTS `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 TABLE IF EXISTS `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) and (`c`.`itemTypeID` <> 23)) */;

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

/*!50001 DROP TABLE IF EXISTS `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 TABLE IF EXISTS `view_unpost_other_payment`*/;
/*!50001 DROP VIEW IF EXISTS `view_unpost_other_payment`*/;

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

/*!50001 DROP TABLE IF EXISTS `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`,`b`.`lineNo` AS `lineNo`,`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 TABLE IF EXISTS `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 TABLE IF EXISTS `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`) and (`c`.`itemTypeID` <> 23)) */;

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

/*!50001 DROP TABLE IF EXISTS `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 TABLE IF EXISTS `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` */;


