Step-1:
=====
Create Report Parameter Items.
And
Create Region PLSQL Dynamic Container.
PLSQL Code :
htp.p('
<!--div id="div_print2" align="left"-->');
HTP.P('<div id="printableArea" style="font-size:12px;">');
htp.p('<div id="div_print2" align="left">');
htp.p('<head>');
htp.p('<style>
table tr, td {
border: 1px solid gray;
//border-collapse: collapse;
}
table tr, th {
border: 1px solid gray;
//border-collapse: collapse;
}
table tr.noBorder td {
border: 0;
}
@media print {
header{
position: fixed;
top: 0;
width: 100%;
text-align: center;
}
footer {
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
}
.content-block, p {
page-break-inside: auto; //avoid;
}
}
@page {
size: 12in 8in;
size: portrait ;
}
.rubber_stamp {
font-size: 22px;
font-weight: bold;
color: red;
float: left;
border-radius: 10px;
opacity: 0.8;
-webkit-transform: rotate(-30deg);
-o-transform: rotate(-10deg);
-moz-transform: rotate(-10deg);
-ms-transform: rotate(-10deg);
position: absolute;
}
</style>');
htp.p('</head>');
DECLARE
v_orgnm varchar2(1000);
V_p varchar2(100);
v_orgadd varchar2(1000);
V_LOGO BLOB;
v_TRCD varchar2(3);
v_FYR varchar2(3);
v_LOC number(20);
v_DT date;
v_PRSNO varchar2(20);
v_FROM_LOC varchar2(200);
v_TO_LOC varchar2(20);
v_REQDT date;
V_WORD varchar2(1000);
v_USR varchar2(100);
v_total number :=0;
V_USER varchar2(100);
v_From_Location varchar2(100);
V_PRS_No varchar2(100);
V_PRS_Date DATE;
V_Submit_to varchar2(100);
V_BATCH_NO varchar2(100);
V_Required_Date DATE;
V_QTY varchar2(100);
V_PRODUCT varchar2(100);
V_REMARKS varchar2(100);
BEGIN
---- COMPANY INFORMATION
SELECT GL_COM_NM, GL_COM_OADD,GL_COM_OPHONE
INTO v_orgnm,v_orgadd,V_p FROM GL_COMPANY_logo where rownum = 1;
htp.p('<div id="div_print" align="center" class="page" width="100%">');
HTP.P('
<table border="0" cellpadding="1" cellspacing="0" style="width:100%;font-size:10px; text-align: center;">
<thead>
<tr class="noBorder"><td colspan="53" style="font-size:20px; font-weight:700; text-align: center;">'||v_orgnm||'</td></tr>
<tr class="noBorder"><td colspan="53" style="font-size:12px; text-align: center;">'||v_orgadd||'</td></tr>
<br>
<tr class="noBorder"><td colspan="53" style="font-size:16px; font-weight:700;text-align: center;">Purchase Requsition Slip </td></tr><br> '
);
----- MASTER DATA
SELECT
decode(INV_REQ_LOCATION,3,'Production','') From_Location,
INV_REQ_TRCODE||'-'||INV_REQ_SERIALNO||'/'||INV_REQ_FYEAR PRS_No,
INV_REQ_DATE PRS_Date,
decode(INV_REQ_ILOC,1,'STORE-FAC',3,'PRODUCTION') Submit_to,
INV_REQ_BATCH BATCH_NO,
INV_REQ_REQDATE Required_Date,
INV_REQ_BATCHQTY QTY,
GET_REQ_PRODUCT(INV_REQ_PFOR) PRODUCT,
INV_REQ_REMARKS REMARKS
INTO v_From_Location , V_PRS_No ,V_PRS_Date ,V_Submit_to ,V_BATCH_NO ,V_Required_Date,V_QTY ,V_PRODUCT ,V_REMARKS
FROM INV_REQ_MASTER_TEMP
WHERE INV_REQ_TRCODE='REQ'
AND INV_REQ_FYEAR=:P31_INV_REQ_FYEAR
AND INV_REQ_SERIALNO=:P31_INV_REQ_SERIALNO
AND INV_REQ_LOCATION=:P31_INV_REQ_LOCATION;
HTP.P('
<table cellpadding="1" cellspacing="0" style="width:100%;font-size:12px; ">
<br>
<tr class="noBorder">
<td style="font-size:14px; text-align: right;">From Location : </td>
<td style="font-size:14px; font-weight: bold; text-align: left;">'||v_From_Location||'</td>
<td style="font-size:14px; text-align: right;"> PRS No :</td>
<td style="font-size:14px; font-weight: bold; text-align: left;">'||V_PRS_No||'</td>
<tr class="noBorder" >
<td style="font-size:14px; text-align: right;">PRS Date : </td>
<td style="font-size:14px; font-weight: bold; text-align: left;">'||V_PRS_Date||'</td>
<td style="font-size:14px; text-align: right;"> Submit to : </td>
<td style="font-size:14px; font-weight: bold; text-align: left;">'||V_Submit_to||'</td>
</tr>
<tr class="noBorder" >
<td style="font-size:14px; text-align: right;"> BATCH NO : </td>
<td style="font-size:14px; font-weight: bold; text-align: left;">'||V_BATCH_NO||'</td>
<td style="font-size:14px; text-align: right;"> Qty : </td>
<td style="font-size:14px; font-weight: bold; text-align: left;">'||V_QTY||'</td>
<tr class="noBorder" >
<td style="font-size:14px; text-align: right;"> Product : </td>
<td style="font-size:14px; font-weight: bold; text-align: left;">'||V_PRODUCT||'</td>
<td style="font-size:14px; text-align: right;"> Required Date : </td>
<td style="font-size:14px; font-weight: bold; text-align: left;">'||V_Required_Date||'</td>
</tr>
<tr class="noBorder" >
<td style="font-size:14px; text-align: right;">Remarks : </td>
<td style="font-size:14px; font-weight: bold; text-align: left;">'||V_REMARKS||'</td>
</tr>
</table>
</br>
');
HTP.P('
<table border="1" cellpadding="2" cellspacing="0" style="width:100%;font-size:12px; text-align: center;">
<br>
<thead>
<tr><th rowspan="2">SL#</th>
<th rowspan="2">Item Code</th>
<th rowspan="2">Item Description</th>
<th rowspan="2"> UNIT </th>
<th rowspan="2"> Quantity</th>
<th rowspan="2">Phy. Stock</th>
</tr>
</thead>');
-- htp.p('<table width="75%" style="border-bottom:1px solid black;">');
for i in (
SELECT
B.INV_REQD_SEQ SR,
A.INV_REQ_PFOR ID,
B.INV_REQD_ITEMCD RAWID,
I.ITEM_NM,
DECODE(I.ITM_MUNITCD,3,'KG',' ') MUNIT,
TO_CHAR(B.INV_REQD_QTY,'999G999G999G999G990D00') QTY,
TO_CHAR(B.INV_REQD_PHYQTY,'999G999G999G999G990D00') SOFTQTY
FROM vw_rwitm_bal_qty V, ITEM I, INV_REQ_MASTER_TEMP A, INV_REQ_DETAIL_TEMP B
WHERE B.INV_REQD_ITEMCD = I.ITEM_CD
AND V.loc (+) = 1
and V.item (+) = B.INV_REQD_ITEMCD
AND A.INV_REQ_TRCODE= B.INV_REQD_TRCODE
AND A.INV_REQ_FYEAR = B.INV_REQD_FYEAR
AND A.INV_REQ_SERIALNO = B.INV_REQD_SERIALNO
AND A.INV_REQ_LOCATION = B.INV_REQD_LOCATION
AND INV_REQ_TRCODE='REQ'
AND INV_REQ_FYEAR=:P31_INV_REQ_FYEAR
AND INV_REQ_SERIALNO=:P31_INV_REQ_SERIALNO
AND INV_REQ_LOCATION=:P31_INV_REQ_LOCATION
ORDER BY B.INV_REQD_SEQ ASC
)
LOOP
htp.p('<tr>
<td style="text-align:left;"> '||i.SR|| '</td>
<td style="text-align:left;">'||i.RAWID||' </td>
<td style="text-align:left;">'||i.ITEM_NM||' </td>
<td style="text-align:right;">'||i.MUNIT||' </td>
<td style="text-align:right;">'||i.QTY||' </td>
<td style="text-align:right;">'||i.SOFTQTY||' </td>'
);
end loop;
htp.p('
<table style="width: 100%; text-align: center; font-size:12px;">
<br><br><br>
<tr class="noBorder">
<td>Requested by</td>
<td>Store Dept. </td>
<td>Plant Manager</td>
</tr>
</table>
<br/>
');
htp.p('</div>');
htp.p('</table></div>');
--EXCEPTION when no_data_found then null;WHEN OTHERS THEN RAISE;
END;
HTP.P('</div>');
htp.p('</div>');
Step-2:
=====
Create Classic/IR Report. And add to query null Column (Print).
Select Print Column.
Type : Link
Target : (Classic/IR Report to page item report parameter)
Link Text : <span class="fa fa-print" aria-hidden="true"></span>
Step-3:
=====
Create Button For Print View.
Button Name: Print
Dynamic Action:
Action: Execute JavaScript Code
Code:
function printContent(el){
var restorepage = document.body.innerHTML;
var printcontent = document.getElementById(el).innerHTML;
document.body.innerHTML = printcontent;
window.print();
document.body.innerHTML = restorepage;
}
printContent('printableArea');
location.reload();