-- liquibase formatted sql
-- changeset Enson:add_column

CREATE TABLE IF NOT EXISTS stockTakeRecord  (
  
  id INT AUTO_INCREMENT PRIMARY KEY,
  created DATETIME,
  createdBy VARCHAR(30),
  version INT,
  modified DATETIME,
  modifiedBy VARCHAR(30),
  deleted TINYINT(1),
  

  itemId INT NOT NULL,                   
  lotId INT NOT NULL,                     
  warehouseId INT NOT NULL,              
  stockTakeSection varchar(255),                
  stockTakeId INT NOT NULL,
  stockTakerName VARCHAR(100),
  approverId INT,                         
  approverName VARCHAR(100),              
  stockTakerId INT NOT NULL,             
  

  pickerFirstStockTakeQty DECIMAL(14,2),        
  pickerSecondStockTakeQty DECIMAL(14,2),
  approverStockTakeQty DECIMAL(14,2),       
  approverSecondStockTakeQty DECIMAL(14,2),
  bookQty DECIMAL(14,2) NOT NULL,
  badQty DECIMAL(14,2),
  pickerFirstBadQty DECIMAL(14,2),
  pickerSecondBadQty DECIMAL(14,2),
  approverBadQty DECIMAL(14,2),     
  varianceQty DECIMAL(14,2),             
  uom VARCHAR(30),                        
  

  stockTakeStartTime DATETIME,           
  stockTakeEndTime DATETIME,             
  date DATE NOT NULL,                     

  status VARCHAR(30) NOT NULL,            
  remarks VARCHAR(500),                    
  

  itemCode VARCHAR(50),                   
  itemName VARCHAR(200),   
  inventoryLotId INT,
  lotNo VARCHAR(512),                    
  expiredDate DATE                        

);