| | |
| | | and credit_date >= #{monstartLastMon} |
| | | and credit_date <= #{monendLastMon}) ) a |
| | | </select> |
| | | <select id="zbjtjznbyszk" resultType="com.by4cloud.platformx.business.vo.JznbyszkVo"> |
| | | SELECT |
| | | zgs, |
| | | wfyssx, |
| | | ( wfyssx - sx ) dfgz, |
| | | sx, |
| | | hxhtze, |
| | | lynjhht, |
| | | lywjhht |
| | | FROM |
| | | ( |
| | | SELECT |
| | | '冀中股份' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | AND billing_amout >= paid_amount |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中股份' and party_a = branch ) |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM |
| | | contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '冀中股份' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM |
| | | contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '冀中股份' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if>) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中股份' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中股份' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中股份' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '峰峰集团' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '峰峰集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM |
| | | contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '峰峰集团' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM |
| | | contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '峰峰集团' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if>) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '峰峰集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '峰峰集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '峰峰集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '邢矿集团' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邢矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM |
| | | contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '邢矿集团' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM |
| | | contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '邢矿集团' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if>) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邢矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邢矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邢矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '邯矿集团' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邯矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '邯矿集团' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '邯矿集团' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if>) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邯矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邯矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邯矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '山西冀中' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '山西冀中' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '山西冀中' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '山西冀中' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if>) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '山西冀中' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '山西冀中' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '山西冀中' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '井矿集团' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '井矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '井矿集团' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '井矿集团' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if>) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '井矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '井矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '井矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '张矿集团' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '张矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '张矿集团' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '张矿集团' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if>) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '张矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '张矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '张矿集团' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '冀中能源' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中能源' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '冀中能源' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '冀中能源' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if>) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中能源' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中能源' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中能源' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '设备租赁' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '设备租赁' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '设备租赁' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '设备租赁' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if>) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '设备租赁' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '设备租赁' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '设备租赁' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '供应链' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '供应链' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '供应链' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '供应链' AND c.party_a = branch )) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if>) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '供应链' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '供应链' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '供应链' and party_a = branch ) |
| | | <if test="compId!=null"> |
| | | AND comp_id = #{compId} |
| | | </if> |
| | | ) lywjhht |
| | | ) a |
| | | </select> |
| | | <select id="zbjtjznbyszkSMJ" resultType="com.by4cloud.platformx.business.vo.JznbyszkVo"> |
| | | SELECT |
| | | zgs, |
| | | wfyssx, |
| | | ( wfyssx - sx ) dfgz, |
| | | sx, |
| | | hxhtze, |
| | | lynjhht, |
| | | lywjhht |
| | | FROM |
| | | ( |
| | | SELECT |
| | | '冀中股份' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中股份' and party_a = branch ) |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '冀中股份' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '冀中股份' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249)) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中股份' and party_a = branch ) |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中股份' and party_a = branch ) |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中股份' and party_a = branch ) |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '峰峰集团' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '峰峰集团' and party_a = branch ) |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '峰峰集团' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '峰峰集团' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249)) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '峰峰集团' and party_a = branch ) |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '峰峰集团' and party_a = branch ) |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '峰峰集团' and party_a = branch ) |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '邢矿集团' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL( sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邢矿集团' and party_a = branch ) |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '邢矿集团' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '邢矿集团' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249)) sx, |
| | | ( SELECT IFNULL( sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邢矿集团' and party_a = branch ) |
| | | ) hxhtze, |
| | | ( SELECT IFNULL( sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邢矿集团' and party_a = branch ) |
| | | ) lynjhht, |
| | | ( SELECT IFNULL( sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邢矿集团' and party_a = branch ) |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '邯矿集团' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL( sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邯矿集团' and party_a = branch ) |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '邯矿集团' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '邯矿集团' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249)) sx, |
| | | ( SELECT IFNULL( sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邯矿集团' and party_a = branch ) |
| | | ) hxhtze, |
| | | ( SELECT IFNULL( sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邯矿集团' and party_a = branch ) |
| | | ) lynjhht, |
| | | ( SELECT IFNULL( sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '邯矿集团' and party_a = branch ) |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '山西冀中' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '山西冀中' and party_a = branch ) |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '山西冀中' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '山西冀中' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249)) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '山西冀中' and party_a = branch ) |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '山西冀中' and party_a = branch ) |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '山西冀中' and party_a = branch ) |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '井矿集团' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '井矿集团' and party_a = branch ) |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '井矿集团' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '井矿集团' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249)) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '井矿集团' and party_a = branch ) |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '井矿集团' and party_a = branch ) |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '井矿集团' and party_a = branch ) |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '张矿集团' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '张矿集团' and party_a = branch ) |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '张矿集团' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '张矿集团' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249)) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '张矿集团' and party_a = branch ) |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '张矿集团' and party_a = branch ) |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '张矿集团' and party_a = branch ) |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '冀中能源' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中能源' and party_a = branch ) |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '冀中能源' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '冀中能源' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249)) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中能源' and party_a = branch ) |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中能源' and party_a = branch ) |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '冀中能源' and party_a = branch ) |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '设备租赁' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '设备租赁' and party_a = branch ) |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '设备租赁' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '设备租赁' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249)) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '设备租赁' and party_a = branch ) |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '设备租赁' and party_a = branch ) |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '设备租赁' and party_a = branch ) |
| | | ) lywjhht |
| | | union all |
| | | SELECT |
| | | '供应链' zgs, |
| | | (( |
| | | SELECT |
| | | IFNULL(sum( billing_amout - paid_amount ), 0 ) |
| | | FROM |
| | | contract |
| | | WHERE |
| | | del_flag = '0' |
| | | AND billing_amout >= paid_amount |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '供应链' and party_a = branch ) |
| | | )+ ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '供应链' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | )) wfyssx, |
| | | ( SELECT IFNULL( sum( unit_price *( out_bound_num - advance_num - invoice_num )), 0 ) FROM contract_out_bound cob |
| | | WHERE |
| | | del_flag = '0' |
| | | AND EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | contract c |
| | | WHERE |
| | | c.del_flag = '0' |
| | | AND c.id = cob.contract_id |
| | | AND EXISTS ( SELECT * FROM jz_group_branch WHERE `group` = '供应链' AND c.party_a = branch )) |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249)) sx, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{monend} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '供应链' and party_a = branch ) |
| | | ) hxhtze, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date <= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '供应链' and party_a = branch ) |
| | | ) lynjhht, |
| | | ( SELECT IFNULL(sum( amount ), 0 ) FROM contract WHERE del_flag = '0' AND contract_status = 2 AND expiration_date >= #{mon2after} |
| | | AND (comp_id = 2089995177814495234 or comp_id = 2089996921978040321 or comp_id = 2089997578009128962 or comp_id = 2101966257365045249) |
| | | AND EXISTS (SELECT * from jz_group_branch where `group` = '供应链' and party_a = branch ) |
| | | ) lywjhht |
| | | ) a |
| | | </select> |
| | | </mapper> |