06 Mai 2017 20:55
SELECT a.codigo, a.descri
FROM a03prd a
INNER JOIN a04dnf b ON ( a.codigo=b.codprd )
WHERE b.CodFrn=50
GROUP BY a.codigo
ORDER BY a.descri
20701 ABS LIVRE ATIVA CLASSIC CA 8 UN
6987 ACHOC ITALAC 200ML
15145 ACHOC ITALAC SC 400G
16462 ACHOC PO MAGICO 200G
...
07 Mai 2017 00:46
07 Mai 2017 09:56
select b.codigo, b.descri, a.qtdprd, a.vlruni, a.numnot, Max(a.datent)
from a04dnf a
inner join a03prd b on (a.codprd=b.CODIGO)
where a.codfrn=3
group by a.codprd
order by b.descri
07 Mai 2017 11:38
08 Mai 2017 09:25
09 Mai 2017 00:06
select a.codprd, a.qtdprd, a.vlruni, a.datent
from a04dnf a
inner join (select max(datent) as data from a04dnf b group by b.codprd) c on c.data = a.datent
where a.codfrn=3
group by a.codprd
order by a.codprd
09 Mai 2017 20:23
cQuery = "SELECT a.codprd, a.uniprd, a.unicom, a.qtdprd, a.vlruni, a.numnot, a.datent, b.descri, b.sldstk " + ;
"FROM a04dnf a " + ;
"INNER JOIN a03prd b ON ( a.codprd=b.codigo ) " + ;
"WHERE a.is_deleted = 'N' and a.CodFrn='&nCodFrn' and a.datent between '&vDataI_' and '&vDataF_' " + ;
"ORDER BY b.descri, a.datent DESC "
GERA_TAB()
use &dbftmp as cQuery NEW SCROLLABLE
DbGoTop()
Do While !Eof()
nCodPrd := CodPrd
nConta := 0
Do While nCodPrd = CodPrd
If nConta = 0
@ PROW() + 01,000 SAY StrZero(CodPrd,5) + " " + Left(DesCri,40)
@ PROW() ,048 SAY UniCom
@ PROW() ,051 SAY UniPrd
@ PROW() ,056 SAY DatEnt
@ PROW() ,069 SAY QtdPrd Pict "@E 99,999.99"
@ PROW() ,083 SAY VlrUni Pict "@E 99,999.99"
@ PROW() ,096 SAY NumNot
@ PROW() ,123 SAY SldStk Pict "@E 99,999.99"
@ PROW() + 01,000 SAY REPLICATE("-",132)
Endif
nConta++
DbSkip()
Enddo
Enddo
Use
11 Set 2017 19:05
Select distinct a.codigo, a.descri, max(b.DATENT)
from a03prd a
inner join a04dnf b on (a.codigo=b.codprd)
where b.DATEMI between '2016-01-01' and '2016-01-31'
group by a.codigo
order by a.codigo
002 ARROZ PARB PAI JOAO 1K 2016-01-13
003 ARROZ PARB PAI JOAO 1K 2016-01-28
016 ARROZ BRANCO GRANEL 1K 2016-01-13
034 MAC NISSIN T MONICA GALINHA 90G 2016-01-19
102 TRIGO D BENTA CF 1K 2016-03-01
11 Set 2017 19:24
Select *
from a04dnf e
where e.datent between '2016-01-01' and '2016-01-31' and
not exists
(
Select null
from a03dpd d
where d.codprd = e.codprd
)
11 Set 2017 20:11
Select distinct e.codprd, b.descri, max(e.datent)
from a04dnf as e
inner join a03prd as b on (b.codigo=e.codprd)
Where e.datent between '2016-01-01' and '2016-01-31' and
not exists
(
Select null
from a03dpd as t
where t.codprd = e.codprd
)
group by e.datent
Select distinct e.codprd, b.descri, max(e.datent)
from a04dnf as e
inner join a03prd as b on (b.codigo=e.codprd)
Where e.datent between '2016-01-01' and '2016-01-31' and
not exists
(
Select null
from a03dpd as t
where t.codprd = e.codprd and t.datemi between '2016-01-01' and '2016-01-31'
)
group by e.datent
11 Set 2017 21:11
11 Set 2017 23:34
Select t.codprd, b. descri
from (Select distinct codprd, datent from a04dnf) as t
left join (select distinct codprd from a03dpd where (datemi between '2016-01-01' and '2016-01-31') c on t.codprd=c.codprd
inner join a03prd as b on (b.codigo=t.codprd)
where (t.datent between '2016-01-01' and '2016-01-31') and (c.codprd is null)
order by b.descri
12 Set 2017 09:10
10 Jan 2018 10:28