Created
December 9, 2013 18:00
-
-
Save viniciusss/7876897 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Thread Id: 34865276 | |
-- User: webpdv | |
-- Host: 192.168.111.4:49432 | |
-- DB: webpdv | |
-- Command: Query | |
-- Time: 2 | |
-- State: Sending data | |
SELECT pv.id_pre_venda, pv.id_paf, pv.serie_numeracao, pv.numero_pre_venda, | |
pv.observacao, pv.criacao, pv.tratada, pv.status AS status_pre_venda, | |
pv.coo AS coo_pre_venda, pv.sincronizado, pv.condicao_comercial, | |
ROUND(SUM((pvfm.valor_parcelas*pvfm.numero_parcelas)/100), 2) AS valor, | |
ROUND(SUM((pvfm.valor)/100), 2) AS valor_cupom, | |
pvc.nome_cliente, | |
v.id_venda, v.coo As coo_venda, v.status AS status_venda, | |
p.storeno, p.ip, p.ecfno, p.pdvno | |
FROM foxpaf.pre_venda pv | |
LEFT JOIN foxpaf.pre_venda_forma_pagamento pvfm USING (id_pre_venda) | |
LEFT JOIN foxpaf.pre_venda_cliente pvc USING (id_pre_venda) | |
LEFT JOIN foxpaf.venda v USING (id_pre_venda) | |
LEFT JOIN foxpaf.paf p | |
ON (p.id_paf = pv.id_paf) | |
WHERE 1 = 1 | |
AND pv.criacao BETWEEN '2013-12-09 00:00:00' AND '2013-12-09 23:59:59' | |
AND p.storeno = 10 | |
GROUP BY pv.id_pre_venda, v.id_venda | |
ORDER BY pv.id_pre_venda DESC, v.coo DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment