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

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

	.dataTable {
        font-size: 11.5px;
	}

	.thumb img:not(.media-preview) {
    height: 100px;
}

</style>

	
	<div id="loader_modal" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg">
				<div class="modal-content">
					
					
					<div class="modal-body" >
						<h1>
							
							<i class="icon-spinner3 spinner position-left" style="font-size: 40px;"></i>
							<span id="loader_msg"></span>
						</h1>	
					</div>
				
					
				</div>
		</div>
	</div>

	

	<div id="show_bills_modal" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg">
			<form class="form-horizontal"  name="show_bills_form" method="post" id="show_bills_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 id="invoce_html_pay">
						<div class="modal-body" >
								<input type="hidden" name="bill_id" id="bill_id">
								<div id="bills_show">
									<!-- Borderless table -->


									<!-- /borderless table -->
								</div>
						</div>
					</div>
					<div class="modal-footer">
						<div id="link_pdf_pay"></div>
						<button type="submit" class="btn btn-labeled btn-labeled-left heading-btn btn-primary" id="pdf_pay"> <span class="multi_lang">توليد  PDF</span>  <b><i class="icon-file-pdf"></i></b>
						</button>
						<button type="submit" class="btn btn-labeled btn-labeled-left heading-btn btn-success" id="print_pay"><span class="multi_lang">طباعة</span>  <b><i class=" icon-printer2"></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="profit_form_cont" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg" style="width: 80%;">
			<form class="form-horizontal"  name="profit_form" method="post" id="profit_form" enctype="multipart/form-data">
				<input type="hidden" id="access_token" name="access_token"  value="">

				<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">
							
							<div class="col-sm-12">

								<div class="form-group">

									<div class="form-group has-feedback has-feedback-left  col-sm-2">
										<label class="control-label animate multi_lang">اسم الموظف</label>
										
										<select name="profit_staff_name" id="profit_staff_name" class="form-control" required="required">
										

										</select>
										<div class="form-control-feedback">
											<i class="icon-user-tie text-muted"></i>
										</div>
									</div>
									
									
									<div class="form-group has-feedback has-feedback-left form-group-material col-sm-3">
										<label class="control-label multi_lang">مبلغ الارباح</label>
										<input type="text" id="profit_amount" name="profit_amount" class="form-control multi_lang" placeholder="مبلغ الارباح" data-value="" required="required" >
										<div class="form-control-feedback">
											<i class="icon-wallet text-muted"></i>
										</div>
									</div>

									<div class="form-group has-feedback has-feedback-left form-group-material col-sm-2">
										<label class="control-label multi_lang">التاريخ</label>
										
										<input type="text" id="profit_date_of_add" name="profit_date_of_add" class="form-control daterange-single multi_lang" placeholder="التاريخ" required="required">
										<div class="form-control-feedback">
											<i class="icon-calendar52 text-muted"></i>
										</div>
									</div>
																	

									<div class="form-group has-feedback has-feedback-left form-group-material col-sm-3">
										<label class="control-label multi_lang">الملاحظات</label>
										<input type="text" id="profit_note" name="profit_note" class="form-control multi_lang" placeholder="الملاحظات" >
										<div class="form-control-feedback">
											<i class="icon-info22 text-muted"></i>
										</div>
									</div>

									<div class="form-group form-group-material col-sm-2" >

										<label class="control-label animate">الفرع</label>
										<select name="branch_id_fk1" id="branch_id_fk1" class="form-control" required="required" data-live-search="true">
											
										</select>
									</div>

									


								</div>


							</div>
					</div>
					<div class="modal-footer">
						<button type="submit" id="profit_form_btn" 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 class="row">
										
		<div class="col-sm-12 col-md-12">
			<div class="panel panel-body">
				<div class="media no-margin">
					<div class="media-body">
						<div class="col-sm-12">
							<h1 class="bg-info text-center"> تقارير البيع والمصاريف</h1>
						</div>
						<div class="col-sm-2">
								<label> التاريخ الاول</label>
							
								<input class="form-control" type="date" name="first_date" id="first_date">
										
							

						</div>

						<div class="col-sm-2">
							<label> التاريخ الثاني</label>
							
							<input class="form-control" type="date" name="second_date" id="second_date">
					
						</div>


						<div class="form-group form-group-material1 col-sm-2" >

							<label class="control-label animate">الصندوق</label>
							<select name="box_id_fk" id="box_id_fk" class="form-control"  data-live-search="true">
								
							</select>
						</div>

						<div class="form-group form-group-material1 col-sm-2" >

							<label class="control-label animate">النوع</label>
							<select name="report_type" id="report_type" class="form-control"  data-live-search="true">
								<option value="1" selected="selected">تفصيلي</option>
								<option value="2" >مختصر</option>
								
							</select>
						</div>

						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">الزبون</label>
							<select name="customer_id_fk" id="customer_id_fk" class="form-control"  data-live-search="true">
								
							</select>
						</div>
						
						<div class="col-sm-3" style="margin-top: 10px;" >

						
							<!-- <button id="close_yearly" type="button" class="btn bg-orange-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">غلق الحساب السنوي</span> </button> -->
							
						</div>
						
						<div class="col-sm-3" style="margin-top: 10px;">

						
							<button id="filter_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">تطبيق فلتر مبيعات المواد الخام</span> </button>
							
						</div>

						<div class="col-sm-3" style="margin-top: 10px;">

						
							<button id="filter_btn_plural" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">تطبيق فلتر مبيعات ستائر الجملة</span> </button>
							
						</div>

						<div class="col-sm-3" style="margin-top: 10px;">

						
							<button id="filter_btn_single" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">تطبيق فلتر مبيعات ستائر المفرد</span> </button>
							
						</div>

						

						<!-- <div class="col-sm-3" style="margin-top: 10px;">

						
							<button id="expenses_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">فلتر المصاريف</span> </button>
							
						</div>
 -->

						<!-- <div class="col-sm-3" style="margin-top: 10px;">

						
							<button id="assets_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">Assets Filter</span> </button>
							
						</div>
 -->

						<!-- <div class="col-sm-3" style="margin-top: 10px;">

						
							<button id="capital_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">فلتر رأس المال</span> </button>
							
						</div> -->


						<!-- <div class="col-sm-3" style="margin-top: 10px;">

						
							<button id="capital_factory_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">فلتر راس مال المصنع</span> </button>
							
						</div> -->


						<div class="col-sm-3" style="margin-top: 10px;">

						
							<button id="withdraw_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">فلتر القروض والديون</span> </button>
							
						</div>

						<div class="col-sm-3" style="margin-top: 10px;">

						
							<button id="payment_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">فلتر تسديد دفوعات الزبائن</span> </button>
							
						</div>

						<div class="col-sm-3" style="margin-top: 10px;">

						
							<button id="purchase_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">فلتر المخازن</span> </button>
							
						</div>

						<!-- <div class="col-sm-3" style="margin-top: 10px;">

						
							<button id="supplier_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">فلتر تسديد الموردين</span> </button>
							
						</div> -->

						

						<div class="col-sm-3" style="margin-top: 10px;">

							

							<a href="index.php?p=archive"  class="btn bg-pink-400 btn-labeled btn-block"><b><i class="icon-close2"> </i></b> <span id="inv_filter">ازالة الفلتر</span> </a>
							
						</div>

						



					</div>

					
				</div>
			</div>
		</div>
		
	</div>

	
	<div class="col-sm-4" >	
		<button id="print_btn" type="button" class="btn bg-info-400 btn-labeled btn-block"><b><i class="icon-printer2"> </i></b> <span >طباعة التقرير</span> </button>
		
	</div>

	<!-- Individual column searching (text inputs) -->
	<div class="panel panel-flat" id="print_report">

		
		
		<table id="table1" border=1 cellspacing=0 cellpadding=0 style="display: none;" class="table datatable-column-search-inputs table-bordered ">
			<thead>
				<tr class="bg-blue-300">
	        		<th>ID</th>
					<th class="multi_lang">رقم الوصل</th>
					<th class="multi_lang">المبلغ</th>
					<th class="multi_lang">التاريخ</th>
					<th class="multi_lang">Transaction</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"> M<sup>2</sup> </th>
					<th class="multi_lang"> TAC </th>
					<th class="multi_lang"> ISIK </th>
	        		<th class="multi_lang">كلفة الانتاج</th>
	        		<th class="multi_lang">Action</th>
	      		</tr>
			</thead>
			<tbody id="table_report">
				
			</tbody>
			<tfoot>
				<tr class="alpha-info">
	                
	                <td colspan="2" class="multi_lang"><i  class="icon-sigma "></i>
	                المجموع</td>
	                <td id="total_invoice"></td>
	                <td></td>
	                <td></td>
	                
	                <td></td>
	                <td></td>
	                <td id="total_disc"></td>
	                <td id="total_paid"></td>
	                <td id="total_m"></td>
	                <td id="total_tac"></td>
	                <td id="total_isik"></td>
	                <td id="total_cost"></td>
	                <td></td>
	                
	                
	            </tr>
			</tfoot>
		</table>

		<table id="table1_sum" border=1 cellspacing=0 cellpadding=0 style="display: none;" class="table datatable-column-search-inputs table-bordered ">
			<thead>
				<tr class="bg-blue-300">
	        		<th>ID</th>
					
					<th class="multi_lang">مبلغ المبيعات</th>
					<th class="multi_lang"> التنزيلات </th>
					<th class="multi_lang"> المبلغ المقبوض </th>
					<th class="multi_lang"> M <sup>2</sup> </th>
					<th class="multi_lang">TAC</th>
					<th class="multi_lang"> ISIK </th>
	        		<th class="multi_lang">كلفة الانتاج</th>
	      		</tr>
			</thead>
			<tbody id="table_report_sum">
				
			</tbody>
			<tfoot>
				<tr class="alpha-info">
	                <td> <i class="icon-sigma "></i></td>
	                <td id="total_invoice_sum" class="multi_lang"></td>
	                <td ></td>
	                <td id="total_paid_sum"></td>
	                <td id="total_m_sum"></td>
	                
	                <td id="total_tac_sum"></td>
	                <td id="total_isik_sum"></td>
	                <td id="total_cost_sum"></td>
	                
	                
	                
	            </tr>
			</tfoot>
		</table>


		<table id="table2" border=1 cellspacing=0 cellpadding=0 style="display: none;" class="table datatable-column-search-inputs table-bordered ">
			<thead>
				<tr class="bg-blue-300">
	        		<th>ID</th>
					<th class="multi_lang">رقم الوصل</th>
					<th class="multi_lang">المبلغ</th>
					<th class="multi_lang">التاريخ</th>
					<th class="multi_lang">Transaction</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" width="10%">Action</th> -->
	      		</tr>
			</thead>
			<tbody id="table_report_safe">
				
			</tbody>
			<tfoot>
				<tr class="alpha-info">
	                <td></td>
	                <td class="multi_lang">مجموع المبالغ الداخلة</td>
	                <td id="total_in"></td>
	               	<td class="multi_lang">مجموع المبالغ الخارجة</td>
	                <td id="total_out"></td>
	                <td class="multi_lang">المتبقي في الخزنة</td>
	                <td id="total_rem"></td>
	                <td class="multi_lang">مجموع المبيعات</td>
	                <td id="total_sell"></td>
	                
	                <td></td>
	                
	                
	            </tr>
			</tfoot>
		</table>

		<table id="table2_sum" border=1 cellspacing=0 cellpadding=0 style="display: none;" class="table datatable-column-search-inputs table-bordered ">
			<thead>
				<tr class="bg-blue-300">
	        		<th>ID</th>
					<th class="multi_lang">المبلغ الكلي المظاف الى الخزنة</th>
					<th class="multi_lang">المبلغ الكلي المسحوب من الخزنة</th>
					<th class="multi_lang bg-blue-300">المبلغ المتوفر في الصندوق</th>
					<th class="multi_lang">المبيعات الكلية</th>
					<th class="multi_lang">Total M<sup>2</sup></th>
					<th class="multi_lang">Total TAC</th>
					<th class="multi_lang">Total ISIK</th>
					<th class="multi_lang"> الصندوق </th>
					
	      		</tr>
			</thead>
			<tbody id="table_report_safe_sum">
				
			</tbody>
			<tfoot>
				<tr class="alpha-info">
	                
	                
	                
	                
	            </tr>
			</tfoot>
		</table>
	</div>
	<!-- /individual column searching (text inputs) -->



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