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

BARUFCAS.m

Go to the documentation of this file.
BARUFCAS ; IHS/SD/TPF - CASHIERING FUNCTIONS FOR UFMS ;04/09/2008
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**3,4,23**;OCT 26, 2005
 Q
 ;
VIEW ;EP - VIEW UFMS SESSIONS
 D INIT
 D SHOW("")  ;SHOW SESSIONS
 Q
 ;
VIEWHDR(STATUS) ;EP - HEADER FOR VIEWING SESSIONS
 W !?6,"SESSION ID",?20,"CASHIER"
 W ?36,"DATE "_$S(STATUS="ALL STATUSES":"STATUS CHANGED",STATUS="OPEN":"OPENED",1:STATUS)
 W ?62,$S(STATUS="ALL STATUSES":"STATUS",1:""),?73,"ERA\PST"
 W !,DASH
 Q
 ;
ALLSTAT(LIST,STATUS) ;EP - CHANGE THE STATUS OF ALL THE SESSIONS IN ARRAY 'LIST' TO STATUS
 N UDUZ,SESSID,RC,ERASTAT,POSTING
 ;
 I STATUS="RT"!(STATUS="T") S UDUZ="" D TRANSMIT^BARUFUT(UDUZ,.LIST,STATUS) Q  ;IF 'T' OR 'RT' THEN TRANSMIT
 ;
 S REC=""
 F  S REC=$O(LIST(REC)) Q:'REC  D
 .S UDUZ=$P(LIST(REC),U)
 .S SESSID=$P(LIST(REC),U,2)
 .S ERASTAT=$P(LIST(REC),U,3)
 .I '$O(^BARSESS(DUZ(2),UDUZ,11,SESSID,2,0)) D  Q
 ..W !!,"CANNOT RECONCILE SESSION ",SESSID
 ..W !,"THE SESSION HAS NO POSTING ACTIVITY"
 ..D ASKFORRT^BARUFUT
 .I ERASTAT="YES" D  Q
 ..W !!,"CANNOT RECONCILE SESSION ",SESSID
 ..W !,"THE CASHIER IS ERA POSTING"
 ..D ASKFORRT^BARUFUT
 .;
 .S POSTING=$$STILPOST^BARUFUT1(UDUZ)
 .I +POSTING=1 D  Q  ;IS THE USER STILL LOGGED ON OR POSTING?
 ..W !!,"CANNOT RECONCILE SESSION ",SESSID
 ..W !,"THE CASHIER IS ",$P(POSTING,U,2)
 ..D ASKFORRT^BARUFUT
 .I +POSTING=2 D  Q:'$G(Y)!($D(DTOUT))!($D(DUOUT))
 ..W !!,"RECONCILING SESSION ",SESSID
 ..W !,"THE CASHIER IS ",$P(POSTING,U,2)
 ..K DIR
 ..S DIR(0)="Y"
 ..S DIR("B")="Y"
 ..S DIR("A")="Continue Anyway?"
 ..D ^DIR
 .S RC=$$SETSESS^BARUFUT(UDUZ,SESSID,STATUS)
 Q
 ;
RESEND ;EP - RESEND A FILE
 D RESENDF^BARUFUT1()
 Q
 ;
INIT ;EP - INIT COMMON VARIABLES
 S $P(DASH,"-",81)=""
 Q
 ;
SHOW(STATUS) ;EP - GENERIC SESSION LISTER
AGAIN ;EP - 
 D ^BARBAN
 S:$G(STATUS)="" STATUS="OPEN"
 W !!,"UFMS DISPLAY DATE LIMIT: ",$S($$GETDISLM^BARUFUT1("E")'="":$$GETDISLM^BARUFUT1("E"),1:"NONE SET")
 W "  ("_$$GET1^DIQ(90052.06,DUZ(2)_",",1504,"I")_")"
 W !!,"The following SESSIONS are currently ",STATUS," =>"
 D VIEWHDR(STATUS)
 I STATUS'="ALL STATUSES",('$D(^BARSESS(DUZ(2),"C",STATUS))) D  G ASKSTAT
 .W !!!,"THERE ARE NO "_STATUS_" CASHIER SESSIONS"
 .D ASKFORRT^BARUFUT
 I '$D(^BARSESS(DUZ(2),"C")),(STATUS="ALL STATUSES") D  G ASKSTAT
 .W !!!,"THERE ARE NO CASHIER SESSIONS WITH A STATUS"
 .D ASKFORRT^BARUFUT
 S UDUZ=DUZ
 K LIST
 I STATUS="ALL STATUSES" D  G ASK
 .S LINE=0
 .S TSTATUS=""
 .F  S TSTATUS=$O(^BARSESS(DUZ(2),"C",TSTATUS)) Q:TSTATUS=""  D
 ..D LOOP(UDUZ,TSTATUS,.LINE,.LIST,STATUS)
 S LINE=0
 D LOOP(UDUZ,STATUS,.LINE,.LIST,STATUS)
 ;
 I LINE=0 D  G ASKSTAT
 .W !!!,"THERE ARE NO "_STATUS_" CASHIER SESSIONS"
 ;
ASK ;EP - ASK FOR ACTION
 W !,$G(DASH)
 W !
 K DIR
 S (OPTIONST,VALIDCHK)=""
 S DIR("?")="Enter a session number"
 I STATUS'="ALL STATUSES",(STATUS="OPEN") D
 .S OPTIONST=" or RC/Reconcile all listed sessions"
 .S DIR("?")="Enter a session number or an action."
 S VALIDCHK="I CHOICE'?1""RC"".E"
 S VALIDCHK=VALIDCHK_",(CHOICE'?1""RC""1""@"".E),(STATUS'=""OPEN"")"
 S DIR("A")="Select Session Number to View"_OPTIONST
 S DIR("?")=DIR("?")_", or press return to choose a different status and/or Quit"
 S DIR(0)="FO"
 S DIR("?")=DIR("?")_" (Note: You can also choose a range from the displayed list. Separate the range from the Action by an @ sign e.g. RC@1,3,5,10-15 or RC@1-5,7,8,9"
 S DIR("A")=DIR("A")_" or Q/Quit"
 W !,"Press <RETURN> to change statuses being displayed or,"
 D ^DIR
 Q:($D(DTOUT))!($D(DUOUT))
 Q:(U_"Q"_U_"q"_U)[(U_Y_U)
 G ASKSTAT:Y=""
 I +Y=Y D  G AGAIN
 .S CHOICE=+Y
 .I '$D(LIST(CHOICE)) W !,"Invalid choice!" H 3 Q
 .S UDUZ=$P(LIST(CHOICE),U)
 .S SESSID=$P(LIST(CHOICE),U,2)
 .S ERASTAT=$P(LIST(CHOICE),U,3)
 .D DISPLAYT^BARUFLOG(UDUZ,SESSID,"CASHIER",ERASTAT)
 ;
 S CHOICE=$$UPC^BARUTL(Y)
 I CHOICE'="",(STATUS="ALL STATUSES") D  G AGAIN
 .W !,"INVALID CHOICE!" H 3
 I CHOICE'="",(STATUS'="ALL STATUSES") D  G AGAIN
 .X VALIDCHK I $T W !,"INVALID CHOICE!" H 3 Q
 .S RANGE=$P(CHOICE,"@",2)
 .S:RANGE'="" RANGE=$$RANGE^BARUFUT1(RANGE)
 .D:RANGE'="" EXCLLST^BARUFUT1(RANGE,.LIST)
 .S CHOICE=$P(CHOICE,"@")
 .D ALLSTAT(.LIST,CHOICE)  ;CHANGE ALL THE STATUSES WITHIN THE 'LIST' ARRAY
 ;
ASKSTAT ;EP - ASK STATUS TO VIEW
 N CNTS
 K STATCNTS
 ;D CNTSTATS^BARUFUT1(.STATCNTS)
 D CNTSTATS^BARUFUT1(.STATCNTS,DUZ)  ;BAR*1.8*4 IM26064
 K DIR
 S DIR("A")="View which session status"
 S DIR(0)="SO^O:OPEN" I $G(STATCNTS("OPEN"))'="" S DIR(0)=DIR(0)_"               ("_$G(STATCNTS("OPEN"))_")"
 S DIR(0)=DIR(0)_";RC:RECONCILED" I $G(STATCNTS("RECONCILED"))'="" S DIR(0)=DIR(0)_"         ("_$G(STATCNTS("RECONCILED"))_")"
 S DIR(0)=DIR(0)_";RV:REVIEWED/APPROVED" I $G(STATCNTS("REVIEWED/APPROVED"))'="" S DIR(0)=DIR(0)_"  ("_$G(STATCNTS("REVIEWED/APPROVED"))_")"
 S DIR(0)=DIR(0)_";T:TRANSMITTED" I $G(STATCNTS("TRANSMITTED"))'="" S DIR(0)=DIR(0)_"        ("_$G(STATCNTS("TRANSMITTED"))_")"
 S DIR(0)=DIR(0)_";RT:RETRANSMITTED" I $G(STATCNTS("RETRANSMITTED"))'="" S DIR(0)=DIR(0)_"      ("_$G(STATCNTS("RETRANSMITTED"))_")"
 S DIR(0)=DIR(0)_";ALL:ALL STATUSES" I $G(STATCNTS("ALL STATUSES"))'="" S DIR(0)=DIR(0)_"       ("_$G(STATCNTS("ALL STATUSES"))_")"
 S DIR(0)=DIR(0)_";Q:QUIT"
 K STATCNTS
 D ^DIR
 G:Y="" AGAIN
 I $D(DIRUT)!($D(DTOUT))!($D(DIRUT))!(Y="Q") Q
 I Y(0)'[("ALL") S STATUS=$P(Y(0)," ")
 E  S STATUS=$P(Y(0)," ",1,2)
 G AGAIN
 Q
 ;
LOOP(UDUZ,STAT,LINE,LIST,PRTSTAT) ;EP - GET DATA FROM SESSION LEVEL
 N SESSID,CNT,ERASTAT,RTCOUNT,CURSTAT
 S SESSID=$$GETDISLM^BARUFUT1("I")-.01
 F CNT=1:1 S SESSID=$O(^BARSESS(DUZ(2),"C",STAT,UDUZ,SESSID)) Q:SESSID=""  D
 .S LINE=LINE+1
 .S IENS=SESSID_","_UDUZ_","
 .S CURSTAT=$$GET1^DIQ(90057.11,IENS,.02,"E")
 .S STATDATE=$$GET1^DIQ(90057.11,IENS,.03,"E")
 .S ERASTAT=$E($$GET1^DIQ(90057.11,IENS,.04,"E"))
 .S POSTING=$$STILPOST^BARUFUT1(UDUZ)
 .S Y=STATDATE X ^DD("DD") S STATDATE=Y
 .S CASHIER=$P($G(^VA(200,UDUZ,0)),U)
 .I STAT="RETRANSMITTED" S RTCOUNT=$$RTCOUNT^BARUFUT1(UDUZ,SESSID)
 .S LIST(LINE)=UDUZ_U_SESSID_U_ERASTAT
 .I $P(SESSID,".")=$$GETDISLM^BARUFUT1("I"),(CURSTAT="OPEN") D EN^XBVIDEO("RVN")
 .W !,LINE,"."
 .W ?3,SESSID,?20,$E(CASHIER,1,15),?36,STATDATE
 .D EN^XBVIDEO("RVF")
 .W:STAT="RETRANSMITTED" "(",RTCOUNT,")"
 .W ?58,$S(PRTSTAT="ALL STATUSES":$E(STAT,1,14),1:""),?72,$S(+POSTING&(STAT="OPEN"):"*",1:""),?75,ERASTAT,?76,"\",?77,$S(+POSTING=1&(CURSTAT="OPEN"):"Y",1:"")
 Q