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

ABPAPD7A.m

Go to the documentation of this file.
ABPAPD7A ;ALLOCATE APPLIED PAYMENT TRANS.;[ 07/25/91  11:52 AM ]
 ;;1.4;AO PVT-INS TRACKING;*0*;IHS-OKC/KJR;JULY 25, 1991
 W !!,"<<< NOT AN ENTRY POINT - ACCESS DENIED >>>",!! Q
BEGIN ;ENTRY POINT
 ;PROCEDURE TO ALLCOCATE DIRECTLY APPLIED CURRENT TRANSACTIONS
 S ABPACDFN=0 F ABPAI=0:0 D  Q:+ABPACDFN=0
 .S ABPACDFN=$O(ABPA("AP",ABPACDFN)) Q:+ABPACDFN=0
 .Q:$D(^ABPVAO(ABPATDFN,1,ABPACDFN,0))'=1  S ABPADOS=+^(0)
 .F ABPAJ=1:1:6 S @("ABPAP"_ABPAJ)=0
 .S DA=0 F ABPAJ=0:0 D  Q:+DA=0
 ..S DA=$O(ABPA("AP",ABPACDFN,DA)) Q:+DA=0
 ..I $P(ABPA("AP",ABPACDFN,DA),"^",2)="P" D  Q
 ...S ABPAP2=ABPAP2+(+ABPA("AP",ABPACDFN,DA))
 ..I $P(ABPA("AP",ABPACDFN,DA),"^",2)="N" D  Q
 ...S ABPAP3=ABPAP3+(+ABPA("AP",ABPACDFN,DA))
 ..I $P(ABPA("AP",ABPACDFN,DA),"^",2)="D" D  Q
 ...S ABPAP4=ABPAP4+(+ABPA("AP",ABPACDFN,DA))
 ..I $P(ABPA("AP",ABPACDFN,DA),"^",2)="S" D  Q
 ...S ABPAP5=ABPAP5+(+ABPA("AP",ABPACDFN,DA))
 .F ABPAJ=2:1:5 D
 ..S $P(ABPA("CP",ABPADOS,ABPACDFN),"^",ABPAJ)=@("ABPAP"_ABPAJ)
 .S ABPACPD=0 F ABPAJ=2:1:5 S ABPACPD=@("ABPAP"_ABPAJ)+ABPACPD
 .S $P(ABPA("CP",ABPADOS,ABPACDFN),"^",6)=ABPACPD
 ;---------------------------------------------------------------------
 ;THIS PROCEDURE WILL ALLOCATE ANY PAYMENT TRANSACTION NOT DIRECTLY
 ;LINKED TO A SPECIFIC BILL ACCROSS ALL BILLS INVOLVED IN THE TRANS-
 ;ACTION ACCORDING TO THE PROPORTIONAL VALUE OF EACH BILL'S OUT-
 ;STANDING BALANCE AT THE TIME OF ALLOCATION.
 ;DEDUCTIBLE TRANSACTIONS ARE DEDUCTED FROM THE OLDEST BILL OR BILLS
 ;UNTIL THE ENTIRE TRANSACTION HAS BEEN ALLOCATED PRIOR TO ANY OTHER
 ;TRANSACTIONS BEING PROPROTIONATELY ALLOCATED.
 S (ABPA("PB"),ABPA("NB"),ABPA("DB"),ABPA("SB"),ABPACTOB,ABPADOS)=0
 F ABPAI=0:0 D  Q:+ABPADOS=0
 .S ABPADOS=$O(ABPA("HP",ABPADOS)) Q:+ABPADOS=0
 .S DA=0 F ABPAJ=0:0 D  Q:+DA=0
 ..S DA=$O(ABPA("HP",ABPADOS,DA)) Q:+DA=0
 ..F ABPAK=1:1:6 D
 ...S @("ABPAP"_ABPAK)=$P(ABPA("HP",ABPADOS,DA),"^",ABPAK)
 ...S @("ABPAT"_ABPAK)=$P(ABPA("CP",ABPADOS,DA),"^",ABPAK)
 ..S ABPAZ=0 F ABPAX=2:1:5 D
 ...S ABPAY=@("ABPAP"_ABPAX)+@("ABPAT"_ABPAX),ABPAZ=ABPAZ+ABPAY
 ...S $P(ABPA("PP",ABPADOS,DA),"^",ABPAX)=ABPAY
 ..S $P(ABPA("PP",ABPADOS,DA),"^",6)=ABPAZ
 ..S $P(ABPA("PP",ABPADOS,DA),"^")=ABPAP1-ABPAT6
 ..S ABPACTOB=ABPACTOB+(ABPAP1-ABPAT6)
 ..S ABPA("PB")=ABPA("PB")+$P(ABPA("PP",ABPADOS,DA),"^",2)
 ..S ABPA("NB")=ABPA("NB")+$P(ABPA("PP",ABPADOS,DA),"^",3)
 ..S ABPA("DB")=ABPA("DB")+$P(ABPA("PP",ABPADOS,DA),"^",4)
 ..S ABPA("SB")=ABPA("SB")+$P(ABPA("PP",ABPADOS,DA),"^",5)
 I +ABPA("UP","N")<0 D NONCOV^ABPAPD7D
 I +ABPA("UP","D")<0 D DEDUCT^ABPAPD7D
 I +ABPA("UP","S")<0 D PAID^ABPAPD7D
 G BEGIN^ABPAPD7B