143 lines
4.1 KiB
Plaintext
Executable File
143 lines
4.1 KiB
Plaintext
Executable File
*------------------------------------------------------------------
|
|
*PGM NAME: REL8.CONV.PMO
|
|
*PURPOSE: TO CONVERT PM.ORDERS FROM REL8 TO NEW REL8
|
|
*AUTHOR: BARKSDALE
|
|
*CREATED: 01/18/95
|
|
*------------------------------------------------------------------
|
|
$INCLUDE BP.MASTER GEN.COM2
|
|
$INCLUDE BP.MASTER CMSD.IVD
|
|
*
|
|
OPEN 'PM.ORDERS.OLD' TO PMO.OLD ELSE ABORT 201,'PM.ORDERS.OLD'
|
|
OPEN 'PM.ORDERS' TO PMO ELSE ABORT 201,'PM.ORDERS'
|
|
OPEN 'PMO.BAD' TO PMO.BAD ELSE ABORT 201,'PMO.BAD'
|
|
OPEN 'PM.ORDERS.INDEX.RELEASED' TO RX ELSE ABORT 201,'RX'
|
|
OPEN 'PM.ORDERS.INDEX.BACKORDER' TO BX ELSE ABORT 201,'BX'
|
|
OPEN 'PM.ORDERS.INDEX.CC' TO CX ELSE ABORT 201,'CX'
|
|
OPEN 'PM.ORDERS.INDEX.PENDING' TO PX ELSE ABORT 201,'PX'
|
|
*
|
|
EOF=0; NUM.READ=0; NUM.DONE=0; NUM.BAD=0; NUM.BAD2=0
|
|
*
|
|
SELECT PMO.OLD
|
|
LOOP
|
|
READNEXT ID ELSE EOF=1
|
|
UNTIL EOF DO
|
|
IF REM(NUM.READ,1000) ELSE GOSUB 2000
|
|
GOSUB 1000
|
|
REPEAT
|
|
GOSUB 2000
|
|
CRT @(0,22):CL:"Press <return> to continue...":
|
|
INPUT ANY
|
|
STOP
|
|
*
|
|
1000 *
|
|
READ OREC FROM PMO.OLD,ID THEN
|
|
NUM.READ=NUM.READ+1
|
|
IF OREC<IVD$BATCH.NUMBER>#"" THEN
|
|
OREC<IVD$WAREHOUSE>="MTEK"
|
|
OREC<IVD$CHANNEL>="MAIL"
|
|
OREC<IVD$ENTITY>="TSM"
|
|
OLDTERMS=OREC<IVD$TERMS>
|
|
OLDSHIP=OREC<IVD$SHIP.MODE>
|
|
BEGIN CASE
|
|
CASE OLDSHIP=1; NEWSHIP=1
|
|
CASE OLDSHIP=2; NEWSHIP="RED"
|
|
CASE OLDSHIP=3; NEWSHIP="UPS"
|
|
CASE OLDSHIP=4; NEWSHIP=3
|
|
CASE OLDSHIP=5; NEWSHIP=3
|
|
CASE OLDSHIP=6; NEWSHIP=3
|
|
CASE OLDSHIP=7; NEWSHIP="BLUE"
|
|
CASE OLDSHIP=8; NEWSHIP=1
|
|
CASE OLDSHIP=9; NEWSHIP="EXPD"
|
|
CASE OLDSHIP=11; NEWSHIP="PRI"
|
|
CASE OLDSHIP=12; NEWSHIP="PRI"
|
|
CASE OLDSHIP=13; NEWSHIP="B"
|
|
CASE OLDSHIP=17; NEWSHIP="RED"
|
|
CASE OLDSHIP=18; NEWSHIP=3
|
|
CASE OLDSHIP=19; NEWSHIP="UPS3"
|
|
CASE OLDSHIP=20; NEWSHIP="SURF"
|
|
CASE OLDSHIP=21; NEWSHIP="AIR"
|
|
CASE OLDSHIP=22; NEWSHIP="PRI"
|
|
CASE OLDSHIP=23; NEWSHIP="FEDX"
|
|
CASE OLDSHIP="SH"; NEWSHIP="SH"
|
|
CASE 1; NEWSHIP=3
|
|
END CASE
|
|
OREC<IVD$SHIP.MODE>=NEWSHIP
|
|
BEGIN CASE
|
|
CASE OLDTERMS=1; NEWTERMS="C"
|
|
CASE OLDTERMS=2; NEWTERMS="COD"
|
|
CASE OLDTERMS=3; NEWTERMS=30
|
|
CASE OLDTERMS=4; NEWTERMS=60
|
|
CASE OLDTERMS="CC"; NEWTERMS="CC"
|
|
CASE OLDTERMS=6; NEWTERMS="G"
|
|
CASE OLDTERMS=7; NEWTERMS="C"
|
|
CASE 1; NEWTERMS="C"
|
|
END CASE
|
|
OREC<IVD$TERMS>=NEWTERMS
|
|
RELNDX=0; CCNDX=0; BONDX=0; PNDX=0
|
|
RELBAD=0; CCBAD=0; BOBAD=0
|
|
IF OREC<IVD$STATUS>[1,1]#"D" THEN
|
|
ICT=DCOUNT(OREC<IVD$ITEM>,VM)
|
|
FOR I=1 TO ICT
|
|
BEGIN CASE
|
|
CASE OREC<IVD$ITEM.STATUS,I>[1,1]="B"
|
|
IF OREC<IVD$LINE.SHIPPED,I>="" THEN
|
|
BONDX=1
|
|
END ELSE
|
|
BONDX=1
|
|
BOBAD=1
|
|
END
|
|
CASE NEWTERMS="CC" AND OREC<IVD$LINE.CC.AUTH,I>="" AND OREC<IVD$BALANCE>#0
|
|
IF OREC<IVD$LINE.NET.AMOUNT,I>#0 THEN
|
|
IF OREC<IVD$ITEM.STATUS,I>[1,1]#"C" THEN
|
|
CCNDX=1
|
|
CCBAD=1
|
|
END ELSE
|
|
CCNDX=1
|
|
END
|
|
END ELSE
|
|
IF OREC<IVD$ITEM.STATUS,I>[1,1]="C" THEN
|
|
CCNDX=1
|
|
CCBAD=1
|
|
END
|
|
END
|
|
CASE OREC<IVD$LINE.SHIPPED,I>=""
|
|
IF OREC<IVD$ITEM.STATUS,I>[1,1]="R" THEN
|
|
RELNDX=1
|
|
END ELSE
|
|
RELNDX=1
|
|
RELBAD=1
|
|
END
|
|
END CASE
|
|
NEXT I
|
|
IF OREC<IVD$BALANCE>#0 THEN PNDX=1
|
|
IF RELNDX+CCNDX+BONDX=0 THEN
|
|
IF OREC<IVD$STATUS>[1,1]#"H" THEN
|
|
OREC<IVD$STATUS>="H":OREC<IVD$STATUS>
|
|
END
|
|
END ELSE
|
|
IF RELNDX THEN WRITE RELBAD ON RX,ID
|
|
IF CCNDX THEN WRITE CCBAD ON CX,ID
|
|
IF BONDX THEN WRITE BOBAD ON BX,ID
|
|
IF PNDX THEN WRITE "" ON PX,ID
|
|
END
|
|
IF RELBAD+CCBAD+BOBAD=0 ELSE
|
|
NUM.BAD2=NUM.BAD2+1
|
|
END
|
|
END
|
|
WRITE OREC ON PMO,ID
|
|
NUM.DONE=NUM.DONE+1
|
|
END ELSE
|
|
NUM.BAD=NUM.BAD+1
|
|
WRITE OREC ON PMO.BAD,ID
|
|
END
|
|
END
|
|
RETURN
|
|
*
|
|
2000 *
|
|
CRT CS
|
|
CRT @(0,5):"NUMBER RECORDS READ: ":NUM.READ
|
|
CRT @(0,6):"NUMBER RECORDS DONE: ":NUM.DONE
|
|
CRT @(0,7):"NUMBER RECORDS BAD: ":NUM.BAD
|
|
CRT @(0,8):"NUMBER RECORDS BAD2 ":NUM.BAD2
|
|
RETURN
|