insert into instalacao_log(ds_passo) values ('passo 182');
drop view if exists vw_erpc_nfccode_geraxml_cancelar;

create view vw_erpc_nfccode_geraxml_cancelar AS
    SELECT 
        dc.id AS id,
        dc.ds_numnf AS ds_numnf,
        dc.ds_chave AS chCanc,
        '07494091000108' AS CNPJ,
		    'rdjsiqxIfJsdSy8TBFZTWiNqp4bBhO48qM2cvoHiOJioNZCW8/EpPb5HgwN7myOz3IZt8UpJWL8ohe/6vPqnFObCqZ0gv6GVUxMcR5ZtW3O9diRGGDtV+tTPBIamgMMrXLAnNAHVaBQE+t3G7tU8wjtW6eHJ+7B7PzGyl061DYeyQTT4Nvswj8xmDPFwWzX/hse3CDnRGLumrDP7ee7Vx/L145OAlBxcp6nVLTQR7cdzKg1uD9HV+lKqa3mND6G9lDhgl+3lKUmPdYsBG9HEUkUlg5yd8oWq4jpLrvt12etWSTnSTDKnzMtvkvCtUfbNsxU/paQsIuLTfmqlusUJww=='
              AS signAC,
        '001' AS numeroCaixa,
        dc.cd_status_nfe AS cd_status_nfe,
        SUM(pv.vl_total_pedido) AS vl_total_cfe
    FROM erpc_documentos_saida dc
        JOIN erpc_pedidos_documentos_saida pd ON dc.id = pd.id_documento_saida
        JOIN erpc_pedidos_venda_liberados pv ON pv.id = pd.id_pedido_liberados
        JOIN erpc_unidades un ON un.id = pv.id_unidade
    WHERE
        dc.id_status_transmissao = 4
            AND dc.cd_status_nfe = '06000'
            AND dc.ds_modelo = 59
    GROUP BY dc.id , dc.ds_numnf , dc.ds_chave , dc.cd_status_nfe
    ;
	insert into instalacao_log(ds_passo) values ('passo 183');