0
OBJECT:
DATETIME TODAYMAX,
BAS012 EXCREC;
TODAYMAX=STRSTR(SYS_CURRENTDATE,0,10)+' 23:59';
SELECT I.COMPANY,I.PLANT, I.ORDERTYPE,I.ORDERNUM,
I.ITEMNUM, I.COSTCENTER , I.MATERIAL , I.STEXT ,
I.QUANTITY , I.PRICE , I.NET ,I.VENDOR,
C.NAME1, I.REQUIREMENTDATE , I.DELIVERYDATE , I.GRQUANTITY ,
AS DELNOTE , AS NOTES , '' AS REQ , 0 AS STATUS,
I.VSTEXT ,I.CURRENCY,0.0 AS NETTL
, (select ORDERDATE from IASPURHEAD where CLIENT=I.CLIENT and COMPANY=I.COMPANY and PLANT=I.PLANT
and ORDERNUM=I.ORDERNUM and ORDERTYPE=I.ORDERTYPE and DOCUMENT=0 ) AS ORDERDATE
FROM IASPURITEM I LEFT OUTER JOIN IASCUSTOMER C ON C.CLIENT=I.CLIENT AND C.COMPANY=I.COMPANY AND C.CUSTOMER=I.VENDOR AND C.BUSAREA='*'
WHERE I.CLIENT=SYS_CLIENT
AND I.COMPANY=SCCOM
AND I.PLANT=SCPLA
AND I.ORDERNUM LIKE SCOUTNO
AND I.COSTCENTER LIKE EDIT5
AND I.MATERIAL LIKE SCMAT
AND I.VENDOR LIKE SCVENDOR
AND I.REQUIREMENTDATE between EDIT3 and EDIT4
AND I.DELIVERYDATE between EDIT1 and EDIT2
AND I.ISDELETE=0
INTO LISTTABLE;
LOOP AT LISTTABLE
BEGIN
SELECT Q.REQNUM
FROM IASPURREQ Q
WHERE Q.CLIENT=SYS_CLIENT
AND Q.COMPANY=LISTTABLE_COMPANY
AND Q.PLANT=LISTTABLE_PLANT
AND Q.ORDERTYPE=LISTTABLE_ORDERTYPE
AND Q.ORDERNUM=LISTTABLE_ORDERNUM
AND Q.ITEMNUM=LISTTABLE_ITEMNUM
INTO RQ;
LOOP AT RQ
BEGIN
IF LISTTABLE_REQ=='' THEN
LISTTABLE_REQ = RQ_REQNUM;
ELSE
LISTTABLE_REQ = LISTTABLE_REQ+'//'+RQ_REQNUM;
ENDIF;
ENDLOOP;
SELECT DISTINCT POSTDATE
FROM IASINVITEM
WHERE CLIENT=SYS_CLIENT
AND COMPANY=LISTTABLE_COMPANY
AND PURORDTYPE=LISTTABLE_ORDERTYPE
AND PURORDNUM=LISTTABLE_ORDERNUM
AND PURORDITEM=LISTTABLE_ITEMNUM
AND PURORDTYPE!=
AND PURORDNUM!=
AND PURORDITEM!=0
AND QPOSTWAY=0
AND ISCANCELED=0
ORDERBY POSTDATE
INTO GIRISLER;
LOOP AT GIRISLER
BEGIN
IF LISTTABLE_DELNOTE=='' THEN
LISTTABLE_DELNOTE = STRSTR(GIRISLER_POSTDATE,0,10);
ELSE
LISTTABLE_DELNOTE = LISTTABLE_DELNOTE+'//'+STRSTR(GIRISLER_POSTDATE,0,10);
ENDIF;
ENDLOOP;
/*
0:EKgib 1:GECiKTi 2:GECiKMELi 3:GELDi 4:TAKiPTE 5:SiPGÖN
•
/
IF LISTTABLE_GRQUANTITY>0 THEN
IF LISTTABLE_GRQUANTITY < LISTTABLE_QUANTITY THEN
SETBACKCOLOR LISTTABLE TO 16777113;
LISTTABLE_STATUS=0;
LISTTABLE_NOTES='EKgib TESLiMAT';
ELSE
IF GETDAYDIFF(GIRISLER_POSTDATE, LISTTABLE_DELIVERYDATE)<0 /*STRSTR(GIRISLER_POSTDATE,0,10) >STRSTR(LISTTABLE_DELIVERYDATE,0,10)*/ THEN
SETBACKCOLOR LISTTABLE TO 13408767;
LISTTABLE_STATUS=2;
LISTTABLE_NOTES='GECiKEREK GELDi';
ELSE
SETBACKCOLOR LISTTABLE TO 13434828;
LISTTABLE_STATUS=3;
LISTTABLE_NOTES='GELDi';
ENDIF;
ENDIF;
ELSE
IF GETDAYDIFF(LISTTABLE_DELIVERYDATE, TODAYMAX)<0 /*STRSTR(LISTTABLE_DELIVERYDATE,0,10)>=STRSTR(SYS_CURRENTDATE,0,10)*/ THEN
SETBACKCOLOR LISTTABLE TO 52479;
LISTTABLE_STATUS=4;
LISTTABLE_NOTES='TAKiPTE';
ELSE
SETBACKCOLOR LISTTABLE TO 16764057;
LISTTABLE_STATUS=1;
LISTTABLE_NOTES='GECiKTi';
ENDIF;
ENDIF;
LISTTABLE_NETTL=EXCREC. GETRATE('01',LISTTABLE_CURRENCY,'TL',SYS_CURRENTDATE,1);
LISTTABLE_NETTL=LISTTABLE_NETTL*LISTTABLE_NET;
ENDLOOP;
SELECT Q.COMPANY,Q.PLANT, Q.COSTCENTER , Q.MATERIAL ,
Q.STEXT , Q.QUANTITY , Q.REQUIREMENTDATE , 4 AS STATUS
FROM IASPURREQ Q
WHERE Q.CLIENT=SYS_CLIENT
AND Q.COMPANY=SCCOM
AND Q.PLANT=SCPLA
AND Q.COSTCENTER LIKE EDIT5
AND Q.MATERIAL LIKE SCMAT
AND Q.REQUIREMENTDATE between EDIT3 and EDIT4
AND Q.ISDELETE=0
AND Q.ISORDER=0
INTO LISTT;
LOOP AT LISTT
BEGIN
APPEND ROW TO LISTTABLE;
MOVE-CORRESPONDING LISTT TO LISTTABLE;
LISTTABLE_NOTES='SiPARiŞ EDiLMEDi';
LISTTABLE_STATUS=5;
SETBACKCOLOR LISTTABLE TO 16751001;
ENDLOOP;
IF ISOUT THEN
SELECT S.COMPANY,S.PLANT,S.COSTCENTER,S.ACCOUNT AS MATERIAL ,
S.COMPTEXT AS STEXT ,S.BASEQUAN AS QUANTITY,O.TARGETEND AS REQUIREMENTDATE, 6 AS STATUS ,
H.VENDOR,H.NAME1 , O.POTYPE,O.PRDORDER,
O.OPERATION,O.BOMLEVEL,O.CONFIRMATION , H.STATUS AS HSTAT ,
S.VALIDFROM AS DELIVERYDATE ,S.SPRICE AS PRICE, S.PRICE AS NET , S.CURRENCY
FROM SISOUTSOURITEM S, SISOUTSOURHEAD H , IASPRDOPR O
WHERE S.CLIENT=SYS_CLIENT
AND S.COMPANY=SCCOM
AND S.PLANT=SCPLA
AND S.COSTCENTER LIKE EDIT5
AND S.ACCOUNT LIKE SCMAT
AND H.CLIENT=S.CLIENT
AND H.COMPANY=S.COMPANY
AND H.PLANT=S.PLANT
AND H.OSORDER=S.OSORDER
AND H.ISSIGNATURE=1
AND H.ISDELETE=0
AND O.CLIENT=S.CLIENT
AND O.COMPANY=S.COMPANY
AND O.PLANT=S.PLANT
AND O.POTYPE=S.POTYPE
AND O.PRDORDER=S.PRDORDER
AND O.OPERATION=S.OPERATION
AND O.TARGETEND between EDIT3 and EDIT4
AND S.VALIDFROM between EDIT1 and EDIT2
INTO FASON;
/* 6:FASONDA 7:GELDi 8:GiDECEK */
LOOP AT FASON
BEGIN
APPEND ROW TO LISTTABLE;
MOVE-CORRESPONDING FASON TO LISTTABLE;
LISTTABLE_NETTL=EXCREC. GETRATE('01',LISTTABLE_CURRENCY,'TL',SYS_CURRENTDATE,0);
LISTTABLE_NETTL=LISTTABLE_NETTL*LISTTABLE_NET;
FASON_DELIVERYDATE=RESETTIME(FASON_DELIVERYDATE);
IASPRDCONF_CDATE=RESETTIME(IASPRDCONF_CDATE);
IF FASON_HSTAT>=2 THEN
SELECT MAX(CONFIRMDATE) AS CDATE,SUM(OUTPUT) AS OUTPUT
FROM IASPRDCONF
WHERE CLIENT=SYS_CLIENT
AND COMPANY=SCCOM
AND POTYPE=FASON_POTYPE
AND PRDORDER=FASON_PRDORDER
AND OPERATION=FASON_OPERATION
AND BOMLEVEL=FASON_BOMLEVEL
AND CONFIRMATION=FASON_CONFIRMATION;
IASPRDCONF_CDATE=RESETTIME(IASPRDCONF_CDATE);
/* IASCELAL && IASPRDCONF_OUTPUT>0 */
IF SELECTED
&& IASPRDCONF_OUTPUT>0 THEN
LISTTABLE_GRQUANTITY=IASPRDCONF_OUTPUT;
LISTTABLE_DELNOTE=IASPRDCONF_CDATE;
IF FASON_DELIVERYDATE < IASPRDCONF_CDATE THEN
LISTTABLE_NOTES='GECiKEREK GELDi.';
LISTTABLE_STATUS=7;
SETBACKCOLOR LISTTABLE TO 6750054;
ELSE
LISTTABLE_NOTES='GELDi';
LISTTABLE_STATUS=7;
SETBACKCOLOR LISTTABLE TO 6750054;
ENDIF;
Tümünü Göster