VistA-WorldVistAEHR/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCHMOLS.m

46 lines
2.2 KiB
Mathematica

PRCHMOLS ;WISC/RWS-TRANSMIT OLS TRANS TO MAILMAN ;8-20-92/11:01
V ;;5.1;IFCAP;;Oct 20, 2000
;Per VHA Directive 10-93-142, this routine should not be modified.
;
READ N A,B,DA,MO,YR,I,J,K,PRCHPO,X,XMB,XMSUB,XMDUN,XMDUZ,XMZ,Y,Z S TRANSIN="^PRCF(423.6,"_PRCDA_",0)",TRNSDA=PRCDA,X=@TRANSIN,TYP=$E(X,1,3),LIN=0,TRANSIN=$Q(@TRANSIN)
S MONS="Jan^Feb^Mar^Apr^May^Jun^Jul^Aug^Sep^Oct^Nov^Dec"
S DAYS="31^28^31^30^31^30^31^31^30^31^30^31"
S XMSUB="ISMS to IFCAP "_TYP_" transaction"
S XMDUZ="IFCAP MESSAGE SERVER"
F TRY=1:1:5 D GET^XMA2 I TRY<5 Q:XMZ>0
I TRY=5,XMZ<1 S ERR=" UNABLE TO GET MAILMAN NUMBER AFTER 5 TRIES." G ERROR
I TYP'="OLS" S ERR="INVALID TRANSACTION TYPE" G ERROR
;
SYSID ; READ SYSID SEGMENT
S X=$Q(@TRANSIN),SYSEG=@X I $P(SYSEG,U,4)'="OLS" S ERR="WRONG TRANSACTION TYPE" G ERROR
S X=$Q(@X),SEG=@X I $P(SEG,U)'="LC" S ERR="LC SEGMENT ERROR" Q
S IFNO=$P(SEG,U,3),IFNO=$E(IFNO,1,3)_"-"_$E(IFNO,4,99),LCNT=$P(SEG,U,2) D CHK
S ^XMB(3.9,XMZ,2,1,0)=" Line Status Transaction (OLS)"
S ^XMB(3.9,XMZ,2,2,0)=""
S ^XMB(3.9,XMZ,2,3,0)=" The following items were Allocated/Backordered/Cancelled"
S LIN=4,^XMB(3.9,XMZ,2,LIN,0)=" from IFCAP Requisition Number "_IFNO
I $D(NOTFOUND) S LIN=LIN+1,^XMB(3.9,XMZ,2,LIN,0)="**** THIS REQUISITION WAS NOT FOUND IN THE FILE ***" K NOTFOUND
S LIN=LIN+1,^XMB(3.9,XMZ,2,5,0)=""
S LIN=LIN+1,^XMB(3.9,XMZ,2,LIN,0)="Line F/K Subs Stat RsnCode Qty SKU Stock Number Comments/Reason Codes "
S BLANKS=$J(" ",57) D LOOKUP^PRCHMOL1
;
SEND ;SEND MAILMAN MESSAGE
I $G(ERR)'="" S LIN=$G(LIN)+1,^XMB(3.9,XMZ,2,LIN,0)=ERR
S:LIN>0 ^XMB(3.9,XMZ,2,0)="^3.92A^"_LIN_U_LIN_U_DT,XMDUN="IFCAP SERVER",X="G.OGR AUSTIN MESSAGES"
D WHO^XMA21 S:'$L($O(XMY(""))) XMY(.5)="" S:$G(PPM)]"" XMY(PPM)=""
D ENT1^XMD K XMY
;
EXIT ;CLEAN UP AND QUIT
I '$D(ERR) S DIK="^PRCF(423.6,",DA=TRNSDA D ^DIK K DIK,DA ; DELETE TRANS FROM TEMP FILE
K BLANKS,DATA,DAYS,DESEG,ERR,FLDIN,FLDOUT,IFNO,JDN,JDF,LCNT,LIN2,LIN,LN,MONS
K NODLS,NODSC,NSN,PAIR,PPM,RESEG,SEG,SEGTYP,SYSEG,TRANSIN,TRNSDA,TRY,TYP
S ZTREQ="@"
Q
;
ERROR S ZTDTH="1H" D REQ^%ZTLOAD
Q
;
CHK ;CHECK IFCAP PURCHASE ORDER NUMBER
S DA=$O(^PRC(442,"B",IFNO,0)) I DA="" S NOTFOUND=""
Q