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

ABMCPOSS.m

Go to the documentation of this file.
  1. ABMCPOSS ; IHS/SD/SDR - Mark POS bill with invoice number ;
  1. ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
  1. ;
  1. ; This routine will go thru POS Cashiering sessions and if the
  1. ; session is marked as transmitted it will verify there is an
  1. ; Invoice number on the bill and put one if not.
  1. ;
  1. Q
  1. EN ;
  1. K ABMCNT
  1. S DIC="^ABMUTXMT("
  1. S DIC(0)="L"
  1. D NOW^%DTC
  1. S X=%
  1. D ^DIC
  1. K DIC
  1. Q:Y<0
  1. S ABMXIEN=+Y
  1. S DUZ(2)=0
  1. F S DUZ(2)=$O(^ABMUCASH(DUZ(2))) Q:+DUZ(2)=0 D
  1. .W !,DUZ(2)
  1. .S ABMSGNI=0
  1. .F S ABMSGNI=$O(^ABMUCASH(DUZ(2),20,1,20,ABMSGNI)) Q:+ABMSGNI=0 D
  1. ..Q:$P($G(^ABMUCASH(DUZ(2),20,1,20,ABMSGNI,0)),U,4)'="T" ;check transmitted only
  1. ..S ABMBA=0
  1. ..F S ABMBA=$O(^ABMUCASH(DUZ(2),20,1,20,ABMSGNI,11,ABMBA)) Q:+ABMBA=0 D
  1. ...S ABMBILL=0
  1. ...F S ABMBILL=$O(^ABMUCASH(DUZ(2),20,1,20,ABMSGNI,11,ABMBA,2,ABMBILL)) Q:+ABMBILL=0 D
  1. ....S ABMREC=$G(^ABMUCASH(DUZ(2),20,1,20,ABMSGNI,11,ABMBA,2,ABMBILL,0))
  1. ....S ABMDUZ2=$P(ABMREC,U,2)
  1. ....S ABMBDFN=$P(ABMREC,U,3)
  1. ....I $$TRANSMIT^ABMUEAPI(ABMDUZ2,ABMBDFN)<1 D
  1. .....D GETBILL^ABMUCUTL(ABMREC)
  1. .....K DIC,DIE,DIR,X,Y,DA
  1. .....S DIC(0)="L"
  1. .....S DA(1)=ABMBDFN
  1. .....;S X=$P($G(^ABMUCASH(DUZ(2),20,1,20,ABMSGNI,0)),U,8)
  1. .....S X=ABMXIEN
  1. .....S ABMHOLD=DUZ(2)
  1. .....S DUZ(2)=ABMDUZ2
  1. .....S DLAYGO=9002274
  1. .....S DIC="^ABMDBILL(DUZ(2),"_DA(1)_",69,"
  1. .....S DIC("P")=$P(^DD(9002274.4,69,0),U,2)
  1. .....S DIC("DR")=".02////"_ABMPASUF_ABMSASUF_$S(+$G(ABMUAOF)'=0:$E($P($G(^DIC(4,ABMP("LDFN"),0)),U),1),1:"")_ABMP("BDFN")
  1. .....D ^DIC
  1. .....S DUZ(2)=ABMHOLD
  1. .....W !,ABMREC_"^"_$G(DIC("DR"))_"^"_X_"^"_Y
  1. .....S ABMCNT=+$G(ABMCNT)+1
  1. W !,ABMCNT
  1. D REGULAR
  1. Q
  1. REGULAR ;
  1. K ABMCNT
  1. S DUZ(2)=0
  1. F S DUZ(2)=$O(^ABMUCASH(DUZ(2))) Q:+DUZ(2)=0 D
  1. .W !,DUZ(2)
  1. .S ABMUSER=0
  1. .F S ABMUSER=$O(^ABMUCASH(DUZ(2),10,ABMUSER)) Q:+ABMUSER=0 D
  1. ..S ABMSGNI=0
  1. ..F S ABMSGNI=$O(^ABMUCASH(DUZ(2),10,ABMUSER,20,ABMSGNI)) Q:+ABMSGNI=0 D
  1. ...Q:$P($G(^ABMUCASH(DUZ(2),10,ABMUSER,20,ABMSGNI,0)),U,4)'="T" ;check transmitted only
  1. ...S ABMBA=0
  1. ...F S ABMBA=$O(^ABMUCASH(DUZ(2),10,ABMUSER,20,ABMSGNI,11,ABMBA)) Q:+ABMBA=0 D
  1. ....S ABMBILL=0
  1. ....F S ABMBILL=$O(^ABMUCASH(DUZ(2),10,ABMUSER,20,ABMSGNI,11,ABMBA,2,ABMBILL)) Q:+ABMBILL=0 D
  1. .....S ABMREC=$G(^ABMUCASH(DUZ(2),10,ABMUSER,20,ABMSGNI,11,ABMBA,2,ABMBILL,0))
  1. .....S ABMDUZ2=$P(ABMREC,U,2)
  1. .....S ABMBDFN=$P(ABMREC,U,3)
  1. .....I $$TRANSMIT^ABMUEAPI(ABMDUZ2,ABMBDFN)<1 D
  1. ......D GETBILL^ABMUCUTL(ABMREC)
  1. ......K DIC,DIE,DIR,X,Y,DA
  1. ......S DIC(0)="L"
  1. ......S DA(1)=ABMBDFN
  1. ......;S X=$P($G(^ABMUCASH(DUZ(2),10,1,20,ABMSGNI,0)),U,8)
  1. ......S X=ABMXIEN
  1. ......S ABMHOLD=DUZ(2)
  1. ......S DUZ(2)=ABMDUZ2
  1. ......S DLAYGO=9002274
  1. ......S DIC="^ABMDBILL(DUZ(2),"_DA(1)_",69,"
  1. ......S DIC("P")=$P(^DD(9002274.4,69,0),U,2)
  1. ......S DIC("DR")=".02////"_ABMPASUF_ABMSASUF_$S(+$G(ABMUAOF)'=0:$E($P($G(^DIC(4,ABMP("LDFN"),0)),U),1),1:"")_ABMP("BDFN")
  1. ......D ^DIC
  1. ......S DUZ(2)=ABMHOLD
  1. ......W !,ABMREC_"^"_$G(DIC("DR"))_"^"_X_"^"_Y
  1. ......S ABMCNT=+$G(ABMCNT)+1
  1. W !,ABMCNT
  1. Q