<?php session_start(); ?> <!-- session start -->
<?php include("../include/config.php"); ?> <!-- database connection -->
<?php include("../include/connect_url.php"); ?> <!-- connection url/link folder -->
<?php include("../include/date_time.php"); ?> <!-- date & time format -->
<?php include("../database/account.php"); ?> <!-- query database account -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title><?php include("../template/title.php"); ?></title>

<link rel="shortcut icon" href="<?php echo $connect_url_data; ?>/favicon.ico" />

<link href="<?php echo $connect_url_data; ?>/css/styles.css" rel="stylesheet" type="text/css" />
<!--[if IE]> <link href="<?php echo $connect_url_data; ?>/css/ie.css" rel="stylesheet" type="text/css"> <![endif]-->
<link rel="stylesheet" href="<?php echo $connect_url_data; ?>/font/font-awesome-4.3.0/css/font-awesome.min.css">

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/download/jquery183.js"></script> 
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/download/jquery192.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/charts/excanvas.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/charts/jquery.flot.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/charts/jquery.flot.orderBars.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/charts/jquery.flot.pie.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/charts/jquery.flot.resize.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/charts/jquery.sparkline.min.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/tables/jquery.sortable.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/tables/jquery.resizable.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.autosize.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.uniform.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.inputlimiter.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.maskedinput.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.autotab.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.select2.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.dualListBox.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.cleditor.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.ibutton.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.validationEngine.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/globalize/globalize.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/globalize/globalize.culture.de-DE.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/globalize/globalize.culture.ja-JP.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/uploader/plupload.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/uploader/plupload.html4.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/uploader/plupload.html5.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/uploader/jquery.plupload.queue.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/wizards/jquery.form.wizard.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/wizards/jquery.validate.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/wizards/jquery.form.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.collapsible.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.breadcrumbs.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.tipsy.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.progress.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.timeentry.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.colorpicker.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.jgrowl.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.fancybox.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.fileTree.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.sourcerer.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/others/jquery.fullcalendar.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/others/jquery.elfinder.js"></script>

<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/forms/jquery.mousewheel.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/plugins/ui/jquery.easytabs.min.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/files/bootstrap.js"></script>
<script type="text/javascript" src="<?php echo $connect_url_data; ?>/js/files/functions.js"></script>

</head>

<body>



<?php
$query_transaction_charge_item2 = mysql_query("SELECT * FROM tbl_transaction_charge_item WHERE id='$_GET[transaction_charge_item_id]'"); 
while($row= mysql_fetch_assoc($query_transaction_charge_item2))
{
    $db_transaction_charge_item2_id = $row['id'];
    $db_transaction_charge_item2_item_id= $row['item_id'];
    $db_transaction_charge_item2_qty = $row['qty'];
    $db_transaction_charge_item2_price = $row['price'];
    $db_transaction_charge_item2_total = $row['total'];
    $db_transaction_charge_item2_user_id = $row['user_id'];
    $db_transaction_charge_item2_date = $row['date'];
    $db_transaction_charge_item2_time = $row['time'];
    $db_transaction_charge_item2_a_status = $row['a_status'];
}
?>

<?php    
$query_item2 = mysql_query("SELECT * FROM tbl_item WHERE id='$db_transaction_charge_item2_item_id'"); 
while($row= mysql_fetch_assoc($query_item2))
{
    $db_item2_id = $row['id'];
    $db_item2_item_no = $row['item_no'];
    $db_item2_barcode = $row['barcode'];
    $db_item2_item = $row['item'];
    $db_item2_description = $row['description'];
    $db_item2_item_category_id = $row['item_category_id'];
    $db_item2_user_id= $row['user_id'];
    $db_item2_date = $row['date'];
    $db_item2_time = $row['time'];
    $db_item2_a_status = $row['a_status'];
}
?>

<?php
$query_item_price2 = mysql_query("SELECT * FROM tbl_item_price WHERE item_id='$db_item2_id' AND a_status=1");
while($row= mysql_fetch_assoc($query_item_price2))
{
    $db_item_price2_id = $row['id'];
    $db_item_price2_price = $row['price'];
    $db_item_price2_price_nf =str_replace(' ','', str_replace(',00','', $db_item_price2_price));
}
?>


<?php
if($_POST)
{

$qty = mysql_real_escape_string($_POST['qty']);

if($qty){

$price_total2  = $qty * $db_item_price2_price_nf;
//number format
include("../include/number_format.php");

$sql = "UPDATE tbl_transaction_charge_item SET   qty='$qty', price='$db_item_price2_price', total='$price_total2_nf' WHERE  id ='$db_transaction_charge_item2_id'";
$result = mysql_query($sql) or die("Error: Failed to Update!");


echo "<script> 
window.close();	
</script> ";
}

} 
?>

<form name="form" id="form" action="<?php echo $connect_url_data; ?>/charge/e/<?php echo $db_transaction_charge_item2_id; ?>" class="main" method="POST"  enctype="multipart/form-data">
            <fieldset style="margin-top:-35px;">
                <div class="widget fluid">
                    <div class="whead"><h6><span class="fa fa-dropbox" style="margin-top:-2px;"></span>&nbsp; <?php echo $db_item2_item; ?></h6></div>
                    
		    <!-- Tabs -->
		<div class="fluid" >
                <div class="widget grid12" style="margin-top:-0px;">       
                    <div class="tabs">
                        <ul>
                            <li><a href="#tabs-1">Item Details</a></li>
                            <li><a href="#tabs-2">Other Details</a></li>
                        </ul>
			
			
			
                <div id="tabs-1">
                    
                    <div class="formRow">
                        <div class="grid2"><label>Barcode:</label></div>
                        <div class="grid10"><?php echo $db_item2_barcode; ?></div>
                    </div>
		    
		    <div class="formRow">
                        <div class="grid2"><label>Item:</label></div>
                        <div class="grid10"><?php echo $db_item2_item; ?></div>
                    </div>
                    
                      <div class="formRow">
                        <div class="grid2"><label>Qty:</label></div>
                        <div class="grid10"><input type="text" name="qty" id="qty" value="<?php echo $db_transaction_charge_item2_qty; ?>"/></div>
                    </div>
		    
                      <div class="formRow">
                        <div class="grid2"><label>Price:</label></div>
                        <div class="grid10"><?php echo $db_transaction_charge_item2_price; ?></div>
                    </div>
		    
                      <div class="formRow">
                        <div class="grid2"><label>Total:</label></div>
                        <div class="grid10"><?php echo $db_transaction_charge_item2_total; ?></div>
                    </div>
		    
		    
	     </div>
	    <!-- end tabs 1 -->
	    
	    <div id="tabs-2"></div>
	
	    
</div>
</div>	    
<!-- end tabs body -->
                  
                </div>
            </fieldset>
	    
    <div class="formRow">
                    <div class="grid2"></div>
                    <div class="grid10">
			<a href="#" class="buttonM bBlue" onclick="document.getElementById('form').submit();"><span class="fa fa-save"></span><span>Save</span></a>
		        <a href="#" class="buttonM bBlue" onclick="window.close();"><span class="fa fa-times-circle"></span><span>Cancel</span></a>
		    </div>
		    
		    </div>
             
</body>
</html>
