<?php
session_start();
require_once("../../includes/display_internal_user_dryout.inc.php");
require_once("../../includes/functions_internal_user_dryout.inc.php");
$obj = new data();
$connect = $obj->funConnect();
$display = new display();
$display->logout_iu();
if (@$_REQUEST['action'] == 'submit') {
	$msg = $obj->insertInventorySale();
	header('Location:./sale_list.php?msg=' . $msg);
}
$pagename = basename($_SERVER['PHP_SELF']);
?>
<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title><?php $display->title(); ?></title>
	<?php $display->favicon(); ?>
	<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
	<?php $display->css(); ?>
	<link rel="stylesheet" href="../../css/select22.css" type="text/css" />
	<link rel="stylesheet" href="../../css/select2-bootstrap.css" type="text/css" />
	<?php $display->js(); ?>
	<script src="../../js/select2.min.js" type="text/javascript"></script>
	<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
	<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
	<!--[if lt IE 9]>
  <script src="../js/html5shiv.js"></script>
  <script src="../js/respond.min.js"></script>
<![endif]-->
	<style>
		.animated {
			vertical-align: top;
			transition: height 0.2s;
			-webkit-transition: height 0.2s;
			-moz-transition: height 0.2s;
		}

		form.cmxform label.error,
		label.error {
			/* remove the next line when you have trouble in IE6 with labels in list */
			font-family: Verdana, Arial, Helvetica, sans-serif;
			font-size: 10px;
			color: red;
			font-style: normal;
			font-weight: lighter;
			margin: 5px;
			vertical-align: top;
		}
	</style>
</head>

<body class="skin-blue fixed">
	<!-- header logo: style can be found in header.less -->
	<?php $display->header_tag(); ?>
	<div class="wrapper row-offcanvas row-offcanvas-left">
		<?php $display->leftmenu(20, 5); ?>
		<aside class="right-side">
			<!-- Content Header (Page header) -->
			<section class="content-header">
				<h1>
					<i class="fa fa-usd"></i>&nbsp;7Oceans Accounting&nbsp;&nbsp;&nbsp;&nbsp;<small>
						<div class="headline text-center" id="time" style="color:#000; font-weight:bold; font-size:12px;"></div>
					</small>
				</h1>
				<ol class="breadcrumb">
					<li><a href="../"><i class="fa fa-home"></i> Home</a></li>
					<li class="active">Sales</li>
				</ol>
			</section>

			<!-- Main content -->
			<section class="content invoice">
				<!--   content put here..................-->
				<div align="right"><a href="sale_list.php"><button class="btn btn-info btn-flat">Back</button></a></div>
				<div style="height:10px;">&nbsp;</div>
				<form role="form" name="frm1" id="frm1" enctype="multipart/form-data" action="<?php echo $pagename; ?>" method="post">
					<div class="row">
						<div class="col-xs-12">
							<h2 class="page-header">
								ADD NEW SALE
							</h2>
						</div><!-- /.col -->
					</div>


					<div class="box-body table-responsive" style="overflow:auto;">
						<table class="table table-bordered table-striped">
							<tbody>
								<tr>
									<td width="25%">Invoice No.</td>
									<td width="25%"><input type="text" name="txtInvoiceNo" id="txtInvoiceNo" class="form-control required" placeholder="Invoice No." autocomplete="off" value=""></td>
									<td width="25%">Date</td>
									<td width="25%"><input type="text" name="txtDate" id="txtDate" autocomplete="off" placeholder="dd-mm-yyyy" class="form-control required" value="" /></td>
								</tr>
								<tr>
									<td>Party A/c Name</td>
									<td colspan="2">
										<script>
											$(document).ready(function($) {
												$("#selPartyLedger").select2({
													minimumInputLength: 1,
													placeholder: '---Select from list---',
													allowClear: true,
													ajax: {
														url: "options.php?id=162&idd=0",
														dataType: 'json',
														quietMillis: 100,
														data: function(term, page) {
															return {
																limit: -1,
																q: term
															};
														},
														results: function(data, page) {
															return {
																results: data
															}
														}
													},
													formatResult: function(doc) {
														return "<div class='select2-user-result'>" + doc.name + "</div>";
													},
													formatSelection: function(doc) {
														return doc.name;
													}
												});
											});
										</script>
										<input type="text" name="selPartyLedger" id="selPartyLedger" class="form-control required" value="" />
									</td>
									<td></td>
								</tr>
								<tr>
									<td>Mailing Address</td>
									<td colspan="2">
										<textarea name="txtMailingAddress" id="txtMailingAddress" class="form-control required" rows="2" placeholder="Address.."></textarea>
									</td>
									<td></td>
								</tr>
								<tr>
									<td>Sale ledger</td>
									<td colspan="2">
										<script>
											$(document).ready(function($) {
												$("#selSaleLedger").select2({
													minimumInputLength: 1,
													placeholder: '---Select from list---',
													allowClear: true,
													ajax: {
														url: "options.php?id=162&idd=0",
														dataType: 'json',
														quietMillis: 100,
														data: function(term, page) {
															return {
																limit: -1,
																q: term
															};
														},
														results: function(data, page) {
															return {
																results: data
															}
														}
													},
													formatResult: function(doc) {
														return "<div class='select2-user-result'>" + doc.name + "</div>";
													},
													formatSelection: function(doc) {
														return doc.name;
													}
												});
											});
										</script>
										<input type="text" name="selSaleLedger" id="selSaleLedger" class="form-control required" value="" />
									</td>
									<td></td>
								</tr>
							</tbody>
						</table>
					</div>
					<div class="box-body table-responsive" style="overflow:auto;">
						<table class="table table-bordered table-striped">
							<thead>
								<tr>
									<th width="4%">#</th>
									<th width="30%">Item</th>
									<th width="20%">Qty</th>
									<th width="20%">Rate Per</th>
									<th width="20%">Amount</th>
								</tr>
							</thead>
							<tbody id="itemtbody">
								<tr id="RowItem_1">
									<td><a href="#tb1" onClick="removeItemRows(1);"><i class="fa fa-times" style="color:red;"></i></a></td>
									</td>
									<td>
										<script>
											$(document).ready(function($) {
												$("#selItemID_1").select2({
													minimumInputLength: 1,
													placeholder: '---Select from list---',
													allowClear: true,
													ajax: {
														url: "options.php?id=165&idd=0",
														dataType: 'json',
														quietMillis: 100,
														data: function(term, page) {
															return {
																limit: -1,
																q: term
															};
														},
														results: function(data, page) {
															return {
																results: data
															}
														}
													},
													formatResult: function(doc) {

														return "<div class='select2-user-result'>" + doc.name + "</div>";
													},
													formatSelection: function(doc) {
														return doc.name;
													}
												});
											});
										</script>
										<input type="text" name="selItemID_1" id="selItemID_1" class="form-control required" value="" onChange="getReplaceRate(1);" />
									</td>
									<td><input type="text" class="form-control numeric" name="txtItemQty_1" id="txtItemQty_1" value="" autocomplete="off" onKeyUp="getCalculate();" /></td>
									<td><input type="text" class="form-control numeric" name="txtItemRate_1" id="txtItemRate_1" value="" autocomplete="off" onKeyUp="getCalculate();" /><input type="hidden" name="txtItemPRate_1" id="txtItemPRate_1" value="" /></td>
									<td><input type="text" class="form-control" name="txtItemAmount_1" id="txtItemAmount_1" value="" readonly="true" /></td>
								</tr>
							</tbody>
							<tfoot>
								<tr>
									<td><button type="button" class="btn btn-primary" onClick="addItemRow()">Add</button><input type="hidden" name="txtRowCount" id="txtRowCount" value="1" /></td>
									<td colspan="3">Total</td>
									<td></td>
								</tr>
								<tr>
									<td></td>
									<td></td>
									<td><strong>GST/VAT Applicable</strong></td>
									<td><input name="rdoTaxApplicable" class="checkbox" id="rdoTaxApplicable1" type="radio" value="1" checked="checked" />&nbsp;&nbsp;Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="rdoTaxApplicable" class="checkbox" id="rdoTaxApplicable2" type="radio" value="2" />&nbsp;&nbsp;No</td>
									<td><span id="taxRadioDiv"><input name="rdoGSTVAT" class="checkbox" id="rdoGSTVAT1" type="radio" value="1" checked="checked" />&nbsp;&nbsp;GST&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="rdoGSTVAT" class="checkbox" id="rdoGSTVAT2" type="radio" value="2" />&nbsp;&nbsp;VAT</span></td>
								</tr>
								<tr id="taxtDiv_1">
									<td></td>
									<td></td>
									<td><i>SGST (%)</i></td>
									<td><input type="text" name="txtSGST" id="txtSGST" class="form-control numeric" placeholder="%" autocomplete="off" value="" onKeyUp="readonlytextbox();getCalculate();" /></td>
									<td><input type="text" name="txtSGST_Amount" id="txtSGST_Amount" class="form-control numeric" placeholder="%" autocomplete="off" readonly="true" value="" /></td>
								</tr>
								<tr id="taxtDiv_2">
									<td></td>
									<td></td>
									<td><i>CGST (%)</i></td>
									<td><input type="text" name="txtCGST" id="txtCGST" class="form-control numeric" placeholder="%" autocomplete="off" value="" onKeyUp="readonlytextbox();getCalculate();" /></td>
									<td><input type="text" name="txtCGST_Amount" id="txtCGST_Amount" class="form-control numeric" placeholder="%" autocomplete="off" readonly="true" value="" /></td>
								</tr>
								<tr id="taxtDiv_3">
									<td></td>
									<td></td>
									<td><i>IGST (%)</i></td>
									<td><input type="text" name="txtIGST" id="txtIGST" class="form-control numeric" placeholder="%" autocomplete="off" value="" onKeyUp="readonlytextbox();getCalculate();" /></td>
									<td><input type="text" name="txtIGST_Amount" id="txtIGST_Amount" class="form-control numeric" placeholder="%" autocomplete="off" readonly="true" value="" /></td>
								</tr>
								<tr id="taxtDiv_4">
									<td></td>
									<td></td>
									<td><i>VAT (%)</i></td>
									<td><input type="text" name="txtVAT" id="txtVAT" class="form-control numeric" placeholder="%" autocomplete="off" value="" onKeyUp="getCalculate();" /></td>
									<td><input type="text" name="txtVAT_Amount" id="txtVAT_Amount" class="form-control numeric" placeholder="%" autocomplete="off" readonly="true" value="" /></td>
								</tr>
								<tr id="taxtDiv_4">
									<td></td>
									<td colspan="3">Total</td>
									<td><input type="text" class="form-control" name="txtTotalAmount" id="txtTotalAmount" value="" readonly="true" /></td>
								</tr>
							</tfoot>
						</table>
					</div>


					<div class="row">
						<div class="col-xs-12">
							<h2 class="page-header">
								Dispatch Details
							</h2>
						</div><!-- /.col -->
					</div>

					<div class="box-body table-responsive" style="overflow:auto;">
						<table class="table table-bordered table-striped">
							<tbody>
								<tr>
									<td width="25%">Delivery Note No.</td>
									<td width="25%"><input type="text" name="txtDeliveryNoteNo" id="txtDeliveryNoteNo" class="form-control" placeholder="Delivery Note No." autocomplete="off" value=""></td>
									<td width="25%">Delivery Date</td>
									<td width="25%"><input type="text" name="txtDeliveryDate" id="txtDeliveryDate" autocomplete="off" placeholder="dd-mm-yyyy" class="form-control" value="" /></td>
								</tr>
								<tr>
									<td>Dispatch Doc No.</td>
									<td><input type="text" name="txtDispatchDocNo" id="txtDispatchDocNo" class="form-control" placeholder="Dispatch Doc No." autocomplete="off" value=""></td>
									<td>Dispatched Through</td>
									<td><input type="text" name="txtDispatchedThrough" id="txtDispatchedThrough" class="form-control" placeholder="Dispatched Through" autocomplete="off" value=""></td>
								</tr>
								<tr>
									<td>Destination</td>
									<td><input type="text" name="txtDispatchDestination" id="txtDispatchDestination" class="form-control" placeholder="Destination" autocomplete="off" value=""></td>
									<td>Carrier Name/Agent</td>
									<td><input type="text" name="txtCarrierAgentName" id="txtCarrierAgentName" class="form-control" placeholder="Carrier Name/Agent" autocomplete="off" value=""></td>
								</tr>
								<tr>
									<td>Bill Of Loading/LR-RR No.</td>
									<td><input type="text" name="txtBillOfLoading" id="txtBillOfLoading" class="form-control" placeholder="Bill Of Loading/LR-RR No." autocomplete="off" value=""></td>
									<td>Date </td>
									<td><input type="text" name="txtLoadingDate" id="txtLoadingDate" class="form-control" placeholder="dd-mm-yyyy" autocomplete="off" value=""></td>
								</tr>
								<tr>
									<td>Motor Vehicle No.</td>
									<td><input type="text" name="txtVehicleNo" id="txtVehicleNo" class="form-control" placeholder="Motor Vehicle No." autocomplete="off" value=""></td>
									<td></td>
									<td></td>
								</tr>
							</tbody>
						</table>
					</div>


					<div class="box-footer" align="right">
						<button type="submit" class="btn btn-primary btn-flat" onClick="return getValidate(1);">Submit to Edit</button>&nbsp;&nbsp;<button type="submit" class="btn btn-warning btn-flat" onClick="return getValidate(2);">Submit to Close</button>
						<input type="hidden" name="action" value="submit" /><input type="hidden" name="upstatus" id="upstatus" value="" />
					</div>



				</form>

				<!--   content ends here..................-->
			</section><!-- /.content -->
		</aside><!-- /.right-side -->

	</div><!-- ./wrapper -->
	<?php $display->footer(); ?>
	<link href="../../css/jquery.alerts.css" rel="stylesheet" type="text/css" />
	<script src='../../js/jquery.autosize.js'></script>
	<script language="JavaScript" type="text/javascript" src="../../js/jquery.alerts.js"></script>
	<script src="../../js/timer.js" type="text/javascript"></script>
	<link href="../../css/datepicker/datepicker.css" rel="stylesheet" type="text/css" />
	<script src="../../js/bootstrap-datepicker.js" type="text/javascript"></script>
	<script language="JavaScript" type="text/javascript" src="../../js/jquery.numeric.js"></script>
	<script language="JavaScript" type="text/javascript" src="../../js/jquery.calculation-min.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$('#rdoTaxApplicable1').on('ifChecked', function() {
				showhidetaxDiv();
			});

			$('#rdoTaxApplicable2').on('ifChecked', function() {
				showhidetaxDiv();
			});

			//-----------------------------------------------------------------
			$('#rdoGSTVAT1').on('ifChecked', function() {
				showhidetaxDiv();
			});

			$('#rdoGSTVAT2').on('ifChecked', function() {
				showhidetaxDiv();
			});
			$('#txtDate,#txtDeliveryDate,#txtLoadingDate').datepicker({
				format: 'dd-mm-yyyy',
				autoclose: true
			});
			$('.numeric').numeric();
			$("#frm1").validate({
				rules: {

				},
				messages: {

				},
				submitHandler: function(form) {
					jAlert('<b style="font-size:25px;">Please wait . . .</b><br><br><img src="../../img/loading.gif"  />', 'Alert');
					$("#popup_container").css({
						"background": "rgba(255,255,255,0.1)",
						"border": "10px solid rgba(255,255,255,0.1)",
						"width": "100%"
					});
					$("#popup_content").css({
						"background": "none",
						"text-align": "center"
					});
					$("#popup_ok,#popup_title").hide();
					form.submit();
				}
			});
			showhidetaxDiv();
		});

		function readonlytextbox() {
			if ($("#txtIGST").val() > 0) {
				$("#txtSGST,#txtCGST").attr('readonly', true);
				$("#txtSGST,#txtCGST").val(0);
			} else {
				$("#txtSGST,#txtCGST").attr('readonly', false);
			}

			if ($("#txtSGST").val() > 0 || $("#txtCGST").val() > 0) {
				$("#txtIGST").attr('readonly', true);
				$("#txtIGST").val(0);
			} else {
				$("#txtIGST").attr('readonly', false);
			}
		}

		function showhidetaxDiv() {
			if ($("#rdoTaxApplicable1").is(":checked")) {
				$("#taxRadioDiv,#taxtDiv_1,#taxtDiv_2,#taxtDiv_3,#taxtDiv_4").show();
				if ($("#rdoGSTVAT1").is(":checked")) {
					$("#taxtDiv_1,#taxtDiv_2,#taxtDiv_3").show();
					$("#taxtDiv_4").hide();
				} else {
					$("#taxtDiv_1,#taxtDiv_2,#taxtDiv_3").hide();
					$("#taxtDiv_4").show();
				}
			} else {
				$("#taxRadioDiv,#taxtDiv_1,#taxtDiv_2,#taxtDiv_3,#taxtDiv_4").hide();
			}
		}

		function getCalculate() {
			for (var i = 0; i <= $("#txtRowCount").val(); i++) {
				var txtItemQty = parseFloat($("#txtItemQty_" + i).val());
				if (isNaN(txtItemQty)) {
					txtItemQty = 0;
				}
				var txtItemRate = parseFloat($("#txtItemRate_" + i).val());
				if (isNaN(txtItemRate)) {
					txtItemRate = 0;
				}
				var txtItemAmount = parseFloat(txtItemQty) * parseFloat(txtItemRate);
				if (isNaN(txtItemAmount)) {
					txtItemAmount = 0;
				}
				$("#txtItemAmount_" + i).val(txtItemAmount.toFixed(2));
			}
			var txtItemAmount = parseFloat($("[id^=txtItemAmount_]").sum());

			var txtSGST = parseFloat($("#txtSGST").val());
			if (isNaN(txtSGST)) {
				txtSGST = 0;
			}
			var txtCGST = parseFloat($("#txtCGST").val());
			if (isNaN(txtCGST)) {
				txtCGST = 0;
			}
			var txtIGST = parseFloat($("#txtIGST").val());
			if (isNaN(txtIGST)) {
				txtIGST = 0;
			}
			var txtVAT = parseFloat($("#txtVAT").val());
			if (isNaN(txtVAT)) {
				txtVAT = 0;
			}

			var txtSGST_Amount = parseFloat(parseFloat(txtItemAmount) * parseFloat(txtSGST)) / 100;
			if (isNaN(txtSGST_Amount)) {
				txtSGST_Amount = 0;
			}
			var txtCGST_Amount = parseFloat(parseFloat(txtItemAmount) * parseFloat(txtCGST)) / 100;
			if (isNaN(txtCGST_Amount)) {
				txtCGST_Amount = 0;
			}
			var txtIGST_Amount = parseFloat(parseFloat(txtItemAmount) * parseFloat(txtIGST)) / 100;
			if (isNaN(txtIGST_Amount)) {
				txtIGST_Amount = 0;
			}
			var txtVAT_Amount = parseFloat(parseFloat(txtItemAmount) * parseFloat(txtVAT)) / 100;
			if (isNaN(txtVAT_Amount)) {
				txtVAT_Amount = 0;
			}

			$("#txtSGST_Amount").val(parseFloat(txtSGST_Amount).toFixed(2));
			$("#txtCGST_Amount").val(parseFloat(txtCGST_Amount).toFixed(2));
			$("#txtIGST_Amount").val(parseFloat(txtIGST_Amount).toFixed(2));
			$("#txtVAT_Amount").val(parseFloat(txtVAT_Amount).toFixed(2));

			if ($("#rdoTaxApplicable1").is(":checked")) {
				if ($("#rdoGSTVAT1").is(":checked")) {
					var txtAmtPayableWithTax = parseFloat(txtItemAmount) + parseFloat(txtSGST_Amount) + parseFloat(txtCGST_Amount) + parseFloat(txtIGST_Amount);
					$('#txtTotalAmount').val(parseFloat(txtAmtPayableWithTax).toFixed(2));
				} else {
					var txtAmtPayableWithTax = parseFloat(txtItemAmount) + parseFloat(txtVAT_Amount);
					$('#txtTotalAmount').val(parseFloat(txtAmtPayableWithTax).toFixed(2));
				}
			} else {
				$('#txtTotalAmount').val(parseFloat(txtItemAmount).toFixed(2));
			}
			getValidate(1);
		}


		function addItemRow() {
			var id = $("#txtRowCount").val();
			if ($("#selItemID_" + id).val() != '') {
				id = (id - 1) + 2;
				$('<tr id="RowItem_' + id + '"><td><a href="#tbb' + id + '" onclick="removeItemRows(' + id + ');"><i class="fa fa-times" style="color:red;"></i></a></td><td><input type="text" name="selItemID_' + id + '" id="selItemID_' + id + '" class="form-control required" value="" onChange="getReplaceRate(' + id + ');"/></td><td><input type="text" class="form-control numeric" name="txtItemQty_' + id + '" id="txtItemQty_' + id + '" value="" autocomplete="off" onKeyUp="getCalculate();"/></td><td><input type="text" class="form-control numeric" name="txtItemRate_' + id + '" id="txtItemRate_' + id + '" value="" autocomplete="off" onKeyUp="getCalculate();"/><input type="hidden" name="txtItemPRate_' + id + '" id="txtItemPRate_' + id + '" value=""/></td><td><input type="text" class="form-control numeric" name="txtItemAmount_' + id + '" id="txtItemAmount_' + id + '" value="" readonly="true"/></td></tr>').appendTo("#itemtbody");
				$("#txtRowCount").val(id);
				$("#selItemID_" + id).select2({
					minimumInputLength: 1,
					placeholder: '---Select from list---',
					allowClear: true,
					ajax: {
						url: "options.php?id=165&idd=0",
						dataType: 'json',
						quietMillis: 100,
						data: function(term, page) {
							return {
								limit: -1,
								q: term
							};
						},
						results: function(data, page) {
							return {
								results: data
							}
						}
					},
					formatResult: function(doc) {
						return "<div class='select2-user-result'>" + doc.name + "</div>";
					},
					formatSelection: function(doc) {
						return doc.name;
					}
				});
				$(".numeric").numeric();
			} else {
				jAlert('Please fill previous data', 'Alert');
			}

		}

		function removeItemRows(var1) {
			jConfirm('Are you sure you want to remove this entry permanently ?', 'Confirmation', function(r) {
				if (r) {
					$("#RowItem_" + var1).remove();
					getBunkerCalculation();
				} else {
					return false;
				}
			});
		}

		function getReplaceRate(val) {
			if ($("#selItemID_" + val).val() != '') {
				var selitemtext = $("#selItemID_" + val).select2('data').name;
				var textarray = selitemtext.split("::");

				var ratearray = textarray[1].split(":");
				$("#txtItemPRate_" + val).val(ratearray[1]);

				var qtyarray = textarray[2].split(":");
			} else {
				$("#txtItemPRate_" + val).val('');
			}
			getValidate(1);
		}

		function getValidate(val) {
			$("#upstatus").val(val);
			for (var i = 1; i <= $("#txtRowCount").val(); i++) {
				if (typeof($("#selItemID_" + i).val()) != 'undefined') {
					if ($("#selItemID_" + i).val() != '') {
						var selitemtext = $("#selItemID_" + i).select2('data').name;

						var textarray = selitemtext.split("::");

						var ratearray = textarray[1].split(":");
						$("#txtItemPRate_" + i).val(ratearray[1]);

						var qtyarray = textarray[2].split(":");

						var sqty = parseFloat($("#txtItemQty_" + i).val());
						if (isNaN(sqty)) {
							sqty = 0;
						}
						$.post("options.php?id=167", {
							itemid: "" + $("#selItemID_" + i).select2('data').id + "",
							purchaserate: "" + ratearray[1] + "",
							rowid: "" + i + "",
							saleqty: "" + $("#txtItemQty_" + i).val() + "",
							saleid: 0
						}, function(data) {
							var jsondata = JSON.parse(data);
							if (jsondata['diff'] == 0) {
								var selitemtext = $("#selItemID_" + jsondata['rowid']).select2('data').name;
								var textarray = selitemtext.split("::");
								var ratearray = textarray[1].split(":");

								jAlert('Entered Quantity for Item:' + textarray[0] + ' Is Greated Than Available Stock.', 'Alert');
								$("#txtItemQty_" + jsondata['rowid']).val(0);
								$("#txtItemQty_" + jsondata['rowid']).focus();
								return false;

							}
						});
					} else {
						jAlert('Please select Item first.', 'Alert');
						return false;
					}
				}
			}
		}
	</script>
</body>

</html>