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

ACRFCCP1.m

Go to the documentation of this file.
ACRFCCP1 ;IHS/OIRM/DSD/THL,AEF - CREDIT CARD PURCHASE MANAGEMENT REPORTS - CONT; [ 09/23/2005   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**19**;NOV 05, 2001
 ;;ROUTINE TO PRINT THE CREDIT CARD REPORT
PRINT ;EP;TO PRINT CREDIT CARD REPORT
 D CH
 S ACRX=""
 F  S ACRX=$O(^TMP("ACRD",$J,35,ACRX)) Q:ACRX=""!$D(ACRQUIT)  D
 .S (ACR(ACRX),ACRDUZ,ACRT,ACRP)=0
 .F  S ACRDUZ=$O(^TMP("ACRD",$J,35,ACRX,ACRDUZ)) Q:'ACRDUZ!$D(ACRQUIT)  D P1
 .D:$D(ACRBYCAN) CANTOT
 Q
P1 D H1
 S (ACRTOTAL,ACRTOTPD)=0,ACRDOC=""
 F  S ACRDOC=$O(^TMP("ACRD",$J,35,ACRX,ACRDUZ,ACRDOC)) Q:ACRDOC=""!$D(ACRQUIT)  D
 .S ACRDOCDA=^TMP("ACRD",$J,35,ACRX,ACRDUZ,ACRDOC)
 .S ACRDOC0=^ACRDOC(ACRDOCDA,0),ACRREQ=^ACRDOC(ACRDOCDA,"REQ"),ACRREQ2=$G(^ACRDOC(ACRDOCDA,"REQ2")),ACRPO=^ACRDOC(ACRDOCDA,"PO")
 .S ACRDATE=$P(ACRREQ,U,11)
 .D P11
 ;I ACRDUZ'=99999999 S X=$P(^VA(200,ACRDUZ,0),U)  ;ACR*2.1*19.02 IM16848
 I ACRDUZ'=99999999 S X=$$NAME2^ACRFUTL1(ACRDUZ)  ;ACR*2.1*19.02 IM16848
 E  S X="NOT STATED,CARDHOLDER"
 D DASH
 W !?20,"TOTAL CREDIT CARD PURCHASES FOR: "
 W $P($P(X,",",2)," ")," ",$P(X,",")
 W ?90,$J($FN(ACRTOTAL,"P",2),12)
 W ?113,$J($FN(ACRTOTPD,"P",2),12)
 I ACRT'=ACRTOTAL D
 .D DASH
 .W !?20,"TOTAL OF ALL CREDIT CARD PURCHASES:"
 .W ?90,$J($FN(ACRT,"P",2),12)
 .W ?113,$J($FN(ACRP,"P",2),12)
 D PAUSE^ACRFWARN
 W @IOF
 Q
P11 ;
 K DXS,DIP,DC
 S D0=$P(ACRPO,U,5)
 D HEAD
 D ^ACRPCCV
 K DXS,DIP,DC
 S (ACRSSDA,ACRTOT,ACRTOTP,ACRI)=0
 F  S ACRSSDA=$O(^ACRSS("J",ACRDOCDA,ACRSSDA)) Q:'ACRSSDA!$D(ACRQUIT)  D
 .S ACRI=ACRI+1
 .D ITEM
 .D HEAD:$O(^ACRSS("J",ACRDOCDA,ACRSSDA))
 I ACRI>1 D
 .W !?90,"-----------"
 .W ?113,"-----------"
 .W !?20,"TOTAL FOR ",$P(ACRDOC0,U)
 .W ?90,$J($FN(ACRTOT,"P",2),12)
 .W ?113,$J($FN(ACRTOTP,"P",2),12)
 D DASH:$O(^TMP("ACRD",$J,35,ACRX,ACRDUZ,ACRDOC))]""
 D HEAD
 Q
 Q
HEAD1 ;
 D PAUSE^ACRFWARN
H1 Q:$D(ACRQUIT)
 W @IOF
 W !,"RECORD OF CREDIT CARD ORDERS"
 W ?55,"FROM......: "
 S Y=ACRBEGIN
 X ^DD("DD")
 ;I ACRDUZ'=99999999 S X=$P(^VA(200,ACRDUZ,0),U)  ;ACR*2.1*19.02 IM16848
 I ACRDUZ'=99999999 S X=$$NAME2^ACRFUTL1(ACRDUZ)  ;ACR*2.1*19.02 IM16848
 E  S X="NOT STATED,CARDHOLDER"
 W Y
 W !,"CARDHOLDER: ",$P($P(X,",",2)," ")," ",$P(X,",")
 W ?55,"TO........: "
 S Y=ACREND
 X ^DD("DD")
 W Y
 D DASH
 D ^ACRPCCH
 Q
ITEM ;PRINT EACH ITEM
 N X,Y,Z
 S X=^ACRSS(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"REQ2")),ACRPO=$G(^ACRDOC(ACRDOCDA,"PO"))
 .S ACRDATE=$P(ACRREQ,U,11)
 .S ACRAPV=$P($G(^ACROBL(ACRDOCDA,"APV")),U)
 .D:ACRAPV="A"
 ..I ACRDUZ,ACRDUZ'=$P(ACRDOC0,U,25) Q
 ..I ACRBEGIN,ACRDATE<ACRBEGIN Q
 ..I ACREND,ACRDATE>ACREND Q
 ..Q:'$P(ACRPO,U,5)
 ..K ACRCAN
 ..I '$D(ACRBYCAN) S ACRCAN="ACRCAN"
 ..I $D(ACRBYCAN) D  Q:'$D(ACRCAN)
 ...S ACRSSDA=$O(^ACRSS("J",ACRDOCDA,0))
 ...Q:'ACRSSDA
 ...Q:'$D(^ACRSS(ACRSSDA,0))
 ...S ACRCANDA=$P(^ACRSS(ACRSSDA,0),U,5)
 ...Q:'ACRCANDA
 ...Q:'$D(^AUTTCAN(ACRCANDA,0))  S ACRCAN=$P(^(0),U)
 ..S ^TMP("ACRD",$J,35,ACRCAN,$S($P(ACRDOC0,U,25):$P(ACRDOC0,U,25),1:99999999),$P(ACRDOC0,U))=ACRDOCDA
 Q
CANTOT ;PRINT TOTAL FOR EACH CAN
 W !!?20,"TOTAL CREDIT CARD PURCHASES FOR CAN NO.: ",ACRX
 W ?90,$J($FN($P(ACR(ACRX),U),"P",2),12)
 W ?113,$J($FN($P(ACR(ACRX),U,2),"P",2),12)
 D PAUSE^ACRFWARN
 Q
DASH W !
 N I
 F I=1:1:132 W "-"
 Q