INSERT INTO `slip_postages` VALUES (267, 274, 'image/jpeg', '[encoded data, 77140 characters]', NULL, '2017-12-21 19:06:26', '2017-12-21 19:06:26');
INSERT INTO `slip_postages` VALUES (268, 275, 'image/jpeg', '[encoded data, 79888 characters]', NULL, '2017-12-21 19:10:28', '2017-12-21 19:10:28');
INSERT INTO `slip_postages` VALUES (269, 276, 'image/jpeg', '[encoded data, 82228 characters]', NULL, '2017-12-21 19:13:47', '2017-12-21 19:13:47');
INSERT INTO `slip_postages` VALUES (270, 277, 'image/jpeg', '[encoded data, 80336 characters]', NULL, '2017-12-21 19:16:00', '2017-12-21 19:16:00');
INSERT INTO `slip_postages` VALUES (271, 278, 'image/jpeg', '[encoded data, 78712 characters]', NULL, '2017-12-21 19:18:16', '2017-12-21 19:18:16');

-- ----------------------------
-- Table structure for taxes
-- ----------------------------
CREATE TABLE `taxes`  (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `tax` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `slug` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `amount` double(8, 2) NOT NULL,
  `deleted_at` timestamp(0) NULL DEFAULT NULL,
  `created_at` timestamp(0) NULL DEFAULT NULL,
  `updated_at` timestamp(0) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of taxes
-- ----------------------------
INSERT INTO `taxes` VALUES (1, 'GST', 'gst', 6.00, NULL, NULL, NULL);

-- ----------------------------
-- Table structure for user_groups
-- ----------------------------
CREATE TABLE `user_groups`  (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `group` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp(0) NULL DEFAULT NULL,
  `updated_at` timestamp(0) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of user_groups
-- ----------------------------
INSERT INTO `user_groups` VALUES (1, 'Administrator', NULL, NULL);
INSERT INTO `user_groups` VALUES (2, 'Staff', NULL, NULL);

-- ----------------------------
-- Table structure for users
-- ----------------------------
CREATE TABLE `users`  (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `slug` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `id_group` int(11) NOT NULL,
  `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `remember_token` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL,
  `color` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp(0) NULL DEFAULT NULL,
  `updated_at` timestamp(0) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `users_email_unique`(`email`) USING BTREE,
  INDEX `users_id_group_foreign`(`id_group`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES (1, 'Dhiauddin', 'dhiauddin', 1, 'dhiauddin', 'dhiauddin@gmail.com', '$2y$10$L9dy4Hh7m/m4iH4F.oIFp.kduqc6QtLgZmhBALyWP1eU0g68NNMzK', 'Y0ZwjUllJ2Ed3Z7P5kag794jtY59LrHbM3G55DHsP1S6w7FT8YU2Fjpajgoh', 'rgba(250, 0, 0, 0.61)', NULL, '2019-03-02 04:28:31');
INSERT INTO `users` VALUES (2, 'Fatihah', 'fatihah', 2, 'fatihah', 'fatihah@gmail.com', '$2y$10$JeskCXZji5fyiCBrR6rZ1u.WHJYE8beuziZp9/ydhgcpQ0NuKajaa', 'LZNZKayvosu2xMZjJVoYid3ZPkJqoGySjLm0xYtMkb56ojrvhMREJw9L445I', 'rgba(102, 92, 214, 0.8)', NULL, '2017-12-25 01:19:09');
INSERT INTO `users` VALUES (3, 'Syazwani', 'syazwani', 2, 'syazwani', 'syazwani@gmail.com', '$2y$10$/5QbtWJPCyLXKomu2z5BnujUXhkEENiAX4QepFPSgZbiZjPksGsnC', 'j9BZutEbByy6jr5FcZZZ7uvIAI3HlQu2lFmn5DrNqNKDfpwtgMsAeMCCeFS6', 'rgba(150, 245, 106, 0.8)', NULL, '2017-12-21 18:51:41');

-- ----------------------------
-- View structure for invoice
-- ----------------------------
DROP VIEW IF EXISTS `invoice`;
CREATE ALGORITHM = UNDEFINED DEFINER = `root`@`localhost` SQL SECURITY DEFINER VIEW `invoice` AS select `users`.`name` AS `name`,`users`.`color` AS `color`,`sales`.`id` AS `id`,`sales`.`date_sale` AS `date_sale`,`products`.`product` AS `product`,`sales_items`.`commission` AS `commission`,`sales_items`.`retail` AS `retail`,`sales_items`.`quantity` AS `quantity`,round((`sales_items`.`retail` * `sales_items`.`quantity`),2) AS `TotalAmount`,round((`sales_items`.`commission` * `sales_items`.`quantity`),2) AS `TotalCommission`,`taxes`.`tax` AS `tax`,ifnull(`taxes`.`amount`,0) AS `tax_charges`,round((round((`sales_items`.`retail` * `sales_items`.`quantity`),2) * (ifnull(`taxes`.`amount`,0) / 100)),2) AS `TotalTax`,(round((`sales_items`.`retail` * `sales_items`.`quantity`),2) + round((round((`sales_items`.`retail` * `sales_items`.`quantity`),2) * (ifnull(`taxes`.`amount`,0) / 100)),2)) AS `GrandTotal`,ifnull(`banks`.`bank`,'NoBank') AS `bank`,ifnull(`payments`.`date_payment`,'1970-01-01') AS `date_payment`,ifnull(`payments`.`amount`,0) AS `PaymentAmount`,`customers`.`client` AS `client`,`customers`.`client_phone` AS `client_phone`,`customers`.`client_email` AS `client_email`,`slip_numbers`.`tracking_number` AS `tracking_number` from ((((((((((`sales` join `sales_items` on((`sales_items`.`id_sales` = `sales`.`id`))) join `products` on((`sales_items`.`id_product` = `products`.`id`))) left join `users` on((`sales`.`id_user` = `users`.`id`))) left join `sales_taxes` on((`sales_taxes`.`id_sales` = `sales`.`id`))) left join `taxes` on((`taxes`.`id` = `sales_taxes`.`id_tax`))) left join `payments` on((`payments`.`id_sales` = `sales`.`id`))) left join `banks` on((`banks`.`id` = `payments`.`id_bank`))) left join `sales_customers` on((`sales_customers`.`id_sales` = `sales`.`id`))) left join `customers` on((`customers`.`id` = `sales_customers`.`id_customer`))) join `slip_numbers` on((`slip_numbers`.`id_sales` = `sales`.`id`))) where (isnull(`sales`.`deleted_at`) and isnull(`sales_items`.`deleted_at`) and isnull(`payments`.`deleted_at`) and isnull(`sales_taxes`.`deleted_at`) and isnull(`sales_customers`.`deleted_at`) and isnull(`slip_numbers`.`deleted_at`)) ;

