SUBROUTINE CMSD.PICKING.SUB.BUILD(PREC,IREC,BO.ARRAY,REL.ARRAY,PRT.ARRAY,MISC.ARRAY,MPRT.ARRAY,TOTAL.ORDER,AUTH.ARRAY,CURRENT.RUN,REPRINT.FLAG) *-------------------------------------------------------------------- *PGM NAME: CMSD.PICKING.BUILD.WORKFILE *PURPOSE: GENERIC OUTPUT SUBROUTINE FOR REL8 PICKING SLIPS & LABELS. *AUTHOR: AL SURLES *CREATED: 06-14-94 *UPDATES: * * ABS 07-24-95 : Modified pgm to multivalued PML$SHIP.MODE . * value1=DESCRIPTION ; value2=CODE * *-------------------------------------------------------------------- $INCLUDE GEN.COMMON $INCLUDE PM $INCLUDE CMSD.IVD $INCLUDE INV $INCLUDE PM.LABELS * 100 *---define variables and build output arrays PML.REC='' PK.FLAG=0 ; SPECIAL.SHIP.FLAG=0 PML.REC=IREC TODAY=OCONV(DATE(),'D2/') ORDER=IREC PML.REC=IREC PML.REC=IREC PML.REC=ICONV(TODAY,"D") ; RUN.NUMBER=OCONV(CURRENT.RUN,"G1*1") PML.KEY=ORDER:"*":RUN.NUMBER PML.REC=IREC * XX=1 IF IREC#'' THEN PML.REC=IREC XX=XX+1 IF IREC#'' THEN PML.REC=IREC XX=XX+1 END IF IREC#'' THEN PML.REC=IREC XX=XX+1 END IF IREC # '' THEN PML.REC=IREC XX=XX+1 END IF IREC='00000' THEN IREC='' CITY=TRIM(IREC) STATE=TRIM(IREC) ZIP=TRIM(IREC) PML.REC=CITY:" ":STATE:" ":ZIP PML.REC=TRIM(IREC) END ELSE READ PM.REC FROM PM,IREC ELSE PM.REC='' XX=1 PML.REC=TRIM(PM.REC:" ":PM.REC) XX=XX+1 IF PM.REC#'' THEN IF PM.REC#'' THEN PML.REC=TRIM(PM.REC) XX=XX+1 END IF PM.REC#'' THEN PML.REC=TRIM(PM.REC) XX=XX+1 END IF PM.REC#'' THEN PML.REC=TRIM(PM.REC) XX=XX+1 END END ELSE; * IF THERE IS AN ADDRESS 3 - TWH added lines 82 - 95 IF PM.REC#'' THEN PML.REC=TRIM(PM.REC) XX=XX+1 END IF PM.REC#'' THEN PML.REC=TRIM(PM.REC) XX=XX+1 END CITY=TRIM(PM.REC) STATE=TRIM(PM.REC) IF PM.REC="00000" THEN PM.REC='' ZIP=TRIM(PM.REC) PML.REC=CITY:" ":STATE:" ":ZIP XX=XX+1 PML.REC=TRIM(PM.REC) END END * IF IREC#'' THEN XX=34 IF IREC#'' THEN PML.REC=IREC XX=XX+1 END IF IREC # '' THEN PML.REC=IREC XX=XX+1 END IF IREC # '' THEN PML.REC=IREC XX=XX+1 END IF IREC # '' THEN PML.REC=IREC XX=XX+1 END IF IREC='00000' THEN IREC='' CITY=TRIM(IREC) STATE=TRIM(IREC) ZIP=TRIM(IREC) PML.REC=CITY:" ":STATE:" ":ZIP XX=XX+1 PML.REC=ZIP END * IF PML.REC LT "00001" OR PML.REC GT "99999" THEN SPECIAL.SHIP.FLAG=1 PML.REC="G0" END * READ CODE FROM GEN.KEYS,"PAYMENT.TERMS" THEN LOCATE(IREC,CODE,1;WH) THEN PML.REC=CODE<2,WH> END ELSE PML.REC='UNKNOWN' END END * READ CODE FROM GEN.KEYS,"SHIP.MODES" THEN LOCATE(IREC,CODE,1;WH) THEN PML.REC=CODE<2,WH>:VM:IREC IF CODE<3,WH>="10" THEN SPECIAL.SHIP.FLAG=1 PML.REC="G0" END END ELSE PML.REC='UNKNOWN' END END * 200 * TOTAL.ORDER=0 NEW.TOTAL.ORDER=0 BALANCE=IREC NEW.TOTAL.ORDER=IREC-IREC LOCATE("FUND",MISC.ARRAY,1;WH) THEN OPEN 'FUND.FILE' TO FUND.FILE ELSE ABORT END * MCT=DCOUNT(MISC.ARRAY,VM) FOR M=1 TO MCT MAMOUNT=MISC.ARRAY<3,M> TOTAL.ORDER=TOTAL.ORDER+MAMOUNT NEXT M * MCT=DCOUNT(BO.ARRAY,VM) FOR M=1 TO MCT MAMOUNT=BO.ARRAY<3,M> TOTAL.ORDER=TOTAL.ORDER-MAMOUNT NEXT M * ICT=DCOUNT(REL.ARRAY<1>,VM) FOR I=1 TO ICT TOTAL.ORDER=TOTAL.ORDER+REL.ARRAY<3,I>-REL.ARRAY<4,I>+REL.ARRAY<5,I> NEXT I *------* IF TOTAL.ORDER > BALANCE THEN TOTAL.ORDER = BALANCE IF TOTAL.ORDER < 0 THEN TOTAL.ORDER=0 *PML.REC=TOTAL.ORDER *------* IF NEW.TOTAL.ORDER > BALANCE THEN NEW.TOTAL.ORDER = BALANCE IF NEW.TOTAL.ORDER < 0 THEN NEW.TOTAL.ORDER=0 *PML.REC=NEW.TOTAL.ORDER IF IREC='CC' THEN IF NEW.TOTAL.ORDER > 0 THEN PML.REC=0 PML.REC='Y' END ELSE PML.REC=0 END END ELSE PML.REC=NEW.TOTAL.ORDER END *------* * SALES.TAX=0 TT=DCOUNT(REL.ARRAY<1>,VM) FOR I=1 TO TT PML.REC=REL.ARRAY<1,I> PML.REC=REL.ARRAY<2,I> READ INV.REC FROM INVENTORY,PML.REC ELSE INV.REC='' DESC=TRIM(INV.REC) PK.ANS=TRIM(INV.REC) PML.REC=DESC PML.REC=REL.ARRAY<3,I>-REL.ARRAY<4,I> SALES.TAX=SALES.TAX+REL.ARRAY<5,I> IF PK.ANS="Y" THEN IF NOT(SPECIAL.SHIP.FLAG) THEN PML.REC="G3" FOR CQ=1 TO TT IF REL.ARRAY<2,CQ> GT 1 THEN PML.REC="G4" CQ=999 END NEXT CQ END PK.FLAG=1 ; PK.ARRAY='' CI.CNT=DCOUNT(INV.REC,VM) FOR CI=1 TO CI.CNT CI.KEY=INV.REC CI.QTY=INV.REC LOCATE(CI.KEY,PK.ARRAY,1;CI.FND;'AL') THEN NULL READV CI.DESC FROM INVENTORY,CI.KEY,INV$DESCRIPTION ELSE CI.DESC='' CI.DESC=TRIM(CI.DESC) PK.ARRAY=INSERT(PK.ARRAY,1,CI.FND;CI.KEY) PML.REC=INSERT(PML.REC,PML$PK.QTY,I,CI.FND;CI.QTY) PML.REC=INSERT(PML.REC,PML$PK.ITEM,I,CI.FND;CI.KEY) PML.REC=INSERT(PML.REC,PML$PK.DESC,I,CI.FND;CI.DESC) NEXT CI END NEXT I * PML.REC=SALES.TAX * IF SPECIAL.SHIP.FLAG OR PK.FLAG THEN GO 250 * BEGIN CASE CASE TT=1 PML.REC="G1" IF PML.REC GT 1 THEN PML.REC="G2" CASE 1 PML.REC="G3" FOR CQ=1 TO TT IF PML.REC GT 1 THEN PML.REC="G4" CQ=999 END NEXT CQ END CASE * 250 * * PML.REC=MISC.ARRAY<1> PML.REC=MISC.ARRAY<2> PML.REC=MISC.ARRAY<3> PML.REC=MISC.ARRAY<4> PML.REC=MISC.ARRAY<5> * BCT=DCOUNT(BO.ARRAY,VM) FOR B=1 TO BCT IF BO.ARRAY<1,B>='' AND BO.ARRAY<2,B>='' ELSE PML.REC=BO.ARRAY<1,B> PML.REC=BO.ARRAY<2,B> READV DESC FROM INVENTORY,PML.REC,INV$DESCRIPTION ELSE DESC='' PML.REC=TRIM(DESC) IF IREC='CC' THEN PML.REC='Y' ;* MTC 0595 END NEXT B * OCT=DCOUNT(IREC,VM) FOR O=1 TO OCT PML.REC=IREC NEXT O * IF PML.REC # "" THEN WRITE PML.REC ON PM.LABELS,PML.KEY * RETURN *