Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ACHSWDCS

ACHSWDCS.m

Go to the documentation of this file.
ACHSWDCS ;IHS/OIT/FCJ-DCIS RECORD FOR EXPORT W/WEB FRS DATA;JUN 20, 2008 ; 17 Jul 2008  3:05 PM
  ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**14,15,16**;JUN 11,2001
  ;NEW ROUTINE FOR PATCH 14
  ;ACHS*3.1*15 2.11.2009 IHS/OIT/FCJ ADDED TEST FOR UNDEF REQ DCIS FIELDS
  ;ACHS*3.1*16 11.3.2009 IHS.OIT.FCJ TEST FOR BLANKET PO'S
  ;;
DCIS ;EP; RECORD FOR DCIS
REC ;Record Type: Contract type PDO - 1, PDO>25K - 2, PDO<=25K - 3
 S (ACHSRTYP,ACHSCTYP,ACHSCDFN,ACHSVC,ACHSVCL,X)=""
 ;Test for PDO-task order and contract vendor DOS falls in the contract dates set to 1
 ;ACHS*3.1*16 11.3.2009 IHS.OIT.FCJ ADDED NXT LINE FOR BLANKETS AND CHANGED 2ND LINE TO E
 I $P(^ACHSF(ACHSFAC,"D",ACHSDIEN,0),U,3)=1 S ACHSCTYP="B"
 E  S X=$P(^ACHSF(ACHSFAC,"D",ACHSDIEN,2),U,9) I X?1N.N S ACHSCTYP=$P($G(^ACHSCTYP(X,0)),U,2)
 S ACHSTST=0,ACHSCNU=""
 S:ACHSCTYP="T" ACHSRTYP=1
 I ACHSCTYP="T",$D(^AUTTVNDR(ACHSVDFN,"CN",0)) D
 .;Test PO for contract vendor
 .S ACHSCDFN=$P(^ACHSF(ACHSFAC,"D",ACHSDIEN,0),U,5)
 .I ACHSCDFN D CTST Q:ACHSTST
 .;
 .;If not in PO test vendor for valid contract
 .S ACHSCDFN=0
 .F  S ACHSCDFN=$O(^AUTTVNDR(ACHSVDFN,"CN",ACHSCDFN)) Q:ACHSCDFN'?1N.N  D CTST Q:ACHSTST
 I 'ACHSTST S ACHSCNU="",ACHSRTYP=""
 ;
 ;f not a contract type PDO and PDO>25K type=2 or PDO<=25k type=3
 I 'ACHSRTYP S ACHSRTYP=$S($P(^ACHSF(ACHSFAC,"D",ACHSDIEN,"PA"),U)>25000:2,1:3)
 ;
PIID ;PIID
 S ACHSPIID=""
 S ACHSPIID="HHSI"_$P(^ACHSF(ACHSFAC,0),U,11)_ACHSDFY_ACHSFC_ACHSDOC1_ACHSCTYP
 S ACHSREC="^"_ACHSRTYP_"^"_ACHSPIID_"^^"_ACHSCNU
 ;
 ;E-SIG DATE For Date Signed and for Effective Date
 S Y=$P(^ACHSF(ACHSFAC,"D",ACHSDIEN,0),U,28)
 S:Y?1N.N Y=$E(Y,1,3)+1700_$E(Y,4,7)
 S ACHSREC=ACHSREC_"^"_Y_"^"_Y
 S:'Y (ACHSERR(1),ACHSERR(2))=1  ;ACHS*3.1*15 2.11.2009 IHS/OIT/FCJ ERROR TEST
 ;
 ;Completion Date-AUTH END DATE
 S Y=$P(^ACHSF(ACHSFAC,"D",ACHSDIEN,"PA"),U,3)
 S:Y?1N.N Y=$E(Y,1,3)+1700_$E(Y,4,7)
 S ACHSREC=ACHSREC_"^"_Y
 S:'Y ACHSERR(3)=1  ;ACHS*3.1*15 2.11.2009 IHS/OIT/FCJ ERROR TEST
 ;
 ;Ultimate Completion Date-AUTH END DATE
 I ACHSRTYP=3 S ACHSREC=ACHSREC_"^"
 E  S ACHSREC=ACHSREC_"^"_Y S:'Y ACHSERR(4)=1 ;ACHS*3.1*15 2.11.2009 IHS/OIT/FCJ ERROR TEST
 ;
 ;Base Value Option <25K leave blank otherwise use TOT OBL
 S X=""
 I ACHSRTYP'=3 S X=$FNUMBER($P(^ACHSF(ACHSFAC,"D",ACHSDIEN,0),U,9),"",2)
 S ACHSREC=ACHSREC_"^"_X
 ;
 ;Base Value Use TOT OBL
 S X=""
 S X=$FNUMBER($P(^ACHSF(ACHSFAC,"D",ACHSDIEN,0),U,9),"",2)
 S ACHSREC=ACHSREC_"^"_X
 ;
 ;Area Contract number
 S X=""
 S X=$P(^ACHSF(ACHSFAC,0),U,11)
 S ACHSREC=ACHSREC_"^"_X
 ;
CNTRC ;Type of Contract ***************MEDICARE QUESTIONS, DO WE NEED A CHECK FOR VALID DATES***********
 S X=""
 I (ACHSRTYP=1)!(ACHSRTYP=2) S X=$S($P($G(^AUTTVNDR(ACHSVDFN,23)),U)="Y":"J",1:"S")
 S ACHSREC=ACHSREC_"^"_X
 ;
 ;Multi Year Contract
 S X=""
 I ACHSRTYP=2 S X=$S(ACHSCTYP="P":"N",1:"Y")
 I ACHSRTYP=1,ACHSCNU S X=$S(ACHSVCL>365:"Y",1:"N")
 S ACHSREC=ACHSREC_"^"_X
 ;
PSC ;Product or Service code
 S X=""
 I ACHSRTYP'=3 S X=$S(ACHSTOS=2:"Q503",1:"Q201")
 S ACHSREC=ACHSREC_"^"_X
 ;
 ;NAICS Code
 S X=""
 I ACHSRTYP=2,$P(^ACHS(3,ACHSFAC,1,ACHSOBJ,0),U,6) S X=$P(^ACHS(3.1,$P(^ACHS(3,ACHSFAC,1,ACHSOBJ,0),U,6),0),U)
 S ACHSREC=ACHSREC_"^"_X
 ;
DUNS ;DUNS Number
 S X=""
 ;ACHS*3.1*15 2.11.2009 IHS/OIT/FCJ DUNS WILL BE SENT FOR ALL RECORD TYPES, ALSO ADDED ERROR TST
 ;I 'ACHSRTYP S X=$P(^AUTTVNDR(ACHSDFN,0),U,7)
 S X=$P(^AUTTVNDR(ACHSVDFN,0),U,7) S:X="" ACHSERR(6)=1
 S ACHSREC=ACHSREC_"^"_X
 ;
 ;Country of Orgin
 S X=""
 I ACHSRTYP=2 D
 .S (X,X1)=""
 .S X=$P($G(^AUTTVNDR(ACHSVDFN,24)),U)
 .I X S X1=$P(^HL(779.004,X,0),U) S:X1="USA" X1="US"
 .S X=$S(X1="US":X1,X1="CA":X1,X1="MX":X1,1:"")
 S ACHSREC=ACHSREC_"^"_X
 ;ACHS*3.1*15 2.11.2009 IHS/OIT/FCJ ADDED NXT LINE FOR PLACE OF PERF ERROR TEST
 S:(X="CA")!(X="MX") ACHSERR(7)=""
 ;
 ;Business Size
 S X=""
 I ACHSRTYP'=1 D
 .S Y=$P($G(^AUTTVNDR(ACHSVDFN,11)),U,26) S:Y'="" Y=$P(^AUTTVNDR(ACHSVDFN,11),U,22)
 .S X=$S(Y=1:"S",Y=2:"O",1:"")
 .I X="" S ACHSERR(9)=1 ;ACHS*3.1*15 2.11.2009 IHS/OIT/FCJ ADDED TEST FOR BUS SZ
 S ACHSREC=ACHSREC_"^"_X
 ;
 ;Final Pay- Only sending Final pays
 S ACHSREC=ACHSREC_"^Y"
 ;
 D CHK^ACHSWDR  ;ACHS*3.1*15 2.11.2009 IHS/OIT/FCJ TEST FOR ERRORS
 ;
 Q
CTST ;Test for valid contract with DOS
 S ACHSVC=^AUTTVNDR(ACHSVDFN,"CN",ACHSCDFN,0)
 S ACHSCNU=$P(ACHSVC,U),(X2,ACHSBDT)=$P(ACHSVC,U,2),(X1,ACHSEDT)=$P(ACHSVC,U,3)
 D ^%DTC S ACHSVCL=X
 S ACHSEDT=ACHSEDT+1
 I ACHSDOS=ACHSBDT S ACHSTST=1 Q
 I ACHSDOS>ACHSBDT,ACHSDOS<ACHSEDT S ACHSTST=1
 Q