-- Table structure for table `_ref_tax_master`
--

CREATE TABLE IF NOT EXISTS `_ref_tax_master` (
  `ID` 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,
  `defaultTaxAccount` varchar(9) 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
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `_ref_tax_master`
--

INSERT INTO `_ref_tax_master` (`ID`, `code`, `name`, `taxType`, `taxPercentage`, `taxClass`, `taxGroup`, `description`, `defaultTaxAccount`, `status`, `createdBy`, `createdTS`, `updatedBy`, `updatedTS`) VALUES
(0, 'TX-CG', 'CAPITAL GOODS ACQUIRED', 11, 6, 1, 1, 'CAPITAL GOODS ACQUIRED', '260010000', 0, 0, '2014-08-19 05:02:45', NULL, '2014-08-19 05:03:18'),
(1, 'SR', 'STANDARD RATED SUPPLIES WITH GST CHARGED', 1, 6, 1, 2, 'STANDARD RATED SUPPLIES WITH GST CHARGED', '330010000', 0, 0, '2014-05-10 23:56:37', NULL, '2014-08-12 07:40:46'),
(2, 'DS', 'DEEMED SUPPLIES', 1, 6, 1, 2, 'DEEMED SUPPLIES', '330010000', 0, 0, '2014-05-10 23:56:37', NULL, '2014-08-12 07:40:46'),
(3, 'ZRL', 'ZERO RATED SUPPLIES-LOCAL', 2, 0, 1, 2, 'ZERO RATED SUPPLIES-LOCAL', NULL, 0, 0, '2014-05-10 23:56:37', NULL, '2014-08-13 08:56:43'),
(4, 'ZRE', 'EXPORTED GOOD SUPPLIES', 3, 0, 1, 2, 'EXPORTED GOOD SUPPLIES', NULL, 0, 0, '2014-05-10 19:02:03', NULL, '2014-08-13 08:56:43'),
(5, 'ES43', 'INCIDENTAL EXEMPT SUPPLIES', 4, 0, 1, 2, 'INCIDENTAL EXEMPT SUPPLIES', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(6, 'ES', 'EXEMPT SUPPLIES UNDER GST', 4, 0, 1, 2, 'EXEMPT SUPPLIES UNDER GST', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(7, 'OS', 'OUT-OF-SCOPE SUPPLIES', 5, 0, 1, 2, 'OUT-OF-SCOPE SUPPLIES', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(8, 'RS', 'RELIEF SUPPLIES UNDER GST', 6, 0, 1, 2, 'RELIEF SUPPLIES UNDER GST', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(9, 'GS', 'DISREGARDED SUPPLIES', 7, 0, 1, 2, 'DISREGARDED SUPPLIES', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(10, 'AJS', 'ANY ADJUSTMENT MADE TO OUTPUT TAX', 8, 6, 1, 2, 'ANY ADJUSTMENT MADE TO OUTPUT TAX', '330010000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-12 07:40:46'),
(11, 'ST-MF', 'SALES TAX FOR GOODS MANUFACTURING ', 9, 10, 2, 2, 'SALES TAX FOR GOODS MANUFACTURING ', '330040000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 11:01:53'),
(12, 'ST', 'SALES TAX FOR GENERAL', 9, 5, 2, 2, 'SALES TAX FOR GENERAL', '330040000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 10:22:57'),
(13, 'SERT', 'SERVICE TAX FOR GENERAL', 10, 6, 2, 2, 'SERVICE TAX FOR GENERAL', '330050000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 10:21:38'),
(14, 'TX', 'PURCHASE WITH GST INCURRED AT 6% AND DIRECTLY ATTRIBUTABLE TO TAXABLE SUPPLIES', 11, 6, 1, 1, 'PURCHASE WITH GST INCURRED AT 6% AND DIRECTLY ATTRIBUTABLE TO TAXABLE SUPPLIES', '260010000', 0, 0, '2014-05-12 01:36:01', NULL, '2015-06-16 07:31:19'),
(15, 'IM', 'GST INCURRED FOR IMPORT OF GOODS', 11, 6, 1, 1, 'GST INCURRED FOR IMPORT OF GOODS', '260010000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-12 07:40:22'),
(16, 'IMS', 'GST INCURRED FOR IMPORT OF SERVICES (REVERSED MECHANISM)', 11, 6, 1, 1, 'GST INCURRED FOR IMPORT OF SERVICES (REVERSED MECHANISM)', '260010000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-12 07:40:22'),
(17, 'IS', 'IMPORTED UNDER SPECIAL SCHEME WITH NO GST INCURRED', 12, 0, 1, 1, 'IMPORTED UNDER SPECIAL SCHEME WITH NO GST INCURRED', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(18, 'BL', 'PURCHASE WITH GST INCURRED BUT NOT CLAIMBLE', 13, 6, 1, 1, 'PURCHASE WITH GST INCURRED BUT NOT CLAIMBLE', '810040000', 0, 0, '2014-05-12 01:36:01', NULL, '2015-06-16 07:41:58'),
(19, 'NR', 'PURCHASE FROM NON GST-REGISTERED SUPPLIER WITH NO GST INCURRED', 14, 0, 1, 1, 'PURCHASE FROM NON GST-REGISTERED SUPPLIER WITH NO GST INCURRED', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(20, 'ZP', 'PURCHASE FROM GST-REGISTERED SUPPLIER WITH NO GST INCURRED', 15, 0, 1, 1, 'PURCHASE FROM GST-REGISTERED SUPPLIER WITH NO GST INCURRED', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(21, 'EP', 'PURCHASE EXEMPTED FROM GST', 16, 0, 1, 1, 'PURCHASE EXEMPTED FROM GST', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(22, 'OP', 'PURCHASE TRANSACTIONS WHICH IS OUT OF THE SCOPE OF GST LEGISLATION', 5, 0, 1, 1, 'PURCHASE TRANSACTIONS WHICH IS OUT OF THE SCOPE', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(23, 'TX-E43', 'GST INCURRED DIRECTLY ATTRIBUTABLE TO INCIDENTAL EXEMPT SUPPLIES', 11, 6, 1, 1, 'GST INCURRED DIRECTLY ATTRIBUTABLE TO INCIDENTAL EXEMPT SUPPLIES', '260010000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-12 07:40:22'),
(24, 'TX-N43', 'GST  INCURRED DIRECTLY ATTRIBUTABLE TO NON-INCIDENTAL EXEMPT SUPPLIES', 11, 6, 1, 1, 'GST  INCURRED DIRECTLY ATTRIBUTABLE TO NON-INCIDENTAL EXEMPT SUPPLIES', '260010000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-12 07:40:22'),
(25, 'TX-RE', 'GST INCURRED THAT IS NOT DIRECTLY ATTRIBUTABLE TO TAXABLE OR EXEMPT SUPPLIES', 11, 6, 1, 1, 'GST INCURRED THAT IS NOT DIRECTLY ATTRIBUTABLE TO TAXABLE OR EXEMPT SUPPLIES', '260010000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-12 07:40:22'),
(26, 'GP', 'PURCHASE TRANSACTION WHICH LEGISLATION', 19, 0, 1, 1, 'PURCHASE TRANSACTION WHICH LEGISLATION', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-19 04:35:41'),
(27, 'AJP', 'ANY ADJUSTMENT MADE TO INPUT TAX', 20, 6, 1, 1, 'ANY ADJUSTMENT MADE TO INPUT TAX', '260010000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-19 04:43:39'),
(28, 'ST-1', 'SALES TAX FOR GOODS MANUFACTURING ', 9, 10, 2, 1, 'SALES TAX FOR GOODS MANUFACTURING ', '810031000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 11:01:05'),
(29, 'ST-2', 'SALES TAX FOR GENERAL', 9, 10, 2, 1, 'SALES TAX FOR GENERAL', '810031000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 11:01:21'),
(30, 'SERT-1', 'SERVICE TAX FOR GENERAL', 10, 6, 2, 1, 'SERVICE TAX FOR GENERAL', '330050000', 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 10:22:12'),
(31, 'IMPD-1', 'IMPORT DUTY FOR CUSTOMS IMPORTED GOODS', 17, 0, 2, 1, 'IMPORT DUTY FOR CUSTOMS IMPORTED GOODS', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(32, 'IMPD-2', 'IMPORT DUTY FOR CUSTOMS OPEN AP', 17, 0, 2, 1, 'IMPORT DUTY FOR CUSTOMS OPEN AP', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(33, 'IMPD-3', 'IMPORT DUTY FOR CUTOMS FRANCHAISE AP', 17, 0, 2, 1, 'IMPORT DUTY FOR CUTOMS FRANCHAISE AP', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43'),
(34, 'EXD', 'EXCISE DUTY CUSTOMS', 18, 0, 2, 1, 'EXCISE DUTY CUSTOMS', NULL, 0, 0, '2014-05-12 01:36:01', NULL, '2014-08-13 08:56:43');

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

--
-- Table structure for table `_ref_zakat_group`
--

CREATE TABLE IF NOT EXISTS `_ref_zakat_group` (
`ID` int(11) NOT NULL,
  `defaultAcctCode` varchar(9) NOT NULL,
  `name` varchar(64) CHARACTER SET utf8 DEFAULT NULL,
  `description` varchar(128) CHARACTER SET utf8 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
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Table structure for table `_sys_menu`
--

CREATE TABLE IF NOT EXISTS `_sys_menu` (
`fldid` int(11) NOT NULL,
  `code` varchar(8) DEFAULT NULL,
  `name` varchar(30) DEFAULT NULL,
  `parents` varchar(8) DEFAULT '0',
  `module` varchar(8) DEFAULT '0',
  `submenu` smallint(1) DEFAULT '0',
  `urls` varchar(100) DEFAULT '0',
  `urls2` varchar(100) DEFAULT '0',
  `access` varchar(100) DEFAULT NULL,
  `seq` int(11) NOT NULL,
  `display` smallint(1) DEFAULT '1',
  `icons` varchar(32) DEFAULT 'i-film',
  `language` varchar(3) DEFAULT 'EN'
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT AUTO_INCREMENT=381 ;

--
-- Dumping data for table `_sys_menu`
--

INSERT INTO `_sys_menu` (`fldid`, `code`, `name`, `parents`, `module`, `submenu`, `urls`, `urls2`, `access`, `seq`, `display`, `icons`, `language`) VALUES
(1, 'DB', 'Dashboard', '0', '0', 0, 'home', 'home', 'ALL', 1, 1, 'icondashboard.png', 'EN'),
(5, 'STP', 'GeneralSetup', '0', '10', 1, '#', '0', 'ALL', 90, 1, 'iconsetup.png', 'EN'),
(6, 'UM', 'UserMaster', '12', '9', 0, 'admin/usermasterlist', '0', 'ALL', 1, 1, 'icon-usermaster.png', 'EN'),
(7, 'UML', 'UserMasterList', '12', '9', 0, 'admin/usermasterlist', '0', 'ALL', 2, 0, 'icon-usermaster.png', 'EN'),
(12, 'ADM', 'Admin', '0', '9', 1, '#', '0', 'ADMIN', 100, 1, 'iconadmin.png', 'EN'),
(14, 'MUL', 'MenuList', '12', '9', 0, 'admin/menumasterlist', '0', 'ALL', 4, 0, 'icon-menulist.png', 'EN'),
(41, 'MSLM', 'LocationMaster', '91', '4', 0, 'ItemSetup/locationlist', '0', 'ALL', 70, 1, 'icon-active.png', 'EN'),
(45, 'GLM', 'GeneralLedger', '0', '1', 1, '#', '0', 'ALL', 10, 1, 'icongeneralledger.png', 'EN'),
(46, 'GLSETUP', 'Setup', '45', '1', 1, '#', '0', 'ALL', 90, 1, 'iconsubsetup.png', 'EN'),
(50, 'PUR', 'Purchasing', '0', '8', 1, '#', '0', 'ALL', 50, 1, 'iconpurchasing.png', 'EN'),
(51, 'PURSETUP', 'Setup', '50', '8', 1, '#', '0', 'ALL', 90, 1, 'iconsubsetup.png', 'EN'),
(52, 'PURRPT', 'Reports', '50', '8', 1, '#', '0', 'ALL', 70, 1, 'iconsubreport.png', 'EN'),
(54, 'PURSTSPL', 'Supplierslist', '51', '5', 0, 'supplier/supplierList', '0', 'ALL', 51, 1, 'icon-active.png', 'EN'),
(80, 'ARDASHB', 'AccountReceivables', '0', '2', 1, '#', '0', 'ALL', 20, 1, 'iconaccountreceivables.png', 'EN'),
(81, 'APDASHB', 'AccountPayables', '0', '3', 1, '#', '0', 'ALL', 30, 1, 'iconaccountpayables.png', 'EN'),
(82, 'SALES', 'SalesOrders', '0', '5', 1, '#', '0', 'ALL', 40, 1, 'iconsalesorder.png', 'EN'),
(83, 'GST', 'GST', '0', '6', 1, '#', '0', 'ALL', 70, 1, 'icongoodserviestax.png', 'EN'),
(84, 'ZAKAT', 'Zakat', '0', '7', 1, '#', '0', 'ALL', 80, 1, 'iconzakatwakaf.png', 'EN'),
(85, 'APSETUP', 'Setup', '81', '3', 1, '#', '0', 'ALL', 90, 1, 'iconsubsetup.png', 'EN'),
(86, 'ARSETUP', 'Setup', '80', '2', 1, '#', '0', 'ALL', 90, 1, 'iconsubsetup.png', 'EN'),
(87, 'APRPT', 'Reports', '81', '3', 1, '#', '0', 'ALL', 80, 1, 'iconsubreport.png', 'EN'),
(88, 'GLRPT', 'Reports', '45', '1', 1, '#', '0', 'ALL', 80, 1, 'iconsubreport.png', 'EN'),
(89, 'ARRPT', 'Reports', '80', '2', 1, '#', '0', 'ALL', 80, 1, 'iconsubreport.png', 'EN'),
(90, 'INVCTRL', 'InventoryControl', '0', '4', 1, '#', '0', 'ALL', 60, 1, 'iconinventorycontrol.png', 'EN'),
(91, 'ICSETUP', 'Setup', '90', '4', 1, '#', '0', 'ALL', 90, 1, 'iconsubsetup.png', 'EN'),
(92, 'ICRPT', 'Reports', '90', '4', 1, '#', '0', 'ALL', 80, 1, 'iconsubreport.png', 'EN'),
(93, 'MSTRCOMP', 'CompanySetup', '5', '10', 1, 'company/setup', '0', 'ALL', 5, 1, 'icon-com-setup.png', 'EN'),
(94, 'GLMCAL', 'Fycalendar', '46', '1', 0, 'glsetting/createCalendar', '0', 'ALL', 10, 1, 'icon-active.png', 'EN'),
(95, 'GLHOME', 'Home', '45', '1', 0, 'GeneralLedger', '0', 'ALL', 1, 1, 'iconsubhome.png', 'EN'),
(96, 'ARHOME', 'Home', '80', '2', 0, 'AccountReceivables', '0', 'ALL', 1, 1, 'iconsubhome.png', 'EN'),
(97, 'APHOME', 'Home', '81', '3', 0, 'AccountPayables', '0', 'ALL', 1, 1, 'iconsubhome.png', 'EN'),
(98, 'ICHOME', 'Home', '90', '4', 0, '#', '0', 'ALL', 1, 1, 'iconsubhome.png', 'EN'),
(99, 'PURHOME', 'Home', '50', '5', 0, '#', '0', 'ALL', 1, 1, 'iconsubhome.png', 'EN'),
(100, 'GSTHOME', 'Home', '83', '6', 0, '#', '0', 'ALL', 1, 1, 'iconsubhome.png', 'EN'),
(102, 'GSTSETUP', 'Setup', '83', '6', 1, '#', '0', 'ALL', 90, 1, 'iconsubsetup.png', 'EN'),
(103, 'GSTRPT', 'Reports', '83', '6', 1, '#', '0', 'ALL', 80, 1, 'iconsubreport.png', 'EN'),
(104, 'SOHOME', 'Home', '82', '5', 0, 'SalesOrder', '0', 'ALL', 1, 1, 'iconsubhome.png', 'EN'),
(105, 'SOSETUP', 'Setup', '82', '5', 1, '#', '0', 'ALL', 90, 1, 'iconsubsetup.png', 'EN'),
(106, 'SORPT', 'Reports', '82', '5', 1, '#', '0', 'ALL', 80, 1, 'iconsubreport.png', 'EN'),
(107, 'ZKTHOME', 'Home', '84', '7', 0, '#', '0', 'ALL', 1, 1, 'iconsubhome.png', 'EN'),
(108, 'ZKTSETUP', 'Setup', '84', '7', 1, '#', '0', 'ALL', 90, 1, 'iconsubsetup.png', 'EN'),
(109, 'ZKTRPT', 'Reports', '84', '7', 1, '#', '0', 'ALL', 80, 1, 'iconsubreport.png', 'EN'),
(110, 'MSTRCOML', 'List', '93', '10', 0, 'setting/companyList', '0', 'ALL', 5, 1, 'iconcompanysetup.png', 'EN'),
(114, 'MSTRSUPP', 'SupplierSetup', '85', '3', 0, 'Apsetting/supplierList', '0', 'ALL', 11, 1, 'icon-active.png', 'EN'),
(124, 'APTRANS', 'Transaction', '81', '3', 1, '#', '0', 'ALL', 10, 1, 'iconsubtransaction.png', 'EN'),
(129, 'APSUPPAY', 'SupplierPayment', '124', '3', 0, 'aptransaction/payment', '0', 'ALL', 50, 1, 'icon-active.png', 'EN'),
(130, 'ARSETCUS', 'CustomerSetup', '86', '2', 0, 'customerSetup/customerList', '0', 'ALL', 5, 1, 'icon-active.png', 'EN'),
(131, 'ARTRANS', 'Transaction', '80', '2', 1, '#', '0', 'ALL', 10, 1, 'iconsubtransaction.png', 'EN'),
(141, 'APPURDN', 'PurchaseDebitNote', '124', '3', 0, 'aptransaction/newDebitNote', '0', 'ALL', 23, 1, 'icon-active.png', 'EN'),
(142, 'APPURCN', 'PurchaseCreditNote', '124', '3', 0, 'aptransaction/newCreditNote', '0', 'ALL', 25, 1, 'icon-active.png', 'EN'),
(143, 'ITEMCAT', 'ItemCategory', '91', '4', 0, 'icsetting/itemCategoryList', '0', 'ALL', 5, 1, 'icon-active.png', 'EN'),
(144, 'ITEMTYP', 'ItemType', '91', '4', 0, 'icsetting/itemTypeList', '0', 'ALL', 10, 1, 'icon-active.png', 'EN'),
(145, 'ITEMSET', 'ItemSetup', '91', '4', 0, 'icsetting/itemList', '0', 'ALL', 25, 1, 'icon-active.png', 'EN'),
(147, 'PURTRANS', 'Transaction', '50', '8', 1, '#', '0', 'ALL', 5, 1, 'iconsubtransaction.png', 'EN'),
(148, 'ICTRANS', 'Transaction', '90', '4', 1, '#', '0', 'ALL', 5, 1, 'iconsubtransaction.png', 'EN'),
(150, 'GLTRANS', 'Transaction', '45', '1', 1, '#', '0', 'ALL', 5, 1, 'iconsubtransaction.png', 'EN'),
(151, 'GSTTRANS', 'Transaction', '83', '6', 1, '#', '0', 'ALL', 5, 1, 'iconsubtransaction.png', 'EN'),
(152, 'SOTRANS', 'Transaction', '82', '5', 1, '#', '0', 'ALL', 5, 1, 'iconsubtransaction.png', 'EN'),
(153, 'SOQUOT', 'SalesQuotation', '152', '5', 0, 'sotransaction/SalesQuotationList', '0', 'ALL', 1, 1, 'icon-active.png', 'EN'),
(154, 'GLTRJRNL', 'JlEntry', '150', '1', 0, 'gltransaction/journal', '0', '', 5, 1, 'icon-active.png', 'EN'),
(155, 'GLMCALL', 'Fycalendarlist', '46', '1', 0, 'glsetting/financialCalendarList', '0', 'ALL', 10, 1, 'icon-active.png', 'EN'),
(156, 'PROJECT', 'ProjectList', '5', '0', 0, 'project/projectlist', '0', 'ALL', 50, 1, 'icon-project.png', 'EN'),
(157, 'TERM', 'Terms', '5', '0', 0, 'term/termlist', '0', 'ALL', 60, 1, 'icon-term.png', 'EN'),
(158, 'GSTMSTR', 'Gsttable', '102', '6', 0, 'tax/taxtableList', '0', 'ALL', 1, 1, 'icon-active.png', 'EN'),
(159, 'GSTCLASS', 'taxclass', '102', '6', 0, 'tax/classList', '0', 'ALL', 30, 1, 'icon-active.png', 'EN'),
(160, 'GSTGROUP', 'taxgroup', '102', '6', 0, 'tax/groupList', '0', 'ALL', 31, 1, 'icon-active.png', 'EN'),
(161, 'GSTTYPE', 'taxtype', '102', '6', 0, 'tax/typeList', '0', 'ALL', 32, 1, 'icon-active.png', 'EN'),
(162, 'INVUM', 'invuom', '91', '4', 0, 'icsetting/umconversionlist', '0', 'ALL', 70, 1, 'iconsetupsub.png', 'EN'),
(166, 'GLRPBS', 'Financialposition', '88', '1', 0, 'glreports/financialposition', '0', '', 20, 1, 'icon-active.png', 'EN'),
(167, 'GLRPTB', 'Trialbalance', '88', '1', 0, 'glreports/trialBalance', '0', 'ALL', 5, 1, 'icon-active.png', 'EN'),
(168, 'GLSTCOA', 'ChartOfAccount', '46', '1', 0, 'glsetting/chartOfAcctList', '0', 'ALL', 60, 1, 'icon-active.png', 'EN'),
(169, 'MSMTRCD', 'Mastercode', '5', '1', 0, 'setting/masterCodeSetupList', '0', '', 40, 1, 'icon-general-setup-sub.png', 'EN'),
(171, 'GLTRJlCY', 'JlCopy', '150', '1', 0, 'Gltransaction/journalCopy', '0', '', 20, 0, 'icon-active.png', 'EN'),
(172, 'GLTRJlRV', 'JlReverse', '150', '1', 0, 'Gltransaction/reverse', '0', '', 30, 0, 'icon-active.png', 'EN'),
(173, 'GLTRPOST', 'Posting', '150', '1', 0, 'Gltransaction/posting', '0', '', 40, 1, 'icon-active.png', 'EN'),
(174, 'GLRPJLPS', 'Jlpost', '88', '1', 0, 'glreports/postedjournal', '0', '', 40, 1, 'icon-active.png', 'EN'),
(175, 'GLRPJLUP', 'Jlunposted', '88', '1', 0, 'glreports/unpostedjournal', '0', '', 35, 1, 'icon-active.png', 'EN'),
(176, 'GLRPTBFC', 'Trialbalancefc', '88', '1', 0, 'glreports/trialbalanceFiscalyear', '0', '', 7, 1, 'icon-active.png', 'EN'),
(178, 'GLRPABSM', 'Accountbalancesummary', '88', '1', 0, 'glreports/accountBalanceSummary', '0', '', 2, 1, 'icon-active.png', 'EN'),
(179, 'EMP', 'employeeSetup', '5', '0', 0, 'employeeSetup/employeeList', '0', '', 7, 1, 'icon-employee2.png', 'EN'),
(180, 'APPURDNL', 'PurchaseDebitNoteList', '87', '3', 0, 'apreports/debitnoteList', '0', '', 26, 1, 'icon-active.png', 'EN'),
(181, 'APPURDNC', 'PurchaseDebitNoteConfirm', '124', '3', 0, 'aptransaction/debitnotePost', '0', '', 24, 1, 'icon-active.png', 'EN'),
(184, 'APPURCNL', 'PurchaseCreditNoteList', '87', '3', 0, 'apreports/creditnoteList', '0', '', 27, 1, 'icon-active.png', 'EN'),
(185, 'APPURCNC', 'PurchaseCreditNoteConfirm', '124', '3', 0, 'aptransaction/creditnotePost', '0', '', 27, 1, 'icon-active.png', 'EN'),
(186, 'APPAYCFM', 'SupplierPaymentConfirm', '124', '3', 0, 'aptransaction/supplierpaymentList', '0', '', 51, 1, 'icon-active.png', 'EN'),
(187, 'APSUPPAY', 'SupplierPaymentList', '87', '3', 0, 'apreports/supplierpaymentlist', '0', '', 52, 1, 'icon-active.png', 'EN'),
(189, 'GLRPPNLM', 'Profitnloss', '88', '1', 0, 'glreports/profitNloss', '0', '', 30, 1, 'icon-active.png', 'EN'),
(190, 'FORMSTP', 'formSetup', '93', '10', 0, 'companySetup/formSetup', '0', '', 30, 1, 'i-pen.png', 'EN'),
(191, 'GLSTBDGT', 'Budget', '46', '1', 0, 'glsetting/budgetEntry', '0', '', 20, 1, 'icon-active.png', 'EN'),
(192, 'APOPWI', 'NewOtherPaymentWithItem', '124', '3', 0, 'othersPayment/newPayWithItem', '0', '', 54, 1, 'icon-active.png', 'EN'),
(193, 'APPAYICM', 'NewOtherPaymentWithItemConfirm', '124', '3', 0, 'aptransaction/otherpaywithItemPost', '0', '', 55, 1, 'icon-active.png', 'EN'),
(194, 'APOPWOI', 'NewOtherPaymentWithoutItem', '150', '1', 0, 'gltransaction/newPayWithoutItem', '0', '', 56, 1, 'icon-active.png', 'EN'),
(196, 'APRPTOPW', 'OtherPaymentWithItemList', '87', '3', 0, 'othersPayment/otherpaywithList', '0', '', 58, 1, 'icon-active.png', 'EN'),
(197, 'APRPTOPW', 'OtherPaymentWithoutItemList', '88', '1', 0, 'glreports/otherpaywithoutList', '0', '', 59, 1, 'icon-active.png', 'EN'),
(198, 'GLRPBGLT', 'Budgetlist', '88', '1', 0, 'glreports/budgetList', '0', '', 70, 1, 'icon-active.png', 'EN'),
(200, 'SOTRNWSO', 'SalesOrder', '152', '5', 0, 'sotransaction/salesOrderList', '0', '', 10, 1, 'icon-active.png', 'EN'),
(201, 'INVLOCTR', 'LocationTransfer', '148', '4', 0, 'locationtransfer/add', '0', '', 6, 1, 'icon-active.png', 'EN'),
(203, 'INVPURPR', 'PurchasePricing', '51', '8', 0, 'purchasepricing', '0', '', 10, 1, 'icon-active.png', 'EN'),
(204, 'INVITEMC', 'ItemCountAdjust', '148', '4', 0, 'itemcountadjust/add', '0', '', 8, 1, 'icon-active.png', 'EN'),
(207, 'CSSYSGEN', 'SystemGeneral', '93', '0', 0, 'systemgeneral/generalSetup', '0', '', 29, 1, 'i-pen.png', 'EN'),
(208, 'APRPTSTL', 'SupplierStatementList', '87', '3', 0, 'supplierStatement/supplierList', '0', '', 53, 1, 'icon-active.png', 'EN'),
(209, 'SOTRQOLT', 'Salesquotelist', '106', '5', 0, 'soreport/SalesQuotationList', '0', 'ALL', 17, 1, 'icon-active.png', 'EN'),
(210, 'SOSTSLPC', 'Salesprice', '105', '5', 0, 'sosetup/SalesPriceList', '0', '', 10, 1, 'icon-active.png', 'EN'),
(211, 'SORPPCLT', 'Salesprice', '106', '5', 0, 'soreport/SalesPrice', '0', '', 10, 1, 'icon-active.png', 'EN'),
(212, 'CHAOFACC', 'ChartOfAccountSetup', '93', '10', 0, 'setting/chartOfAccountsSetup', '0', '', 28, 1, 'i-film.png', 'EN'),
(216, 'SOTRDOLT', 'DeliveryOrderList', '106', '5', 0, 'sotransaction/SalesDOList', '0', 'ALL', 19, 1, 'icon-active.png', 'EN'),
(217, 'SOTRDO', 'DeliveryOrder', '152', '5', 0, 'sotransaction/SalesDO', '0', 'ALL', 40, 1, 'icon-active.png', 'EN'),
(218, 'PURORDER', 'PurchaseOrder', '147', '5', 0, 'PO_Transaction/newPO', '0', '', 6, 1, 'icon-active.png', 'EN'),
(219, 'PURORLST', 'PurchaseOrderList', '52', '5', 0, 'purchaseReports/poList', '0', '', 7, 1, 'icon-active.png', 'EN'),
(220, 'PURRCV', 'PurchaseReceive', '147', '5', 0, 'receiveItems/newITemReceived', '0', '', 9, 1, 'icon-active.png', 'EN'),
(224, 'APPURINV', 'PurchaseInvoice', '124', '3', 0, 'aptransaction/purchaseinvoice', '0', '', 19, 1, 'icon-active.png', 'EN'),
(225, 'APDIRINV', 'DirectPurchaseInvoice', '124', '3', 0, 'Aptransaction/invoices', '0', '', 20, 1, 'icon-active.png', 'EN'),
(226, 'APDRINVC', 'PurchaseInvoiceConfirm', '124', '3', 0, 'aptransaction/invoicesConfirm', '0', '', 22, 1, 'icon-active.png', 'EN'),
(227, 'ARSALINV', 'SalesInvoice', '131', '2', 0, 'artransaction/salesinvoice', '0', '', 10, 1, 'icon-active.png', 'EN'),
(229, 'ARSDBN', 'SalesDebitNote', '131', '2', 0, 'artransaction/newSaleDebitNote', '0', '', 19, 1, 'icon-active.png', 'EN'),
(230, 'ARDBNC', 'SalesDebitNoteConfirm', '131', '2', 0, 'artransaction/salesdebitnotePost', '0', '', 20, 1, 'icon-active.png', 'EN'),
(231, 'ARSCN', 'SalesCreditNote', '131', '2', 0, 'artransaction/newSaleCreditNote', '0', '', 21, 1, 'icon-active.png', 'EN'),
(232, 'ARSCNC', 'SalesCreditNoteConfirm', '131', '2', 0, 'artransaction/salescreditnotePost', '0', '', 22, 1, 'icon-active.png', 'EN'),
(233, 'ARRCVP', 'ReceivePayment', '131', '2', 0, 'artransaction/newReceivePayment', '0', '', 23, 1, 'icon-active.png', 'EN'),
(234, 'ARRCVPC', 'ReceivePaymentConfirm', '131', '2', 0, 'artransaction/receivedPaymentPost', '0', '', 24, 1, 'icon-active.png', 'EN'),
(235, 'ARINVLST', 'DirectSalesInvoiceList', '89', '2', 0, 'arReports/salesInvoiceList', '0', '', 18, 1, 'icon-active.png', 'EN'),
(236, 'ARDBNLST', 'SalesDebitNoteList', '89', '2', 0, 'arReports/salesdebitnotelist', '0', '', 26, 1, 'icon-active.png', 'EN'),
(237, 'ARCDNLST', 'SalesCreditNoteList', '89', '2', 0, 'arreports/salescreditnoteList', '0', '', 27, 1, 'icon-active.png', 'EN'),
(238, 'ARRCVPLS', 'ReceivePaymentList', '89', '2', 0, 'arReports/compRecPaymentList', '0', '', 28, 1, 'icon-active.png', 'EN'),
(239, 'ARDSLINV', 'NewDirectSaleInvoice', '131', '2', 0, 'arTransaction/newDirectSaleInvoice', '0', '', 13, 1, 'icon-active.png', 'EN'),
(240, 'AGENTSTP', 'AgentSetup', '5', '0', 0, 'saleagentSetup/agentList', '0', '', 32, 1, 'icon-agent.png', 'EN'),
(241, 'SOTRSOLT', 'Saleslist', '106', '5', 0, 'soreport/SalesOrderList', '0', 'ALL', 18, 1, 'icon-active.png', 'EN'),
(243, 'INVPLNRP', 'InventoryPlanningReport', '92', '4', 0, 'inventory/rptstatus/all', '0', '', 81, 1, 'icon-active.png', 'EN'),
(244, 'INVVALRP', 'InventoryValuationReport', '92', '4', 0, 'inventory/rptinventorysummary', '0', '', 82, 1, 'icon-active.png', 'EN'),
(245, 'INVSTORP', 'StockCheckReport', '92', '4', 0, 'inventory/stocklist', '0', '', 84, 1, 'icon-active.png', 'EN'),
(248, 'INVOUTRP', 'OutstandingGRNReport', '92', '4', 0, 'inventory/rptgrnvaluationFromInventory', '0', '', 87, 1, 'icon-active.png', 'EN'),
(249, 'INVMOVRP', 'InventoryMovementReport', '92', '4', 0, 'inventory/rptmovement', '0', '', 88, 1, 'icon-active.png', 'EN'),
(250, 'INVLSTRP', 'InventoryList', '92', '4', 0, 'inventory/rptbylocation', '0', '', 89, 1, 'icon-active.png', 'EN'),
(251, 'PURORDCF', 'PurchaseOrderConfirm', '147', '5', 0, 'po_transaction/poList', '0', '', 8, 1, 'icon-active.png', 'EN'),
(252, 'PURRCVC', 'PurchaseReceiveConfirm', '147', '5', 0, 'purchasetransaction/receiveItemPosting', '0', '', 10, 1, 'icon-active.png', 'EN'),
(253, 'PURRCVLS', 'PurchaseReceiveList', '52', '5', 0, 'receiveItems/receiveItemList2', '0', '', 8, 1, 'icon-active.png', 'EN'),
(255, 'GLSTCURC', 'Currencyconversion', '46', '1', 0, 'glsetting/currencyConvertion', '0', '', 50, 1, 'icon-active.png', 'EN'),
(256, 'ARDRSINV', 'SaleInvoiceConfirm', '131', '2', 0, 'artransaction/directsalesinvPost', '0', '', 15, 1, 'icon-active.png', 'EN'),
(257, 'TXTRPROC', 'GAFFiles', '151', '6', 0, 'taxTransaction/processGAF', '0', '', 10, 1, 'icon-active.png', 'EN'),
(258, 'APPURINV', 'PurchaseInvoiceList', '87', '3', 0, 'apreports/purchaseinvoicelist', '0', '', 25, 1, 'icon-active.png', 'EN'),
(259, 'SORPSOCU', 'Salesbycustomer', '106', '5', 0, 'soreport/SalesByCustomer', '0', '', 20, 1, 'icon-active.png', 'EN'),
(260, 'DELCNFRM', 'DeliveryOrderConfirm', '152', '5', 0, 'sotransaction/salesDOPost', '0', '', 42, 1, 'icon-active.png', 'EN'),
(261, 'SORPYRSL', 'SalesbycustomerYears', '106', '5', 0, 'soreport/SalesByCustomerYears', '0', '', 25, 1, 'icon-active.png', 'EN'),
(263, 'SORPSLIT', 'Salesbyitem', '106', '5', 0, 'soreport/SalesByItem', '0', '', 26, 1, 'icon-active.png', 'EN'),
(264, 'INVLOCTC', 'LocationTransferConfirm', '148', '4', 0, 'locationtransfer/locationtransfer', '0', '', 7, 1, 'icon-active.png', 'EN'),
(265, 'INVITCC', 'ItemCountAdjustConfirm', '148', '4', 0, 'itemcountadjust/confirm', '0', '', 9, 1, 'icon-active.png', 'EN'),
(268, 'IVSTCKCS', 'StockCountSheet', '92', '4', 0, 'countsheet', '0', '', 83, 1, 'icon-active.png', 'EN'),
(269, 'LTL', 'LocationTransferList', '92', '4', 0, 'locationtransfer/report', '0', '', 10, 1, 'icon-active.png', 'EN'),
(270, 'ICAA', 'ItemCountAndAdjustmentList', '92', '4', 0, 'itemcountadjust/report', '0', '', 20, 1, 'icon-active.png', 'EN'),
(272, 'BNKSETUP', 'BankSetup', '5', '10', 0, 'bankSetup/bankList', '0', '', 78, 1, 'icon-bank.png', 'EN'),
(274, 'ZKTSTGRP', 'Zakatgroup', '108', '7', 0, 'zakatsetup/Group', '0', '', 30, 1, 'icon-active.png', 'EN'),
(275, 'ZKTSTNSB', 'nisab', '108', '7', 0, 'zakatsetup/nisabsetup', '0', NULL, 20, 1, 'icon-active.png', 'EN'),
(276, 'ZKTRGPLT', 'Zakatgrouplist', '109', '7', 0, 'zakatreport/groupList', '0', '', 20, 1, 'icon-active.png', 'EN'),
(277, 'ZKTSTNSD', 'Nisabdetails', '108', '7', 0, 'zakatsetup/NisabDetails', '0', '', 10, 1, 'icon-active.png', 'EN'),
(278, 'ZKTTRANS', 'Transaction', '84', '7', 1, '#', '0', '', 20, 1, 'iconsubtransaction.png', 'EN'),
(279, 'ZKTTRCAL', 'Zakatcalculate', '278', '7', 0, 'zakatTransaction/Calculation', '0', '', 10, 1, 'icon-active.png', 'EN'),
(280, 'ZKSTCNTR', 'Zakatcenter', '108', '7', 0, 'zakatSetup/zakatcentersetup', '0', '', 55, 1, 'icon-active.png', 'EN'),
(281, 'ZKRPCTRL', 'Zakatcenter', '109', '7', 0, 'zakatreport/centerList', '0', '', 10, 1, 'icon-active.png', 'EN'),
(282, 'ZKRPNBLT', 'Zakatnisab', '109', '7', 0, 'zakatreport/nisabList', '0', '', 5, 1, 'icon-active.png', 'EN'),
(283, 'ZKRPSMLT', 'Zakatsummary', '109', '7', 0, 'zakatreport/zakatSummaryList', '0', '', 80, 1, 'icon-active.png', 'EN'),
(284, 'PUROUTGR', 'OutstandingGRNReport', '52', '5', 0, 'inventory/rptgrnvaluationFromPurchase', '0', '', 10, 1, 'icon-active.png', 'EN'),
(285, 'WKSTMSTR', 'Wakafsetup', '108', '7', 0, 'wakafsetup/wakaf_acrual_list', '0', '', 60, 1, 'icon-active.png', 'EN'),
(286, 'ARCUSTST', 'CustomerStatement', '89', '2', 0, 'customerStatement/customerList', '0', '', 29, 1, 'icon-active.png', 'EN'),
(287, 'ARCPYSI', 'copySalesInvoice', '131', '2', 0, 'arinvoiceclone', '0', '', 14, 1, 'icon-active.png', 'EN'),
(288, 'APCPYPI', 'copyPurchaseInvoice', '124', '3', 0, 'apinvoiceclone', '0', '', 21, 1, 'icon-active.png', 'EN'),
(289, 'SORPORCT', 'Salesorderbycustomer', '106', '5', 0, 'soreport/SalesOrderByCustomer', '0', '', 60, 1, 'icon-active.png', 'EN'),
(290, 'SORPSOIT', 'Salesorderbyitem', '106', '5', 0, 'soreport/SalesOrderByItem', '0', '', 65, 1, 'icon-active.png', 'EN'),
(292, 'SORPOROT', 'Salesorderoutstandingbyitem', '106', '5', 0, 'soreport/SalesOrderOutstandingByItem', '0', '', 75, 1, 'icon-active.png', 'EN'),
(294, 'APBANKRE', 'BankReconciliation', '88', '1', 0, 'BankReconciliation', '0', '', 57, 1, 'icon-active.png', 'EN'),
(295, 'WCQCNTR', 'WaqafCenter', '108', '7', 0, 'waqafsetup/waqaflist', '0', '', 61, 1, 'icon-active.png', 'EN'),
(297, 'WKFCAL', 'wakafCalculation', '278', '7', 0, 'wakafSetup/newwakaf', '0', '', 11, 1, 'icon-active.png', 'EN'),
(298, 'WKFLST', 'wakafList', '109', '7', 0, 'wakafSetup/wakafList', '0', '', 81, 1, 'icon-active.png', 'EN'),
(299, 'APDRNOTE', 'PurchaseDebitNoteEdit', '124', '3', 0, 'aptransaction/editDebitNote', '0', '', 100, 0, 'icon-transaction.png', 'EN'),
(302, 'GLTRYECL', 'YearEndClose', '150', '1', 0, 'Gltransaction/YearEndClose', '0', '0', 90, 1, 'icon-active.png', 'EN'),
(304, 'LOGRPT', 'LogReport', '12', '9', 0, 'logreport', '0', '0', 5, 1, 'icon-log.png', 'EN'),
(305, 'USRGD', 'UserGuide', '0', '0', 0, 'userguide', '0', '0', 1000, 1, 'iconuserguide.png', 'EN'),
(306, 'APTRETCR', 'EditCreditNote', '124', '3', 0, 'aptransaction/editCreditNote/19', '0', '0', 55, 0, 'i-film.png', 'EN'),
(307, 'APTRPYIE', 'EditOtherPaymentWithItem', '124', '3', 0, 'othersPayment/editpaywithitem', '0', '0', 70, 0, 'i-film.png', 'EN'),
(308, 'APTRPYOE', 'EditOtherPaymentWithoutItem', '124', '3', 0, 'othersPayment/editpaywithoutitem', '0', '0', 71, 0, 'i-film.png', 'EN'),
(309, 'UMACCSS', 'Useraccess', '12', '9', 0, 'admin/user_access', '0', '0', 3, 0, 'i-film.png', 'EN'),
(310, 'ADMMENU', 'Menumaster', '12', '9', 0, 'admin/menumaster', '0', '0', 30, 0, 'i-film.png', 'EN'),
(311, 'ARTRINED', 'EditDirectSaleInvoice', '131', '2', 0, 'artransaction/editDirectSaleInvoice', '0', '0', 20, 0, 'i-film.png', 'EN'),
(312, 'AREDSLDR', 'EditSalesDebitNote', '131', '2', 0, 'artransaction/editSaleDebitNote', '0', '0', 50, 0, 'i-film.png', 'EN'),
(313, 'AREDCR', 'EditSalesCreditNote', '131', '2', 0, 'artransaction/editSaleCreditNote', '0', '0', 50, 0, 'i-film.png', 'EN'),
(314, 'ARPAYEDT', 'EditPayment', '131', '2', 0, 'artransaction/editReceivePayment', '0', '0', 70, 0, 'i-film.png', 'EN'),
(316, 'ARNWCUST', 'NewCustomer', '86', '2', 0, 'customerSetup/CustomerNew', '0', '0', 70, 0, 'i-film.png', 'EN'),
(317, 'ARSHIP2L', 'ShiptoList', '86', '2', 0, 'customerSetup/shiptolist', '0', '0', 40, 0, 'i-film.png', 'EN'),
(318, 'ARSHIP2N', 'NewShipto', '86', '2', 0, 'CustomerSetup/shiptoNew', '0', '0', 42, 0, 'i-film.png', 'EN'),
(319, 'INEDITEM', 'EditItem', '91', '4', 0, 'icsetting/item_id', '0', '0', 40, 0, 'i-film.png', 'EN'),
(320, 'INNWITEM', 'NewItem', '91', '4', 0, 'icsetting/itemNew', '0', '0', 40, 0, 'i-film.png', 'EN'),
(321, 'GST03', 'gst03', '103', '6', 0, 'gst03', '0', '0', 83, 1, 'icon-active.png', 'EN'),
(322, 'ARCUSTAG', 'CustomerAging', '89', '2', 0, 'arreports/customerAging', '0', '0', 30, 1, 'icon-active.png', 'EN'),
(323, 'GSTRPT01', 'gstReport', '103', '6', 0, 'gstReport', '0', '0', 81, 1, 'icon-active.png', 'EN'),
(325, 'APNEWSUP', 'NewSupplier', '85', '3', 0, 'supplier/SupplierNew', '0', '0', 50, 0, 'i-film.png', 'EN'),
(326, 'APNWSHP2', 'SupplierShipto', '85', '3', 0, 'supplier/shiptoNew', '0', '0', 53, 0, 'i-film.png', 'EN'),
(327, 'ItemDetR', 'Itemdetails', '92', '4', 0, 'icsetting/ItemDetails', '0', '0', 6, 1, 'icon-active.png', 'EN'),
(328, 'UMCONVNW', 'UMConversion', '51', '8', 0, 'purchasesetting/umconversion', '0', '0', 70, 0, 'i-film.png', 'EN'),
(330, 'PUPRRPT', 'purchasePricingReport', '52', '5', 0, 'purchasepricing/report', '0', NULL, 5, 1, 'icon-active.png', 'EN'),
(332, 'ARCASH', 'CashSale', '131', '2', 0, 'arTransaction/newcashsale', '0', '0', 25, 1, 'icon-active.png', 'EN'),
(337, 'PURCNCL', 'purchaseOrderCancel', '52', '8', 0, 'purchaseReports/poCancelList', '0', '0', 10, 1, 'icon-active.png', 'EN'),
(338, 'PURPRCAD', 'purchasePricingAdd', '50', '8', 0, 'purchasePricing/add', '0', '0', 56, 0, 'i-film', 'EN'),
(340, 'ARCASHSC', 'CashSalesConfirm', '131', '2', 0, 'artransaction/cashsalePost', '0', '0', 26, 1, 'icon-active.png', 'EN'),
(341, 'ARCSHS', 'CashSalesRpt', '89', '2', 0, 'arreports/cashsalelist', '0', '0', 31, 1, 'icon-active.png', 'EN'),
(344, 'USRADD', 'usermasterAdd', '12', '9', 0, 'admin/usermaster', '0', '0', 3, 0, 'i-film', 'EN'),
(345, 'LOCEDT', 'locationedit', '90', '4', 0, 'ItemSetup/location', '0', '0', 72, 0, 'i-film', 'EN'),
(346, 'COMPSTP', 'compsetup', '93', '10', 0, 'setting/companysetup', '0', '0', 6, 0, 'i-film', 'EN'),
(347, 'PURRCVCA', 'purchaseReceiveCancel', '52', '8', 0, 'receiveItems/receivecancel', '0', '0', 9, 1, 'icon-active.png', 'EN'),
(348, 'ShipToST', 'shiptosetup', '5', '1', 0, 'setting/shiptoList', '0', '0', 79, 1, 'icon-ship.png', 'EN'),
(351, 'BACKUP', 'backup', '12', '9', 0, 'backup', '0', '0', 6, 1, 'icon-backup.png', 'EN'),
(353, 'OTRPAY', 'otherpaymentconfirm', '150', '1', 0, 'gltransaction/otherpaymentConfirm', '0', '0', 57, 1, 'icon-active.png', 'EN'),
(354, 'OTHRCV', 'othersReceive', '150', '1', 0, 'gltransaction/newotherreceive', '0', '0', 58, 1, 'icon-active.png', 'EN'),
(355, 'OTRCVCON', 'othersReceiveConfirm', '150', '1', 0, 'gltransaction/otherreceiveConfirm', '0', '0', 59, 1, 'icon-active.png', 'EN'),
(356, 'OTRCVLST', 'othersReceiveList', '88', '1', 0, 'glreports/othersreceiveList', '0', '0', 71, 1, 'icon-active.png', 'EN'),
(357, 'GSBADRLF', 'baddebtrelief', '151', '6', 0, 'gstReport/badDebtRelief', '0', '0', 11, 1, 'icon-active.png', 'EN'),
(358, 'BADBTRLC', 'baddebtreliefcon', '151', '6', 0, 'gstReport/badDebtReliefConfirm', '0', '0', 12, 1, 'icon-active.png', 'EN'),
(359, 'GSBADBTR', 'baddebtrecover', '151', '6', 0, 'gstreport/badDebtRecover', '0', '0', 13, 1, 'icon-active.png', 'EN'),
(360, 'BDEBRCCO', 'baddebtrecovercon', '151', '6', 0, 'gstreport/DebtRecoverConfirm', '0', '0', 14, 1, 'icon-active.png', 'EN'),
(361, 'BDRETRPT', 'baddebtreliefrpt', '103', '6', 0, '#', '0', '0', 85, 1, 'i-film', 'EN'),
(362, 'BDRCVRPT', 'baddebtrecoverrpt', '103', '6', 0, '#', '0', '0', 86, 1, 'i-film', 'EN'),
(365, 'PURUOMLS', 'UMConversionList', '51', '8', 0, 'icsetting/umconversionlist', '0', '0', 52, 1, 'icon-active.png', 'EN'),
(368, 'GLBNKRCL', 'bankreconlist', '88', '1', 0, 'bankreconciliation/concilelist', '0', '0', 58, 1, 'icon-active.png', 'EN'),
(369, 'IVUNTMSR', 'unitmeasures', '91', '4', 1, 'icsetting/unitmeasurelist', '0', NULL, 71, 1, 'icon-active.png', 'EN'),
(370, 'TRSCSUMM', 'transactionsummary', '88', '1', 0, 'glreports/transactionSummaryList', '0', '0', 72, 1, 'icon-active.png', 'EN'),
(371, 'GLOPNBAL', 'glopeningbalance', '46', '1', 0, 'glsetting/openingBalance', '0', '0', 61, 1, 'icon-active.png', 'EN'),
(372, 'OPNBALIN', 'openbalanceinventory', '91', '4', 0, 'inventory/addinventory', '0', '0', 26, 1, 'icon-active.png', 'EN'),
(373, 'GLUNPRES', 'unpresentSetup', '46', '1', 0, 'bankreconciliation/unpresented_list', '0', '0', 62, 1, 'icon-active.png', 'EN'),
(374, 'updversi', 'updversion', '12', '9', 0, 'admin/spsversion', '0', '0', 110, 1, 'icon-license.png', 'EN'),
(375, 'upgraden', 'upgradenouser', '12', '9', 0, 'admin/updatekey', '0', '0', 111, 1, 'icon-version.png', 'EN'),
(376, 'GTSJNL', 'gstjournal', '151', '6', 0, 'gltransaction/gstjournal', '0', NULL, 15, 1, 'icon-active.png', 'EN'),
(377, 'GSTJCNF', 'gstjournalconfirm', '151', '6', 0, 'gltransaction/gstjournalconfirm', '0', NULL, 16, 1, 'icon-active.png', 'EN'),
(379, 'GSTRPTSU', 'gstReportSummary', '103', '6', 0, 'gstReport/gstReportSummary', '0', '0', 82, 1, 'icon-active.png', 'EN'),
(380, 'GST03SUM', 'gst03Summary', '103', '6', 0, 'gst03/gst03Summary', '0', '0', 84, 1, 'icon-active.png', 'EN');

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

--
-- Table structure for table `_sys_um`
--

CREATE TABLE IF NOT EXISTS `_sys_um` (
`fldid` int(11) NOT NULL,
  `companyID` int(11) NOT NULL,
  `code` varchar(10) DEFAULT NULL,
  `desc` varchar(50) DEFAULT NULL
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT AUTO_INCREMENT=17 ;

--
-- Dumping data for table `_sys_um`
--

INSERT INTO `_sys_um` (`fldid`, `companyID`, `code`, `desc`) VALUES
(1, 1, 'cm', 'Centimeter'),
(2, 1, 'pcs', 'Pieces'),
(3, 1, 'ea', 'Each'),
(4, 1, 'km', 'Kilometer'),
(5, 1, 'm', 'Meter'),
(6, 1, 'L', 'Liter'),
(7, 1, 'ml', 'Mililiter'),
(8, 1, 'g', 'Grams'),
(9, 1, 'kg', 'Kilograms'),
(10, 1, 'tons', 'Tons'),
(11, 1, 'mm', 'Milimeter'),
(12, 1, 'drum', 'Drums'),
(13, 1, 'box', 'Boxes'),
(14, 1, 'pallet', 'Pallets'),
(15, 1, 'unit', 'unit'),
(16, 2, 'unit', 'unit');

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

--
-- Table structure for table `_sys_um_conv`
--

CREATE TABLE IF NOT EXISTS `_sys_um_conv` (
`fldid` int(11) NOT NULL,
  `companyID` int(11) NOT NULL,
  `itemID` int(11) DEFAULT NULL,
  `from_um` int(11) DEFAULT NULL,
  `to_um` int(11) DEFAULT NULL,
  `unitm` decimal(10,5) DEFAULT NULL,
  `factor` decimal(10,5) DEFAULT NULL,
  `create_by` varchar(50) DEFAULT NULL,
  `create_dt` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `modified_by` varchar(50) DEFAULT NULL,
  `modified_dt` datetime DEFAULT NULL
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;

--
-- Dumping data for table `_sys_um_conv`
--

INSERT INTO `_sys_um_conv` (`fldid`, `companyID`, `itemID`, `from_um`, `to_um`, `unitm`, `factor`, `create_by`, `create_dt`, `modified_by`, `modified_dt`) VALUES
(3, 0, NULL, 1, 5, '1.00000', '100.00000', 'yahaya', '2015-03-26 09:23:04', NULL, NULL),
(6, 0, NULL, 8, 9, '1000.00000', '1.00000', 'yahaya', '2015-03-26 09:23:04', NULL, NULL);

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

--
-- Table structure for table `_sys_um_conv_bak`
--

CREATE TABLE IF NOT EXISTS `_sys_um_conv_bak` (
  `fldid` int(11) NOT NULL DEFAULT '0',
  `companyID` int(11) NOT NULL,
  `itemID` int(11) DEFAULT NULL,
  `from_um` int(11) DEFAULT NULL,
  `to_um` int(11) DEFAULT NULL,
  `unitm` decimal(10,5) DEFAULT NULL,
  `factor` decimal(10,5) DEFAULT NULL,
  `create_by` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
  `create_dt` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `modified_by` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
  `modified_dt` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Structure for view `view_account_balance`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`;

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

--
-- Structure for view `view_ar_inventory`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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);

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

--
-- Structure for view `view_ar_open_position`
--

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

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

--
-- Structure for view `view_balance_sheet`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`;

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

--
-- Structure for view `view_bank_reconcile`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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));

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

--
-- Structure for view `view_bank_reconcile_reverse`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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);

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

--
-- Structure for view `view_chart_of_acct_updateable`
--

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

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

--
-- Structure for view `view_comp_acc_det`
--

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

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

--
-- Structure for view `view_customer_aging`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_customer_aging` AS select `a`.`companyID` AS `companyID`,`a`.`ID` AS `customerID`,`a`.`customerName` AS `customerName`,`a`.`phoneNumber1` AS `phoneNumber1`,`a`.`email` AS `email`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 0))) AS `current`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 1))) AS `month1`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 2))) AS `month2`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 3))) AS `month3`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 4))) AS `month4`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 5))) AS `month5`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 6))) AS `month6`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 7))) AS `month7`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 8))) AS `month8`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 9))) AS `month9`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) = 10))) AS `month10`,(select sum(`comp_sales_invoice`.`totalReceivable`) from `comp_sales_invoice` where ((`comp_sales_invoice`.`companyID` = `a`.`companyID`) and (`comp_sales_invoice`.`customerID` = `a`.`ID`) and (timestampdiff(MONTH,`comp_sales_invoice`.`salesInvoiceDate`,now()) > 10))) AS `month11` from `customer` `a`;

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

--
-- Structure for view `view_customer_statement`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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) 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 (`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 (`b`.`ID` = `a`.`salesInvoiceID`)) union select `b`.`ID` AS `ID`,0 AS `parent`,`b`.`companyID` AS `companyID`,`b`.`customerID` AS `customerID`,'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`.`updateAble` = 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);

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

--
-- Structure for view `view_expence_and_income`
--

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

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

--
-- Structure for view `view_gaf`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`));

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

--
-- Structure for view `view_grn_report`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`;

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

--
-- Structure for view `view_gst_report`
--

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

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

--
-- Structure for view `view_gst_tax`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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` 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)) 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` 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)) 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` 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)) 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` 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)) 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` 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)) 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` 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)) 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` 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)) 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` 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)) 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` 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)) 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` 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)) 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` 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)) 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` 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)) 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` 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)) 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` 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)) 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` 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)) 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` 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))) 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` 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));

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

--
-- Structure for view `view_inventorylist_subtotal`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`;

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

--
-- Structure for view `view_inventory_statement`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`));

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

--
-- Structure for view `view_inventory_transaction`
--

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

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

--
-- Structure for view `view_item_details`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`;

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

--
-- Structure for view `view_item_quantityonhand`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`;

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

--
-- Structure for view `view_item_quantityonhand_confirm`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`;

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

--
-- Structure for view `view_open_ar_invoice`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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);

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

--
-- Structure for view `view_salescreditnote`
--

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

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

--
-- Structure for view `view_salesdebitnote`
--

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

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

--
-- Structure for view `view_search`
--

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

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

--
-- Structure for view `view_serial_comp_cash_sales`
--

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

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

--
-- Structure for view `view_serial_comp_delivery_order`
--

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

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

--
-- Structure for view `view_serial_comp_gst_transaction`
--

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

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

--
-- Structure for view `view_serial_comp_location_transfer`
--

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

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

--
-- Structure for view `view_serial_comp_payment`
--

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

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

--
-- Structure for view `view_serial_comp_payment_others`
--

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

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

--
-- Structure for view `view_serial_comp_purchase_order`
--

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

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

--
-- Structure for view `view_serial_comp_quotation`
--

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

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

--
-- Structure for view `view_serial_comp_receive_item`
--

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

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

--
-- Structure for view `view_serial_comp_receive_payment`
--

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

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

--
-- Structure for view `view_serial_comp_receive_payment_others`
--

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

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

--
-- Structure for view `view_serial_comp_sales_creditnote`
--

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

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

--
-- Structure for view `view_serial_comp_sales_debitnote`
--

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

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

--
-- Structure for view `view_serial_comp_sales_invoice`
--

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

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

--
-- Structure for view `view_serial_comp_sales_order`
--

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

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

--
-- Structure for view `view_serial_comp_supplier_creditnote`
--

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

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

--
-- Structure for view `view_serial_comp_supplier_debitnote`
--

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

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

--
-- Structure for view `view_serial_comp_supplier_invoice`
--

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

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

--
-- Structure for view `view_suppliercreditnote`
--

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

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

--
-- Structure for view `view_supplierdebitnote`
--

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

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

--
-- Structure for view `view_supplier_aging`
--

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

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

--
-- Structure for view `view_supplier_statement`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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) 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`.`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`.`supplierInvoiceID` = `b`.`ID`)) union select `b`.`ID` AS `ID`,NULL AS `parent`,`b`.`companyID` AS `companyID`,`b`.`supplierID` AS `supplierID`,'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`.`updateAble` = 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);

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

--
-- Structure for view `view_total_comp_sales_creditnote`
--

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

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

--
-- Structure for view `view_total_comp_sales_debitnote`
--

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

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

--
-- Structure for view `view_total_comp_sales_invoice`
--

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

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

--
-- Structure for view `view_total_comp_supplier_creditnote`
--

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

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

--
-- Structure for view `view_total_comp_supplier_debitnote`
--

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

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

--
-- Structure for view `view_total_comp_supplier_invoice`
--

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

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

--
-- Structure for view `view_transaction_summary`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`;

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

--
-- Structure for view `view_unpost_ap_creditnote`
--

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

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

--
-- Structure for view `view_unpost_ap_debitnote`
--

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

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

--
-- Structure for view `view_unpost_ap_invoice`
--

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

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

--
-- Structure for view `view_unpost_ar_creditnote`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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));

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

--
-- Structure for view `view_unpost_ar_debitnote`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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));

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

--
-- Structure for view `view_unpost_ar_invoice`
--

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

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

--
-- Structure for view `view_unpost_ar_payment`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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` = 'payDisc'))) 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));

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

--
-- Structure for view `view_unpost_cash_purchase`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`,(select `item`.`inventoriesID` from `item` where (`item`.`ID` = `b`.`itemID`)) 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`) where ((`a`.`ID` = `b`.`otherPaymentID`) and (`a`.`updateAble` = 1) and (`a`.`is_delete` = 0));

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

--
-- Structure for view `view_unpost_cash_sale`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`));

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

--
-- Structure for view `view_unpost_do`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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));

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

--
-- Structure for view `view_unpost_gst_transaction`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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));

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

--
-- Structure for view `view_unpost_other_payment`
--

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

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

--
-- Structure for view `view_unpost_other_receive`
--

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

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

--
-- Structure for view `view_unpost_payment`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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));

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

--
-- Structure for view `view_unpost_receive_item`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`));

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

--
-- Structure for view `view_wakaf_accrual`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`;

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

--
-- Structure for view `view_wakaf_from_profit`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 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`;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `acount_type`
--
ALTER TABLE `acount_type`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `chat`
--
ALTER TABLE `chat`
 ADD PRIMARY KEY (`ID`), ADD KEY `to` (`to`), ADD KEY `from` (`from`);

--
-- Indexes for table `chats`
--
ALTER TABLE `chats`
 ADD PRIMARY KEY (`id`);

--
-- Indexes for table `ci_sessions`
--
ALTER TABLE `ci_sessions`
 ADD PRIMARY KEY (`session_id`);

--
-- Indexes for table `ci_users`
--
ALTER TABLE `ci_users`
 ADD PRIMARY KEY (`user_id`,`user_email`);

--
-- Indexes for table `company`
--
ALTER TABLE `company`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_acct_group_bak`
--
ALTER TABLE `comp_acct_group_bak`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_acct_type`
--
ALTER TABLE `comp_acct_type`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_acc_det`
--
ALTER TABLE `comp_acc_det`
 ADD PRIMARY KEY (`ID`), ADD KEY `Index 2` (`companyID`,`acctID`,`year`,`period`);

--
-- Indexes for table `comp_address`
--
ALTER TABLE `comp_address`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_alert_table`
--
ALTER TABLE `comp_alert_table`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_bank`
--
ALTER TABLE `comp_bank`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_bank_reconcile`
--
ALTER TABLE `comp_bank_reconcile`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_bank_reconcile_track_back`
--
ALTER TABLE `comp_bank_reconcile_track_back`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_budget`
--
ALTER TABLE `comp_budget`
 ADD PRIMARY KEY (`ID`), ADD KEY `Index 2` (`companyID`,`acctID`,`year`);

--
-- Indexes for table `comp_cash_sales`
--
ALTER TABLE `comp_cash_sales`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_cash_sales_charges`
--
ALTER TABLE `comp_cash_sales_charges`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_cash_sales_detail`
--
ALTER TABLE `comp_cash_sales_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_chart_of_acct`
--
ALTER TABLE `comp_chart_of_acct`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_contact`
--
ALTER TABLE `comp_contact`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_control_acct_setup`
--
ALTER TABLE `comp_control_acct_setup`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_currency_conv`
--
ALTER TABLE `comp_currency_conv`
 ADD PRIMARY KEY (`ID`), ADD KEY `Index 2` (`companyID`,`currencyFrom`,`startDate`);

--
-- Indexes for table `comp_delivery_detail`
--
ALTER TABLE `comp_delivery_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_delivery_order`
--
ALTER TABLE `comp_delivery_order`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_department`
--
ALTER TABLE `comp_department`
 ADD PRIMARY KEY (`fldid`);

--
-- Indexes for table `comp_employee`
--
ALTER TABLE `comp_employee`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_financial_year`
--
ALTER TABLE `comp_financial_year`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_form_control`
--
ALTER TABLE `comp_form_control`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_gl`
--
ALTER TABLE `comp_gl`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_gst_report`
--
ALTER TABLE `comp_gst_report`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_gst_transaction`
--
ALTER TABLE `comp_gst_transaction`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_gst_transaction_detail`
--
ALTER TABLE `comp_gst_transaction_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_industry`
--
ALTER TABLE `comp_industry`
 ADD PRIMARY KEY (`ID`), ADD KEY `companyID` (`companyID`);

--
-- Indexes for table `comp_item_category`
--
ALTER TABLE `comp_item_category`
 ADD PRIMARY KEY (`ID`), ADD KEY `companyID` (`companyID`);

--
-- Indexes for table `comp_jl_seq`
--
ALTER TABLE `comp_jl_seq`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_journal`
--
ALTER TABLE `comp_journal`
 ADD PRIMARY KEY (`ID`), ADD KEY `status` (`status`), ADD KEY `journalID` (`journalID`);

--
-- Indexes for table `comp_journal_detail`
--
ALTER TABLE `comp_journal_detail`
 ADD PRIMARY KEY (`ID`), ADD KEY `journalID` (`journalID`), ADD KEY `comp_acc_det` (`companyID`,`acctCode`,`period`,`year`,`status`,`is_delete`), ADD KEY `acctCode` (`acctCode`);

--
-- Indexes for table `comp_location_transfer`
--
ALTER TABLE `comp_location_transfer`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_location_transfer_detail`
--
ALTER TABLE `comp_location_transfer_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_opening_balance`
--
ALTER TABLE `comp_opening_balance`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_payment`
--
ALTER TABLE `comp_payment`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_payment_detail`
--
ALTER TABLE `comp_payment_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_payment_others`
--
ALTER TABLE `comp_payment_others`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_payment_others_without_item`
--
ALTER TABLE `comp_payment_others_without_item`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_payment_others_with_item`
--
ALTER TABLE `comp_payment_others_with_item`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_project`
--
ALTER TABLE `comp_project`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_purchase_order`
--
ALTER TABLE `comp_purchase_order`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_purchase_order_detail`
--
ALTER TABLE `comp_purchase_order_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_purchase_price`
--
ALTER TABLE `comp_purchase_price`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_quotation`
--
ALTER TABLE `comp_quotation`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_quotation_detail`
--
ALTER TABLE `comp_quotation_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_receive_delivery_conn`
--
ALTER TABLE `comp_receive_delivery_conn`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_receive_item`
--
ALTER TABLE `comp_receive_item`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_receive_item_detail`
--
ALTER TABLE `comp_receive_item_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_receive_payment`
--
ALTER TABLE `comp_receive_payment`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_receive_payment_detail`
--
ALTER TABLE `comp_receive_payment_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_receive_payment_others`
--
ALTER TABLE `comp_receive_payment_others`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_receive_payment_others_detail`
--
ALTER TABLE `comp_receive_payment_others_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_agent`
--
ALTER TABLE `comp_sales_agent`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_bad_debt`
--
ALTER TABLE `comp_sales_bad_debt`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_creditnote`
--
ALTER TABLE `comp_sales_creditnote`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_creditnote_charges`
--
ALTER TABLE `comp_sales_creditnote_charges`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_creditnote_detail`
--
ALTER TABLE `comp_sales_creditnote_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_debitnote`
--
ALTER TABLE `comp_sales_debitnote`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_debitnote_charges`
--
ALTER TABLE `comp_sales_debitnote_charges`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_debitnote_detail`
--
ALTER TABLE `comp_sales_debitnote_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_debt_recover`
--
ALTER TABLE `comp_sales_debt_recover`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_detail`
--
ALTER TABLE `comp_sales_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_invoice`
--
ALTER TABLE `comp_sales_invoice`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_invoice_charges`
--
ALTER TABLE `comp_sales_invoice_charges`
 ADD PRIMARY KEY (`ID`), ADD KEY `invoice` (`invoiceID`), ADD KEY `tax` (`taxID`), ADD KEY `accountID` (`accountNoID`);

--
-- Indexes for table `comp_sales_invoice_detail`
--
ALTER TABLE `comp_sales_invoice_detail`
 ADD PRIMARY KEY (`ID`), ADD KEY `item` (`itemID`), ADD KEY `tax` (`taxID`), ADD KEY `invoice` (`invoiceID`);

--
-- Indexes for table `comp_sales_order`
--
ALTER TABLE `comp_sales_order`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_sales_price`
--
ALTER TABLE `comp_sales_price`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_so_seq`
--
ALTER TABLE `comp_so_seq`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_supplier_closing`
--
ALTER TABLE `comp_supplier_closing`
 ADD PRIMARY KEY (`ID`), ADD KEY `companyID` (`companyID`,`supplierID`,`yearMonth`);

--
-- Indexes for table `comp_supplier_closing_daily`
--
ALTER TABLE `comp_supplier_closing_daily`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_supplier_creditnote`
--
ALTER TABLE `comp_supplier_creditnote`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_supplier_creditnote_charges`
--
ALTER TABLE `comp_supplier_creditnote_charges`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_supplier_creditnote_detail`
--
ALTER TABLE `comp_supplier_creditnote_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_supplier_debitnote`
--
ALTER TABLE `comp_supplier_debitnote`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_supplier_debitnote_charges`
--
ALTER TABLE `comp_supplier_debitnote_charges`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_supplier_debitnote_detail`
--
ALTER TABLE `comp_supplier_debitnote_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_supplier_invoice`
--
ALTER TABLE `comp_supplier_invoice`
 ADD PRIMARY KEY (`ID`), ADD KEY `supplier` (`ID`,`supplierID`,`updateAble`);

--
-- Indexes for table `comp_supplier_invoice_charges`
--
ALTER TABLE `comp_supplier_invoice_charges`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_supplier_invoice_detail`
--
ALTER TABLE `comp_supplier_invoice_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_supplier_statement`
--
ALTER TABLE `comp_supplier_statement`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `comp_unpresented_check`
--
ALTER TABLE `comp_unpresented_check`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `customer`
--
ALTER TABLE `customer`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `customer_address`
--
ALTER TABLE `customer_address`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `customer_contact`
--
ALTER TABLE `customer_contact`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `item`
--
ALTER TABLE `item`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `item_adjustment`
--
ALTER TABLE `item_adjustment`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `item_adjustment_detail`
--
ALTER TABLE `item_adjustment_detail`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `item_details`
--
ALTER TABLE `item_details`
 ADD PRIMARY KEY (`ID`), ADD KEY `Index 2` (`companyID`,`acctID`,`locationID`);

--
-- Indexes for table `master`
--
ALTER TABLE `master`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `master_code`
--
ALTER TABLE `master_code`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `module`
--
ALTER TABLE `module`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `person`
--
ALTER TABLE `person`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `person_contact`
--
ALTER TABLE `person_contact`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `poke`
--
ALTER TABLE `poke`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `prospect`
--
ALTER TABLE `prospect`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `supplier`
--
ALTER TABLE `supplier`
 ADD PRIMARY KEY (`ID`), ADD KEY `ID` (`ID`);

--
-- Indexes for table `supplier_address`
--
ALTER TABLE `supplier_address`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `tax_class`
--
ALTER TABLE `tax_class`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `tax_group`
--
ALTER TABLE `tax_group`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `tax_master`
--
ALTER TABLE `tax_master`
 ADD PRIMARY KEY (`ID`,`companyID`), ADD KEY `FK_tax_master_tax_class` (`taxClass`), ADD KEY `FK_tax_master_tax_group` (`taxGroup`), ADD KEY `FK_tax_master_tax_type` (`taxType`);

--
-- Indexes for table `tax_type`
--
ALTER TABLE `tax_type`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `tax_work_footer`
--
ALTER TABLE `tax_work_footer`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `tax_work_gl`
--
ALTER TABLE `tax_work_gl`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `tax_work_header`
--
ALTER TABLE `tax_work_header`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `tax_work_purchase`
--
ALTER TABLE `tax_work_purchase`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `tax_work_sales`
--
ALTER TABLE `tax_work_sales`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `tbl_department`
--
ALTER TABLE `tbl_department`
 ADD PRIMARY KEY (`fldid`);

--
-- Indexes for table `tbl_location`
--
ALTER TABLE `tbl_location`
 ADD PRIMARY KEY (`fldid`);

--
-- Indexes for table `tbl_section`
--
ALTER TABLE `tbl_section`
 ADD PRIMARY KEY (`fldid`);

--
-- Indexes for table `tbl_usermaster`
--
ALTER TABLE `tbl_usermaster`
 ADD PRIMARY KEY (`fldid`), ADD UNIQUE KEY `userid` (`userid`), ADD KEY `Index 3` (`userid`);

--
-- Indexes for table `terms`
--
ALTER TABLE `terms`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `ug_content`
--
ALTER TABLE `ug_content`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `ug_relatedtopic`
--
ALTER TABLE `ug_relatedtopic`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `ug_topic`
--
ALTER TABLE `ug_topic`
 ADD PRIMARY KEY (`fldid`);

--
-- Indexes for table `ug_video`
--
ALTER TABLE `ug_video`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `user`
--
ALTER TABLE `user`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `user_module_access`
--
ALTER TABLE `user_module_access`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `user_module_access_details`
--
ALTER TABLE `user_module_access_details`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `wakaf`
--
ALTER TABLE `wakaf`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `wakaf_acrual`
--
ALTER TABLE `wakaf_acrual`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `wakaf_beneficiaries`
--
ALTER TABLE `wakaf_beneficiaries`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `wakaf_center`
--
ALTER TABLE `wakaf_center`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `wakaf_details_allocation`
--
ALTER TABLE `wakaf_details_allocation`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `wakaf_details_distribution`
--
ALTER TABLE `wakaf_details_distribution`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `wakaf_master`
--
ALTER TABLE `wakaf_master`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `zakat_center`
--
ALTER TABLE `zakat_center`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `zakat_details`
--
ALTER TABLE `zakat_details`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `zakat_group`
--
ALTER TABLE `zakat_group`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `zakat_group_details`
--
ALTER TABLE `zakat_group_details`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `zakat_nisab`
--
ALTER TABLE `zakat_nisab`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `zakat_summary`
--
ALTER TABLE `zakat_summary`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `_log_query`
--
ALTER TABLE `_log_query`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `_ref_acct_group`
--
ALTER TABLE `_ref_acct_group`
 ADD PRIMARY KEY (`ID`), ADD KEY `ID` (`ID`);

--
-- Indexes for table `_ref_acct_type`
--
ALTER TABLE `_ref_acct_type`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `_ref_business_type`
--
ALTER TABLE `_ref_business_type`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `_ref_chart_of_acct`
--
ALTER TABLE `_ref_chart_of_acct`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `_ref_control_acct_setup`
--
ALTER TABLE `_ref_control_acct_setup`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `_ref_country`
--
ALTER TABLE `_ref_country`
 ADD PRIMARY KEY (`fldid`);

--
-- Indexes for table `_ref_currency`
--
ALTER TABLE `_ref_currency`
 ADD PRIMARY KEY (`fldid`);

--
-- Indexes for table `_ref_dateformat`
--
ALTER TABLE `_ref_dateformat`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `_ref_industry`
--
ALTER TABLE `_ref_industry`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `_ref_language`
--
ALTER TABLE `_ref_language`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `_ref_state`
--
ALTER TABLE `_ref_state`
 ADD PRIMARY KEY (`fldid`), ADD KEY `subregion_region_id` (`fldregion_id`);

--
-- Indexes for table `_ref_tax_master`
--
ALTER TABLE `_ref_tax_master`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `_ref_zakat_group`
--
ALTER TABLE `_ref_zakat_group`
 ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `_sys_menu`
--
ALTER TABLE `_sys_menu`
 ADD PRIMARY KEY (`fldid`);

--
-- Indexes for table `_sys_um`
--
ALTER TABLE `_sys_um`
 ADD PRIMARY KEY (`fldid`);

--
-- Indexes for table `_sys_um_conv`
--
ALTER TABLE `_sys_um_conv`
 ADD PRIMARY KEY (`fldid`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `acount_type`
--
ALTER TABLE `acount_type`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `chat`
--
ALTER TABLE `chat`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `chats`
--
ALTER TABLE `chats`
MODIFY `id` int(5) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `ci_users`
--
ALTER TABLE `ci_users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `company`
--
ALTER TABLE `company`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `comp_acct_group_bak`
--
ALTER TABLE `comp_acct_group_bak`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_acct_type`
--
ALTER TABLE `comp_acct_type`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `comp_acc_det`
--
ALTER TABLE `comp_acc_det`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=132;
--
-- AUTO_INCREMENT for table `comp_address`
--
ALTER TABLE `comp_address`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `comp_alert_table`
--
ALTER TABLE `comp_alert_table`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_bank`
--
ALTER TABLE `comp_bank`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `comp_bank_reconcile`
--
ALTER TABLE `comp_bank_reconcile`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_bank_reconcile_track_back`
--
ALTER TABLE `comp_bank_reconcile_track_back`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_budget`
--
ALTER TABLE `comp_budget`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_cash_sales`
--
ALTER TABLE `comp_cash_sales`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_cash_sales_charges`
--
ALTER TABLE `comp_cash_sales_charges`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_cash_sales_detail`
--
ALTER TABLE `comp_cash_sales_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_chart_of_acct`
--
ALTER TABLE `comp_chart_of_acct`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=374;
--
-- AUTO_INCREMENT for table `comp_contact`
--
ALTER TABLE `comp_contact`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_control_acct_setup`
--
ALTER TABLE `comp_control_acct_setup`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=65;
--
-- AUTO_INCREMENT for table `comp_currency_conv`
--
ALTER TABLE `comp_currency_conv`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_delivery_detail`
--
ALTER TABLE `comp_delivery_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=88;
--
-- AUTO_INCREMENT for table `comp_delivery_order`
--
ALTER TABLE `comp_delivery_order`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=88;
--
-- AUTO_INCREMENT for table `comp_employee`
--
ALTER TABLE `comp_employee`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_financial_year`
--
ALTER TABLE `comp_financial_year`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT for table `comp_form_control`
--
ALTER TABLE `comp_form_control`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=43;
--
-- AUTO_INCREMENT for table `comp_gl`
--
ALTER TABLE `comp_gl`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_gst_report`
--
ALTER TABLE `comp_gst_report`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `comp_gst_transaction`
--
ALTER TABLE `comp_gst_transaction`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_gst_transaction_detail`
--
ALTER TABLE `comp_gst_transaction_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_industry`
--
ALTER TABLE `comp_industry`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_item_category`
--
ALTER TABLE `comp_item_category`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `comp_jl_seq`
--
ALTER TABLE `comp_jl_seq`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT for table `comp_journal`
--
ALTER TABLE `comp_journal`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=672;
--
-- AUTO_INCREMENT for table `comp_journal_detail`
--
ALTER TABLE `comp_journal_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2311;
--
-- AUTO_INCREMENT for table `comp_location_transfer`
--
ALTER TABLE `comp_location_transfer`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_location_transfer_detail`
--
ALTER TABLE `comp_location_transfer_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_opening_balance`
--
ALTER TABLE `comp_opening_balance`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_payment`
--
ALTER TABLE `comp_payment`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_payment_detail`
--
ALTER TABLE `comp_payment_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_payment_others`
--
ALTER TABLE `comp_payment_others`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=33;
--
-- AUTO_INCREMENT for table `comp_payment_others_without_item`
--
ALTER TABLE `comp_payment_others_without_item`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=41;
--
-- AUTO_INCREMENT for table `comp_payment_others_with_item`
--
ALTER TABLE `comp_payment_others_with_item`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_project`
--
ALTER TABLE `comp_project`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_purchase_order`
--
ALTER TABLE `comp_purchase_order`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_purchase_order_detail`
--
ALTER TABLE `comp_purchase_order_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_purchase_price`
--
ALTER TABLE `comp_purchase_price`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_quotation`
--
ALTER TABLE `comp_quotation`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_quotation_detail`
--
ALTER TABLE `comp_quotation_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_receive_delivery_conn`
--
ALTER TABLE `comp_receive_delivery_conn`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=115;
--
-- AUTO_INCREMENT for table `comp_receive_item`
--
ALTER TABLE `comp_receive_item`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=181;
--
-- AUTO_INCREMENT for table `comp_receive_item_detail`
--
ALTER TABLE `comp_receive_item_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=182;
--
-- AUTO_INCREMENT for table `comp_receive_payment`
--
ALTER TABLE `comp_receive_payment`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_receive_payment_detail`
--
ALTER TABLE `comp_receive_payment_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_receive_payment_others`
--
ALTER TABLE `comp_receive_payment_others`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=77;
--
-- AUTO_INCREMENT for table `comp_receive_payment_others_detail`
--
ALTER TABLE `comp_receive_payment_others_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=77;
--
-- AUTO_INCREMENT for table `comp_sales_agent`
--
ALTER TABLE `comp_sales_agent`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_sales_bad_debt`
--
ALTER TABLE `comp_sales_bad_debt`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_sales_creditnote`
--
ALTER TABLE `comp_sales_creditnote`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `comp_sales_creditnote_charges`
--
ALTER TABLE `comp_sales_creditnote_charges`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `comp_sales_creditnote_detail`
--
ALTER TABLE `comp_sales_creditnote_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `comp_sales_debitnote`
--
ALTER TABLE `comp_sales_debitnote`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_sales_debitnote_charges`
--
ALTER TABLE `comp_sales_debitnote_charges`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_sales_debitnote_detail`
--
ALTER TABLE `comp_sales_debitnote_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_sales_debt_recover`
--
ALTER TABLE `comp_sales_debt_recover`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_sales_detail`
--
ALTER TABLE `comp_sales_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_sales_invoice`
--
ALTER TABLE `comp_sales_invoice`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=88;
--
-- AUTO_INCREMENT for table `comp_sales_invoice_charges`
--
ALTER TABLE `comp_sales_invoice_charges`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=86;
--
-- AUTO_INCREMENT for table `comp_sales_invoice_detail`
--
ALTER TABLE `comp_sales_invoice_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=88;
--
-- AUTO_INCREMENT for table `comp_sales_order`
--
ALTER TABLE `comp_sales_order`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_sales_price`
--
ALTER TABLE `comp_sales_price`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_so_seq`
--
ALTER TABLE `comp_so_seq`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_supplier_closing`
--
ALTER TABLE `comp_supplier_closing`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_supplier_closing_daily`
--
ALTER TABLE `comp_supplier_closing_daily`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_supplier_creditnote`
--
ALTER TABLE `comp_supplier_creditnote`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `comp_supplier_creditnote_charges`
--
ALTER TABLE `comp_supplier_creditnote_charges`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_supplier_creditnote_detail`
--
ALTER TABLE `comp_supplier_creditnote_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `comp_supplier_debitnote`
--
ALTER TABLE `comp_supplier_debitnote`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT for table `comp_supplier_debitnote_charges`
--
ALTER TABLE `comp_supplier_debitnote_charges`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_supplier_debitnote_detail`
--
ALTER TABLE `comp_supplier_debitnote_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT for table `comp_supplier_invoice`
--
ALTER TABLE `comp_supplier_invoice`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=179;
--
-- AUTO_INCREMENT for table `comp_supplier_invoice_charges`
--
ALTER TABLE `comp_supplier_invoice_charges`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_supplier_invoice_detail`
--
ALTER TABLE `comp_supplier_invoice_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=180;
--
-- AUTO_INCREMENT for table `comp_supplier_statement`
--
ALTER TABLE `comp_supplier_statement`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comp_unpresented_check`
--
ALTER TABLE `comp_unpresented_check`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer`
--
ALTER TABLE `customer`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=87;
--
-- AUTO_INCREMENT for table `customer_address`
--
ALTER TABLE `customer_address`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_contact`
--
ALTER TABLE `customer_contact`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item`
--
ALTER TABLE `item`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=175;
--
-- AUTO_INCREMENT for table `item_adjustment`
--
ALTER TABLE `item_adjustment`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `item_adjustment_detail`
--
ALTER TABLE `item_adjustment_detail`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `item_details`
--
ALTER TABLE `item_details`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=171;
--
-- AUTO_INCREMENT for table `master`
--
ALTER TABLE `master`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=23;
--
-- AUTO_INCREMENT for table `master_code`
--
ALTER TABLE `master_code`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=164;
--
-- AUTO_INCREMENT for table `module`
--
ALTER TABLE `module`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `person`
--
ALTER TABLE `person`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `person_contact`
--
ALTER TABLE `person_contact`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `poke`
--
ALTER TABLE `poke`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `prospect`
--
ALTER TABLE `prospect`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `supplier`
--
ALTER TABLE `supplier`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `supplier_address`
--
ALTER TABLE `supplier_address`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tax_class`
--
ALTER TABLE `tax_class`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tax_group`
--
ALTER TABLE `tax_group`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tax_master`
--
ALTER TABLE `tax_master`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=71;
--
-- AUTO_INCREMENT for table `tax_type`
--
ALTER TABLE `tax_type`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=21;
--
-- AUTO_INCREMENT for table `tax_work_footer`
--
ALTER TABLE `tax_work_footer`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tax_work_gl`
--
ALTER TABLE `tax_work_gl`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tax_work_header`
--
ALTER TABLE `tax_work_header`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tax_work_purchase`
--
ALTER TABLE `tax_work_purchase`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tax_work_sales`
--
ALTER TABLE `tax_work_sales`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tbl_department`
--
ALTER TABLE `tbl_department`
MODIFY `fldid` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `tbl_location`
--
ALTER TABLE `tbl_location`
MODIFY `fldid` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tbl_section`
--
ALTER TABLE `tbl_section`
MODIFY `fldid` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tbl_usermaster`
--
ALTER TABLE `tbl_usermaster`
MODIFY `fldid` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `terms`
--
ALTER TABLE `terms`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `ug_content`
--
ALTER TABLE `ug_content`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=168;
--
-- AUTO_INCREMENT for table `ug_relatedtopic`
--
ALTER TABLE `ug_relatedtopic`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `ug_topic`
--
ALTER TABLE `ug_topic`
MODIFY `fldid` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=339;
--
-- AUTO_INCREMENT for table `ug_video`
--
ALTER TABLE `ug_video`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=64;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user_module_access`
--
ALTER TABLE `user_module_access`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=32;
--
-- AUTO_INCREMENT for table `user_module_access_details`
--
ALTER TABLE `user_module_access_details`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=523;
--
-- AUTO_INCREMENT for table `wakaf`
--
ALTER TABLE `wakaf`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `wakaf_acrual`
--
ALTER TABLE `wakaf_acrual`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `wakaf_beneficiaries`
--
ALTER TABLE `wakaf_beneficiaries`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `wakaf_center`
--
ALTER TABLE `wakaf_center`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `wakaf_details_allocation`
--
ALTER TABLE `wakaf_details_allocation`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `wakaf_details_distribution`
--
ALTER TABLE `wakaf_details_distribution`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `wakaf_master`
--
ALTER TABLE `wakaf_master`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `zakat_center`
--
ALTER TABLE `zakat_center`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT for table `zakat_details`
--
ALTER TABLE `zakat_details`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `zakat_group`
--
ALTER TABLE `zakat_group`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `zakat_group_details`
--
ALTER TABLE `zakat_group_details`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `zakat_nisab`
--
ALTER TABLE `zakat_nisab`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `zakat_summary`
--
ALTER TABLE `zakat_summary`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `_log_query`
--
ALTER TABLE `_log_query`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=14012;
--
-- AUTO_INCREMENT for table `_ref_acct_group`
--
ALTER TABLE `_ref_acct_group`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=45;
--
-- AUTO_INCREMENT for table `_ref_acct_type`
--
ALTER TABLE `_ref_acct_type`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `_ref_business_type`
--
ALTER TABLE `_ref_business_type`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `_ref_chart_of_acct`
--
ALTER TABLE `_ref_chart_of_acct`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1827;
--
-- AUTO_INCREMENT for table `_ref_country`
--
ALTER TABLE `_ref_country`
MODIFY `fldid` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=895;
--
-- AUTO_INCREMENT for table `_ref_currency`
--
ALTER TABLE `_ref_currency`
MODIFY `fldid` int(5) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT for table `_ref_dateformat`
--
ALTER TABLE `_ref_dateformat`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `_ref_industry`
--
ALTER TABLE `_ref_industry`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `_ref_language`
--
ALTER TABLE `_ref_language`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `_ref_state`
--
ALTER TABLE `_ref_state`
MODIFY `fldid` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3880;
--
-- AUTO_INCREMENT for table `_ref_zakat_group`
--
ALTER TABLE `_ref_zakat_group`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `_sys_menu`
--
ALTER TABLE `_sys_menu`
MODIFY `fldid` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=381;
--
-- AUTO_INCREMENT for table `_sys_um`
--
ALTER TABLE `_sys_um`
MODIFY `fldid` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `_sys_um_conv`
--
ALTER TABLE `_sys_um_conv`
MODIFY `fldid` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
