<html>
<script type="text/javascript">//<![CDATA[
var PageInfo = [0,12];
var BookmarksOnPage = new Array();

function BodyClickHandler() {
	var window = document.parentWindow;
	if (!window) { window = document.contentWindow; }
	if (!window) { window = document.defaultView; }
	var frameElement = (window) ? window.frameElement : null;
	if (frameElement) {
		var viewer = frameElement.Viewer;
		if (viewer && viewer.HideEditorPopup) { viewer.HideEditorPopup(); }
	}
}

function GetReportViewer() {
	var window = document.parentWindow;
	if (!window) { window = document.contentWindow; }
	if (!window) { window = document.defaultView; }
	var frameElement = (window) ? window.frameElement : null;
	if (frameElement) { return frameElement.Viewer; }
	return null;
}

function NavigateToUrl(Url, target) {
	window.open(Url, target);
}

function NavigateToBookmark(bookmarkId) {
	var viewer = GetReportViewer();
	if (viewer) { viewer.NavigateToBookmark(bookmarkId); }
}

function NavigateToReport(reportAddress) {
	var viewer = GetReportViewer();
	if (viewer) { viewer.NavigateToReport(reportAddress); }
}

//]]></script><style type="text/css">/*<![CDATA[*/
div.html-root>ol, div.html-root>ul, div.html-root>p 
{
	margin-top: 0px;
}
body
{
	font-family: arial;
}
.underlinebox
{
/*	text-decoration: underline;*/
	border-bottom:1px solid black;
}
.sheet .error 
{
	border: 1px solid red;
	color: red;
}
	#company td
	{
		font-weight: normal;
		white-space: pre;
    word-wrap: normal;
    font-size: 14pt;
	}
	#invoiceMaster th
	{
		   font-family: Arial;
    font-size: 9pt;
				text-align: left;

	}
	#headertop
	{
		font-size: 9px;
	}
	#details th
	{
		background-color: #00B050;/*#46eb46*/;
		height: 30px;
		color:white;
   font-family: Arial;
    font-size: 9pt;
    color: White;
    text-align: center;
    word-wrap: break-word;
    padding-left: 3px;
    padding-right: 3px;
    padding-top: 2px;
    padding-bottom: 0px;
    border-left: 0px solid black;
    border-top: 0px solid black;
    border-right: 0.3px solid white;
    border-bottom: 0px solid black;
    background-color: #00B050;
}
		#details td
		{
    font-family: Arial;
    font-size: 9pt;
    color: Black;
    height: 25px;
    text-align: right;
    word-wrap: break-word;
    padding-left: 0px;
    padding-right: 5px;
    padding-top: 0px;
    padding-bottom: 0px;
    border-left: 0px solid silver;
    border-top: 0px solid silver;
    border-right: 0px solid silver;
   border-bottom: 0.1px solid silver;

		}

		#otherdetail td
		{
			font-size: 9pt;
	padding:6px;
		font-family: arial;
		}


		h2,h3,h4
		{
			margin:0px;
			font-family: arial;
		}
.all
{
	background-color: #ffc;
}
.all td,.all th
{
	/*border-right:silver 1px solid;*/
}
/*		#logo
		{
			width:123px;
			height: 96	px;
		}*/
/* interactive page */
.interactive-page .sheet
{
	margin: 10px;
}
/* print preview page */
.print-page 
{
	background-color: #ccc;	
}
@media print 
{
.print-page 
{
	background-color: white;	
}
.print-page > .sheet
{
	border: 0px solid white;
}
table
{
	width:100%;
}

}
.print-page > .sheet
{
	border: 0px solid darkblue;
	/* centers the DIV horizontally */
	margin-left: auto;
	margin-right: auto;
	margin-top: 10px;
	margin-bottom: 10px;
/*	-moz-box-shadow: 5px 5px 5px #888;
	-webkit-box-shadow: 5px 5px 5px #888;
	box-shadow: 5px 5px 5px #888;*/
	font-size: 9px !important;
}
.sheet .layer
{
	position: absolute;
	width: 100%;
	height: 100%;
	left: 0px;
	top: 20px;
}
.sheet .action
{
	cursor: pointer;
}
.sheet div.action:hover
{
	border: 1px solid #ddd;
	/*
	-moz-box-shadow: 1px 1px 3px #888 inset
	-webkit-box-shadow: 1px 1px 3px #888 inset
	box-shadow: 1px 1px 3px #888 inset
	z-index: 99
	*/
}
.sheet
{
	position: relative;
}
.sheet {background-color:White}
.s31- {
    font-family: Arial;
    font-size: 10pt;
    color: Red;
    word-wrap: normal;
}
.s35- {
    font-family: Arial;
    font-size: 13.2pt;
    color: Red;
    font-weight: bold;
    word-wrap: normal;
}
.s38- {
    font-family: Arial;
    font-size: 14pt;
    color: Red;
    direction: rtl;
    word-wrap: break-word;
    padding-left: 0px;
    padding-right: 5px;
    padding-top: 0px;
    padding-bottom: 0px;
}
.s0- {padding-left:0px;padding-right:0px;padding-top:0px;padding-bottom:0px}
.s1- {font-family:Arial;font-size:10pt;color:Black;font-weight:bold;word-wrap:break-word;padding-left:0px;padding-right:0px;padding-top:1px;padding-bottom:0px;border-left:1px solid Black;border-top:1px solid Black;border-right:1px solid Black;border-bottom:1px solid Black;background-color:White}
.s2- {font-family:Arial;font-size:10pt;color:Black;text-align:center;word-wrap:break-word;padding-left:0px;padding-right:0px;padding-top:1px;padding-bottom:0px;border-left:1px solid Black;border-top:1px solid Black;border-right:1px solid Black;border-bottom:1px solid Black}
.s3- {font-family:Arial;font-size:10pt;color:Black;font-weight:bold;word-wrap:break-word;padding-left:0px;padding-right:0px;padding-top:0px;padding-bottom:0px;border-left:1px solid Black;border-top:1px solid Black;border-right:1px solid Black;border-bottom:1px solid Black;background-color:White}
.s4- {font-family:Arial;font-size:10pt;color:Black;text-align:center;word-wrap:break-word;padding-left:0px;padding-right:0px;padding-top:0px;padding-bottom:0px;border-left:1px solid Black;border-top:1px solid Black;border-right:1px solid Black;border-bottom:1px solid Black}
.s5- {font-family:Arial;font-size:10pt;color:Black;word-wrap:break-word;padding-left:0px;padding-right:0px;padding-top:0px;padding-bottom:0px;border-left:1px solid Black;border-top:1px solid Black;border-right:1px solid Black;border-bottom:1px solid Black}
.s6- {font-family:Arial;font-size:10pt;color:Black;word-wrap:break-word;padding-left:0px;padding-right:0px;padding-top:1px;padding-bottom:0px;}
.s7- {font-family:Arial;font-size:18pt;color:Black;word-wrap:break-word;padding-left:0px;padding-right:0px;padding-top:0px;padding-bottom:0px;border-bottom:1px solid Black}
.s8- {font-family:Arial;font-size:10pt;color:Black;font-weight:bold;text-align:center;word-wrap:break-word;padding-left:0px;padding-right:0px;padding-top:3px;padding-bottom:0px;border-left:1px solid Black;border-top:1px solid Black;border-right:1px solid Black;border-bottom:1px solid Black;background-color:Silver}
.s9- {font-family:Arial;font-size:10pt;color:Black;font-weight:bold;word-wrap:break-word;padding-left:0px;padding-right:0px;padding-top:3px;padding-bottom:0px;border-left:1px solid Black;border-top:1px solid Black;border-right:1px solid Black;border-bottom:1px solid Black;background-color:Silver}
.s10- {
    font-family: Arial;
    font-size: 9pt;
    color: Black;
    font-weight: bold;
    word-wrap: break-word;
    padding-left: 2px;
    padding-right: 3px;
    padding-top: 12px;
    padding-bottom: 0px;
}
.s11- {font-family:Arial;font-size:8pt;color:Black;word-wrap:break-word;padding-left:0px;padding-right:0px;padding-top:12px;padding-bottom:0px}
.s12- {font-family:Arial;font-size:8pt;color:Black;text-align:right;word-wrap:break-word;padding-left:0px;padding-right:0px;padding-top:12px;padding-bottom:0px}
.s51- {
    font-family: Arial;
    font-size: 10pt;
    color: Black;
    font-weight: bold;
    word-wrap: break-word;
    padding-left: 3px;
    padding-right: 2px;
    padding-top: 2px;
    padding-bottom: 0px;
}
.s52- {
    font-family: Arial;
    font-size: 9pt;
    color: Black;
    word-wrap: break-word;
    padding-left: 3px;
    padding-right: 2px;
    padding-top: 3px;
    padding-bottom: 0px;
}
.s19- {
    font-family: Arial !important;
    font-size: 9pt !important;
    color: Black;
    font-weight: bold !important;
    word-wrap: break-word;
    padding-left: 3px;
    padding-right: 3px;
    padding-top: 0px;
    padding-bottom: 0px;
}
.s20- {
    font-family: Arial !important;
    font-size: 9pt !important;
    color: Black;
    word-wrap: break-word;
    padding-left: 3px;
    padding-right: 3px;
    padding-top: 3px;
    padding-bottom: 0px;
}
/*]]>*/</style></head><body class="print-page"><div class="sheet page1" style="padding-left:86px;padding-right:86px;padding-top:6px;padding-bottom:26px;width:744px;height:1097px;margin-bottom: 0px;"><div class="layer">
<div id="headertop" class="row">
	<form name="bform" method="POST">
		<br><br><br>
<table align="center">
	<tr>
		<th><h1>Please Scan the QRCODE</h1> </th>
		</tr>

	<tr>
		<td>
		<input type="text" name="qrcode" id="qrcode" style="height: 90px;width:5.00px;">	
		</td>
	</tr>	
</table>
</form>
	<table id="barcodedata" style="display: none;" border="1" width="56%" align="center" cellpadding="0" cellspacing="0">
	<tr>

<td  valign="middle" width="12%"  align="right" id="barcode" style="text-align: right;"><span id="barcode3"></span><!-- <span id="keyfield" style="border:red 1px solid !important;"></span> --></td>
		<th colspan=""  width="25%"  align="left"><div class="s51-" style='white-space: pre;
    word-wrap: normal;'><h2>ITEM DETAILS</h2></div>  <span id="invoicedate" class="s52-"></span></th>
    </tr>
<tr>
<th valign="top"   ><img style="width:100%;border:red 0px solid;position: relative;height: 140px;"  src='assets/images/caller.jpg' id='logo'> </th>

			<td align="left" valign="top" align="left" colspan="1" width="300">
	<table id="company" width="100%" align="center" border="0" style="color:red;">
		<tr>
			<td>Item Name</td><td id="ItemName" width="300" class="s19-" style="font-size:12pt !important;font=weight:bold;left:3px;white-space:normal;word-wrap:normal;top:0px;">Company Name </td>
		</tr>
		<tr>
			<Td>Category</Td><td id="ProductCategoryID" class="s20-" style="left:3px;white-space:pre;word-wrap:normal;top:0px;">Company Name </td>
		</tr>
		<tr>
			<td>Part #</td>
			<td id="PartNo" class="s20-" style="left:3px;white-space:pre;word-wrap:normal;top:0px;">Company Name </td>
		</tr>
		<tr>
			<td>Location</td><td id="Location" class="s20-" style="white-space:pre;word-wrap:normal;left:3px;top:0px;">Company Name </td>
		</tr>
	<!-- 	<tr>
			<td>Weight</td><td id="Fax" class="s20-" style="white-space:pre;word-wrap:normal;left:3px;top:0px;">Company Name </td>
		</tr> -->
		<tr>
			<td>Size</td><td id="Size" class="s20-" style="white-space:pre;word-wrap:normal;left:3px;top:0px;">Company Name </td>
		</tr>
		<tr>
			<td>Color</td><td id="Color" class="s20-" style="white-space:pre;word-wrap:normal;left:3px;top:0px;">Company Name </td>
		</tr>
				<tr>
			<td>Brand</td><td id="Brand" class="s20-" style="white-space:pre;word-wrap:normal;left:3px;top:0px;">Company Name </td>
		</tr>
			<tr>
			<td colspan="2">Description</td></tr>
				<tr>
			<td id="Details" colspan="2" class="s20-" style="white-space:pre;word-wrap:normal;left:3px;top:0px;">Company Name </td>
		</tr>		
	</table>
</td>
</tr>
</table>
	<br><br>
	
	<br>
	<!-- <table id="details" width="96%" align="center" border="0" cellpadding="0" cellspacing="0">
		<tr><th> S#</th><th>Product/Service </th><th>Qty</th><th>Rate</th><th>Amount</th><th>Discount Amount </th><th>Vat Amount </th><th>Net Amount </th></tr>

	</table>
	 -->
	</div></div>

</body></html>

<script type="text/javascript" src="assets2/js/jquery-3.2.1.min.js"></script>
<!-- <script src="http://code.jquery.com/jquery-latest.min.js"></script>
 -->
<script type="text/javascript" src="assets/js/jquery-barcode.js"></script>
<script type="text/javascript" src="assets/js/jquery-barcode1.js"></script>
<script type="text/javascript" src="qrcode/qrcode.js"></script>
<script>
	var globalWebServiceInventoryPath='';
        function getUrlParams(url) {
            var lastURL1 = "";
            var urlParams = {} // return value
            var queryString = getQueryString()

            if (queryString) {
                var keyValuePairs = queryString.split('&')
                for (var i = 0; i < keyValuePairs.length; i++) {
                    var keyValuePair = keyValuePairs[i].split('=')
                    var paramName = keyValuePair[0]
                    var paramValue = keyValuePair[1] || ''
                    urlParams[paramName] = decodeURIComponent(paramValue.replace(/\+/g, ' '))
                }
            }
            return urlParams // functions below
            function getQueryString() {
                var reducedUrl = lastURL1 || url || window.location.search

                reducedUrl = reducedUrl.split('#')[0] // Discard fragment identifier.
                var queryString = reducedUrl.split('?')[1]
                if (!queryString) {
                    if (reducedUrl.search('=') !== false) { // URL is a query string.
                        queryString = reducedUrl
                    }
                }
                return queryString
            } // getQueryString
        } // getUrlParams

/*
        var TextBoxName = getUrlParams()["TextBoxName"];
        var CurrentCompanyID = getUrlParams()["CompanyID"];*/
        var ItemID = getUrlParams()["ItemID"];
        var company = getUrlParams()["company"];
//alert(company);
	$(document).ready(function(){
		var d=new Date();
$("#printdate").html(d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate());
$("#printtime").html(d.getHours()+':'+(d.getMinutes())+':'+d.getSeconds());
	});
	function DisplayCompany(GodownID)
	{
var condition="degree=1 and active=1 and GodownID="+GodownID;

		$.ajax({


                url: globalWebServiceInventoryPath + 'getmastervalue.php?action=viewlist&TextBoxName=Godowns&fields=GodownID,Name,Address,Address2,EmailAddress1,TRNNo,ContactNO,Website,FAX,AdditionalInfo2&condition='+condition,

                type: 'post',
                dataType: 'json',
                // timeout: 2000,
                data: $(this).serialize(document.forms[0]),
         
                success: function (data) {
             //   	console.log(data);
                	var Company = data[0].Name;
                	var Address = data[0].Address;
                	var Address2 = data[0].Address2;  //pobox
                	var ContactNO  =data[0].ContactNO;  
                	var EmailAddress1 =data[0].EmailAddress1; 
                	var Website =data[0].Website;    
                	var TRNNo=data[0].TRNNo;
                	var Fax =data[0].FAX;               
                	var AdditionalInfo2=data[0].AdditionalInfo2+'logo.png';  	        	
                	$("#companyname").html(Company);
                	$("#Address").html(Address);    //POBox
                	$("#POBox").html(Address2);   
                	$("#Tel").html('Tel:'+ContactNO);   
                	$("#Email").html(EmailAddress1);   
                	$("#Website").html(Website);
                	$("#TRNNo").html('TRN:'+TRNNo);                	 
                	$("#Fax").html('Fax:'+Fax);                   	
                	$("#logo").attr('src','../images/'+AdditionalInfo2);  
                	$("#logo1").attr('src','../images/'+AdditionalInfo2);                  	                 	
                /*	console.log(JSON.stringify(allinvoice));
                	$("span#invoicedate").html(allinvoice.invoicedate);
                	$("span#keyfield").html(allinvoice.keyfield);
         $("th#barcode").barcode(allinvoice.keyfield,"code39");
*/
                //	$('#ReportViewer1ReportFrame').attr('src','../login.html?dataid=3');
                	//parent.$("body").find("#ReportViewer1ReportFrame").html(data);
                
                }
            
            });

	}

function showDetails(txt)
{
		$.ajax({


                url: globalWebServiceInventoryPath + 'productdata.php?action=GetProducts2&ID='+txt+'&ProductBaseType=Item',

                type: 'post',
                dataType: 'json',
                // timeout: 2000,
                data: $(this).serialize(document.forms[0]),
         
                success: function (data) {
                	//alert(data);
                	$("#barcodedata").css('display','block');
                	var allinvoice = data[0];//[0][0];
                	console.log(JSON.stringify(allinvoice));
                	//var details=data.detailitems;
                	console.log(allinvoice);
                	$("#ItemName").html(allinvoice.ItemName);
                //	DisplayCompany(allinvoice.godownid);
                if(allinvoice.PictureLocation!="" && allinvoice.PictureLocation!=null && allinvoice.PictureLocation!="undefined")
                		$("#logo").html(allinvoice.PictureLocation);

                	$("span#invoicedate").html(allinvoice.invoicedate);
                	$("#PartNo").html(allinvoice.AdditionalInfo1);
                	$("td#Brand").html(allinvoice.Brand);
                	$("td#Color").html(allinvoice.Color);
                	$("#Size").html(allinvoice.Size);
					$("td#Location").html(allinvoice.AdditionalInfo3);


					makeCode(allinvoice.Barcode);


                	$("td#keyno").html(allinvoice.keyno);
                	$("td#ProductCategoryID").html(allinvoice.ProductCategoryID);
                	$("#Details").html(allinvoice.Details);
                
                	//             	                						
       //  $("span#barcode3").barcode(allinvoice.Barcode,"msi");
       //  $("span#ChassisNo").barcode1(allinvoice.chassisnumber,"code128");
      //   $("span#PlateNo").barcode1(allinvoice.platenumber,"code39");
		//			$("span#ChassisNo div:nth-last-child(1)").css('width','50%');	                	                  
                //	$('#ReportViewer1ReportFrame').attr('src','../login.html?dataid=3');
                	//parent.$("body").find("#ReportViewer1ReportFrame").html(data);
                	var totallabour=0;
                	var totalsparepart=0;
                	var discount=0;
                	var vatamount=0;
             /*   for(a=0;a<details.length;a++)
                {

                	//ItemProductBaseType
                	//+'<td>'+details[a].barcode+'</td>'
                	//discountamount
                	console.log(details[a].ItemProductBaseType)
                	if(details[a].ItemProductBaseType=="SERVICE" || details[a].ItemProductBaseType=="Package")
                	totallabour=totallabour+parseFloat(details[a].amount);
                	else if(details[a].ItemProductBaseType=="ITEM")	
					totalsparepart=totalsparepart+parseFloat(details[a].amount);
					else
					totallabour=totallabour+parseFloat(details[a].amount);
						
					discount=discount+parseFloat(details[a].discountamount);
					vatamount=vatamount+parseFloat(details[a].vatamount);
                	
                	var netamount11=(details[a].netamount*1);
                		netamount11=netamount11.toFixed(2);
                	var vatamount11=(details[a].vatamount*1);
                		vatamount11=vatamount11.toFixed(2);                		
                	var amount11=(details[a].amount*1);
                		amount11=amount11.toFixed(2);  

                	
                	var unitprice11=(details[a].unitprice*1);
                		unitprice11=unitprice11.toFixed(2);	              		
                	var discountamount11=(details[a].discountamount*1);
                		discountamount11=discountamount11.toFixed(2);                		
              //  details[a].netamount=netamount.toFixed(2);
                	var row='<tr><td>'+details[a].row_num+'</td><td style="text-align:left;text-indent:5px;">'+details[a].itemname+'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>'+details[a].detailnarration+'</i></td>'+'<td>'+parseFloat(details[a].qty)+'</td>'+'<td>'+unitprice11+'</td>'+'<td>'+amount11+'</td>'+'<td>'+discountamount11+'</td>'+'<td>'+vatamount11+'</td>'+'<td>'+netamount11+'</td></tr>';
                	//console.log(details[a].itemname);
                	$("#details").append(row);

                
                /*
                	//ItemProductBaseType
                	//+'<td>'+details[a].barcode+'</td>'
                	//discountamount
                	if(details[a].ItemProductBaseType=="SERVICE")
                	totallabour=totallabour+parseFloat(details[a].amount);
                	else if(details[a].ItemProductBaseType=="ITEM")	
					totalsparepart=totalsparepart+parseFloat(details[a].amount);
					else
					totallabour=totallabour+parseFloat(details[a].amount);

					discount=discount+parseFloat(details[a].discountamount);
					vatamount=vatamount+parseFloat(details[a].vatamount);
                	var row='<tr><td>'+details[a].row_num+'</td>'+'<td style="text-align:left;text-indent:5px;">'+details[a].itemname+'</td>'+'<td>'+parseFloat(details[a].qty)+'</td>'+'<td>'+parseFloat(details[a].unitprice)+'</td>'+'<td>'+parseFloat(details[a].amount)+'</td>'+'<td>'+parseFloat(details[a].discountamount)+'</td>'+'<td>'+parseFloat(details[a].vatamount)+'</td>'+'<td>'+parseFloat(details[a].netamount)+'</td></tr>';
                	//console.log(details[a].itemname);
                	$("#details").append(row);

                }
                totallabour=totallabour.toFixed(2);
                totallabour=formatNumber(totallabour);
                discount=discount.toFixed(2);	
                totalsparepart=totalsparepart.toFixed(2);
                vatamount=vatamount.toFixed(2);

                $("#totallabour").html(totallabour);
                $("#totalsparepart").html(totalsparepart);
$("#discount").html(discount);
$("#totalvat").html(vatamount);
				totalamount=(totallabour*1)+(totalsparepart*1);
				grandtotal=totalamount+(vatamount*1)-(discount*1);
				grandtotal=grandtotal.toFixed(2);
				totalamount=totalamount.toFixed(2);
                $("#totalamount").html(totalamount);
                $("#grandtotal").html(grandtotal);*/
                }
            
            });
}
$("#qrcode").change(function () {


            }).keyup(function () {

            }).keydown(function (e) {

                if (e.which == 13) {

                    e.preventDefault();
                    //$('#CustomerModal').modal('show');
                   // alert('enter');
                   var txt=$(this).val();
showDetails(txt);
                }

            });
var qrcode = new QRCode(document.getElementById("barcode3"), {
    width : 100,
    height : 100
});
function makeCode (elText) {      
  //  var elText = document.getElementById("barcode");
    console.log(elText);
    if (!elText) {
        alert("Input a text");
        elText.focus();
        return;
    }
    
    qrcode.makeCode(elText);
}

function formatNumber(num) {
  return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')
}
</script>