<?php 
	$header_file=APPPATH.'views/include/header.php';
	require($header_file);
	$sidenav_file=APPPATH.'views/include/sidenav.php';
	require($sidenav_file);	?>
   	<style>
    table {
        width:100%!important;
       
    }
    td,th {
     font-size: 14px;
     line-height: 18px;
     font-weight:bold;
    }
    hr {
    border-bottom: 1px solid #000;
}
    @media print { 
    .main-header, .sidebar, .bg-light-opac  {
        display:none!important
    }
    .fixed-header .wrapper {
        padding-top:0px!important;
    }
    .wrapper {
        padding:0px!important;
            background: #fff!important;
    }
    .sidebar-right-close > footer {
        display:none!important;
    }
    .bg-light-opac {
        background:#fff!important;
    }
    .print_none {
        display:none!important;
    }
    }
    .hidden1 {
     display:none;
}
</style>
    <!-- BEGIN: Content-->
    <div class="app-content content">
      <div class="content-overlay"></div>
      <div class="content-wrapper">
        <div class="content-header row">
          <div class="content-header-left col-md-12 col-12 mb-2 breadcrumb-new">
            <h3 class="content-header-title mb-0 d-inline-block">Chef </h3>
            <div class="row breadcrumbs-top d-inline-block">
              <div class="breadcrumb-wrapper col-12">
                <ol class="breadcrumb">
                  <li class="breadcrumb-item"><a href="#">Home</a>
                  </li>
                  <li class="breadcrumb-item"><a href="#">Chef</a>
                  </li>
                  <li class="breadcrumb-item active">Advance Order List
                  </li>
                </ol>
              </div>
            </div>
          </div>
          
        </div>
        <div class="content-body"><!-- Basic form layout section start -->
            <section id="basic-form-layouts">
            	<div class="row justify-content-md-center">
            		<div class="col-md-12">
            			<div class="card">
            				<div class="card-header">
            					<h4 class="card-title" id="basic-layout-form-center">Advance Order List</h4>
            					<a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
            					<div class="heading-elements">
            						<ul class="list-inline mb-0">
            							<li><a data-action="collapse"><i class="ft-minus"></i></a></li>
            							<li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
            							<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
            							<li><a data-action="close"><i class="ft-x"></i></a></li>
            						</ul>
            					</div>
            				</div>
            				<div class="card-content collapse show">
            					<div class="card-body">
            						<div class="table-responsive">
                                        <div class="row">
        	<div class="col-md-12">
        	    <?php foreach($invoice_details as $bill)
								$indate = date('d-m-Y', strtotime($bill->invoice_date));
							    $del_date = date('d-m-Y', strtotime($bill->delivery_date));
							    $bill_date = date('d-m-Y', strtotime($bill->bill_date));
							    
							    ?>
            	<div class="card-body" id="section-to-print">
            	    <?php if($bill->status =='cancelled')
            	    {
            	        ?>
            	        <p><B style="color: red; float: right;"><?php echo $bill->status;?><br/><?php echo $bill->ord_remarks;?></B></p>
            	        <?php
            	    }
            	    else
            	    {
            	        ?>
            	        <p><B style="color: green; float: right;"><?php echo $bill->status;?><br/></B></p>
            	        <?php
            	    }
            	    ?>
						<table>
						    <?php ?>	
        					  <?php foreach($points_logo as $logo) {
        					      $url = "https://gspos.in/TestSalesMaster/";
        					      $final_url = (master_url).$logo->master_image_path;
        					?>	
							<tr>
								<td colspan="6" class="text-center"><img src="<?php echo $final_url; ?>"/></td>
							</tr>
							<?php 
    							   }
							?>
						    <?php foreach($branch_info as $branchs)	?>
						    <tr class="text-center">
								<td colspan="6"><?php echo $branchs->org_name; ?></td>
							</tr>
							<tr class="text-center">
								<td colspan="6"><?php echo $branchs->address1; ?></td>
							</tr>
							<tr class="text-center">
								<td colspan="6"><?php echo $branchs->address2; ?></td>
							</tr>
							<tr class="text-center">
								<td colspan="6">GSTIN : <?php echo $branchs->gstin_no; ?></td>
							</tr>
							<tr class="text-center">
								<td colspan="6"><?php echo $branchs->cin_no; ?></td>
							</tr>
							
							
							
							<tr>
								<td colspan="6" class="text-left">Phone No : <?php echo $branchs->land_no; ?></td>
							</tr>
					        <tr>
								<td colspan="2" class="text-left">Mobile: <?php echo $branchs->mobile; ?> </td>
								<?php if($bill->status =="closed") { ?>
								    <td colspan="2" class="text-center" style="font-size: 18px;">TAX INVOICE</td>
								<?php } else { ?>
								    <td colspan="2" class="text-center" style="font-size: 18px;">ORDERS FORM</td>
								<?php } ?>
								<td colspan="2" class="text-right">Website : <?php echo $branchs->website_name; ?></td>
							</tr>
							
							<tr class="text-center">
								<td colspan="6" style="border-bottom:1px solid #000"></td>
							</tr>
							<tr>
							    <td colspan="2">Order No - <?php echo $bill->bill_no; ?></td></td>
								<td colspan="2">Order Date : <?php echo $bill_date; ?></td>
								<td colspan="2">Order Time : <?php echo $bill->bill_time; ?></td>
							</tr>
							<?php if($bill->status =="closed") { ?>
							<tr>
								<td colspan="2">Invoice No - <?php echo $bill->invoice_no; ?></td></td>
								<td colspan="2">Invoice Date : <?php echo $indate; ?></td>
								<td colspan="2">Invoice Time : <?php echo $bill->invoice_time; ?></td>
							</tr>
							<?php } ?>
							<tr>
								<td colspan="2">Customer Name : <?php echo $bill->cust_name; ?></td>
								<td colspan="2">Customer GSTN : <?php echo $bill->cust_gst ?></td>
								<td colspan="2">Customer Contact : <?php echo $bill->cust_phone; ?></td>
							</tr>
							<tr>
								<td colspan="6">Customer Address :<?php echo $bill->cust_address; ?> </td>
							</tr>
							<tr class="text-center">
								<td colspan="6" style="border-bottom:1px solid #000"></td>
							</tr>
							<tr>
								<th colspan="3" class="text-center">Order Details</th>
								<th colspan="3" class="text-center">Other Details</th>
							</tr>
							<tr>
								<td class="text-left">Album Ref No</td>
								<td class="text-left"> - <?php echo $bill->album_no; ?></td>
								<td colspan="2"></td>
								<td class="text-left">Delivery Date </td>
								<td  class="text-left">- <?php echo $del_date; ?></td>
							</tr>
							<tr>
								<td class="text-left">Shape</td>
								<td class="text-left"> - <?php echo $bill->shape; ?></td>
								<td colspan="2"></td>
								<td class="text-left">Delivery Time</td>
								<td  class="text-left"> - <?php echo $bill->delivery_time; ?></td>
							</tr>
							<tr>
								<td class="text-left">Remarks</td>
								<td class="text-left"> - <?php echo $bill->remarks; ?></td>
								<td colspan="2"></td>
								<td class="text-left">Delivery Day</td>
								<td class="text-left">- <?php echo $bill->delivery_day; ?></td>
							</tr>
							<tr>
								<td class="text-left">Order Taken By</td>
								<td  class="text-left"> - <?php echo $bill->ord_taken_by; ?></td>
								<td colspan="2"></td>
								<td class="text-left">Delivery Mode</td>
								<td  class="text-left"> - <?php echo $bill->delivery_mode; ?></td>
							</tr>
							<tr class="text-center">
								<td colspan="6" style="border-bottom:1px solid #000"></td>
							</tr>
							<tr>
							   
								<th scope="col">Item Name</th>
								<th scope="col">HSN CODE</th>
								<th scope="col">UOM</th>
								<th scope="col">Qty</th>
								<th scope="col">Price</th>
								<th scope="col" class="text-right">Total Price</th>
							</tr>
							<tr class="text-center">
								<td colspan="6" style="border-bottom:1px solid #000"></td>
							</tr>
								<?php
								   $net_amount =0;
								   $dis_amount =0;
								   $taxabale_amount =0;
								   $tax_amount =0;
								   $grand_amount =0;
									if(isset($invoice_details) && is_array($invoice_details) && count($invoice_details)): $i=1;
									foreach($invoice_details as $invoice_details) { 
									$net_amount = $net_amount + $invoice_details->total_price;
									$dis_amount = $dis_amount + $invoice_details->disc_amount;
									$taxabale_amount = $taxabale_amount +  $invoice_details->item_taxable_amt;
									$tax_amount = $tax_amount  + $invoice_details->item_tax_amt;
									$grand_amount = $grand_amount + $invoice_details->total_price;
									?>
									<tr>
									    <td class="text-left"><?php echo $invoice_details->product_name; ?></td>
										<td><?php echo $invoice_details->hsn_code; ?></td>
										<td><?php echo $invoice_details->uom; ?></td>
										<td><?php echo round($invoice_details->quantity,2); ?></td>
										<td><?php echo round($invoice_details->price,2); ?></td>
										<td class="text-right"><?php echo round($invoice_details->total_price,2); ?></td>
									</tr>
									<?php
										$i++;
									}
								endif; ?>
								<tr class="text-center">
								    <td colspan="6" style="border-bottom:1px solid #000"></td>
							    </tr>
								<?php if($dis_amount !="0") { ?>
								<tr>
								     <td colspan="4"></td>
								     <td>Net Amount</td>
								    <td class="text-right"><?php echo round($net_amount,2) ?></td>
								</tr>
								<tr>
								     <td colspan="4"></td>
								     <td>Discount Amount</td>
								    <td class="text-right"><?php echo round($dis_amount,2) ?></td>
								</tr>
								<?php } ?>
								<tr>
								     <td colspan="4"></td>
								     <td>Taxable Amount</td>
								    <td class="text-right"><?php echo round($taxabale_amount,2) ?></td>
								</tr>
								<?php foreach($invoice_tax as $in_tax) {
									if($in_tax->sgst_tax != '0') {
									?>
									<tr>
									    <td colspan="4"></td>
										<td>SGST : (<?php echo $in_tax->sgst_tax; ?>%)</td>
										<?php if($in_tax->sgst_tax == 9) { ?>
											<td class="text-right"><?php echo round($in_tax->sgst_tax_amt,2); ?></td>
											<?php } else { ?>
											<td class="text-right"><?php echo round($in_tax->sgst_tax_amt,2); ?></td>
										<?php } ?>
									</tr>
									<tr>
									    <td colspan="4"></td>
										<td>CGST : (<?php echo $in_tax->sgst_tax; ?>%)</td>
										<?php if($in_tax->sgst_tax == 9) { ?>
											<td class="text-right"><?php echo round($in_tax->cgst_tax_amt,2) ?></td>
											<?php } else { ?>
											<td class="text-right"><?php echo round($in_tax->cgst_tax_amt,2); ?></td>
										<?php } ?>
									</tr>
									<?php }
								    } ?>
    								<tr>
    								     <td colspan="4"></td>
    								     <td>Total Tax Amount</td>
    								    <td class="text-right"><?php echo round($tax_amount,2) ?></td>
    								</tr>
    								<tr>
    								     <td colspan="4"></td>
    								     <td>Grand Total</td>
    								    <td class="text-right"><?php echo round($grand_amount,2) ?></td>
    								</tr>
    								<?php if($bill->status =="closed") { ?>
    								<tr>
    								     <td colspan="4"></td>
    								     <td>Balance Paid Amount</td>
    								    <td class="text-right"><?php echo round($grand_amount,2) ?></td>
    								</tr>
    								
    								<?php } else { ?>
    							     <tr>
    								     <td colspan="4"></td>
    								     <td>Advance Paid</td>
    								    <td class="text-right"><?php echo round($bill->advance_amount,2) ?></td>
    								</tr>
    								<?php if($bill->balance_amount > 0) { ?>
    								<tr>
    								     <td colspan="4"></td>
    								     <td>Balance Amount</td>
    								    <td class="text-right"><?php echo round($bill->balance_amount,2) ?></td>
    								</tr>
    								<?php  } } ?>
    								<?php if($bill->status =="closed") { ?>
        								<tr>
        								     <td colspan="4"></td>
        								     <td>Payment Mode</td>
        								    <td class="text-right"><?php echo $bill->final_mop ?></td>
        								</tr>
    								<?php } ?>
									<tr class="text-center">
        								<td colspan="6" style="border-bottom:1px solid #000"></td>
        							</tr>
        							<tr>
        								<td colspan="6">Remarks : <?php echo $bill->msg; ?></td>
        							</tr>
    								<tr class="text-center">
        								<td colspan="6" style="border-bottom:1px solid #000"></td>
        							</tr>
        							<tr>
        								<td colspan="2" class="text-center pt-4 pb-4">Guest Signature</td>
        								<td colspan="2" class="text-center pt-4 pb-4">Manager Signature</td>
        								<td colspan="2" class="text-center pt-4 pb-4">Chef Signature</td>
        							</tr>
        						
        							<?php foreach($points_info as $points) {?>
        							<tr class="pt-3">
        								<td colspan="6"><?php echo $points->master_details; ?></strong></td>
        							</tr>
        							<?php } ?>	
        							<?php foreach($points_branchlist as $list) {
        							?>
        							<tr>
        								<td colspan="6" class="text-center pt-4"><?php echo $list->master_details; ?></td>
        							</tr>
        							<?php 
        							   }
        							?>
        							
        							<tr>
        								<?php foreach($points_social_list as $social) {
        							?>
        								<td colspan="2" class="text-center"><img src="<?php echo base_url(); ?>public/img/<?php echo $social->masters_status; ?>"/><br/><?php echo $social->master_details; ?></td>
        								<?php } ?>
        							</tr>
        							
        							<tr>
        								<td colspan="6" class="text-center pt-4">Computer generated Invoice, hence signature Not required</td>
        							</tr>
					            </table>
            	            </div>
            	            <br/>
            	             <?php $user_group = $_SESSION['user_group'];
            	            if($user_group != '800')
            	            {
            	            ?>
            	            <div class="card-body print_none">
            	                <div class="row">
            	                   
            	                    <?php if($bill->final_mop == "CREDIT") { ?>
            	                    <div class="col-md-8">
            	                        <form action="<?php echo site_url("User_section/credit_payment_mode_change");?>" method="post">
                                    	<input type="hidden"  class="form-control" value="<?php echo $bill->final_mop;?>">
                                    	<?php if($bill->final_mop =='CREDIT') { ?>
                                    	<input type="hidden" class="form-control" name="total_credit_amount" value="<?php echo $bill->total_paid_amount;?>">
                                    	<?php } else { ?>
                                    	<input type="hidden" class="form-control" name="total_credit_amount" value="0">
                                    	<?php } ?>
                                    	<input type="hidden" class="form-control" name="bil_id" value="<?php echo $bill->bid;?>">
                                    	<input type="hidden" class="form-control" id="bill_form_id" name="branch" value="<?php echo $bill->branch; ?>">
                                    	<input type="hidden" class="form-control" id="bill_form_id" name="inv_no" value="<?php echo $bill->invoice_no; ?>">
                                    	 <br/>
                                    	 <div class="col-md-6">
                                    	<label for="name" class="control-label">Select new Payment mode</label>
                                    	<select id="new_payment" name="new_payment" class="form-control" required>
                            				<option value="">Select Payment Mode</option>
                            				<?php
                            				if(is_array($paymode) && count($paymode)>=1)
                                        	{
                                        		foreach ($paymode as $r) 
                                            	{
                                            	?>
                                				<option value="<?php echo $r->setting_title;?>" <?php if($r->setting_title == $bill->final_mop){echo "selected='selected'";} ?>><?php echo $r->setting_title;?></option>
                                				<?php
                                					}
                                				}
                            				?>
                            			    </select>
        	                            </div>
        	                            <div class="col-md-6">
        	                                 <br/>
                                        		<?php if($bill->status != 'Cancelled') {?>
                                        		<input type="submit" name="submit" id='submit' class="btn btn-flat btn-primary" value="submit">
                                        		<?php } ?>
    	                                </div>
    	                                	</form>
            	                    </div>
            	                    <div class="col-md-4">
            	                        <button onclick="window.print()" class="btn btn-primary " style="float: right;margin-top:10px">Print</button>
            	                        <div class="col-md-4"> <button type="button" class="btn btn-primary btn-sm"  id= "back">Back</button></div>
        	                        </div>
            	                    <?php } else { ?>
            	                    <div class="col-md-4">
            	                        	<?php if($bill->status != 'Cancelled' && $bill->status =='closed') {?>
            	                        <div>
                                            <div class="col-md-12">
                                            	<div class="card-body">
                                            		<!-- <button type="button"  class="print_none btn btn-primary bil_cancel" onclick="show_box()"> Cancel Bill </button> -->
                                            		<div class="col-md-12 boxheading"><h6></h6></div>
                                    				<form action="<?php echo site_url("User_section/advanceCancelbilldetails");?>" method="post"  class="myForm" role="form">
                                                		<div class="form-group">
                                                    		<div class="form-group row">
                                                                <div class="col-sm-12">
                                                                    <div class="form-check form-check-inline">
                                                                        <input class="form-check-input" type="radio" name="cancel_remarks" id="cancel_remarks" value="Item Missing" checked>
                                                                        <label class="form-check-label" for="cancel_remarks">Item Missing</label>
                                                                    </div>
                                                                    <br/>
                                                                    <div class="form-check form-check-inline">
                                                                        <input class="form-check-input" type="radio" name="cancel_remarks" id="cancel_remarks" value="Delete Extra Items">
                                                                        <label class="form-check-label" for="cancel_remarks">Delete Extra Items</label>
                                                                    </div>
                                                                    <br/>
                                                                    <div class="form-check form-check-inline">
                                                                        <input class="form-check-input" type="radio" name="cancel_remarks" id="cancel_remarks" value="Others">
                                                                        <label class="form-check-label" for="cancel_remarks">Others</label>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                			<!--<textarea  name="cancel_remarks" id="cancel_remarks" style="height: 50px;padding-top: 10px;" class=" form-control" placeholder="Enter Remarks"></textarea>-->
                                                			<input type="text" class="form-control" id="bill_form_id" name="bill_id" value="<?php echo $bill->bid; ?>">
                                                			<input type="hidden" class="form-control" id="bill_form_id" name="branch" value="<?php echo $bill->branch; ?>">
                                                			<input type="hidden" class="form-control" id="bill_form_id" name="inv_no" value="<?php echo $bill->invoice_no; ?>">
                                                			<br/>
                                                		
                                                			<input type="submit" name="submit" id='submit' class="btn btn-flat btn-primary col-md-12" value="Cancel Bill" onclick="return confirm('Do you want to Cancel this Bill?');">
                                                		
                                                		</div>
                                    	            </form>
                                            	</div>
                                            </div>
                                        </div>
                                        	<?php } ?>
            	                        <button onclick="window.print()" class="btn btn-primary print_none" style="float: right;margin-top:10px">Print</button>
        	                        </div>
                            		 <?php } ?>   
                                	</div>
                            	</div>
                            	
                            	<?php } ?>
                            	<br/>
        	            </div>
                    </div>
                    <?php $user_group = $_SESSION['user_group'];
            	            if($user_group != '800')
            	            {
            	            ?>
                     <div class="col-md-12 print_none">
                    	<div class="card-body" style="background: #ddd;">
                    		<!-- <button type="button"  class="print_none btn btn-primary bil_cancel" onclick="show_box()"> Cancel Bill </button> -->
                    		<div class="col-md-12 boxheading"><h6></h6></div>
                    		<?php if($bill->food_ready =='no') { ?>
            				<form action="<?php echo site_url("Sales_reports/change_status");?>" method="post" enctype="multipart/form-data"  class="myForm" role="form">
                        		<div class="form-group">
                            		<div class="form-group row">
                                        <div class="col-md-3">
                                            <div class="form-group">
                                                <lable>Select Food Ready Status</lable>
                                                <select name="food_status" class="form-control select2" id="food_status">
                                                    <option "">Food Ready Status</option>
                                                    <option value="no">NO</option>
                                                    <option value="yes">YES</option>
                                                </select>
                                            </div>
                                        </div>
                                         <div class="col-md-3">
                                            <div class="form-group">
                                                <lable>Select Chef Name</lable>
                                                <select name="assigned" class="form-control select2" id="assigned">
                                                    <option "">Select Chef Name</option>
                                                    <?php
        											if(!empty($chef_list))
        											{
        												foreach ($chef_list as $rl)
        												{
        												?>
                                                <option value="<?php echo $rl->chef_name ?>"><?php echo $rl->chef_name ?>
                                                </option>
                                                <?php
        												}
        											}
        										?>
                                                </select>
                                            </div>
                                        </div>
                                         <div class="col-md-3">
                                            <div class="form-group">
                                                <lable>Select File</lable>
                                                <input type="file"  name='image_capture' accept="image/*" capture  required/>
                                                 </div>
                                        </div>
                                        <div class="col-md-3">
                                            <div class="form-group">
                                                <lable>Enter Weight(KG)</lable>
                                                <input type="text" class="form-control" name='weight' id="weight" required/>
                                                 </div>
                                        </div>
                                    </div>
                        			<!--<textarea  name="cancel_remarks" id="cancel_remarks" style="height: 50px;padding-top: 10px;" class=" form-control" placeholder="Enter Remarks"></textarea>-->
                        			<input type="hidden" class="form-control" id="bill_form_id" name="bill_id" value="<?php echo $bill->bid; ?>">
                        			<input type="hidden" class="form-control" id="bill_form_id" name="branch" value="<?php echo $bill->branch; ?>">
                        			<br/>
                        		
                        			<input type="submit" name="submit" id='submit' class="btn btn-flat btn-primary col-md-12" value="Submit" onclick="return confirm('Do you want to submit?');">
                        		
                        		</div>
            	            </form>
            	            <?php } else { 
            	            $url = "https://gsrgroup.biz/inventory_management/assets/advanceorder_photo/".$bill->capture_image;
        					     // $final_url = (master_url).$logo->master_image_path;
            	            ?>
            	            <div class="form-group">
            	                
                            		<div class="form-group row">
                                         <div class="col-md-4">
                                            <div class="form-group">
                                                <lable>Select Chef Name</lable>
                                                <input type="text" class="form-control" id="bill_form_id" name="bill_id" value="<?php echo $bill->prepared_by; ?>" readonly>
                                            </div>
                                        </div>
                                         <div class="col-md-8 text-center">
                                             <a href="#" onclick="toggler('myContent');">View Attached File</a>
                                            <div id="myContent" class='hidden1'>
                                              <div><img src="<?php echo $url ?>" style="width: 100%;height: 300px;"></div>
                                            </div> 
                                            
                                        </div>
                                    </div>
                        			<!--<textarea  name="cancel_remarks" id="cancel_remarks" style="height: 50px;padding-top: 10px;" class=" form-control" placeholder="Enter Remarks"></textarea>-->
                        		</div>
            	            <?php } ?>
                    	</div>
                    </div>    
                    <?php } ?>
                                </div>
        
        					</div>
        				</div>
        			</div>
        		</div>
        	</div>

</section>
<!-- // Basic form layout section end -->
        </div>
      </div>
    </div>
    <?php //require('include/theme_customizer.php');?>

   <?php 
  $footer_file=APPPATH.'views/include/footer.php';
	require($footer_file);
	?>
  
<script type="text/javascript">//<![CDATA[


function toggler(divId) {
    $("#" + divId).toggle();
}


  //]]></script>
  </body>
  <!-- END: Body-->

<!-- Mirrored from pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-modern-menu-template/form-layout-basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Apr 2020 09:38:02 GMT -->
</html>