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

ACRFIRS0.m

Go to the documentation of this file.
ACRFIRS0 ;IHS/OIRM/DSD/AEF - 1099 RECORD A,B,C,F,T LAYOUTS; [ 02/13/2004  9:40 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**1,6,8**;NOV 05, 2001
 ; NEW ROUTINE CREATED FROM ACRFIRS2; ACR*2.1*8
 ;
 ;      This routine is called by ACRFIRS1 to format 1099 record data
 ;      into a ^TMP global using the record layouts specified in
 ;      Department of the Treasury Internal Revenue Service
 ;      Publication 1220 Catalog Number 61275P.
 ;      Variables are set by ACRFIRS1.
 ;      Note: All Apha characters must be in upper case
 ;         EXCEPT e-mail addresses that might be case sensitive
 Q
RECORDC(ACRAREA,ACRTOT,ACRCNTB,ACRCNTR)        ;EP   ;ACR*2.1*6.01
 ;----- CREATE RECORD TYPE C (END OF PAYER)
 ;
 ;LAYOUT
 ;1  -  1 "C"                     160-177 CONTROL TOTAL 9
 ;2  -  9 NUMBER OF PAYEES        178-195 CONTROL TOTAL A
 ;10 - 15 BLANK                   196-213 CONTROL TOTAL B
 ;16 - 33 CONTROL TOTAL 1         214-231 CONTROL TOTAL C
 ;34 - 51 CONTROL TOTAL 2         232-249 CONTROL TOTAL D  ;ACR*2.1*8.01
 ;52 - 69 CONTROL TOTAL 3         250-267 CONTROL TOTAL E  ;ACR*2.1*8.01
 ;70 - 87 CONTROL TOTAL 4         268-449 BLANK            ;ACR*2.1*8.01
 ;88 -105 CONTROL TOTAL 5         500-507 RECORD SEQUENCE# ;ACR*2.1*6.01
 ;106-123 CONTROL TOTAL 6         508-748 BLANK            ;ACR*2.1*6.01
 ;124-141 CONTROL TOTAL 7         749-750 BLANK            ;ACR*2.1*6.01
 ;142-159 CONTROL TOTAL 8
 ;
 ;      INPUT:
 ;      ACRAREA = PAYER NAME
 ;      ACRTOT( = ARRAY CONTAINING PAYMENT AMOUNT CODE TOTALS
 ;      ACRCNTB = RECORD B COUNT
 ;      ACRCNTR = RECORD SEQUENCE NUMBER ; ACR*2.1*6.01
 ;
 ;      OUTPUT:    
 ;      ACRCNTR = RECORD SEQUENCE COUNT  ; ACR*2.1*6.01
 ;
 N I,Z
 S ACRCNTR=ACRCNTR+1                     ; ACR*2.1*6.01
 S $E(Z)="C"
 S $E(Z,2,9)=$$PAD^ACRFUTL(ACRCNTB,"L",8,0)
 S $E(Z,10,15)=$$PAD^ACRFUTL("","R",6,"")
 S $E(Z,16,33)=$$PAD^ACRFUTL(ACRTOT(1),"L",18,0)
 S $E(Z,34,51)=$$PAD^ACRFUTL(ACRTOT(2),"L",18,0)
 S $E(Z,52,69)=$$PAD^ACRFUTL(ACRTOT(3),"L",18,0)
 S $E(Z,70,87)=$$PAD^ACRFUTL(ACRTOT(4),"L",18,0)
 S $E(Z,88,105)=$$PAD^ACRFUTL(ACRTOT(5),"L",18,0)
 S $E(Z,106,123)=$$PAD^ACRFUTL(ACRTOT(6),"L",18,0)
 S $E(Z,124,141)=$$PAD^ACRFUTL(ACRTOT(7),"L",18,0)
 S $E(Z,142,159)=$$PAD^ACRFUTL(ACRTOT(8),"L",18,0)
 S $E(Z,160,177)=$$PAD^ACRFUTL(ACRTOT(9),"L",18,0)
 S $E(Z,178,195)=$$PAD^ACRFUTL(ACRTOT("A"),"L",18,0)
 S $E(Z,196,213)=$$PAD^ACRFUTL(ACRTOT("B"),"L",18,0)
 S $E(Z,214,231)=$$PAD^ACRFUTL(ACRTOT("C"),"L",18,0)
 S $E(Z,232,249)=$$PAD^ACRFUTL("","R",18,"")    ;ACR*2.1*8.01
 S $E(Z,250,267)=$$PAD^ACRFUTL("","R",18,"")    ;ACR*2.1*8.01
 S $E(Z,268,499)=$$PAD^ACRFUTL("","R",232,"")   ;ACR*2.1*8.01
 S $E(Z,500,507)=$$PAD^ACRFUTL(ACRCNTR,"L",8,0) ;ACR*2.1*6.01
 S $E(Z,508,748)=$$PAD^ACRFUTL("","R",241,"")   ;ACR*2.1*6.01
 S $E(Z,749,750)=$$PAD^ACRFUTL("","R",2,"")
 ;
 S ^TMP("ACRZ",$J,"RECORD","C",ACRAREA,1)=$E(Z,1,240)
 S ^TMP("ACRZ",$J,"RECORD","C",ACRAREA,2)=$E(Z,241,480)
 S ^TMP("ACRZ",$J,"RECORD","C",ACRAREA,3)=$E(Z,481,720)
 S ^TMP("ACRZ",$J,"RECORD","C",ACRAREA,4)=$E(Z,721,750)
 Q
RECORDF(ACRCNTA,ACRCNTR)   ;EP   ;ACR*2.1*6.01
 ;----- CREATE RECORD TYPE F (END OF TRANSMISSION)
 ;
 ;LAYOUT
 ;1  -  1 "F"                     58-499 BLANK   ;ACR*2.1*6.01
 ;2  -  9 NUMBER OF "A" RECORDS  500-507 RECORD SEQUENCE# ;ACR*2.1*6.01
 ;10 - 30 ZEROS                  508-748 BLANK   ;ACR*2.1*6.01
 ;31 - 49 BLANK                  749-750 BLANK   ;ACR*2.1*6.01
 ;50 - 57 TOTAL NUMBER OF PAYEES                 ;ACR*2.1*6.01
 ;
 ;      INPUT:
 ;      ACRCNTA = RECORD A COUNT
 ;      ACRCNTR = RECORD SEQUENCE NUMBER ;ACR*2.1*6.01
 ;
 ;      OUTPUT:
 ;      ACRCNTR = RECORD SEQUENCE COUNT ;ACR*2.1*6.01
 ;
 N I,Z
 S ACRCNTR=ACRCNTR+1            ; ACR*2.1*6.01
 S $E(Z)="F"
 S $E(Z,2,9)=$$PAD^ACRFUTL(ACRCNTA,"L",8,0)
 S $E(Z,10,30)=$$PAD^ACRFUTL("","L",21,0)
 S $E(Z,31,49)=$$PAD^ACRFUTL("","R",19,"")      ;ACR*2.1*6.01
 S $E(Z,50,57)=$$PAD^ACRFUTL(ACRCNTB,"L",8,0)   ;ACR*2.1*6.01
 S $E(Z,58,449)=$$PAD^ACRFUTL("","R",442,"")    ;ACR*2.1*6.01
 S $E(Z,500,507)=$$PAD^ACRFUTL(ACRCNTR,"L",8,0) ;ACR*2.1*6.01
 S $E(Z,508,749)=$$PAD^ACRFUTL("","R",241,"")   ;ACR*2.1*6.01
 S $E(Z,749,750)=$$PAD^ACRFUTL("","R",2,"")     ;ACR*2.1*6.01
 ;
 S ^TMP("ACRZ",$J,"RECORD","F",1)=$E(Z,1,240)
 S ^TMP("ACRZ",$J,"RECORD","F",2)=$E(Z,241,480)
 S ^TMP("ACRZ",$J,"RECORD","F",3)=$E(Z,481,720)
 S ^TMP("ACRZ",$J,"RECORD","F",4)=$E(Z,721,750)
 Q
RECORDT(ACRAREA,ACRPMYR,ACRCNTB)       ;EP
 ;----- CREATE RECORD TYPE T  (TRANSMITTER)
 ;
 ;LAYOUT   ;NEW LAYOUT ACR*2.1*6.01,ACR*2.1*8.04
 ;  1-  1 "T"                       344-358 CONTACT PHONE
 ;  2-  5 PAYMENT YEAR              359-393 CONTACT E-MAIL ADDRESS
 ;  6-  6 PRIOR YEAR DATA IND       394-395 CARTRDGE TAPE FILE IND (BNK)
 ;  7- 15 TRANSMITTER'S TIN         396-410 ELEC FILE IND (BLANKS)
 ; 16- 20 TRANSMITTER CTRL CODE     411-416 TRANSMITTER'S MEDIA NUMBER
 ; 21- 22 REPLACEMENT ALPHA CHAR    417-499 BLANK
 ; 23- 27 BLANK                **** 500-507 RECORD SEQUENCE NUMBER (R)
 ; 28- 28 TEST FILE INDICATOR       508-517 BLANK
 ; 29- 29 FOREIGN ENTITY IND        518-518 VENDOR INDICATOR ("I")
 ; 30- 69 TRANSMITTER NAME          519-558 VENDOR NAME OF COTS SF (NR)
 ; 70-109 TRANSMITTER NAME, CONT    559-598 VENDOR MAILING ADDRESS (NR)
 ;110-149 COMPANY NAME              599-638 VENDOR CITY (NR)
 ;150-189 COMPANY NAME, CONT        639-640 VENDOR STATE (NR)
 ;190-229 COMPANY MAILING ADDR      641-649 VENDOR ZIP CODE (NR)
 ;230-269 COMPANY CITY              650-689 VENDOR CONTACT NAME (NR)
 ;270-271 COMPANY STATE             690-704 VENDOR CONTACT PHONE (NR)
 ;272-280 COMPANY ZIP CODE          705-739 VENDOR CONTACT EMAIL (NR)
 ;281-295 BLANK                     740-740 FOREIGN VENDOR INDICATOR ;ACR*2.1*8.04
 ;296-303 TOTAL NUMBER OF PAYEES    741-748 BLANK         ACR*2.1*8.04
 ;304-343 CONTACT NAME              749-750 BLANK
 ;
 ;      INPUT:
 ;      ACRAREA = PAYER NAME
 ;      ACRPMYR = PAYMENT CALENDAR YEAR
 ;      ACRCNTB = RECORD B COUNT
 ;
 N DATA,I,Z,DATA1   ;ACR*2.1*6.01
 S DATA=$$UPPER^ACRFUTL($G(^ACR1099P(ACRAREA,0)))   ;ACR*2.1*6.01
 S DATA1=$G(^ACR1099P(ACRAREA,1))   ;ACR*2.1*6.01
 S $E(Z)="T"
 S $E(Z,2,5)=ACRPMYR
 S $E(Z,6)=$$PAD^ACRFUTL("","R",1,"")
 S $E(Z,7,15)=$P(DATA,U,8)
 S $E(Z,16,20)=$E($P(DATA,U,10),1,5)
 S $E(Z,21,22)=$$PAD^ACRFUTL("","R",2,"")
 S $E(Z,23,27)=$$PAD^ACRFUTL("","R",5,"")
 S $E(Z,28)=$$PAD^ACRFUTL("","R",1,"")
 S $E(Z,29)=$$PAD^ACRFUTL("","R",1,"")
 S $E(Z,30,69)=$$PAD^ACRFUTL($P(DATA,U,2),"R",40,"")
 S $E(Z,70,109)=$$PAD^ACRFUTL($P(DATA,U,3),"R",40,"")
 S $E(Z,110,149)=$$PAD^ACRFUTL($P(DATA,U,2),"R",40,"")
 S $E(Z,150,189)=$$PAD^ACRFUTL($P(DATA,U,3),"R",40,"")
 S $E(Z,190,229)=$$PAD^ACRFUTL($P(DATA,U,4),"R",40,"")
 S $E(Z,230,269)=$$PAD^ACRFUTL($P(DATA,U,5),"R",40,"")
 S $E(Z,270,271)=$P(^DIC(5,$P(DATA,U,6),0),U,2)
 S $E(Z,272,280)=$$PAD^ACRFUTL($TR($P(DATA,U,7),"-",""),"R",9,"")
 S $E(Z,281,295)=$$PAD^ACRFUTL("","R",15,"")
 S $E(Z,296,303)=$$PAD^ACRFUTL(ACRCNTB,"L",8,0)
 S $E(Z,304,343)=$$PAD^ACRFUTL($P(DATA,U,13),"R",40,"")
 S $E(Z,344,358)=$$PAD^ACRFUTL($P(DATA,U,14),"R",15,"")
 S $E(Z,359,393)=$$PAD^ACRFUTL($P(DATA1,U,2),"L",35,"")  ;ACR*2.1*6.01
 S $E(Z,394,395)=$$PAD^ACRFUTL("","R",2,"")              ;ACR*2.1*6.01
 S $E(Z,396,410)=$$PAD^ACRFUTL("","R",15,"")             ;ACR*2.1*6.01
 S $E(Z,411,416)=$$PAD^ACRFUTL("","R",6,"")              ;ACR*2.1*6.01
 S $E(Z,417,499)=$$PAD^ACRFUTL("","R",83,"")             ;ACR*2.1*6.01
 S $E(Z,500,507)=$$PAD^ACRFUTL(1,"L",8,0)  ; T record always #1 ACR*2.1*6.01
 S $E(Z,508,517)=$$PAD^ACRFUTL("","R",10,"")             ;ACR*2.1*6.01
 S $E(Z,518)="I"                                         ;ACR*2.1*6.01
 S $E(Z,519,558)=$$PAD^ACRFUTL("","R",40,"")             ;ACR*2.1*6.01
 S $E(Z,559,598)=$$PAD^ACRFUTL("","R",40,"")             ;ACR*2.1*6.01
 S $E(Z,599,638)=$$PAD^ACRFUTL("","R",40,"")             ;ACR*2.1*6.01
 S $E(Z,639,640)=$$PAD^ACRFUTL("","R",2,"")              ;ACR*2.1*6.01
 S $E(Z,641,649)=$$PAD^ACRFUTL("","R",9,"")              ;ACR*2.1*6.01
 S $E(Z,650,689)=$$PAD^ACRFUTL("","R",40,"")             ;ACR*2.1*6.01
 S $E(Z,690,704)=$$PAD^ACRFUTL("","R",15,"")             ;ACR*2.1*6.01
 S $E(Z,705,739)=$$PAD^ACRFUTL("","R",35,"")             ;ACR*2.1*6.01
 S $E(Z,740,740)=$$PAD^ACRFUTL("","R",1,"")              ;ACR*2.1*8.01
 S $E(Z,741,748)=$$PAD^ACRFUTL("","R",8,"")              ;ACR*2.1*8.01
 S $E(Z,749,750)=$$PAD^ACRFUTL("","R",2,"")
 ;
 S ^TMP("ACRZ",$J,"RECORD","T",1)=$E(Z,1,240)
 S ^TMP("ACRZ",$J,"RECORD","T",2)=$E(Z,241,480)
 S ^TMP("ACRZ",$J,"RECORD","T",3)=$E(Z,481,720)
 S ^TMP("ACRZ",$J,"RECORD","T",4)=$E(Z,721,750)
 Q