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

ACRFIRS2.m

Go to the documentation of this file.
  1. ACRFIRS2 ;IHS/OIRM/DSD/AEF - 1099 RECORD A,B,C,F,T LAYOUTS; [ 07/20/2006 3:48 PM ]
  1. ;;2.1;ADMIN RESOURCE MGT SYSTEM;**1,6,8,20**;NOV 05, 2001
  1. ;
  1. ; This routine is called by ACRFIRS1 to format 1099 record data
  1. ; into a ^TMP global using the record layouts specified in
  1. ; Department of the Treasury Internal Revenue Service
  1. ; Publication 1220 Catalog Number 61275P.
  1. ; Variables are set by ACRFIRS1.
  1. ; Note: All Apha characters must be in upper case
  1. ; EXCEPT e-mail addresses that might be case sensitive
  1. Q
  1. ;RECORDC, RECORDF, RECORDT SUBROUTINES MOVED TO ACRFIRS0;ACR*2.1*8.07
  1. ;
  1. RECORDA(ACRAREA,ACRPMYR,ACRCNTA) ;EP
  1. ;----- CREATE RECORD TYPE A (PAYER)
  1. ;
  1. ;LAYOUT
  1. ;1 - 1 "A" 52 - 52 FOREIGN ENTITY INDICATOR
  1. ;2 - 5 YEAR 53 - 92 FIRST PAYER NAME LINE
  1. ;6 - 11 BLANK 93 -132 SECOND PAYER NAME LINE
  1. ;12 - 20 PAYER'S TIN# 133-133 TRANSFER AGENT INDICATOR
  1. ;21 - 24 PAYER NAME CONTROL 134-173 PAYER SHIPPING ADDRESS
  1. ;25 - 25 LAST FILING INDICATOR 174-213 PAYER CITY
  1. ;26 - 26 COMB FED/STATE FILER 214-215 PAYER STATE
  1. ;27 - 27 TYPE OF RETURN 216-224 PAYER ZIP CODE
  1. ;28 - 41 AMOUNT CODES ;ACR*2.1*8.01
  1. ;42 - 47 BLANK ;ARC*2.1*8.01 225-239 PAYER'S PHONE & EXT
  1. ;48 - 48 ORIGINAL FILE IND 240-499 BLANK ;ACR*2.1*6.01
  1. ;49 - 49 REPLACEMENT FILE IND 500-507 RECORD SEQUENCE # ;ACR*2.1*6.01
  1. ;50 - 50 CORRECTION FILE IND 508-748 BLANK ;ACR*2.1*6.01
  1. ;51 - 51 BLANK 749-750 BLANK OR CR/LF ;ACR*2.1*6.01
  1. ;
  1. ; INPUT:
  1. ; ACRAREA = PAYER NAME
  1. ; ACRPMYR = PAYMENT CALENDAR YEAR
  1. ;
  1. ; RETURNS:
  1. ; ACRCNTA = RECORD A COUNT
  1. ;
  1. N DATA,I,X,Z
  1. S DATA=$$UPPER^ACRFUTL(^ACR1099P(ACRAREA,0)) ; ACR*2.1*6.02
  1. S $E(Z)="A"
  1. S $E(Z,2,5)=ACRPMYR
  1. S $E(Z,6,11)=$$PAD^ACRFUTL("","R",6,"")
  1. S $E(Z,12,20)=$P(DATA,U,8)
  1. S $E(Z,21,24)=$$PAD^ACRFUTL($P(DATA,U,9),"R",4,"")
  1. S $E(Z,25)=$$PAD^ACRFUTL("","R",1,"")
  1. S $E(Z,26)=$$PAD^ACRFUTL("","R",1,"")
  1. S $E(Z,27)="A"
  1. S $E(Z,28,41)=$$PAD^ACRFUTL($P(DATA,U,11),"R",14,"") ;ACR*2.1*8.01
  1. S $E(Z,42,47)=$$PAD^ACRFUTL("","R",6,"") ;ACR*2.1*8.01
  1. ;S $E(Z,28,39)=$$PAD^ACRFUTL($P(DATA,U,11),"R",12,"") ;ACR*2.1*20.11 IM19398
  1. ;S $E(Z,40,47)=$$PAD^ACRFUTL("","R",8,"") ;ACR*2.1*20.11 IM19398
  1. S $E(Z,48)=1
  1. S $E(Z,49)=$$PAD^ACRFUTL("","R",1,"")
  1. S $E(Z,50)=$$PAD^ACRFUTL("","R",1,"")
  1. S $E(Z,51)=$$PAD^ACRFUTL("","R",1,"")
  1. S $E(Z,52)=$$PAD^ACRFUTL("","R",1,"")
  1. S $E(Z,53,92)=$$PAD^ACRFUTL($P(DATA,U,2),"R",40,"")
  1. S $E(Z,93,132)=$$PAD^ACRFUTL($P(DATA,U,3),"R",40,"")
  1. S $E(Z,133)=0
  1. S $E(Z,134,173)=$$PAD^ACRFUTL($P(DATA,U,4),"R",40,"")
  1. S $E(Z,174,213)=$$PAD^ACRFUTL($P(DATA,U,5),"R",40,"")
  1. S $E(Z,214,215)=$P($G(^DIC(5,$P(DATA,U,6),0)),U,2)
  1. S $E(Z,216,224)=$$PAD^ACRFUTL($TR($P(DATA,U,7),"-",""),"R",9,"")
  1. S $E(Z,225,239)=$$PAD^ACRFUTL($P(DATA,U,12),"R",15,"")
  1. S $E(Z,240,499)=$$PAD^ACRFUTL("","R",260,"") ;ACR*2.1*6.01
  1. S $E(Z,500,507)=$$PAD^ACRFUTL(2,"L",8,0) ;"A"RECORD ALWAYS 2 ;ACR*2.1*6.01
  1. S $E(Z,508,748)=$$PAD^ACRFUTL("","R",241,"") ;ACR*2.1*6.01
  1. S $E(Z,749,750)=$$PAD^ACRFUTL("","R",2,"") ;ACR*2.1*6.01
  1. S ACRCNTA=$G(ACRCNTA)+1
  1. ;
  1. S ^TMP("ACRZ",$J,"RECORD","A",ACRAREA,1)=$E(Z,1,240)
  1. S ^TMP("ACRZ",$J,"RECORD","A",ACRAREA,2)=$E(Z,241,480)
  1. S ^TMP("ACRZ",$J,"RECORD","A",ACRAREA,3)=$E(Z,481,720)
  1. S ^TMP("ACRZ",$J,"RECORD","A",ACRAREA,4)=$E(Z,721,750)
  1. Q
  1. RECORDB(ACRPMYR,ACRNAME,ACRTIN,ACRVEND0,ACRAMT,ACRAMTCD,ACRADD,ACRCITY,ACRSTAB,ACRZIP,ACRCNTB,ACRTOT,ACRCNTR,ACRFOR) ;EP ;ACR*2.1*6.01,ACR*2.1*8.05
  1. ;----- CREATE RECORD TYPE B (PAYEE)
  1. ; FOR 1099-MISC
  1. ;LAYOUT:
  1. ;1 - 1 "B" 247-247 FOREIGN COUNTRY INDICATOR
  1. ;2 - 5 PAYMENT YEAR 248-287 FIRST PAYEE NAME LINE
  1. ;6 - 6 CORRECTED RETURN IND 288-327 SECOND PAYEE NAME LINE
  1. ;7 - 10 NAME CONTROL 328-367 BLANK
  1. ;11 - 11 TYPE OF TIN 368-407 PAYEE MAILING ADDRESS
  1. ;12 - 20 PAYEE'S TIN 408-447 BLANK
  1. ;21 - 40 PAYER'S ACCOUNT NO 448-487 PAYEE CITY
  1. ;41 - 44 PAYER'S OFFICE CODE 488-489 PAYEE STATE
  1. ;45 - 54 BLANK 490-498 PAYEE ZIP CODE
  1. ;55 - 66 PAYMENT AMOUNT 1 499-499 BLANK ;ACR*2.1*6.01
  1. ;67 - 78 PAYMENT AMOUNT 2 500-507 RECORD SEQUENCE NUMBER ;ACR*2.1*6.01
  1. ;79 - 90 PAYMENT AMOUNT 3 508-543 BLANK ;ACR*2.1*6.01
  1. ;91 -102 PAYMENT AMOUNT 4 544-544 SECOND TIN NOTICE (OPTIONAL) ;ACR*2.1*6.01
  1. ;103-114 PAYMENT AMOUNT 5 545-546 BLANKS ;ACR*2.1*6.01
  1. ;115-126 PAYMENT AMOUNT 6 547-547 DIRECT SALES INDICATOR ;ACR*2.1*6.01
  1. ;127-138 PAYMENT AMOUNT 7 545-546 BLANKS
  1. ;139-150 PAYMENT AMOUNT 8 547-547 DIRECT SALES INDICATOR
  1. ;151-162 PAYMENT AMOUNT 9 548-662 BLANK
  1. ;163-174 PAYMENT AMOUNT A 663-722 SPECIAL DATA ENTRIES
  1. ;175-186 PAYMENT AMOUNT B ;ACR*2.1*8.02
  1. ; 723-734 STATE INCOME TAX WITHHELD
  1. ;187-198 PAYMENT AMOUNT C 735-746 LOCAL INCOME TAX WITHHELD
  1. ;199-210 PAYMENT AMOUNT D (BLANK FOR 1099) ;ACR*2.1*8.02
  1. ; 747-748 COMBINED FEDERAL/STATE CODE
  1. ;211-222 PAYMENT AMOUNT E (BLANK FOR 1099) ;ACR*2.1*8.02
  1. ; 749-750 BLANK
  1. ;223-246 RESERVED (BLANK) ;ACR*2.1*8.02
  1. ;
  1. ; INPUT:
  1. ; ACRPMYR = PAYMENT CALENDAR YEAR
  1. ; ACRNAME = PAYEE NAME
  1. ; ACRTIN = PAYEE TAX ID NUMBER
  1. ; ACRVEND0 = VENDOR IEN
  1. ; ACRAMT = PAYMENT AMOUNT
  1. ; ACRAMTCD = PAYMENT AMOUNT CODE
  1. ; ACRADD = PAYEE ADDRESS
  1. ; ACRCITY = PAYEE CITY
  1. ; ACRSTAB = PAYEE STATE
  1. ; ACRZIP = PAYEE ZIP
  1. ; ACRCNTR = RECORD SEQUENCE NUMBER ; ACR*2.1*6.01
  1. ;
  1. ; RETURNS:
  1. ; ACRCNTB = RECORD B COUNT
  1. ; ACRCNTR = RECORD SEQUENCE COUNT ; ACR*2.1*6.01
  1. ; ACRTOT( = ARRAY CONTAINING PAYMENT AMOUNT CODE TOTALS
  1. ;
  1. N I,X,Z,ACRTMP
  1. S ACRCNTR=ACRCNTR+1 ;ACR*2.1*6.01
  1. S $E(Z)="B"
  1. S $E(Z,2,5)=ACRPMYR
  1. S $E(Z,6)=$$PAD^ACRFUTL("","R",1,"") ;corrected return indicator
  1. S $E(Z,7,10)=$$PAD^ACRFUTL($$NCTL^ACRFIRS1(ACRNAME),"R",4,"")
  1. S $E(Z,11)=$E(ACRTIN)
  1. S $E(Z,12,20)=$E(ACRTIN,2,10)
  1. S ACRTMP=$$UPPER^ACRFUTL($G(^AUTTVNDR(ACRVEND0,19))) ;ACR*2.1*6.01
  1. S $E(Z,21,40)=$$PAD^ACRFUTL($P(ACRTMP,U,3),"R",20,"") ;ACR*2.1*6.01
  1. S $E(Z,41,44)=$$PAD^ACRFUTL("","R",4,"")
  1. S $E(Z,45,54)=$$PAD^ACRFUTL("","R",10,"")
  1. S $E(Z,55,198)=$$PAD^ACRFUTL(0,"L",144,0)
  1. S ACRAMT=$$PAD^ACRFUTL(+ACRAMT,"L",12,0)
  1. I ACRAMTCD[1 D
  1. . S ACRTOT(1)=$G(ACRTOT(1))+ACRAMT
  1. . S $E(Z,55,66)=ACRAMT
  1. I ACRAMTCD[2 D
  1. . S ACRTOT(2)=$G(ACRTOT(2))+ACRAMT
  1. . S $E(Z,67,78)=ACRAMT
  1. I ACRAMTCD[3 D
  1. . S ACRTOT(3)=$G(ACRTOT(3))+ACRAMT
  1. . S $E(Z,79,90)=ACRAMT
  1. I ACRAMTCD[4 D
  1. . S ACRTOT(4)=$G(ACRTOT(4))+ACRAMT
  1. . S $E(Z,91,102)=ACRAMT
  1. I ACRAMTCD[5 D
  1. . S ACRTOT(5)=$G(ACRTOT(5))+ACRAMT
  1. . S $E(Z,103,114)=ACRAMT
  1. I ACRAMTCD[6 D
  1. . S ACRTOT(6)=$G(ACRTOT(6))+ACRAMT
  1. . S $E(Z,115,126)=ACRAMT
  1. I ACRAMTCD[7 D
  1. . S ACRTOT(7)=$G(ACRTOT(7))+ACRAMT
  1. . S $E(Z,127,138)=ACRAMT
  1. I ACRAMTCD[8 D
  1. . S ACRTOT(8)=$G(ACRTOT(8))+ACRAMT
  1. . S $E(Z,139,150)=ACRAMT
  1. I ACRAMTCD[9 D
  1. . S ACRTOT(9)=$G(ACRTOT(9))+ACRAMT
  1. . S $E(Z,151,162)=ACRAMT
  1. I ACRAMTCD["A" D
  1. . S ACRTOT("A")=$G(ACRTOT("A"))+ACRAMT
  1. . S $E(Z,163,174)=ACRAMT
  1. I ACRAMTCD["B" D
  1. . S ACRTOT("B")=$G(ACRTOT("B"))+ACRAMT
  1. . S $E(Z,175,186)=ACRAMT
  1. I ACRAMTCD["C" D
  1. . S ACRTOT("C")=$G(ACRTOT("C"))+ACRAMT
  1. . S $E(Z,187,198)=ACRAMT
  1. S $E(Z,199,210)=$$PAD^ACRFUTL("","R",12,"") ;ACR*2.1*8.02
  1. S $E(Z,211,222)=$$PAD^ACRFUTL("","R",12,"") ;ACR*2.1*8.02
  1. S $E(Z,223,246)=$$PAD^ACRFUTL("","R",24,"") ;ACR*2.1*8.02
  1. S $E(Z,247)=$$PAD^ACRFUTL(ACRFOR,"R",1,"") ;ACR*2.1*8.05
  1. S $E(Z,248,287)=$$PAD^ACRFUTL(ACRNAME,"R",40,"")
  1. S $E(Z,288,327)=$$PAD^ACRFUTL("","R",40,"")
  1. S $E(Z,328,367)=$$PAD^ACRFUTL("","R",40,"")
  1. S $E(Z,368,407)=$$PAD^ACRFUTL(ACRADD,"R",40,"")
  1. S $E(Z,408,447)=$$PAD^ACRFUTL("","R",40,"")
  1. S $E(Z,448,487)=$$PAD^ACRFUTL(ACRCITY,"R",40,"")
  1. S $E(Z,488,489)=ACRSTAB
  1. S $E(Z,490,498)=$$PAD^ACRFUTL($TR(ACRZIP,"-",""),"R",9,"")
  1. S $E(Z,499)="" ;ACR*2.1*6.01
  1. S $E(Z,500,507)=$$PAD^ACRFUTL(ACRCNTR,"L",8,0) ;ACR*2.1*6.01
  1. S $E(Z,508,543)=$$PAD^ACRFUTL("","R",36,"") ;ACR*2.1*6.01
  1. S $E(Z,544)=$$PAD^ACRFUTL("","R",1,"")
  1. S $E(Z,545,546)=$$PAD^ACRFUTL("","R",2,"")
  1. S $E(Z,547)=$$PAD^ACRFUTL("","R",1,"")
  1. S $E(Z,548,662)=$$PAD^ACRFUTL("","R",115,"")
  1. S $E(Z,663,722)=$$PAD^ACRFUTL("","R",60,"")
  1. S $E(Z,723,734)=$$PAD^ACRFUTL(0,"L",12,0)
  1. S $E(Z,735,746)=$$PAD^ACRFUTL(0,"L",12,0)
  1. S $E(Z,747,748)=$$PAD^ACRFUTL("","R",2,"")
  1. S $E(Z,749,750)=$$PAD^ACRFUTL("","R",2,"")
  1. S ACRCNTB=$G(ACRCNTB)+1
  1. ;
  1. S ^TMP("ACRZ",$J,"RECORD","B",ACRAREA,ACRVEND0,1)=$E(Z,1,240)
  1. S ^TMP("ACRZ",$J,"RECORD","B",ACRAREA,ACRVEND0,2)=$E(Z,241,480)
  1. S ^TMP("ACRZ",$J,"RECORD","B",ACRAREA,ACRVEND0,3)=$E(Z,481,720)
  1. S ^TMP("ACRZ",$J,"RECORD","B",ACRAREA,ACRVEND0,4)=$E(Z,721,750)
  1. Q