source: FOIAVistA/tag/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCHMSHA.m@ 1806

Last change on this file since 1806 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.6 KB
Line 
1PRCHMSHA ;WISC/RWS-TRANSMIT SHA TRANS TO MAILMAN ;1/26/98 1130
2V ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5READ N DA,MO,YR,I,J,K,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)
6 S MONS="Jan^Feb^Mar^Apr^May^Jun^Jul^Aug^Sep^Oct^Nov^Dec"
7 S DAYS="31^28^31^30^31^30^31^31^30^31^30^31"
8 S XMSUB="ISMS to IFCAP "_TYP_" transaction"
9 S XMDUZ="IFCAP MESSAGE SERVER"
10 F TRY=1:1:5 D GET^XMA2 I TRY<5 Q:XMZ>0
11 I TRY=5,XMZ<1 S ERR=" UNABLE TO GET MAILMAN NUMBER AFTER 5 TRIES." G ERROR
12 I TYP'="SHA" S ERR="INVALID TRANSACTION TYPE" G ERROR
13 ;
14SYSID ; READ SYSID SEGMENT
15 S X=$Q(@TRANSIN),SYSEG=@X I $P(SYSEG,U,4)'="SHA" S ERR="WRONG TRANSACTION TYPE" G ERROR
16 S X=$Q(@X),SEG=@X I $P(SEG,U)'="SH" S ERR="SH SEGMENT ERROR" Q
17 S IFNO=$P(SEG,U,4),IFNO=$E(IFNO,1,3)_"-"_$E(IFNO,4,99),SHIPDATE=$P(SEG,U,8),DELDATE=$P(SEG,U,9),CARRIER=$P(SEG,U,7),GBLNO=$P(SEG,U,10)_"-"_$P(SEG,U,11),LCNT=$P(SEG,U,12)
18 D JDN(.SHIPDATE),JDN(.DELDATE)
19 S ^XMB(3.9,XMZ,2,1,0)=" SHIPPING ACKNOWLEDGEMENT"
20 S ^XMB(3.9,XMZ,2,2,0)=""
21 S ^XMB(3.9,XMZ,2,3,0)=" Items from IFCAP Purchase Order # "_IFNO_" were shipped on "_SHIPDATE
22 S ^XMB(3.9,XMZ,2,4,0)="Via "_CARRIER_". The estimated delivery date is "_DELDATE
23 S ^XMB(3.9,XMZ,2,5,0)="on Government Bill of Lading number "_GBLNO_"."
24 S ^XMB(3.9,XMZ,2,6,0)=" IFCAP Line # - Quantity - SKU - Stock Number "
25 ;
26CHK ;CHECK IFCAP PURCHASE ORDER NUMBER
27 S DA=$O(^PRC(442,"B",IFNO,0)) I DA="" S ERR="PO NUMBER NOT FOUND"
28 S LIN=6 F I=1:1:LCNT S X=$Q(@X),SEG=@X,SEGTYP=$E(SEG,1,2) G:SEGTYP'="SP" SPERR D
29 .S NSN=$P(SEG,U,2),NSN=$E(NSN,1,4)_"-"_$E(NSN,5,6)_"-"_$E(NSN,7,9)_"-"_$E(NSN,10,20)
30 .S LIN=LIN+1,^XMB(3.9,XMZ,2,LIN,0)=$J($P(SEG,U,5),10)_$J($P(SEG,U,3)/100,20)_" "_$P(SEG,U,4)_" "_NSN
31 ;
32SEND ;SEND MAILMAN MESSAGE
33 I $G(ERR)'="" S LIN=$G(LIN)+1,^XMB(3.9,XMZ,2,LIN,0)=ERR
34 S:LIN>0 ^XMB(3.9,XMZ,2,0)="^3.92A^"_LIN_U_LIN_U_DT,XMDUN="IFCAP SERVER",X="G.OGR AUSTIN MESSAGES"
35 D WHO^XMA21 S:'$L($O(XMY(""))) XMY(.5)="" S:$G(PPM)]"" XMY(PPM)=""
36 D ENT1^XMD K XMY
37 ;
38EXIT ;CLEAN UP AND QUIT
39 I '$D(ERR) S DIK="^PRCF(423.6,",DA=TRNSDA D ^DIK K DIK,DA ; DELETE TRANS FROM TEMP FILE
40 K DATA,DESEG,ERR,FLDIN,FLDOUT,IFNO,LIN,NODLS,NODSC,PAIR,SEG,SEGTYP,SYSEG,TRANSIN,TRNSDA,TRY,TYP S ZTREQ="@"
41 Q
42JDN(JDN) ; CHANGE JULIAN DATE (JDN) TO DA-MON-YEAR (JDF)
43 S YR=$E(JDN,1,4),DA=$E(JDN,5,7)
44 S $P(DAYS,U,2)=$S(YR#400=0:29,(YR#4=0&(YR#100'=0)):29,1:28)
45 F MO=1:1 S DA=DA-$P(DAYS,U,MO) Q:DA'>0
46 S DA=DA+$P(DAYS,U,MO),JDN=DA_" "_$P(MONS,U,MO)_" "_YR
47 Q
48 ;
49ERROR S ZTDTH="1H" D REQ^%ZTLOAD Q
50 ;
51SPERR S ERR="SHIPPING LINE ERROR" Q
Note: See TracBrowser for help on using the repository browser.