ALTER TABLE `zh_stage_rela_bills`
ADD COLUMN `qc_minus_qty`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '不计价' AFTER `qc_tp`;
ALTER TABLE `zh_stage_rela_bills_final`
ADD COLUMN `qc_minus_qty`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '不计价' AFTER `qc_tp`;

ALTER TABLE `zh_stage_rela_pos`
ADD COLUMN `qc_minus_qty`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '不计价' AFTER `qc_qty`;
ALTER TABLE `zh_stage_rela_pos_final`
ADD COLUMN `qc_minus_qty`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '不计价' AFTER `qc_qty`;

ALTER TABLE `zh_stage_rela_im`
ADD COLUMN `qc_minus_jl`  decimal(24,8) NULL DEFAULT 0 COMMENT '不计价' AFTER `qc_jl`,
ADD COLUMN `pre_qc_minus_jl`  decimal(24,8) NULL DEFAULT 0 COMMENT '截止上期-不计价' AFTER `pre_qc_jl`,
ADD COLUMN `end_qc_minus_jl`  decimal(24,8) NULL DEFAULT 0 COMMENT '截止本期-不计价' AFTER `end_qc_jl`;

ALTER TABLE `zh_stage_rela_im_bills`
ADD COLUMN `qc_minus_jl`  decimal(24,8) NULL DEFAULT 0 COMMENT '不计价' AFTER `qc_jl`,
ADD COLUMN `pre_qc_minus_jl`  decimal(24,8) NULL DEFAULT 0 COMMENT '截止上期-不计价' AFTER `pre_qc_jl`,
ADD COLUMN `end_qc_minus_jl`  decimal(24,8) NULL DEFAULT 0 COMMENT '截止本期-不计价' AFTER `end_qc_jl`;

ALTER TABLE `zh_material` ADD `is_stage_self` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '多期共用单价还是独立单价，默认是共用0' AFTER `is_new`;

ALTER TABLE `zh_material_list` ADD `ms_id` INT NULL DEFAULT NULL COMMENT '调差多期单独计价期id' AFTER `mb_id`;

CREATE TABLE `zh_material_stage`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tid` int(11) NOT NULL COMMENT '标段id',
  `mid` int(11) NOT NULL COMMENT '调差id',
  `sid` int(11) NOT NULL COMMENT '计量期id',
  `order` tinyint(4) NOT NULL COMMENT '计量期期数',
  `m_tp` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期金额',
  `m_tax_tp` decimal(30, 8) NULL DEFAULT NULL COMMENT '材料含税总金额',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `tid`(`tid`) USING BTREE,
  INDEX `mid`(`mid`) USING BTREE
) ENGINE = InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `zh_material_stage_bills`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tid` int(11) NOT NULL COMMENT '标段id',
  `mid` int(11) NOT NULL COMMENT '调差id',
  `ms_id` int(11) NOT NULL COMMENT '调差多期单独计价期id',
  `mb_id` int(11) NOT NULL COMMENT '工料id',
  `quantity` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期应耗数量',
  `msg_tp` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期信息价单价',
  `msg_times` varchar(30) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '本期信息价时间',
  `msg_spread` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期信息价价差',
  `m_spread` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期材料调差有效价差',
  `m_tp` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期金额',
  `m_tax_tp` decimal(30, 8) NULL DEFAULT NULL COMMENT '调差金额（材料税）',
  `is_summary` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否汇总',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `tid`(`tid`) USING BTREE,
  INDEX `mid`(`mid`) USING BTREE
) ENGINE = InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
