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

IBAGMM.m

Go to the documentation of this file.
  1. IBAGMM ;WOIFO/AAT-GMT MONTHLY TOTALS REPORT;30-JUL-02
  1. ;;2.0;INTEGRATED BILLING;**183**;21-MAR-94
  1. ;; Per VHA Directive 10-93-142, this routine should not be modified
  1. ;
  1. N IBQUIT
  1. F S IBQUIT=0 D Q:IBQUIT
  1. . N IBBDT,IBEDT,%DT,X,Y,DIC
  1. . W !
  1. . D DATE I IBBDT<0 S IBQUIT=1 Q
  1. . D ASKDEV ;Choose device and run/schedule printing
  1. . S IBQUIT=1 ;Probably the report will not be printed repeatedly
  1. Q
  1. ;
  1. ASKDEV ; Ask about output device and print the report (or run task)
  1. N %ZIS,POP
  1. S %ZIS="QM"
  1. W ! D ^%ZIS Q:POP ; Quit and ask for patient again. Otherwise Set IBSTOP=1
  1. ; If it was queued
  1. I $D(IO("Q")) D RUNTASK Q
  1. U IO D REPORT^IBAGMM1 ; Generate report directly
  1. D ^%ZISC ; Close the device
  1. Q
  1. ;
  1. ;
  1. RUNTASK ; Start Taskman job
  1. N ZTRTN,ZTSK,IBVAR,ZTSAVE,ZTDESC
  1. S ZTRTN="REPORT^IBAGMM1",ZTDESC="IB GMT MONTHLY TOTALS REPORT"
  1. F IBVAR="IBBDT","IBEDT" S ZTSAVE(IBVAR)=""
  1. D ^%ZTLOAD
  1. I $G(ZTSK) W !!,"This request has been queued. The task number is "_ZTSK_"."
  1. E W !!,"Unable to queue this job."
  1. K IO("Q")
  1. D HOME^%ZIS W !
  1. Q
  1. ;
  1. ;
  1. ; Ask begin/end dates, with default values
  1. ; Input: none
  1. ; Output: IBBDT,IBEDT - begin/end dates
  1. DATE N %DT,Y,IBNOW
  1. S IBNOW=$$NOW()
  1. DATAGN ;Loop entry point
  1. S (IBBDT,IBEDT)=-1
  1. ; Get beginning date
  1. S IBBDT=$$ASKDT("Start with DATE: ",$$FIRST(IBNOW))
  1. I IBBDT<1 Q
  1. I IBBDT'=$$FIRST(IBBDT) W !!,"Warning! The Start date is not the first day of the month.",!
  1. ; Get ending date
  1. S IBEDT=$$ASKDT("Go to DATE: ",$$LAST(IBNOW))
  1. I IBEDT<1 S IBBDT=-1 Q ;User cancelled
  1. I IBEDT<IBBDT W !,"Ending date must follow start date!",! G DATAGN
  1. I IBBDT<$$GMTEFD^IBAGMT() W !!,"Warning! The Start date is earlier than the GMT Effective Date - ",$$DAT^IBAGMM1($$GMTEFD^IBAGMT)
  1. I IBEDT'=$$LAST(IBEDT) W !!,"Warning! The Ending date is not the last day of the month."
  1. Q
  1. ;
  1. ;Define the first day of the given month
  1. FIRST(IBDT) S $E(IBDT,6,7)="01"
  1. Q IBDT
  1. ;
  1. ;Define the last day of the given month
  1. LAST(IBDT) N IBM,IBY,X1,X2,X
  1. S IBY=$E(IBDT,1,3),IBM=+$E(IBDT,4,5)
  1. S IBM=IBM+1 I IBM>12 S IBM=1,IBY=IBY+1
  1. I $L(IBM)<2 S IBM="0"_IBM
  1. S X1=IBY_IBM_"01",X2=-1
  1. D C^%DTC
  1. Q X
  1. ;
  1. ;Returns today's date in FM format
  1. NOW() N %,%H,%I,X
  1. D NOW^%DTC
  1. Q X
  1. ;
  1. ; Input: prompt, default value (FM format)
  1. ; Output: date (FM) or -1, if cancelled
  1. ASKDT(IBPRMT,IBDFLT) ;Date input
  1. N DIR,Y,Y0,X,DIROUT,DIRUT
  1. I $G(IBPRMT)'="" S DIR("A")=IBPRMT
  1. I $G(IBDFLT)'="" S DIR("B")=$$FMTE^XLFDT(IBDFLT,"1D")
  1. S DIR(0)="DA"
  1. D ^DIR I $D(DIRUT) Q -1
  1. W " (",$$FMTE^XLFDT(Y),")"
  1. Q Y