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;

ALTER TABLE `zh_project_account`
ADD COLUMN `invalid_time`  varchar(50) NOT NULL DEFAULT '' AFTER `wx_name`;

ALTER TABLE `zh_valuation_list` ADD `glj_lib_id` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '(0号台账模式)zh_glj_lib_list id列表，逗号分隔' AFTER `chapter_id`;
ALTER TABLE `zh_valuation_list` ADD `list_glj_lib_id` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '(工程量清单模式)zh_glj_lib_list id列表，逗号分隔' AFTER `list_chapter_id`;

CREATE TABLE `zh_revise_price` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `pid` bigint(20) unsigned NOT NULL COMMENT '项目id',
  `tid` bigint(20) unsigned NOT NULL COMMENT '标段id',
  `rid` varchar(36) COLLATE utf8_unicode_ci NOT NULL COMMENT '台账修订id',
  `order` int(11) unsigned NOT NULL COMMENT '排序',
  `b_code` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '清单编号',
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '名称',
  `unit` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '单位',
  `org_price` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '旧单价',
  `new_price` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '变更单价',
  `memo` varchar(1000) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '备注',
  `valid` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '是否有效',
  `use_stage` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '使用期',
  `use_stage_order` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '使用期序号',
  PRIMARY KEY (`id`),
  KEY `idx_rid` (`rid`) USING BTREE,
  KEY `idx_tid_valid_stage` (`rid`,`valid`,`use_stage`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='台账修订-单价调整';

CREATE TABLE `zh_stage_bills_pc` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `tid` int(11) unsigned NOT NULL COMMENT '标段id',
  `sid` int(11) NOT NULL,
  `lid` varchar(36) COLLATE utf8_unicode_ci NOT NULL COMMENT '项目节id',
  `org_price` decimal(24,8) NOT NULL DEFAULT 0 COMMENT '原单价',
  `unit_price` decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期单价',
  `contract_pc_tp` decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)',
  `qc_pc_tp` decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)',
  `pc_tp` decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差',
  `positive_qc_pc_tp` decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差（正变更）',
  `negative_qc_pc_tp` decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差（负变更）',
  PRIMARY KEY (`id`),
  KEY `idx_sid` (`sid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='期-补差数据';

ALTER TABLE `zh_stage_bills_final_0`
ADD COLUMN `unit_price`  decimal(24,8) UNSIGNED NOT NULL DEFAULT 0 COMMENT '本期单价' AFTER `contract_expr`,
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `used`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT  '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_bills_final_1`
ADD COLUMN `unit_price`  decimal(24,8) UNSIGNED NOT NULL DEFAULT 0 COMMENT '本期单价' AFTER `contract_expr`,
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `used`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT  '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_bills_final_2`
ADD COLUMN `unit_price`  decimal(24,8) UNSIGNED NOT NULL DEFAULT 0 COMMENT '本期单价' AFTER `contract_expr`,
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `used`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT  '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_bills_final_3`
ADD COLUMN `unit_price`  decimal(24,8) UNSIGNED NOT NULL DEFAULT 0 COMMENT '本期单价' AFTER `contract_expr`,
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `used`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT  '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_bills_final_4`
ADD COLUMN `unit_price`  decimal(24,8) UNSIGNED NOT NULL DEFAULT 0 COMMENT '本期单价' AFTER `contract_expr`,
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `used`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT  '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_bills_final_5`
ADD COLUMN `unit_price`  decimal(24,8) UNSIGNED NOT NULL DEFAULT 0 COMMENT '本期单价' AFTER `contract_expr`,
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `used`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT  '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_bills_final_6`
ADD COLUMN `unit_price`  decimal(24,8) UNSIGNED NOT NULL DEFAULT 0 COMMENT '本期单价' AFTER `contract_expr`,
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `used`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT  '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_bills_final_7`
ADD COLUMN `unit_price`  decimal(24,8) UNSIGNED NOT NULL DEFAULT 0 COMMENT '本期单价' AFTER `contract_expr`,
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `used`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT  '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_bills_final_8`
ADD COLUMN `unit_price`  decimal(24,8) UNSIGNED NOT NULL DEFAULT 0 COMMENT '本期单价' AFTER `contract_expr`,
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `used`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT  '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_bills_final_9`
ADD COLUMN `unit_price`  decimal(24,8) UNSIGNED NOT NULL DEFAULT 0 COMMENT '本期单价' AFTER `contract_expr`,
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `used`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT  '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;

ALTER TABLE `zh_stage_pos_final_0`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0  COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0  COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_1`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0  COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0  COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_2`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0  COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_3`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_4`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_5`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_6`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_7`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_8`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_9`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_10`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_11`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_12`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_13`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_14`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_15`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_16`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_17`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_18`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;
ALTER TABLE `zh_stage_pos_final_19`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `contract_expr`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;

Update zh_stage_bills_final_0 sp LEFT JOIN zh_ledger_0 p on sp.lid = p.id Set sp.unit_price = IFNULL(p.unit_price, 0);
Update zh_stage_bills_final_1 sp LEFT JOIN zh_ledger_1 p on sp.lid = p.id Set sp.unit_price = IFNULL(p.unit_price, 0);
Update zh_stage_bills_final_2 sp LEFT JOIN zh_ledger_2 p on sp.lid = p.id Set sp.unit_price = IFNULL(p.unit_price, 0);
Update zh_stage_bills_final_3 sp LEFT JOIN zh_ledger_3 p on sp.lid = p.id Set sp.unit_price = IFNULL(p.unit_price, 0);
Update zh_stage_bills_final_4 sp LEFT JOIN zh_ledger_4 p on sp.lid = p.id Set sp.unit_price = IFNULL(p.unit_price, 0);
Update zh_stage_bills_final_5 sp LEFT JOIN zh_ledger_5 p on sp.lid = p.id Set sp.unit_price = IFNULL(p.unit_price, 0);
Update zh_stage_bills_final_6 sp LEFT JOIN zh_ledger_6 p on sp.lid = p.id Set sp.unit_price = IFNULL(p.unit_price, 0);
Update zh_stage_bills_final_7 sp LEFT JOIN zh_ledger_7 p on sp.lid = p.id Set sp.unit_price = IFNULL(p.unit_price, 0);
Update zh_stage_bills_final_8 sp LEFT JOIN zh_ledger_8 p on sp.lid = p.id Set sp.unit_price = IFNULL(p.unit_price, 0);
Update zh_stage_bills_final_9 sp LEFT JOIN zh_ledger_9 p on sp.lid = p.id Set sp.unit_price = IFNULL(p.unit_price, 0);

ALTER TABLE `zh_stage`
ADD COLUMN `contract_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(合同)' AFTER `qc_tp`,
ADD COLUMN `qc_pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差(变更)' AFTER `contract_pc_tp`,
ADD COLUMN `pc_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '本期补差' AFTER `qc_pc_tp`;

ALTER TABLE `zh_ledger_revise`
ADD COLUMN `sum`   varchar(255) NOT NULL DEFAULT '' COMMENT 'sum统计数据' AFTER `pre_his_id`;

ALTER TABLE `zh_project` ADD `fun_set` VARCHAR(1000) NULL DEFAULT NULL COMMENT '项目设置页内容json' AFTER `map_json`;

ALTER TABLE `zh_change`
ADD COLUMN `positive_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '正变更金额' AFTER `order_by`,
ADD COLUMN `negative_tp`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '负变更金额' AFTER `positive_tp`;

ALTER TABLE `zh_stage_bills_0`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_1`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_2`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_3`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_4`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_5`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_6`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_7`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_8`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_9`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;

ALTER TABLE `zh_stage_bills_final_0`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_final_1`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_final_2`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_final_3`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_final_4`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_final_5`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_final_6`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_final_7`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_final_8`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;
ALTER TABLE `zh_stage_bills_final_9`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `positive_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `negative_qc_qty`;

ALTER TABLE `zh_stage_pos_0`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_1`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_2`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_3`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_4`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_5`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_6`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_7`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_8`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_9`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_10`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_11`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_12`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_13`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_14`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_15`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_16`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_17`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_18`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_19`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;

ALTER TABLE `zh_stage_pos_final_0`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_1`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_2`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_3`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_4`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_5`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_6`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_7`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_8`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_9`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_10`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_11`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_12`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_13`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_14`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_15`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_16`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_17`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_18`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;
ALTER TABLE `zh_stage_pos_final_19`
ADD COLUMN `positive_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `qc_minus_qty`,
ADD COLUMN `negative_qc_qty`  decimal(24,8) NOT NULL DEFAULT 0 AFTER `positive_qc_qty`;

ALTER TABLE `zh_stage`
ADD COLUMN `positive_qc_tp`  decimal(24,8) NULL DEFAULT 0 COMMENT '本期-正-变更金额' AFTER `his_id`,
ADD COLUMN `pre_positive_qc_tp`  decimal(24,8) NULL DEFAULT 0 COMMENT '截止上期-正-变更金额' AFTER `positive_qc_tp`,
ADD COLUMN `positive_qc_pc_tp`  decimal(24,8) NULL DEFAULT 0 COMMENT '本期-正-变更金额' AFTER `pre_positive_qc_tp`,
ADD COLUMN `negative_qc_tp`  decimal(24,8) NULL DEFAULT 0 COMMENT '本期-负-变更金额' AFTER `pre_positive_qc_tp`,
ADD COLUMN `pre_negative_qc_tp`  decimal(24,8) NULL DEFAULT 0 COMMENT '截止上期-负-变更金额' AFTER `negative_qc_tp`,
ADD COLUMN `negative_qc_pc_tp`  decimal(24,8) NULL DEFAULT 0 COMMENT '本期-负-变更金额' AFTER `pre_negative_qc_tp`;

ALTER TABLE `zh_stage_change`
ADD COLUMN `unit_price`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '清单单价' AFTER `no_value`;
ALTER TABLE `zh_stage_change_final`
ADD COLUMN `unit_price`  decimal(24,8) NOT NULL DEFAULT 0 COMMENT '清单单价' AFTER `no_value`;

Update `zh_stage_change` sc LEFT JOIN zh_change_audit_list cal ON sc.cbid = cal.id Set sc.unit_price = IFNULL(cal.unit_price, 0);
Update `zh_stage_change_final` sc LEFT JOIN zh_change_audit_list cal ON sc.cbid = cal.id Set sc.unit_price = IFNULL(cal.unit_price, 0);

CREATE TABLE `zh_glj_lib` (
  `id` int(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `list_id` int(8) NOT NULL COMMENT '工料机列表id',
  `glj_id` int(8) NOT NULL COMMENT '导入的工料机id',
  `glj_pid` int(8) NOT NULL COMMENT '父节点id',
  `level` tinyint(2) NOT NULL DEFAULT '1' COMMENT '目录层级',
  `is_leaf` tinyint(1) NOT NULL,
  `full_path` text NOT NULL,
  `order` tinyint(5) NOT NULL,
  `code` varchar(30) NOT NULL DEFAULT '' COMMENT '编号',
  `name` varchar(255) NOT NULL DEFAULT '' COMMENT '名称',
  `unit` varchar(18) NOT NULL DEFAULT '' COMMENT '单位',
  `rise_range` decimal(24,8) NOT NULL DEFAULT '0.00000000',
  `fall_range` decimal(24,8) NOT NULL DEFAULT '0.00000000',
  `spec` varchar(50) NOT NULL DEFAULT '' COMMENT '规格',
  `type` int(8) unsigned NOT NULL DEFAULT '0' COMMENT '工料分类',
  `memo` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
  PRIMARY KEY (`id`),
  KEY `idx_pid` (`glj_pid`) USING BTREE,
  KEY `idx_list_id` (`list_id`) USING BTREE,
  KEY `idx_level` (`level`) USING BTREE,
  KEY `idx_chapter_id` (`glj_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='工料机数据表';

CREATE TABLE `zh_glj_lib_list` (
  `id` int(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `name` varchar(60) NOT NULL COMMENT '项目章节名称',
  `remark` varchar(60) DEFAULT '' COMMENT '备注',
  `create_time` int(10) NOT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='工料机列表数据表';