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

BAREITDN.m

Go to the documentation of this file.
BAREITDN ; IHS/SD/SDR - EDIT COLLECTION BATCH/ITEMS JAN 15,1997 ;04/10/2008
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**4,23**;OCT 26, 2005
 ; New routine in bar*1.8*4 for DD item 4.1.5.4
 ;
 Q
 ;
EN ;EP
 W !!,"NOTE: Do this option only when posting is not being done.  Regular"
 W !,"posting locks the A/R Transactions file and doesn't allow other edits"
 W !,"to A/R Transactions.",!!
 ;
PICK I $D(BARLIST) D CLEAR^VALM1
 S DIC=$$DIC^XBDIQ1(90050.01)
 S DIC(0)="AEQM"
 D ^DIC
 I Y'>0 G EXIT
 S BARBLDA=+Y
 ; -------------------------------
LIST W !!!,"#",?24,"TRANS"
 W !,"#",?4,"TRANSACTION DT/TM"
 W ?24,"TYPE",?32,"TDN"
 W ?45,"AMOUNT",?56,"BATCH/Item",!
 F B=1:1:80 W "-"
 ;
 S BARTRDA=0,BARCNT=0
 K BARLIST
 F  S BARTRDA=$O(^BARTR(DUZ(2),"AC",BARBLDA,BARTRDA)) Q:'BARTRDA  D
 .S BARTTYP=$$GET1^DIQ(90050.03,BARTRDA_",",101,"E")
 .Q:BARTTYP'="PAYMENT"  ;only allow edit of payments
 .S BARTDTTM=$$TDT^BARDUTL($P($G(^BARTR(DUZ(2),BARTRDA,0)),U))
 .S BARCRD=$$GET1^DIQ(90050.03,BARTRDA_",",2,"E")
 .S BARDEB=$$GET1^DIQ(90050.03,BARTRDA_",",3,"E")
 .S BARBATCH=$P($G(^BARTR(DUZ(2),BARTRDA,0)),U,14)
 .S BARITEM=$P($G(^BARTR(DUZ(2),BARTRDA,0)),U,15)
 .;
 .S BARTDN=""
 .I $P($G(^BARTR(DUZ(2),BARTRDA,1)),U,11) S BARTDN=$P(^(1),U,11)
 .;Transaction TDN
 .I BARTDN="",$P($G(^BARTR(DUZ(2),BARTRDA,0)),U,17) S BARTDN=$P(^(0),U,17)
 .;item TDN
 .I BARTDN="",$P($G(^BARCOL(DUZ(2),BARBATCH,1,BARITEM,0)),U,20) S BARTDN=$P(^(0),U,20)
 .;batch TDN
 .I BARTDN="",$P($G(^BARCOL(DUZ(2),BARBATCH,0)),U,28) S BARTDN=$P(^(0),U,28)
 .;
 .S BARCNT=+$G(BARCNT)+1
 .S BARLIST(BARCNT)=BARTRDA_"^"
 .;
 .W !,$J(BARCNT_".","3R"),?4,BARTDTTM
 .W ?24,BARTTYP
 .W ?32,BARTDN
 .W ?45,$J($FN($S($G(BARCRD):-BARCRD,1:$G(BARDEB)),",",2),"9R")
 .W:+BARBATCH'=0 ?56,$E($P($G(^BARCOL(DUZ(2),BARBATCH,0)),U)_"-"_BARITEM,1,23)
 ;
SELECT W !!
 K DIR,DIC,DIE,DR,DA,X,Y
 S DIR(0)="LO^1:"_BARCNT
 S DIR("A")="Select A/R BILL TRANSACTION: "
 D ^DIR K DIR
 I $D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT) G PICK
 S BARSEL=+Y
 W !!
 D EDIT
 Q
 ;
EDIT ;
 S BARENTRY=$P(BARLIST(BARSEL),U)
 W !!,"Editing transaction: ",$$TDT^BARDUTL($P($G(^BARTR(DUZ(2),BARENTRY,0)),U))
 S BARACCT=$$GET1^DIQ(90050.03,BARENTRY_",",6,"E")
 S BARTTYP=$$GET1^DIQ(90050.03,BARENTRY_",",101,"E")
 S BARCRD=$$GET1^DIQ(90050.03,BARENTRY_",",2,"E")
 S BARDEB=$$GET1^DIQ(90050.03,BARENTRY_",",3,"E")
 S BARBATCH=$P($G(^BARTR(DUZ(2),BARENTRY,0)),U,14)
 S BARITEM=$P($G(^BARTR(DUZ(2),BARENTRY,0)),U,15)
 W !?3,"A/R ACCOUNT: ",BARACCT
 W !?3,BARTTYP_" for "_$J($FN($S($G(BARCRD):-BARCRD,1:$G(BARDEB)),",",2),"9R")
 W !?3,"Collection Batch/Item: ",$P($G(^BARCOL(DUZ(2),BARBATCH,0)),U)_"-"_BARITEM,!!
 ;
 K DIC,DIE,DIR,DA,DR,X,Y
 K BARREV
 S BAROVAL=""
 S DIR(0)="F^6:20"
 I $P($G(^BARTR(DUZ(2),BARENTRY,1)),U,11)'="" D
 .S DIR("A")="REV TREASURY DEP NUMBER/IPAC"
 .S (DIR("B"),BAROVAL)=$P($G(^BARTR(DUZ(2),BARENTRY,1)),U,11)
 I $P($G(^BARTR(DUZ(2),BARENTRY,1)),U,11)="" D
 .S DIR("A")="TREASURY DEPOSIT NUMBER/IPAC"
 .S:$P($G(^BARTR(DUZ(2),BARENTRY,0)),U,17)'="" (DIR("B"),BAROVAL)=$P($G(^BARTR(DUZ(2),BARENTRY,0)),U,17)
 .S:'$D(DIR("B"))&($P($G(^BARCOL(DUZ(2),BARBATCH,1,BARITEM,0)),U,20)'="") (DIR("B"),BAROVAL)=$P($G(^BARCOL(DUZ(2),BARBATCH,1,BARITEM,0)),U,20)
 .S:'$D(DIR("B"))&($P($G(^BARCOL(DUZ(2),BARBATCH,0)),U,28)'="") (DIR("B"),BAROVAL)=$P($G(^BARCOL(DUZ(2),BARBATCH,0)),U,28)
 D ^DIR K DIR
 S BARNVAL=Y
 ;
 I BAROVAL'=BARNVAL D
 .S DIE="^BARTR(DUZ(2),"
 .S DA=BARENTRY
 .;reversal TDN
 .I $P($G(^BARTR(DUZ(2),BARENTRY,1)),U,11)'="" S DR="111////"_BARNVAL,BARREV=""
 .;Transaction TDN
 .I $G(DR)="",$P($G(^BARTR(DUZ(2),BARENTRY,0)),U,17)'="" S DR="17////"_BARNVAL
 .;item TDN
 .I $G(DR)="",$P($G(^BARCOL(DUZ(2),BARBATCH,1,BARITEM,0)),U,20)'="" S DR="17////"_BARNVAL
 .;batch TDN
 .I $G(DR)="",$P($G(^BARCOL(DUZ(2),BARBATCH,0)),U,28)'="" S DR="17////"_BARNVAL
 .I $G(DR)="" S DR="17////"_BARNVAL
 .D ^DIE
 .S DA(1)=BARENTRY
 .S DIC="^BARTR(DUZ(2),"_DA(1)_",12,"
 .S DIC(0)="LMQ"
 .D NOW^%DTC
 .S X=%
 .S DIC("DR")=".02////"_$S($D(BARREV):"111",1:"20")_";.03////"_BAROVAL_";.04////"_BARNVAL_";.05////"_DUZ
 .S DLAYGO=90050
 .S DIC("P")=$P(^DD(90050.03,1201,0),U,2)
 .D ^DIC
 I BAROVAL=BARNVAL D
 .W !!,"NOTHING CHANGED." H 2
 G LIST
EXIT ;
 K BAROVAL,BARNVAL,BARREV,BARENTRY,BARLIST,BARBATCH,BARITEM,BARACCT
 K BARCRD,BARDEB,BARBLDA,BARTRDA,BARCNT,BARTDN,BARSEL
 Q