<?php
$permission  = explode(',',$_SESSION['permission_id']);
if(!in_array(14,$permission) && !in_array(1,$permission) ){

?>
<script>
window.location="starter.php";
</script>
<?php
}
?>
<style >
	tfoot {
    	display: table-header-group !important;
	}

	.dataTable {
		font-size: 11.5px !important;
	}
</style>

<div id="add-form-cont" class="panel-collapse collapse panel" aria-expanded="false" style="height: 0px; position: relative; top:-3px; width:98%; margin:0px auto;">
	<div class="panel-body">
		<form class="form-horizontal" method="post" id="add_form" enctype="multipart/form-data">
			<div>
			<input type="hidden" id="access_token" name="access_token"  value="">

				<div class="col-sm-12">

					<div class="form-group">
						<div class="col-sm-6">
							<div class="input-group">
								<label class="input-group-addon"> اسم المخزن </label>
								<input type="text" placeholder=" اسم المخزن " class="form-control" name="objname" id="objname" required="required">
							</div>
						</div>
						<div class="col-sm-6">
							<div class="input-group">
								<label class="input-group-addon"> الوصف </label>
								<select name="stock_type" id="stock_type" class="form-control" required="required">
										<option value="" selected="selected">نوع المخزن</option>
										<option value="0" >خزن</option>
										<option value="1" >انتاج</option>
								</select>
							</div>
						</div>


					</div>

					<div class="form-group" >
						<div class="form-group has-feedback has-feedback-left form-group-material col-sm-12">
							<label class="control-label">الملاحظات</label>
							<textarea type="text" id="stock_note" name="stock_note" class="form-control" placeholder="الملاحظات" > </textarea> 
							<div class="form-control-feedback">
								<i class="icon-notebook text-muted"></i>
							</div>
						</div>
					</div>

				</div>
			</div>

			<div class="text-right">
				<button type="submit" id="submit_add_btn" class="btn btn-primary btn-labeled btn-labeled-left">
					حفظ <b><i class="icon-floppy-disk"></i></b>
				</button>
				<a href="#add-form-cont" id="add_form_cancel" class="btn btn-labeled btn-labeled-left bg-danger heading-btn" data-toggle="collapse">
					اغلاق  <b><i class="icon-cross"></i></b>
				</a>
			</div>
		</form>
	</div>
</div>

<div id="edit_form_cont" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg" style="width: 84%">
		<form class="form-horizontal"  name="edit_form" method="post" id="edit_form" enctype="multipart/form-data">
			

			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"><i class="icon-cross"></i></button>
					<h4 class="modal-title multi_lang">  نقل الى مخزن اخر </h4>
				</div>

				<div class="modal-body">
					<input type="hidden" name="itemid" id="edit_objid" value="">

					<div class="col-sm-12">
						<div class="form-group">

							<div class="alert text-violet-800 alpha-violet alert-bordered col-sm-3">
								
								<span class="text-black multi_lang">المخزن الحالي</span> : <a href="#" class="alert-link curnt_stock"></a>
						    </div>

						    <div class="alert text-violet-800 alpha-violet alert-bordered col-sm-3">
								
								<span class="text-black multi_lang">الرمز المحلي</span> : <a href="#" class="alert-link erbil_code"></a>
						    </div>

						    <div class="alert text-violet-800 alpha-violet alert-bordered col-sm-3">
								
								<span class="text-black multi_lang">الرمز الاجنبي</span> : <a href="#" class="alert-link turkish_code"></a>
						    </div>

						    <div class="alert text-violet-800 alpha-violet alert-bordered col-sm-3">
								
								<span class="text-black multi_lang">طول المادة</span> : <a href="#" class="alert-link product_leng"></a> <span> م</span>
						    </div>



						</div>

						<div class="form-group">

							<div class="col-sm-6">
								<div class="input-group">
									<label class="input-group-addon multi_lang"> اسم المخزن </label>
									<select name="stock_id" id="stock_id" class="form-control multi_lang" required="required">
											
									</select>
								</div>
							</div>

						</div>

					</div>
						
				</div>
				<div class="modal-footer">
					<button type="submit" class="btn btn-labeled btn-labeled-left heading-btn btn-primary"> <span class="multi_lang">حفظ</span> <b><i class="icon-floppy-disk"></i></b>
					</button>
					<button type="button" class="btn btn-warning" data-dismiss="modal"> <span class="multi_lang">الغاء</span>
					</button>
				</div>
			</div>
		</form>
	</div>
</div>

<div id="add_damage_form_cont" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg" style="width: 84%">
		<form class="form-horizontal"  name="add_damage_form" method="post" id="add_damage_form" enctype="multipart/form-data">
			

			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"><i class="icon-cross"></i></button>
					<h4 class="modal-title multi_lang">  اضافة الطول التالف </h4>
				</div>

				<div class="modal-body">
					<input type="hidden" name="id_damage" id="id_damage" value="">
					<div class="col-sm-12">

						<div class="form-group">

							<div class="alert text-violet-800 alpha-violet alert-bordered col-sm-3">
								
								<span class="text-black multi_lang">المخزن الحالي</span> : <a href="#" class="alert-link curnt_stock"></a>
						    </div>

						    <div class="alert text-violet-800 alpha-violet alert-bordered col-sm-3">
								
								<span class="text-black multi_lang">الرمز المحلي</span> : <a href="#" class="alert-link erbil_code"></a>
						    </div>

						    <div class="alert text-violet-800 alpha-violet alert-bordered col-sm-3">
								
								<span class="text-black multi_lang">الرمز الاجنبي</span> : <a href="#" class="alert-link turkish_code"></a>
						    </div>

						    <div class="alert text-violet-800 alpha-violet alert-bordered col-sm-3">
								
								<span class="text-black multi_lang">طول المادة</span> : <a href="#" class="alert-link product_leng"></a> <span> م</span>
						    </div>



						</div>


						<div class="form-group">

							<div class="col-sm-6">
								<div class="input-group">
									<label class="input-group-addon multi_lang"> الكمية التالفة (متر) </label>
									<input type="number" step="0.1" name="damage_length" id="damage_length" class="form-control multi_lang" required="required" placeholder=" الكمية التالفة (متر)" >

								</div>
							</div>

						</div>

					</div>
				</div>
				<div class="modal-footer">
					<button type="submit" class="btn btn-labeled btn-labeled-left heading-btn btn-primary"> <span class="multi_lang">حفظ</span> <b><i class="icon-floppy-disk"></i></b>
					</button>
					<button type="button" class="btn btn-warning" data-dismiss="modal"> <span class="multi_lang">الغاء</span>
					</button>
				</div>
			</div>
		</form>
	</div>
</div>

<div id="production_form_cont" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg" style="width: 84%">
		<form class="form-horizontal"  name="production_form" method="post" id="production_form" enctype="multipart/form-data">
			

			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"><i class="icon-cross"></i></button>
					<h4 class="modal-title multi_lang">  اضافة الطول المستخدم في الانتاج </h4>
				</div>

				<div class="modal-body">
					<input type="hidden" name="id_production" id="id_production" value="">

					<div class="col-sm-12">
						<div class="form-group">

							<div class="alert text-violet-800 alpha-violet alert-bordered col-sm-3">
								
								<span class="text-black multi_lang">المخزن الحالي</span> : <a href="#" class="alert-link curnt_stock"></a>
						    </div>

						    <div class="alert text-violet-800 alpha-violet alert-bordered col-sm-3">
								
								<span class="text-black multi_lang">الرمز المحلي</span> : <a href="#" class="alert-link erbil_code"></a>
						    </div>

						    <div class="alert text-violet-800 alpha-violet alert-bordered col-sm-3">
								
								<span class="text-black multi_lang">الرمز الاجنبي</span> : <a href="#" class="alert-link turkish_code"></a>
						    </div>

						    <div class="alert text-violet-800 alpha-violet alert-bordered col-sm-3">
								
								<span class="text-black multi_lang">طول المادة</span> : <a href="#" class="alert-link product_leng"></a> <span> م</span>
						    </div>



						</div>

						<div class="form-group">
							<div class="col-sm-8">
								<div class="input-group">
									<label class="input-group-addon multi_lang"> الكمية المستخدمة في الانتاج (متر) </label>
									<input type="number" step="0.1" name="used_length" id="used_length" class="form-control multi_lang" required="required" placeholder=" الكمية المستخدمة في الانتاج (متر)" >

								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="submit" class="btn btn-labeled btn-labeled-left heading-btn btn-primary"> <span class="multi_lang">حفظ</span> <b><i class="icon-floppy-disk"></i></b>
					</button>
					<button type="button" class="btn btn-warning" data-dismiss="modal"> <span class="multi_lang">الغاء</span>
					</button>
				</div>
			</div>
		</form>
	</div>
</div>


<!-- Quick stats boxes -->
		<div class="row">

			<!-- <div class="col-sm-6 col-md-2">
				<div class="panel panel-body bg-success-400 has-bg-image">
					<div class="media no-margin">
						<div class="media-body">
							<h3 class="no-margin text-black" id="total_cnt">0</h3>
							<span class="text-uppercase text-size-lg multi_lang">عدد الطوب</span>
						</div>

						<div class="media-right media-middle">
							<i class="icon-list-numbered icon-3x opacity-75"></i>
						</div>
					</div>
				</div>
			</div>

			<div class="col-sm-6 col-md-2">
				<div class="panel panel-body bg-success-400 has-bg-image">
					<div class="media no-margin">
						<div class="media-body">
							<h3 class="no-margin text-black" id="total_length">0</h3>
							<span class="text-uppercase text-size-lg multi_lang">الطول الكلي </span>
						</div>

						<div class="media-right media-middle">
							<i class="icon-design icon-3x opacity-75"></i>
						</div>
					</div>
				</div>
			</div>

			<div class="col-sm-6 col-md-2">
				<div class="panel panel-body bg-success-400 has-bg-image">
					<div class="media no-margin">
						<div class="media-body">
							<h3 class="no-margin text-black" id="total_used">0</h3>
							<span class="text-uppercase text-size-lg multi_lang">مستخدم  بلانتاج</span>
						</div>

						<div class="media-right media-middle">
							<i class="icon-scissors icon-3x opacity-75"></i>
						</div>
					</div>
				</div>
			</div>

			<div class="col-sm-6 col-md-2">
				<div class="panel panel-body bg-success-400 has-bg-image">
					<div class="media no-margin">
						<div class="media-body">
							<h3 class="no-margin text-black" id="total_sold">0</h3>
							<span class="text-uppercase text-size-lg multi_lang">الطول المباع</span>
						</div>

						<div class="media-right media-middle">
							<i class="icon-cash icon-3x opacity-75"></i>
						</div>
					</div>
				</div>
			</div>

			<div class="col-sm-6 col-md-2">
				<div class="panel panel-body bg-success-400 has-bg-image">
					<div class="media no-margin">
						<div class="media-body">
							<h3 class="no-margin text-black" id="total_damages">0</h3>
							<span class="text-uppercase text-size-lg multi_lang">التالف</span>
						</div>

						<div class="media-right media-middle">
							<i class="icon-blocked icon-3x opacity-75"></i>
						</div>
					</div>
				</div>
			</div>

			<div class="col-sm-6 col-md-2">
				<div class="panel panel-body bg-success-400 has-bg-image">
					<div class="media no-margin">
						<div class="media-body">
							<h3 class="no-margin text-black" id="total_remaind">0</h3>
							<span class="text-uppercase text-size-lg multi_lang">المتبقي</span>
						</div>

						<div class="media-right media-middle">
							<i class="icon-stack3 icon-3x opacity-75"></i>
						</div>
					</div>
				</div>
			</div>
 -->

 			
	 		<div class="panel panel-flat panel-body alpha-warning1">


	 			<div class="form-group has-feedback has-feedback-left  col-sm-4">
					
					<button type="button" class="btn bg-teal-400 btn-labeled dropdown-toggle" data-toggle="dropdown">
						<b><i class="icon-filter4"></i></b>
						<span id="stock_btn" class="multi_lang">المخازن</span>  
						<span class="caret"></span>
					</button>
		              <ul class="dropdown-menu dropdown-menu-right" id="stock_filter">
		              </ul>
					
				</div>

	 			<!-- <div class="col-sm-6 col-md-3">
	              <button type="button" class="btn bg-teal-400 btn-labeled dropdown-toggle" data-toggle="dropdown"><b><i class="icon-filter4"></i></b><span id="stock_btn" class="multi_lang">المخازن</span>  <span class="caret"></span></button>
	              <ul class="dropdown-menu dropdown-menu-right" id="stock_filter">
	              </ul>
	          	</div> -->


	          	<div class="form-group has-feedback has-feedback-left  col-sm-4">
					
					<button type="button" id="status_color" class="btn bg-danger-400 btn-labeled dropdown-toggle" data-toggle="dropdown">
						<b><i class="icon-filter4"> </i></b>
						<span id="status_btn" class="multi_lang">فلتر الحالة</span>  
						<span class="caret"></span>
					</button>
	              	<ul class="dropdown-menu dropdown-menu-right" id="status_filter">
	              	</ul>
					
				</div>

				<div class="col-sm-4 col-md-4">
					<div class="panel panel-body bg-success-400 has-bg-image">
						<div class="media no-margin">
							<div class="media-body">
								<h3 class="no-margin text-black" id="total_remaind">0</h3>
								<span class="text-uppercase text-size-lg multi_lang">المتبقي</span>
							</div>

							<div class="media-right media-middle">
								<i class="icon-stack3 icon-3x opacity-75"></i>
							</div>
						</div>
					</div>
				</div>

	          	<!-- <div class="col-sm-6 col-md-3">
	              <button type="button" id="status_color" class="btn bg-danger-400 btn-labeled dropdown-toggle" data-toggle="dropdown"><b><i class="icon-filter4"> </i></b><span id="status_btn" class="multi_lang">فلتر الحالة</span>  <span class="caret"></span></button>
	              <ul class="dropdown-menu dropdown-menu-right" id="status_filter">
	              </ul>
	            </div> -->

	            

					<div class="form-group has-feedback has-feedback-left  col-sm-4">
						<!-- <label class="control-label multi_lang">بحث عن مادة في جميع المخازن</label> -->
						<select onchange1="search_Product();" multiple="multiple" class="form-control text-black multi_lang" data-live-search="true" name="product_id_search" id="product_id_search" data-width="100%" placeholder="اسم المادة">
		                
		                </select>
					</div>

					<div class="form-group has-feedback has-feedback-left  col-sm-6">

		                <button type="button" class="btn bg-info-400 btn-labeled " onclick="show_detail_page();">
		                  <b><i class="icon-search4"></i></b>عرض تفاصيل هذه المادة في جميع المخازن
		                </button>

		                <button type="button" class="btn btn-danger" onclick="deselect_all();" id="deselect-all-values">
						ازالة الفلتر
						</button>
					</div>
				
			</div>


           

		
		



		</div>
		<!-- /quick stats boxes -->







<!-- Individual column searching (text inputs) -->
<div class="panel panel-flat">
	
	<table class="table datatable-column-search-inputs" style="font-size: 13.5px;">
		<thead>
			<tr>
                <th >ID</th>
               
                <th class="multi_lang">الرمز المحلي</th>
                <th class="multi_lang">الرمز الاجنبي</th>
                <th class="multi_lang">Barcode</th>
                <th class="multi_lang">الصنف</th>
                <th class="multi_lang">عدد الطوب الكلي</th>
                <th class="multi_lang">الطول الكلي (متر)</th>
                <th class="multi_lang">المستخدم في الانتاج  (متر)</th>
                <th class="multi_lang">الطول المباع (متر)</th>
                <th class="multi_lang">التالف (متر)</th>
                <th class="multi_lang">الاجزاء</th>
                <th  class="text-center multi_lang" > المتبقي </th>
            </tr>
		</thead>
		<tbody>
			
		</tbody>
		<tfoot>
			<tr>
                <td>Name</td>
                <td>Position</td>
                
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
		</tfoot>
	</table>
</div>
<!-- /individual column searching (text inputs) -->



<script type="text/javascript" src="controllers/stock_report.js?random=<?php echo uniqid(); ?>"></script>