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

BARRQ1.m

Go to the documentation of this file.
BARRQ1 ; IHS/SD/TPF - RE-QUEU A/R TRANSACTIONS SEARCH UTILITIES
 ;;1.8;IHS ACCOUNTS RECEIVABLE;*22,23**;OCT 26, 2005
 ;OCT 2012 P.OTT ADDED REVERSE SEARCH
 Q
 ;
OPENSESS(REJECT,ESC) ;EP - ENTER NEW OPEN SESSION FOR RE-QUEUING
ASKSESS ;EP -
 ;AUTO CREATE NEW OPEN SESSION FOR CASHIER CHOSEN
 ;DO NOT ALLOW ADDING AN OPEN ONE FOR THE CURRENT DUZ
 ;OR FOR SOMEONE WITHOUT ACCESS TO AR MENU
 S (NEWDUZ,NEWSESS,NEWUSRNM)=""
 S REJECT=0
 K DIC,DIR,DIE,DA,DR
 S DIC("A")="OPEN A NEW CASHIERING SESSION FOR REQUEUING: "
 S DIC="^BARSESS("_DUZ(2)_","
 S DIC(0)="AEQML"
 ;S DIC("S")="I ^(0)'=DUZ"
 D ^DIC
 I Y<0 S ESC=X Q
 ;I +Y=DUZ!('$D(^XUSEC("BARZMENU",+Y))) D  Q
 ;.S REJECT=1
 ;.K DIC,DIR,DIE,DA,DR
 ;.S DIE="^BARSESS(DUZ(2),"
 ;.S DA=+Y
 ;.S DR=".01////@"
 ;.D ^DIE
 ;.W !!,"CAN NOT OPEN A SESSION FOR YOURSELF OR USER WITHOUT BAR ACCESS!!" H 2
 S NEWDUZ=+Y
 K DIC,DIE,DR,DA,DIR
 D NOW^%DTC
 S SESSID=%
 S DA(1)=NEWDUZ
 S X=SESSID
 S DIC(0)="L"
 S DIC("P")=$P(^DD(90057,1101,0),U,2)
 S DIC="^BARSESS(DUZ(2),"_DA(1)_",11,"
 D ^DIC
 I Y<0 W !!,"SESSION COULD NOT BE CREATED!!" H 2 G ASKSESS
 S NEWSESS=+Y
 S X=$$SETSESS^BARUFUT(NEWDUZ,$P(Y,U,2),"O")  ;SET OPEN STATUS
 I X=0 W !!,"STATUS COULD NOT BE SET!!" H 2 G ASKSESS
 S NEWUSRNM=$P($G(^VA(200,NEWDUZ,0)),U)
 W !!!,"A NEW SESSION HAS BEEN OPENED FOR "_NEWUSRNM_" TO BE USED FOR RE-QUEUING"
 W !!,"SESSION: ",NEWSESS,?30,"STATUS: ",$$CURSTAT^BARUFUT(NEWDUZ,NEWSESS,"E")
 W !
 K DIR
 S DIR(0)="E"
 D ^DIR
 Q
 ;
FNSEARCH(FN) ;EP - SEARCH FOR FILENAME IN NODE 6 OF BARTR
 ;SCENARIO: TX HAS A FILNAME IN NODE 6 BUT SITE AND HUB CLAIM THIS FILE IS
 ;          NOT TO BE FOUND IN LOCAL DIRECTORY AND NOT FOUND AT HUB.
 ;          IF FILE NOT AT HUB BUT IS IN LOCAL DIR JUST FTP FILE
 N FILENAME,TXCNT
 S TXCNT=0
 K DIR
 S DIR(0)="FO^3:80"
 S DIR("A")="ENTER FILENAME TO SEARCH FOR IN A/R TRANSACTION FILE"
 S DIR("?")=5
 S DIR("?",1)="USE THIS SEARCH OPTION TO FIND TX THAT APPARENTLY WERE SENT IN A FILE"
 S DIR("?",2)="BUT THE SITE AND HUB CLAIM THE FILE IS NO WHERE TO BE FOUND"
 D ^DIR
 Q:$D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT)!(Y="")
 S TARGFILE=Y  ;TARGET FILE STRING
 S GLO="^BARTR(0)"
 ;B "S+"
 F  S GLO=$Q(@GLO,-1) Q:GLO=""!($P(GLO,",",2)["AC")  D  ;P.OTT REVERSE SEARCH
 .Q:$P(GLO,",",3)'="6)"
 .I @GLO'[TARGFILE Q
 .W !,GLO_"="_@GLO
 .S NODE6=@GLO
 .S TRANTYPE=$P($G(^(1)),U)
 .Q:TRANTYPE=49!(TRANTYPE=115)!(TRANTYPE=117)  ;DON'T PROCESS BILL NEW, COL BAT TO ACC POST, OR COL BAT TO FACILITY
 .S TX=$P(GLO,",",2)
 .I $D(^BARSESS(DUZ(2),"NS",TX)) D  Q
 ..W !!,"TRANSACTION IN THE 'NOT SEND' STATUS"
 ..W !,"TX NOT ALLOWED!"
 .S NODE6=@GLO
 .S BILL=$P($G(^(0)),U,4)
 .S COLBAT=$P($G(^(0)),U,14)
 .S FNAME=$P($G(^(6)),U)
 .S SESSID=$P($G(^(6)),U,2)
 .S BYUSER=$P($G(^(6)),U,3)
 .S UNIQID=$P($G(^(6)),U,4)
 .W !!,"TX: ",TX
 .W !,"WAS TRANSMITTED IN FILE: ",FNAME
 .W !,"BY: " W:BYUSER $P($G(^VA(200,BYUSER,0)),U)
 .W !,"IN SESSION: ",SESSID
 .W !,"TPB BILL: " W:BILL $P($G(^BARBL(DUZ(2),BILL,0)),U)
 .W !,"COL BAT: " W:COLBAT $P($G(^BARCOL(DUZ(2),COLBAT,0)),U)
 .I $D(^TMP($J,BARRNAM,$J,TX)) D  Q
 ..W !,TX_" TRANSACTION FOUND IN PREVIOUS SEARCH"
 .S ^TMP($J,BARRNAM,$J,TX)="",FN="*",^TMP($J,BARRNAM,$J)=$G(^TMP($J,BARRNAM,$J))+1
 ;PLACE SOME TYPE OF REVIEW/REJECTION STEP HERE.
 Q
 ;
CBSEARCH(CB) ;EP - SEARCH FOR A GIVEN COL BATCH WHERE THE TX IS IN A SESSION BUT HAS NO NODE 6
 ;SCENARIO: SITE SUPPLIES A COL BATCH AND THEY CLAIM OR HUB CLAIMS
 ;THE TX IS NOT TO BE FOUND. SO LOOK AT COL BATCH THEN NODE 6 IF NO NODE 6, IS IT
 ;IN A SESSION? IF SESSION HAS A STATUS OF TRANSIMITED SOMETHING HAPPENED.
 N CBATTAR,INSESS,FNFILE,SESSFOUN
 K DIR,DIC,DIE,DR,DA
 W !!,"USE THIS SEARCH OPTION TO FIND TX THAT APPARENTLY WERE IN A SESSION"
 W !,"THE SESSION WAS TRANSMITTED BUT THE SITE AND HUB CLAIM"
 W !,"THE TX IS NO WHERE TO BE FOUND"
 S DIC(0)="AEMQ"
 S DIC="^BARCOL(DUZ(2),"
 D ^DIC
 Q:Y<0
 S COLBAT=+Y
 S COLBATTAR=$P(Y,U,2)
 ;GO THROUGH BARTR "AD" X-REF
 S TX=""
 F  S TX=$O(^BARTR(DUZ(2),"AD",COLBAT,TX)) Q:TX=""  D
 .S FNFILE=$P($G(^BARTR(DUZ(2),TX,6)),U)
 .;FOUND TX BY COL BATCH. NOW LETS SEE IF ITS IN A SESSION
 .;         DUZ(2)       TX         DUZ SESSION DATE/TIME   TX
 .;^BARSESS(1564,"G",3070522.125652,805,3070522.125538,3070522.125652)
 .K SESSFOUN
 .S SESSFOUN=0
 .;B:TX=3110210.132038 "S+"
 .I $D(^BARSESS(DUZ(2),"G",TX)),(FNFILE="") D  ;ITS IN THE COL BATCH AND HAS NO UFMS FILE
 ..;WHAT DOES THIS MEAN?
 ..;"G" SIMPLY MEANS ITS IN A SESSION.
 ..I $D(^BARSESS(DUZ(2),"NS",TX)) D  Q
 ...W !!,"TRANSACTION IN THE 'NOT SEND' STATUS"
 ...W !,"TX NOT ALLOWED!"
 ..S UDUZ=""
 ..F  S UDUZ=$O(^BARSESS(DUZ(2),"G",TX,UDUZ)) Q:UDUZ=""  D
 ...S SESSION=""
 ...F SESSION=$O(^BARSESS(DUZ(2),"G",TX,UDUZ,SESSION)) Q:SESSION=""  D
 ....S SESSFOUN=1
 ....S SESSFOUN(SESSION)=SESSION
 ....W !,"TX WAS FOUND IN SESSION: ",SESSION
 ....;WAS SESSION TRANSMITTED?
 ....I $O(^BARSESS(DUZ(2),UDUZ,11,SESSION,21,0)) D
 .....W !,"AND WAS TRANSMITTED ON: "
 .....S TRDT=0
 .....F I=1:1 S TRDT=$O(^BARSESS(DUZ(2),UDUZ,11,SESSION,21,TRDT)) Q:'TRDT  D
 ......S TXDATA=$G(^BARSESS(DUZ(2),UDUZ,11,SESSION,21,TRDT,0))
 ......S TXDT=$P(TXDATA,U)
 ......S TXFILE=$P(TXDATA,U,2)
 ......S TXBY=$P(TXDATA,U,3)
 ......I I=1 W ?25,TXDT,?35,TXFILE,!?25,"BY: ",$P($G(^VA(200,TXBY,0)),U)
 ......E  W !,25,TXDT,?35,TXFILE,!?25,"BY: ",$P($G(^VA(200,TXBY,0)),U)
 .;B "S+"
 .Q:'SESSFOUN
 .S TRANTYPE=$P($G(^BARTR(DUZ(2),TX,1)),U)
 .Q:TRANTYPE=49!(TRANTYPE=115)!(TRANTYPE=117)  ;DON'T PROCESS BILL NEW, COL BAT TO ACC POST, OR COL BAT TO FACILITY
 .W !,"TRANTYPE= ",TRANTYPE
 .W !,"TX: ",TX
 .I $D(^TMP($J,BARRNAM,$J,TX)) D  Q
 ..W !,TX_" TRANSACTION FOUND IN PREVIOUS SEARCH"
 .S ^TMP($J,BARRNAM,$J,TX)="",CB="*",^TMP($J,BARRNAM,$J)=$G(^TMP($J,BARRNAM,$J))+1
 Q
 ;
SSEARCH(SS) ;EP - SEARCH FOR A TX IN A SESSION WHERE THE SESSION HAS
 ;BEEN TRANSMITTED BUT THE TX DOESN'T HAVE NODE 6
SESS ;EP - ASK FOR A SESSION
 N UDUZ,SESSID,TRANS,FOUND6,RQLIST,NODE6,UNIQID,UFMSFN,TRCNT
 K DIC,DIE,DR,DA,DIR
 S DIC="^BARSESS(DUZ(2),"
 S DIC(0)="AEMQ"
 D ^DIC
 Q:Y<0
 S UDUZ=+Y
 K DIC,DIE,DR,DA,DIR
 S DA(1)=UDUZ
 S DIC="^BARSESS(DUZ(2),"_DA(1)_",11,"
 S DIC(0)="AEMQ"
 D ^DIC
 G:Y<0 SESS
 S SESSID=+Y
 W !!,"SESSION ",SESSID," OF CASHIER ",$P($G(^VA(200,UDUZ,0)),U)
 W !,"WILL BE SEARCHED FOR TRANSACTIONS"
 ;W !,"THAT DO NOT HAVE ^BARTR NODE 6.
 W !,"THIS WILL ONLY BE DONE IF THE SESSION HAS BEEN TRANSMITTED."
 S (TRCNT,FOUND6,NO6)=0
 ;I '$O(^BARSESS(DUZ(2),UDUZ,11,SESSID,21,0)) D  Q
 ;.W !,"SESSION HAS NOT BEEN TRANSMITTED!!"
 ;.W !,"SESSION WILL NOT BE SEARCHED"
 W !!,"SESSION CASHIER ",$P($G(^VA(200,UDUZ,0)),U)
 W !,"SESSION ",SESSID," HAS BEEN TRANSMITTED..."
 S TX=0
 F  S TX=$O(^BARSESS(DUZ(2),UDUZ,11,SESSID,2,TX))  Q:'TX  D
 .W !,TX
 .I $D(^BARSESS(DUZ(2),"NS",TX)) D  Q
 ..W !!,"TRANSACTION IN THE 'NOT SEND' STATUS"
 ..W !,"TX NOT ALLOWED!"
 .S TRCNT=TRCNT+1
 .I $D(^BARTR(DUZ(2),TX,6)) D
 ..S FOUND6=FOUND6+1 W ?17,"HAS NODE 6"
 ..S NODE6=$G(^BARTR(DUZ(2),TX,6))  ;MIGHT WANT TO MAKE FIELD 602 IN A/R TRANSACTION AS X-REF
 ..S UFMSFN=$P(NODE6,U)
 ..S SID=$P(NODE6,U,2)
 ..S BY=$P(NODE6,U,3)
 ..S:BY'="" BY=$P($G(^VA(200,BY,0)),U)
 ..S UNIQID=$P(NODE6,U,4)
 ..W !?10,"UFMS FN: ",UFMSFN
 ..W !?10,"SESSION ID: ",SID
 ..W !?10,"EXPORTED BY: ",BY
 ..W !?10,"UNIQUE ID: ",UNIQID
 .E  D
 ..S NO6=NO6+1 W ?17,TX_" MISSING NODE 6"
 .;I NO6 D
 .;.I $D(^TMP($J,BARRNAM,$J,TX)) D  Q
 .;..W !,TX_" TRANSACTION FOUND IN PREVIOUS SEARCH"
 .S ^TMP($J,BARRNAM,$J,TX)="",SS="*",^TMP($J,BARRNAM,$J)=$G(^TMP($J,BARRNAM,$J))+1
 W !,"A TOTAL OF ",TRCNT," TRANSACTIONS WERE PROCESSED"
 W !,"THERE WERE "_$S(NO6=0:"NO",1:NO6)_" TRANSACTION"_$S(NO6=0!(NO6>1):"S",1:"")_" FOUND WITHOUT NODE 6"
 W !,"THERE WERE "_$S(FOUND6=0:"NO",1:FOUND6)_" TRANSACTION"_$S(FOUND6=0!(FOUND6>1):"S",1:"")_" FOUND WITH NODE 6"
 Q
 ;
PROCESS ;EP - PROCESS DATA FOUND FROM SEARCHES
 I '$O(^TMP($J,BARRNAM,$J,"")) D  Q
 .W !!,"NO DATA IN ^TMP SEARCH GLOBAL"
 .W !,"PLEASE PERFORM AT LEAST ONE SEARCH FIRST."
 .K DIR
 .S DIR(0)="E"
 .D ^DIR
 W !!,"THERE ARE "_$G(^TMP($J,BARRNAM,$J))_" TRANSACTIONS TO PROCESS."
 S BARTRIEN=0
 F  S BARTRIEN=$O(^TMP($J,BARRNAM,$J,BARTRIEN)) Q:'BARTRIEN  D
 .K DIR
 .S DIR(0)="E"
 .S DIR("A")="CONTINUE PROCESSING TX: "_BARTRIEN
 .D ^DIR
 .Q:$D(DUOUT)
 .S BARCNT=$G(BARCNT)+1
 .D EN1^BARRQ
 .K FLAG
 Q
 ;
MSG1(BARMSG1,BARERR) ;EP - MESSAGE
 I $G(BARTRIEN)="" S BARTRIEN=0
 S BARTMP=+$G(^TMP($J,BARRNAM,BARRQDT,10,BARTRIEN))+1
 S ^TMP($J,BARRNAM,BARRQDT,10,BARTRIEN)=BARTMP
 S ^TMP($J,BARRNAM,BARRQDT,10,BARTRIEN,BARTMP,0)=$G(BARMSG1)
 S ^TMP($J,BARRNAM,BARRQDT,10,BARTRIEN,BARTMP,2)=$G(BARBILL)_U_$G(SESSID)_U_$G(UDUZ)_U_$G(TPBILL)
 S ^TMP($J,BARRNAM,BARRQDT,10,BARTRIEN,BARTMP,3)=$G(NEWSESS)_U_$G(NEWUSR)_U_$G(NEWUSRNM)
 I BARERR="F" D
 .W !,BARCNTS,?5,"<<< A/R TRANSACTION WAS NOT RE-QUEUED >>>      REASON: ",$G(BARMSG1)
 .S BARCNTS=BARCNTS+1                  ;COUNT TX ADDED TO SESSION
 .S BARCNTE=BARCNTE+1
 .W !,DASHLINE
 .W !,$G(BARCNTS),?6,$G(BARMSG1)
 .W !,?5,"A/R TRANS:",?25,$G(BARTRIEN),?45,"ORIGINAL SESSION:",?65,$G(SESSID)
 .W !,?5,"A/R BILL:",?25,$G(BARBILL),?45,"ORIG EXPORT USER:"
 .W:$G(UDUZ)'="" ?65,$P($G(^VA(200,UDUZ,0)),U)
 .W !,?5,"3P BILL:",?25,$G(TPBILL)
 .I $G(BAR3PB)=1 W !,?6,"# OF A/R TX'S PROCESSED FOR ",$G(TPBILL),":",?37,BARCNT3X
 .W !,?5,"*** TOTAL TRANS NOT PROCESSED:",?35,$G(BARCNTE)," ***"
 .S BARSAVE=""
 Q
 ;
SAVE ; - EP SAVE ORIGINAL DATA
 D NOW^%DTC
 S ^TMP($J,BARRNAM,BARRQDT,20,BARTRIEN,"TPB",0,0)="N/A"
 S ^TMP($J,BARRNAM,BARRQDT,20,BARTRIEN,"BARTR",0,0)=%
 S ^TMP($J,BARRNAM,BARRQDT,20,BARTRIEN,"BARTR",0,1)=$G(^BARTR(DUZ(2),BARTRIEN,0))  ;ORIGINAL TX BEFORE UPDATE
 S ^TMP($J,BARRNAM,BARRQDT,20,BARTRIEN,"BARTR",1,1)=$G(^BARTR(DUZ(2),BARTRIEN,1))
 S ^TMP($J,BARRNAM,BARRQDT,20,BARTRIEN,"BARTR",6,1)=$G(^BARTR(DUZ(2),BARTRIEN,6))
 I UDUZ'="",SESSID'="" D
 .S ^TMP($J,BARRNAM,BARRQDT,20,BARTRIEN,"BARSESS",SESSID,0)=UDUZ_U_SESSID_U_BARTRIEN_U_NEWSESS_"^No Action^"_%
 .S ^TMP($J,BARRNAM,BARRQDT,20,BARTRIEN,"BARSESS",SESSID,11,0)=$G(^BARSESS(DUZ(2),UDUZ,11,SESSID,2,BARTRIEN,0))
 .S ^TMP($J,BARRNAM,BARRQDT,20,BARTRIEN,"BARSESS",SESSID,21,0)=$G(^BARSESS(DUZ(2),UDUZ,11,SESSID,21,1,0))
 .S BARSAVE=1
 Q
 ;
SETRQTYP(DIR) ;EP - SET REQTYP HELP IN BARRQ
 S DIR("?",1)="THE FIRST FOUR CHOICES ARE STRAIGHT FORWARD. YOU CAN ENTER"
 S DIR("?",2)="ONE OR MANY INDIVIDUAL TXS OR BILLS. OR PROCESS A FILE OF TXS OR BILLS."
 S DIR("?",3)="IF YOU DO ONE OF THE FIRST FOUR OPTIONS YOU MUST TRANSMIT THESE BEFORE"
 S DIR("?",4)="USING THE 'BATCH' SEARCHES. AFTER USING ONE OF THE FIRST FOUR"
 S DIR("?",5)="OPTIONS SIMPLY PRESS RETURN AT THE PROMPT TO ENTER THE DISPLAY SESSION SCREEN"
 S DIR("?",6)="WHERE YOU CAN RECONCILE, REVIEW AND TRANSMIT YOUR RE-QUEUE SESSION."
 S DIR("?",7)=" "
 S DIR("?",8)="THE LAST THREE OPTIONS ARE SEARCHES DONE WITH A PARTICULAR LOGIC INVOLVED:"
 S DIR("?",9)="SCENARIO 1:"
 S DIR("?",10)="THE FN SEARCH ALLOWS THE USER TO ENTER A UFMS FILENAME. IT THEN"
 S DIR("?",11)="SEARCHES THE A/R TRANSACTION FILE NODE 6 FOR THE FILENAME."
 S DIR("?",12)="USE THIS SEARCH TO FIND TX THAT APPARENTLY WERE SENT IN A FILE"
 S DIR("?",13)="BUT THE SITE AND HUB CLAIM THE FILE IS NO WHERE TO BE FOUND"
 S DIR("?",14)=" "
 S DIR("?",15)="SCENARIO 2:"
 S DIR("?",16)="THE CB SEARCH ALLOWS THE USER TO ENTER A COLLECTION BATCH. IT THEN"
 S DIR("?",17)="LOOKS FOR TX IN THE COL BATCH THAT ARE IN A TRANSMITTED SESSION BUT THERE IS NO"
 S DIR("?",18)="NODE 6 IN THE A/R TRANSACTION FILE AND THE TX WAS TRANSMITTED (X-REF G)."
 S DIR("?",19)=" "
 S DIR("?",20)="SCENARIO 3:"
 S DIR("?",21)="THE SS SEARCH ALLOWS THE USER TO ENTER A SESSION. IT THEN"
 S DIR("?",22)="CHECKS TO SEE IF THE SESSION WAS TRANSMITTED. IF IT WAS"
 S DIR("?",23)="THEN IT LOOKS FOR TX THAT HAVE NO NODE 6 IN THE SESSION."
 S DIR("?",24)="THIS COULD BE THE 'CASHIER WENT TO LUNCH' SCENARIO"
 S DIR("?",25)="KEEP IN MIND THESE SCENARIOS SEEM TO OVERLAP"
 S DIR("?",26)="AND YOU MAY GET A HIT FOR THE SAME TX IN EACH SEARCH."
 S DIR("?",27)=" "
 S DIR("?",28)="AFTER DOING SEARCHES USING FN,CB AND SS A TEMPORARY GLOBAL WILL HOLD THE"
 S DIR("?")="TRANSACTIONS FOUND. TO RE-Q THOSE TRANSACTIONS USE OPTION RQ."
 Q