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

BARUFUT0.m

Go to the documentation of this file.
BARUFUT0 ; IHS/SD/TPF - UTILITIES FOR UFMS (CONTINUATION OF BARUFUT) ; 09/19/2007
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**7,20**;OCT 26, 2005
 ;NEW ROUTINE TO MEET SAC REQUIREMENT FOR ROUTINE SIZE; BAR*1.8*7
 Q
 ;
VIEWTRAN(UDUZ,SESSID,ERASTAT) ;EP - VIEW INDIVIDUAL SESSION TRANSACTIONS
 N TRDATE,LINE,CREDIT,DEBIT,TRANTYP,ADJCAT,DATE,BILL,CURSTAT,TRANBY,TRANS,IEN,TRANTIME
 N ESCAPE
 S ESCAPE=0
 K TRANS
 D TRANHDR(UDUZ,SESSID)
 S TRDATE=0
 F LINE=1:1 S TRDATE=$O(^BARSESS(DUZ(2),UDUZ,11,SESSID,2,TRDATE)) Q:'TRDATE!(ESCAPE)  D
 .S IENS=TRDATE_","_SESSID_","_UDUZ_","
 .S TRANS=$$GET1^DIQ(90057.110102,IENS,.02,"E")
 .S TRANBY=$$GET1^DIQ(90057.110102,IENS,.03,"E")
 .S TRANTIME=$$GET1^DIQ(90057.110102,IENS,.04,"E")
 .S CREDIT=$$GET1^DIQ(90050.03,TRDATE_",",2)
 .S DEBIT=$$GET1^DIQ(90050.03,TRDATE_",",3)
 .S BILL=$$GET1^DIQ(90050.03,TRDATE_",",4)
 .S BLLIEN=$$GET1^DIQ(90050.03,TRDATE_",",4,"I")
 .S TPBIEN=$$GET1^DIQ(90050.01,BLLIEN_",",17,"I")
 .S TRANTYP=$$GET1^DIQ(90050.03,TRDATE_",",101,"E")
 .S ADJCAT=$$GET1^DIQ(90050.03,TRDATE_",",102,"E")
 .S TRANS(LINE)=TRDATE
 .I $Y>(IOSL-5) D ASKFORRT^BARUFUT S ESCAPE=$D(DIROUT)!$D(DUOUT)!$D(DTOUT) D TRANHDR(UDUZ,SESSID)
 .W !,LINE,"."
 .S Y=TRDATE X ^DD("DD") S DATE=Y
 .W ?4,DATE,?25,$J(CREDIT,8,2),?35,$J(DEBIT,8,2),?50,$E(TRANTYP,1,14),?65,$E(ADJCAT,1,15)
 .W:BILL'="" !?4,BILL
 .W:TPBIEN'="" !?4,"["_TPBIEN_"]"
 .W:TRANS="YES" ?25,"TRANSMITTED BY: ",TRANBY," on ",TRANTIME
 D ASKFORRT^BARUFUT
 Q
 ;
TRANHDR(UDUZ,SESSID) ;EP - VIEW STATUS HEADER
 W @IOF
 W !?3,"VIEWING TRANSACTIONS FOR SESSION ID ",SESSID," OF ",$P($G(^VA(200,UDUZ,0)),U)
 W !?3,"A/R TRANSACTION DATE",?29,"CREDIT",?39,"DEBIT",?50,"TYPE",?65,"CATEGORY"
 W !?3,"A/R BILL"
 W !?3,"--------------------",?29,"------",?39,"-----",?50,"----",?65,"--------"
 W !
 Q
VIEWSTAT(UDUZ,SESSID) ;EP - VIEW STATUS HISTORY
 N STATUSDT,STATDTEX,CHANGETO,CHANGBY
 D STATHDR(UDUZ,SESSID)
 S STATUSDT=0
 F  S STATUSDT=$O(^BARSESS(DUZ(2),UDUZ,11,SESSID,1,STATUSDT)) Q:'STATUSDT  D
 .S CHANGETO=$$GET1^DIQ(90057.110101,STATUSDT_","_SESSID_","_UDUZ_",",.02,"E")
 .S CHANGEBY=$$GET1^DIQ(90057.110101,STATUSDT_","_SESSID_","_UDUZ_",",.03,"E")
 .S Y=STATUSDT X ^DD("DD") S STATDTEX=Y
 .I $Y>(IOSL-8) D ASKFORRT^BARUFUT D STATHDR(UDUZ,SESSID) Q
 .W !,STATDTEX,?25,$E(CHANGEBY,1,20),?50,CHANGETO
 D ASKFORRT^BARUFUT
 Q
STATHDR(UDUZ,SESSID) ;EP - VIEW STATUS HEADER
 W @IOF
 W !,"VIEWING STATUS HISTORY FOR SESSION ID ",SESSID," OF ",$P($G(^VA(200,UDUZ,0)),U)
 W !,"STATUS CHANGED ON",?25,"CHANGED BY",?50,"CHANGED TO"
 W !,"-----------------",?25,"----------",?50,"----------",!
 Q
 ;
SETTRANS(UDUZ,SESSID,BARFILE) ;EP - SET TRANSMISSION DATE/TIME MULTIPLE;MRS:BAR*1.8*7 IM30562
 ;ADDED NEW FUNCTIONALITY TO PREVENT DUPLICATES  ;MRS:BAR*1.8*7 IM30562
 N NEWSTAT
 K DIR,DIE,DIC,DR,DA
 D NOW^%DTC
 S X=%
 I $D(SESSID)=1 D  Q 1                    ;SET AND UNLOCK SINGLE SESSION
 .D SET(UDUZ,SESSID)
 .LOCK -^BARSESS(DUZ(2),UDUZ,11,SESSID)
 S REC=""
 F  S REC=$O(SESSID(REC)) Q:'REC  D       ;SET AND UNLOCK MULTIPLE SESSIONS
 .S UDUZ=$P(SESSID(REC),U)
 .S SESSID=$P(SESSID(REC),U,2)
 .D SET(UDUZ,SESSID)
 .LOCK -^BARSESS(DUZ(2),UDUZ,11,SESSID)
 Q 1
 ;
SET(UDUZ,SESSID) ;EP -
 ;start new IHS/SD/PKD 3/2/11 1.8*20
 ; UDUZ = SESSION CASHIER, NOT EXPORTING CASHIER
 ; FILENAME Was not being set for Not Sent TRX (here from SET^BARUFEXT0)
 N CHK21
 S CHK21=$$CHK21(UDUZ,SESSID) Q:CHK21
 ;end new
 K DIR,DIE,DIC,DR,DA
 D NOW^%DTC
 S X=%
 S DA(2)=UDUZ
 S DA(1)=SESSID
 S DIC("P")=$P(^DD(90057.11,210101,0),U,2)
 S DIC="^BARSESS(DUZ(2),"_DA(2)_",11,"_DA(1)_",21,"
 S DIC(0)="L"
 D ^DIC
 Q:Y<0
 K DIR,DIE,DIC,DR,DA
 S DA(2)=UDUZ
 S DA(1)=SESSID
 S DIE="^BARSESS(DUZ(2),"_DA(2)_",11,"_DA(1)_",21,"
 S DR=".02///^S X=BARFILE;.03////^S X=DUZ"
 S DA=+Y
 D ^DIE
 K DIR,DIE,DIC,DR,DA
 S CURSTAT=$$CURSTAT^BARUFUT(UDUZ,SESSID,"E")
 ; IHS/SD/PKD 1.8*20 3/3/11 Remnant:  No longer use RETRANSMITTED
 ;     TRANSMITTED Timestamp = 1st EXPORT timestamp - DON'T change
 ;I CURSTAT="TRANSMITTED"!(CURSTAT="RETRANSMITTED") S RETCODE=$$SETSESS^BARUFUT(UDUZ,SESSID,"RT") Q
 I CURSTAT["TRANSMITTED" S RETCODE=1 Q
 ;END 1.8*20
 S X=$$SETSESS^BARUFUT(UDUZ,SESSID,"T")
 Q
 ;
ADDSTAT(UDUZ,SESSID) ; EP - ;CREATE A NEW STATUS CHANGE DATE/TIME
 K DIC,DIE,DR,DA,DIR
 D NOW^%DTC
 S X=%
 S DA(2)=UDUZ
 S DA(1)=SESSID
 S DIC("P")=$P(^DD(90057.11,110101,0),U,2)
 S DIC="^BARSESS(DUZ(2),"_DA(2)_",11,"_DA(1)_",1,"
 S DIC(0)="L"
 D ^DIC
 Q:Y<0 0
 Q Y
 ;start new code IHS/SD/PKD bar*1.8*20
CHK21(UDUZ,SESSID)  ;IHS/SD/PKD 3/2/11 Check for previous set of FILENAME
 ;into ^BARSESS(DUZ(2),USER,11,SESSID,21,COUNT,0)
 ;Don't want duplicates but don't want to miss any
 N CT,OK S CT=0,OK=0
 F  S CT=$O(^BARSESS(DUZ(2),UDUZ,11,SESSID,21,CT)) Q:'CT!(OK)  D
 . S FL=$G(^BARSESS(DUZ(2),UDUZ,11,SESSID,21,CT,0)) Q:'FL  D
 . . I $P(FL,U,2)=BARFILE S OK=1
 Q OK
 ;end new code