Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
with MYTAB (MYDATE) as (
values ('20210716'), ('20211116')
)
select
MYDATE,
substr(MYDATE, 1, 4) || '-' || substr(MYDATE, 5, 2) || '-' || substr(MYDATE, 7, 2) as MYDATE_ISO,
week_iso(substr(MYDATE, 1, 4) || '-' || substr(MYDATE, 5, 2) || '-' || substr(MYDATE, 7, 2)) as WEEK_ISO
from MYTAB
MYDATE MYDATE_ISO WEEK_ISO
20210716 2021-07-16 28
20211116 2021-11-16 46
select distinct PMORDF.PROFILO as "INSERITO DA",
PMORDF.TIPO as "PRELEVATO",
PMORDF.ORDPRO as "ORDINE LAVORO",
PMORDF.CODART as "COD. ARTICOLO",
(PMORDF.QTRDPO - PMORDF.QTNTPO) as "QUANTITÀ RESIDUA",
year (DTSCAD) as "ANNO", (day (DTSCSD) - day (DTIPPO)) as "GG ATTRAVERSAMENTO",
date(insert(insert(left(char(DTSCAD),8),5,0,'-'),8,0,'-')) as "FINE PROD.",
current date as "DATA CORRENTE",
(date(insert(insert(left(char(DTSCAD),8),5,0,'-'),8,0,'-'))) - (current date) as "RITARDO",
PMORDF.TORDPO as "STATO",
PMORDF.STAMP as "STAMPA",
PMORDF.QTNTPO as "QT. VERSATA",
MGARTF.DSARMA as "DESCR. ARTICOLO"
from S1000000.RAI01DAT.MGARTF MGARTF, S1000000.RAI01DAT.MGART1F MGART1F, S1000000.RAI01DAT.PCIMPF PCIMPF, S1000000.RAI01DAT.PMORDF PMORDF
where PCIMPF.ORPRCI = PMORDF.ORDPRO
and MGART1F.CDARMD = PCIMPF.CDARCI
and MGARTF.CDARMA = MGART1F.CDARMD
and ((PMORDF.DTINPO>20201231))
and TIPO <>'S'
and (QTRDPO-QTNTPO) >0
and (date(insert(insert(left(char(DTSCAD),8),5,0,'-'),8,0,'-'))) - (current date) like '-%'
with MGARTF (DTSCAD) as (
values (20210716), (20211116)
)
select
date(insert(insert(left(char(DTSCAD),8),5,0,'-'),8,0,'-')) as "FINE PROD",
week_iso(date(insert(insert(left(char(DTSCAD),8),5,0,'-'),8,0,'-'))) as "week number of FINE PROD"
from MGARTF
FINE PROD week number of FINE PROD
2021-07-16 28
2021-11-16 46