-- Hasil Backup Database Kasir Pro
-- Waktu Backup: 2026-07-31 18:35:35



CREATE TABLE `categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `price` int(11) DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;



CREATE TABLE `customers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `phone` varchar(50) NOT NULL,
  `favorite_product` varchar(100) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;



CREATE TABLE `expenses` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` datetime DEFAULT current_timestamp(),
  `expense_name` varchar(255) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `category` varchar(50) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;



CREATE TABLE `orders` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `invoice_no` varchar(20) NOT NULL,
  `customer_name` varchar(100) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `product_id` int(11) DEFAULT NULL,
  `target_no` varchar(50) DEFAULT NULL,
  `sn` varchar(100) DEFAULT NULL,
  `price` int(11) DEFAULT 0,
  `admin_fee` int(11) DEFAULT 0,
  `selling_price` int(11) DEFAULT 0,
  `qty` int(11) DEFAULT 1,
  `discount` int(11) DEFAULT 0,
  `amount_paid` int(11) DEFAULT 0,
  `note` text DEFAULT NULL,
  `period` varchar(100) DEFAULT NULL,
  `status` varchar(20) DEFAULT 'LUNAS',
  `created_at` datetime DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

INSERT INTO `orders` VALUES
('1', 'KEY2026954544', 'KEYPEDIA', '', '2', '083143743018', '083143743018', '5000', '2500', '5000', '1', '0', '0', '', NULL, 'LUNAS', '2026-05-05 20:47:18'),
('2', 'KEY2026190667', 'keypedia', '', '7', '083143743018', 'kocak', '10000', '2500', '10000', '1', '0', '0', '', NULL, 'NON TUNAI', '2026-05-05 21:02:24'),
('3', 'KEY2026120627', 'UCUP', '', '1', '083143743018', '083143743018', '5700', '2500', '5700', '1', '0', '0', '', NULL, 'TUNAI', '2026-05-05 21:38:48'),
('4', 'KEY202605063603', 'PAK OJI', '', '1', '083143743018', '083143743018', '5700', '0', '5700', '1', '0', '0', '', NULL, 'TUNAI', '2026-05-06 12:25:29'),
('6', 'KEY2026050628EF', 'PAK OJI ganteng', '', '1', '083143743018', 'KEYPEDIA MURAH', '5700', '0', '5700', '1', '0', '0', '', NULL, 'TUNAI', '2026-05-06 12:40:38'),
('8', 'KEY202605062EB4', 'PAK OJI ganteng bngt', '', '1', '083143743018', 'keypedia', '5700', '0', '5700', '1', '0', '0', '', NULL, 'TUNAI', '2026-05-06 12:45:03'),
('10', 'KEY202605066052', 'PAK OJI ganteng bngt', '', '1', '083143743018', 'keypedia', '5700', '0', '5700', '1', '0', '0', '', NULL, 'TUNAI', '2026-05-06 12:50:05'),
('12', 'KEY2026050605D5', 'PAK OJI ganteng bngt', '', '1', '083143743018', 'keypedia', '5700', '0', '5700', '1', '0', '0', '', NULL, 'TUNAI', '2026-05-06 12:55:33'),
('13', 'KEY2026050605D5', 'PAK OJI ganteng bngt', '', '1', '083143743018', 'ucup', '5700', '0', '5700', '1', '0', '0', '', NULL, 'TUNAI', '2026-05-06 12:55:33'),
('14', 'KEY2026050683D5', 'PAK OJI', '', '1', '083143743018', 'ucup', '5700', '0', '5700', '1', '0', '0', '', NULL, 'TUNAI', '2026-05-06 12:57:33'),
('15', 'KEY2026050683D5', 'PAK OJI', '', '1', '083143743018', 'asep', '5700', '0', '5700', '1', '0', '0', '', NULL, 'TUNAI', '2026-05-06 12:57:33'),
('16', 'KEY2026050709D2', 'SIDI MARHAMAH', '', '2', '222320011252', '2778118699312778355', '57370', '0', '57370', '1', '0', '0', '', NULL, 'TUNAI', '2026-05-07 08:54:56'),
('17', 'KEY20260507393D', 'SAYANG', '', '7', '222320011252', 'KEYPEDIA', '57000', '0', '57000', '1', '0', '0', '', 'MEI 2026', 'TUNAI', '2026-05-07 20:57:36'),
('18', 'KEY20260509127D', 'PAK OJI BESTIE', '', '9', '222320011252', '500527223', '20000', '3000', '20000', '1', '0', '0', '', 'MEI 2026', 'TUNAI', '2026-05-09 19:10:23'),
('19', 'KEY202605104429', 'TAHAJI', '', '11', '45058572400', '3684 7986 8199 5364 6941', '50000', '5000', '50000', '1', '0', '0', '', '', 'TUNAI', '2026-05-10 07:50:51');


CREATE TABLE `products` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `product_code` varchar(50) NOT NULL,
  `product_name` varchar(100) NOT NULL,
  `category` varchar(50) NOT NULL,
  `stock` int(11) DEFAULT 0,
  `base_price` decimal(10,2) NOT NULL,
  `sell_price` decimal(10,2) NOT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `product_code` (`product_code`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;



CREATE TABLE `settings` (
  `id` int(11) NOT NULL DEFAULT 1,
  `store_name` varchar(100) NOT NULL,
  `address` text NOT NULL,
  `whatsapp` varchar(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

INSERT INTO `settings` VALUES
('1', 'KONTER PULSA MAKMUR', 'Jl. Merdeka No. 45, Jakarta', '6281234567890');


CREATE TABLE `transactions` (
  `id` char(36) NOT NULL,
  `transaction_id` varchar(50) NOT NULL,
  `date` datetime DEFAULT current_timestamp(),
  `category` varchar(50) NOT NULL,
  `customer_name` varchar(100) DEFAULT NULL,
  `customer_number` varchar(50) DEFAULT NULL,
  `product_name` varchar(100) NOT NULL,
  `qty` int(11) DEFAULT 1,
  `base_price` decimal(10,2) NOT NULL,
  `sell_price` decimal(10,2) NOT NULL,
  `admin_fee` decimal(10,2) DEFAULT 0.00,
  `bill_amount` decimal(10,2) DEFAULT 0.00,
  `profit` decimal(10,2) NOT NULL,
  `status` varchar(20) DEFAULT 'PENDING',
  `serial_number` varchar(100) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `transaction_id` (`transaction_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

INSERT INTO `transactions` VALUES
('5fac8527-d02a-4e71-a76f-34a20b7fa8d0', 'TRX-POS-20260713020905-B020', '2026-07-13 09:09:05', 'AKSESORIS', 'UCUP', NULL, 'KABEL DATA MICRO CCTV', '5', '5000.00', '25000.00', '0.00', '0.00', '20000.00', 'BERHASIL', NULL, 'Kasir Fisik / Gudang', '2026-07-13 09:09:05', '2026-07-13 09:09:05');
