CREATE TABLE inventories (
  id INT(11) AUTO_INCREMENT PRIMARY KEY,
  warehouse_id INT(11) COMMENT "納品先ID",
  send_customer_id INT(11) COMMENT "送信先ID",
  customer_id INT(11) COMMENT "得意先ID",
  supplier_id INT(11) COMMENT "仕入先ID",
  shipment_customer_id INT(11) COMMENT "配送先ID",
  user_position_id INT(11) COMMENT "担当者",
  sales_area_id INT(11) COMMENT "営業エリア", 
  total_quantity INT(11) COMMENT "在庫数量",
  printed_at DATETIME COMMENT "印刷日時",
  sync_at DATETIME COMMENT "データ更新日時",
  inventory_date DATE COMMENT "基準日",
  deadline_date DATE COMMENT "締切日",
  send_date DATE COMMENT "送信日",
  receive_date DATE COMMENT "受信日",
  close_date DATE COMMENT "完了日", 
  note_1 VARCHAR(200) COMMENT "備考1",
  note_2 VARCHAR(200) COMMENT "備考2",
  note_3 VARCHAR(200) COMMENT "備考3",
  note_4 VARCHAR(200) COMMENT "備考4",
  note_5 VARCHAR(200) COMMENT "備考5",
  created_at DATETIME COMMENT "作成日時",
  updated_at DATETIME COMMENT "更新日時"
) type=InnoDB;

CREATE TABLE inventory_details (
  id INT(11) AUTO_INCREMENT PRIMARY KEY,
  inventory_id INT(11) COMMENT "棚卸ID",
  product_category_id INT(11) COMMENT "製品カテゴリID",
  product_set_id INT(11) COMMENT "製品群ID",
  product_id INT(11) COMMENT "製品ID",
  lot_number VARCHAR(40) COMMENT "ロット",
  serial_number VARCHAR(40) COMMENT "シリアル",
  ubd DATE COMMENT "有効期限",
  existing_quantity INT(11) COMMENT "在庫数量",
  short_shipped_quantity INT(11) COMMENT "短期数量",
  detail_note VARCHAR(200) COMMENT "明細備考",
  created_at DATETIME COMMENT "作成日時",
  updated_at DATETIME COMMENT "更新日時"
) type=InnoDB;


