tldm-universe/CMS/BP.CNV/REL8.CONV.IVT

85 lines
2.3 KiB
Plaintext
Raw Normal View History

2024-09-10 19:25:06 +00:00
*------------------------------------------------------------------
*PGM NAME: REL8.CONV.IVT
*PURPOSE: TO CONVERT INVENTORY TRANSACTION HISTORY
*AUTHOR: BARKSDALE
*CREATED: 07/20/95
*------------------------------------------------------------------
$INCLUDE GEN.COMMON
$INCLUDE INV
$INCLUDE IVT
$INCLUDE IMA
*
OPEN 'IVT.OLD' TO IVT.OLD ELSE ABORT 201,'IVT.OLD'
OPEN 'INVENTORY' TO INVENTORY ELSE ABORT 201,'INVENTORY'
OPEN 'INV.TRANS' TO INV.TRANS ELSE ABORT 201,'INV.TRANS'
OPEN 'INV.ACTIVITY' TO INV.ACTIVITY ELSE ABORT 201,'INV.ACTIVITY'
OPEN 'INV.JOURNAL' TO INV.JOURNAL ELSE ABORT 201,'INV.JOURNAL'
OPEN 'INV.COST' TO INV.COST ELSE ABORT 201,'INV.COST'
OPEN 'GEN.KEYS' TO GEN.KEYS ELSE ABORT 201,'GEN.KEYS'
*
EOF=0; NUM.READ=0; NUM.DONE=0
*
EXECUTE \SSELECT IVT.OLD BY ITEM BY PERIOD\
LOOP
READNEXT ID ELSE EOF=1
UNTIL EOF DO
IF REM(NUM.READ,10) ELSE GOSUB 2000
GOSUB 1000
REPEAT
GOSUB 2000
CRT @(0,22):CL:"Press <return> to continue...":
INPUT ANY
STOP
*
1000 *
READ TREC FROM IVT.OLD,ID THEN
NUM.READ=NUM.READ+1
ITEM=FIELD(ID,"|",2)
READV ASMFLAG FROM INVENTORY,ITEM,INV$ASSEMBLED ELSE ASMFLAG="N"
TCT=DCOUNT(TREC<1>,VM)
FOR T=TCT TO 1 STEP -1
TYPE=TREC<IVT$TYPE,T>
QTY=TREC<IVT$QUANTITY,T>
BEGIN CASE
CASE TYPE="DNR"
TYPE="SLS"
QTY=QTY*-1
CASE TYPE="ASM"
IF ASMFLAG="Y" THEN
TYPE="ASM.UPDATE"
END ELSE
TYPE="ASM"
END
CASE TYPE="TRF"; TYPE="ADJ"
CASE TYPE="MR"; TYPE="ADJ"
CASE TYPE="RT"; TYPE="RTS"
END CASE
IMA.DATA=""
IMA.DATA<IMA$FUNCTION>=TYPE
IMA.DATA<IMA$ITEM>=ITEM
IMA.DATA<IMA$QUANTITY>=QTY
IMA.DATA<IMA$WAREHOUSE>="MTEK"
IMA.DATA<IMA$DATE>=TREC<IVT$DATE,T>
IMA.DATA<IMA$REFERENCE>=TREC<IVT$REFERENCE.NUMBER,T>
IMA.DATA<IMA$USER>=TREC<IVT$OPERATOR,T>
IMA.DATA<IMA$TO.WHSE>=TREC<IVT$TO.LOCATION,T>
IMA.DATA<IMA$COMMENT>=TREC<IVT$COMMENT,T>
IMA.DATA<IMA$PROCESS>="REL8.CONV.IVT"
IMA.DATA<IMA$PROCESS.DATE>=DATE()
IMA.DATA<IMA$PROCESS.TIME>=TIME()
CALL CMSD.INV.MASTER(IMA.DATA)
IF IMA.DATA<IMA$RESULT>#"PASS" THEN
CRT @(0,22):"Problem exists...":
INPUT DUMMY
END
NEXT T
NUM.DONE=NUM.DONE+1
END
RETURN
*
2000 *
CRT CS
CRT @(0,5):"NUMBER RECORDS READ: ":NUM.READ
CRT @(0,6):"NUMBER RECORDS DONE: ":NUM.DONE
RETURN