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

BARUFUT6.m

Go to the documentation of this file.
BARUFUT6 ; IHS/SD/TPF - UTILITIES FOR UFMS - PRINT BATCHES WITH SCHEDULE NUMBER POPULATED ;04/10/08
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**4,23**;OCT 26, 2005
 ;NEW ROUTINE BAR*1.8*4 SCR80 4.1.2
 ;
 ; IHS/SD/SDR - v1.8 p6 - DD item 4.1.2
 ;   added fields check# and check amt
 Q
 ;
EN ;EP - PRINT OUT BATCH AND ITEM WITH SCHEDULE NUMBER POPULATED
 N BARCOL,BARITEM,IPAC,DUZ2,TEMPDUZ2,CREDDEB,TRDATE,IPACX
 ;
 W !!,"This report will go through A/R payment transactions posted from 10/1/07 forward"
 W !,"and print collection batch information about every batch that was posted to."
 W !
 ;
 K DIR
 S DIR(0)="FO"
 S DIR("A")="Enter path"
 D ^DIR K DIR
 Q:$D(DTOUT)!$D(DIROUT)!$D(DUOUT)!(Y="")
 S PATH=Y
 S DIR(0)="FO"
 S DIR("A")="Enter filename"
 D ^DIR K DIR
 G:$D(DTOUT)!$D(DIROUT)!$D(DUOUT)!(Y="") EN
 S FILENAME=Y
 ;
 K ^XTMP("BARUFUT6",$J)
 S TEMPDUZ2=DUZ(2)
 S DUZ(2)=1
 F  S DUZ(2)=$O(^BARTR(DUZ(2))) Q:'DUZ(2)  D
 . S TRDATE=3070930.999999  ;PULL ONLY TRANSACTIONS FROM 10/1/2007 AND AFTER
 . F  S TRDATE=$O(^BARTR(DUZ(2),TRDATE)) Q:'TRDATE  D
 .. Q:'$$IHS^BARUFUT(DUZ(2))  ;DO ONLY IHS SITES
 .. ;;;Q:'$$IHSERA^BARUFUT(DUZ(2))  ;P.OTT DO ONLY IHS SITES AND TRIBAL WITH FLAG
 .. Q:$$GET1^DIQ(90050.03,TRDATE_",",101,"E")'="PAYMENT"  ;A/R TRANSACTIONS, TRANS TYPE'=PAYMENT
 .. S BARCOL=$$GET1^DIQ(90050.03,TRDATE_",",14,"I")  ;A/R TRANSACTIONS, A/R COLLECTION BATCH PTR
 .. Q:'BARCOL                       ;NO COLLECTION BATCH
 .. S BARITEM=$$GET1^DIQ(90050.03,TRDATE_",",15,"I") ;A/R TRANSACTIONS, A/R COLLECTION ITEM NUMBER
 .. I BARITEM="" D  Q               ;NO ITEM NUMBER
 ... S ^XTMP("BARUFUT6",$J,DUZ(2),"NO ITEM#",BARCOL,"MISSING",TRDATE)=""
 .. S IPAC=$$GET1^DIQ(90051.1101,BARITEM_","_BARCOL_",",20,"E")
 .. S:'$$GOODIPAC^BARUFEX3(IPAC) IPAC="BAD TDN: "_IPAC
 .. S ^XTMP("BARUFUT6",$J,DUZ(2),IPAC,BARCOL,BARITEM)=TRDATE
 I '$D(^XTMP("BARUFUT6",$J)) W !!,"NO DATA FOUND." H 3 G EN
 D PRINT
 I $G(POP) W !!,"COULD NOT OPEN FILE!! TRY AGAIN." H 3 G EN
 S DUZ(2)=TEMPDUZ2
 Q
 ;
PRINT ;EP - PRINT
 N FACILITY,TRDATE,IPAC,ARCOL,COL,ARCOLNM,ARSTAT
 N CREDDEB,ARITEM,CNT,ARACCT,ITEMSTAT
 K POP
 D OPEN^%ZISH("FILE",PATH,FILENAME,"W")
 Q:$G(POP)
 ;W !,"COLLECTION BATCH",U,"STATUS",U,"FACILITY",U,"A/R ACCOUNT",U,"ITEM",U,"SCHEDULE#",U,"CREDIT-DEBIT"  ;bar*1.8*4 SCR83  ;IHS/SD/SDR bar*1.8*6 DD item 4.1.2
 W !,"COLLECTION BATCH",U,"STATUS",U,"FACILITY",U,"A/R ACCOUNT",U,"ITEM",U,"SCHEDULE#",U,"CHECK#",U,"CHECK AMOUNT"  ;IHS/SD/SDR bar*1.8*6 DD item 4.1.2, SCR 118
 S DUZ(2)=""
 F  S DUZ(2)=$O(^XTMP("BARUFUT6",$J,DUZ(2))) Q:'DUZ(2)  D
 .S FACILITY=$$GET1^DIQ(4,DUZ(2)_",",.01,"E")
 .S IPAC=""
 .F  S IPAC=$O(^XTMP("BARUFUT6",$J,DUZ(2),IPAC)) Q:IPAC=""  D
 ..S ARCOL=""
 ..F  S ARCOL=$O(^XTMP("BARUFUT6",$J,DUZ(2),IPAC,ARCOL)) Q:ARCOL=""  D
 ...S ARCOLNM=$$GET1^DIQ(90051.01,ARCOL_",",.01,"E")
 ...S ARSTAT=$$GET1^DIQ(90051.01,ARCOL_",",3,"E")
 ...S HREC=ARCOLNM  ;collection batch
 ...S HREC=HREC_U_ARSTAT  ;status
 ...S HREC=HREC_U_FACILITY  ;facility
 ...S (ARACCT,ITEMSTAT,CREDDEB)="NO ITEM#"
 ...S ARITEM=""
 ...F  S ARITEM=$O(^XTMP("BARUFUT6",$J,DUZ(2),IPAC,ARCOL,ARITEM)) Q:ARITEM=""  D
 ....S:ARITEM'["MISS" ARACCT=$$GET1^DIQ(90051.1101,ARITEM_","_ARCOL_",",7,"E")
 ....S:ARITEM'["MISS" ITEMSTAT=$$GET1^DIQ(90051.1101,ARITEM_","_ARCOL_",",17,"E")
 ....S REC=HREC_U_ARACCT  ;A/R account
 ....S:ARITEM'["MISS" CREDDEB=$$GET1^DIQ(90051.1101,ARITEM_","_ARCOL_",",102.5,"E")
 ....;start new code IHS/SD/SDR bar*1.8*6 DD 4.1.2
 ....S:ARITEM'["MISS" BARCKN=$$GET1^DIQ(90051.1101,ARITEM_","_ARCOL_",",11,"E")
 ....S:ARITEM'["MISS" BARCKAMT=$$GET1^DIQ(90051.1101,ARITEM_","_ARCOL_",",101,"E")
 ....;end new code IHS/SD/SDR DD 4.1.2
 ....S REC=REC_U_ARITEM  ;item
 ....S REC=REC_U_IPAC  ;sched#
 ....;S REC=REC_U_CREDDEB  ;credit-debit  SCR118
 ....;S REC=REC_U_ITEMSTAT  ;item status  ;bar*1.8*4 SCR83
 ....;start new code IHS/SD/SDR bar*1.8*6 DD 4.1.2
 ....S REC=REC_U_BARCKN  ;check number
 ....S REC=REC_U_BARCKAMT  ;check amount
 ....;end new code DD 4.1.2
 ....W !,REC
 D CLOSE^%ZISH("FILE")
 Q