<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="ibase.webitm.ejb.fin.adv.*" %>
        <%@ page import="ibase.webitm.ejb.fin.*" %>
    <%@ page import="java.sql.Connection" %>
       <%@ page import="ibase.system.config.ConnDriver" %>
       <%@ page import="java.util.ArrayList" %>
        <%@ page import="java.sql.*" %>
    <%@ page import="java.util.HashMap" %>
     <%@ page import="java.text.SimpleDateFormat" %>
    <%@ page import="ibase.webitm.ejb.sys.UtilMethods" %>
    <%@ page import="ibase.utility.E12GenericUtility" %>
     <%@ page import="ibase.webitm.utility.ITMException" %>
    <%--  <jsp:useBean id="fin" scope="session" class="ibase.webitm.ejb.fin.FinCommon"/> --%>
   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<script>

function resizeVideoPage(){
    var width = 1100;
   var height = 900;
   window.resizeTo(width, height);
   window.moveTo(((screen.width - width) / 2), ((screen.height - height) / 2));      
   }



</script>

  <!-- <link rel="stylesheet" href="../css/cd_style_new.css" type="text/css" />  -->
   <link rel="stylesheet" href="../css/bill_status.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bill Status</title>
</head>
  <body onload="resizeVideoPage()" style="overflow:auto;"> 
  
<!-- <body> -->
<%!
private String checkNull(String inp)
{
	if(inp == null)
		inp = " ";
	return inp.trim();
}
%>
<%
/* out.println("JSP CALLED FOR PREVIEW"); */
String xtraParams ="", forcedFlag ="";
String voucherType="",receiptNo="",tranCode="",currCode="",priceList="",tranName="",sundryDescr="";

String purcOrder="",pordType="",suppCode="",siteCodeDlv="",siteCodeBill="",siteCodeOrd="",tranModeDescr="",status="",suppAdd1="",suppAdd2="",suppAdd3="",suppCity="",suppPin="",suppCountryCd="",suppStateCode="",siteDescr="";
String confirmed="",advType="",siteAdd1="",siteAdd2="",siteCity="",suppName="",ordTypeDescr="",statusDescr="",tranMode="";
Date orderDate=null,confDate=null;
double ordAmt=0.0,totAmt=0.0,taxAmt=0.0,advAmt=0.0; 

String adVoucherNo="",adVocTranType="",adVocSuppCode="",adVocBillNo="",adVocBankCd="",adVocConf="",adVocPaid="",adVocPurcOrd="";
double adVocBillAmt=0.0,adVocAdvAmt=0.0,adVocTaxAmt=0.0,adVocTotAmt=0.0,adVocNetAmt=0.0,adVocSuppBillAmt=0.0;
Date advoucherDt=null,adVocBillDt=null,adVocDueDt=null,adVocConfDt=null;
int adVocCnt=0,rcpCnt=0,vocCnt=0;


String rcpNo="",receiptType="",rcpConf="",voucherCre="",rcpSiteCode="",rcpQcReq="",rcpSuppCode="",rcpStatus="",rcpInv="",rcpInvNo="";
double rcpTotAmt=0.0,rcpAdjAmt=0.0,rcpTaxAmt=0.0,rcpAmt=0.0;
Date rcpDate=null,rcpConfDt=null,rcpInvDt=null;


String voucherNo="",vocTranType="",vocSuppCode="",vocBillNo="",vocBankCd="",vocConf="",vocPaid="",vocPurcOrd="",vocRcpNo="";
double vocNetAmt=0.0,vocAdvAmt=0.0,vocBillAmt=0.0,vocTaxAmt=0.0,vocTotAmt=0.0,netAmt1=0.0,vocSuppBillAmt=0.0,vocRcpAmt=0.0;
Date voucherDt=null,vocBillDt=null,vocDueDt=null,vocConfDt=null;



String paymentId="",pmtTranType="",pmtPayMode="",pmtSiteCode="",pmtbankCode="",pmtSundryType="",pmtSundryCode="";
String pmtRefNo="",pmtVochNo="",pmtConf="";
double pmtNetAmt=0.0,pmtTaxAmt=0.0,pmtDiscAmt=0.0;
Date pmtDate=null,pmtRefDate=null,pmtVochDate=null,pmtConfDate=null;
int payCnt=0;


String miscVocNo="",miscVoctype="",miscSundCode="",miscSundType="",miscBillNo="",miscBankCd="",miscPaid="",miscConf="";
Date miscVocDt=null,miscBilldt=null,miscConfDt=null;
double miscAdvAmt=0.0,miscTaxAmt=0.0,miscBillAmt=0.0,miscSuppBillAmt=0.0,miscNetAmt=0.0,miscTotAmt=0.0;
int miscVouCnt=0;

String qcOrdNo="",qcOrdType="",qcItemCd="",qcSiteCd="",qcStatus="",qcQuantity="",qcQtyPass="",qcQtyRej="",qcLocCd="",qcLocCdAprv="",qcLocRej="",qcCampNo="";
Date qcOrdDt=null,qcStartDt=null,qcDueDt=null,qcRelDt=null;
int qcCnt = 0;
Date billDate=null;

boolean isPreview = true;
Connection conn = null;
boolean connStatus=false;
String sql ="";
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null,pstmt3 = null,pstmt4 = null;
ResultSet rs = null,rs1 = null,rs2 = null,rs3=null,rs4=null;
E12GenericUtility e12GenericUtility = new E12GenericUtility();
SimpleDateFormat sdf = new SimpleDateFormat(e12GenericUtility.getApplDateFormat());


HashMap<String, String> adVochMap = new HashMap<String, String>();
HashMap<String, String> miscVochMap = new HashMap<String, String>();
HashMap<String, String> rcpInfoMap = new HashMap<String, String>();
HashMap<String, String> vochMap = new HashMap<String, String>();
HashMap<String, String> pmtMap = new HashMap<String, String>();
HashMap<String, String> qcMap = new HashMap<String, String>();
UtilMethods utilMethods= new UtilMethods();
String tranSer="";
try{



if ( conn == null )
{
	System.out.println("New Connection created");
	ConnDriver connDriver = null;
	connDriver = new ConnDriver();
	conn = connDriver.getConnectDB("DriverITM");
	conn.setAutoCommit(false);
	connDriver = null;
	connStatus = true;
}
purcOrder=request.getParameter("PK_VALUES"); 
 /*--------------------------Purchase order informatrion---------------------------*/
sql = " select purc_order,ord_date,pord_type,supp_code,site_code__dlv,site_code__bill,site_code__ord,status,SITE_ADD1,SITE_ADD2,CITY__SITE,SITE_DESCR, ";
sql = sql + " ord_amt,tax_amt,tot_amt,confirmed,conf_date,adv_type,curr_code,tran_code,price_list,advance,tran_code ,trans_mode ";
sql = sql + " from porder where purc_order=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,purcOrder);  
rs = pstmt.executeQuery();
if(rs.next())
{  
	purcOrder=rs.getString("purc_order");
	orderDate=rs.getDate("ord_date");
	pordType=rs.getString("pord_type");
	suppCode=rs.getString("supp_code");
	siteCodeDlv=rs.getString("site_code__dlv");
	siteCodeBill=rs.getString("site_code__bill");
	siteCodeOrd=rs.getString("site_code__ord");
	status=rs.getString("status");
	ordAmt=rs.getDouble("ord_amt");
	taxAmt=rs.getDouble("tax_amt");
	totAmt=rs.getDouble("tot_amt");
	confirmed=rs.getString("confirmed");
	confDate=rs.getDate("conf_date");
	advType=rs.getString("adv_type");
	siteAdd1=rs.getString("SITE_ADD1");
	siteAdd2=rs.getString("SITE_ADD2");
	siteCity=rs.getString("CITY__SITE");
	siteDescr=rs.getString("SITE_DESCR");
	currCode=rs.getString("curr_code");
	tranCode=rs.getString("tran_code");
	priceList=rs.getString("price_list");
	tranCode=rs.getString("tran_code");
	tranMode=rs.getString("trans_mode");
	advAmt=rs.getDouble("advance");
	
	purcOrder = purcOrder == null ? " " : purcOrder.trim();
	pordType = pordType == null ? " " : pordType.trim();
	suppCode = suppCode == null ? " " : suppCode.trim();
	siteCodeDlv = siteCodeDlv == null ? " " : siteCodeDlv.trim();
	siteCodeBill = siteCodeBill == null ? " " : siteCodeBill.trim();
	siteCodeOrd = siteCodeOrd == null ? " " : siteCodeOrd.trim();
	status = status == null ? " " : status.trim();
	confirmed = confirmed == null ? " " : confirmed.trim();
	advType = advType == null ? " " : advType.trim();
	siteAdd1 = siteAdd1 == null ? " " : siteAdd1.trim();
	siteAdd2 = siteAdd2 == null ? " " : siteAdd2.trim();
	siteCity = siteCity == null ? " " : siteCity.trim();
	siteDescr = siteDescr == null ? " " : siteDescr.trim();
	priceList = priceList == null ? " " : priceList.trim();
	status = status == null ? " " : status.trim();
	tranCode = tranCode == null ? " " : tranCode.trim();
	tranMode = tranMode == null ? " " : tranMode.trim();
	
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;


sql = " select tran_name from transporter where tran_code=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranCode);  
rs = pstmt.executeQuery();
if(rs.next())
{  
	tranName=rs.getString("tran_name");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;

tranName = tranName == null ? " " : tranName.trim();



sql = " select addr1,addr2,addr3,city,state_code,pin,count_code,supp_name from supplier where supp_code=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,suppCode);  
rs = pstmt.executeQuery();
if(rs.next())
{  
	suppAdd1=rs.getString("addr1");
	suppAdd2=rs.getString("addr2");
	suppAdd3=rs.getString("addr3");
	suppCity=rs.getString("city");
	suppStateCode=rs.getString("state_code");
	suppPin=rs.getString("pin");
	suppCountryCd=rs.getString("count_code");
	suppName=rs.getString("supp_name");
	
	suppAdd1 = suppAdd1 == null ? " " : suppAdd1.trim();
	suppAdd2 = suppAdd2 == null ? " " : suppAdd2.trim();
	suppAdd3 = suppAdd3 == null ? " " : suppAdd3.trim();
	suppCity = suppCity == null ? " " : suppCity.trim();
	suppStateCode = suppStateCode == null ? " " : suppStateCode.trim();
	suppPin = suppPin == null ? " " : suppPin.trim();
	suppCountryCd = suppCountryCd == null ? " " : suppCountryCd.trim();
	suppName = suppName == null ? " " : suppName.trim();
			
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;  

 
sql = " select descr from gencodes where fld_name = 'TRANS_MODE' and mod_name = 'X' and rtrim(fld_value)= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranMode);  
rs = pstmt.executeQuery();
if(rs.next())
{  
	tranModeDescr=rs.getString("descr");	
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;

tranModeDescr = tranModeDescr == null ? " " : tranModeDescr.trim();


sql = " select descr from gencodes where UPPER(RTRIM(fld_value))=? and UPPER(RTRIM(FLD_NAME)) = 'PORD_TYPE' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,pordType);  
rs = pstmt.executeQuery();
if(rs.next())
{  
	ordTypeDescr=rs.getString("descr");	
}
rs.close();
rs = null;
pstmt.close();
pstmt = null; 

ordTypeDescr = ordTypeDescr == null ? " " : ordTypeDescr.trim();
System.out.println("ordTypeDescr "+ordTypeDescr);


if("R".equals(status))
{
	statusDescr = "Released";
}
else if("O".equals(status))
{
	statusDescr = "Open";
}
else if("C".equals(status))
{
	statusDescr = "Closed";
}
else if("X".equals(status))
{
	statusDescr = "Cancelled";
}

if("Y".equals(confirmed))
{
	confirmed="Yes";
}
else
{
	confirmed="No";
}
	
/*------------------- Misc Voucher Information-----------------------------------*/
 

sql = " select tran_id,tran_date,vouch_type,sundry_code,sundry_type,bill_no,bill_date ";
sql = sql + " ,bank_code,adv_amt,bill_amt,tax_amt,supp_bill_amt,net_amt,tot_amt,paid,confirmed,conf_date ";
sql = sql + "  from misc_voucher where order_ref=? ";

pstmt = conn.prepareStatement(sql);
pstmt.setString(1,purcOrder);  
rs = pstmt.executeQuery();
while(rs.next())
{  
	miscVouCnt++;
	miscVocNo=rs.getString("tran_id");
	miscVocDt=rs.getDate("tran_date");
	miscVoctype=rs.getString("vouch_type");
	miscSundCode=rs.getString("sundry_code");
	miscSundType=rs.getString("sundry_type");
	miscBillNo=rs.getString("bill_no");
	miscBilldt=rs.getDate("bill_date");
	miscBankCd=rs.getString("bank_code");
	miscAdvAmt=rs.getDouble("adv_amt");
	miscBillAmt=rs.getDouble("bill_amt");
	miscTaxAmt=rs.getDouble("tax_amt");
	miscSuppBillAmt=rs.getDouble("supp_bill_amt");
	miscNetAmt=rs.getDouble("net_amt");
	miscTotAmt=rs.getDouble("tot_amt");
	miscPaid=rs.getString("paid");
	miscConf=rs.getString("confirmed");
	miscConfDt=rs.getDate("conf_date");
	
	
	
	miscVocNo = miscVocNo == null ? " " : miscVocNo.trim();
	miscVoctype = miscVoctype == null ? " " : miscVoctype.trim();
	miscSundCode = miscSundCode == null ? " " : miscSundCode.trim();
	miscSundType = miscSundType == null ? " " : miscSundType.trim();
	miscBillNo = miscBillNo == null ? " " : miscBillNo.trim();
	miscBankCd = miscBankCd == null ? " " : miscBankCd.trim();
	miscPaid = miscPaid == null ? " " : miscPaid.trim();
	
	
	
	if("Y".equals(miscPaid))
	{
		miscPaid="Yes";
	}
	else
	{
		miscPaid="No";
	}
	
	
	if("Y".equals(miscConf))
	{
		miscConf="Yes";
	}
	else
	{
		miscConf="No";
	}
	
	if("A".equals(miscVoctype))
	{
		miscVoctype="Advanced";
	}
	else if("P".equals(miscVoctype))
	{
		miscVoctype="Payment";
	}
	else if("M".equals(miscVoctype))
	{
		miscVoctype="Misc.Voucher";
	}
	else if("D".equals(miscVoctype))
	{
		miscVoctype="Adjustment";
	}
	
	
	
	
    miscVochMap.put("misc_vocNo" + miscVouCnt, miscVocNo);
    if(miscVocDt == null)
    {
    	miscVochMap.put("misc_vocDate" + miscVouCnt, "");
    }
    else
    {
    	miscVochMap.put("misc_vocDate" + miscVouCnt, String.valueOf(sdf.format(miscVocDt)));
    }
    
    miscVochMap.put("misc_vocType" + miscVouCnt, miscVoctype);
    miscVochMap.put("misc_vocSunrCd" + miscVouCnt, miscSundCode);
    miscVochMap.put("misc_vocSundrTy" + miscVouCnt, miscSundType);
    miscVochMap.put("misc_vocBillNo" + miscVouCnt, miscBillNo);
    if(miscBilldt == null)
    {
    	miscVochMap.put("misc_vocBillDt" + miscVouCnt, "");
    }
    else
    {
    	miscVochMap.put("misc_vocBillDt" + miscVouCnt, String.valueOf(sdf.format(miscBilldt)));
    }
    miscVochMap.put("misc_vocBankCd" + miscVouCnt, miscBankCd);
    miscVochMap.put("misc_vocAdvAmt" + miscVouCnt,  utilMethods.getReqDecString(miscAdvAmt,2));
    miscVochMap.put("misc_vocBillAmt" + miscVouCnt,  utilMethods.getReqDecString(miscBillAmt,2));
    miscVochMap.put("misc_vocTaxAmt" + miscVouCnt,  utilMethods.getReqDecString(miscTaxAmt,2));
    miscVochMap.put("misc_vocSuppBillAmt" + miscVouCnt,  utilMethods.getReqDecString(miscSuppBillAmt,2));
    miscVochMap.put("misc_vocNetAmt" + miscVouCnt,  utilMethods.getReqDecString(miscNetAmt,2));
    miscVochMap.put("misc_vocTotAmt" + miscVouCnt,  utilMethods.getReqDecString(miscTotAmt,2));
    miscVochMap.put("misc_vocPaid" + miscVouCnt, miscPaid);
    miscVochMap.put("misc_vocConf" + miscVouCnt, miscConf);
    
    if(miscConfDt == null)
    {
    	miscVochMap.put("misc_vocConfDt" + miscVouCnt, "");
    }
    else
    {
    	miscVochMap.put("misc_vocConfDt" + miscVouCnt, String.valueOf(sdf.format(miscConfDt)));
    }
  
	
	
}//end of while for misc.voucher information

rs.close();
rs = null;
pstmt.close();
pstmt = null; 


/*-----------------Receipt Information---------------------------------------------*/

 		

sql = " select tran_id,tran_date,tran_type,supp_code,confirmed,conf_date, ";
sql = sql + " vouch_created,status,qc_reqd,tot_amt ,tax,adj_amt ,INVOICE_NO ,INVOICE_DATE,STATUS,AMOUNT,site_code,tran_ser ";
sql = sql + " from porcp where purc_order=?  ";

pstmt = conn.prepareStatement(sql);
pstmt.setString(1,purcOrder);  
rs = pstmt.executeQuery();
while(rs.next())
{  
	rcpCnt++;
	rcpNo=rs.getString("tran_id");
	rcpDate=rs.getDate("tran_date");
	receiptType=rs.getString("tran_type");
	rcpSuppCode=rs.getString("supp_code");
	rcpConf=rs.getString("confirmed");
	rcpConfDt=rs.getDate("conf_date");
	rcpStatus=rs.getString("status");
	rcpQcReq=rs.getString("qc_reqd");
	rcpAdjAmt=rs.getDouble("adj_amt");
	rcpTaxAmt=rs.getDouble("tax");
	rcpTotAmt=rs.getDouble("tot_amt");
	rcpAmt=rs.getDouble("AMOUNT");
	rcpInvNo=rs.getString("INVOICE_NO");
	rcpInvDt=rs.getDate("INVOICE_DATE");
	rcpStatus=rs.getString("STATUS");
	rcpSiteCode=rs.getString("site_code");
	tranSer=rs.getString("tran_ser");
	if(tranSer!=null && tranSer.equalsIgnoreCase("P-RET"))
	{
          	if(rcpAdjAmt != 0)
		{
			rcpAdjAmt=-1*rcpAdjAmt;
		}

       		if(rcpTaxAmt != 0)
		{
			rcpTaxAmt=-1*rcpTaxAmt;
		}

       		if(rcpTotAmt != 0)
		{
	 		rcpTotAmt=-1*rcpTotAmt;
		}

       		if(rcpAmt != 0)
		{
			rcpAmt=-1*rcpAmt;
		}
	  
	  
	 
	  
	}
	
	if("Y".equals(rcpConf))
	{
		rcpConf="Yes";
	}
	else
	{
		rcpConf="No";
	}
	
	
	
	if("Y".equals(rcpQcReq))
	{
		rcpQcReq="Yes";
	}
	else
	{
		rcpQcReq="No";
	}
	
	
	if("O".equals(rcpStatus))
	{
		rcpStatus="Open";
	}
	else if("C".equals(rcpStatus))
	{
		rcpStatus="Closed";
	}
	else if("X".equals(rcpStatus))
	{
		rcpStatus="Cancelled";
	}
	
	
	rcpNo = rcpNo == null ? " " : rcpNo.trim();
	receiptType = receiptType == null ? " " : receiptType.trim();
	suppCode = suppCode == null ? " " : suppCode.trim();
	confirmed = confirmed == null ? " " : confirmed.trim();
	voucherCre = voucherCre == null ? " " : voucherCre.trim();
	rcpStatus = rcpStatus == null ? " " : rcpStatus.trim();
	rcpQcReq = rcpQcReq == null ? " " : rcpQcReq.trim();
	rcpInvNo = rcpInvNo == null ? " " : rcpInvNo.trim();
	rcpSiteCode = rcpSiteCode == null ? " " : rcpSiteCode.trim();
	
	rcpInfoMap.put("tran_id" + rcpCnt, rcpNo);
	rcpInfoMap.put("tran_date" + rcpCnt, String.valueOf(sdf.format(rcpDate)));
	rcpInfoMap.put("tran_type" + rcpCnt, receiptType);
	rcpInfoMap.put("supp_code" + rcpCnt, rcpSuppCode);
	rcpInfoMap.put("confirmed" + rcpCnt, rcpConf);

	if(rcpConfDt == null)
	{
		rcpInfoMap.put("conf_date" + rcpCnt,"");	
	}
	else
	{
		rcpInfoMap.put("conf_date" + rcpCnt, String.valueOf(sdf.format(rcpConfDt)));
	}
	
	rcpInfoMap.put("status" + rcpCnt, rcpStatus);
	rcpInfoMap.put("qc_reqd" + rcpCnt, rcpQcReq);
	rcpInfoMap.put("tot_amt" + rcpCnt, utilMethods.getReqDecString(rcpTotAmt,2));
	rcpInfoMap.put("adj_amt" + rcpCnt, utilMethods.getReqDecString(rcpAdjAmt,2));
	rcpInfoMap.put("tax_amt" + rcpCnt, utilMethods.getReqDecString(rcpTaxAmt,2));
	rcpInfoMap.put("amount" + rcpCnt, utilMethods.getReqDecString(rcpAmt,2));
	rcpInfoMap.put("invoice_no" + rcpCnt, rcpInvNo);	
	if(rcpInvDt == null)
	{
		rcpInfoMap.put("inv_date" + rcpCnt, "");	
	}
	else
	{
		rcpInfoMap.put("inv_date" + rcpCnt, String.valueOf(sdf.format(rcpInvDt)));
	}
	
	
	rcpInfoMap.put("status" + rcpCnt, rcpStatus);
	rcpInfoMap.put("purc_order" + rcpCnt, purcOrder);
	rcpInfoMap.put("site_code" + rcpCnt, rcpSiteCode);
			 
	/*------------------------QC order Information-------------------------------------------*/
	
	
	 sql = " select QORDER_NO,QORDER_TYPE,QORDER_DATE,ITEM_CODE,SITE_CODE,QUANTITY,QTY_PASSED,QTY_REJECTED,START_DATE,DUE_DATE,REL_DATE   ";
	sql = sql + " ,LOC_CODE__REJ,STATUS,CAMPGN_NO ,status,loc_code,LOC_CODE__APRV ";
	sql = sql + "  from QC_ORDER ";
	sql = sql + " where porcp_no=? ";

	pstmt4 = conn.prepareStatement(sql);
	pstmt4.setString(1,rcpNo);  
	rs4 = pstmt4.executeQuery();
	while(rs4.next())
	{ 
		
		qcCnt++;
		qcOrdNo=rs4.getString("QORDER_NO");
		
		qcOrdType=rs4.getString("QORDER_TYPE");
		qcOrdDt=rs4.getDate("QORDER_DATE");
		qcItemCd=rs4.getString("ITEM_CODE");
		qcSiteCd=rs4.getString("SITE_CODE");
		qcQuantity=rs4.getString("QUANTITY");
		qcQtyPass=rs4.getString("QTY_PASSED");
		qcQtyRej=rs4.getString("QTY_REJECTED");
		 qcStartDt=rs4.getDate("START_DATE");
		qcDueDt=rs4.getDate("DUE_DATE");
		//qcRelDt=rs4.getDate("REL_DATE");
		qcLocCd=rs4.getString("LOC_CODE");
		//out.println("qcLocCd :"+qcLocCd);
		qcLocCdAprv=rs4.getString("LOC_CODE__APRV");
		//out.println("qcLocCdAprv :"+qcLocCdAprv);
		qcLocRej=rs4.getString("LOC_CODE__REJ");
		qcStatus=rs4.getString("STATUS");
		qcCampNo=rs4.getString("CAMPGN_NO"); 
		
		
		
		if("I".equals(qcOrdType))
		{
			qcOrdType="Inspect";
		}
		else if("S".equals(qcOrdType))
		{
			qcOrdType="Sampling";
		}
		else if("C".equals(qcOrdType))
		{
			qcOrdType="Customer Spec.";
		}
		else if("M".equals(qcOrdType))
		{
			qcOrdType="Manufacturing";
		}
		
		
		if("A".equals(qcStatus))
		{
			qcStatus="Approved";
		}
		else if("U".equals(qcStatus))
		{
			qcStatus="UnApproved";
		}
		else if("R".equals(qcStatus))
		{
			qcStatus="Rejected";
		}
		else if("C".equals(qcStatus))
		{
			qcStatus="Closed";
		}
		
		
		
		qcOrdNo = qcOrdNo == null ? " " : qcOrdNo.trim();
		qcOrdType = qcOrdType == null ? " " : qcOrdType.trim();
		qcItemCd = qcItemCd == null ? " " : qcItemCd.trim();
		qcSiteCd = qcSiteCd == null ? " " : qcSiteCd.trim();
		qcQuantity = qcQuantity == null ? " " : qcQuantity.trim();
		qcQtyPass = qcQtyPass == null ? " " : qcQtyPass.trim();
		qcQtyRej = qcQtyRej == null ? " " : qcQtyRej.trim();
		qcLocCd = qcLocCd == null ? " " : qcLocCd.trim();
		qcLocCdAprv = qcLocCdAprv == null ? " " : qcLocCdAprv.trim();
		qcLocRej = qcLocRej == null ? " " : qcLocRej.trim();
		qcStatus = qcStatus == null ? " " : qcStatus.trim();
		qcCampNo = qcCampNo == null ? " " : qcCampNo.trim();
		
		
		
		qcMap.put("qc_order" + qcCnt, qcOrdNo);
		qcMap.put("qc_ordType" + qcCnt, qcOrdType);
		if(qcOrdDt == null)
		{
			qcMap.put("qc_ordDt" + qcCnt, "");
		}
		else
		{
			qcMap.put("qc_ordDt" + qcCnt,  String.valueOf(sdf.format(qcOrdDt)));
		}
		qcMap.put("qc_receiptNo" + qcCnt, rcpNo);
		qcMap.put("qc_ItemCd" + qcCnt, qcItemCd);
		qcMap.put("qc_SiteCd" + qcCnt, qcSiteCd);
		qcMap.put("qc_quantity" + qcCnt, qcQuantity);
		qcMap.put("qc_qtypass" + qcCnt, qcQtyPass);
		qcMap.put("qc_qtyRej" + qcCnt, qcQtyRej);
		
		if(qcStartDt == null)
		{
			qcMap.put("qc_StartDt" + qcCnt, "");
		}
		else
		{
			qcMap.put("qc_StartDt" + qcCnt,  String.valueOf(sdf.format(qcStartDt)));
		}
		
		if(qcDueDt == null)
		{
			qcMap.put("qc_dueDt" + qcCnt, "");
		}
		else
		{
			qcMap.put("qc_dueDt" + qcCnt,  String.valueOf(sdf.format(qcDueDt)));
		}
		
		
		if(qcRelDt == null)
		{
			qcMap.put("qc_relDt" + qcCnt, "");
		}
		else
		{
			qcMap.put("qc_relDt" + qcCnt,  String.valueOf(sdf.format(qcRelDt)));
		}
		
		qcMap.put("qc_locCd" + qcCnt, qcLocCd);
		qcMap.put("qc_locCdAprv" + qcCnt, qcLocCdAprv);
		qcMap.put("qc_locRej" + qcCnt, qcLocRej);
		qcMap.put("qc_status" + qcCnt, qcStatus);
		qcMap.put("qc_CampNo" + qcCnt, qcCampNo);
		qcMap.put("qc_status" + qcCnt, qcStatus);
		
		
		
	}//end of while for QC information
	rs4.close();
	rs4 = null;
	pstmt4.close();
	pstmt4 = null; 
	
	
	
	/*---------------Voucher Information---------------------------------------------*/
	
	 sql = "  select distinct v.tran_id,v.tran_date,v.tran_type,v.supp_code,v.bill_no,v.bill_amt,v.bill_date, ";
	sql = sql + " v.bank_code,v.due_date,v.adv_amt,v.bill_amt,v.tax_amt,v.tot_amt, ";
	sql = sql + " v.confirmed,v.conf_date,v.paid,v.net_amt,v.vouch_type,v.PURC_ORDER,v.DUE_DATE,v.SUPP_BILL_AMT,'"+rcpNo+"' prcp_id  ";
	sql = sql + " from voucher v  where v.purc_order=? and v.tran_id in(select distinct tran_id from vouchrcp where prcp_id=?) ";

	pstmt1 = conn.prepareStatement(sql);
	pstmt1.setString(1,purcOrder);  
	pstmt1.setString(2,rcpNo);  
	rs1 = pstmt1.executeQuery();
	while(rs1.next())
	{  
		vocCnt++;
		voucherNo=rs1.getString("tran_id");
		voucherDt=rs1.getDate("tran_date");
		vocTranType=rs1.getString("vouch_type");
		vocSuppCode=rs1.getString("supp_code");
		vocBillNo=rs1.getString("bill_no");
		vocBillAmt=rs1.getDouble("bill_amt");
		vocBillDt=rs1.getDate("bill_date");
		vocBankCd=rs1.getString("bank_code");
		vocDueDt=rs1.getDate("due_date");
		vocAdvAmt=rs1.getDouble("adv_amt");
		vocBillAmt=rs1.getDouble("bill_amt");
		vocTaxAmt=rs1.getDouble("tax_amt");
		vocTotAmt=rs1.getDouble("tot_amt");
		vocConf=rs1.getString("confirmed");
		vocConfDt=rs1.getDate("conf_date");
		vocPaid=rs1.getString("paid");
		vocNetAmt=rs1.getDouble("net_amt");
	    vocPurcOrd=rs1.getString("purc_order");
		vocRcpNo=rs1.getString("prcp_id");
		//vocRcpAmt=rs1.getDouble("rcp_amt");
		
		//out.println("vocConfDt :"+vocConfDt);
		
		if("Y".equals(vocPaid))
		{
			vocPaid="Yes";
		}
		else
		{
			vocPaid="No";
		}
		
		
		if("A".equals(vocTranType))
		{
			vocTranType="Advanced";
		}
		else if("P".equals(vocTranType))
		{
			vocTranType="Payment";
		}
		else if("M".equals(vocTranType))
		{
			vocTranType="Misc.Voucher";
		}
		else if("D".equals(vocTranType))
		{
			vocTranType="Adjustment";
		}
		
		
		
		if("Y".equals(vocConf))
	    {
			vocConf="Yes";
	    }
	    else
	    {
	    	vocConf="No";
	    }

		voucherNo = voucherNo == null ? " " : voucherNo.trim();
		vocTranType = vocTranType == null ? " " : vocTranType.trim();
		vocSuppCode = vocSuppCode == null ? " " : vocSuppCode.trim();
		vocBillNo = vocBillNo == null ? " " : vocBillNo.trim();
		vocBankCd = vocBankCd == null ? " " : vocBankCd.trim();
		vocConf = vocConf == null ? " " : vocConf.trim();
		vocPaid = vocPaid == null ? " " : vocPaid.trim();
		vocPurcOrd = vocPurcOrd == null ? " " : vocPurcOrd.trim();
		vocRcpNo = vocRcpNo == null ? " " : vocRcpNo.trim();
		//vocConfDt = vocConfDt == null ? " " : vocConfDt;

		
		
		vochMap.put("tran_id" + vocCnt, voucherNo);
		vochMap.put("tran_date" + vocCnt, String.valueOf(sdf.format(voucherDt)));
	 	vochMap.put("tran_type" + vocCnt, vocTranType);
		vochMap.put("supp_code" + vocCnt, vocSuppCode);
		vochMap.put("bill_no" + vocCnt, vocBillNo);
		vochMap.put("bill_amt" + vocCnt,utilMethods.getReqDecString(vocBillAmt, 2));
		if(vocBillDt == null)
		{
			vochMap.put("bill_date" + vocCnt, "");	
		}
		else
		{
			vochMap.put("bill_date" + vocCnt, String.valueOf(sdf.format(vocBillDt)));
		}
		
		vochMap.put("bank_code" + vocCnt, vocBankCd);
		
		if(vocDueDt == null)
		{
			vochMap.put("due_date" + vocCnt, "");
		}
		else
		{
			vochMap.put("due_date" + vocCnt, String.valueOf(sdf.format(vocDueDt)));	
		}
		
		
		vochMap.put("adv_amt" + vocCnt, utilMethods.getReqDecString(vocAdvAmt,2));
		vochMap.put("bill_amt" + vocCnt, utilMethods.getReqDecString(vocBillAmt,2));
		vochMap.put("tax_amt" + vocCnt, utilMethods.getReqDecString(vocTaxAmt,2));
		vochMap.put("net_amt" + vocCnt, utilMethods.getReqDecString(vocNetAmt,2));
		vochMap.put("tot_amt" + vocCnt, utilMethods.getReqDecString(vocTotAmt,2));
		vochMap.put("confirmed" + vocCnt, vocConf);
		if(vocConfDt == null)
		{
			vochMap.put("conf_date" + vocCnt, "");
		}
		else
		{
			vochMap.put("conf_date" + vocCnt, String.valueOf(sdf.format(vocConfDt)));	
		}
		
		vochMap.put("paid" + vocCnt, vocPaid);
		vochMap.put("net_amt" + vocCnt, utilMethods.getReqDecString(vocNetAmt,2)); 
		//vochMap.put("purc_order" + vocCnt, vocPurcOrd);
		vochMap.put("supp_bill_amt" + vocCnt, utilMethods.getReqDecString(vocSuppBillAmt,2));
		vochMap.put("rcp_no" + vocCnt, vocRcpNo);
	//	vochMap.put("rcp_amt" + vocCnt, utilMethods.getReqDecString(vocRcpAmt,2));
		
		
/*---------------------payment Information------------------------------------------------------------*/
    System.out.println("========Payment Information=========");
 
    sql = " select pmt.tran_id,pmt.tran_date,pmt.tran_type,pmt.pay_mode,pmt.site_code,pmt.bank_code ";
	sql = sql + "  ,pmt.sundry_type,pmt.sundry_code,pmt.ref_no,pmt.ref_date,pmtdet.pay_amt,pmt.tax_amt,pmt.discount_amt,pmt.confirmed,pmt.conf_date ";
	sql = sql + " ,pmtdet.vouch_no,pmtdet.vouch_date ";
	sql = sql + " from misc_payment pmt,misc_paydet pmtdet where pmtdet.tran_id = pmt.tran_id ";
	sql = sql + " and pmtdet.vouch_no=? ";
	pstmt2 = conn.prepareStatement(sql);
	pstmt2.setString(1,voucherNo);  
	
	rs2 = pstmt2.executeQuery();
	while(rs2.next())
	{ 
		payCnt++;
		paymentId=rs2.getString("tran_id");
		pmtDate=rs2.getDate("tran_date");
		pmtTranType=rs2.getString("tran_type");
		pmtPayMode=rs2.getString("pay_mode");
		pmtSiteCode=rs2.getString("site_code");
		pmtbankCode=rs2.getString("bank_code");
		pmtSundryType=rs2.getString("sundry_type");
		pmtSundryCode=rs2.getString("sundry_code");
		pmtRefNo=rs2.getString("ref_no");
		pmtRefDate=rs2.getDate("ref_date");
		//pmtNetAmt=rs2.getDouble("net_amt");
		pmtNetAmt=rs2.getDouble("pay_amt");
		pmtTaxAmt=rs2.getDouble("tax_amt");
		pmtDiscAmt=rs2.getDouble("discount_amt");
		pmtVochNo=rs2.getString("vouch_no");
		pmtVochDate=rs2.getDate("vouch_date");
		pmtConf=rs2.getString("confirmed");
		pmtConfDate=rs2.getDate("conf_date");
		
		
		 paymentId = paymentId == null ? " " : paymentId.trim();
		pmtTranType = pmtTranType == null ? " " : pmtTranType.trim();
		pmtPayMode = pmtPayMode == null ? " " : pmtPayMode.trim();
		pmtSiteCode = pmtSiteCode == null ? " " : pmtSiteCode.trim();
		pmtbankCode = pmtbankCode == null ? " " : pmtbankCode.trim();
		pmtSundryType = pmtSundryType == null ? " " : pmtSundryType.trim();
		pmtSundryCode = pmtSundryCode == null ? " " : pmtSundryCode.trim();
		pmtRefNo = pmtRefNo == null ? " " : pmtRefNo.trim();
		pmtVochNo = pmtVochNo == null ? " " : pmtVochNo.trim();
		pmtConf = pmtConf == null ? " " : pmtConf.trim();
		
		System.out.println("pmtSundryType :"+pmtSundryType);
		
		sql = " select descr FROM sundry_type where sundry_type=? ";
		pstmt3 = conn.prepareStatement(sql);
		pstmt3.setString(1,pmtSundryType);  
		rs3 = pstmt3.executeQuery();
		if(rs3.next())
		{  
			sundryDescr=rs3.getString("descr");
		}
		rs3.close();
		rs3 = null;
		pstmt3.close();
		pstmt3 = null;

		sundryDescr = sundryDescr == null ? " " : sundryDescr.trim();
		
		
		
		if("Y".equals(pmtConf))
	    {
			pmtConf="Yes";
	    }
	    else
	    {
	    	pmtConf="No";
	    }
		
		
		if("Q".equals(pmtPayMode))
		{
			pmtPayMode="Cheque";
		}
		else if("D".equals(pmtPayMode))
		{
			pmtPayMode="Draft";
		}
		else if("C".equals(pmtPayMode))
		{
			pmtPayMode="Cash";
		}
		else if("P".equals(pmtPayMode))
		{
			pmtPayMode="Pay Order";
		}
		else if("E".equals(pmtPayMode))
		{
			pmtPayMode="EDI";
		}
		else if("T".equals(pmtPayMode))
		{
			pmtPayMode="Electronic";
		}
		
		
		if("O".equals(pmtTranType))
		{
			pmtTranType="Out Station";
		}
		else if("L".equals(pmtTranType))
		{
			pmtTranType="Local";
		}
		
		
		
		pmtMap.put("payment_id" + payCnt, paymentId);
		if(pmtDate == null)
		{
			pmtMap.put("payment_date" + payCnt, "");
		}
		else
		{
			pmtMap.put("payment_date" + payCnt, String.valueOf(sdf.format(pmtDate)));
		}
		
		pmtMap.put("pmt_tranType" + payCnt, pmtTranType);
		pmtMap.put("pmt_payMode" + payCnt, pmtPayMode);
		pmtMap.put("pmt_siteCode" + payCnt, pmtSiteCode);
		pmtMap.put("pmt_bankCode" + payCnt, pmtbankCode);
		pmtMap.put("pmt_sunrdyType" + payCnt, sundryDescr);
		pmtMap.put("pmt_sundryCode" + payCnt, pmtSundryCode);
		pmtMap.put("pmt_refNo" + payCnt, pmtRefNo);
		
		if(pmtRefDate == null)
		{
			pmtMap.put("pmt_refDate" + payCnt,"");
		}
		else
		{
			pmtMap.put("pmt_refDate" + payCnt,String.valueOf(sdf.format(pmtRefDate)));
		}
		
		
		pmtMap.put("pmt_refDate" + payCnt,String.valueOf(sdf.format(pmtRefDate)));
		pmtMap.put("pmt_netAmt" + payCnt, utilMethods.getReqDecString(pmtNetAmt,2));
		pmtMap.put("pmt_taxAmt" + payCnt, utilMethods.getReqDecString(pmtTaxAmt,2));
		pmtMap.put("pmt_discAmt" + payCnt, utilMethods.getReqDecString(pmtDiscAmt,2));
		pmtMap.put("pmt_vochNo" + payCnt, pmtVochNo);
		
		
		if(pmtVochDate == null)
		{
			pmtMap.put("pmt_vochDate" + payCnt, "");
		}
		else
		{
			pmtMap.put("pmt_vochDate" + payCnt, String.valueOf(sdf.format(pmtVochDate)));
		}
		
		
		
		pmtMap.put("pmt_conf" + payCnt, pmtConf);
		if(pmtConfDate == null)
		{
			pmtMap.put("pmt_confDate" + payCnt,"");
		}
		else
		{
			pmtMap.put("pmt_confDate" + payCnt,String.valueOf(sdf.format(pmtConfDate)));	
		}
		 
		
	
	}//end of while for payment information
	rs2.close();
	rs2 = null;
	pstmt2.close();
	pstmt2 = null; 
	
	
	
	}//end of while for voucher information
	rs1.close();
	rs1 = null;
	pstmt1.close();
	pstmt1 = null;  
	
	
	
		
	
}//end of while loop for receipt information
rs.close();
rs = null;
pstmt.close();
pstmt = null; 

%>

<table border ="0" width="100%" class="headerTable" cellpadding="1" cellspacing="1">
<tr><th colspan="8" height="27"><div align="left"><font color="red" align="left">Purchase Order Information</font></div></th>
</tr>
<tr>
<th width="100" height="27" class="headerTextCol">Purchase Order :</th>
<td width="242" align="left"><%=purcOrder%></td>
<th width="113" class="headerTextCol">Purchase Order Date:</th>
<%
if(orderDate == null)
{
%>
<td width="159" align="left"></td>
<%
}
else
{
%>
<td width="230" align="left"><%=sdf.format(orderDate)%></td>
<%
}
%>


<td colspan="4" class="headerTextCol"><b>Purchase Order Type:</b> &nbsp;&nbsp;<%=ordTypeDescr%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Status :</b>&nbsp;<%=statusDescr%></td>
</tr>

<tr>
  <th height="27" class="headerTextCol">Supply Code:</th>
  <td align="left"><%=suppCode%>&nbsp;-&nbsp;<%=suppName%></td>
  <th class="headerTextCol" >Address:</th>
  <td align="left"><%=suppAdd1%></td>
  <td class="headerTextCol"><b>City</b>: &nbsp;&nbsp;</td>
  <td class="headerTextCol"><%=suppCity%></td>
  <td align="left"></td>
  <td align="left"></td>
</tr> 

<tr>
<th width="100" height="27" class="headerTextCol">Deliver At:</th>
<td width="242" align="left"><%=siteCodeDlv%>&nbsp;-&nbsp;<%=siteDescr%></td>
<th width="113" class="headerTextCol" >Address:</th>
<td width="159" align="left"><%=siteAdd1 %></td>
<td class="headerTextCol"><b>City :</b>&nbsp;&nbsp;</td>
<td class="headerTextCol"><%=siteCity%></td>
<td width="95" align="left"></td>
<td width="103" align="left"></td>
</tr>


<tr>
  <th height="27" class="headerTextCol">Transporter:</th>
  <td align="left">&nbsp;<%=tranCode%>&nbsp;&nbsp;-&nbsp;<%=tranName%></td>
  <th class="headerTextCol" >Transporter Mode</th>
  <td align="left">&nbsp;<%=tranMode%>&nbsp;-&nbsp;<%=tranModeDescr%></td>
  <td colspan="4" class="headerTextCol" >&nbsp;</td>
</tr>
<tr>
<th width="100" height="27" class="headerTextCol">Currency Code:</th>
<td width="242" align="left"><%=currCode%></td>
<th width="113" class="headerTextCol" >Price List:</th>
<td width="159" align="left"><%=priceList%></td>
<td colspan="4" class="headerTextCol" >&nbsp;</td>
</tr>

<tr>
<th width="100" height="27" class="headerTextCol">Order Amount:</th>
<td width="242" align="left"><%=ordAmt%></td>
<th width="113" class="headerTextCol">Tax Amount:</th>
<td width="159" align="left"><%=taxAmt%></td>
<th class="headerTextCol">Total Amount:</th>
<td colspan="3" class="headerTextCol"><%=totAmt%></td>
</tr>




<tr>

<th width="100" height="27" class="headerTextCol">Advanced Type:</th>
<td width="242" align="left"><%=advType%></td>
<th width="113" class="headerTextCol">Advanced Amount:</th>
<td width="159" align="left"><%=advAmt%></td>
<td colspan="2">&nbsp;</td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>



<th width="100" height="27" class="headerTextCol">Confirmed :</th>
<td width="242" align="left"><%=confirmed%></td>
<th width="113" class="headerTextCol">Confirmed Date:</th>
<%
if(confDate == null)
{
%>
<td width="159" align="left">&nbsp;</td>
<%
}
else
{
%>
<td width="230" align="left"><%=sdf.format(confDate)%></td>
<%
}
%>
<td colspan="4">&nbsp;</td>
</tr>
</table>








<br><br>



<%
if(rcpCnt != 0)
{
%>
<table border ="1" width="100%" class="headerTable" style="overflow:auto">
<!-- <tr><th><font color="red">Receipt Information</font><th></tr> -->
<tr><th colspan="14" height="27"><div align="left"><font color="red" align="left">Receipt Information</font></div></th>
</tr>
<tr>
<th>Receipt No</th>
<th>Receipt Date</th>
<th>Receipt Type</th>
<th>Purchase Order</th>
<th>Site Code</th>
<th>Supplier code</th>
<th>Adjustment Amount</th>
<th>Tax Amount</th>
<th>Receipt Amount</th>
<th>Confirmed</th>
<th>Confirmed Date</th>
 <th>Status</th> 
<th>Invoice No</th>
<th>Invoice Date</th>

</tr>
<% 
for(int i = 1; i<= rcpCnt ; i++)
{%>
<tr>
<td><%=rcpInfoMap.get("tran_id" + i)%></td>
<td><%=rcpInfoMap.get("tran_date" + i)%></td>
<td><%=rcpInfoMap.get("tran_type" + i)%></td>
<td><%=rcpInfoMap.get("purc_order" + i)%></td>
<td><%=rcpInfoMap.get("site_code" + i)%></td>
<td><%=rcpInfoMap.get("supp_code" + i)%></td>
<td align="right"><%=rcpInfoMap.get("adj_amt" + i)%></td>
<td align="right"><%=rcpInfoMap.get("tax_amt" + i)%></td>
<td align="right"><%=rcpInfoMap.get("amount" + i)%></td>
<td><%=rcpInfoMap.get("confirmed" + i)%></td>
<td><%=rcpInfoMap.get("conf_date" + i)%></td>
 <td><%=rcpInfoMap.get("status" + i)%></td> 
<td><%=rcpInfoMap.get("invoice_no" + i)%></td>
<td><%=rcpInfoMap.get("inv_date" + i)%></td>
</tr>
<%
}
%>
<table>
<%
}
%>

<%
if(qcCnt != 0)
{
%>
<br><br>
<table border ="1" width="100%" class="headerTable" style="overflow:auto">
<!-- <tr><th><font color="red">QC Order Information</font><th></tr> -->
<tr><th colspan="15" height="27"><div align="left"><font color="red" align="left">&nbsp;QC Order Information</font></div></th>

<tr>
<th>QCOrder No</th>
<th>QCOrder Date</th>
<th>QcOrder Type</th>
<th>Receipt No</th>
<th>Site Code</th>
<th>Item Code</th>
<th>Quantity</th>
<th>Quantity Passed</th>
<th>Quantity Rejected</th>
 <th>Start date</th> 
<th>Due Date</th>
<th>Location</th>
<th>Approve Location</th>
<th>Rejected Location</th>
<th>Status</th>
</tr>

<% 
for(int i = 1; i<= qcCnt ; i++)
{%>
<tr>
<td><%=qcMap.get("qc_order" + i)%></td>
<td><%=qcMap.get("qc_ordDt" + i)%></td>
<td><%=qcMap.get("qc_ordType" + i)%></td>
<td><%=qcMap.get("qc_receiptNo" + i)%></td>
<td><%=qcMap.get("qc_SiteCd" + i)%></td>
<td><%=qcMap.get("qc_ItemCd" + i)%></td>
<td align="right"><%=qcMap.get("qc_quantity" + i)%></td>
<td align="right"><%=qcMap.get("qc_qtypass" + i)%></td>
<td align="right"><%=qcMap.get("qc_qtyRej" + i)%></td>
 <td><%=qcMap.get("qc_StartDt" + i)%></td> 
<td><%=qcMap.get("qc_dueDt" + i)%></td>
<td><%=qcMap.get("qc_locCd" + i)%></td>
<td><%=qcMap.get("qc_locCdAprv" + i)%></td>
<td><%=qcMap.get("qc_locRej" + i)%></td>
<td><%=qcMap.get("qc_status" + i)%></td>
</tr>
<%
}
%>
<table>
<%
}
%>






<%-- 
<%
if(adVocCnt != 0)
{
%>
<table border ="1" width="100%" class="headerTable">
<tr><th><font color="red" align="left">Advanced Voucher Information</font><th></tr>
<tr>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Supply Code</th>
<th>Bill No</th>
<th>Bill Date</th>
<th>Bank Code</th>
<th>Advanced Amount</th>
<th>Bill Amount</th>
<th>Tax Amount</th>
<th>Supply Bill Amount</th>
<th>Total Amount</th>
<th>Paid</th>
<th>Confirmed</th>
<th>Confirmed date</th>
</tr>
<% 
for(int i = 1; i<= adVocCnt ; i++)
{%>
		
<tr>
<td><%=adVochMap.get("tran_id" + i)%></td>
<td><%=adVochMap.get("tran_date" + i) %></td>
<td><%=adVochMap.get("tran_type" + i) %></td>
<td><%=adVochMap.get("supp_code" + i) %></td>
<td><%=adVochMap.get("bill_no" + i) %></td>
<td><%=adVochMap.get("bill_date" + i) %></td>
<td><%=adVochMap.get("bank_code" + i) %></td>
<td><%=adVochMap.get("adv_amt" + i) %></td>
<td><%=adVochMap.get("bill_amt" + i) %></td>
<td><%=adVochMap.get("tax_amt" + i) %></td>
<td><%=adVochMap.get("supp_bill_amt" + i) %></td>
<td><%=adVochMap.get("tot_amt" + i) %></td>
<td><%=adVochMap.get("paid" + i) %></td>
<td><%=adVochMap.get("confirmed" + i) %></td>
<td><%=adVochMap.get("conf_date" + i) %></td>
</tr>
<%
}
%>
<table>
<%
}
%> --%>



<br><br>
<%
if(vocCnt != 0)
{
%>

<table border ="1" width="100%" class="headerTable" style="overflow:auto">
<!-- <tr><th><font color="red">Voucher Information</font><th></tr> -->
<tr><th colspan="17" height="27"><div align="left"><font color="red" align="left">&nbsp;Voucher Information</font></div></th>

<tr>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Supply Code</th>
<th>Bill No</th>
<th>Bill Date</th>
<th>Bank Code</th>
<th>Receipt No</th>
<th>Advanced Amount</th>
<th>Bill Amount</th>
<th>Tax Amount</th>
<th>Supply Bill Amount</th>
<th>Net Amount</th>
<th>Total Amount</th>
<th>Paid</th>
<th>Confirmed</th>
<th>Confirmed date</th>
</tr>
<% 

for(int i = 1; i<= vocCnt ; i++)
{%>
		
<tr>
<td><%=vochMap.get("tran_id" + i)%></td>
<td><%=vochMap.get("tran_date" + i) %></td>
<td><%=vochMap.get("tran_type" + i) %></td>
<td><%=vochMap.get("supp_code" + i) %></td>
<td><%=vochMap.get("bill_no" + i) %></td>
<td><%=vochMap.get("bill_date" + i) %></td>
<td><%=vochMap.get("bank_code" + i) %></td>
<td><%=vochMap.get("rcp_no" + i) %></td>
<td align="right"><%=vochMap.get("adv_amt" + i) %></td>
<td align="right"><%=vochMap.get("bill_amt" + i) %></td>
<td align="right"><%=vochMap.get("tax_amt" + i) %></td>
<td align="right"><%=vochMap.get("supp_bill_amt" + i) %></td>
<td align="right"><%=vochMap.get("net_amt" + i) %></td>
<td align="right"><%=vochMap.get("tot_amt" + i) %></td>
<td><%=vochMap.get("paid" + i) %></td>
<td><%=vochMap.get("confirmed" + i) %></td>
<td><%=vochMap.get("conf_date" + i) %></td>
</tr>
<%
}
%>


<% 

for(int i = 1; i<= miscVouCnt ; i++)
{%>
		
<tr>
<td><%=miscVochMap.get("misc_vocNo" + i)%></td>
<td><%=miscVochMap.get("misc_vocDate" + i) %></td>
<td><%=miscVochMap.get("misc_vocType" + i) %></td>
<td><%=miscVochMap.get("misc_vocSunrCd" + i) %></td>
<td><%=miscVochMap.get("misc_vocBillNo" + i) %></td>
<td><%=miscVochMap.get("misc_vocBillDt" + i) %></td>
<td><%=miscVochMap.get("misc_vocBankCd" + i) %></td>
<td></td>
<td align="right"><%=miscVochMap.get("misc_vocAdvAmt" + i) %></td>
<td align="right"><%=miscVochMap.get("misc_vocBillAmt" + i) %></td>
<td align="right"><%=miscVochMap.get("misc_vocTaxAmt" + i) %></td>
<td align="right"><%=miscVochMap.get("misc_vocSuppBillAmt" + i) %></td>
<td align="right"><%=miscVochMap.get("misc_vocNetAmt" + i) %></td>
<td align="right"><%=miscVochMap.get("misc_vocTotAmt" + i) %></td>
<td><%=miscVochMap.get("misc_vocPaid" + i) %></td>
<td><%=miscVochMap.get("misc_vocConf" + i) %></td>
<td><%=miscVochMap.get("misc_vocConfDt" + i) %></td>
</tr>
<%
}
%>

<table>
<%
}
%>



<BR>

<%
if(payCnt != 0)
{
%>

<table border ="1" width="100%" class="headerTable" style="overflow:auto">
<!-- <tr><th><font color="red">Payment Information</font><th></tr> -->
<tr><th colspan="18" height="27"><div align="left"><font color="red" align="left">&nbsp;Payment Information</font></div></th>

<tr>
<th>Payment No</th>
<th>Payment Date</th>
<th>Payment Type</th>
<th>Payment Mode</th>
<th>Site Code</th>
<th>Bank</th>
<th>Sundry Type</th>
<th>Sundry Code</th>
<th>Cheque/DD No</th>
<th>Refernce Date</th>
<th>Tax Amount</th>
<th>Discount Amount</th>
<th>Amount Paid</th>
<th>Voucher No</th>
<!-- <th>Voucher Date</th> -->
<!-- <th>Voucher Amount</th> -->
<!-- <th>paid Amount</th> -->
<th>Confirmed</th>
<th>Confirmed Date</th>
</tr>
<% 
for(int i = 1; i<= payCnt ; i++)
{%>
<tr>
<td><%=pmtMap.get("payment_id" + i)%></td>
<td><%=pmtMap.get("payment_date" + i)%></td>
<td><%=pmtMap.get("pmt_tranType" + i)%></td>
<td><%=pmtMap.get("pmt_payMode" + i)%></td>
<td><%=pmtMap.get("pmt_siteCode" + i)%></td>
<td><%=pmtMap.get("pmt_bankCode" + i)%></td>
<td><%=pmtMap.get("pmt_sunrdyType" + i)%></td>
<td><%=pmtMap.get("pmt_sundryCode" + i)%></td>
<td><%=pmtMap.get("pmt_refNo" + i)%></td>
<td><%=pmtMap.get("pmt_refDate" + i)%></td>
<td align="right"><%=pmtMap.get("pmt_discAmt" + i)%></td>
<td align="right"><%=pmtMap.get("pmt_taxAmt" + i)%></td>
<td align="right"><%=pmtMap.get("pmt_netAmt" + i)%></td>
<%-- <td><%=pmtMap.get("pmt_netAmt" + i)%></td> --%>
<%-- <td><%=pmtMap.get("pmt_taxAmt" + i)%></td> --%>
<td><%=pmtMap.get("pmt_vochNo" + i)%></td>
<%-- <td><%=pmtMap.get("pmt_vochDate" + i)%></td>
<td></td>
 --%>
<td><%=pmtMap.get("pmt_conf" + i)%></td>
<td><%=pmtMap.get("pmt_confDate" + i)%></td>
</tr>
<%
}
%>
<table>
<%
}
%>





<table width="50%" border="0" align="center">
							<tr>
												
												
												<td align="center"><input type="button" value="Close" class="button"
														onClick="window.close();" /></td>
												
												
											</tr>
</table>

<%

}
catch(ITMException itme)
{
	itme.printStackTrace();
	System.out.println("ITMException :=>");
	throw itme;
}
catch(Exception e)
{
	e.printStackTrace();
	System.out.println( "@@@@@ Exception occured:: " );
}
finally{
	try{
		if( rs != null )
			rs.close();
		    rs = null;
		if( pstmt != null )
			pstmt.close();
		pstmt = null;
		if( conn != null )
			conn.close();
		conn = null; 
	}catch( Exception ex ){}
	
}

%>


</body>
</html>
