DELIMITER $$

create ALGORITHM=UNDEFINED DEFINER=`apzl`@`%` SQL SECURITY DEFINER VIEW `vi_li_invoice_tj_gps` AS (
SELECT `lci`.`ID` AS `contract_id`,`lci`.`CONTRACT_NO` AS `contract_no`,'1' AS `plan_list`,`lfi`.`FACT_MONEY` AS `invoice_money`,(SELECT `apzl`.`code_library`.`itemname` FROM `apzl`.`code_library` WHERE ((`apzl`.`code_library`.`codeno` = 'tax_type') AND (`apzl`.`code_library`.`itemno` = 'feetype24'))) AS `tax_type`,'feetype24' AS `tax_no`,(SELECT `apzl`.`tax_code_info`.`code` FROM `apzl`.`tax_code_info` WHERE (`apzl`.`tax_code_info`.`tax_type` = 'feetype24')) AS `tax_code`,`cac`.`CERTID` AS `cert_id`,`cac`.`account` AS `account`,`cac`.`acc_number` AS `acc_number`,`cac`.`bank_name` AS `bank_name`,`cac`.`MOBILE` AS `telephone`,`ci`.`customertype` AS `customer_type`,`ci`.`customername` AS `customer_name`,`ti`.`gps_install_fee` AS `tax_ratio`,`liti`.`id` AS `liti_id`,`liti`.`status` AS `invoice_status`,`liti`.`FPDM` AS `FPDM`,`liti`.`FPHM` AS `FPHM`,`liti`.`hztzdh` AS `hztzdh`,`liti`.`mxxh` AS `mxxh` FROM ((((((`apzl`.`lc_fund_income` `lfi` LEFT JOIN `apzl`.`lb_contract_info` `lci` ON((`lfi`.`CONTRACT_ID` = `lci`.`ID`))) LEFT JOIN (SELECT `li`.`id` AS `id`,`li`.`contract_no` AS `contract_no`,`li`.`status` AS `status`,`li`.`fpdm` AS `FPDM`,`li`.`fphm` AS `FPHM`,`li`.`hztzdh` AS `hztzdh`,`li`.`mxxh` AS `mxxh` FROM `apzl`.`li_invoice_tj_info` `li` WHERE ((`li`.`tax_type` = 'feetype24') AND (`li`.`status` = 'Y'))) `liti` ON((`liti`.`contract_no` = `lci`.`CONTRACT_NO`))) LEFT JOIN `apzl`.`lb_union_lessee` `lul` ON((`lul`.`CONTRACT_ID` = `lci`.`ID`))) LEFT JOIN `apzl`.`customer_info` `ci` ON((`ci`.`customerid` = `lul`.`CUSTOMER_ID`))) LEFT JOIN `apzl`.`customer_account` `cac` ON((`cac`.`CONTRACT_ID` = `lci`.`ID`))) LEFT JOIN `apzl`.`tax_info` `ti` ON(((`ti`.`LEASE_FORM` = `lci`.`LEAS_FORM`) AND (`ti`.`ID` IN ('5ceefeccd3af4db8a98d41c203c9dbe9','7672ff2fa48046ebbaf905c02e993221'))))) WHERE ((`lci`.`SUBJECTID` = 'd989246c11c111eaaa0000163e0e11e6') AND (`lci`.`CONTRACT_STATUS` IN ('31','100','105')) AND (`lfi`.`FEE_TYPE` = 'feetype24') AND (`lfi`.`PAY_TYPE` = 'pay_type_in') AND (((`lfi`.`SETTLE_METHOD` IN ('settlemethod11','settlemethod6')) AND (`lfi`.`PAY_STATUS` = 'apply_pass')) OR (`lfi`.`PAY_STATUS` = 'have_paid'))))$$

DELIMITER ;