bhaveshurvi
New Member
This is progress print option program that, gone on infinite loop.
{mfdtitle.i} /* ****Added by Bhavesh*********** */
DEFINE VARIABLE pagenum AS INTEGER.
DEFINE VARIABLE page1 AS INTEGER.
DEFINE VARIABLE printcpy AS INTEGER.
DEFINE VARIABLE num AS INTEGER.
DEFINE VARIABLE po_no LIKE prh_nbr.
DEFINE VARIABLE po_date LIKE po_ord_date.
DEFINE VARIABLE po_line LIKE pod_line.
DEFINE VARIABLE fmrin AS CHARACTER NO-UNDO.
DEFINE VARIABLE itemno LIKE prh_part.
DEFINE VARIABLE receiver LIKE prh_receiver.
DEFINE VARIABLE rcp_date LIKE prh_rcp_date.
DEFINE VARIABLE user1 LIKE prh_user1.
DEFINE VARIABLE dcno LIKE prh__chr01.
DEFINE VARIABLE blno LIKE prh__chr02.
DEFINE VARIABLE lrno LIKE prh__chr03.
DEFINE VARIABLE trno LIKE prh__chr04.
DEFINE VARIABLE thr LIKE prh__chr05.
DEFINE VARIABLE lrdate LIKE prh__dec01.
DEFINE VARIABLE bldate LIKE prh__dec02.
DEFINE VARIABLE line1 LIKE ad_line1.
DEFINE VARIABLE line2 LIKE ad_line2.
DEFINE VARIABLE line3 LIKE ad_line3.
DEFINE VARIABLE city LIKE ad_city.
DEFINE VARIABLE sname LIKE ad_name.
DEFINE VARIABLE excamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE cesamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE vatamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE stxamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE totamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE scsamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE lineamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE srno AS INTEGER.
DEFINE VARIABLE line4 LIKE prh_line.
DEFINE VARIABLE partno LIKE pt_part.
DEFINE VARIABLE lot LIKE tr_serial.
DEFINE VARIABLE accqty LIKE tr_qty_chg.
DEFINE VARIABLE rejqty LIKE tr_qty_chg.
DEFINE VARIABLE incno AS INTEGER.
/* Report parameter form */
FORM SKIP(1)
fmrin COLON 25 LABEL "From MRIN" SKIP(1)
itemno COLON 25 LABEL "Part no" SKIP(2)
printcpy COLON 25 LABEL "No Copy" SKIP(1)
WITH FRAME a SIDE-LABELS ATTR-SPACE WIDTH 80
TITLE COLOR normal "Sticker Printing Reports".
{&GLUTRRP-P-TAG16}
/* SET EXTERNAL LABELS */
setFrameLabels(FRAME a:HANDLE).
{&GLUTRRP-P-TAG7}
{wbrp01.i}
REPEAT:
IF itemno = hi_char THEN itemno = "".
{&GLUTRRP-P-TAG17}
IF c-application-mode <> 'web' THEN
{&GLUTRRP-P-TAG18}
UPDATE
fmrin
itemno
printcpy
WITH FRAME a.
{wbrp06.i &COMMAND = UPDATE &FIELDS = " fmrin itemno printcpy" &frm = "a"}
{&GLUTRRP-P-TAG19}
IF (c-application-mode <> 'web') OR
(c-application-mode = 'web' AND
(c-web-request BEGINS 'data')) THEN DO:
/* CREATE BATCH INPUT STRING */
bcdparm = "".
{&GLUTRRP-P-TAG20}
{mfquoter.i fmrin }
{mfquoter.i itemno }
{&GLUTRRP-P-TAG21}
IF itemno = "" THEN itemno = hi_char.
{&GLUTRRP-P-TAG22}
END.
/* defining temp tables for the report */
num = printcpy.
DEFINE TEMP-TABLE temp_mst
FIELD mprh_nbr LIKE prh_hist.prh_nbr
FIELD mprh_rcp_date LIKE prh_hist.prh_rcp_date
FIELD mprh_receiver LIKE prh_hist.prh_receiver
FIELD mprh_user1 LIKE prh_hist.prh_user1
FIELD mprh_dcno LIKE prh__chr01
FIELD mprh_blno LIKE prh__chr02
FIELD mprh_lrno LIKE prh__chr03
FIELD mprh_trno LIKE prh__chr04
FIELD mprh_through LIKE prh__chr05
FIELD mprh_lrdate LIKE prh__dec01
FIELD mprh_bldate LIKE prh__dec02
FIELD mad_city LIKE ad_mstr.ad_city
FIELD mad_line1 LIKE ad_mstr.ad_line1
FIELD mad_line2 LIKE ad_mstr.ad_line2
FIELD mad_line3 LIKE ad_mstr.ad_line3
FIELD mad_name LIKE ad_mstr.ad_name
FIELD mpo_ord_date LIKE po_mstr.po_ord_date
FIELD mprh_type LIKE prh_hist.prh_type
FIELD mprh_vend LIKE prh_hist.prh_vend.
DEFINE TEMP-TABLE temp_det
FIELD md_receiver LIKE prh_receiver
FIELD mprh_part LIKE prh_part
FIELD mprh_line LIKE prh_line
FIELD mpt_desc1 LIKE pt_mstr.pt_desc1
FIELD mpt_desc2 LIKE pt_mstr.pt_desc2
FIELD mprh_um LIKE prh_hist.prh_um
FIELD mprh_ps_qty LIKE prh_hist.prh_ps_qty
FIELD mprh_rcvd LIKE prh_hist.prh_rcvd
FIELD mprh_cost LIKE prh_pur_cost.
DEFINE TEMP-TABLE taxdet
FIELD taxref LIKE tx2d_ref
FIELD taxtype LIKE tx2d_tax_type
FIELD tax_amt LIKE tx2d_cur_tax_amt
FIELD tax_line LIKE tx2d_line.
FORM "VIJAYJYOT SEATS PVT. LTD, BASKA" FONT 5 AT 1 "FM/QA/026/00" AT 39 SKIP(0)
"|-------------------------------------------------|" AT 1
"| PART NO. |DESCRIPTION OF GOODS|UM|CH.QTY |" AT 1
"|-----------------|--------------------|--|-------|" AT 1
WITH FRAME hdr NO-BOX NO-LABELS WIDTH 200.
{gpselout.i &printType = "printer"
&printWidth = 132
&pagedFlag = " "
&stream = " "
&appendToFile = " "
&streamedOutputToTerminal = " "
&withBatchOption = "no"
&displayStatementType = 1
&withCancelMessage = "yes"
&pageBottomMargin = 6
&withEmail = "yes"
&withWinprint = "yes"
&defineVariables = "yes"}
FOR EACH temp_mst:
DELETE temp_mst.
END.
FOR EACH temp_det:
DELETE temp_det.
END.
IF fmrin = "" THEN
MESSAGE " Pleasae Enter MRIN No OR Part No: Bhavesh panchal".
FOR EACH qaddb.prh_hist
WHERE (qaddb.prh_hist.prh_receiver = fmrin AND qaddb.prh_hist.prh_part = itemno OR qaddb.prh_hist.prh_receiver = fmrin OR qaddb.prh_hist.prh_part = itemno ) NO-LOCK USE-INDEX prh_receiver:
FIND FIRST temp_mst WHERE mprh_receiver = prh_receiver NO-ERROR.
IF NOT AVAILABLE temp_mst THEN DO:
CREATE temp_mst.
ASSIGN mprh_rcp_date = prh_rcp_date
mprh_receiver = prh_receiver
mprh_user1 = prh_user1
mprh_dcno = prh__chr01
mprh_blno = prh__chr02
mprh_lrno = prh__chr03
mprh_trno = prh__chr04
mprh_through = prh__chr05
mprh_lrdate = prh__dec01
mprh_bldate = prh__dec02.
FIND first ad_mstr WHERE ad_addr = prh_vend NO-LOCK NO-ERROR.
IF AVAILABLE ad_mstr THEN
DO:
ASSIGN mad_line1 = ad_line1
mad_line2 = ad_line2
mad_line3 = ad_line3
mad_city = ad_city
mad_name = ad_name.
END. /* if available ad_mstr */
FIND FIRST po_mstr WHERE po_nbr = prh_nbr NO-LOCK NO-ERROR.
IF AVAILABLE po_mstr THEN
DO:
ASSIGN mprh_nbr = po_nbr
mpo_ord_date = po_ord_date.
END. /* if available po_mstr */
END. /* if not available temp_mst */
END. /* for each prh_hist */
FOR EACH temp_mst where mprh_receiver <> "" NO-LOCK,
EACH prh_hist WHERE prh_receiver = mprh_receiver NO-LOCK:
IF prh_hist.prh_part = itemno THEN
FIND FIRST temp_det WHERE md_receiver = prh_receiver AND mprh_part = prh_part NO-ERROR.
IF NOT AVAILABLE temp_det THEN
DO:
CREATE temp_det.
ASSIGN md_receiver = prh_receiver
mprh_part = prh_part
mprh_ps_qty = prh_ps_qty
mprh_rcvd = prh_rcvd
mprh_um = prh_um
mprh_line = prh_line
mprh_cost = prh_pur_cost.
FIND first pt_mstr WHERE pt_part = prh_part NO-LOCK NO-ERROR.
IF AVAILABLE pt_mstr THEN
DO:
ASSIGN mprh_part = pt_part
mpt_desc1 = pt_desc1
mpt_desc2 = pt_desc2.
END. /* if available pt_mstr */
END. /* if not available temp_det */
END. /* for each temp_mst */
FOR EACH temp_mst WHERE (mprh_receiver = fmrin) NO-LOCK BREAK BY mprh_receiver:
/* FOR EACH temp_mst WHERE (mprh_receiver >= fmrin AND mprh_receiver <= itemno) NO-LOCK BREAK BY mprh_receiver: */
ASSIGN rcp_date = mprh_rcp_date
receiver = mprh_receiver
user1 = mprh_user1
dcno = mprh_dcno
blno = mprh_blno
lrno = mprh_lrno
trno = mprh_trno
thr = mprh_through
lrdate = mprh_lrdate
bldate = mprh_bldate
line1 = mad_line1
line2 = mad_line2
line3 = mad_line3
city = mad_city
sname = mad_name
po_no = mprh_nbr
po_date = mpo_ord_date
page1 = 0
srno = 1
lineamt = 0
pagenum = 1
excamt = 0
cesamt = 0
vatamt = 0
stxamt = 0
scsamt = 0.
RUN dispframehdr.
FOR EACH temp_det WHERE mprh_receiver = md_receiver NO-LOCK BREAK BY md_receiver :
partno = mprh_part.
line4 = mprh_line.
/* it checks for QA entry */
RUN qacheck.
PUT UNFORMATTED "|" AT 1 mprh_part AT 2 "|" AT 19 SUBSTR(mpt_desc1,1,19) FORMAT "x(19)" AT 20 "|" AT 40 mprh_um AT 41 "|" AT 43 mprh_ps_qty FORMAT "->99.99" AT 44 "|" AT 51.
PUT UNFORMATTED "|-------------------------------------------------|" AT 1.
PUT UNFORMATTED "|" AT 1 "MRIN No: " AT 2 receiver AT 12 "|" AT 21 "Lot Serial : " AT 22 lot AT 35 "|" AT 51.
PUT UNFORMATTED "|-------------------------------------------------|" AT 1.
PUT pagenum AT 1.
PUT "bhavesh" TO 20.
RUN prnchk.
page1 = page1 + 1.
ACCUM mprh_ps_qty (TOTAL BY md_receiver).
ACCUM mprh_rcvd (TOTAL BY md_receiver).
lineamt = lineamt + (mprh_rcvd * mprh_cost).
/* it calculates total Tax tax type wise */
RUN calctax.
/* it checks for detail line for the page break */
RUN checkline.
/* it checks for the last partno for that MRIN */
IF LAST-OF(md_receiver) THEN DO:
/* PUT UNFORMATTED "Total : - " AT 30 ACCUM TOTAL BY md_receiver mprh_ps_qty FORMAT "->>>>>>9.99" AT 48 ACCUM TOTAL BY md_receiver mprh_rcvd FORMAT "->>>>>>9.99" AT 59. */
page1 = page1 + 1.
IF page1 < 15 THEN DO:
DO WHILE page1 <> 15 :
PUT SKIP(1).
page1 = page1 + 1.
END. /* do while page1 <> 27 */
END. /* if page1 < 27 */
/* RUN dispreportfoot. */
PUT SKIP(0).
PAGE.
END. /* if last-of(md_receiver) */
END. /* for each temp_det */
END. /* for each temp_mst */
{mfrpexit.i}
HIDE ALL.
{mfreset.i}
END. /* end of reapeat */
{wbrp04.i &frame-spec = a}
/* procedure for displaying page header */
PROCEDURE dispframehdr:
DISP "" WITH FRAME hdr.
END. /* end of procedure dispframehdr */
/* procedure for displaying page footer */
PROCEDURE dispframefoot:
PUT SKIP(0).
END. /* end of procedure dispframefoot */
/* procedure for displaying report footer */
PROCEDURE dispreportfoot:
PUT UNFORMATTED "|----------------------------------------------------------------------------------------|" AT 1.
END. /* end of procedure dispreportfoot */
/* procedure for checking page break */
PROCEDURE CheckLine:
IF 54 - page1 = page1 THEN DO:
PUT SKIP(2).
RUN dispframefoot.
pagenum = pagenum + 1.
page.
RUN dispframehdr.
page1 = 0.
END. /* if 54 - page1 */
END. /* end of procedure checkline */
PROCEDURE prnchk:
IF printcpy > 1 THEN DO:
PUT SKIP(2).
pagenum = pagenum + printcpy.
page.
RUN dispframehdr.
page1 = printcpy.
END. /* if 54 -page1 */
END.
/* procedure for calculating total tax for the MRIN tax type wise */
PROCEDURE calctax :
/* deleting temp-table taxdet */
FOR EACH taxdet :
DELETE taxdet.
END.
FOR EACH tx2d_det WHERE tx2d_ref = receiver AND tx2d_line = line4 AND tx2d_nbr = po_no NO-LOCK BREAK BY tx2d_line BY tx2d_tax_type:
find first taxdet where taxref = tx2d_ref and tax_line = tx2d_line AND tx2d_tax_type = taxtype NO-ERROR.
IF NOT AVAILABLE taxdet THEN DO:
CREATE taxdet.
ASSIGN taxref = tx2d_ref
tax_line = tx2d_line
taxtype = tx2d_tax_type
tax_amt = tx2d_cur_tax_amt.
END. /* if not available taxdet */
END. /* for each tx2d_det */
FOR EACH taxdet NO-LOCK BY taxtype:
incno = 1.
IF taxtype BEGINS 'EXCISE' THEN DO :
ASSIGN excamt = excamt + tax_amt.
END.
IF taxtype BEGINS 'ECESS' THEN DO:
ASSIGN cesamt = cesamt + tax_amt.
END.
IF taxtype BEGINS 'VAT' THEN DO:
ASSIGN vatamt = vatamt + tax_amt.
END.
IF taxtype BEGINS 'SCESS' THEN DO:
ASSIGN scsamt = scsamt + tax_amt.
END.
IF taxtype begins 'CST' then do :
ASSIGN stxamt = stxamt + tax_amt.
END.
incno = incno + 1.
END. /* for each taxdet */
/* PUT UNFORMATTED "EXC" AT 2 excamt FORMAT "->>>>>>9.99" AT 8 "Ecess" AT 20 cesamt FORMAT "->>>>>>9.99" AT 30 "VAT" AT 43 vatamt FORMAT "->>>>>>9.99" AT 50. */
/* calculating total amount for the MRIN */
totamt = lineamt + excamt + cesamt + scsamt + vatamt + stxamt.
END. /* end of procedure calctax */
/* procedure for checking for the QA entry */
PROCEDURE qacheck :
/* initializing variables */
lot = "".
accqty = 0.
rejqty = 0.
FOR EACH tr_hist NO-LOCK WHERE tr_part=partno AND tr_lot=receiver:
ASSIGN lot = tr_serial.
END.
FOR EACH tr_hist NO-LOCK WHERE tr_part=partno AND tr_serial = lot AND tr_loc = '101':
ASSIGN accqty = tr_qty_chg.
END.
FOR EACH tr_hist NO-LOCK WHERE tr_part = partno AND tr_serial = lot AND tr_loc='121' :
ASSIGN rejqty = tr_qty_loc.
END.
END. /* end of procedure qacheck */
{mfdtitle.i} /* ****Added by Bhavesh*********** */
DEFINE VARIABLE pagenum AS INTEGER.
DEFINE VARIABLE page1 AS INTEGER.
DEFINE VARIABLE printcpy AS INTEGER.
DEFINE VARIABLE num AS INTEGER.
DEFINE VARIABLE po_no LIKE prh_nbr.
DEFINE VARIABLE po_date LIKE po_ord_date.
DEFINE VARIABLE po_line LIKE pod_line.
DEFINE VARIABLE fmrin AS CHARACTER NO-UNDO.
DEFINE VARIABLE itemno LIKE prh_part.
DEFINE VARIABLE receiver LIKE prh_receiver.
DEFINE VARIABLE rcp_date LIKE prh_rcp_date.
DEFINE VARIABLE user1 LIKE prh_user1.
DEFINE VARIABLE dcno LIKE prh__chr01.
DEFINE VARIABLE blno LIKE prh__chr02.
DEFINE VARIABLE lrno LIKE prh__chr03.
DEFINE VARIABLE trno LIKE prh__chr04.
DEFINE VARIABLE thr LIKE prh__chr05.
DEFINE VARIABLE lrdate LIKE prh__dec01.
DEFINE VARIABLE bldate LIKE prh__dec02.
DEFINE VARIABLE line1 LIKE ad_line1.
DEFINE VARIABLE line2 LIKE ad_line2.
DEFINE VARIABLE line3 LIKE ad_line3.
DEFINE VARIABLE city LIKE ad_city.
DEFINE VARIABLE sname LIKE ad_name.
DEFINE VARIABLE excamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE cesamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE vatamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE stxamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE totamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE scsamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE lineamt LIKE tx2d_cur_tax_amt.
DEFINE VARIABLE srno AS INTEGER.
DEFINE VARIABLE line4 LIKE prh_line.
DEFINE VARIABLE partno LIKE pt_part.
DEFINE VARIABLE lot LIKE tr_serial.
DEFINE VARIABLE accqty LIKE tr_qty_chg.
DEFINE VARIABLE rejqty LIKE tr_qty_chg.
DEFINE VARIABLE incno AS INTEGER.
/* Report parameter form */
FORM SKIP(1)
fmrin COLON 25 LABEL "From MRIN" SKIP(1)
itemno COLON 25 LABEL "Part no" SKIP(2)
printcpy COLON 25 LABEL "No Copy" SKIP(1)
WITH FRAME a SIDE-LABELS ATTR-SPACE WIDTH 80
TITLE COLOR normal "Sticker Printing Reports".
{&GLUTRRP-P-TAG16}
/* SET EXTERNAL LABELS */
setFrameLabels(FRAME a:HANDLE).
{&GLUTRRP-P-TAG7}
{wbrp01.i}
REPEAT:
IF itemno = hi_char THEN itemno = "".
{&GLUTRRP-P-TAG17}
IF c-application-mode <> 'web' THEN
{&GLUTRRP-P-TAG18}
UPDATE
fmrin
itemno
printcpy
WITH FRAME a.
{wbrp06.i &COMMAND = UPDATE &FIELDS = " fmrin itemno printcpy" &frm = "a"}
{&GLUTRRP-P-TAG19}
IF (c-application-mode <> 'web') OR
(c-application-mode = 'web' AND
(c-web-request BEGINS 'data')) THEN DO:
/* CREATE BATCH INPUT STRING */
bcdparm = "".
{&GLUTRRP-P-TAG20}
{mfquoter.i fmrin }
{mfquoter.i itemno }
{&GLUTRRP-P-TAG21}
IF itemno = "" THEN itemno = hi_char.
{&GLUTRRP-P-TAG22}
END.
/* defining temp tables for the report */
num = printcpy.
DEFINE TEMP-TABLE temp_mst
FIELD mprh_nbr LIKE prh_hist.prh_nbr
FIELD mprh_rcp_date LIKE prh_hist.prh_rcp_date
FIELD mprh_receiver LIKE prh_hist.prh_receiver
FIELD mprh_user1 LIKE prh_hist.prh_user1
FIELD mprh_dcno LIKE prh__chr01
FIELD mprh_blno LIKE prh__chr02
FIELD mprh_lrno LIKE prh__chr03
FIELD mprh_trno LIKE prh__chr04
FIELD mprh_through LIKE prh__chr05
FIELD mprh_lrdate LIKE prh__dec01
FIELD mprh_bldate LIKE prh__dec02
FIELD mad_city LIKE ad_mstr.ad_city
FIELD mad_line1 LIKE ad_mstr.ad_line1
FIELD mad_line2 LIKE ad_mstr.ad_line2
FIELD mad_line3 LIKE ad_mstr.ad_line3
FIELD mad_name LIKE ad_mstr.ad_name
FIELD mpo_ord_date LIKE po_mstr.po_ord_date
FIELD mprh_type LIKE prh_hist.prh_type
FIELD mprh_vend LIKE prh_hist.prh_vend.
DEFINE TEMP-TABLE temp_det
FIELD md_receiver LIKE prh_receiver
FIELD mprh_part LIKE prh_part
FIELD mprh_line LIKE prh_line
FIELD mpt_desc1 LIKE pt_mstr.pt_desc1
FIELD mpt_desc2 LIKE pt_mstr.pt_desc2
FIELD mprh_um LIKE prh_hist.prh_um
FIELD mprh_ps_qty LIKE prh_hist.prh_ps_qty
FIELD mprh_rcvd LIKE prh_hist.prh_rcvd
FIELD mprh_cost LIKE prh_pur_cost.
DEFINE TEMP-TABLE taxdet
FIELD taxref LIKE tx2d_ref
FIELD taxtype LIKE tx2d_tax_type
FIELD tax_amt LIKE tx2d_cur_tax_amt
FIELD tax_line LIKE tx2d_line.
FORM "VIJAYJYOT SEATS PVT. LTD, BASKA" FONT 5 AT 1 "FM/QA/026/00" AT 39 SKIP(0)
"|-------------------------------------------------|" AT 1
"| PART NO. |DESCRIPTION OF GOODS|UM|CH.QTY |" AT 1
"|-----------------|--------------------|--|-------|" AT 1
WITH FRAME hdr NO-BOX NO-LABELS WIDTH 200.
{gpselout.i &printType = "printer"
&printWidth = 132
&pagedFlag = " "
&stream = " "
&appendToFile = " "
&streamedOutputToTerminal = " "
&withBatchOption = "no"
&displayStatementType = 1
&withCancelMessage = "yes"
&pageBottomMargin = 6
&withEmail = "yes"
&withWinprint = "yes"
&defineVariables = "yes"}
FOR EACH temp_mst:
DELETE temp_mst.
END.
FOR EACH temp_det:
DELETE temp_det.
END.
IF fmrin = "" THEN
MESSAGE " Pleasae Enter MRIN No OR Part No: Bhavesh panchal".
FOR EACH qaddb.prh_hist
WHERE (qaddb.prh_hist.prh_receiver = fmrin AND qaddb.prh_hist.prh_part = itemno OR qaddb.prh_hist.prh_receiver = fmrin OR qaddb.prh_hist.prh_part = itemno ) NO-LOCK USE-INDEX prh_receiver:
FIND FIRST temp_mst WHERE mprh_receiver = prh_receiver NO-ERROR.
IF NOT AVAILABLE temp_mst THEN DO:
CREATE temp_mst.
ASSIGN mprh_rcp_date = prh_rcp_date
mprh_receiver = prh_receiver
mprh_user1 = prh_user1
mprh_dcno = prh__chr01
mprh_blno = prh__chr02
mprh_lrno = prh__chr03
mprh_trno = prh__chr04
mprh_through = prh__chr05
mprh_lrdate = prh__dec01
mprh_bldate = prh__dec02.
FIND first ad_mstr WHERE ad_addr = prh_vend NO-LOCK NO-ERROR.
IF AVAILABLE ad_mstr THEN
DO:
ASSIGN mad_line1 = ad_line1
mad_line2 = ad_line2
mad_line3 = ad_line3
mad_city = ad_city
mad_name = ad_name.
END. /* if available ad_mstr */
FIND FIRST po_mstr WHERE po_nbr = prh_nbr NO-LOCK NO-ERROR.
IF AVAILABLE po_mstr THEN
DO:
ASSIGN mprh_nbr = po_nbr
mpo_ord_date = po_ord_date.
END. /* if available po_mstr */
END. /* if not available temp_mst */
END. /* for each prh_hist */
FOR EACH temp_mst where mprh_receiver <> "" NO-LOCK,
EACH prh_hist WHERE prh_receiver = mprh_receiver NO-LOCK:
IF prh_hist.prh_part = itemno THEN
FIND FIRST temp_det WHERE md_receiver = prh_receiver AND mprh_part = prh_part NO-ERROR.
IF NOT AVAILABLE temp_det THEN
DO:
CREATE temp_det.
ASSIGN md_receiver = prh_receiver
mprh_part = prh_part
mprh_ps_qty = prh_ps_qty
mprh_rcvd = prh_rcvd
mprh_um = prh_um
mprh_line = prh_line
mprh_cost = prh_pur_cost.
FIND first pt_mstr WHERE pt_part = prh_part NO-LOCK NO-ERROR.
IF AVAILABLE pt_mstr THEN
DO:
ASSIGN mprh_part = pt_part
mpt_desc1 = pt_desc1
mpt_desc2 = pt_desc2.
END. /* if available pt_mstr */
END. /* if not available temp_det */
END. /* for each temp_mst */
FOR EACH temp_mst WHERE (mprh_receiver = fmrin) NO-LOCK BREAK BY mprh_receiver:
/* FOR EACH temp_mst WHERE (mprh_receiver >= fmrin AND mprh_receiver <= itemno) NO-LOCK BREAK BY mprh_receiver: */
ASSIGN rcp_date = mprh_rcp_date
receiver = mprh_receiver
user1 = mprh_user1
dcno = mprh_dcno
blno = mprh_blno
lrno = mprh_lrno
trno = mprh_trno
thr = mprh_through
lrdate = mprh_lrdate
bldate = mprh_bldate
line1 = mad_line1
line2 = mad_line2
line3 = mad_line3
city = mad_city
sname = mad_name
po_no = mprh_nbr
po_date = mpo_ord_date
page1 = 0
srno = 1
lineamt = 0
pagenum = 1
excamt = 0
cesamt = 0
vatamt = 0
stxamt = 0
scsamt = 0.
RUN dispframehdr.
FOR EACH temp_det WHERE mprh_receiver = md_receiver NO-LOCK BREAK BY md_receiver :
partno = mprh_part.
line4 = mprh_line.
/* it checks for QA entry */
RUN qacheck.
PUT UNFORMATTED "|" AT 1 mprh_part AT 2 "|" AT 19 SUBSTR(mpt_desc1,1,19) FORMAT "x(19)" AT 20 "|" AT 40 mprh_um AT 41 "|" AT 43 mprh_ps_qty FORMAT "->99.99" AT 44 "|" AT 51.
PUT UNFORMATTED "|-------------------------------------------------|" AT 1.
PUT UNFORMATTED "|" AT 1 "MRIN No: " AT 2 receiver AT 12 "|" AT 21 "Lot Serial : " AT 22 lot AT 35 "|" AT 51.
PUT UNFORMATTED "|-------------------------------------------------|" AT 1.
PUT pagenum AT 1.
PUT "bhavesh" TO 20.
RUN prnchk.
page1 = page1 + 1.
ACCUM mprh_ps_qty (TOTAL BY md_receiver).
ACCUM mprh_rcvd (TOTAL BY md_receiver).
lineamt = lineamt + (mprh_rcvd * mprh_cost).
/* it calculates total Tax tax type wise */
RUN calctax.
/* it checks for detail line for the page break */
RUN checkline.
/* it checks for the last partno for that MRIN */
IF LAST-OF(md_receiver) THEN DO:
/* PUT UNFORMATTED "Total : - " AT 30 ACCUM TOTAL BY md_receiver mprh_ps_qty FORMAT "->>>>>>9.99" AT 48 ACCUM TOTAL BY md_receiver mprh_rcvd FORMAT "->>>>>>9.99" AT 59. */
page1 = page1 + 1.
IF page1 < 15 THEN DO:
DO WHILE page1 <> 15 :
PUT SKIP(1).
page1 = page1 + 1.
END. /* do while page1 <> 27 */
END. /* if page1 < 27 */
/* RUN dispreportfoot. */
PUT SKIP(0).
PAGE.
END. /* if last-of(md_receiver) */
END. /* for each temp_det */
END. /* for each temp_mst */
{mfrpexit.i}
HIDE ALL.
{mfreset.i}
END. /* end of reapeat */
{wbrp04.i &frame-spec = a}
/* procedure for displaying page header */
PROCEDURE dispframehdr:
DISP "" WITH FRAME hdr.
END. /* end of procedure dispframehdr */
/* procedure for displaying page footer */
PROCEDURE dispframefoot:
PUT SKIP(0).
END. /* end of procedure dispframefoot */
/* procedure for displaying report footer */
PROCEDURE dispreportfoot:
PUT UNFORMATTED "|----------------------------------------------------------------------------------------|" AT 1.
END. /* end of procedure dispreportfoot */
/* procedure for checking page break */
PROCEDURE CheckLine:
IF 54 - page1 = page1 THEN DO:
PUT SKIP(2).
RUN dispframefoot.
pagenum = pagenum + 1.
page.
RUN dispframehdr.
page1 = 0.
END. /* if 54 - page1 */
END. /* end of procedure checkline */
PROCEDURE prnchk:
IF printcpy > 1 THEN DO:
PUT SKIP(2).
pagenum = pagenum + printcpy.
page.
RUN dispframehdr.
page1 = printcpy.
END. /* if 54 -page1 */
END.
/* procedure for calculating total tax for the MRIN tax type wise */
PROCEDURE calctax :
/* deleting temp-table taxdet */
FOR EACH taxdet :
DELETE taxdet.
END.
FOR EACH tx2d_det WHERE tx2d_ref = receiver AND tx2d_line = line4 AND tx2d_nbr = po_no NO-LOCK BREAK BY tx2d_line BY tx2d_tax_type:
find first taxdet where taxref = tx2d_ref and tax_line = tx2d_line AND tx2d_tax_type = taxtype NO-ERROR.
IF NOT AVAILABLE taxdet THEN DO:
CREATE taxdet.
ASSIGN taxref = tx2d_ref
tax_line = tx2d_line
taxtype = tx2d_tax_type
tax_amt = tx2d_cur_tax_amt.
END. /* if not available taxdet */
END. /* for each tx2d_det */
FOR EACH taxdet NO-LOCK BY taxtype:
incno = 1.
IF taxtype BEGINS 'EXCISE' THEN DO :
ASSIGN excamt = excamt + tax_amt.
END.
IF taxtype BEGINS 'ECESS' THEN DO:
ASSIGN cesamt = cesamt + tax_amt.
END.
IF taxtype BEGINS 'VAT' THEN DO:
ASSIGN vatamt = vatamt + tax_amt.
END.
IF taxtype BEGINS 'SCESS' THEN DO:
ASSIGN scsamt = scsamt + tax_amt.
END.
IF taxtype begins 'CST' then do :
ASSIGN stxamt = stxamt + tax_amt.
END.
incno = incno + 1.
END. /* for each taxdet */
/* PUT UNFORMATTED "EXC" AT 2 excamt FORMAT "->>>>>>9.99" AT 8 "Ecess" AT 20 cesamt FORMAT "->>>>>>9.99" AT 30 "VAT" AT 43 vatamt FORMAT "->>>>>>9.99" AT 50. */
/* calculating total amount for the MRIN */
totamt = lineamt + excamt + cesamt + scsamt + vatamt + stxamt.
END. /* end of procedure calctax */
/* procedure for checking for the QA entry */
PROCEDURE qacheck :
/* initializing variables */
lot = "".
accqty = 0.
rejqty = 0.
FOR EACH tr_hist NO-LOCK WHERE tr_part=partno AND tr_lot=receiver:
ASSIGN lot = tr_serial.
END.
FOR EACH tr_hist NO-LOCK WHERE tr_part=partno AND tr_serial = lot AND tr_loc = '101':
ASSIGN accqty = tr_qty_chg.
END.
FOR EACH tr_hist NO-LOCK WHERE tr_part = partno AND tr_serial = lot AND tr_loc='121' :
ASSIGN rejqty = tr_qty_loc.
END.
END. /* end of procedure qacheck */