<?php

if(!isset($_GET['typ'])){
?>
<script>
window.location="starter.php";
</script>
<?php
}
if( ($_GET['typ'] !='0' && $_GET['typ']!='1') || $_GET['typ'] ==''){

?>
<script>
window.location="starter.php";
</script>
<?php
}
?>

<?php
$permission  = explode(',',$_SESSION['permission_id']);
if( $_GET['typ'] =='0' ){ // plural
	if(!in_array(19,$permission) && !in_array(1,$permission)  ){

?>
	<script>
	window.location="starter.php";
	</script>
<?php
	}
}elseif($_GET['typ'] =='1'  ){
	if(!in_array(28,$permission) && !in_array(1,$permission)  ){
?>
	<script>
	window.location="starter.php";
	</script>
<?php
	}
}else{
?>
	<script>
	window.location="starter.php";
	</script>
<?php
}
?>


<style >
	tfoot {
    display: table-header-group !important;
	}

	td{
	text-align: center !important;
	}
	th{
	text-align: center !important;
	}

	textarea{
	height: 38px !important;
	resize: none;
	}

.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td {
    padding: 10px 5px;

    }

    .badge:empty{
    	display: initial;
    }

    .btn_add_item{
    	padding: 0px 0px;
    }

    .bootstrap-select.btn-group .btn .filter-option{
    	text-align: center;
    }

    input[type="checkbox"] {
    	margin: -8px 0 0;
    	
    	line-height: normal;
	}

	.radio label, .checkbox label {
    	padding-right: 85px;
	}

	.radio label, .checkbox label {
    	min-height: 20px;
    	/*padding-right: 20px;*/
    	margin-bottom: 20px;
    	font-weight: normal;
    	cursor: pointer;
	}

</style>




<div id="show_payments_modal" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg">
		<form class="form-horizontal"  name="show_payments_form" method="post" id="show_payments_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 id="invoce_html_pay">
					<div class="modal-body" >
							<input type="hidden" name="inv_numb" id="inv_numb">
							<div id="invoice_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 multi_lang" data-dismiss="modal"> اغلاق
					</button>
				</div>
			</div>
		</form>
	</div>
</div>

<!-- 
<div id="add_payments_modal" class="modal fade" >
	<div class="modal-dialog modal-lg">
		<form class="form-horizontal"  name="add_payments_form" method="post" id="add_payments_form" enctype="multipart/form-data">
			
			<input type="hidden" name="customer_id_fk" id="customer_id_fk" 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"> <i class="icon-cach4"></i> <span class="multi_lang">اضافة دفعة على الحساب</span>  </h4>
				</div>

				<div class="modal-body">

					<div class="form-group">
						<div class="form-group has-feedback has-feedback-left col-sm-6">
							<label class="control-label multi_lang">اختيار الصنف</label>
							
							<select class="form-control multi_lang" data-live-search="true" name="item_type_id_fk" id="item_type_id_fk" data-width="100%" placeholder="اختيار الصنف">

							</select>
							<div class="form-control-feedback">
								<i class="icon-user text-muted"></i>
							</div>
						</div>
					</div>

					<div class="form-group">
						<div class="form-group has-feedback has-feedback-left  col-sm-4">
							<label class="control-label multi_lang">حساب الزبون الكلي</label>
							<input type="text" id="customer_all_invoices_price" name="customer_all_invoices_price" class="form-control text-center text-danger text-black multi_lang " placeholder="حساب الزبون الكلي" readonly="readonly">
							<div class="form-control-feedback">
								<i class=" icon-wallet text-muted"></i>
							</div>
						</div>

						<div class="form-group has-feedback has-feedback-left  col-sm-4">
							<label class="control-label multi_lang">المبلغ المدفوع الكلي</label>
							<input type="text" id="customer_all_invoices_payment" name="customer_all_invoices_payment" class="form-control multi_lang text-center text-success text-black" placeholder="المبلغ المدفوع الكلي" readonly="readonly">
							<div class="form-control-feedback">
								<i class=" icon-cash3 text-muted"></i>
							</div>
						</div>

						<div class="form-group has-feedback has-feedback-left  col-sm-4">
							<label class="control-label multi_lang">المبلغ الكلي المتبقي على الزبون</label>
							<input type="text" id="customer_all_invoices_remaind" name="customer_all_invoices_remaind" class="form-control multi_lang text-center text-info text-black" placeholder="المبلغ الكلي المتبقي على الزبون" readonly="readonly">
							<div class="form-control-feedback">
								<i class=" icon-credit-card2 text-muted"></i>
							</div>
						</div>
					</div>

					<div class="form-group">
						<div class="form-group has-feedback has-feedback-left form-group-material col-sm-4">
							<label class="control-label multi_lang">الدفعه</label>
							<input type="text" id="paid_amount" name="paid_amount" class="form-control multi_lang " placeholder="الدفعه" >
							<div class="form-control-feedback">
								<i class=" icon-cach4 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="paid_date" name="paid_date" class="form-control multi_lang daterange-single" placeholder="التاريخ" >
							<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-5">
							<label class="control-label multi_lang">الملاحظات</label>
							<input type="text" id="payment_note" name="payment_note" class="form-control multi_lang " placeholder="الملاحظات" >
							<div class="form-control-feedback">
								<i class=" icon-bubble-lines4 text-muted"></i>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="submit" id="submit_add_pay_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 id="account_date_modal" class="modal fade" >
	<div class="modal-dialog modal-lg">
		<form class="form-horizontal"  name="account_date_form" method="post" id="account_date_form" enctype="multipart/form-data">
			
			<input type="hidden" name="customer_id_fk" id="customer_id_fk" value="">
			<input type="hidden" name="func_name" id="func_name" value="">
			<input type="hidden" name="func_param" id="func_param" 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"> <i class="icon-cach4"></i> <span class="multi_lang">عرض عمليات  كشف الحساب حسب التاريخ</span>  </h4>
				</div>

				<div class="modal-body">

					


					<div class="form-group">
						

						<div class="form-group has-feedback has-feedback-left form-group-material col-sm-4">
							<label class="control-label multi_lang">العملية</label>
							
							<select class="form-control" data-live-search="true" name="operation_type" id="operation_type" data-width="100%" required="required">
								<option value="" class="multi_lang">العملية</option>
								<option value="e" class="multi_lang">تساوي التاريخ الاول</option>
								<option value="l" class="multi_lang">اصغر من التاريخ الاول</option>
								<option value="g" class="multi_lang">اكبر من التاريخ الاول</option>
								<option value="b" class="multi_lang">بين التاريخ الاول والثاني</option>
							</select>

							<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-4">
							<label class="control-label multi_lang">التاريخ الاول</label>
							<input type="text" id="ac_date_1" name="ac_date_1" class="form-control multi_lang daterange-single" 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-4">
							<label class="control-label multi_lang">التاريخ الثاني</label>
							<input type="text" id="ac_date_2" name="ac_date_2" class="form-control multi_lang daterange-single" placeholder="التاريخ" >
							<div class="form-control-feedback">
								<i class=" icon-calendar52 text-muted"></i>
							</div>
						</div>

						
					</div>
				</div>
				<div class="modal-footer">
					

					<button type="button" id="btn_display_all" class="btn btn-labeled btn-labeled-left heading-btn btn-warning pull-left"> <span class="multi_lang">عرض الكل بدون فلتر التاريخ</span> <b><i class="icon-enlarge"></i></b>
					</button>

					<button type="submit" id="btn_display_filter" class="btn btn-labeled btn-labeled-left heading-btn btn-primary"> <span class="multi_lang">عرض حسب التاريخ</span> <b><i class="icon-shrink"></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_payments_modal" class="modal fade" >
		<div class="modal-dialog modal-lg" style="width: 80%;">
			<form class="form-horizontal" method="post" id="add_payments_form" enctype="multipart/form-data">
						
					<input type="hidden" id="access_token" name="access_token"  value="">
					
					<input type="hidden" id="customer_id_fk_pay" name="customer_id_fk_pay"  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="row">
							<div class="col-sm-3">
								<div class="alert alert-info alert-styled-right alert-arrow-right alert-bordered">
									<span class="text-semibold multi_lang" > المبلغ الكلي : </span>
									<span class="text-semibold" data-original-amount="" id="total_customer_account"></span>
							    </div>
							</div>

							<div class="col-sm-3">
								<div class="alert alert-warning alert-styled-right alert-arrow-right alert-bordered">
									<span class="text-semibold multi_lang" > خصومات الحساب : </span>
									<span class="text-semibold" data-original-amount="" id="total_customer_discount"></span>
							    </div>
							</div>

							<div class="col-sm-3">
								<div class="alert alert-success alert-styled-right alert-arrow-right alert-bordered ">
									<span class="text-semibold multi_lang" >المبلغ المدفوع : </span>
									<span class="text-semibold" data-original-amount="" id="total_customer_paid"></span>
							    </div>
							</div>

							<div class="col-sm-3">
								<div class="alert alert-danger alert-styled-right alert-arrow-right alert-bordered ">
									<span class="text-semibold multi_lang" > المبلغ المتبقي : </span>
									<span class="text-semibold" data-original-amount="" id="total_customer_remaind"></span>
							    </div>
							</div>

						</div>

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

							

							<div class="form-group">


								
								
								<div class="form-group has-feedback has-feedback-left form-group-material col-sm-4">
									<label class="control-label multi_lang">مبلغ الدفعة</label>
									<input type="text" id="payment_withdraw_amount" name="payment_withdraw_amount" class="form-control multi_lang" placeholder=" مبلغ الدفعة " 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-4">
									<label class="control-label multi_lang">التاريخ</label>
									
									<input type="text" id="paid_date" name="paid_date" 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  col-sm-4">
									<label class="control-label animate multi_lang">نوع الوصل</label>
									
									<select name="pay_type" id="pay_type" class="form-control" >
										<option value=""> جميع الانواع</option>
										<option value="Raw">مواد جملة</option>
										<option value="Plural">ستائر جملة</option>
										<option value="Single"> ستائر مفرد</option>
										
									</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  col-sm-4">
									<label class="control-label animate multi_lang">الصنف</label>
									
									<select name="item_type_id_fk" id="item_type_id_fk" class="form-control" >
									

									</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-8">
									<label class="control-label multi_lang">الملاحظات</label>
									<input type="text" id="payment_note" name="payment_note" class="form-control multi_lang" placeholder="الملاحظات" >
									<div class="form-control-feedback">
										<i class="icon-info22 text-muted"></i>
									</div>
								</div>



							</div>

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





				<!-- Individual column searching (text inputs) -->
				<div class="panel panel-flat">
					
					<table class="table datatable-column-search-inputs">
						<thead>
							<tr>
				        		<th width="5%">ID</th>
								<th class="multi_lang">اسم الزبون</th>
								<th class="multi_lang" width="15%">عدد الوصولات</th>
			          			<th class="multi_lang">المبلغ الكلي</th>
			          			<th class="multi_lang">المبلغ المدفوع</th>
								<th class="multi_lang">المبلغ المتبقي</th>
								
								<th class="multi_lang">الحالة</th>
								
			          <th width="10%" class="text-center multi_lang">العمليات</th>
				      </tr>
						</thead>
						<tbody>
							
						</tbody>
						<tfoot>
							<tr>
				                <td></td>
				                <td>username</td>
				                <td>full_name</td>
				                <td>EMail</td>
				                <td>Phone</td>
				                <td></td>
				                <td></td>
				                
				                <td></td>
				            </tr>
						</tfoot>
					</table>
				</div>
				<!-- /individual column searching (text inputs) -->



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