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

ABSPOSMB.m

Go to the documentation of this file.
  1. ABSPOSMB ; IHS/FCS/DRS - General Inquiry/Report .57; [ 09/12/2002 10:14 AM ]
  1. ;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
  1. Q
  1. JOIN ;EP - various options from ABSPOSMA join here
  1. N X,DEFDATES
  1. A ;S X=$$MODE^ABSPOSMZ
  1. S X="I" ; always Inquiry mode?
  1. I X="I" S ABSPOSMA("MODE")="INQUIRY"
  1. E I X="R" S ABSPOSMA("MODE")="REPORT"
  1. E Q
  1. B I '$D(ABSPOSMA("SORT")) G D ;if doing a Fileman sort, skip date range
  1. D DEFDATES ; set default sort dates
  1. S X=$$SORTDATE^ABSPOSMZ I X="" G A
  1. I X="T" D
  1. . S ABSPOSMA("BY WHICH DATE")="TRANSACTION"
  1. . K ABSPOSMA("SORT",9999.95)
  1. E I X="R" D
  1. . S ABSPOSMA("BY WHICH DATE")="RELEASED"
  1. E Q
  1. C S X=$$DATES^ABSPOSMZ(DEFDATES) G:'X B
  1. I ABSPOSMA("BY WHICH DATE")="TRANSACTION" D
  1. . S ABSPOSMA("SORT",7,"FR")=$P(X,U)
  1. . S ABSPOSMA("SORT",7,"TO")=$P(X,U,2)
  1. . K ABSPOSMA("SORT",9999.95)
  1. . D AUTO^ABSPOSM1() ; have to do this because of "AE" screen
  1. E D ; released dates: compute equivalent transaction dates
  1. . S ABSPOSMA("SORT",9999.95,"FR")=$P(X,U)
  1. . S ABSPOSMA("SORT",9999.95,"TO")=$P(X,U,2)
  1. . S X=$$FILE61(X)
  1. . I 'X D
  1. . . W !,"No transactions in this range of released dates?!",!
  1. . S ABSPOSMA("SORT",7,"FR")=$P(X,U)
  1. . S ABSPOSMA("SORT",7,"TO")=$P(X,U,2)
  1. I 'ABSPOSMA("SORT",7,"FR") G B
  1. D ; If in report mode, then get the type of output right now
  1. I ABSPOSMA("MODE")="REPORT" D G:X="" C
  1. . S X=$$OUTPUT^ABSPOSMZ Q:X=""
  1. . S ABSPOSMA("OUTPUT TYPE")=X
  1. W ! G CONTINUE^ABSPOSMC
  1. FILE61(X) ; given X = low^high date range of released dates
  1. ; figure out range of transaction dates needed to include all of them
  1. ; This will make the sort efficient.
  1. ; return low^high range of transaction dates
  1. D AUTO^ABSPOSM1() ; update last couple days of 9002313.61
  1. N TLO,THI S TLO=9999999,THI=-1
  1. N RLO,RHI S RLO=$P(X,U)\1,RHI=$P(X,U,2)\1 ; stored w/o time in .61
  1. N RDT S RDT=RLO
  1. N IEN61 S IEN61=0
  1. F D S RDT=$O(^ABSPECX("RPT","B",RDT)) Q:'RDT Q:RDT>RHI D
  1. . ; loop through all released on this date
  1. . S IEN61=0 F S IEN61=$O(^ABSPECX("RPT","B",RDT,IEN61)) Q:'IEN61 D
  1. . . N IEN57 S IEN57=$P(^ABSPECX("RPT",IEN61,0),U,3)
  1. . . N X S X=$P($G(^ABSPTL(IEN57,0)),U,8) ; transaction date
  1. . . S:X<TLO TLO=X S:X>THI THI=X
  1. I TLO>THI Q "" ; none?!
  1. Q TLO_U_THI
  1. DEFDATES ; set DEFDATES=start^end default sort dates
  1. N X S X=$O(ABSPOSMA("SORT"," ")) ; what are we sorting on?
  1. ; by Patient or by Claim ID, we go back a year
  1. I X="PATIENT"!(X="CLAIM:Claim ID") S DEFDATES=DT-10000
  1. E S DEFDATES=DT ; for others, it's today only
  1. I $P(DEFDATES,U,2)="" S $P(DEFDATES,U,2)=DT
  1. ; If start date default is today and there are no transactions,
  1. ; set the default start date to yesterday
  1. I $P(DEFDATES,U)=DT,'$O(^ABSPTL("AH",DT)) S $P(DEFDATES,U)=$$YESTER
  1. Q
  1. YESTER() Q $$TADD^ABSPOSUD(DT,-1) ; yesterday