161 lines
8.7 KiB
Mathematica
161 lines
8.7 KiB
Mathematica
PRCHQ12A ;(WASH IRMFO)/LKG-RFQ QUOTE VIEW ;8/6/96 20:44
|
|
;;5.1;IFCAP;;Oct 20, 2000
|
|
;Per VHA Directive 10-93-142, this routine should not be modified.
|
|
BUILD(PRCVEN,PRCDA,PRCDA2,PRCTITLE) ;Entry for building Quote report
|
|
N PRCDA3,PRCDA4,PRCF,PRCI,PRCITMDA,PRCJ,PRCK,PRCL,PRCLN,PRCAR,PRCRFQ,PRCSP,PRCT
|
|
N DA,DIC,DIQ,DR,DIWL,DIWR,DIWF,X,Y,PRCDASH S $P(PRCDASH,"-",80)=""
|
|
K ^TMP($J,"RPT") S PRCRFQ=$P(^PRC(444,PRCDA,0),U),$P(PRCSP," ",81)=""
|
|
S (PRCF,DIC)=$P($P(PRCVEN,"(",2),","),DR=".01;4.8;5;18.3;38;46",DA=$P(PRCVEN,";")
|
|
S DIQ="PRCAR(" K ^UTILITY("DIQ1",$J) D EN^DIQ1 K DIQ,DR,^UTILITY("DIQ1",$J)
|
|
S PRCLN="Quote from Dun # "_PRCAR(PRCF,DA,18.3)_" for RFQ #: "_PRCRFQ
|
|
S PRCTITLE=$$CENTER(PRCLN),PRCJ=0
|
|
S PRCLN="Vendor: "_PRCAR(PRCF,DA,.01),PRCLN=$$PAD(PRCLN,50)
|
|
S PRCLN=PRCLN_"Tax ID: "_PRCAR(PRCF,DA,38)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
S PRCLN="Voice Phone #: "_PRCAR(PRCF,DA,5),PRCLN=$$PAD(PRCLN,50)
|
|
S PRCLN=PRCLN_"Fax #: "_PRCAR(PRCF,DA,46)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
S PRCLN="Contact: "_PRCAR(PRCF,DA,4.8)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(" ",79)
|
|
K PRCAR,DA,DIC,DIQ,^UTILITY("DIQ1",$J)
|
|
S DIC=444,DR=24,DA=PRCDA,DA(444.024)=PRCDA2,DR(444.024)="1;2;3;4;5;6;7;8;10;15"
|
|
S DIQ="PRCAR(" D EN^DIQ1 K DIC,DR,DA,^UTILITY("DIQ1",$J)
|
|
S PRCLN="Sellers's Ref #: "_PRCAR(444.024,PRCDA2,1)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
S PRCLN="Quote Contact: "_PRCAR(444.024,PRCDA2,4),PRCLN=$$PAD(PRCLN,50)
|
|
S PRCLN=PRCLN_"Phone #: "_PRCAR(444.024,PRCDA2,5)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
S PRCLN="Government Contract: "_PRCAR(444.024,PRCDA2,10)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
S PRCLN="Effective Date: "_PRCAR(444.024,PRCDA2,2),PRCLN=$$PAD(PRCLN,39)
|
|
S PRCLN=PRCLN_"Receipt Date/Time: "_PRCAR(444.024,PRCDA2,3)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
S PRCLN="FOB: "_PRCAR(444.024,PRCDA2,6),PRCLN=$$PAD(PRCLN,39)
|
|
S PRCLN=PRCLN_"Total of Lines: "_$J($FN(PRCAR(444.024,PRCDA2,15),"",2),9)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
S PRCLN="Number of Items in RFQ: "_($P($G(^PRC(444,PRCDA,2,0)),U,4)+0)
|
|
S PRCLN=$$PAD(PRCLN,39)_"S/H Charges: "_$J($FN(PRCAR(444.024,PRCDA2,7)+0,"",2),12)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
S PRCLN="Number of Items Quoted: "_($P($G(^PRC(444,PRCDA,8,PRCDA2,3,0)),U,4)+0)
|
|
S PRCLN=$$PAD(PRCLN,39)_"Quote Total: "_$J($FN(PRCAR(444.024,PRCDA2,8),"",2),12)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
K PRCAR
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD("Prompt Pay Terms: ",79)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(" Term / % Days",79)
|
|
S PRCDA3=0
|
|
F S PRCDA3=$O(^PRC(444,PRCDA,8,PRCDA2,2,PRCDA3)) Q:PRCDA3'?1.N D
|
|
. K ^UTILITY("DIQ1",$J),DA,DR,PRCAR,DIQ,DIC
|
|
. S DIC=444,DR=24,DA=PRCDA,DA(444.024)=PRCDA2,DR(444.024)=9
|
|
. S DA(444.025)=PRCDA3,DR(444.025)=".01;1",DIQ="PRCAR("
|
|
. D EN^DIQ1 K DIC,DR,DA,DIQ,^UTILITY("DIQ1",$J)
|
|
. S PRCLN=$$PAD(" ",5)_PRCAR(444.025,PRCDA3,.01),PRCLN=$$PAD(PRCLN,18)
|
|
. S PRCLN=PRCLN_$J(PRCAR(444.025,PRCDA3,1),3)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. K PRCAR
|
|
K ^UTILITY("DIQ1",$J) S PRCDA3=0
|
|
F S PRCDA3=$O(^PRC(444,PRCDA,8,PRCDA2,3,PRCDA3)) Q:PRCDA3'?1.N D
|
|
. S DIC=444,DR=24,DA=PRCDA,DA(444.024)=PRCDA2,DR(444.024)=11
|
|
. S DA(444.026)=PRCDA3,DIQ="PRCAR("
|
|
. S DR(444.026)=".01;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;18"
|
|
. D EN^DIQ1 K DIC,DR,DA,DIQ,^UTILITY("DIQ1",$J)
|
|
. S PRCLN="RFQ Line #: "_PRCAR(444.026,PRCDA3,.01),PRCLN=$$PAD(PRCLN,79)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=PRCLN
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=PRCDASH
|
|
. S PRCLN=$$PAD("| RFQ Requirements",78)_"|"
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=PRCLN
|
|
. S PRCITMDA=$O(^PRC(444,PRCDA,2,"B",PRCAR(444.026,PRCDA3,.01),""))
|
|
. I PRCITMDA="" S PRCLN="| **** Line Item #"_PRCAR(444.026,PRCDA3,.01)_" was not in the Request ****",PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,78)_"|"
|
|
. I PRCITMDA]"" D
|
|
. . S PRCLN=$$PAD("| Item Description:",78)_"|"
|
|
. . S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=PRCLN
|
|
. . K ^UTILITY($J,"W") S PRCK=0,DIWL=1,DIWR=70,DIWF=""
|
|
. . F S PRCK=$O(^PRC(444,PRCDA,2,PRCITMDA,2,PRCK)) Q:+PRCK'=PRCK D
|
|
. . . Q:'$D(^PRC(444,PRCDA,2,PRCITMDA,2,PRCK,0)) S X=^(0)
|
|
. . . D ^DIWP
|
|
. . S PRCT=$G(^UTILITY($J,"W",1))
|
|
. . F PRCI=1:1:PRCT D
|
|
. . . S PRCLN="| "_$G(^UTILITY($J,"W",1,PRCI,0))
|
|
. . . S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,78)_"|"
|
|
. . K ^UTILITY($J,"W"),DIWL,DIWR,DIWF
|
|
. . S PRCLN="| FOB: "_$S($P($G(^PRC(444,PRCDA,1)),U)="O":"ORIGIN",1:"DESTINATION")
|
|
. . S PRCLN=$$PAD(PRCLN,30),PRCI=$G(^PRC(444,PRCDA,2,PRCITMDA,0))
|
|
. . S PRCLN=PRCLN_"Quantity: "_$FN($P(PRCI,U,2)+0,"",2),PRCLN=$$PAD(PRCLN,60)
|
|
. . S PRCLN=PRCLN_"Unit: "_$S($P(PRCI,U,3)]"":$P($G(^PRCD(420.5,$P(PRCI,U,3),0)),U),1:"")
|
|
. . S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,78)_"|"
|
|
. . S PRCK=$G(^PRC(444,PRCDA,2,PRCITMDA,3))
|
|
. . I $P(PRCK,U)]"",$P(PRCK,U,2)]"" D
|
|
. . . S PRCL=$P(PRCK,U,10)
|
|
. . . I PRCL="" D
|
|
. . . . S PRCL=$O(^PRCS(410,$P(PRCK,U),"IT","B",$P(PRCK,U,2),"")) Q:PRCL=""
|
|
. . . . S PRCL=$P($G(^PRCS(410,$P(PRCK,U),"IT",PRCL,0)),U,7)
|
|
. . . S PRCLN="| Unit Price: "_$FN(PRCL,"",4),PRCLN=$$PAD(PRCLN,40)
|
|
. . . S PRCLN=PRCLN_"Total Cost: "_$FN($P(PRCI,U,2)*PRCL,"",2)
|
|
. . . S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,78)_"|"
|
|
. . S PRCLN="| Natl Stock #: "_$P(PRCI,U,6),PRCLN=$$PAD(PRCLN,40)
|
|
. . S PRCLN=PRCLN_"Mfg Part #: "_$P(PRCI,U,9),PRCLN=$$PAD(PRCLN,78)_"|"
|
|
. . S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=PRCLN
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=PRCDASH
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD("Quote Information for this Line Item",79)
|
|
. S PRCLN="Vendor's Product #: "_PRCAR(444.026,PRCDA3,1)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD("Description: ",79)
|
|
. S PRCDA4=0,DIWL=1,DIWR=70,DIWF="" K ^UTILITY($J,"W")
|
|
. F S PRCDA4=$O(^PRC(444,PRCDA,8,PRCDA2,3,PRCDA3,2,PRCDA4)) Q:PRCDA4="" D
|
|
. . Q:'$D(^PRC(444,PRCDA,8,PRCDA2,3,PRCDA3,2,PRCDA4,0)) S X=^(0)
|
|
. . D ^DIWP
|
|
. S PRCT=$G(^UTILITY($J,"W",1))
|
|
. F PRCI=1:1:PRCT D
|
|
. . S PRCLN=" "_$G(^UTILITY($J,"W",1,PRCI,0))
|
|
. . S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. K ^UTILITY($J,"W"),DIWL,DIWR,DIWF
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(" ",79)
|
|
. S PRCLN="FOB: "_PRCAR(444.026,PRCDA3,11),PRCLN=$$PAD(PRCLN,40)
|
|
. S PRCLN=PRCLN_"Hazmat Code: "_PRCAR(444.026,PRCDA3,12)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. S PRCLN="Govt Contract: "_PRCAR(444.026,PRCDA3,16),PRCLN=$$PAD(PRCLN,50)
|
|
. S PRCLN=PRCLN_"Quantity: "_PRCAR(444.026,PRCDA3,2)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. S PRCLN="Unit of Purchase: "_PRCAR(444.026,PRCDA3,3),PRCLN=$$PAD(PRCLN,40)
|
|
. S PRCLN=PRCLN_"Unit Cost: "_PRCAR(444.026,PRCDA3,13)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. S PRCLN="Volume Discount %: "_PRCAR(444.026,PRCDA3,14),PRCLN=$$PAD(PRCLN,40)
|
|
. S PRCLN=PRCLN_"Volume Discount Amount: "_PRCAR(444.026,PRCDA3,15)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. S PRCLN="Net Line Amount: "_PRCAR(444.026,PRCDA3,18)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. S PRCLN="Natl Stock #: "_PRCAR(444.026,PRCDA3,5),PRCLN=$$PAD(PRCLN,40)
|
|
. S PRCLN=PRCLN_"Federal Supply Class: "_PRCAR(444.026,PRCDA3,4)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. S PRCLN="Natl Drug Code: "_PRCAR(444.026,PRCDA3,7),PRCLN=$$PAD(PRCLN,40)
|
|
. S PRCLN=PRCLN_"Mfg Part #: "_PRCAR(444.026,PRCDA3,8)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. S PRCLN="Lot #: "_PRCAR(444.026,PRCDA3,9),PRCLN=$$PAD(PRCLN,40)
|
|
. S PRCLN=PRCLN_"Serial #: "_PRCAR(444.026,PRCDA3,10)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. S PRCLN="SIC Code: "_$E(PRCAR(444.026,PRCDA3,6),1,68)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD("Delivery Schedules: ",79)
|
|
. S PRCDA4=0 K ^UTILITY("DIQ1",$J),PRCAR,DIC,DR,DIQ,DA
|
|
. F S PRCDA4=$O(^PRC(444,PRCDA,8,PRCDA2,3,PRCDA3,3,PRCDA4)) Q:PRCDA4'?1.N D
|
|
. . S DIC=444,DR=24,DA=PRCDA,DA(444.024)=PRCDA2,DR(444.024)=11
|
|
. . S DA(444.026)=PRCDA3,DR(444.026)=17,DA(444.027)=PRCDA4,DR(444.027)=".01;1;2;3"
|
|
. . S DIQ="PRCAR(" D EN^DIQ1 K DIC,DR,DA,DIQ,^UTILITY("DIQ1",$J)
|
|
. . S PRCLN=" Schedule #: "_PRCAR(444.027,PRCDA4,.01),PRCLN=$$PAD(PRCLN,40)
|
|
. . S PRCLN=PRCLN_"Date: "_PRCAR(444.027,PRCDA4,1)
|
|
. . S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. . S PRCLN=" Quantity: "_PRCAR(444.027,PRCDA4,2),PRCLN=$$PAD(PRCLN,40)
|
|
. . S PRCLN=PRCLN_"Unit of Purchase: "_PRCAR(444.027,PRCDA4,3)
|
|
. . S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(PRCLN,79)
|
|
. . S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(" ",79)
|
|
. . K PRCAR
|
|
. S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD(" ",79)
|
|
S PRCJ=PRCJ+1,^TMP($J,"RPT",PRCJ)=$$PAD("* End of Quote *",79)
|
|
Q
|
|
PAD(X,Y) ;Pad on right with spaces to specified length
|
|
S X=X_$E(PRCSP,$L(X)+1,Y)
|
|
Q X
|
|
CENTER(X) ;Center Text
|
|
S X=$E(PRCSP,1,79-$L(X)\2)_X,X=$$PAD(X,79)
|
|
Q X
|