- ACHSTXX ; IHS/ITSC/PMF - EXPORT DATA (1/9) ; [ 10/16/2001 8:16 AM ]
- ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
- ;
- ; This is the lead program of the export process. You
- ;start here whether you are exporting or REexporting
- ;
- ;Depending on which function you selected, the var ACHSREEX
- ;will be set to:
- ; 0 exporting
- ; 1 reexporting by batch
- ; 2 reexporting selected POs
- ;
- ;
- ;set up some special things FOR TESTING ONLY
- ;D ^ACHSPMF
- S ACHSREEX=0
- ;
- ;INIT some vars
- ;DO a series of checks, any of which may cause us to STOP
- ;
- ;if we don't stop, then
- ; FOR each transaction in the time period
- ; if an export record is called for, then
- ; create it
- ; end for
- ; OPEN the unix file
- ; FOR each export record created
- ; send it to the unix file
- ; record it in the database
- ; endfor
- ; PRINT the export report
- ;
- ;
- ;
- D INIT
- ;do the checks
- ;FOR TEST
- ;D ^ACHSTXCK I STOP D END Q
- ;get the list to export. go different ways depending on REEX
- I ACHSREEX=1 D ^ACHSTX1R
- I ACHSREEX=2 D ^ACHSTX2R
- I 'ACHSREEX D ^ACHSTX11
- ;
- ;for testing only
- ;W !!,"back from tx11 " R PMF
- ;
- ;now that the transactions are created, bring them all into one
- ;global and send them.
- ;
- D END
- Q
- ;
- END ;
- ;we've come to the end of the job. maybe we completed the
- ;export, maybe we didn't. The value in tag STOP will tell
- ;us.
- ;
- ;if stop is true, do special stuff
- I STOP D STOP
- ;now do the stuff we do if stop is true or not
- ;
- X:$D(ACHSPCC) ACHSPPC
- U IO(0)
- ;
- ;for test
- ;I $$DIR^XBDIR("E","Press RETURN...")
- I '$$LOCK^ACHS("^ACHSF(DUZ(2),""D"")","-")
- K %DT,ACHSCRTN,DA,DFN,DIC,DIE,DOLRH,DR,DUOUT,DX,DY,LIST,NUM
- K OK,RET,ROUT,STOP,TNUM,VNDEINSX,W,X,X1,XBDT,XBF,XBGL,XBTIT,Y,Z
- D EN^XBVK("ACHS"),^%ZISC,^ACHSVAR
- ;
- ;for test
- D ^ACHSR1
- Q
- ;
- STOP ;
- I STOP=1 W !,"User terminated this function - no export performed"
- I STOP=2 W !,"Register not closed"
- I STOP=3 W !,"Authorizing facility number invalid"
- I STOP=4 W !,"No data for facility"
- I STOP=5 W !,"DHR record not 80 chars"
- ;
- W !,"Abnormal end of function"
- ;
- ;any abnormal end means no export happened. this line
- ;cleans out the record of it.
- I $G(DOLRH)'="" K ^ACHSXPRT(DOLRH)
- ;
- Q
- ;
- INIT ;
- D ^ACHSVAR
- D ^ACHSUF
- D LINES^ACHSFU
- ;
- S ACHSYAYA="" F S ACHSYAYA=$O(^ACHSXPRT(ACHSYAYA)) Q:ACHSYAYA="" K ^ACHSXPRT(ACHSYAYA)
- K ACHSYAYA
- ;
- S STOP=0
- S ACHSRCT=0,ACHSCRTN=""
- S ACHSF638=($$PARM^ACHS(0,8)="Y")
- S DOLRH=$TR($H,",","_")
- K DUOUT,DTOUT
- Q
- ACHSTXX ; IHS/ITSC/PMF - EXPORT DATA (1/9) ; [ 10/16/2001 8:16 AM ]
- +1 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
- +2 ;
- +3 ; This is the lead program of the export process. You
- +4 ;start here whether you are exporting or REexporting
- +5 ;
- +6 ;Depending on which function you selected, the var ACHSREEX
- +7 ;will be set to:
- +8 ; 0 exporting
- +9 ; 1 reexporting by batch
- +10 ; 2 reexporting selected POs
- +11 ;
- +12 ;
- +13 ;set up some special things FOR TESTING ONLY
- +14 ;D ^ACHSPMF
- +15 SET ACHSREEX=0
- +16 ;
- +17 ;INIT some vars
- +18 ;DO a series of checks, any of which may cause us to STOP
- +19 ;
- +20 ;if we don't stop, then
- +21 ; FOR each transaction in the time period
- +22 ; if an export record is called for, then
- +23 ; create it
- +24 ; end for
- +25 ; OPEN the unix file
- +26 ; FOR each export record created
- +27 ; send it to the unix file
- +28 ; record it in the database
- +29 ; endfor
- +30 ; PRINT the export report
- +31 ;
- +32 ;
- +33 ;
- +34 DO INIT
- +35 ;do the checks
- +36 ;FOR TEST
- +37 ;D ^ACHSTXCK I STOP D END Q
- +38 ;get the list to export. go different ways depending on REEX
- +39 IF ACHSREEX=1
- DO ^ACHSTX1R
- +40 IF ACHSREEX=2
- DO ^ACHSTX2R
- +41 IF 'ACHSREEX
- DO ^ACHSTX11
- +42 ;
- +43 ;for testing only
- +44 ;W !!,"back from tx11 " R PMF
- +45 ;
- +46 ;now that the transactions are created, bring them all into one
- +47 ;global and send them.
- +48 ;
- +49 DO END
- +50 QUIT
- +51 ;
- END ;
- +1 ;we've come to the end of the job. maybe we completed the
- +2 ;export, maybe we didn't. The value in tag STOP will tell
- +3 ;us.
- +4 ;
- +5 ;if stop is true, do special stuff
- +6 IF STOP
- DO STOP
- +7 ;now do the stuff we do if stop is true or not
- +8 ;
- +9 IF $DATA(ACHSPCC)
- XECUTE ACHSPPC
- +10 USE IO(0)
- +11 ;
- +12 ;for test
- +13 ;I $$DIR^XBDIR("E","Press RETURN...")
- +14 IF '$$LOCK^ACHS("^ACHSF(DUZ(2),""D"")","-")
- +15 KILL %DT,ACHSCRTN,DA,DFN,DIC,DIE,DOLRH,DR,DUOUT,DX,DY,LIST,NUM
- +16 KILL OK,RET,ROUT,STOP,TNUM,VNDEINSX,W,X,X1,XBDT,XBF,XBGL,XBTIT,Y,Z
- +17 DO EN^XBVK("ACHS")
- DO ^%ZISC
- DO ^ACHSVAR
- +18 ;
- +19 ;for test
- +20 DO ^ACHSR1
- +21 QUIT
- +22 ;
- STOP ;
- +1 IF STOP=1
- WRITE !,"User terminated this function - no export performed"
- +2 IF STOP=2
- WRITE !,"Register not closed"
- +3 IF STOP=3
- WRITE !,"Authorizing facility number invalid"
- +4 IF STOP=4
- WRITE !,"No data for facility"
- +5 IF STOP=5
- WRITE !,"DHR record not 80 chars"
- +6 ;
- +7 WRITE !,"Abnormal end of function"
- +8 ;
- +9 ;any abnormal end means no export happened. this line
- +10 ;cleans out the record of it.
- +11 IF $GET(DOLRH)'=""
- KILL ^ACHSXPRT(DOLRH)
- +12 ;
- +13 QUIT
- +14 ;
- INIT ;
- +1 DO ^ACHSVAR
- +2 DO ^ACHSUF
- +3 DO LINES^ACHSFU
- +4 ;
- +5 SET ACHSYAYA=""
- FOR
- SET ACHSYAYA=$ORDER(^ACHSXPRT(ACHSYAYA))
- IF ACHSYAYA=""
- QUIT
- KILL ^ACHSXPRT(ACHSYAYA)
- +6 KILL ACHSYAYA
- +7 ;
- +8 SET STOP=0
- +9 SET ACHSRCT=0
- SET ACHSCRTN=""
- +10 SET ACHSF638=($$PARM^ACHS(0,8)="Y")
- +11 SET DOLRH=$TRANSLATE($HOROLOG,",","_")
- +12 KILL DUOUT,DTOUT
- +13 QUIT