-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 19, 2023 at 12:05 PM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.2.33

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


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

--
-- Database: `empty_demo`
--

DELIMITER $$
--
-- Functions
--
CREATE  FUNCTION `SPLIT_STRING` (`str` VARCHAR(255), `delim` VARCHAR(12), `pos` INT) RETURNS VARCHAR(255) CHARSET utf8 RETURN REPLACE(
	SUBSTRING(
		SUBSTRING_INDEX(str , delim , pos) ,
		CHAR_LENGTH(
			SUBSTRING_INDEX(str , delim , pos - 1)
		) + 1
	) ,
	delim ,
	''
)$$

DELIMITER ;

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

--
-- Table structure for table `tbl_acgroup`
--

CREATE TABLE `tbl_acgroup` (
  `id` int(11) NOT NULL,
  `clsid` int(11) NOT NULL,
  `name` varchar(35) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(250) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_acgroup`
--

INSERT INTO `tbl_acgroup` (`id`, `clsid`, `name`, `bname`, `description`, `uid`, `date`) VALUES
(1, 1, 'Non Current Assets', NULL, '', 1, '2020-04-09 02:06:49'),
(2, 1, 'Current Assets', NULL, '', 1, '2020-04-09 02:07:07'),
(3, 3, 'Owners\' Equity', NULL, '', 1, '2020-04-09 02:08:07'),
(4, 2, 'Non Current Liabilities', NULL, '', 1, '2020-04-09 02:08:38'),
(5, 2, 'Current Liabilities', NULL, '', 1, '2020-04-09 02:08:54'),
(6, 5, 'Operating Revenue', NULL, '', 1, '2020-04-09 02:09:13'),
(7, 5, 'Non Operating Revenue', NULL, '', 1, '2020-04-09 02:09:30'),
(8, 4, 'Direct Expense', NULL, '', 1, '2020-04-09 02:09:49'),
(9, 4, 'Indirect Expenses', NULL, '', 1, '2020-04-09 02:10:10');

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

--
-- Table structure for table `tbl_aclass`
--

CREATE TABLE `tbl_aclass` (
  `id` int(11) NOT NULL,
  `name` varchar(35) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(250) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_aclass`
--

INSERT INTO `tbl_aclass` (`id`, `name`, `bname`, `description`) VALUES
(1, 'Assets', '', 'Accounts represent the different types of economic resources owned or controlled by an entity. Common examples of asset accounts are cash in hand, cash in bank, real estate, inventory, prepaid expenses, goodwill, and accounts receivable.'),
(2, 'Liabilities', '', 'Accounts represent the different types of economic obligations of an entity, such as accounts payable, bank loans, bonds payable, and accrued expenses.'),
(3, 'Owner\'s Equity', '', 'Accounts represent the residual equity of an entity (the value of assets after deducting the value of all liabilities). Equity accounts include common stock, paid-in capital, and retained earnings. The type and captions used for equity accounts are d'),
(4, 'Expenses', '', 'Accounts represent the company\'s expenditures. Common examples are utilities, rents, depreciation, interest, and insurance.'),
(5, 'Revenue', '', 'Accounts represent the company\'s earnings and common examples include sales, service revenue and interest income.');

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

--
-- Table structure for table `tbl_acledger`
--

CREATE TABLE `tbl_acledger` (
  `id` int(11) NOT NULL,
  `code` varchar(15) NOT NULL,
  `grid` int(11) NOT NULL,
  `sgrid` int(11) DEFAULT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(250) NOT NULL,
  `status` int(1) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_acledger`
--

INSERT INTO `tbl_acledger` (`id`, `code`, `grid`, `sgrid`, `name`, `bname`, `description`, `status`, `uid`, `date`) VALUES
(1, '200001', 2, 1, 'Petty Cash', NULL, 'Every Days Official Expenses Amount', 0, 1, '2020-04-22 12:22:21'),
(2, '200002', 2, 1, 'Cash', NULL, 'Income Form Sales Or Other Income', 1, 1, '2020-04-22 12:23:22'),
(3, '100001', 1, 6, 'Service Tools &amp; Equipment', NULL, '', 1, 1, '2020-04-22 12:30:58'),
(4, '100002', 1, 6, 'Furniture, Fixture &amp; Interiors', NULL, '', 0, 1, '2020-04-22 12:33:37'),
(5, '300001', 3, 30, 'Capital', NULL, '', 1, 1, '2020-04-22 12:41:21'),
(6, '300002', 3, 31, 'Cash Withdrawal', NULL, '', 1, 1, '2020-04-22 12:41:42'),
(7, '300003', 3, 32, 'Retained Earnings', NULL, '', 1, 1, '2020-04-22 12:42:12'),
(8, '300004', 3, 32, 'VAT Reimbursement Account', NULL, '', 0, 1, '2020-04-22 12:43:15'),
(9, '500001', 5, 14, 'VAT On Commission Payable', NULL, '', 0, 1, '2020-04-22 12:44:09'),
(10, '500002', 5, 14, 'VAT On Sales Payable', NULL, '', 0, 1, '2020-04-22 12:44:48'),
(11, '700001', 7, 27, 'Interest On FDR', NULL, '', 0, 1, '2020-04-22 12:46:31'),
(12, '700002', 7, 28, 'Freight Receipt', NULL, '', 0, 1, '2020-04-22 12:47:09'),
(13, '900021', 9, 21, 'Bank Charges', 'ব্যাংক চার্জ', '', 1, 1, '2020-04-22 12:48:48'),
(14, '600001', 6, 25, 'Cost Of Good Sold', 'Cost Of Good Sold', 'Cost Of Good Sold', 1, 1, '2023-05-20 11:05:16'),
(15, '900032', 9, 21, 'Telephones &amp; Mobile Bill', 'টেলিফোন এবং মোবাইল বিল', '', 1, 1, '2020-04-22 12:48:04'),
(16, '900022', 9, 21, 'Electricity Bills', 'বিদ্যুৎ বিল', '', 0, 1, '2020-04-22 12:48:32'),
(17, '900023', 9, 21, 'Food, Lunch &amp; Entertainments', 'খাবার, দুপুরের খাবার এবং অন্যান্য', '', 0, 1, '2020-04-22 12:48:49'),
(18, '500007', 5, 39, 'Supplier Opening Balance', NULL, '', 1, 1, '2020-04-22 12:49:09'),
(19, '900019', 9, 21, 'Conveyances', 'যাতায়াত খরচ', '', 1, 1, '2020-04-22 12:49:41'),
(20, '900027', 9, 21, 'Office Stationeries', 'কার্যালয়ের নিশ্চল খরচ', '', 1, 1, '2020-04-22 12:50:34'),
(21, '900020', 9, 21, 'Internet &amp; IT Expenses', 'ইন্টারনেট ও আইটির খরচ', '', 0, 1, '2020-04-22 12:50:56'),
(22, '900034', 9, 21, 'Sundry Expenses', 'বিবিধ খরচ', '', 1, 1, '2020-04-22 12:51:20'),
(23, '900025', 9, 21, 'Licences &amp; Renewals', 'লাইছেঞ্ছ নবায়ন খরচ', '', 0, 1, '2020-04-22 12:51:43'),
(24, '900029', 9, 21, 'Sales Commission', 'বিক্রয় কমিশন', '', 0, 1, '2020-04-22 12:52:17'),
(25, '800015', 8, 20, 'VAT On Purchase', 'ক্রয়ের উপর ভ্যাট', '', 0, 1, '2020-04-22 12:53:00'),
(26, '800014', 8, 20, 'Tax On Purchase', 'ক্রয়ের উপর ট্যাক্স', '', 1, 1, '2020-04-22 12:53:14'),
(27, '800013', 8, 20, 'Other Direct Expenses', 'অন্যান্য পরিচালন খরচ', '', 0, 1, '2020-04-22 12:53:29'),
(28, '900033', 9, 21, 'Tips &amp; Donations', 'টিপস এবং ডোনেশন', '', 1, 1, '2020-04-22 12:54:02'),
(29, '900028', 9, 21, 'Personal Expenses', 'ব্যাক্তিগত খরচ', 'All personal Expenses of Owner', 0, 1, '2020-04-22 12:54:48'),
(30, '900024', 9, 21, 'Home Delivery', 'হোম ডেলিভারি', '', 0, 1, '2020-04-22 01:08:31'),
(31, '900026', 9, 21, 'Office Rent', 'কার্যালয়ের ভাড়া', '', 0, 1, '2020-04-27 10:35:17'),
(32, '700003', 7, 26, 'Commission Income', NULL, '', 1, 1, '2020-04-27 10:45:27'),
(33, '100003', 1, 12, 'Customer Opening Balance', NULL, '', 1, 1, '2020-04-27 10:54:57'),
(34, '600002', 6, 23, 'Sales Revenue', NULL, '', 0, 1, '2020-04-28 02:20:11'),
(36, '800010', 8, 20, 'Discount On Sales', 'বিক্রয়ের ডিসকাউন্ট', '', 0, 1, '2020-06-11 07:58:38'),
(37, '800009', 8, 20, 'Discount On Item', 'আইটেমে ডিসকাউন্ট', '', 0, 1, '2020-06-11 08:00:10'),
(38, '500003', 5, 14, 'AIT On Sales Payable', NULL, '', 1, 1, '2020-06-11 08:03:40'),
(39, '700004', 7, 28, 'Service Charges Receipts', NULL, '', 0, 1, '2020-06-11 08:06:32'),
(40, '800011', 8, 20, 'Less Given On Sales', 'বিক্রয়ের উপর কমিশন', '', 0, 1, '2020-06-11 08:09:58'),
(41, '500005', 5, 16, 'Discount Reserves On Purchase', NULL, '', 0, 1, '2020-06-16 11:25:15'),
(42, '500004', 5, 16, 'Discount Item On Purchase', NULL, '', 0, 1, '2020-06-16 11:25:59'),
(43, '700007', 7, 28, 'Less Paid On Purchase', NULL, '', 0, 1, '2020-06-16 11:29:10'),
(44, '900018', 9, 21, 'Labour &amp; Transportation', 'লেবার এবং ট্রান্সপোর্টেশন', '', 0, 1, '2020-06-16 11:41:50'),
(45, '800012', 8, 20, 'Less Receive On Purchase Return', 'ক্রয়কৃত পন্য ফেরতের উপর ছাড়', '', 0, 1, '2020-06-17 02:56:32'),
(46, '700008', 7, 28, 'Less Paid On Sales Return', NULL, '', 0, 1, '2020-06-17 11:29:43'),
(48, '800018', 8, 20, 'Salaries,Wages And Allowance', NULL, 'Employee Salary', 0, 1, '2020-07-23 11:01:51'),
(49, '800016', 8, 20, 'Product Adjustment', NULL, 'Product witch are damage, stolen, miss use etc...', 0, 1, '2020-08-25 01:35:32'),
(50, '800017', 8, 20, 'Cost Of Goods Damage', NULL, '', 1, 1, '2020-08-25 02:13:42'),
(51, '600003', 6, 38, 'Damage Revenue', NULL, 'Product witch are damage, stolen, miss use etc...', 0, 1, '2020-08-25 02:28:47'),
(54, '900036', 9, 21, 'Entertainment', NULL, '', 0, 1, '2020-11-12 07:46:54');

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

--
-- Table structure for table `tbl_acmobile`
--

CREATE TABLE `tbl_acmobile` (
  `id` int(11) NOT NULL,
  `name` varchar(25) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `mobile` varchar(18) NOT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_acsubgroup`
--

CREATE TABLE `tbl_acsubgroup` (
  `id` int(11) NOT NULL,
  `grid` int(11) NOT NULL,
  `name` varchar(35) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(250) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_acsubgroup`
--

INSERT INTO `tbl_acsubgroup` (`id`, `grid`, `name`, `bname`, `description`, `uid`, `date`) VALUES
(1, 2, 'Cash In Hand', NULL, '', 1, '2020-04-09 03:07:03'),
(2, 2, 'Cash At Bank', NULL, '', 1, '2020-04-09 03:07:36'),
(3, 2, 'Inventory', NULL, 'All Kind Of Purchase Product', 1, '2020-04-09 03:19:39'),
(4, 2, 'Account Receivables', NULL, '', 1, '2020-04-21 08:51:00'),
(5, 2, 'Other Current Assets', NULL, '', 1, '2020-04-21 08:52:10'),
(6, 1, 'Fixed Assets', NULL, '', 1, '2020-04-21 08:54:06'),
(7, 1, 'Investments', NULL, '', 1, '2020-04-21 09:01:44'),
(8, 1, 'Advances, Deposits &amp; Prepayment', NULL, '', 1, '2020-04-21 09:02:06'),
(9, 1, 'Intangible Assets', NULL, '', 1, '2020-04-21 09:02:32'),
(10, 1, 'Tangible Asset', NULL, '', 1, '2020-04-21 09:05:15'),
(11, 1, 'Other Non Current Assets', NULL, '', 1, '2020-04-21 09:05:44'),
(12, 1, 'Customer Previous Balance', NULL, '', 1, '2020-04-21 09:08:59'),
(13, 5, 'Account Payable', NULL, '', 1, '2020-04-21 09:10:38'),
(14, 5, 'Liability For Expenses', NULL, '', 1, '2020-04-21 09:11:58'),
(15, 5, 'Liability For Other Finance', NULL, '', 1, '2020-04-21 09:12:22'),
(16, 5, 'Other Current Liabilities', NULL, '', 1, '2020-04-21 09:12:47'),
(17, 4, 'Long Term Borrowings', NULL, '', 1, '2020-04-21 09:13:45'),
(18, 4, 'Institutional Borrowings', NULL, '', 1, '2020-04-21 09:15:54'),
(19, 4, 'Other Non Current Liabilities', NULL, '', 1, '2020-04-21 09:21:52'),
(20, 8, 'Operating Expenses', NULL, '', 1, '2020-04-21 09:23:30'),
(21, 9, 'Administrative Expenses', NULL, '', 1, '2020-04-21 09:25:41'),
(22, 9, 'Selling Expenses', NULL, '', 1, '2020-04-21 09:25:58'),
(23, 6, 'Goods Sales', NULL, '', 1, '2020-04-21 09:29:07'),
(24, 6, 'Other Operating Sales', NULL, '', 1, '2020-04-21 09:31:58'),
(25, 6, 'Cost Of Goods Sold', NULL, '', 1, '2020-04-21 09:39:26'),
(26, 7, 'Service Income', NULL, '', 1, '2020-04-21 09:39:56'),
(27, 7, 'Interest Income', NULL, '', 1, '2020-04-21 09:40:18'),
(28, 7, 'Other Income', NULL, '', 1, '2020-04-21 09:43:05'),
(29, 7, 'Incentive Income', NULL, '', 1, '2020-04-21 09:43:24'),
(30, 3, 'Share Capital', NULL, '', 1, '2020-04-21 09:44:27'),
(31, 3, 'Drawings', NULL, '', 1, '2020-04-21 09:44:58'),
(32, 3, 'Reserves &amp; Surplus', NULL, '', 1, '2020-04-21 09:45:33'),
(33, 5, 'Salaries,Wages &amp; Allowance Paya', NULL, '', 1, '2020-04-21 10:26:31'),
(34, 2, 'Cash At Mobile Account', NULL, '', 1, '2020-06-13 06:45:20'),
(35, 4, 'Bank &amp; Over Draft', NULL, '', 1, '2020-06-13 09:35:22'),
(36, 4, 'Other Loan &amp; Mortgage', NULL, '', 1, '2020-06-13 09:35:37'),
(37, 8, 'Product Adjust', NULL, '', 1, '2020-08-25 02:12:43'),
(38, 6, 'Damage Recover', NULL, '', 1, '2020-08-25 02:26:35'),
(39, 5, 'Supplier Previous Balance', NULL, '', 1, '2022-12-22 12:57:18');

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

--
-- Table structure for table `tbl_activity`
--

CREATE TABLE `tbl_activity` (
  `id` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `filds` varchar(3) NOT NULL,
  `title` varchar(45) NOT NULL,
  `btitle` varchar(120) DEFAULT NULL,
  `activity` varchar(350) NOT NULL,
  `bactivity` varchar(650) DEFAULT NULL,
  `acdtime` datetime NOT NULL,
  `brid` int(11) NOT NULL,
  `ip` varchar(20) DEFAULT NULL,
  `mac` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_activity`
--

INSERT INTO `tbl_activity` (`id`, `uid`, `filds`, `title`, `btitle`, `activity`, `bactivity`, `acdtime`, `brid`, `ip`, `mac`) VALUES
(1, 1, 'LOG', 'Login Record', 'লগইন রেকর্ড', 'Successfully login.', 'প্রবেশ সফল হয়েছে।', '2023-06-19 16:01:25', 0, '::1', '00-FF-69-A5-77-72'),
(2, 1, 'ROL', 'User Role has been deleted', NULL, 'Role name: Tafsin Sanjid Turan', NULL, '2023-06-19 16:04:04', 0, '::1', '00-FF-69-A5-77-72'),
(3, 1, 'ROL', 'User Role has been deleted', NULL, 'Role name: Admin', NULL, '2023-06-19 16:04:08', 0, '::1', '00-FF-69-A5-77-72');

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

--
-- Table structure for table `tbl_bacount`
--

CREATE TABLE `tbl_bacount` (
  `id` int(11) NOT NULL,
  `bid` int(11) NOT NULL,
  `branch` varchar(45) DEFAULT NULL,
  `bbranch` varchar(255) DEFAULT NULL,
  `acno` varchar(25) NOT NULL,
  `title` varchar(45) NOT NULL,
  `location` varchar(250) NOT NULL,
  `brcode` varchar(6) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_badstockclaim`
--

CREATE TABLE `tbl_badstockclaim` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `type` varchar(2) NOT NULL,
  `supid` int(11) NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `note` varchar(255) NOT NULL,
  `apdate` date NOT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_bank`
--

CREATE TABLE `tbl_bank` (
  `id` int(11) NOT NULL,
  `sort` varchar(6) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_bank`
--

INSERT INTO `tbl_bank` (`id`, `sort`, `name`, `bname`, `uid`, `date`) VALUES
(1, 'DBBL', 'Dutch-Bangla Bank Ltd.', NULL, 1, '2020-09-21 04:39:03'),
(2, 'IBL', 'Islami Bank Ltd.', NULL, 1, '2020-09-21 04:39:40'),
(3, 'BA', 'BANK ASIA ', NULL, 1, '2020-11-12 04:27:07'),
(4, 'NCC', 'NCC Bank', NULL, 1, '2020-12-17 04:06:03'),
(5, 'HSBC', 'HSBC', NULL, 1, '2021-01-04 04:19:17'),
(6, 'BRC', 'Brack', NULL, 1, '2021-01-06 01:02:18');

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

--
-- Table structure for table `tbl_banktra`
--

CREATE TABLE `tbl_banktra` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `note` varchar(150) DEFAULT NULL,
  `amount` double(12,2) NOT NULL,
  `apdate` date NOT NULL,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_banktrade`
--

CREATE TABLE `tbl_banktrade` (
  `id` int(11) NOT NULL,
  `seid` int(11) NOT NULL,
  `brid` int(11) DEFAULT 0,
  `cid` int(11) NOT NULL,
  `cty` varchar(2) NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `did` int(11) NOT NULL,
  `dty` varchar(2) NOT NULL,
  `cheno` varchar(20) DEFAULT NULL,
  `chedt` date DEFAULT NULL,
  `chest` int(11) DEFAULT NULL,
  `ref` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_branch`
--

CREATE TABLE `tbl_branch` (
  `id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `address` varchar(250) NOT NULL,
  `baddress` varchar(350) DEFAULT NULL,
  `phone` varchar(18) NOT NULL,
  `email` varchar(45) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_brand`
--

CREATE TABLE `tbl_brand` (
  `id` int(11) NOT NULL,
  `name` varchar(35) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Stand-in structure for view `tbl_brstock`
-- (See below for the actual view)
--
CREATE TABLE `tbl_brstock` (
`brid` int(11)
,`pid` int(11)
,`name` varchar(65)
,`bname` varchar(255)
,`pcode` varchar(15)
,`image` varchar(50)
,`catid` int(11)
,`scatid` int(11)
,`brnid` int(11)
,`apdate` date
,`colid` int(11)
,`sizid` int(11)
,`unqid` varchar(15)
,`code` varchar(15)
,`poqty` double
,`pqty` double
,`prqty` double
,`rcvqty` double
,`senqty` double
,`avpqty` double
,`soqty` double
,`sold` double
,`sloc` double
,`srqty` double
,`woqty` double
,`wrqty` double
,`fsqty` double
,`adjqty` double
,`avqty` double
,`status` int(1)
);

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

--
-- Table structure for table `tbl_cashflow`
--

CREATE TABLE `tbl_cashflow` (
  `id` int(11) NOT NULL,
  `particular` varchar(45) DEFAULT NULL,
  `pino` varchar(25) DEFAULT NULL,
  `invno` varchar(25) DEFAULT NULL,
  `remarks` varchar(35) DEFAULT NULL,
  `note` varchar(250) DEFAULT NULL,
  `debit` decimal(12,2) NOT NULL DEFAULT 0.00,
  `credit` decimal(12,2) NOT NULL DEFAULT 0.00,
  `apdate` date NOT NULL,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_category`
--

CREATE TABLE `tbl_category` (
  `id` int(11) NOT NULL,
  `pid` int(11) DEFAULT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_cgroup`
--

CREATE TABLE `tbl_cgroup` (
  `id` int(11) NOT NULL,
  `name` varchar(35) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_chat`
--

CREATE TABLE `tbl_chat` (
  `id` int(11) NOT NULL,
  `joined` datetime NOT NULL,
  `online` tinyint(4) NOT NULL DEFAULT 1,
  `last_acive` datetime NOT NULL,
  `status` enum('0','1','2') NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_chat`
--

INSERT INTO `tbl_chat` (`id`, `joined`, `online`, `last_acive`, `status`) VALUES
(1, '2020-10-16 12:22:47', 1, '2021-03-21 18:17:42', '0');

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

--
-- Table structure for table `tbl_cheqman`
--

CREATE TABLE `tbl_cheqman` (
  `id` int(11) NOT NULL,
  `clientid` int(11) DEFAULT NULL,
  `type` varchar(2) DEFAULT NULL,
  `chkno` varchar(30) NOT NULL,
  `chkdt` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `acid` int(11) DEFAULT NULL,
  `refinv` varchar(30) DEFAULT NULL,
  `chbnkid` int(11) DEFAULT NULL,
  `note` varchar(255) DEFAULT NULL,
  `ref` varchar(255) DEFAULT NULL,
  `paymod` varchar(5) DEFAULT NULL,
  `status` int(11) DEFAULT NULL,
  `apdate` datetime NOT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_color`
--

CREATE TABLE `tbl_color` (
  `id` int(11) NOT NULL,
  `name` varchar(25) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `sval` varchar(12) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_color`
--

INSERT INTO `tbl_color` (`id`, `name`, `bname`, `sval`, `uid`, `date`) VALUES
(1, 'Green', NULL, '#06e013', 1, '2020-04-10 11:14:49'),
(2, 'Red', NULL, '#f30c03', 1, '2020-04-10 11:16:11'),
(4, 'White', NULL, '#ffffff', 1, '2020-04-15 09:34:10'),
(5, 'Blue', NULL, '#0000ff', 1, '2020-04-15 09:34:57'),
(6, 'Lime', NULL, '#00ff00', 1, '2020-04-15 09:35:41'),
(7, 'Black', NULL, '#000000', 1, '2020-04-15 09:36:15');

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

--
-- Table structure for table `tbl_company`
--

CREATE TABLE `tbl_company` (
  `id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `dialog` varchar(150) DEFAULT NULL,
  `bdialog` varchar(350) DEFAULT NULL,
  `mobile` varchar(18) NOT NULL,
  `phone` varchar(15) DEFAULT NULL,
  `fax` varchar(15) DEFAULT NULL,
  `email` varchar(45) DEFAULT NULL,
  `web` varchar(35) DEFAULT NULL,
  `tin` varchar(15) DEFAULT NULL,
  `vat` varchar(15) DEFAULT NULL,
  `address` varchar(250) DEFAULT NULL,
  `baddress` varchar(350) DEFAULT NULL,
  `logo` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_company`
--

INSERT INTO `tbl_company` (`id`, `name`, `bname`, `dialog`, `bdialog`, `mobile`, `phone`, `fax`, `email`, `web`, `tin`, `vat`, `address`, `baddress`, `logo`) VALUES
(1, 'Axes Business ', 'এক্সেস গ্লোবাল টেকনোলজি', 'A Comprehensive thought together, for better and individual growth.', NULL, '01920729893', '01303971179', '', 'axesbusinessautomation@gmail.com', 'http://www.axesgl.com', '10-09-xxxxx', '', '820, Mokkah Tower, Shewrapara, Mirpur, Dhaka.', '৮২০, মক্কাহ তাওার, শ্যাওড়াপাড়া, মিরপুর, ঢাকা।', 'SAVE_20230302_140116_1683702482.jpg');

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

--
-- Stand-in structure for view `tbl_comstock`
-- (See below for the actual view)
--
CREATE TABLE `tbl_comstock` (
`pid` int(11)
,`name` varchar(65)
,`bname` varchar(255)
,`code` varchar(15)
,`image` varchar(50)
,`poqty` double
,`pqty` double
,`prqty` double
,`soqty` double
,`sold` double
,`srqty` double
,`adjqty` double
,`sloc` double
,`avqty` double
);

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

--
-- Table structure for table `tbl_country`
--

CREATE TABLE `tbl_country` (
  `id` int(11) NOT NULL,
  `name` varchar(65) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(350) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_country`
--

INSERT INTO `tbl_country` (`id`, `name`, `bname`, `description`, `uid`, `date`) VALUES
(1, 'Bangladesh', NULL, 'Bangladesh, to the east of India on the Bay of Bengal, is a South Asian country marked by lush greenery and many waterways. Its Padma (Ganges), Meghna and Jamuna rivers create fertile plains, and travel by boat is common. On the southern coast, the Sundarbans, an enormous mangrove forest shared with Eastern India, is home to the royal Bengal tiger.', 1, '2020-04-10 11:56:30'),
(2, 'China', NULL, 'China, officially the People\'s Republic of China, is a country in East Asia. It is the world\'s most populous country, with a population of around 1.428 billion in 2017. Covering approximately 9,600,000 square kilometers, it is the world\'s third-largest country by area.', 1, '2020-04-10 11:57:28'),
(3, 'Singapore', NULL, 'Singapore, an island city-state off southern Malaysia, is a global financial center with a tropical climate and multicultural population. Its colonial core centers on the Padang, a cricket field since the 1830s and now flanked by grand buildings such as City Hall, with its 18 Corinthian columns. ', 1, '2020-04-10 11:58:14'),
(4, 'United States', NULL, 'The U.S. is a country of 50 states covering a vast swath of North America, with Alaska in the northwest and Hawaii extending the nation’s presence into the Pacific Ocean. Major Atlantic Coast cities are New York, a global finance and culture center, and capital Washington, DC.', 1, '2020-04-10 11:59:11'),
(5, 'Taiwan', NULL, 'Taiwan, officially the Republic of China, is a state in East Asia. Neighboring states include the People\'s Republic of China to the north-west, Japan to the north-east, and the Philippines to the south.', 1, '2020-04-10 12:10:19'),
(6, 'Hong Kong', NULL, 'Hong Kong, officially the Hong Kong Special Administrative Region of the People\'s Republic of China, is a city and special administrative region of China in the eastern Pearl River Delta by the South China Sea.', 1, '2020-04-10 12:16:31'),
(8, 'Japan', NULL, '', 1, '2020-11-05 09:09:43'),
(9, 'Austria', NULL, '', 1, '2020-11-05 09:10:03');

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

--
-- Table structure for table `tbl_currency`
--

CREATE TABLE `tbl_currency` (
  `id` int(11) NOT NULL,
  `name` varchar(25) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `sortn` varchar(4) NOT NULL,
  `symbol` varchar(12) NOT NULL,
  `xrate` decimal(10,2) NOT NULL,
  `status` int(11) NOT NULL DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_currency`
--

INSERT INTO `tbl_currency` (`id`, `name`, `bname`, `sortn`, `symbol`, `xrate`, `status`, `uid`, `date`) VALUES
(1, 'Taka', 'টাকা', 'BDT', '৳', '1.00', 1, 1, '2020-04-09 08:56:40'),
(2, 'US Dollar', 'ইউ এস ডলার', 'USD', '$', '82.60', 0, 1, '2020-04-10 12:23:46'),
(3, 'Japan Yen', 'ইয়েন', 'JPY', '¥', '0.78', 0, 1, '2020-04-10 12:35:58'),
(4, 'Chinese Yuan', 'চাইনা ইউয়ান', 'CNY', '¥', '12.06', 0, 1, '2020-04-10 12:39:02'),
(5, 'Ringgit', 'রিংগিট', 'MYR', 'RM', '19.60', 0, 1, '2020-04-10 12:40:12'),
(6, ' Pound', 'পাউন্ড', 'GBP', '£', '105.83', 0, 1, '2020-04-10 12:41:30'),
(7, 'Euro', 'ইওরো', 'EUR', '€', '92.84', 0, 1, '2020-04-10 12:42:38'),
(8, 'Canadian Dollar', 'কানাডা ডলার', 'CAD', 'C$', '60.61', 0, 1, '2020-04-10 12:45:01');

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

--
-- Stand-in structure for view `tbl_cusbalance`
-- (See below for the actual view)
--
CREATE TABLE `tbl_cusbalance` (
`id` int(11)
,`name` varchar(45)
,`code` varchar(15)
,`did` int(11)
,`zid` int(11)
,`cnumber` varchar(18)
,`cemail` varchar(45)
,`address` varchar(200)
,`debit` double
,`credit` double
);

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

--
-- Stand-in structure for view `tbl_cuscredit`
-- (See below for the actual view)
--
CREATE TABLE `tbl_cuscredit` (
`id` varchar(21)
,`credit` double
);

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

--
-- Stand-in structure for view `tbl_cusdebit`
-- (See below for the actual view)
--
CREATE TABLE `tbl_cusdebit` (
`id` varchar(21)
,`debit` double
);

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

--
-- Table structure for table `tbl_customer`
--

CREATE TABLE `tbl_customer` (
  `id` int(11) NOT NULL,
  `gid` int(11) DEFAULT NULL,
  `code` varchar(15) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `cperson` varchar(45) DEFAULT NULL,
  `bcperson` varchar(255) DEFAULT NULL,
  `mname` varchar(45) DEFAULT NULL,
  `cnumber` varchar(18) NOT NULL,
  `cphone` varchar(14) DEFAULT NULL,
  `cemail` varchar(45) DEFAULT NULL,
  `nid` varchar(20) DEFAULT NULL,
  `creditlimit` double DEFAULT 0,
  `crepreiod` int(11) NOT NULL DEFAULT 0,
  `address` varchar(200) DEFAULT NULL,
  `baddress` varchar(350) DEFAULT NULL,
  `saddress` varchar(200) DEFAULT NULL,
  `did` int(11) DEFAULT NULL,
  `zid` int(11) DEFAULT NULL,
  `rank` int(11) DEFAULT NULL,
  `status` int(1) NOT NULL DEFAULT 1,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_delivery`
--

CREATE TABLE `tbl_delivery` (
  `id` int(11) NOT NULL,
  `pino` varchar(25) DEFAULT NULL,
  `invno` varchar(25) NOT NULL,
  `esddate` date NOT NULL,
  `esadate` date NOT NULL,
  `blno` varchar(25) NOT NULL,
  `carrier` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

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

CREATE TABLE `tbl_department` (
  `id` int(11) NOT NULL,
  `name` varchar(35) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(350) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_designation`
--

CREATE TABLE `tbl_designation` (
  `id` int(11) NOT NULL,
  `name` varchar(35) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(350) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_disposal`
--

CREATE TABLE `tbl_disposal` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `brwh` varchar(1) NOT NULL,
  `ibrid` int(11) NOT NULL,
  `type` varchar(2) DEFAULT NULL,
  `cusid` int(11) DEFAULT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `mobile` varchar(18) DEFAULT NULL,
  `dtotal` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `note` varchar(350) NOT NULL,
  `apdate` date NOT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_district`
--

CREATE TABLE `tbl_district` (
  `id` int(11) NOT NULL,
  `cid` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_district`
--

INSERT INTO `tbl_district` (`id`, `cid`, `name`, `bname`, `uid`, `date`) VALUES
(1, 1, 'Barguna', NULL, 6, '2020-07-12 03:11:57'),
(2, 1, 'Barisal', NULL, 6, '2020-07-12 03:12:22'),
(3, 1, 'Bhola', NULL, 6, '2020-07-12 03:12:46'),
(4, 1, 'Jhalokati', NULL, 6, '2020-07-12 03:13:17'),
(5, 1, 'Patuakhali', NULL, 6, '2020-07-12 03:13:45'),
(6, 1, 'Pirojpur', NULL, 6, '2020-07-12 03:14:11'),
(7, 1, 'Bandarban', NULL, 6, '2020-07-12 03:14:38'),
(8, 1, 'Brahmanbaria', NULL, 6, '2020-07-12 03:15:54'),
(9, 1, 'Chandpur', NULL, 6, '2020-07-12 03:16:26'),
(10, 1, 'Chittagong', NULL, 6, '2020-07-12 03:16:55'),
(11, 1, 'Comilla', NULL, 6, '2020-07-12 03:17:34'),
(12, 1, 'Cox\'s Bazar', NULL, 6, '2020-07-12 03:18:03'),
(13, 1, 'Feni', NULL, 6, '2020-07-12 03:18:29'),
(14, 1, 'Khagrachhari', NULL, 6, '2020-07-12 03:18:55'),
(15, 1, 'Lakshmipur', NULL, 6, '2020-07-12 03:19:19'),
(16, 1, 'Noakhali', NULL, 6, '2020-07-12 03:19:43'),
(17, 1, 'Rangamati', NULL, 6, '2020-07-12 03:20:13'),
(18, 1, 'Dhaka', NULL, 6, '2020-07-12 03:20:37'),
(19, 1, 'Faridpur', NULL, 6, '2020-07-12 03:20:57'),
(20, 1, 'Gazipur', NULL, 6, '2020-07-12 03:21:16'),
(21, 1, 'Gopalganj', NULL, 6, '2020-07-12 03:21:40'),
(22, 1, 'Kishoreganj', NULL, 6, '2020-07-12 03:22:20'),
(23, 1, 'Madaripur', NULL, 6, '2020-07-12 03:23:29'),
(24, 1, 'Manikganj', NULL, 6, '2020-07-12 03:23:56'),
(25, 1, 'Munshiganj', NULL, 6, '2020-07-12 03:24:17'),
(26, 1, 'Narayanganj', NULL, 6, '2020-07-12 03:24:37'),
(27, 1, 'Narsingdi ', NULL, 6, '2020-07-12 03:25:07'),
(28, 1, 'Rajbari', NULL, 6, '2020-07-12 03:25:31'),
(29, 1, 'Shariatpur', NULL, 6, '2020-07-12 03:25:58'),
(30, 1, 'Tangail', NULL, 6, '2020-07-12 03:28:13'),
(31, 1, 'Bagerhat', NULL, 6, '2020-07-12 03:28:36'),
(32, 1, 'Chuadanga', NULL, 6, '2020-07-12 03:29:16'),
(33, 1, 'Jessore', NULL, 6, '2020-07-12 03:30:02'),
(34, 1, 'Jhenaidah', NULL, 6, '2020-07-12 03:30:32'),
(35, 1, 'Khulna', NULL, 6, '2020-07-12 03:30:56'),
(36, 1, 'Kushtia', NULL, 6, '2020-07-12 03:31:37'),
(37, 1, 'Magura', NULL, 6, '2020-07-12 03:31:59'),
(38, 1, 'Meherpur', NULL, 6, '2020-07-12 03:32:20'),
(39, 1, 'Narail', NULL, 6, '2020-07-12 03:33:03'),
(40, 1, 'Satkhira', NULL, 6, '2020-07-12 03:33:32'),
(41, 1, 'Jamalpur', NULL, 6, '2020-07-12 03:33:53'),
(42, 1, 'Mymensingh', NULL, 6, '2020-07-12 03:34:12'),
(43, 1, 'Netrokona', NULL, 6, '2020-07-12 03:34:30'),
(44, 1, 'Sherpur', NULL, 6, '2020-07-12 03:34:49'),
(45, 1, 'Bogra', NULL, 6, '2020-07-12 03:35:07'),
(46, 1, 'Joypurhat', NULL, 6, '2020-07-12 03:35:32'),
(47, 1, 'Naogaon', NULL, 6, '2020-07-12 03:35:56'),
(48, 1, 'Natore', NULL, 6, '2020-07-12 03:36:19'),
(49, 1, 'Chapainawabganj', NULL, 6, '2020-07-12 03:36:50'),
(50, 1, 'Pabna', NULL, 6, '2020-07-12 03:37:05'),
(51, 1, 'Rajshahi', NULL, 6, '2020-07-12 03:37:27'),
(52, 1, 'Sirajgonj', NULL, 6, '2020-07-12 03:37:50'),
(53, 1, 'Dinajpur', NULL, 6, '2020-07-12 03:38:09'),
(54, 1, 'Gaibandha', NULL, 6, '2020-07-12 03:38:36'),
(55, 1, 'Kurigram', NULL, 6, '2020-07-12 03:38:58'),
(56, 1, 'Lalmonirhat', NULL, 6, '2020-07-12 03:39:21'),
(57, 1, 'Nilphamari', NULL, 6, '2020-07-12 03:39:43'),
(58, 1, 'Panchagarh', NULL, 6, '2020-07-12 03:40:28'),
(59, 1, 'Rangpur', NULL, 6, '2020-07-12 03:40:57'),
(60, 1, 'Thakurgaon', NULL, 6, '2020-07-12 03:41:20'),
(61, 1, 'Habiganj', NULL, 6, '2020-07-12 03:41:40'),
(62, 1, 'Moulvibazar', NULL, 6, '2020-07-12 03:42:09'),
(63, 1, 'Sunamganj', NULL, 6, '2020-07-12 03:42:33'),
(64, 1, 'Sylhet', NULL, 6, '2020-07-12 03:42:56');

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

--
-- Table structure for table `tbl_employe`
--

CREATE TABLE `tbl_employe` (
  `id` int(11) NOT NULL,
  `dipid` int(11) NOT NULL,
  `desid` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `bfname` varchar(255) DEFAULT NULL,
  `fname` varchar(45) DEFAULT NULL,
  `mname` varchar(45) DEFAULT NULL,
  `bmname` varchar(255) DEFAULT NULL,
  `dob` date NOT NULL,
  `job` date NOT NULL,
  `code` varchar(8) NOT NULL,
  `salary` decimal(10,2) NOT NULL,
  `address` varchar(250) DEFAULT NULL,
  `baddress` varchar(350) DEFAULT NULL,
  `paddress` varchar(250) DEFAULT NULL,
  `bpaddress` varchar(350) DEFAULT NULL,
  `mobile` varchar(18) NOT NULL,
  `phone` varchar(18) DEFAULT NULL,
  `email` varchar(45) DEFAULT NULL,
  `nidno` varchar(17) DEFAULT NULL,
  `image` varchar(50) DEFAULT NULL,
  `status` int(1) NOT NULL,
  `wbrid` int(11) DEFAULT NULL,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_esexpenses`
--

CREATE TABLE `tbl_esexpenses` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `note` varchar(150) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `apdate` datetime NOT NULL,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_esexpensesde`
--

CREATE TABLE `tbl_esexpensesde` (
  `id` int(11) NOT NULL,
  `brid` int(11) DEFAULT 0,
  `seid` int(11) NOT NULL,
  `expid` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `ref` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_estimate`
--

CREATE TABLE `tbl_estimate` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `type` varchar(2) NOT NULL,
  `cusid` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `mobile` varchar(18) DEFAULT NULL,
  `itemdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `subtot` decimal(12,2) NOT NULL,
  `disp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `totdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `aitp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `aitamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `otname` varchar(35) NOT NULL,
  `otamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `freight` decimal(8,2) NOT NULL DEFAULT 0.00,
  `less` decimal(8,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `curid` int(11) NOT NULL,
  `ref` varchar(25) DEFAULT NULL,
  `note` varchar(150) DEFAULT NULL,
  `apdate` date NOT NULL,
  `expdate` date DEFAULT NULL,
  `ocusname` varchar(35) DEFAULT NULL,
  `ocusmobile` varchar(18) DEFAULT NULL,
  `pname` varchar(45) DEFAULT NULL,
  `pdep` varchar(35) DEFAULT NULL,
  `paddress` varchar(150) DEFAULT NULL,
  `selp` int(11) DEFAULT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_estimatede`
--

CREATE TABLE `tbl_estimatede` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `pid` int(11) NOT NULL,
  `unqid` varchar(15) NOT NULL,
  `colid` int(11) NOT NULL DEFAULT 0,
  `sizid` int(11) NOT NULL DEFAULT 0,
  `cost` decimal(10,2) NOT NULL,
  `icdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `icinvdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `price` decimal(10,2) NOT NULL,
  `qty` double NOT NULL,
  `taxp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disf` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `subtot` decimal(12,2) NOT NULL,
  `wday` double NOT NULL DEFAULT 0,
  `pnote` varchar(150) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_expensedue`
--

CREATE TABLE `tbl_expensedue` (
  `id` int(11) NOT NULL,
  `invno` varchar(255) DEFAULT NULL,
  `amount` double(16,2) DEFAULT NULL,
  `status` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `tbl_expenses`
--

CREATE TABLE `tbl_expenses` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `note` varchar(150) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `apdate` datetime NOT NULL,
  `status` int(11) DEFAULT 1,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_expensesde`
--

CREATE TABLE `tbl_expensesde` (
  `id` int(11) NOT NULL,
  `brid` int(11) DEFAULT 0,
  `seid` int(11) NOT NULL,
  `expid` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `ref` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_invoice`
--

CREATE TABLE `tbl_invoice` (
  `id` int(11) NOT NULL,
  `invno` varchar(25) NOT NULL,
  `pino` varchar(25) NOT NULL,
  `curid` int(11) NOT NULL,
  `total` decimal(12,2) NOT NULL,
  `totcom` double(12,2) NOT NULL,
  `apdate` date NOT NULL,
  `packst` int(11) NOT NULL DEFAULT 0,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_invoicede`
--

CREATE TABLE `tbl_invoicede` (
  `id` int(11) NOT NULL,
  `brid` int(11) DEFAULT 0,
  `seid` int(11) NOT NULL,
  `itemid` int(11) NOT NULL,
  `itemname` varchar(65) DEFAULT NULL,
  `color` int(11) DEFAULT NULL,
  `price` int(11) NOT NULL,
  `qty` double NOT NULL DEFAULT 0,
  `unit` int(11) NOT NULL,
  `subtot` decimal(12,2) NOT NULL DEFAULT 0.00,
  `cfamo` double NOT NULL DEFAULT 0,
  `tcamo` double NOT NULL DEFAULT 0,
  `ctns` double NOT NULL DEFAULT 0,
  `netw` double NOT NULL DEFAULT 0,
  `grow` decimal(10,0) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_item`
--

CREATE TABLE `tbl_item` (
  `id` int(11) NOT NULL,
  `code` varchar(15) NOT NULL,
  `name` varchar(65) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `prid` int(11) DEFAULT NULL,
  `catid` int(11) DEFAULT NULL,
  `scatid` int(11) DEFAULT NULL,
  `brid` int(11) DEFAULT NULL,
  `manid` int(11) DEFAULT NULL,
  `unid` int(11) DEFAULT NULL,
  `couid` int(11) DEFAULT NULL,
  `minstock` double NOT NULL DEFAULT 0,
  `cqty` int(11) DEFAULT NULL,
  `barcode` varchar(25) DEFAULT NULL,
  `certificate` varchar(150) DEFAULT NULL,
  `modelno` varchar(25) DEFAULT NULL,
  `brandno` varchar(25) DEFAULT NULL,
  `image` varchar(50) DEFAULT NULL,
  `cost` decimal(12,2) NOT NULL DEFAULT 0.00,
  `price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `wday` double NOT NULL DEFAULT 0,
  `pmod` int(11) NOT NULL,
  `status` int(1) NOT NULL DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_journal`
--

CREATE TABLE `tbl_journal` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `note` varchar(150) DEFAULT NULL,
  `amount` decimal(12,2) NOT NULL,
  `apdate` date NOT NULL,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_journalde`
--

CREATE TABLE `tbl_journalde` (
  `id` int(11) NOT NULL,
  `brid` int(11) DEFAULT 0,
  `seid` int(11) NOT NULL,
  `did` int(11) NOT NULL,
  `dtype` varchar(2) NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `cid` int(11) NOT NULL,
  `ctype` varchar(2) NOT NULL,
  `cheno` varchar(20) DEFAULT NULL,
  `chedt` date DEFAULT NULL,
  `chest` int(11) DEFAULT NULL,
  `ref` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_lcopen`
--

CREATE TABLE `tbl_lcopen` (
  `id` int(11) NOT NULL,
  `lcno` varchar(25) NOT NULL,
  `pino` varchar(25) NOT NULL,
  `doi` date NOT NULL,
  `expdate` date NOT NULL,
  `expdays` int(11) DEFAULT 0,
  `ldos` date NOT NULL,
  `apbank` varchar(150) NOT NULL,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_leave`
--

CREATE TABLE `tbl_leave` (
  `id` int(11) NOT NULL,
  `name` varchar(25) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(150) DEFAULT NULL,
  `days` int(11) NOT NULL DEFAULT 0,
  `status` int(1) NOT NULL DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_leaverequest`
--

CREATE TABLE `tbl_leaverequest` (
  `id` int(11) NOT NULL,
  `lid` int(11) NOT NULL,
  `empid` int(11) NOT NULL,
  `lfrom` date NOT NULL,
  `lto` date NOT NULL,
  `ldays` int(11) NOT NULL DEFAULT 0,
  `empremarks` varchar(250) DEFAULT NULL,
  `adminremarks` varchar(250) DEFAULT NULL,
  `status` int(1) NOT NULL DEFAULT 0,
  `attfile` text NOT NULL,
  `apdate` date NOT NULL,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Stand-in structure for view `tbl_ledger`
-- (See below for the actual view)
--
CREATE TABLE `tbl_ledger` (
`id` varchar(13)
,`code` varchar(15)
,`grid` int(11)
,`groups` varchar(35)
,`sgrid` int(11)
,`sgroup` varchar(35)
,`ledger` varchar(73)
,`clsid` int(11)
,`class` varchar(35)
);

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

--
-- Table structure for table `tbl_ledgerview`
--

CREATE TABLE `tbl_ledgerview` (
  `id` varchar(13) DEFAULT NULL,
  `ledger` varchar(73) DEFAULT NULL,
  `code` varchar(15) DEFAULT NULL,
  `clsid` int(11) DEFAULT NULL,
  `class` varchar(35) DEFAULT NULL,
  `grid` int(11) DEFAULT NULL,
  `groups` varchar(35) DEFAULT NULL,
  `sgrid` int(11) DEFAULT NULL,
  `sgroup` varchar(35) DEFAULT NULL,
  `debit` double(19,2) DEFAULT NULL,
  `credit` double(19,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `tbl_limitset`
--

CREATE TABLE `tbl_limitset` (
  `id` int(11) NOT NULL,
  `brlim` int(11) NOT NULL DEFAULT 0,
  `userlim` int(11) NOT NULL DEFAULT 5,
  `whlim` int(11) NOT NULL DEFAULT 1,
  `strDate` date NOT NULL,
  `expDate` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_limitset`
--

INSERT INTO `tbl_limitset` (`id`, `brlim`, `userlim`, `whlim`, `strDate`, `expDate`) VALUES
(1, 1, 5, 2, '2020-09-21', '2024-04-18');

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

--
-- Table structure for table `tbl_loanid`
--

CREATE TABLE `tbl_loanid` (
  `id` int(11) NOT NULL,
  `code` varchar(15) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `type` int(11) NOT NULL,
  `acno` varchar(25) DEFAULT NULL,
  `mobile` varchar(18) DEFAULT NULL,
  `address` varchar(150) DEFAULT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_manfacturer`
--

CREATE TABLE `tbl_manfacturer` (
  `id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `address` varchar(250) DEFAULT NULL,
  `cperson` varchar(45) DEFAULT NULL,
  `bcperson` varchar(255) DEFAULT NULL,
  `cmobile` varchar(18) DEFAULT NULL,
  `email` varchar(45) DEFAULT NULL,
  `web` varchar(45) DEFAULT NULL,
  `rank` int(11) DEFAULT NULL,
  `mainpro` varchar(350) DEFAULT NULL,
  `description` varchar(250) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_messages`
--

CREATE TABLE `tbl_messages` (
  `message_id` int(11) NOT NULL,
  `from_id` varchar(40) NOT NULL,
  `to_id` varchar(50) NOT NULL,
  `from_uname` varchar(255) NOT NULL,
  `to_uname` varchar(255) NOT NULL,
  `message_content` text NOT NULL,
  `message_date` datetime NOT NULL,
  `recd` tinyint(4) NOT NULL DEFAULT 0,
  `seen` enum('0','1') NOT NULL DEFAULT '0',
  `message_type` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_note`
--

CREATE TABLE `tbl_note` (
  `id` int(11) NOT NULL,
  `title` varchar(35) NOT NULL,
  `note` varchar(250) NOT NULL,
  `isfav` varchar(1) NOT NULL DEFAULT 'N',
  `type` int(1) NOT NULL DEFAULT 0,
  `apdate` date NOT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_parent`
--

CREATE TABLE `tbl_parent` (
  `id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(250) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_payvoucher`
--

CREATE TABLE `tbl_payvoucher` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `note` varchar(150) DEFAULT NULL,
  `amount` decimal(12,2) NOT NULL,
  `apdate` date NOT NULL,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_payvoucherde`
--

CREATE TABLE `tbl_payvoucherde` (
  `id` int(11) NOT NULL,
  `brid` int(11) DEFAULT 0,
  `seid` int(11) NOT NULL,
  `cid` int(11) NOT NULL,
  `cty` varchar(2) NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `did` int(11) NOT NULL,
  `dty` varchar(2) NOT NULL,
  `cheno` varchar(20) DEFAULT NULL,
  `chedt` date DEFAULT NULL,
  `chest` int(11) DEFAULT NULL,
  `ref` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_pdlirecord`
--

CREATE TABLE `tbl_pdlirecord` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `refinv` varchar(15) DEFAULT NULL,
  `ibrid` int(11) NOT NULL,
  `note` varchar(150) DEFAULT NULL,
  `apdate` date NOT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_precrecord`
--

CREATE TABLE `tbl_precrecord` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `refinv` varchar(15) DEFAULT NULL,
  `ibrid` int(11) NOT NULL,
  `note` varchar(150) DEFAULT NULL,
  `apdate` date NOT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_preturn`
--

CREATE TABLE `tbl_preturn` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `refinv` varchar(15) NOT NULL,
  `type` varchar(2) NOT NULL,
  `cusid` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `mobile` varchar(18) DEFAULT NULL,
  `itemdis` decimal(10,2) NOT NULL DEFAULT 0.00,
  `subtot` decimal(10,2) NOT NULL DEFAULT 0.00,
  `disp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disamo` decimal(10,2) NOT NULL DEFAULT 0.00,
  `totdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `less` decimal(8,2) NOT NULL DEFAULT 0.00,
  `adjust` decimal(8,2) NOT NULL DEFAULT 0.00,
  `adamo` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `note` varchar(150) NOT NULL,
  `apdate` date NOT NULL,
  `nxtduedate` date DEFAULT NULL,
  `rawcash` decimal(12,2) NOT NULL DEFAULT 0.00,
  `changes` decimal(8,2) NOT NULL DEFAULT 0.00,
  `retp` int(11) DEFAULT NULL,
  `debitid` varchar(15) NOT NULL,
  `details` varchar(65) DEFAULT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_proinv`
--

CREATE TABLE `tbl_proinv` (
  `id` int(11) NOT NULL,
  `pino` varchar(25) NOT NULL,
  `cusid` int(11) NOT NULL,
  `cusname` varchar(45) NOT NULL,
  `supid` int(11) NOT NULL,
  `supname` varchar(45) NOT NULL,
  `curid` int(11) NOT NULL,
  `taxp` double NOT NULL DEFAULT 0,
  `taxamo` decimal(12,2) NOT NULL DEFAULT 0.00,
  `freight` decimal(12,2) NOT NULL DEFAULT 0.00,
  `insurance` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `totcom` decimal(12,2) NOT NULL DEFAULT 0.00,
  `apdate` datetime NOT NULL,
  `dldate` date DEFAULT NULL,
  `dldays` int(11) DEFAULT 0,
  `country` int(11) DEFAULT NULL,
  `pofemb` varchar(150) DEFAULT NULL,
  `pofdis` varchar(150) DEFAULT NULL,
  `terms` varchar(650) DEFAULT NULL,
  `bfbank` varchar(45) DEFAULT NULL,
  `bfac` varchar(25) DEFAULT NULL,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_proinvde`
--

CREATE TABLE `tbl_proinvde` (
  `id` int(11) NOT NULL,
  `brid` int(11) DEFAULT 0,
  `seid` int(11) NOT NULL,
  `itemid` int(11) DEFAULT NULL,
  `color` int(11) NOT NULL,
  `itemname` varchar(65) NOT NULL,
  `hscode` varchar(15) DEFAULT NULL,
  `qty` double NOT NULL DEFAULT 0,
  `unit` int(11) NOT NULL,
  `price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `subtot` decimal(12,2) NOT NULL DEFAULT 0.00,
  `cfamo` decimal(12,2) NOT NULL DEFAULT 0.00,
  `cp` double NOT NULL DEFAULT 0,
  `tcamo` decimal(12,2) NOT NULL DEFAULT 0.00,
  `rcvqty` double NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_purchase`
--

CREATE TABLE `tbl_purchase` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `refinv` varchar(15) DEFAULT NULL,
  `type` varchar(2) NOT NULL,
  `supid` int(11) NOT NULL,
  `itemdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `subtot` decimal(12,2) NOT NULL,
  `disp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `totdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `spmoney` decimal(8,2) NOT NULL DEFAULT 0.00,
  `otname` varchar(35) NOT NULL,
  `otamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `freight` decimal(8,2) NOT NULL DEFAULT 0.00,
  `less` decimal(8,2) NOT NULL DEFAULT 0.00,
  `adamo` decimal(12,2) DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `curid` int(11) NOT NULL,
  `ref` varchar(25) DEFAULT NULL,
  `note` varchar(150) DEFAULT NULL,
  `apdate` date NOT NULL,
  `nxtduedate` date DEFAULT NULL,
  `rawcash` decimal(12,2) NOT NULL DEFAULT 0.00,
  `changes` decimal(8,2) NOT NULL DEFAULT 0.00,
  `purp` int(11) DEFAULT NULL,
  `creditid` varchar(15) NOT NULL,
  `details` varchar(65) DEFAULT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_purorder`
--

CREATE TABLE `tbl_purorder` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `type` varchar(2) NOT NULL,
  `supid` int(11) NOT NULL,
  `itemdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `subtot` decimal(12,2) NOT NULL,
  `disp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `totdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `spmoney` decimal(12,2) NOT NULL DEFAULT 0.00,
  `otname` varchar(35) NOT NULL,
  `otamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `freight` decimal(8,2) NOT NULL DEFAULT 0.00,
  `less` decimal(8,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `curid` int(11) NOT NULL,
  `ref` varchar(25) DEFAULT NULL,
  `note` varchar(150) DEFAULT NULL,
  `apdate` date NOT NULL,
  `expdate` date DEFAULT NULL,
  `purp` int(11) DEFAULT NULL,
  `ap` varchar(1) NOT NULL DEFAULT 'N',
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_purorderde`
--

CREATE TABLE `tbl_purorderde` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `pid` int(11) NOT NULL,
  `colid` int(11) DEFAULT NULL,
  `sizid` int(11) DEFAULT NULL,
  `exqty` double NOT NULL DEFAULT 0,
  `oldprice` decimal(10,2) NOT NULL DEFAULT 0.00,
  `cuqty` double NOT NULL,
  `cuprice` decimal(10,2) NOT NULL,
  `disp` double NOT NULL DEFAULT 0,
  `disf` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disamo` decimal(10,2) NOT NULL DEFAULT 0.00,
  `taxp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxamo` decimal(12,2) NOT NULL DEFAULT 0.00,
  `vatp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatamo` decimal(12,2) NOT NULL DEFAULT 0.00,
  `wday` int(11) NOT NULL DEFAULT 0,
  `subtot` decimal(12,2) NOT NULL,
  `pnote` varchar(150) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_recvoucher`
--

CREATE TABLE `tbl_recvoucher` (
  `id` int(11) NOT NULL,
  `brid` int(11) DEFAULT 0,
  `invno` varchar(15) NOT NULL,
  `note` varchar(150) DEFAULT NULL,
  `amount` decimal(12,2) NOT NULL,
  `apdate` date NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_recvoucherde`
--

CREATE TABLE `tbl_recvoucherde` (
  `id` int(11) NOT NULL,
  `brid` int(11) DEFAULT 0,
  `seid` int(11) NOT NULL,
  `cid` int(11) NOT NULL,
  `cty` varchar(2) NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `did` int(11) NOT NULL,
  `dty` varchar(2) NOT NULL,
  `cheno` varchar(20) DEFAULT NULL,
  `chedt` date DEFAULT NULL,
  `chest` int(11) DEFAULT NULL,
  `ref` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_reqitem`
--

CREATE TABLE `tbl_reqitem` (
  `id` int(100) NOT NULL,
  `item` varchar(100) NOT NULL,
  `oty` int(100) DEFAULT NULL,
  `imei` longtext DEFAULT NULL,
  `sellqty` varchar(11) DEFAULT NULL,
  `returnqty` varchar(11) DEFAULT NULL,
  `other` varchar(255) DEFAULT NULL,
  `code` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `tbl_requisition`
--

CREATE TABLE `tbl_requisition` (
  `id` int(11) NOT NULL,
  `code` varchar(100) DEFAULT NULL,
  `stf_id` varchar(100) DEFAULT NULL,
  `note` varchar(1000) DEFAULT NULL,
  `apdate` date DEFAULT NULL,
  `brid` varchar(100) NOT NULL,
  `uid` varchar(100) NOT NULL,
  `date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `tbl_salarysheet`
--

CREATE TABLE `tbl_salarysheet` (
  `id` int(11) NOT NULL,
  `empid` int(11) NOT NULL,
  `absent` int(2) NOT NULL,
  `late` int(2) NOT NULL,
  `lapid` int(11) DEFAULT NULL,
  `leaves` int(2) NOT NULL,
  `pday` int(2) NOT NULL,
  `pamo` double NOT NULL,
  `mwd` double DEFAULT NULL,
  `whpd` double DEFAULT NULL,
  `phror` double DEFAULT 0,
  `tohr` double DEFAULT 0,
  `toam` double DEFAULT 0,
  `basic` double NOT NULL,
  `homeamo` double NOT NULL,
  `medical` double NOT NULL,
  `food` double NOT NULL,
  `comuni` double NOT NULL,
  `absamo` double NOT NULL,
  `lateamo` double NOT NULL,
  `levamo` double NOT NULL,
  `pdayamo` double NOT NULL,
  `jdamo` double NOT NULL,
  `bonus` double NOT NULL,
  `tsalary` double NOT NULL,
  `month` int(2) NOT NULL,
  `year` int(4) NOT NULL,
  `paid` decimal(10,0) DEFAULT 0,
  `note` varchar(150) DEFAULT NULL,
  `pstatus` int(1) NOT NULL,
  `payslip` varchar(15) NOT NULL,
  `refno` varchar(15) DEFAULT NULL,
  `apdate` date NOT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_sales`
--

CREATE TABLE `tbl_sales` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `refinv` varchar(15) DEFAULT NULL,
  `type` varchar(2) NOT NULL,
  `cusid` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `mobile` varchar(18) DEFAULT NULL,
  `did` int(11) DEFAULT NULL,
  `zid` int(11) DEFAULT NULL,
  `itemdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `subtot` decimal(12,2) NOT NULL,
  `disp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `totdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `aitp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `aitamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `otname` varchar(35) NOT NULL,
  `otamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `freight` decimal(8,2) NOT NULL DEFAULT 0.00,
  `less` decimal(8,2) NOT NULL DEFAULT 0.00,
  `dfixed` decimal(16,2) DEFAULT 0.00,
  `adamo` decimal(12,2) DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `curid` int(11) NOT NULL,
  `ref` varchar(25) DEFAULT NULL,
  `note` varchar(150) DEFAULT NULL,
  `apdate` date NOT NULL,
  `nxtduedate` date DEFAULT NULL,
  `ocusname` varchar(35) DEFAULT NULL,
  `ocusmobile` varchar(18) DEFAULT NULL,
  `pname` varchar(45) DEFAULT NULL,
  `pdep` varchar(35) DEFAULT NULL,
  `paddress` varchar(150) DEFAULT NULL,
  `waddress` varchar(250) DEFAULT NULL,
  `wemail` varchar(50) DEFAULT NULL,
  `rawcash` decimal(12,2) NOT NULL DEFAULT 0.00,
  `changes` decimal(8,2) NOT NULL DEFAULT 0.00,
  `selp` int(11) DEFAULT NULL,
  `debitid` varchar(15) NOT NULL,
  `details` varchar(65) DEFAULT NULL,
  `otref` varchar(25) DEFAULT NULL,
  `otrefval` varchar(25) DEFAULT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_selquotation`
--

CREATE TABLE `tbl_selquotation` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `type` varchar(2) NOT NULL,
  `cusid` int(11) NOT NULL,
  `itemdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `subtot` decimal(12,2) NOT NULL,
  `disp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `totdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `spmoney` decimal(12,2) NOT NULL DEFAULT 0.00,
  `otname` varchar(35) NOT NULL,
  `otamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `freight` decimal(8,2) NOT NULL DEFAULT 0.00,
  `less` decimal(8,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `curid` int(11) NOT NULL,
  `ref` varchar(25) DEFAULT NULL,
  `note` varchar(150) DEFAULT NULL,
  `apdate` date NOT NULL,
  `expdate` date DEFAULT NULL,
  `purp` int(11) DEFAULT NULL,
  `ap` varchar(1) NOT NULL DEFAULT 'N',
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_selquotationde`
--

CREATE TABLE `tbl_selquotationde` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `pid` int(11) NOT NULL,
  `colid` int(11) DEFAULT NULL,
  `sizid` int(11) DEFAULT NULL,
  `exqty` double NOT NULL DEFAULT 0,
  `oldprice` decimal(10,2) NOT NULL DEFAULT 0.00,
  `cuqty` double NOT NULL,
  `cuprice` decimal(10,2) NOT NULL,
  `disp` double NOT NULL DEFAULT 0,
  `disf` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disamo` decimal(10,2) NOT NULL DEFAULT 0.00,
  `taxp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxamo` decimal(12,2) NOT NULL DEFAULT 0.00,
  `vatp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatamo` decimal(12,2) NOT NULL DEFAULT 0.00,
  `wday` int(11) NOT NULL DEFAULT 0,
  `subtot` decimal(12,2) NOT NULL,
  `pnote` varchar(150) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_sercenter`
--

CREATE TABLE `tbl_sercenter` (
  `id` int(11) NOT NULL,
  `name` varchar(35) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `address` varchar(150) NOT NULL,
  `baddress` varchar(350) DEFAULT NULL,
  `mobile` varchar(18) NOT NULL,
  `email` varchar(45) DEFAULT NULL,
  `status` int(1) NOT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_serial`
--

CREATE TABLE `tbl_serial` (
  `id` int(11) NOT NULL,
  `purinv` varchar(15) NOT NULL,
  `reinvno` varchar(15) DEFAULT NULL,
  `pid` int(11) NOT NULL,
  `unqid` varchar(15) NOT NULL,
  `serial` varchar(25) NOT NULL,
  `rci` varchar(1) NOT NULL,
  `rcno` varchar(15) DEFAULT NULL,
  `disno` varchar(15) DEFAULT NULL,
  `brid` int(11) DEFAULT NULL,
  `whid` int(11) DEFAULT NULL,
  `status` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_serialsale`
--

CREATE TABLE `tbl_serialsale` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `pid` varchar(10) NOT NULL,
  `unqid` varchar(15) NOT NULL,
  `serial` varchar(25) NOT NULL,
  `mods` varchar(1) NOT NULL,
  `dli` varchar(1) NOT NULL,
  `dlno` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_seritem`
--

CREATE TABLE `tbl_seritem` (
  `id` int(11) NOT NULL,
  `code` varchar(8) NOT NULL,
  `name` varchar(35) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(350) DEFAULT NULL,
  `catid` int(11) DEFAULT NULL,
  `scatid` int(11) DEFAULT NULL,
  `cost` double(8,2) NOT NULL DEFAULT 0.00,
  `price` double(8,2) NOT NULL DEFAULT 0.00,
  `status` int(1) NOT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_serreceive`
--

CREATE TABLE `tbl_serreceive` (
  `id` int(11) NOT NULL,
  `invoice_no` varchar(100) NOT NULL,
  `cname` varchar(255) DEFAULT NULL,
  `cphone` varchar(255) DEFAULT NULL,
  `caddress` varchar(1000) DEFAULT NULL,
  `pname` varchar(255) DEFAULT NULL,
  `pmodel` varchar(255) DEFAULT NULL,
  `pdescription` varchar(1000) DEFAULT NULL,
  `deli_date` date DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  `brid` int(11) DEFAULT NULL,
  `uid` int(11) DEFAULT NULL,
  `date` varchar(11) NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `tbl_sersales`
--

CREATE TABLE `tbl_sersales` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `refinv` varchar(15) DEFAULT NULL,
  `type` varchar(2) NOT NULL,
  `cusid` int(11) NOT NULL,
  `srid` varchar(100) DEFAULT NULL,
  `name` varchar(45) DEFAULT NULL,
  `mobile` varchar(18) DEFAULT NULL,
  `itemdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `subtot` decimal(12,2) NOT NULL,
  `disp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `totdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `aitp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `aitamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `otname` varchar(35) NOT NULL,
  `otamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `freight` decimal(8,2) NOT NULL DEFAULT 0.00,
  `less` decimal(8,2) NOT NULL DEFAULT 0.00,
  `adamo` decimal(12,2) DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `curid` int(11) NOT NULL,
  `ref` varchar(25) DEFAULT NULL,
  `note` varchar(150) DEFAULT NULL,
  `apdate` date NOT NULL,
  `nxtduedate` date DEFAULT NULL,
  `ocusname` varchar(35) DEFAULT NULL,
  `ocusmobile` varchar(18) DEFAULT NULL,
  `pname` varchar(45) DEFAULT NULL,
  `pdep` varchar(35) DEFAULT NULL,
  `paddress` varchar(150) DEFAULT NULL,
  `rawcash` decimal(12,2) NOT NULL DEFAULT 0.00,
  `changes` decimal(8,2) NOT NULL DEFAULT 0.00,
  `selp` int(11) DEFAULT NULL,
  `debitid` varchar(15) NOT NULL,
  `details` varchar(65) DEFAULT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_sersalesde`
--

CREATE TABLE `tbl_sersalesde` (
  `id` int(11) NOT NULL,
  `seid` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `sid` int(11) DEFAULT NULL,
  `code` varchar(8) DEFAULT NULL,
  `name` varchar(35) NOT NULL,
  `cost` decimal(10,0) NOT NULL DEFAULT 0,
  `price` decimal(8,2) NOT NULL DEFAULT 0.00,
  `qty` double NOT NULL DEFAULT 0,
  `disp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disf` double NOT NULL DEFAULT 0,
  `disamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `taxamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `subtot` decimal(10,2) NOT NULL DEFAULT 0.00,
  `snote` varchar(65) DEFAULT NULL,
  `brid` int(11) NOT NULL,
  `stype` varchar(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_setting`
--

CREATE TABLE `tbl_setting` (
  `id` int(11) NOT NULL,
  `skey` varchar(35) NOT NULL,
  `sval` varchar(650) NOT NULL,
  `description` varchar(250) DEFAULT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_setting`
--

INSERT INTO `tbl_setting` (`id`, `skey`, `sval`, `description`, `brid`, `uid`, `date`) VALUES
(1, 'LANGUES', '0', NULL, 0, 1, '0000-00-00 00:00:00'),
(2, 'PURCV', '0', NULL, 0, 1, '2020-08-02 00:00:00'),
(3, 'SELDLI', '0', NULL, 0, 1, '2020-08-02 00:00:00'),
(4, 'SHOCOST', '0', 'Show Purchase Cost', 0, 0, '2020-09-07 11:54:46'),
(5, 'INVDUE', '0', 'Show Previous Due On Sales Invoice', 0, 0, '2020-09-12 16:52:48'),
(6, 'INVDNOTE', '<p>This is your note where you can write your&nbsp;Note, Terms &amp; Condition&nbsp;</p>\r\n<ol>\r\n<li>VAT &amp; Taxes are not included in the above price.</li>\r\n<li>Read the Manual Book supplied with the vehicle with attention and follow the service instruction properly.</li>\r\n<li>Delivery of Registration Document is subject to clearance of all dues (if any).</li>\r\n</ol>', 'Invoice Default Note', 0, 0, '2020-09-12 16:53:00'),
(7, 'SHOINVNOT', '0', 'Sales Invoice Print With Terms &amp; Condition', 0, 0, '2020-09-12 16:26:42'),
(8, 'ENCHAT', '1', 'Enable Chat Internal Chat System ', 0, 1, '2020-09-22 17:06:44'),
(9, 'COSTSHOW', '0', 'Sales Price Update Time Show Cost', 0, 1, '2020-10-10 14:30:48'),
(10, 'INVBRAN', '1', 'Display Band And Country Origin', 0, 0, '2020-12-12 18:36:34'),
(11, 'COLORSIZE', '0', 'Display Size And Color', 0, 1, '2021-11-12 00:34:40'),
(12, 'CHEQUE', '0', 'Manage Cheque After Cheque Payment', 0, 1, '2021-12-17 22:41:11'),
(13, 'CUSLIMIT', '1', 'Check Customer Limit After Sales Payment', 0, 1, '2022-10-02 16:47:00');

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

--
-- Table structure for table `tbl_shipline`
--

CREATE TABLE `tbl_shipline` (
  `id` int(11) NOT NULL,
  `sortn` varchar(8) NOT NULL,
  `name` varchar(35) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `contact` varchar(18) DEFAULT NULL,
  `address` varchar(250) DEFAULT NULL,
  `baddress` varchar(350) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_size`
--

CREATE TABLE `tbl_size` (
  `id` int(11) NOT NULL,
  `name` varchar(20) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `sval` varchar(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_sms`
--

CREATE TABLE `tbl_sms` (
  `id` int(11) NOT NULL,
  `status` int(2) NOT NULL,
  `language` int(2) DEFAULT NULL,
  `appkey` varchar(100) DEFAULT NULL,
  `senderid` varchar(100) DEFAULT NULL,
  `type` varchar(100) DEFAULT NULL,
  `url` varchar(255) DEFAULT NULL,
  `htext` varchar(255) DEFAULT NULL,
  `ftext` varchar(255) DEFAULT NULL,
  `hbtext` varchar(255) DEFAULT NULL,
  `fbtext` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `tbl_sms`
--

INSERT INTO `tbl_sms` (`id`, `status`, `language`, `appkey`, `senderid`, `type`, `url`, `htext`, `ftext`, `hbtext`, `fbtext`) VALUES
(1, 0, 1, 'C200796460cb4b2888c9a5.95921687', 'BrotherTech', 'text', 'https://msg.elitbuzz-bd.com/smsapi', 'Dear customer,\r\nThank you for Shopping with us.', 'BrotherTech\r\nThank you.\r\n', 'প্রিয় গ্র্রহক  , \r\nBrotherTech থেকে পণ্য ক্রয় করার জন্য আপনাকে  অসংখ্য ধন্যবাদ।', 'ধন্যবাদ \r\nBrotherTech ');

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

--
-- Table structure for table `tbl_sreturn`
--

CREATE TABLE `tbl_sreturn` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `refinv` varchar(15) NOT NULL,
  `type` varchar(2) NOT NULL,
  `cusid` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `mobile` varchar(18) DEFAULT NULL,
  `itemdis` decimal(10,2) NOT NULL DEFAULT 0.00,
  `subtot` decimal(10,2) NOT NULL DEFAULT 0.00,
  `disp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disamo` decimal(10,2) NOT NULL DEFAULT 0.00,
  `totdis` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `vatamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `aitp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `aitamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `less` decimal(8,2) NOT NULL DEFAULT 0.00,
  `adjust` decimal(8,2) NOT NULL DEFAULT 0.00,
  `adamo` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `note` varchar(150) NOT NULL,
  `apdate` date NOT NULL,
  `nxtduedate` date DEFAULT NULL,
  `rawcash` decimal(10,2) NOT NULL DEFAULT 0.00,
  `changes` decimal(8,2) NOT NULL DEFAULT 0.00,
  `retp` int(11) DEFAULT NULL,
  `creditid` varchar(15) NOT NULL,
  `details` varchar(65) DEFAULT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_stock`
--

CREATE TABLE `tbl_stock` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `pid` int(11) NOT NULL,
  `unqid` varchar(15) NOT NULL,
  `code` varchar(15) NOT NULL,
  `icdis` decimal(10,2) NOT NULL DEFAULT 0.00,
  `icinvdis` decimal(10,2) NOT NULL DEFAULT 0.00,
  `cost` decimal(12,2) NOT NULL,
  `oldprice` decimal(10,2) NOT NULL DEFAULT 0.00,
  `pupdate` datetime DEFAULT NULL,
  `uid` int(11) DEFAULT NULL,
  `price` decimal(12,2) NOT NULL,
  `taxp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disf` decimal(8,2) NOT NULL DEFAULT 0.00,
  `wday` int(11) NOT NULL DEFAULT 0,
  `ofid` int(11) DEFAULT NULL,
  `status` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_subcat`
--

CREATE TABLE `tbl_subcat` (
  `id` int(11) NOT NULL,
  `pid` int(11) DEFAULT NULL,
  `catid` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Stand-in structure for view `tbl_supcredit`
-- (See below for the actual view)
--
CREATE TABLE `tbl_supcredit` (
`id` varchar(21)
,`credit` double
);

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

--
-- Stand-in structure for view `tbl_supdebit`
-- (See below for the actual view)
--
CREATE TABLE `tbl_supdebit` (
`id` varchar(21)
,`debit` double
);

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

--
-- Table structure for table `tbl_supplier`
--

CREATE TABLE `tbl_supplier` (
  `id` int(11) NOT NULL,
  `gid` int(11) DEFAULT NULL,
  `code` varchar(15) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `cperson` varchar(45) DEFAULT NULL,
  `cnumber` varchar(18) NOT NULL,
  `cphone` varchar(14) DEFAULT NULL,
  `cemail` varchar(45) DEFAULT NULL,
  `creditlimit` double DEFAULT 0,
  `crepreiod` int(11) NOT NULL DEFAULT 0,
  `address` varchar(200) DEFAULT NULL,
  `baddress` varchar(350) DEFAULT NULL,
  `saddress` varchar(200) DEFAULT NULL,
  `bsaddress` varchar(350) DEFAULT NULL,
  `rank` int(11) DEFAULT NULL,
  `status` int(1) NOT NULL DEFAULT 1,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_trafrbra`
--

CREATE TABLE `tbl_trafrbra` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `ftype` varchar(2) NOT NULL,
  `fsourch` int(11) NOT NULL,
  `ttype` varchar(2) NOT NULL,
  `tsourch` int(11) NOT NULL,
  `media` int(11) DEFAULT NULL,
  `note` varchar(150) DEFAULT NULL,
  `apdate` date NOT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_trafrwho`
--

CREATE TABLE `tbl_trafrwho` (
  `id` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `ftype` varchar(2) NOT NULL,
  `fsourch` int(11) NOT NULL,
  `ttype` varchar(2) NOT NULL,
  `tsourch` int(11) NOT NULL,
  `media` int(11) DEFAULT NULL,
  `note` varchar(150) DEFAULT NULL,
  `apdate` date NOT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Stand-in structure for view `tbl_traledger`
-- (See below for the actual view)
--
CREATE TABLE `tbl_traledger` (
`id` int(11)
,`invno` varchar(25)
,`refinv` varchar(25)
,`dty` varchar(255)
,`did` varchar(21)
,`amo` double
,`cid` varchar(21)
,`cty` varchar(255)
,`chkno` varchar(255)
,`chkdt` date
,`otnote` varchar(350)
,`recon` int(11)
,`ref` varchar(35)
,`curid` int(11)
,`xrate` decimal(10,2)
,`apdate` date
,`brid` int(11)
,`uid` int(11)
,`date` datetime
);

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

--
-- Table structure for table `tbl_traproduct`
--

CREATE TABLE `tbl_traproduct` (
  `id` int(11) NOT NULL,
  `type` varchar(2) DEFAULT NULL,
  `tid` int(11) DEFAULT NULL,
  `invno` varchar(15) NOT NULL,
  `refinv` varchar(15) DEFAULT NULL,
  `pid` int(11) NOT NULL,
  `unqid` varchar(15) NOT NULL,
  `colid` int(11) DEFAULT NULL,
  `sizid` int(11) DEFAULT NULL,
  `cost` decimal(12,2) NOT NULL DEFAULT 0.00,
  `icdis` decimal(10,2) NOT NULL DEFAULT 0.00,
  `icinvdis` decimal(10,2) NOT NULL DEFAULT 0.00,
  `price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `p_qty` double NOT NULL,
  `p_in` double NOT NULL DEFAULT 0,
  `s_qty` double NOT NULL,
  `p_out` double NOT NULL DEFAULT 0,
  `p_loc` double NOT NULL DEFAULT 0,
  `p_uloc` double NOT NULL DEFAULT 0,
  `taxp` decimal(8,2) NOT NULL,
  `taxamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disp` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disf` decimal(8,2) NOT NULL DEFAULT 0.00,
  `disamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `subtot` decimal(12,2) NOT NULL,
  `wday` double DEFAULT 0,
  `mods` varchar(2) NOT NULL,
  `brid` int(11) DEFAULT NULL,
  `waid` int(11) DEFAULT NULL,
  `tramod` varchar(2) DEFAULT NULL,
  `isinv` varchar(1) NOT NULL DEFAULT 'Y',
  `gp` varchar(1) NOT NULL DEFAULT 'Y',
  `pnote` varchar(45) DEFAULT NULL,
  `rbp` decimal(3,2) NOT NULL DEFAULT 0.00,
  `rbf` decimal(8,2) NOT NULL DEFAULT 0.00,
  `rbamo` decimal(8,2) NOT NULL DEFAULT 0.00,
  `rbclno` varchar(15) DEFAULT NULL,
  `ofid` int(11) DEFAULT NULL,
  `ofamo` decimal(10,2) NOT NULL DEFAULT 0.00,
  `aft` int(11) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `apdate` date NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_trarecord`
--

CREATE TABLE `tbl_trarecord` (
  `id` int(11) NOT NULL,
  `invno` varchar(25) NOT NULL,
  `refinv` varchar(25) DEFAULT NULL,
  `dty` varchar(2) NOT NULL,
  `did` int(11) NOT NULL,
  `amo` decimal(12,2) NOT NULL,
  `cid` int(11) NOT NULL,
  `cty` varchar(2) NOT NULL,
  `chkno` varchar(25) DEFAULT NULL,
  `chkdt` date DEFAULT NULL,
  `otnote` varchar(85) DEFAULT NULL,
  `recon` int(1) NOT NULL DEFAULT 0,
  `ref` varchar(35) DEFAULT NULL,
  `curid` int(11) NOT NULL DEFAULT 0,
  `xrate` decimal(10,2) NOT NULL DEFAULT 0.00,
  `apdate` date NOT NULL,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_unit`
--

CREATE TABLE `tbl_unit` (
  `id` int(11) NOT NULL,
  `name` varchar(25) DEFAULT NULL,
  `bname` varchar(150) DEFAULT NULL,
  `description` varchar(350) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_unit`
--

INSERT INTO `tbl_unit` (`id`, `name`, `bname`, `description`, `uid`, `date`) VALUES
(1, 'Piece', NULL, 'Pieces, a band consisting of Buckethead and Bryan &quot;Brain&quot; Mantia', 1, '2020-09-21 06:26:01'),
(2, 'KG', NULL, 'The kilogram or kilogramme (SI unit symbol: kg) is the base unit of mass in the International System of Units (SI), and is defined as being equal to the mass of the International Prototype of the Kilogram (IPK, also known as &quot;Le Grand K&quot; or &quot;Big K&quot;)', 1, '2020-10-17 09:17:47'),
(3, 'Pound', NULL, 'Pound, unit of avoirdupois weight, equal to 16 ounces, 7,000 grains, or 0.45359237 kg, and of troy and apothecaries\' weight, equal to 12 ounces', 1, '2020-10-17 09:18:11'),
(4, 'Meter', NULL, 'The metre (British spelling) or meter (American spelling) (from the Greek noun μέτρον, &quot;measure&quot;) is the base unit of length in the International System of Units (SI).', 1, '2020-10-17 09:18:31'),
(5, 'Yard', NULL, 'The yard (abbreviation: yd) is an English unit of length, in both the British imperial and US customary systems of measurement, that comprises 3 feet or 36 inches.', 1, '2020-10-17 09:18:47'),
(6, 'Centimeter (CM)', NULL, 'A centimetre (international spelling as used by the International Bureau of Weights and Measures; symbol cm) or centimeter (American spelling) is a unit of length in the metric system, equal to one hundredth of a metre, centi being the SI prefix for ', 1, '2020-10-17 09:19:20'),
(7, 'Person', NULL, 'A human being regarded as an individual.', 1, '2020-10-17 09:19:38'),
(8, 'Dozen', NULL, 'A group or set of twelve.', 1, '2020-10-17 09:19:55'),
(9, 'Ream', NULL, 'Writing paper measurements: 25 sheets = 1 quire: 500 sheets = 20 quires = 1 ream', 1, '2020-10-17 09:20:13'),
(10, 'Inches', NULL, 'The international standard symbol for inch is in (see ISO 31-1, Annex A) but traditionally the inch is denoted by a double prime, which is often approximated by double quotes', 1, '2020-10-17 09:21:02'),
(11, 'ML', NULL, 'The millilitre (ml or mL, also spelled milliliter) is a metric unit of volume that is equal to one thousandth of a litre.', 1, '2020-10-17 09:21:20'),
(12, 'Gram', NULL, 'The gram is a metric system unit of mass. Originally defined as &quot;the absolute weight of a volume of pure water equal to the cube of the hundredth part of a metre, and at the temperature of melting ice&quot;.', 1, '2020-10-17 09:21:44'),
(13, 'Packet', NULL, 'Packet may refer to: A small container or pouch. Packet (container), a small single use container; Cigarette packet · Sugar packet · Plastic bag ·', 1, '2020-10-17 09:22:03'),
(14, 'Box', NULL, 'Box (plural: boxes) describes a variety of containers and receptacles for permanent use as storage, or for temporary use, often for transporting contents.', 1, '2020-10-17 09:22:20'),
(15, 'Bottle', NULL, 'This article is about bottles in general. For baby bottles, see Baby bottle. For the song by Doug Anthony All Stars, see Bottle (song). &quot;Bottles&quot; redirects here. For the 1936 MGM cartoon, see Bottles (film). For the power pop band, see the Bottles.', 1, '2020-10-17 09:22:39'),
(16, 'Litre', NULL, 'The litre (SI spelling) or liter (American spelling) (symbols L or l,[1] sometimes abbreviated ltr) is an SI accepted metric system unit of volume equal to 1 cubic decimetre (dm3), 1,000 cubic centimetres (cm3) or 1/1,000 cubic metre. A cubic decimet', 1, '2020-10-17 09:22:57'),
(17, 'Pair', NULL, 'Pair', 1, '2020-10-17 09:24:03'),
(18, 'Carton', NULL, 'Carton', 1, '2020-10-17 09:25:53'),
(19, 'PIECES', NULL, '', 1, '2020-11-04 08:08:29'),
(20, 'pcs', NULL, '', 1, '2020-11-23 01:05:13'),
(21, '25 Pcs/Box', NULL, '', 1, '2020-12-29 03:22:46'),
(22, 'gm', NULL, '', 1, '2021-02-08 05:05:59'),
(23, 'BAG', NULL, '', 1, '2021-03-13 08:32:35'),
(24, 'ps', NULL, '', 1, '2023-03-28 01:23:12');

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

--
-- Table structure for table `tbl_user`
--

CREATE TABLE `tbl_user` (
  `id` int(11) NOT NULL,
  `email` varchar(45) NOT NULL,
  `password` varchar(65) NOT NULL,
  `utype` int(1) NOT NULL,
  `acess` int(2) NOT NULL,
  `abrid` int(11) NOT NULL,
  `name` varchar(35) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `image` varchar(50) DEFAULT NULL,
  `status` int(1) NOT NULL,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_user`
--

INSERT INTO `tbl_user` (`id`, `email`, `password`, `utype`, `acess`, `abrid`, `name`, `bname`, `image`, `status`, `brid`, `uid`, `date`) VALUES
(1, 'demo@axesgl.com', '6ea7ccdcf642953a24672d10b0d32cef576e0329', 1, 1, 0, 'Axes Global', 'এক্সেস গ্লোবাল', NULL, 1, 0, 0, '2020-03-23 00:00:00');

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

--
-- Table structure for table `tbl_usergroup`
--

CREATE TABLE `tbl_usergroup` (
  `id` int(11) NOT NULL,
  `name` varchar(25) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `description` varchar(150) DEFAULT NULL,
  `status` int(1) NOT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_usergroup`
--

INSERT INTO `tbl_usergroup` (`id`, `name`, `bname`, `description`, `status`, `uid`, `date`) VALUES
(1, 'Administration', NULL, 'Main user Access', 1, 1, '2021-12-12 11:14:02');

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

--
-- Table structure for table `tbl_usermodule`
--

CREATE TABLE `tbl_usermodule` (
  `id` int(11) NOT NULL,
  `seid` int(11) NOT NULL,
  `daily` int(1) DEFAULT NULL,
  `purchase` int(1) DEFAULT NULL,
  `sales` int(1) DEFAULT NULL,
  `service` int(1) DEFAULT NULL,
  `warranty` int(1) DEFAULT NULL,
  `inventory` int(1) DEFAULT NULL,
  `operation` int(1) DEFAULT NULL,
  `client` int(1) DEFAULT NULL,
  `product` int(1) DEFAULT NULL,
  `master` int(1) DEFAULT NULL,
  `account` int(1) DEFAULT NULL,
  `financial` int(1) DEFAULT NULL,
  `payrol` int(1) DEFAULT NULL,
  `bank` int(1) DEFAULT NULL,
  `user` int(1) DEFAULT NULL,
  `report` int(1) DEFAULT NULL,
  `installment` int(11) DEFAULT NULL,
  `personal` int(11) DEFAULT NULL,
  `home` int(11) DEFAULT NULL,
  `date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `tbl_usermodule`
--

INSERT INTO `tbl_usermodule` (`id`, `seid`, `daily`, `purchase`, `sales`, `service`, `warranty`, `inventory`, `operation`, `client`, `product`, `master`, `account`, `financial`, `payrol`, `bank`, `user`, `report`, `installment`, `personal`, `home`, `date`) VALUES
(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, '2021-12-12');

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

--
-- Table structure for table `tbl_userpermision`
--

CREATE TABLE `tbl_userpermision` (
  `id` int(11) NOT NULL,
  `seid` int(11) NOT NULL,
  `pageid` int(3) NOT NULL,
  `views` int(1) NOT NULL,
  `creates` int(1) NOT NULL,
  `edits` int(1) NOT NULL,
  `deletes` int(1) NOT NULL,
  `prints` int(1) NOT NULL,
  `section` varchar(35) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_userpermision`
--

INSERT INTO `tbl_userpermision` (`id`, `seid`, `pageid`, `views`, `creates`, `edits`, `deletes`, `prints`, `section`) VALUES
(1, 1, 2, 1, 1, 1, 1, 1, 'daily'),
(2, 1, 3, 1, 1, 1, 1, 1, 'daily'),
(3, 1, 4, 1, 1, 1, 1, 1, 'daily'),
(4, 1, 5, 1, 1, 1, 1, 1, 'operation'),
(5, 1, 6, 1, 1, 1, 1, 1, 'operation'),
(6, 1, 7, 1, 1, 1, 1, 1, 'operation'),
(7, 1, 8, 1, 1, 1, 1, 1, 'operation'),
(8, 1, 9, 1, 1, 1, 1, 1, 'client'),
(9, 1, 10, 1, 1, 1, 1, 1, 'client'),
(10, 1, 11, 1, 1, 1, 1, 1, 'product'),
(11, 1, 12, 1, 1, 1, 1, 1, 'product'),
(12, 1, 13, 1, 1, 1, 1, 1, 'product'),
(13, 1, 14, 1, 1, 1, 1, 1, 'product'),
(14, 1, 15, 1, 1, 1, 1, 1, 'master'),
(15, 1, 16, 1, 1, 1, 1, 1, 'master'),
(16, 1, 17, 1, 1, 1, 1, 1, 'master'),
(17, 1, 18, 1, 1, 1, 1, 1, 'master'),
(18, 1, 19, 1, 1, 1, 1, 1, 'master'),
(19, 1, 20, 1, 1, 1, 1, 1, 'master'),
(20, 1, 21, 1, 1, 1, 1, 1, 'master'),
(21, 1, 22, 1, 1, 1, 1, 1, 'account'),
(22, 1, 23, 1, 1, 1, 1, 1, 'account'),
(23, 1, 24, 1, 1, 1, 1, 1, 'account'),
(24, 1, 25, 1, 1, 1, 1, 1, 'account'),
(25, 1, 26, 1, 1, 1, 1, 1, 'account'),
(26, 1, 27, 1, 1, 1, 1, 1, 'account'),
(27, 1, 28, 1, 1, 1, 1, 1, 'account'),
(28, 1, 29, 1, 1, 1, 1, 1, 'financial'),
(29, 1, 30, 1, 1, 1, 1, 1, 'financial'),
(30, 1, 31, 1, 1, 1, 1, 1, 'financial'),
(31, 1, 32, 1, 1, 1, 1, 1, 'financial'),
(32, 1, 33, 1, 1, 1, 1, 1, 'financial'),
(33, 1, 34, 1, 1, 1, 1, 1, 'payrol'),
(34, 1, 35, 1, 1, 1, 1, 1, 'payrol'),
(35, 1, 36, 1, 1, 1, 1, 1, 'payrol'),
(36, 1, 37, 1, 1, 1, 1, 1, 'payrol'),
(37, 1, 38, 1, 1, 1, 1, 1, 'payrol'),
(38, 1, 39, 1, 1, 1, 1, 1, 'payrol'),
(39, 1, 40, 1, 1, 1, 1, 1, 'payrol'),
(40, 1, 41, 1, 1, 1, 1, 1, 'bank'),
(41, 1, 42, 1, 1, 1, 1, 1, 'bank'),
(42, 1, 43, 1, 1, 1, 1, 1, 'bank'),
(43, 1, 44, 1, 1, 1, 1, 1, 'user'),
(44, 1, 45, 1, 1, 1, 1, 1, 'user'),
(45, 1, 46, 1, 1, 1, 1, 1, 'report'),
(46, 1, 47, 1, 1, 1, 1, 1, 'purchase'),
(47, 1, 48, 1, 1, 1, 1, 1, 'purchase'),
(48, 1, 49, 1, 1, 1, 1, 1, 'purchase'),
(49, 1, 50, 1, 1, 1, 1, 1, 'sales'),
(50, 1, 51, 1, 1, 1, 1, 1, 'sales'),
(51, 1, 52, 1, 1, 1, 1, 1, 'sales'),
(52, 1, 53, 1, 1, 1, 1, 1, 'service'),
(53, 1, 54, 1, 1, 1, 1, 1, 'service'),
(54, 1, 55, 1, 1, 1, 1, 1, 'service'),
(55, 1, 56, 1, 1, 1, 1, 1, 'warranty'),
(56, 1, 57, 1, 1, 1, 1, 1, 'warranty'),
(57, 1, 58, 1, 1, 1, 1, 1, 'warranty'),
(58, 1, 59, 1, 1, 1, 1, 1, 'warranty'),
(59, 1, 60, 1, 1, 1, 1, 1, 'warranty'),
(60, 1, 61, 1, 1, 1, 1, 1, 'warranty'),
(61, 1, 62, 1, 1, 1, 1, 1, 'warranty'),
(62, 1, 63, 1, 1, 1, 1, 1, 'inventory'),
(63, 1, 64, 1, 1, 1, 1, 1, 'inventory'),
(64, 1, 65, 1, 1, 1, 1, 1, 'inventory'),
(65, 1, 66, 1, 1, 1, 1, 1, 'inventory'),
(66, 1, 67, 1, 1, 1, 1, 1, 'inventory'),
(67, 1, 68, 1, 1, 1, 1, 1, 'inventory'),
(68, 1, 69, 1, 1, 1, 1, 1, 'inventory'),
(69, 1, 70, 1, 1, 1, 1, 1, 'inventory'),
(70, 1, 71, 1, 1, 1, 1, 1, 'inventory'),
(71, 1, 72, 1, 1, 1, 1, 1, 'inventory');

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

--
-- Table structure for table `tbl_userreportrole`
--

CREATE TABLE `tbl_userreportrole` (
  `id` int(11) NOT NULL,
  `access` int(11) NOT NULL,
  `uid` int(11) DEFAULT NULL,
  `brid` int(11) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `drp` int(11) DEFAULT 0,
  `drs` int(11) DEFAULT 0,
  `dre` int(11) DEFAULT 0,
  `dred` int(11) DEFAULT 0,
  `drdcs` int(11) DEFAULT 0,
  `drplin` int(11) DEFAULT 0,
  `drplit` int(11) DEFAULT 0,
  `dro` int(11) DEFAULT 0,
  `sarin` int(11) DEFAULT 0,
  `sarrin` int(11) DEFAULT 0,
  `sacw` int(11) DEFAULT 0,
  `sait` int(11) DEFAULT 0,
  `saitst` int(11) DEFAULT 0,
  `sapsr` int(11) DEFAULT 0,
  `sao` int(11) DEFAULT 0,
  `aclst` int(11) DEFAULT 0,
  `accst` int(11) DEFAULT 0,
  `acbst` int(11) DEFAULT 0,
  `acmst` int(11) DEFAULT 0,
  `acjh` int(11) DEFAULT 0,
  `actb` int(11) DEFAULT 0,
  `acbs` int(11) DEFAULT 0,
  `acpl` int(11) DEFAULT 0,
  `aco` int(11) DEFAULT 0,
  `puriv` int(11) DEFAULT 0,
  `purrin` int(11) DEFAULT 0,
  `pusw` int(11) DEFAULT 0,
  `puit` int(11) DEFAULT 0,
  `puitst` int(11) DEFAULT 0,
  `puppr` int(11) DEFAULT 0,
  `puo` int(11) DEFAULT 0,
  `recl` int(11) DEFAULT 0,
  `resl` int(11) DEFAULT 0,
  `recst` int(11) DEFAULT 0,
  `recstit` int(11) DEFAULT 0,
  `recdc` int(11) DEFAULT 0,
  `reco` int(11) DEFAULT 0,
  `reo` int(11) NOT NULL,
  `vop` int(11) DEFAULT 0,
  `vor` int(11) DEFAULT 0,
  `voj` int(11) DEFAULT 0,
  `voprst` int(11) DEFAULT 0,
  `voit` int(11) DEFAULT 0,
  `voo` int(11) DEFAULT 0,
  `inpl` int(11) DEFAULT 0,
  `insr` int(11) DEFAULT 0,
  `inis` int(11) DEFAULT 0,
  `inpic` int(11) DEFAULT 0,
  `iniv` int(11) DEFAULT 0,
  `inpiv` int(11) DEFAULT 0,
  `invo` int(11) DEFAULT 0,
  `pasl` int(11) DEFAULT 0,
  `pasb` int(11) DEFAULT 0,
  `pass` int(11) DEFAULT 0,
  `passi` int(11) DEFAULT 0,
  `pao` int(11) DEFAULT 0,
  `prel` int(11) DEFAULT 0,
  `pra` int(11) DEFAULT 0,
  `prla` int(11) DEFAULT 0,
  `prsr` int(11) DEFAULT 0,
  `prcr` int(11) DEFAULT 0,
  `pro` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `tbl_userreportrole`
--

INSERT INTO `tbl_userreportrole` (`id`, `access`, `uid`, `brid`, `date`, `drp`, `drs`, `dre`, `dred`, `drdcs`, `drplin`, `drplit`, `dro`, `sarin`, `sarrin`, `sacw`, `sait`, `saitst`, `sapsr`, `sao`, `aclst`, `accst`, `acbst`, `acmst`, `acjh`, `actb`, `acbs`, `acpl`, `aco`, `puriv`, `purrin`, `pusw`, `puit`, `puitst`, `puppr`, `puo`, `recl`, `resl`, `recst`, `recstit`, `recdc`, `reco`, `reo`, `vop`, `vor`, `voj`, `voprst`, `voit`, `voo`, `inpl`, `insr`, `inis`, `inpic`, `iniv`, `inpiv`, `invo`, `pasl`, `pasb`, `pass`, `passi`, `pao`, `prel`, `pra`, `prla`, `prsr`, `prcr`, `pro`) VALUES
(1, 1, 1, 0, '2021-10-31', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
(2, 2, 1, 0, '2021-11-01', 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

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

--
-- Table structure for table `tbl_waranty`
--

CREATE TABLE `tbl_waranty` (
  `id` int(11) NOT NULL,
  `type` varchar(2) NOT NULL,
  `cusid` int(11) NOT NULL,
  `supid` int(11) NOT NULL,
  `invno` varchar(15) NOT NULL,
  `refinv` varchar(15) NOT NULL,
  `pid` int(11) NOT NULL,
  `unqid` varchar(15) NOT NULL,
  `colid` int(11) NOT NULL DEFAULT 0,
  `sizid` int(11) NOT NULL DEFAULT 0,
  `cost` decimal(12,2) NOT NULL,
  `price` decimal(12,2) NOT NULL,
  `p_in` double NOT NULL DEFAULT 0,
  `p_out` double NOT NULL DEFAULT 0,
  `b_in` double NOT NULL DEFAULT 0,
  `b_out` double NOT NULL DEFAULT 0,
  `p_conid` int(1) NOT NULL,
  `serial` varchar(64) NOT NULL,
  `sel_date` date NOT NULL,
  `exp_date` date NOT NULL,
  `warn_status` int(1) NOT NULL,
  `cl_note` varchar(150) DEFAULT NULL,
  `ck_note` varchar(150) DEFAULT NULL,
  `ck_date` datetime DEFAULT NULL,
  `d_note` varchar(150) DEFAULT NULL,
  `d_date` datetime DEFAULT NULL,
  `d_type` int(11) DEFAULT NULL,
  `src_id` int(11) DEFAULT NULL,
  `rep_type` varchar(1) DEFAULT NULL,
  `rep_pid` int(11) DEFAULT NULL,
  `rep_unqid` varchar(15) DEFAULT NULL,
  `rep_serial` varchar(64) DEFAULT NULL,
  `rep_date` date DEFAULT NULL,
  `sat_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `d_status` int(1) NOT NULL DEFAULT 0,
  `estdate` date DEFAULT NULL,
  `binvno` varchar(15) DEFAULT NULL,
  `bst` int(11) DEFAULT 0,
  `bsrserial` varchar(25) DEFAULT NULL,
  `brid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `apdate` date NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tbl_warehouse`
--

CREATE TABLE `tbl_warehouse` (
  `id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `address` varchar(250) DEFAULT NULL,
  `baddress` varchar(350) DEFAULT NULL,
  `phone` varchar(18) NOT NULL,
  `email` varchar(45) DEFAULT NULL,
  `brid` int(11) DEFAULT 0,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Stand-in structure for view `tbl_whstock`
-- (See below for the actual view)
--
CREATE TABLE `tbl_whstock` (
`waid` int(11)
,`name` varchar(65)
,`bname` varchar(255)
,`code` varchar(15)
,`image` varchar(50)
,`pid` int(11)
,`unqid` varchar(15)
,`poqty` double
,`pqty` double
,`rcvqty` double
,`senqty` double
,`adjqty` double
,`avqty` double
);

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

--
-- Table structure for table `tbl_zone`
--

CREATE TABLE `tbl_zone` (
  `id` int(11) NOT NULL,
  `did` int(11) NOT NULL,
  `name` varchar(35) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `uid` int(11) NOT NULL,
  `date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tbl_zone`
--

INSERT INTO `tbl_zone` (`id`, `did`, `name`, `bname`, `uid`, `date`) VALUES
(1, 18, 'Mirpur', NULL, 6, '2020-07-12 04:23:43'),
(2, 18, 'Uttara', NULL, 6, '2020-07-12 04:24:11'),
(3, 18, 'Mohammadpur', NULL, 6, '2020-07-12 04:24:31'),
(4, 18, 'Dhanmondi', NULL, 6, '2020-07-12 04:24:52'),
(5, 18, 'Dhaka University', NULL, 6, '2020-07-12 04:25:26'),
(6, 18, 'Old Dhaka', NULL, 6, '2020-07-12 04:25:52'),
(7, 18, 'Zatrabari &amp; Shanir Akhra', NULL, 6, '2020-07-12 04:26:45'),
(8, 18, 'Demra', NULL, 6, '2020-07-12 04:27:15'),
(9, 18, 'Rampura &amp; Bonosree', NULL, 6, '2020-07-12 04:27:45'),
(10, 18, 'Moghbazar &amp; Malibagh', NULL, 6, '2020-07-12 04:28:17'),
(11, 18, 'Khilgaon, Goran &amp; Shahjahanpur', NULL, 6, '2020-07-12 04:30:52'),
(12, 18, 'Gulshan &amp; Baridhara', NULL, 6, '2020-07-12 04:31:17'),
(13, 18, 'Bashundhara R/A', NULL, 6, '2020-07-12 04:31:44'),
(14, 18, 'Firmgate', NULL, 6, '2020-07-12 04:32:00'),
(15, 18, 'Kuril, Bishshoroad &amp; Vatara', NULL, 6, '2020-07-12 04:32:36');

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

--
-- Structure for view `tbl_brstock`
--
DROP TABLE IF EXISTS `tbl_brstock`;

CREATE ALGORITHM=UNDEFINED  SQL SECURITY DEFINER VIEW `tbl_brstock`  AS  (select `brc`.`brid` AS `brid`,`bst`.`pid` AS `pid`,`pro`.`name` AS `name`,`pro`.`bname` AS `bname`,`pro`.`code` AS `pcode`,`pro`.`image` AS `image`,`pro`.`catid` AS `catid`,`pro`.`scatid` AS `scatid`,`pro`.`brnid` AS `brnid`,`brc`.`apdate` AS `apdate`,`brc`.`colid` AS `colid`,`brc`.`sizid` AS `sizid`,`bst`.`unqid` AS `unqid`,`bst`.`code` AS `code`,ifnull(`bro`.`poqty`,0) AS `poqty`,ifnull(`brp`.`pqty`,0) AS `pqty`,ifnull(`brr`.`prqty`,0) AS `prqty`,ifnull(`rcv`.`rcvqty`,0) AS `rcvqty`,ifnull(`sen`.`senqty`,0) AS `senqty`,ifnull(`brp`.`pqty`,0) + ifnull(`rcv`.`rcvqty`,0) - (ifnull(`brr`.`prqty`,0) + ifnull(`sen`.`senqty`,0)) AS `avpqty`,ifnull(`seo`.`soqty`,0) AS `soqty`,ifnull(`sel`.`sold`,0) AS `sold`,ifnull(`loc`.`sloc`,0) AS `sloc`,ifnull(`ser`.`srqty`,0) AS `srqty`,ifnull(`wor`.`woqty`,0) AS `woqty`,ifnull(`wer`.`wrqty`,0) AS `wrqty`,ifnull(`sel`.`sold`,0) - ifnull(`ser`.`srqty`,0) AS `fsqty`,ifnull(`dis`.`adjqty`,0) AS `adjqty`,ifnull(`brp`.`pqty`,0) + ifnull(`rcv`.`rcvqty`,0) + ifnull(`ser`.`srqty`,0) + ifnull(`wer`.`wrqty`,0) - (ifnull(`brr`.`prqty`,0) + ifnull(`sen`.`senqty`,0) + ifnull(`sel`.`sold`,0) + ifnull(`dis`.`adjqty`,0) + ifnull(`wor`.`woqty`,0)) AS `avqty`,`bst`.`status` AS `status` from (((((((((((((((select `tbl_stock`.`pid` AS `pid`,`tbl_stock`.`unqid` AS `unqid`,`tbl_stock`.`code` AS `code`,`tbl_stock`.`status` AS `status` from `tbl_stock` group by `tbl_stock`.`unqid`) `bst` left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`waid` is null group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `brc` on(`brc`.`unqid` = `bst`.`unqid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,sum(`tbl_traproduct`.`p_qty`) AS `poqty`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'PU' and `tbl_traproduct`.`waid` is null group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `bro` on(`bro`.`unqid` = `bst`.`unqid` and `bro`.`brid` = `brc`.`brid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,sum(`tbl_traproduct`.`p_in`) AS `pqty`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`mods` in ('PU','RC') and `tbl_traproduct`.`waid` is null group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `brp` on(`brp`.`unqid` = `bst`.`unqid` and `brp`.`brid` = `brc`.`brid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,sum(`tbl_traproduct`.`p_out`) AS `prqty`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'PR' group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `brr` on(`brr`.`unqid` = `bst`.`unqid` and `brr`.`brid` = `brc`.`brid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,sum(`tbl_traproduct`.`p_in`) AS `rcvqty`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'TR' and `tbl_traproduct`.`waid` is null group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `rcv` on(`rcv`.`unqid` = `bst`.`unqid` and `rcv`.`brid` = `brc`.`brid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,sum(`tbl_traproduct`.`p_out`) AS `senqty`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'TR' and `tbl_traproduct`.`waid` is null group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `sen` on(`sen`.`unqid` = `bst`.`unqid` and `sen`.`brid` = `brc`.`brid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,sum(`tbl_traproduct`.`s_qty`) AS `soqty`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'SE' group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `seo` on(`seo`.`unqid` = `bst`.`unqid` and `seo`.`brid` = `brc`.`brid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,sum(`tbl_traproduct`.`p_out`) AS `sold`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`mods` in ('SE','DL') group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `sel` on(`sel`.`unqid` = `bst`.`unqid` and `sel`.`brid` = `brc`.`brid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,sum(`tbl_traproduct`.`p_loc` - `tbl_traproduct`.`p_uloc`) AS `sloc`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`mods` in ('SE','DL') group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `loc` on(`loc`.`unqid` = `bst`.`unqid` and `loc`.`brid` = `brc`.`brid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,sum(`tbl_traproduct`.`p_in`) AS `srqty`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'SR' group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `ser` on(`ser`.`unqid` = `bst`.`unqid` and `ser`.`brid` = `brc`.`brid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,sum(`tbl_traproduct`.`p_out`) AS `woqty`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'WR' group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `wor` on(`wor`.`unqid` = `bst`.`unqid` and `wor`.`brid` = `brc`.`brid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,sum(`tbl_traproduct`.`p_in`) AS `wrqty`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'WR' group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `wer` on(`wer`.`unqid` = `bst`.`unqid` and `wer`.`brid` = `brc`.`brid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`colid` AS `colid`,`tbl_traproduct`.`sizid` AS `sizid`,sum(`tbl_traproduct`.`p_out`) AS `adjqty`,`tbl_traproduct`.`brid` AS `brid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'DS' group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`brid`) `dis` on(`dis`.`unqid` = `bst`.`unqid` and `dis`.`brid` = `brc`.`brid`)) left join (select `tbl_item`.`id` AS `id`,`tbl_item`.`code` AS `code`,`tbl_item`.`name` AS `name`,`tbl_item`.`bname` AS `bname`,`tbl_item`.`image` AS `image`,`tbl_item`.`catid` AS `catid`,`tbl_item`.`scatid` AS `scatid`,`tbl_item`.`brid` AS `brnid` from `tbl_item` where `tbl_item`.`status` = '1') `pro` on(`pro`.`id` = `bst`.`pid`)) where `brc`.`brid` is not null order by `pro`.`name`) ;

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

--
-- Structure for view `tbl_comstock`
--
DROP TABLE IF EXISTS `tbl_comstock`;

CREATE ALGORITHM=UNDEFINED  SQL SECURITY DEFINER VIEW `tbl_comstock`  AS  (select `stk`.`pid` AS `pid`,`pro`.`name` AS `name`,`pro`.`bname` AS `bname`,`pro`.`code` AS `code`,`pro`.`image` AS `image`,ifnull(`puo`.`poqty`,0) AS `poqty`,ifnull(`puq`.`pqty`,0) AS `pqty`,ifnull(`pur`.`prqty`,0) AS `prqty`,ifnull(`seo`.`soqty`,0) AS `soqty`,ifnull(`sel`.`sold`,0) AS `sold`,ifnull(`ser`.`srqty`,0) AS `srqty`,ifnull(`dis`.`adjqty`,0) AS `adjqty`,ifnull(`loc`.`sloc`,0) AS `sloc`,`puq`.`pqty` - ifnull(`pur`.`prqty`,0) - (ifnull(`sel`.`sold`,0) - ifnull(`ser`.`srqty`,0) + ifnull(`dis`.`adjqty`,0)) AS `avqty` from ((((((((((select `tbl_stock`.`pid` AS `pid` from `tbl_stock` group by `tbl_stock`.`pid`) `stk` left join (select `tbl_traproduct`.`pid` AS `pid`,sum(`tbl_traproduct`.`p_qty`) AS `poqty` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'PU' group by `tbl_traproduct`.`pid`) `puo` on(`puo`.`pid` = `stk`.`pid`)) left join (select `tbl_traproduct`.`pid` AS `pid`,sum(`tbl_traproduct`.`p_in`) AS `pqty` from `tbl_traproduct` where `tbl_traproduct`.`mods` in ('PU','RC') group by `tbl_traproduct`.`pid`) `puq` on(`puq`.`pid` = `stk`.`pid`)) left join (select `tbl_traproduct`.`pid` AS `pid`,sum(`tbl_traproduct`.`p_out`) AS `prqty` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'PR' group by `tbl_traproduct`.`pid`) `pur` on(`pur`.`pid` = `stk`.`pid`)) left join (select `tbl_traproduct`.`pid` AS `pid`,sum(`tbl_traproduct`.`s_qty`) AS `soqty` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'SE' group by `tbl_traproduct`.`pid`) `seo` on(`seo`.`pid` = `stk`.`pid`)) left join (select `tbl_traproduct`.`pid` AS `pid`,sum(`tbl_traproduct`.`p_out`) AS `sold` from `tbl_traproduct` where `tbl_traproduct`.`mods` in ('SE','DL') group by `tbl_traproduct`.`pid`) `sel` on(`sel`.`pid` = `stk`.`pid`)) left join (select `tbl_traproduct`.`pid` AS `pid`,sum(`tbl_traproduct`.`p_in`) AS `srqty` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'SR' group by `tbl_traproduct`.`pid`) `ser` on(`ser`.`pid` = `stk`.`pid`)) left join (select `tbl_traproduct`.`pid` AS `pid`,sum(`tbl_traproduct`.`p_out`) AS `adjqty` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'DS' group by `tbl_traproduct`.`pid`) `dis` on(`dis`.`pid` = `stk`.`pid`)) left join (select `tbl_traproduct`.`pid` AS `pid`,sum(`tbl_traproduct`.`p_loc` - `tbl_traproduct`.`p_uloc`) AS `sloc` from `tbl_traproduct` where `tbl_traproduct`.`mods` in ('SE','DL') group by `tbl_traproduct`.`pid`) `loc` on(`loc`.`pid` = `stk`.`pid`)) left join (select `tbl_item`.`id` AS `id`,`tbl_item`.`code` AS `code`,`tbl_item`.`name` AS `name`,`tbl_item`.`bname` AS `bname`,`tbl_item`.`image` AS `image` from `tbl_item` where `tbl_item`.`status` = '1') `pro` on(`pro`.`id` = `stk`.`pid`)) order by `pro`.`name`) ;

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


--
-- Structure for view `tbl_whstock`
--
DROP TABLE IF EXISTS `tbl_whstock`;

CREATE ALGORITHM=UNDEFINED  SQL SECURITY DEFINER VIEW `tbl_whstock`  AS  (select `weh`.`waid` AS `waid`,`pro`.`name` AS `name`,`pro`.`bname` AS `bname`,`pro`.`code` AS `code`,`pro`.`image` AS `image`,`wst`.`pid` AS `pid`,`wst`.`unqid` AS `unqid`,ifnull(`wpo`.`poqty`,0) AS `poqty`,ifnull(`wpu`.`pqty`,0) AS `pqty`,ifnull(`rcv`.`rcvqty`,0) AS `rcvqty`,ifnull(`sen`.`senqty`,0) AS `senqty`,ifnull(`dis`.`adjqty`,0) AS `adjqty`,ifnull(`wpu`.`pqty`,0) + ifnull(`rcv`.`rcvqty`,0) - (ifnull(`sen`.`senqty`,0) + ifnull(`dis`.`adjqty`,0)) AS `avqty` from ((((((((select `tbl_stock`.`pid` AS `pid`,`tbl_stock`.`unqid` AS `unqid` from `tbl_stock` group by `tbl_stock`.`unqid`) `wst` left join (select `tbl_traproduct`.`unqid` AS `unqid`,`tbl_traproduct`.`waid` AS `waid` from `tbl_traproduct` where `tbl_traproduct`.`brid` is null group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`waid`) `weh` on(`weh`.`unqid` = `wst`.`unqid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,sum(`tbl_traproduct`.`p_qty`) AS `poqty`,`tbl_traproduct`.`waid` AS `waid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'PU' and `tbl_traproduct`.`brid` is null group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`waid`) `wpo` on(`wpo`.`unqid` = `wst`.`unqid` and `wpo`.`waid` = `weh`.`waid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,sum(`tbl_traproduct`.`p_in`) AS `pqty`,`tbl_traproduct`.`waid` AS `waid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'PU' and `tbl_traproduct`.`brid` is null group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`waid`) `wpu` on(`wpu`.`unqid` = `wst`.`unqid` and `wpu`.`waid` = `weh`.`waid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,sum(`tbl_traproduct`.`p_in`) AS `rcvqty`,`tbl_traproduct`.`waid` AS `waid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'TR' and `tbl_traproduct`.`brid` is null group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`waid`) `rcv` on(`rcv`.`unqid` = `wst`.`unqid` and `rcv`.`waid` = `weh`.`waid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,sum(`tbl_traproduct`.`p_out`) AS `senqty`,`tbl_traproduct`.`waid` AS `waid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'TR' and `tbl_traproduct`.`brid` is null group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`waid`) `sen` on(`sen`.`unqid` = `wst`.`unqid` and `sen`.`waid` = `weh`.`waid`)) left join (select `tbl_traproduct`.`unqid` AS `unqid`,sum(`tbl_traproduct`.`p_out`) AS `adjqty`,`tbl_traproduct`.`waid` AS `waid` from `tbl_traproduct` where `tbl_traproduct`.`mods` = 'DS' and `tbl_traproduct`.`brid` is null group by `tbl_traproduct`.`unqid`,`tbl_traproduct`.`waid`) `dis` on(`dis`.`unqid` = `wst`.`unqid` and `dis`.`waid` = `weh`.`waid`)) left join (select `tbl_item`.`id` AS `id`,`tbl_item`.`code` AS `code`,`tbl_item`.`name` AS `name`,`tbl_item`.`bname` AS `bname`,`tbl_item`.`image` AS `image` from `tbl_item` where `tbl_item`.`status` = '1') `pro` on(`pro`.`id` = `wst`.`pid`)) where `weh`.`waid` is not null order by `pro`.`name`) ;

--
-- Indexes for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- Indexes for table `tbl_traproduct`
--
ALTER TABLE `tbl_traproduct`
  ADD PRIMARY KEY (`id`),
  ADD KEY `apdate` (`pid`,`unqid`,`apdate`,`date`) USING BTREE;

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

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

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

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `tbl_acgroup`
--
ALTER TABLE `tbl_acgroup`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `tbl_aclass`
--
ALTER TABLE `tbl_aclass`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `tbl_acledger`
--
ALTER TABLE `tbl_acledger`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=66;

--
-- AUTO_INCREMENT for table `tbl_acmobile`
--
ALTER TABLE `tbl_acmobile`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_acsubgroup`
--
ALTER TABLE `tbl_acsubgroup`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=40;

--
-- AUTO_INCREMENT for table `tbl_activity`
--
ALTER TABLE `tbl_activity`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `tbl_bacount`
--
ALTER TABLE `tbl_bacount`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_badstockclaim`
--
ALTER TABLE `tbl_badstockclaim`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_bank`
--
ALTER TABLE `tbl_bank`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `tbl_banktra`
--
ALTER TABLE `tbl_banktra`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_banktrade`
--
ALTER TABLE `tbl_banktrade`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_branch`
--
ALTER TABLE `tbl_branch`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_brand`
--
ALTER TABLE `tbl_brand`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_cashflow`
--
ALTER TABLE `tbl_cashflow`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_category`
--
ALTER TABLE `tbl_category`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_cgroup`
--
ALTER TABLE `tbl_cgroup`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_cheqman`
--
ALTER TABLE `tbl_cheqman`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_color`
--
ALTER TABLE `tbl_color`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `tbl_company`
--
ALTER TABLE `tbl_company`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `tbl_country`
--
ALTER TABLE `tbl_country`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `tbl_currency`
--
ALTER TABLE `tbl_currency`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `tbl_customer`
--
ALTER TABLE `tbl_customer`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_delivery`
--
ALTER TABLE `tbl_delivery`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_department`
--
ALTER TABLE `tbl_department`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_designation`
--
ALTER TABLE `tbl_designation`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_disposal`
--
ALTER TABLE `tbl_disposal`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `tbl_district`
--
ALTER TABLE `tbl_district`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=65;

--
-- AUTO_INCREMENT for table `tbl_employe`
--
ALTER TABLE `tbl_employe`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_esexpenses`
--
ALTER TABLE `tbl_esexpenses`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `tbl_esexpensesde`
--
ALTER TABLE `tbl_esexpensesde`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `tbl_estimate`
--
ALTER TABLE `tbl_estimate`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_estimatede`
--
ALTER TABLE `tbl_estimatede`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_expensedue`
--
ALTER TABLE `tbl_expensedue`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_expenses`
--
ALTER TABLE `tbl_expenses`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_expensesde`
--
ALTER TABLE `tbl_expensesde`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_invoice`
--
ALTER TABLE `tbl_invoice`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_invoicede`
--
ALTER TABLE `tbl_invoicede`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_item`
--
ALTER TABLE `tbl_item`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_journal`
--
ALTER TABLE `tbl_journal`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_journalde`
--
ALTER TABLE `tbl_journalde`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_lcopen`
--
ALTER TABLE `tbl_lcopen`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_leave`
--
ALTER TABLE `tbl_leave`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_leaverequest`
--
ALTER TABLE `tbl_leaverequest`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_loanid`
--
ALTER TABLE `tbl_loanid`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_manfacturer`
--
ALTER TABLE `tbl_manfacturer`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_note`
--
ALTER TABLE `tbl_note`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_parent`
--
ALTER TABLE `tbl_parent`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_payvoucher`
--
ALTER TABLE `tbl_payvoucher`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_payvoucherde`
--
ALTER TABLE `tbl_payvoucherde`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_pdlirecord`
--
ALTER TABLE `tbl_pdlirecord`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_precrecord`
--
ALTER TABLE `tbl_precrecord`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_preturn`
--
ALTER TABLE `tbl_preturn`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_proinv`
--
ALTER TABLE `tbl_proinv`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_proinvde`
--
ALTER TABLE `tbl_proinvde`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_purchase`
--
ALTER TABLE `tbl_purchase`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_purorder`
--
ALTER TABLE `tbl_purorder`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_purorderde`
--
ALTER TABLE `tbl_purorderde`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_recvoucher`
--
ALTER TABLE `tbl_recvoucher`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_recvoucherde`
--
ALTER TABLE `tbl_recvoucherde`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_reqitem`
--
ALTER TABLE `tbl_reqitem`
  MODIFY `id` int(100) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_requisition`
--
ALTER TABLE `tbl_requisition`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_salarysheet`
--
ALTER TABLE `tbl_salarysheet`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_sales`
--
ALTER TABLE `tbl_sales`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_selquotation`
--
ALTER TABLE `tbl_selquotation`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_sercenter`
--
ALTER TABLE `tbl_sercenter`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_serial`
--
ALTER TABLE `tbl_serial`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_serialsale`
--
ALTER TABLE `tbl_serialsale`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_seritem`
--
ALTER TABLE `tbl_seritem`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_serreceive`
--
ALTER TABLE `tbl_serreceive`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_sersales`
--
ALTER TABLE `tbl_sersales`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_sersalesde`
--
ALTER TABLE `tbl_sersalesde`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_setting`
--
ALTER TABLE `tbl_setting`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `tbl_shipline`
--
ALTER TABLE `tbl_shipline`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_size`
--
ALTER TABLE `tbl_size`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_sms`
--
ALTER TABLE `tbl_sms`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `tbl_sreturn`
--
ALTER TABLE `tbl_sreturn`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_stock`
--
ALTER TABLE `tbl_stock`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_subcat`
--
ALTER TABLE `tbl_subcat`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_supplier`
--
ALTER TABLE `tbl_supplier`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_trafrbra`
--
ALTER TABLE `tbl_trafrbra`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_trafrwho`
--
ALTER TABLE `tbl_trafrwho`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_traproduct`
--
ALTER TABLE `tbl_traproduct`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_trarecord`
--
ALTER TABLE `tbl_trarecord`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_unit`
--
ALTER TABLE `tbl_unit`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;

--
-- AUTO_INCREMENT for table `tbl_user`
--
ALTER TABLE `tbl_user`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `tbl_usergroup`
--
ALTER TABLE `tbl_usergroup`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `tbl_usermodule`
--
ALTER TABLE `tbl_usermodule`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `tbl_userpermision`
--
ALTER TABLE `tbl_userpermision`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=285;

--
-- AUTO_INCREMENT for table `tbl_userreportrole`
--
ALTER TABLE `tbl_userreportrole`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `tbl_waranty`
--
ALTER TABLE `tbl_waranty`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_warehouse`
--
ALTER TABLE `tbl_warehouse`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tbl_zone`
--
ALTER TABLE `tbl_zone`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
COMMIT;

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



DROP TABLE IF EXISTS `tbl_ledger`;

CREATE ALGORITHM=UNDEFINED  SQL SECURITY DEFINER VIEW `tbl_ledger`  AS  select convert(concat('LE',`tbl_acledger`.`id`) using utf8) collate utf8_general_ci AS `id`,`tbl_acledger`.`code` AS `code`,`tbl_acledger`.`grid` AS `grid`,`tbl_acgroup`.`name` AS `groups`,`tbl_acledger`.`sgrid` AS `sgrid`,`tbl_acsubgroup`.`name` AS `sgroup`,`tbl_acledger`.`name` AS `ledger`,`tbl_acgroup`.`clsid` AS `clsid`,`tbl_aclass`.`name` AS `class` from (((`tbl_acledger` left join `tbl_acgroup` on(`tbl_acgroup`.`id` = `tbl_acledger`.`grid`)) left join `tbl_acsubgroup` on(`tbl_acsubgroup`.`id` = `tbl_acledger`.`sgrid`)) left join `tbl_aclass` on(`tbl_aclass`.`id` = `tbl_acgroup`.`clsid`)) union all select concat('BA',`tbl_bacount`.`id`) AS `id`,NULL AS `code`,`tbl_acsubgroup`.`grid` AS `grid`,`tbl_acgroup`.`name` AS `groups`,`tbl_acsubgroup`.`id` AS `sgrid`,`tbl_acsubgroup`.`name` AS `sgroup`,concat(`tbl_bank`.`sort`,'/',`tbl_bacount`.`acno`) AS `ledger`,`tbl_acgroup`.`clsid` AS `clsid`,`tbl_aclass`.`name` AS `class` from ((((`tbl_bacount` left join `tbl_acsubgroup` on(`tbl_acsubgroup`.`id` = '2')) left join `tbl_acgroup` on(`tbl_acgroup`.`id` = `tbl_acsubgroup`.`grid`)) left join `tbl_bank` on(`tbl_bank`.`id` = `tbl_bacount`.`bid`)) left join `tbl_aclass` on(`tbl_aclass`.`id` = `tbl_acgroup`.`clsid`)) union all select concat('PD',`tbl_item`.`id`) AS `id`,`tbl_item`.`code` AS `code`,`tbl_acsubgroup`.`grid` AS `grid`,`tbl_acgroup`.`name` AS `groups`,`tbl_acsubgroup`.`id` AS `sgrid`,`tbl_acsubgroup`.`name` AS `sgroup`,`tbl_item`.`name` AS `ledger`,`tbl_acgroup`.`clsid` AS `clsid`,`tbl_aclass`.`name` AS `class` from (((`tbl_item` left join `tbl_acsubgroup` on(`tbl_acsubgroup`.`id` = '3')) left join `tbl_acgroup` on(`tbl_acgroup`.`id` = `tbl_acsubgroup`.`grid`)) left join `tbl_aclass` on(`tbl_aclass`.`id` = `tbl_acgroup`.`clsid`)) union all select concat('CU',`tbl_customer`.`id`) AS `id`,`tbl_customer`.`code` AS `code`,`tbl_acsubgroup`.`grid` AS `grid`,`tbl_acgroup`.`name` AS `groups`,`tbl_acsubgroup`.`id` AS `sgrid`,`tbl_acsubgroup`.`name` AS `sgroup`,`tbl_customer`.`name` AS `ledger`,`tbl_acgroup`.`clsid` AS `clsid`,`tbl_aclass`.`name` AS `class` from (((`tbl_customer` left join `tbl_acsubgroup` on(`tbl_acsubgroup`.`id` = '4')) left join `tbl_acgroup` on(`tbl_acgroup`.`id` = `tbl_acsubgroup`.`grid`)) left join `tbl_aclass` on(`tbl_aclass`.`id` = `tbl_acgroup`.`clsid`)) union all select concat('SU',`tbl_supplier`.`id`) AS `id`,`tbl_supplier`.`code` AS `code`,`tbl_acsubgroup`.`grid` AS `grid`,`tbl_acgroup`.`name` AS `groups`,`tbl_acsubgroup`.`id` AS `sgrid`,`tbl_acsubgroup`.`name` AS `sgroup`,`tbl_supplier`.`name` AS `ledger`,`tbl_acgroup`.`clsid` AS `clsid`,`tbl_aclass`.`name` AS `class` from (((`tbl_supplier` left join `tbl_acsubgroup` on(`tbl_acsubgroup`.`id` = '13')) left join `tbl_acgroup` on(`tbl_acgroup`.`id` = `tbl_acsubgroup`.`grid`)) left join `tbl_aclass` on(`tbl_aclass`.`id` = `tbl_acgroup`.`clsid`)) union all select concat('EM',`tbl_employe`.`id`) AS `id`,`tbl_employe`.`code` AS `code`,`tbl_acsubgroup`.`grid` AS `grid`,`tbl_acgroup`.`name` AS `groups`,`tbl_acsubgroup`.`id` AS `sgrid`,`tbl_acsubgroup`.`name` AS `sgroup`,`tbl_employe`.`name` AS `ledger`,`tbl_acgroup`.`clsid` AS `clsid`,`tbl_aclass`.`name` AS `class` from (((`tbl_employe` left join `tbl_acsubgroup` on(`tbl_acsubgroup`.`id` = '33')) left join `tbl_acgroup` on(`tbl_acgroup`.`id` = `tbl_acsubgroup`.`grid`)) left join `tbl_aclass` on(`tbl_aclass`.`id` = `tbl_acgroup`.`clsid`)) union all select concat('SE',`tbl_seritem`.`id`) AS `id`,`tbl_seritem`.`code` AS `code`,`tbl_acsubgroup`.`grid` AS `grid`,`tbl_acgroup`.`name` AS `groups`,`tbl_acsubgroup`.`id` AS `sgrid`,`tbl_acsubgroup`.`name` AS `sgroup`,`tbl_seritem`.`name` AS `ledger`,`tbl_acgroup`.`clsid` AS `clsid`,`tbl_aclass`.`name` AS `class` from (((`tbl_seritem` left join `tbl_acsubgroup` on(`tbl_acsubgroup`.`id` = '26')) left join `tbl_acgroup` on(`tbl_acgroup`.`id` = `tbl_acsubgroup`.`grid`)) left join `tbl_aclass` on(`tbl_aclass`.`id` = `tbl_acgroup`.`clsid`)) union all select concat('MO',`tbl_acmobile`.`id`) AS `id`,NULL AS `code`,`tbl_acsubgroup`.`grid` AS `grid`,`tbl_acgroup`.`name` AS `groups`,`tbl_acsubgroup`.`id` AS `sgrid`,`tbl_acsubgroup`.`name` AS `sgroup`,concat(`tbl_acmobile`.`name`,' - ',`tbl_acmobile`.`mobile`) AS `ledger`,`tbl_acgroup`.`clsid` AS `clsid`,`tbl_aclass`.`name` AS `class` from (((`tbl_acmobile` left join `tbl_acsubgroup` on(`tbl_acsubgroup`.`id` = '34')) left join `tbl_acgroup` on(`tbl_acgroup`.`id` = `tbl_acsubgroup`.`grid`)) left join `tbl_aclass` on(`tbl_aclass`.`id` = `tbl_acgroup`.`clsid`)) union all select concat('LO',`tbl_loanid`.`id`) AS `id`,`tbl_loanid`.`code` AS `code`,`tbl_acsubgroup`.`grid` AS `grid`,`tbl_acgroup`.`name` AS `groups`,`tbl_acsubgroup`.`id` AS `sgrid`,`tbl_acsubgroup`.`name` AS `sgroup`,if(`tbl_loanid`.`acno` is not null,concat(`tbl_loanid`.`name`,' - ',`tbl_loanid`.`acno`),concat(`tbl_loanid`.`name`,' - ',`tbl_loanid`.`mobile`)) AS `ledger`,`tbl_acgroup`.`clsid` AS `clsid`,`tbl_aclass`.`name` AS `class` from (((`tbl_loanid` left join `tbl_acsubgroup` on(`tbl_acsubgroup`.`id` = if(`tbl_loanid`.`type` = 0,'35','36'))) left join `tbl_acgroup` on(`tbl_acgroup`.`id` = `tbl_acsubgroup`.`grid`)) left join `tbl_aclass` on(`tbl_aclass`.`id` = `tbl_acgroup`.`clsid`)) ;




DROP TABLE IF EXISTS `tbl_traledger`;

CREATE ALGORITHM=UNDEFINED  SQL SECURITY DEFINER VIEW `tbl_traledger`  AS  select `tbl_trarecord`.`id` AS `id`,`tbl_trarecord`.`invno` AS `invno`,`tbl_trarecord`.`refinv` AS `refinv`,`tbl_trarecord`.`dty` AS `dty`,`tbl_trarecord`.`did` AS `did`,`tbl_trarecord`.`amo` AS `amo`,`tbl_trarecord`.`cid` AS `cid`,`tbl_trarecord`.`cty` AS `cty`,`tbl_trarecord`.`chkno` AS `chkno`,`tbl_trarecord`.`chkdt` AS `chkdt`,`tbl_trarecord`.`otnote` AS `otnote`,`tbl_trarecord`.`recon` AS `recon`,`tbl_trarecord`.`ref` AS `ref`,`tbl_trarecord`.`curid` AS `curid`,`tbl_trarecord`.`xrate` AS `xrate`,`tbl_trarecord`.`apdate` AS `apdate`,`tbl_trarecord`.`brid` AS `brid`,`tbl_trarecord`.`uid` AS `uid`,`tbl_trarecord`.`date` AS `date` from `tbl_trarecord` union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,'PD' AS `dty`,`tbl_traproduct`.`pid` AS `did`,`tbl_traproduct`.`cost` * `tbl_traproduct`.`p_qty` AS `amo`,`tbl_purchase`.`supid` AS `cid`,`tbl_purchase`.`type` AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,`tbl_purchase`.`curid` AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_purchase` on(`tbl_purchase`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'PU' union all select `tbl_purchase`.`id` AS `id`,`tbl_purchase`.`invno` AS `invno`,NULL AS `refinv`,`tbl_purchase`.`type` AS `dty`,`tbl_purchase`.`supid` AS `did`,`tbl_purchase`.`itemdis` AS `amo`,cast('42' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_purchase`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_purchase`.`apdate` AS `apdate`,`tbl_purchase`.`brid` AS `brid`,`tbl_purchase`.`uid` AS `uid`,`tbl_purchase`.`date` AS `date` from `tbl_purchase` where `tbl_purchase`.`itemdis` > 0 union all select `tbl_purchase`.`id` AS `id`,`tbl_purchase`.`invno` AS `invno`,NULL AS `refinv`,`tbl_purchase`.`type` AS `dty`,`tbl_purchase`.`supid` AS `did`,`tbl_purchase`.`disamo` AS `amo`,cast('41' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_purchase`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_purchase`.`apdate` AS `apdate`,`tbl_purchase`.`brid` AS `brid`,`tbl_purchase`.`uid` AS `uid`,`tbl_purchase`.`date` AS `date` from `tbl_purchase` where `tbl_purchase`.`disamo` > 0 union all select `tbl_purchase`.`id` AS `id`,`tbl_purchase`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('25' as signed) AS `did`,`tbl_purchase`.`vatamo` AS `amo`,`tbl_purchase`.`supid` AS `cid`,`tbl_purchase`.`type` AS `cty`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_purchase`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_purchase`.`apdate` AS `apdate`,`tbl_purchase`.`brid` AS `brid`,`tbl_purchase`.`uid` AS `uid`,`tbl_purchase`.`date` AS `date` from `tbl_purchase` where `tbl_purchase`.`vatamo` > 0 union all select `tbl_purchase`.`id` AS `id`,`tbl_purchase`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('26' as signed) AS `did`,`tbl_purchase`.`taxamo` AS `amo`,`tbl_purchase`.`supid` AS `cid`,`tbl_purchase`.`type` AS `cty`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_purchase`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_purchase`.`apdate` AS `apdate`,`tbl_purchase`.`brid` AS `brid`,`tbl_purchase`.`uid` AS `uid`,`tbl_purchase`.`date` AS `date` from `tbl_purchase` where `tbl_purchase`.`taxamo` > 0 union all select `tbl_purchase`.`id` AS `id`,`tbl_purchase`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('27' as signed) AS `did`,`tbl_purchase`.`otamo` AS `amo`,`tbl_purchase`.`supid` AS `cid`,`tbl_purchase`.`type` AS `cty`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_purchase`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_purchase`.`apdate` AS `apdate`,`tbl_purchase`.`brid` AS `brid`,`tbl_purchase`.`uid` AS `uid`,`tbl_purchase`.`date` AS `date` from `tbl_purchase` where `tbl_purchase`.`otamo` > 0 union all select `tbl_purchase`.`id` AS `id`,`tbl_purchase`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('27' as signed) AS `did`,`tbl_purchase`.`spmoney` AS `amo`,`tbl_purchase`.`supid` AS `cid`,`tbl_purchase`.`type` AS `cty`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_purchase`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_purchase`.`apdate` AS `apdate`,`tbl_purchase`.`brid` AS `brid`,`tbl_purchase`.`uid` AS `uid`,`tbl_purchase`.`date` AS `date` from `tbl_purchase` where `tbl_purchase`.`spmoney` > 0 union all select `tbl_purchase`.`id` AS `id`,`tbl_purchase`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('44' as signed) AS `did`,`tbl_purchase`.`freight` AS `amo`,`tbl_purchase`.`supid` AS `cid`,`tbl_purchase`.`type` AS `cty`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_purchase`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_purchase`.`apdate` AS `apdate`,`tbl_purchase`.`brid` AS `brid`,`tbl_purchase`.`uid` AS `uid`,`tbl_purchase`.`date` AS `date` from `tbl_purchase` where `tbl_purchase`.`freight` > 0 union all select `tbl_purchase`.`id` AS `id`,`tbl_purchase`.`invno` AS `invno`,NULL AS `refinv`,`tbl_purchase`.`type` AS `dty`,`tbl_purchase`.`supid` AS `did`,`tbl_purchase`.`less` AS `amo`,cast('43' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_purchase`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_purchase`.`apdate` AS `apdate`,`tbl_purchase`.`brid` AS `brid`,`tbl_purchase`.`uid` AS `uid`,`tbl_purchase`.`date` AS `date` from `tbl_purchase` where `tbl_purchase`.`less` > 0 union all select `tbl_purchase`.`id` AS `id`,`tbl_purchase`.`invno` AS `invno`,`tbl_purchase`.`invno` AS `refinv`,`tbl_purchase`.`type` AS `dty`,`tbl_purchase`.`supid` AS `did`,`tbl_purchase`.`rawcash` - `tbl_purchase`.`changes` AS `amo`,cast(`SPLIT_STRING`(`tbl_purchase`.`creditid`,'_',2) as signed) AS `cid`,`SPLIT_STRING`(`tbl_purchase`.`creditid`,'_',1) AS `cty`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_purchase`.`details`) > 3,if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_purchase`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_purchase`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_purchase`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,`tbl_purchase`.`ref` AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_purchase`.`apdate` AS `apdate`,`tbl_purchase`.`brid` AS `brid`,`tbl_purchase`.`uid` AS `uid`,`tbl_purchase`.`date` AS `date` from `tbl_purchase` where `tbl_purchase`.`rawcash` - `tbl_purchase`.`changes` > 0 union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,`tbl_preturn`.`type` AS `dty`,`tbl_preturn`.`cusid` AS `did`,`tbl_traproduct`.`cost` * `tbl_traproduct`.`p_out` AS `amo`,`tbl_traproduct`.`pid` AS `cid`,'PD' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_preturn` on(`tbl_preturn`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'PR' union all select `tbl_preturn`.`id` AS `id`,`tbl_preturn`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('42' as signed) AS `did`,`tbl_preturn`.`itemdis` AS `amo`,`tbl_preturn`.`cusid` AS `cid`,`tbl_preturn`.`type` AS `cty`,if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_preturn`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_preturn`.`apdate` AS `apdate`,`tbl_preturn`.`brid` AS `brid`,`tbl_preturn`.`uid` AS `uid`,`tbl_preturn`.`date` AS `date` from `tbl_preturn` where `tbl_preturn`.`itemdis` > 0 union all select `tbl_preturn`.`id` AS `id`,`tbl_preturn`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('41' as signed) AS `did`,`tbl_preturn`.`disamo` AS `amo`,`tbl_preturn`.`cusid` AS `cid`,`tbl_preturn`.`type` AS `cty`,if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_preturn`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_preturn`.`apdate` AS `apdate`,`tbl_preturn`.`brid` AS `brid`,`tbl_preturn`.`uid` AS `uid`,`tbl_preturn`.`date` AS `date` from `tbl_preturn` where `tbl_preturn`.`disamo` > 0 union all select `tbl_preturn`.`id` AS `id`,`tbl_preturn`.`invno` AS `invno`,NULL AS `refinv`,`tbl_preturn`.`type` AS `dty`,`tbl_preturn`.`cusid` AS `did`,`tbl_preturn`.`vatamo` AS `amo`,cast('25' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_preturn`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_preturn`.`apdate` AS `apdate`,`tbl_preturn`.`brid` AS `brid`,`tbl_preturn`.`uid` AS `uid`,`tbl_preturn`.`date` AS `date` from `tbl_preturn` where `tbl_preturn`.`vatamo` > 0 union all select `tbl_preturn`.`id` AS `id`,`tbl_preturn`.`invno` AS `invno`,NULL AS `refinv`,`tbl_preturn`.`type` AS `dty`,`tbl_preturn`.`cusid` AS `did`,`tbl_preturn`.`taxamo` AS `amo`,cast('26' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_preturn`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_preturn`.`apdate` AS `apdate`,`tbl_preturn`.`brid` AS `brid`,`tbl_preturn`.`uid` AS `uid`,`tbl_preturn`.`date` AS `date` from `tbl_preturn` where `tbl_preturn`.`taxamo` > 0 union all select `tbl_preturn`.`id` AS `id`,`tbl_preturn`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('45' as signed) AS `did`,`tbl_preturn`.`less` AS `amo`,`tbl_preturn`.`cusid` AS `cid`,`tbl_preturn`.`type` AS `cty`,if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_preturn`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_preturn`.`apdate` AS `apdate`,`tbl_preturn`.`brid` AS `brid`,`tbl_preturn`.`uid` AS `uid`,`tbl_preturn`.`date` AS `date` from `tbl_preturn` where `tbl_preturn`.`less` > 0 union all select `tbl_preturn`.`id` AS `id`,`tbl_preturn`.`invno` AS `invno`,`tbl_preturn`.`invno` AS `refinv`,`SPLIT_STRING`(`tbl_preturn`.`debitid`,'_',1) AS `dty`,cast(`SPLIT_STRING`(`tbl_preturn`.`debitid`,'_',2) as signed) AS `did`,`tbl_preturn`.`rawcash` - `tbl_preturn`.`changes` AS `amo`,`tbl_preturn`.`cusid` AS `cid`,`tbl_preturn`.`type` AS `cty`,if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_preturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_preturn`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_preturn`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_preturn`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_preturn`.`apdate` AS `apdate`,`tbl_preturn`.`brid` AS `brid`,`tbl_preturn`.`uid` AS `uid`,`tbl_preturn`.`date` AS `date` from `tbl_preturn` where `tbl_preturn`.`rawcash` - `tbl_preturn`.`changes` > 0 union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sales`.`type` AS `dty`,`tbl_sales`.`cusid` AS `did`,`tbl_traproduct`.`price` * `tbl_traproduct`.`p_out` AS `amo`,`tbl_traproduct`.`pid` AS `cid`,'PD' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_sales` on(`tbl_sales`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'SE' union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,'PD' AS `dty`,`tbl_traproduct`.`pid` AS `did`,`tbl_traproduct`.`price` * `tbl_traproduct`.`p_out` AS `amo`,'34' AS `cid`,'LE' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_sales` on(`tbl_sales`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'SE' union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,'14' AS `did`,`tbl_traproduct`.`cost` * `tbl_traproduct`.`p_out` AS `amo`,`tbl_traproduct`.`pid` AS `cid`,'PD' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_sales` on(`tbl_sales`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'SE' union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,'42' AS `did`,`tbl_traproduct`.`icdis` * `tbl_traproduct`.`p_out` AS `amo`,`tbl_traproduct`.`pid` AS `cid`,'PD' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_sales` on(`tbl_sales`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'SE' and `tbl_traproduct`.`icdis` > 0 union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,'41' AS `did`,`tbl_traproduct`.`icinvdis` * `tbl_traproduct`.`p_out` AS `amo`,`tbl_traproduct`.`pid` AS `cid`,'PD' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_sales` on(`tbl_sales`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'SE' and `tbl_traproduct`.`icinvdis` > 0 union all select `tbl_sales`.`id` AS `id`,`tbl_sales`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('37' as signed) AS `did`,`tbl_sales`.`itemdis` AS `amo`,`tbl_sales`.`cusid` AS `cid`,`tbl_sales`.`type` AS `cty`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sales`.`apdate` AS `apdate`,`tbl_sales`.`brid` AS `brid`,`tbl_sales`.`uid` AS `uid`,`tbl_sales`.`date` AS `date` from `tbl_sales` where `tbl_sales`.`itemdis` > 0 union all select `tbl_sales`.`id` AS `id`,`tbl_sales`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('36' as signed) AS `did`,`tbl_sales`.`disamo` AS `amo`,`tbl_sales`.`cusid` AS `cid`,`tbl_sales`.`type` AS `cty`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sales`.`apdate` AS `apdate`,`tbl_sales`.`brid` AS `brid`,`tbl_sales`.`uid` AS `uid`,`tbl_sales`.`date` AS `date` from `tbl_sales` where `tbl_sales`.`disamo` > 0 union all select `tbl_sales`.`id` AS `id`,`tbl_sales`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sales`.`type` AS `dty`,`tbl_sales`.`cusid` AS `did`,`tbl_sales`.`vatamo` AS `amo`,cast('10' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sales`.`apdate` AS `apdate`,`tbl_sales`.`brid` AS `brid`,`tbl_sales`.`uid` AS `uid`,`tbl_sales`.`date` AS `date` from `tbl_sales` where `tbl_sales`.`vatamo` > 0 union all select `tbl_sales`.`id` AS `id`,`tbl_sales`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sales`.`type` AS `dty`,`tbl_sales`.`cusid` AS `did`,`tbl_sales`.`aitamo` AS `amo`,cast('38' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sales`.`apdate` AS `apdate`,`tbl_sales`.`brid` AS `brid`,`tbl_sales`.`uid` AS `uid`,`tbl_sales`.`date` AS `date` from `tbl_sales` where `tbl_sales`.`aitamo` > 0 union all select `tbl_sales`.`id` AS `id`,`tbl_sales`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sales`.`type` AS `dty`,`tbl_sales`.`cusid` AS `did`,`tbl_sales`.`otamo` AS `amo`,cast('39' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sales`.`apdate` AS `apdate`,`tbl_sales`.`brid` AS `brid`,`tbl_sales`.`uid` AS `uid`,`tbl_sales`.`date` AS `date` from `tbl_sales` where `tbl_sales`.`otamo` > 0 union all select `tbl_sales`.`id` AS `id`,`tbl_sales`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sales`.`type` AS `dty`,`tbl_sales`.`cusid` AS `did`,`tbl_sales`.`freight` AS `amo`,cast('12' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sales`.`apdate` AS `apdate`,`tbl_sales`.`brid` AS `brid`,`tbl_sales`.`uid` AS `uid`,`tbl_sales`.`date` AS `date` from `tbl_sales` where `tbl_sales`.`freight` > 0 union all select `tbl_sales`.`id` AS `id`,`tbl_sales`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('40' as signed) AS `did`,`tbl_sales`.`less` AS `amo`,`tbl_sales`.`cusid` AS `cid`,`tbl_sales`.`type` AS `cty`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sales`.`apdate` AS `apdate`,`tbl_sales`.`brid` AS `brid`,`tbl_sales`.`uid` AS `uid`,`tbl_sales`.`date` AS `date` from `tbl_sales` where `tbl_sales`.`less` > 0 union all select `tbl_sales`.`id` AS `id`,`tbl_sales`.`invno` AS `invno`,`tbl_sales`.`invno` AS `refinv`,`SPLIT_STRING`(`tbl_sales`.`debitid`,'_',1) AS `dty`,cast(`SPLIT_STRING`(`tbl_sales`.`debitid`,'_',2) as signed) AS `did`,`tbl_sales`.`rawcash` - `tbl_sales`.`changes` AS `amo`,`tbl_sales`.`cusid` AS `cid`,`tbl_sales`.`type` AS `cty`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,`tbl_sales`.`ref` AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sales`.`apdate` AS `apdate`,`tbl_sales`.`brid` AS `brid`,`tbl_sales`.`uid` AS `uid`,`tbl_sales`.`date` AS `date` from `tbl_sales` where `tbl_sales`.`rawcash` - `tbl_sales`.`changes` > 0 union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,'PD' AS `dty`,`tbl_traproduct`.`pid` AS `did`,`tbl_traproduct`.`cost` * `tbl_traproduct`.`p_in` AS `amo`,'14' AS `cid`,'LE' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_sreturn` on(`tbl_sreturn`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'SR' union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,'PD' AS `dty`,`tbl_traproduct`.`pid` AS `did`,`tbl_traproduct`.`price` * `tbl_traproduct`.`p_in` AS `amo`,`tbl_sreturn`.`cusid` AS `cid`,`tbl_sreturn`.`type` AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_sreturn` on(`tbl_sreturn`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'SR' union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,'34' AS `did`,`tbl_traproduct`.`price` * `tbl_traproduct`.`p_in` AS `amo`,`tbl_traproduct`.`pid` AS `cid`,'PD' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_sreturn` on(`tbl_sreturn`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'SR' union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,'PD' AS `dty`,`tbl_traproduct`.`pid` AS `did`,`tbl_traproduct`.`icdis` * `tbl_traproduct`.`p_in` AS `amo`,'42' AS `cid`,'LE' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_sales` on(`tbl_sales`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'SR' and `tbl_traproduct`.`icdis` > 0 union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,'PD' AS `dty`,`tbl_traproduct`.`pid` AS `did`,`tbl_traproduct`.`icinvdis` * `tbl_traproduct`.`p_in` AS `amo`,'41' AS `cid`,'LE' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_sales` on(`tbl_sales`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'SR' and `tbl_traproduct`.`icinvdis` > 0 union all select `tbl_sreturn`.`id` AS `id`,`tbl_sreturn`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sreturn`.`type` AS `dty`,`tbl_sreturn`.`cusid` AS `did`,`tbl_sreturn`.`itemdis` AS `amo`,cast('37' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sreturn`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sreturn`.`apdate` AS `apdate`,`tbl_sreturn`.`brid` AS `brid`,`tbl_sreturn`.`uid` AS `uid`,`tbl_sreturn`.`date` AS `date` from `tbl_sreturn` where `tbl_sreturn`.`itemdis` > 0 union all select `tbl_sreturn`.`id` AS `id`,`tbl_sreturn`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sreturn`.`type` AS `dty`,`tbl_sreturn`.`cusid` AS `did`,`tbl_sreturn`.`disamo` AS `amo`,cast('36' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sreturn`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sreturn`.`apdate` AS `apdate`,`tbl_sreturn`.`brid` AS `brid`,`tbl_sreturn`.`uid` AS `uid`,`tbl_sreturn`.`date` AS `date` from `tbl_sreturn` where `tbl_sreturn`.`disamo` > 0 union all select `tbl_sreturn`.`id` AS `id`,`tbl_sreturn`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('10' as signed) AS `did`,`tbl_sreturn`.`vatamo` AS `amo`,`tbl_sreturn`.`cusid` AS `cid`,`tbl_sreturn`.`type` AS `cty`,if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sreturn`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sreturn`.`apdate` AS `apdate`,`tbl_sreturn`.`brid` AS `brid`,`tbl_sreturn`.`uid` AS `uid`,`tbl_sreturn`.`date` AS `date` from `tbl_sreturn` where `tbl_sreturn`.`vatamo` > 0 union all select `tbl_sreturn`.`id` AS `id`,`tbl_sreturn`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('38' as signed) AS `did`,`tbl_sreturn`.`aitamo` AS `amo`,`tbl_sreturn`.`cusid` AS `cid`,`tbl_sreturn`.`type` AS `cty`,if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sreturn`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sreturn`.`apdate` AS `apdate`,`tbl_sreturn`.`brid` AS `brid`,`tbl_sreturn`.`uid` AS `uid`,`tbl_sreturn`.`date` AS `date` from `tbl_sreturn` where `tbl_sreturn`.`aitamo` > 0 union all select `tbl_sreturn`.`id` AS `id`,`tbl_sreturn`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sreturn`.`type` AS `dty`,`tbl_sreturn`.`cusid` AS `did`,`tbl_sreturn`.`less` AS `amo`,cast('46' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sreturn`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sreturn`.`apdate` AS `apdate`,`tbl_sreturn`.`brid` AS `brid`,`tbl_sreturn`.`uid` AS `uid`,`tbl_sreturn`.`date` AS `date` from `tbl_sreturn` where `tbl_sreturn`.`less` > 0 union all select `tbl_sreturn`.`id` AS `id`,`tbl_sreturn`.`invno` AS `invno`,`tbl_sreturn`.`invno` AS `refinv`,`tbl_sreturn`.`type` AS `dty`,`tbl_sreturn`.`cusid` AS `did`,`tbl_sreturn`.`rawcash` - `tbl_sreturn`.`changes` AS `amo`,cast(`SPLIT_STRING`(`tbl_sreturn`.`creditid`,'_',2) as signed) AS `cid`,`SPLIT_STRING`(`tbl_sreturn`.`creditid`,'_',1) AS `cty`,if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sreturn`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sreturn`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sreturn`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sreturn`.`apdate` AS `apdate`,`tbl_sreturn`.`brid` AS `brid`,`tbl_sreturn`.`uid` AS `uid`,`tbl_sreturn`.`date` AS `date` from `tbl_sreturn` where `tbl_sreturn`.`rawcash` - `tbl_sreturn`.`changes` > 0 union all select `tbl_sersalesde`.`id` AS `id`,`tbl_sersales`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sersales`.`type` AS `dty`,`tbl_sersales`.`cusid` AS `did`,`tbl_sersalesde`.`price` * `tbl_sersalesde`.`qty` AS `amo`,`tbl_sersalesde`.`sid` AS `cid`,'SE' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,if(`tbl_sersalesde`.`sid` = 0,`tbl_sersalesde`.`name`,NULL) AS `ref`,`tbl_sersales`.`curid` AS `curid`,0 AS `xrate`,`tbl_sersales`.`apdate` AS `apdate`,`tbl_sersalesde`.`brid` AS `brid`,`tbl_sersales`.`uid` AS `uid`,`tbl_sersales`.`date` AS `date` from (`tbl_sersalesde` left join `tbl_sersales` on(`tbl_sersales`.`id` = `tbl_sersalesde`.`seid`)) union all select `tbl_sersalesde`.`id` AS `id`,`tbl_sersales`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,'14' AS `did`,`tbl_sersalesde`.`cost` * `tbl_sersalesde`.`qty` AS `amo`,`tbl_sersalesde`.`sid` AS `cid`,'SE' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,if(`tbl_sersalesde`.`sid` = 0,`tbl_sersalesde`.`name`,NULL) AS `ref`,`tbl_sersales`.`curid` AS `curid`,0 AS `xrate`,`tbl_sersales`.`apdate` AS `apdate`,`tbl_sersalesde`.`brid` AS `brid`,`tbl_sersales`.`uid` AS `uid`,`tbl_sersales`.`date` AS `date` from (`tbl_sersalesde` left join `tbl_sersales` on(`tbl_sersales`.`id` = `tbl_sersalesde`.`seid`)) union all select `tbl_sersales`.`id` AS `id`,`tbl_sersales`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('37' as signed) AS `did`,`tbl_sersales`.`itemdis` AS `amo`,`tbl_sersales`.`cusid` AS `cid`,`tbl_sersales`.`type` AS `cty`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sersales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sersales`.`apdate` AS `apdate`,`tbl_sersales`.`brid` AS `brid`,`tbl_sersales`.`uid` AS `uid`,`tbl_sersales`.`date` AS `date` from `tbl_sersales` where `tbl_sersales`.`itemdis` > 0 union all select `tbl_sersales`.`id` AS `id`,`tbl_sersales`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('36' as signed) AS `did`,`tbl_sersales`.`disamo` AS `amo`,`tbl_sersales`.`cusid` AS `cid`,`tbl_sersales`.`type` AS `cty`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sersales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sersales`.`apdate` AS `apdate`,`tbl_sersales`.`brid` AS `brid`,`tbl_sersales`.`uid` AS `uid`,`tbl_sersales`.`date` AS `date` from `tbl_sersales` where `tbl_sersales`.`disamo` > 0 union all select `tbl_sersales`.`id` AS `id`,`tbl_sersales`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sersales`.`type` AS `dty`,`tbl_sersales`.`cusid` AS `did`,`tbl_sersales`.`vatamo` AS `amo`,cast('10' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sersales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sersales`.`apdate` AS `apdate`,`tbl_sersales`.`brid` AS `brid`,`tbl_sersales`.`uid` AS `uid`,`tbl_sersales`.`date` AS `date` from `tbl_sersales` where `tbl_sersales`.`vatamo` > 0 union all select `tbl_sersales`.`id` AS `id`,`tbl_sersales`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sersales`.`type` AS `dty`,`tbl_sersales`.`cusid` AS `did`,`tbl_sersales`.`aitamo` AS `amo`,cast('38' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sersales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sersales`.`apdate` AS `apdate`,`tbl_sersales`.`brid` AS `brid`,`tbl_sersales`.`uid` AS `uid`,`tbl_sersales`.`date` AS `date` from `tbl_sersales` where `tbl_sersales`.`aitamo` > 0 union all select `tbl_sersales`.`id` AS `id`,`tbl_sersales`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sersales`.`type` AS `dty`,`tbl_sersales`.`cusid` AS `did`,`tbl_sersales`.`otamo` AS `amo`,cast('39' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sersales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sersales`.`apdate` AS `apdate`,`tbl_sersales`.`brid` AS `brid`,`tbl_sersales`.`uid` AS `uid`,`tbl_sersales`.`date` AS `date` from `tbl_sersales` where `tbl_sersales`.`otamo` > 0 union all select `tbl_sersales`.`id` AS `id`,`tbl_sersales`.`invno` AS `invno`,NULL AS `refinv`,`tbl_sersales`.`type` AS `dty`,`tbl_sersales`.`cusid` AS `did`,`tbl_sersales`.`freight` AS `amo`,cast('12' as signed) AS `cid`,'LE' AS `cty`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sersales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sersales`.`apdate` AS `apdate`,`tbl_sersales`.`brid` AS `brid`,`tbl_sersales`.`uid` AS `uid`,`tbl_sersales`.`date` AS `date` from `tbl_sersales` where `tbl_sersales`.`freight` > 0 union all select `tbl_sersales`.`id` AS `id`,`tbl_sersales`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,cast('40' as signed) AS `did`,`tbl_sersales`.`less` AS `amo`,`tbl_sersales`.`cusid` AS `cid`,`tbl_sersales`.`type` AS `cty`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sersales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sersales`.`apdate` AS `apdate`,`tbl_sersales`.`brid` AS `brid`,`tbl_sersales`.`uid` AS `uid`,`tbl_sersales`.`date` AS `date` from `tbl_sersales` where `tbl_sersales`.`less` > 0 union all select `tbl_sersales`.`id` AS `id`,`tbl_sersales`.`invno` AS `invno`,`tbl_sersales`.`invno` AS `refinv`,`SPLIT_STRING`(`tbl_sersales`.`debitid`,'_',1) AS `dty`,cast(`SPLIT_STRING`(`tbl_sersales`.`debitid`,'_',2) as signed) AS `did`,`tbl_sersales`.`rawcash` - `tbl_sersales`.`changes` AS `amo`,`tbl_sersales`.`cusid` AS `cid`,`tbl_sersales`.`type` AS `cty`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL),NULL) AS `chkno`,cast(if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CHK',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',3),NULL),NULL) as date) AS `chkdt`,if(octet_length(`tbl_sersales`.`details`) > 3,if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'CRD',concat((select `tbl_bank`.`name` from `tbl_bank` where `tbl_bank`.`id` = `SPLIT_STRING`(`tbl_sersales`.`details`,'_',4)),'-',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2)),if(`SPLIT_STRING`(`tbl_sersales`.`details`,'_',1) = 'MOB',`SPLIT_STRING`(`tbl_sersales`.`details`,'_',2),NULL)),NULL) AS `otnote`,0 AS `recon`,`tbl_sersales`.`ref` AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_sersales`.`apdate` AS `apdate`,`tbl_sersales`.`brid` AS `brid`,`tbl_sersales`.`uid` AS `uid`,`tbl_sersales`.`date` AS `date` from `tbl_sersales` where `tbl_sersales`.`rawcash` - `tbl_sersales`.`changes` > 0 union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,'50' AS `did`,`tbl_traproduct`.`cost` * `tbl_traproduct`.`p_out` AS `amo`,`tbl_traproduct`.`pid` AS `cid`,'PD' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_disposal` on(`tbl_disposal`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'DS' union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,if(`tbl_disposal`.`type` is null or octet_length(`tbl_disposal`.`type`) < 1,'LE',`tbl_disposal`.`type`) AS `dty`,if(`tbl_disposal`.`type` is null or octet_length(`tbl_disposal`.`type`) < 1,'49',`tbl_disposal`.`cusid`) AS `did`,`tbl_traproduct`.`price` * `tbl_traproduct`.`p_out` AS `amo`,`tbl_traproduct`.`pid` AS `cid`,'PD' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_disposal` on(`tbl_disposal`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'DS' and `tbl_traproduct`.`price` > 0 union all select `tbl_traproduct`.`id` AS `id`,`tbl_traproduct`.`invno` AS `invno`,NULL AS `refinv`,'PD' AS `dty`,`tbl_traproduct`.`pid` AS `did`,`tbl_traproduct`.`price` * `tbl_traproduct`.`p_out` AS `amo`,'51' AS `cid`,'LE' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_traproduct`.`apdate` AS `apdate`,`tbl_traproduct`.`brid` AS `brid`,`tbl_traproduct`.`uid` AS `uid`,`tbl_traproduct`.`date` AS `date` from (`tbl_traproduct` left join `tbl_disposal` on(`tbl_disposal`.`invno` = `tbl_traproduct`.`invno`)) where `tbl_traproduct`.`mods` = 'DS' and `tbl_traproduct`.`price` > 0 union all select `tbl_disposal`.`id` AS `id`,`tbl_disposal`.`invno` AS `invno`,`tbl_disposal`.`invno` AS `refinv`,'LE' AS `dty`,cast('2' as signed) AS `did`,`tbl_disposal`.`amount` AS `amo`,`tbl_disposal`.`cusid` AS `cid`,`tbl_disposal`.`type` AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,`tbl_disposal`.`note` AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,`tbl_disposal`.`apdate` AS `apdate`,`tbl_disposal`.`brid` AS `brid`,`tbl_disposal`.`uid` AS `uid`,`tbl_disposal`.`date` AS `date` from `tbl_disposal` where `tbl_disposal`.`amount` > 0 union all select `tbl_waranty`.`id` AS `id`,`tbl_waranty`.`invno` AS `invno`,NULL AS `refinv`,'PD' AS `dty`,`tbl_waranty`.`pid` AS `did`,`tbl_waranty`.`sat_amount` AS `amo`,`tbl_waranty`.`cusid` AS `cid`,`tbl_waranty`.`type` AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,cast(`tbl_waranty`.`d_date` as date) AS `apdate`,`tbl_waranty`.`brid` AS `brid`,`tbl_waranty`.`uid` AS `uid`,`tbl_waranty`.`d_date` AS `date` from `tbl_waranty` where `tbl_waranty`.`sat_amount` > 0 union all select `tbl_waranty`.`id` AS `id`,if(`tbl_waranty`.`binvno` is not null,`tbl_waranty`.`binvno`,`tbl_waranty`.`invno`) AS `invno`,NULL AS `refinv`,'SU' AS `dty`,`tbl_waranty`.`supid` AS `did`,`tbl_waranty`.`sat_amount` AS `amo`,`tbl_waranty`.`pid` AS `cid`,'PD' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,0 AS `curid`,0 AS `xrate`,cast(`tbl_waranty`.`d_date` as date) AS `apdate`,`tbl_waranty`.`brid` AS `brid`,`tbl_waranty`.`uid` AS `uid`,`tbl_waranty`.`d_date` AS `date` from `tbl_waranty` where `tbl_waranty`.`sat_amount` > 0 union all select `tbl_salarysheet`.`id` AS `id`,`tbl_salarysheet`.`payslip` AS `invno`,NULL AS `refinv`,'LE' AS `dty`,'48' AS `did`,`tbl_salarysheet`.`tsalary` AS `amo`,`tbl_salarysheet`.`empid` AS `cid`,'EM' AS `cty`,NULL AS `chkno`,NULL AS `chkdt`,NULL AS `otnote`,0 AS `recon`,NULL AS `ref`,1 AS `curid`,0 AS `xrate`,`tbl_salarysheet`.`apdate` AS `apdate`,`tbl_employe`.`wbrid` AS `brid`,`tbl_salarysheet`.`uid` AS `uid`,`tbl_salarysheet`.`date` AS `date` from (`tbl_salarysheet` left join `tbl_employe` on(`tbl_employe`.`id` = `tbl_salarysheet`.`empid`)) ;


-- --------------------------------------------------------
--
-- Structure for view `tbl_cuscredit`
--
DROP TABLE IF EXISTS `tbl_cuscredit`;

CREATE ALGORITHM=UNDEFINED  SQL SECURITY DEFINER VIEW `tbl_cuscredit`  AS SELECT `tbl_traledger`.`cid` AS `id`, sum(`tbl_traledger`.`amo`) AS `credit` FROM `tbl_traledger` WHERE `tbl_traledger`.`cty` = 'CU' AND `tbl_traledger`.`cid` <> 0 GROUP BY `tbl_traledger`.`cid` ORDER BY `tbl_traledger`.`cid` ASC ;

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

-- --------------------------------------------------------
--
-- Structure for view `tbl_cusdebit`
--
DROP TABLE IF EXISTS `tbl_cusdebit`;

CREATE ALGORITHM=UNDEFINED  SQL SECURITY DEFINER VIEW `tbl_cusdebit`  AS SELECT `tbl_traledger`.`did` AS `id`, sum(`tbl_traledger`.`amo`) AS `debit` FROM `tbl_traledger` WHERE `tbl_traledger`.`dty` = 'CU' AND `tbl_traledger`.`did` <> 0 GROUP BY `tbl_traledger`.`did` ORDER BY `tbl_traledger`.`did` ASC ;

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



--
-- Structure for view `tbl_cusbalance`
--
DROP TABLE IF EXISTS `tbl_cusbalance`;

CREATE ALGORITHM=UNDEFINED  SQL SECURITY DEFINER VIEW `tbl_cusbalance`  AS SELECT `c`.`id` AS `id`, `c`.`name` AS `name`, `c`.`code` AS `code`, `c`.`did` AS `did`, `c`.`zid` AS `zid`, `c`.`cnumber` AS `cnumber`, `c`.`cemail` AS `cemail`, `c`.`address` AS `address`, `d`.`debit` AS `debit`, `cr`.`credit` AS `credit` FROM ((`tbl_customer` `c` left join `tbl_cusdebit` `d` on(`c`.`id` = `d`.`id`)) left join `tbl_cuscredit` `cr` on(`c`.`id` = `cr`.`id`)) ORDER BY `c`.`id` ASC ;

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


--
-- Structure for view `tbl_supdebit`
--
DROP TABLE IF EXISTS `tbl_supdebit`;

CREATE ALGORITHM=UNDEFINED  SQL SECURITY DEFINER VIEW `tbl_supdebit`  AS SELECT `tbl_traledger`.`did` AS `id`, sum(`tbl_traledger`.`amo`) AS `debit` FROM `tbl_traledger` WHERE `tbl_traledger`.`dty` = 'SU' AND `tbl_traledger`.`did` <> 0 GROUP BY `tbl_traledger`.`did` ORDER BY `tbl_traledger`.`did` ASC ;

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



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

--
-- Structure for view `tbl_supcredit`
--
DROP TABLE IF EXISTS `tbl_supcredit`;

CREATE ALGORITHM=UNDEFINED  SQL SECURITY DEFINER VIEW `tbl_supcredit`  AS SELECT `tbl_traledger`.`cid` AS `id`, sum(`tbl_traledger`.`amo`) AS `credit` FROM `tbl_traledger` WHERE `tbl_traledger`.`cty` = 'SU' AND `tbl_traledger`.`cid` <> 0 GROUP BY `tbl_traledger`.`cid` ORDER BY `tbl_traledger`.`cid` ASC ;

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