
<script>
	function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

    // document.body.innerHTML = printContents.fontsize(12);
  //   window.print();

	 if( window.print()) {
         window.location.href = "../user/mysales";
		alert(" printing...........");
    }else {

	
		      return      window.location.href = "../user/mysales";

		    // document.body.innerHTML = originalContents;

	}
}
	</script>

         <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		
		
		
    </script>   
  <style type="text/css">
  
  

    #myprint { display: none; }
#print{  	


    background-repeat: no-repeat;
	font-size;20px;
  
    width:100%; 


}

#sale{  	


    background-repeat: no-repeat;
  
    width:100px; height:50px;


}
    @media print
    {
    	#non-printable { display: none; }
    	#printableArea { display: block; font-size:16; width:100%; }
		#myprint { display: block; font-size:16; width:100%; }

    }
    </style>
 
 <div class="row">
  
   	

   	<div class="col-md-12">
	<?PHP
function formatMoney($number, $fractional=false) {
						if ($fractional) {
							$number = sprintf('%.2f', $number);
						}
						while (true) {
							$replaced = preg_replace('/(-?\d+)(\d\d\d)/', '$1,$2', $number);
							if ($replaced != $number) {
								$number = $replaced;
							} else {
								break;
							}
						}
						
						return $number;
					}
					 $finalstartdate=date("Y-m-d 00:00:00");
					  $finalendate=date("Y-m-d H:i:s");

echo $this->session->flashdata('deletemsg'); 
	 $session_data = $this->session->userdata('logged_in');

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	 
	 
	 	 $smsconfig = $this->usermodel->populateallarray('smsconfig','id',$companyid);
		 		$currenttime = date('H:i');

		    $mydate=date("Y-m-d H:i:s");

  	$dateString = '2020-02-05';
 
//Last date of current month.
//echo$lastDateOfMonth = date("Y-m-t", strtotime($dateString));
		  $year=date("Y");
		  $month=date("m");
		   $day=date("d");
		   
		   
		   $subtract=$day-1;
		   $add=$day+1;
		      if ($subtract<10){
			  $subtract="0".$subtract;
		   }else{
			   $subtract=$subtract; 
		   }
		$finalstartdate="";
		$finalendate="";
		  $myfromdate=$smsconfig[0]['fromdate'];
		 $mytodate=$smsconfig[0]['todate'];
		 $starttime=$smsconfig[0]['starttime'];
		 $duetime=$smsconfig[0]['duetime'];
		
	if(($myfromdate=="Current") &&($mytodate=="Current") &&  ($currenttime>=$starttime)){
	
		  $finalstartdate=$year.'-'.$month.'-'.$day.' '. $starttime.':00';
		
		 }else if(($myfromdate=="Current") &&($mytodate=="Next") &&  ($currenttime>=$starttime)){
	
		  $finalstartdate=$year.'-'.$month.'-'.$day.' '. $starttime.':00';
		
		 }
		 
		  else if(($myfromdate=="Current") &&($mytodate=="Current") && ($currenttime<$starttime)){
					  $finalstartdate=$year.'-'.$month.'-'.$day.' '. $starttime.':00';


				
		 }
		 
		 else if(($myfromdate=="Current") &&($mytodate=="Next") && ($currenttime<$starttime)){
			 if(($day=="01") || ($day=="1")){
				 
				 $currentdate=$year.'-'.$month.'-'.$day;

 $mynewfromdate = strtotime ( '-1 month' , strtotime ( $currentdate ) ) ;
$newfromdate = date ( 'Y-m-d' , $mynewfromdate );
$finalstartdate = date("Y-m-t", strtotime($newfromdate)).' '.$starttime.':00';
			 }else{
			
								  $finalstartdate=$year.'-'.$month.'-'.$subtract.' '. $starttime.':00';

			
			 }
	


		 }

	
					

		
		 
		 
		if(($mytodate=="Next") && ($currenttime>=$duetime)){
	
		  $finalendate=$year.'-'.$month.'-'.$add.' '. $duetime.':00';
				//echo $finalstartdate;
		
		 }else if(($mytodate=="Next") && ($currenttime<$duetime)){
			
		  $finalendate=$year.'-'.$month.'-'.$day.' '. $duetime.':00';
		  
				//	echo $finalstartdate;
		 }else  if(($mytodate=="Current") && ($currenttime>=$duetime)){
		 		  $finalendate=$year.'-'.$month.'-'.$add.' '. $duetime.':00';

		 }else  if(($mytodate=="Current") && ($currenttime<$duetime)){
					  $finalendate=$year.'-'.$month.'-'.$day.' '. $duetime.':00';

		  
				//	echo $finalstartdate;
		 }
		 
		 
		 
		 
		 
		 
		 
		 						$updatepaymentmode=$this->usermodel->populatuserpermissionsdataarray('sales','updatepaymentmode',$userid);

		 
	 
	    $addproductaction=$this->usermodel->populatuserpermissionsdataarray('reports','add',$userid);

	 $updateaction=$this->usermodel->populatuserpermissionsdataarray('reports','update',$userid);
  $updatebuyingpriceaction=$this->usermodel->populatuserpermissionsdataarray('reports','update',$userid);
  $deleteaction=$this->usermodel->populatuserpermissionsdataarray('reports','delete',$userid);
	 
			    $cashiersales=$this->usermodel->populatuserpermissionsdataarray('cashiersales','all',$userid);
			    $cashierreprint=$this->usermodel->populatuserpermissionsdataarray('sales','reprint',$userid);
			    $pendingmpesareports=$this->usermodel->populatuserpermissionsdataarray('cashiersales','mpesapendingreport',$userid);
				
				
	   $viewallaction=$this->usermodel->populatuserpermissionsdataarray('reports','viewall',$userid);
	   
	   
	   	   $viewdailycollections=$this->usermodel->populatuserpermissionsdataarray('cashiersales','viewdailycollections',$userid);

		   	   $adddailycollection=$this->usermodel->populatuserpermissionsdataarray('cashiersales','adddailycollection',$userid);
		   	   $clearallsales=$this->usermodel->populatuserpermissionsdataarray('cashiersales','clearallsales',$userid);
		   	   $viewtill=$this->usermodel->populatuserpermissionsdataarray('cashiersales','viewtill',$userid);
	      $selecttable=$this->usermodel->populatuserpermissionsdataarray('sales','selecttable',$userid);
		  		  	      $leaseitems=$this->usermodel->populatuserpermissionsdataarray('sales','leaseitems',$userid);

	      $viewreports=$this->usermodel->populatuserpermissionsdataarray('accomodation','viewreports',$userid);



    $mpesaaction=$this->usermodel->populatuserpermissionsdataarray('sales','mpesa',$userid);
	      $chequeaction=$this->usermodel->populatuserpermissionsdataarray('sales','cheque',$userid);
 $voucheraction=$this->usermodel->populatuserpermissionsdataarray('sales','voucher',$userid);
	      $creditaction=$this->usermodel->populatuserpermissionsdataarray('sales','credit',$userid);
		   $pointsaction=$this->usermodel->populatuserpermissionsdataarray('sales','points',$userid);
	      $cardaction=$this->usermodel->populatuserpermissionsdataarray('sales','card',$userid);
	      $orderaction=$this->usermodel->populatuserpermissionsdataarray('sales','order',$userid);
		  		    $cashaction=$this->usermodel->populatuserpermissionsdataarray('sales','cash',$userid);
		  	      $creditnoteeaction=$this->usermodel->populatuserpermissionsdataarray('sales','creditnote',$userid);

		   	   $viewcommission=$this->usermodel->populatuserpermissionsdataarray('cashiersales','viewcommission',$userid);
		   	   $myviewcommission=$this->usermodel->populatuserpermissionsdataarray('agent','view report',$userid);






				echo $this->session->flashdata('msg'); 
								?>	
  
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading" id="non-printable">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>

									 <!--<a href="<?php echo base_url();?>user/startsales" class="btn btn-default"> Back</a>	
-->

 <span class="pull-right"> View salesreport</span>
			
            	</div>
            </div>
			<div class="panel-body">

			
	<div class="widget-content nopadding table_holder table-responsive" >				
			
					<div class="row">
				
				
						<div class="col-md-12">
							
							<div class="panel-body">
	
									
				<table border="1"  width="100%" id="sortable_table">			

             <thead>
         <tr>
		 
		 	 	 <?php  if(isset($report)) {
				
			 ?>
		 
		  	  <tr>
			 <th colspan="20"><center>
			 
			 
			 <?php  if(isset($configuration[0]['businessname'])) {echo   $configuration[0]['businessname']; 
			 
			echo " </BR>";
			 }
			   $TIMEOFREPORT=date("d/m/Y H:i:s a");
			
			 if(isset($branchdata)) {echo   $branchdata; } 
			 ?>

			 <B><?PHP if(isset($reporttype)) {echo   $reporttype; } ?><BR> 
	 <?PHP if(isset($myusers)) {echo   $myusers; } ?>	 Between  <?php  if(isset($finalfromdate)) {echo   date("d/m/Y H:i:s", strtotime($finalfromdate)); }?>  To  <?php  if(isset($finaltodate)) {echo     date("d/m/Y H:i:s", strtotime($finaltodate));; }?>   </B><br>
			 Report was run on <?php echo  date("d/m/Y H:i:s");?>
									<br>Name----------------------Date--------------------Signature----------------</span>

			</th>
	
			 </center>
			 </tr>
		 	 <?php 
				 }				
			 ?>
		 
		 
		 
		 
		 
		 <tr>
		     <th> #</th>  
	
									    <th> AGENT NAME</th>  
								
												<th> SALES</th>
                                            
											
											<th> No of Orders</th> 
											
		<?php
 if(($myviewcommission==true)||($viewcommission==true)) {
	 ?>
 <th> Commission</th> 
	 <?php
 }
	 ?>

											

									
										
										

                 </tr>
             </thead>
<?php
















	

 if(!is_array($salesreport)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='1'>";
    
       echo '<div class="alert alert-warning text-center">There no records found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  $total=0; 
    $ttcommision=0; 

    $totalcash=0; 
		  $totaltax=0; 
$totalmpesa=0;		  
$cashmpesa=0;

$totalcredit=0;		  
$totalcheque=0;
$totalvoucher=0;		  
$totalpoints=0;
$totalcard=0;		  
$ttmaindiscount=0;		  
$totalcreditnote=0;

$i=0;


  	foreach ($salesreport as $c): 
$totalcash=$totalcash+$c->cash;
		$totalmpesa=$totalmpesa+$c->mpesa;
		$ttmaindiscount=$ttmaindiscount+$c->maindiscount;
		$totalcredit=$totalcredit+$c->credit;		  
$totalcheque=$totalcheque+$c->cheque;	
$totalvoucher=$totalvoucher+$c->voucher;			  
$totalpoints=$totalpoints+$c->points;	
$totalcard=$totalcard+$c->card;	
$totalcreditnote=$totalcreditnote+$c->creditnote;

$cashmpesa=	 $totalmpesa+$totalcash+$totalcredit+$totalcheque+$totalvoucher+$totalpoints+$totalcard;
	$mytotal=$totalmpesa+$totalcash+$totalcheque+$totalpoints+$totalcard;
 $myinvoice=$c->invoice ; 
 
 

		$view="user/mergebill";
	
             ?>



             <tr>
              
            <?php 
$id=$c->id;
 $total=$total+$c->total;


 $view="";
$salestype= $c->salestype;
$type=$c->type;

?>


     <td>
	
<?php 
$i++;


echo $i ;

?>
      </td>
   







 <td><?php  $userids= $c->salesperson ;

$myuser=$this->usermodel->geteuser($userids);
   echo $myname=$myuser[0]['firstname'];
   
   if($myuser[0]['rate']!=""){
	      $comissionrate=$myuser[0]['rate'];

   }else{
	      $comissionrate=0;

   }
$mycom= (($comissionrate/100) *$c->total) ;

$ttcommision=$ttcommision+$mycom;
  ?></td>  



      <td>
<?php 
echo formatMoney($c->total, true);  
?>
      </td>
   
  



      <td>
<?php echo $c->counter ;

?>
      </td>
  
  
   
   
         
<?php  
?>
     
	<?php
 if(($myviewcommission==true)||($viewcommission==true)) {
	 ?>
	 <td>
	 <?php
echo formatMoney($mycom, true);

?>
   </td>
   <?php
 }
	 ?>

 
   
   
   
   
   
   
   
   
   
   
         
             </tr>

	<?php endforeach;} ?>
<tfoot>
 <tr>
		 
	
	
												
												
								<tr border="1" background="green">
									<td colspan="2"><center><b>Expected  Amount:</td>
				<td>					
		<b><?php if(isset($total)) {echo formatMoney($total, true);  }?></b>
		
		</td>
		<td></td>
				



<?php
 if( $viewcommission==true){
	 ?>
		<td>	
		<b><?php if(isset($ttcommision)) {echo formatMoney($ttcommision, true);  }?></b>
		
		</td>
   <?php
 }
	 ?>
		
					
					
</tr>
	
	
	</tfoot>
         

        </table>
		
	 <div class="col-md-12 text-center">    <?php echo $links; ?>
					   		<span style="color:red; font-size:20px"><?php  echo $total_rows. "   Sales. " ;?>    </span>

        
        </div>
		
		
	</div>
	
	
	
	
	
				
				<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

           
		
          
<?php
$session_data = $this->session->userdata('logged_in');

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
 if(!is_array($allcollections)) 

 {

 
 
 
 
 

   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='10'>";
    
				 echo '<div class="alert alert-warning text-center">There is no data found in the system</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    	 <tr>
			        <th colspan="10"><CENTER>DAILY DEPOSITS COLLECTIONS</CENTER></th>
			     </tr>
         <tr>
     <th>Receipt No</th>
     <th>Invoice No</th>
	  <th>Amount</th>
	   <th>Balance</th>
	   <th>Remarks</th>
	    	   <th>Method</th>

<th>Date</th>	
 
		   <th>Added by</th>

		
 

                 </tr>
             <?php 
   $mytotals=0;
  	foreach ($allcollections as $c): 
	
 $mybalance=0;
$mycash=0;
	
             ?>



             <tr>
                
            <?php 
$id=$c->id;
$myinvoice=$c->id ;

?>

     <td><?php echo "RS-".$myinvoice; ?></td>           
  <td><?php echo $c->invoice ; ?></td>
  
    <td><?php echo $c->amount ; 
	$mytotals=$mytotals+$c->amount ;
	
	?></td>
	<td><?php echo $c->balance ; ?></td>
   <td><?php echo $c->remarks ; ?></td>
	  
	
	   
	   <td>
			 <?php  $paymentmethodesid= $c->paymentmethodes ;
	 $mypaymentmethodes = $this->usermodel->populateallarray('glaccounts','number',$paymentmethodesid);

   echo $mypaymentmethodes[0]['accountname'];
			  ?>
			</td>

	  <td><?php echo $c->paiddate ; ?></td>
	   <td><?php  $userids= $c->userid ;

$myuser=$this->usermodel->geteuser($userids);
   echo $myname=$myuser[0]['firstname'];

  ?></td>

                 
				 

             </tr>

	<?php endforeach;} ?>

            
			  	</tr>
							
								

								
								
								<th colspan="2" >
								
								
								
								 Total Money Paid:<br>
								
								
								
								</th>
								
														<th >
<?php if(isset($mytotals)) {echo $mytotals; }?>
								
														</th>
														<th colspan="5" ></th>
							</tr>

        </table>
		
		
	
	
			<div id="productModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Sales Report per product</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewproductsalesreport' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>

  <div class="form-group">
    <label for="inputcategory" class="col-sm-2 control-label">Product Category</label>
    <div class="col-sm-10">
	<select class="form-control" name="category"  required>
	
	
	<option value=""  >---Select item category to search--</option>

					<option selected="selected" value="code">Product name/code</option>
					<option  value="serial">Product Serial Number</option>

</select>
		

		
	</div>
  </div>
	 <div class="form-group">
    <label for="inputdaterange" class="col-sm-2 control-label">Date Range?</label>
    <div class="col-sm-10">
	<select class="form-control" name="daterange"  required>
	
	
	<option value=""  >---Use date ranges?--</option>

					<option selected="selected" value="yes">Yes</option>
					<option  value="No">No(Everything)</option>

</select>
		

		
	</div>
  </div>
	
	
  <div class="form-group">
    <label for="inputbranchname" class="col-sm-2 control-label">Counter</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchname"  id="branchname" required>
	
	
	<option value=""  >---Select Branch/Counter Name--</option>
<?php
									 if( $viewallaction==true){
										 ?>
					<option value="all"  >All branches/Counters</option>
									<?php
									 }
							
	?>
	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option selected="selected" value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</div>
  </div>
	
	  <div class="form-group">
    <label for="inputcode" class="col-sm-2 control-label">Product code / Serial No</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="code" id="id" autofocus value="<?php echo set_value('code'); ?>" class="form-control" required placeholder="Enter code or name">
		 
				
		<span class="text-danger"> <?php echo form_error('code'); ?>
		
		</span>
	</div>
  </div>
  
	
	
	
	
	
	
						    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>

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

                     		  		<input type="date" name="fromdate" value="<?php echo set_value('fromdate',$finalstartdate); ?>" class="form-control" required placeholder="Enter start date">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					

							  		<input type="text"  name="frotime" value="<?php echo set_value('frotime',$starttime.":00"); ?>" class="form-control" required placeholder="Enter start time">

					</div>
				</div>
			

			
			
						    <label for="inputfromdate" class="col-sm-2 control-label">To Date </label>

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

		  		<input type="date" name="todate" value="<?php echo set_value('todate',$finalendate); ?>" class="form-control" required placeholder="Enter End date">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					

							  		<input type="text"  name="totime" value="<?php echo set_value('totime',$duetime.":00"); ?>" class="form-control" required placeholder="Enter stop time">

					</div>
				</div>
			
  
    
       	 		  		<input type="hidden" name="type" value="all" class="form-control" required placeholder="Enter all">


	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_addevent" class="btn btn-primary"> View Sales  </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>
	
	
							
<div id="addModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Post your  daily sales</h4>
      </div>
      <div class="modal-body">

	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');

$img_id = rand(100, 990000).time();

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addcollections' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
								<input type="hidden" name="view" value="user/viewdailycollections" id="view" class="form-control" required placeholder="Enter cash">
      		
	
	 <div class="form-group">
    <label for="inputbranchid" class="col-sm-2 control-label">Counter</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchid"  id="branchid" required>
	
	
	<option value=""  >---Select Branch/Counter Name--</option>
<?php
									 if( $viewallaction==true){
										 ?>
					<option value="all"  >All branches/Counters</option>
									<?php
									 }
							
	?>
	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option selected="selected" value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</div>
  </div>
  	 <div class="form-group">
    <label for="inputopeningbalance" class="col-sm-2 control-label">Opening balance</label>
    <div class="col-sm-10">
	

			<select class="form-control2" name="openingbalance"  id="openingbalance" >
	
	
		 <?php

			   			      	   	$clbalsnce = $this->usermodel->populatealldatarraythreeclosingbalance('dailycollections','companyid', $companyid,'branchid', $branchid,'id >', 0);

							


if(is_array($clbalsnce)) {

   foreach($clbalsnce as $clbalsncerow){

   //echo $courserow->coursename;
    ?>
					<option selected="selected" value="<?=  $clbalsncerow->closingbalance;   ?>"><?=  $clbalsncerow->closingbalance; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		
										<input type="text" name="openingbalance2" value="0" id="openingbalance" class="form-control2"  placeholder="Enter Opening balance">

        <span class="text-danger"><?php echo form_error('openingbalance'); ?></span>
	</div>
  </div>
  


  
  
    	 <div class="form-group">
    <label for="inputtotalsales" class="col-sm-2 control-label">TT Sales</label>
    <div class="col-sm-10">
	<?php
	if($usertype=="admin"){
		?>
<input type="text" name="totalsales"  value="<?php   if(isset($cashmpesa)) {echo $cashmpesa; } ?>" id="totalsales" class="form-control"  placeholder="Enter total  sales">
				<?php
				}else{?>
						<input type="text" name="totalsales" readonly value="<?php   if(isset($cashmpesa)) {echo $cashmpesa; } ?>" id="totalsales" class="form-control"  placeholder="Enter total  sales">

				<?php
				}
				?>
				

			
	
        <span class="text-danger"><?php echo form_error('totalsales'); ?></span>
	</div>
  </div>
  <center> Summary Sales Details</center>
  <hr width="100%" style="height: 3px;color: #123455;background-color: #123455;border: none;">
   <div class="form-group">
    <label for="inputamount" class="col-sm-2 control-label">Cash Sales</label>
    <div class="col-sm-10">
				<input type="text" name="cash" value="<?php   if(isset($totalcash)) {echo $totalcash; } ?>" id="cash" class="form-control" required placeholder="Enter cash">
        <span class="text-danger"><?php echo form_error('amount'); ?></span>
	</div>
  </div>
 

   <div class="form-group">
    <label for="inputmpesa" class="col-sm-2 control-label">Mpesa Sales</label>
    <div class="col-sm-10">
				<input type="text" name="mpesa" value=" <?php   if(isset($totalmpesa)) {echo $totalmpesa; } ?>" id="mpesa" class="form-control" required placeholder="Enter Mpesa">
        <span class="text-danger"><?php echo form_error('mpesa'); ?></span>
	</div>
  </div>
    
	
	
		
     <div class="form-group">
    <label for="inputcredit" class="col-sm-2 control-label">Credit Sales</label>
    <div class="col-sm-10">
				<input type="text" name="credit" value="<?php   if(isset($totalcredit)) {echo $totalcredit; } ?>" id="credit" class="form-control" required placeholder="Enter credit amount">
        <span class="text-danger"><?php echo form_error('credit'); ?></span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputcard" class="col-sm-2 control-label">Visa/Master Card Sales</label>
    <div class="col-sm-10">
				<input type="text" name="card" value="<?php   if(isset($totalcard)) {echo $totalcard; } ?>" id="card" class="form-control" required placeholder="Enter card amount">
        <span class="text-danger"><?php echo form_error('card'); ?></span>
	</div>
  </div>
  
   <div class="form-group">
    <label for="inputcheque" class="col-sm-2 control-label">Cheque/Bank Sales</label>
    <div class="col-sm-10">
				<input type="text" name="cheque" value="<?php   if(isset($totalcheque)) {echo $totalcheque; } ?>" id="cheque" class="form-control" required placeholder="Enter cheque amount">
        <span class="text-danger"><?php echo form_error('cheque'); ?></span>
	</div>
  </div>
  
  <div class="form-group">
    <label for="inputpoints" class="col-sm-2 control-label">L Points Sales</label>
    <div class="col-sm-10">
				<input type="text" name="points" value="<?php   if(isset($totalpoints)) {echo $totalpoints; } ?>" id="points" class="form-control" required placeholder="Enter points amount">
        <span class="text-danger"><?php echo form_error('points'); ?></span>
	</div>
  </div>
  
  
  
  

			
  
    <div class="form-group">
    <label for="inputvoucher" class="col-sm-2 control-label">Voucher Sales</label>
    <div class="col-sm-10">
				<input type="text" name="voucher" value="<?php   if(isset($totalvoucher)) {echo $totalvoucher; } ?>" id="voucher" class="form-control" required placeholder="Enter voucher amount">
        <span class="text-danger"><?php echo form_error('voucher'); ?></span>
	</div>
  </div>
  
      <center> Expense Details</center>
  <hr width="100%" style="height: 3px;color: #123455;background-color: #123455;border: none; ">
  

    <div class="form-group">
    <label for="inputexpense" class="col-sm-2 control-label">Total Expense</label>
    <div class="col-sm-10">
	
									<input type="text" name="expense" value="<?php   if(isset($totalexpense)) {echo $totalexpense; } ?>" id="expense" class="form-control"  placeholder="Enter total Expense">

			
	
        <span class="text-danger"><?php echo form_error('expense'); ?></span>
	</div>
  </div>
  
  
     <div class="form-group">
    <label for="inputsortmoney" class="col-sm-2 control-label">Short (Unaccounted FOR)</label>
    <div class="col-sm-10">
	
									<input type="text" readonly name="sortmoney" value="0" id="tax" class="form-control"  placeholder="Enter total money Unaccounted FOR">

			
	
        <span class="text-danger"><?php echo form_error('sortmoney'); ?></span>
	</div>
  </div>
     
  
    <div class="form-group">
    <label for="inputtax" class="col-sm-2 control-label">Total Tax</label>
    <div class="col-sm-10">
	
									<input type="text" name="tax" value="<?php if(isset($totaltax)) {echo formatMoney($totaltax, true);  }?>" id="tax" class="form-control"  placeholder="Enter total tax collected">

			
	
        <span class="text-danger"><?php echo form_error('tax'); ?></span>
	</div>
  </div>
  
  
  
  <center> Other Details</center>
  <hr width="100%" style="height: 3px;color: #123455;background-color: #123455;border: none;">
  
     <div class="form-group">
    <label for="inputcashcollected" class="col-sm-2 control-label">Amount Colled (From Counter)</label>
    <div class="col-sm-10">
				<input type="text" name="cashcollected" value="0" id="cashcollected" class="form-control" required placeholder="Enter cash collected">
        <span class="text-danger"><?php echo form_error('cashcollected'); ?></span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputclosingbalance" class="col-sm-2 control-label">Closing balance</label>
    <div class="col-sm-10">
	
									<input type="text" name="closingbalance" value="0" id="closingbalance" class="form-control"  placeholder="Enter Closing balance">

			
	
        <span class="text-danger"><?php echo form_error('closingbalance'); ?></span>
	</div>
  </div>
  
   	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">Name? </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php   if(isset($myname)) {echo $myname; } ?>" class="form-control" required placeholder="Enter the person in charge">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">ID No </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idno" value="<?php echo set_value('idno'); ?>" class="form-control"  placeholder="idno of person incharge ">
		 
				
		<span class="text-danger"> <?php echo form_error('idno'); ?>
		
		</span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputcontact" class="col-sm-2 control-label">Contact </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="contact" value="<?php echo set_value('contact'); ?>" class="form-control"  placeholder="Phone of person incharge ">
		 
				
		<span class="text-danger"> <?php echo form_error('contact'); ?>
		
		</span>
	</div>
  </div>
  	<div class="form-group">
    <label for="inputcontroller" class="col-sm-2 control-label">Approved by? </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="controller" value="<?php echo set_value('controller'); ?>" class="form-control" required placeholder="Confirmed by?">
		 
				
		<span class="text-danger"> <?php echo form_error('controller'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
  
  
  
  
  	<div class="form-group">
    <label for="inputdatespent" class="col-sm-2 control-label">	Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="entrydate" value="<?php echo $mydate;?>" class="form-control" required placeholder="Enter date ">
		 
				
		<span class="text-danger"> <?php echo form_error('datespent'); ?>
		
		</span>
	</div>
  </div>
 

	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  class="form-control"   placeholder="Enter description"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="collections" name="btn_addcollections" class="btn btn-default"> Add Collections   </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

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

	
		<div id="tableModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>

        <h4 class="modal-title">Sales Summary Report per table</h4>
      </div>
      <div class="modal-body">
      


				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
		
		
                 echo form_open('user/viewgsummaryreportbytable' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>

		  			  		<input type="hidden" name="type" value="all" class="form-control"  placeholder="Enter type">

  <div class="form-group">
    <label for="inputbranchname" class="col-sm-2 control-label">Counter</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchname"  id="branchname" required>
	
	
	<option value=""  >---Select Branch/Counter Name--</option>

	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option selected="selected" value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</div>
  </div>
	
	
				  		<input type="hidden" name="view" value="mysales" class="form-control" required placeholder="Enter sales type">

						
     
     <div class="form-group">
	 
	 
	 
    <label for="inputpaymentstatus" class="col-sm-2 control-label">Sales Status</label>
    <div class="col-sm-10">
	<select class="form-control" name="paymentstatus" required>
	<option  value="all"  >---All/Any sales status--</option>
   <option value="Cleared">Cleared</option>
									  
								
																 <option value="No">No (Not cleared)</option>
																 									   <option value="Pending">Pending</option>



	
</select>
		
						<span class="text-danger"><?php echo form_error('paymentstatus'); ?>

	</div>
  </div>
  
  
  
	 
	
  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$finalstartdate); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">	To Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="todate" value="<?php echo set_value('todate',$finalendate); ?>" class="form-control" required placeholder="Enter End date">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
  
    
  

	 <div class="form-group">
    <label for="inputmytable" class="col-sm-2 control-label">Table</label>
    <div class="col-sm-10">
	<select class="form-control" name="mytable"   required>
	
	<option selected="selected" value="all"  >---Select a table to view--</option>

		<option value="all"  >---All/Any table</option>

	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('tables','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $maincategoryrow->name;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main category available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('maincategory'); ?>

	</div>
  </div>

  

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_addevent" class="btn btn-default"> View Sales  </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

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

	
	
		<div id="usersummaryModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
		<?php
if( $viewreports==true){
 ?>

		 <a href="<?php echo base_url();?>admin/searchbalance" class="btn btn-default"> View Rooms Report</a>	

<?php	
}
 ?>
	
        <h4 class="modal-title">Sales Summary Report per user</h4>
      </div>
      <div class="modal-body">
      


				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewgsummaryreportbyuser' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>


  <div class="form-group">
    <label for="inputbranchname" class="col-sm-2 control-label">Counter</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchname"  id="branchname" required>
	
	
	<option value=""  >---Select Branch/Counter Name--</option>
<?php
									 if( $viewallaction==true){
										 ?>
					<option value="all"  >All branches/Counters</option>
									<?php
									 }
							
	?>
	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option selected="selected" value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</div>
  </div>
	
	
				  		<input type="hidden" name="view" value="mysales" class="form-control" required placeholder="Enter sales type">

     <div class="form-group">
    <label for="inputuser" class="col-sm-2 control-label">User?</label>
    <div class="col-sm-10">
	<select class="form-control" name="user" required>
	
	<option value=""  >---Select user---</option>

						<?php
		
		 if($cashiersales==true){
			 					//$allusers = $this->usermodel->populatealldatanoarraythree('productlist','expdate <>', '0000-00-00','expdate <', $currentdate,'companyid', $companyid);			   

			$allusers = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category','user');
			?>
						<option value="all"  selected="selected" >All 	users</option>
<?php


 }else{
	 			$allusers = $this->usermodel->populatealldatanoarraythree('people', 'userid',$userid,'status',1,'category','user');

	 
			//$allusers = $this->usermodel->populatealldatanoarray('people', 'id',$userid,'status',1);

 
  
 }
  ?>

	
	
	
	<?php 
				
				
	

	
if(is_array($allusers)) {

   foreach($allusers as $userrow){

   //echo $courserow->coursename;
    ?>
						<option value="<?=  $userrow->id;   ?>"><?=  $userrow->firstname ."- ".$userrow->surname ."(". $userrow->email.")"; ?></option>




	<?php

}} else {
    echo 'No user available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('people'); ?>

	</div>
  </div>
  
  
     <div class="form-group">
    <label for="inputgroup" class="col-sm-2 control-label">Group Sales?</label>
    <div class="col-sm-10">
	<select class="form-control" name="group"  required>
	
	

					
	
	<option value=""  >---Use Group Items?--</option>
		<option  value="yes">Yes (Perfomance Report)</option>
					<option  selected="selected" value="Perfomance">Yes  (Total sales)</option>
					<option   value="no">No(Everything)</option>


</select>
		

		
	</div>
  </div>
	
	
	
	
	
	
	
	
	
	
	
	
    
     <div class="form-group">
	 
	 
	 
    <label for="inputpaymentstatus" class="col-sm-2 control-label">Sales Status</label>
    <div class="col-sm-10">
	<select class="form-control" name="paymentstatus" required>
	<option  value="all"  >---All/Any sales status--</option>
   <option value="Cleared">Cleared</option>
									  
								
																 <option value="No">No (Not cleared)</option>
																 									   <option value="Pending">Pending</option>



	
</select>
		
						<span class="text-danger"><?php echo form_error('paymentstatus'); ?>

	</div>
  </div>
  
  
  
  
  
  
	
	
	
	
	
  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$finalstartdate); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">	To Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="todate" value="<?php echo set_value('todate',$finalendate); ?>" class="form-control" required placeholder="Enter End date">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
  
    
     <div class="form-group">
	 
	 
	 
    <label for="inputdisplay" class="col-sm-2 control-label">Display type?</label>
    <div class="col-sm-10">
	<select class="form-control" name="display" required>
	<option  value="all"  >---Do you want to print user z-report--</option>
	<option value="yes" >Yes</option>
<option selected="selected" value="no">No i want to just view sales</option>

	
</select>
		
						<span class="text-danger"><?php echo form_error('display'); ?>

	</div>
  </div>
   



	 <div class="form-group">
	 
	 
	 
    <label for="inputtype" class="col-sm-2 control-label">Sales types</label>
    <div class="col-sm-10">
	<select class="form-control" name="type" required>
	<option  value="all"  >Both Cash and Credit sales--</option>
   <option value="Cash">Cash Sales Only</option>
 <option value="Invoice">Credit/Invoice Sales Only</option>

									  
									  				


	
</select>
		
						<span class="text-danger"><?php echo form_error('type'); ?>

	</div>
  </div>







	 <div class="form-group">
    <label for="inputviewmaincategory" class="col-sm-2 control-label">Department Category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="maincategory"  id="maincategory" required>
	
	<option selected="selected" value="all"  >---All/Any Category--</option>

	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('maincategory','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main category available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('maincategory'); ?>

	</div>
  </div>

  

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_addevent" class="btn btn-default"> View Sales  </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

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

	
	
	
	
	
	
	
	
	
	
	
	
	
			<div id="userModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
		
		
		<?php
if( $viewreports==true){
 ?>

		 <a href="<?php echo base_url();?>admin/searchbalance" class="btn btn-default"> View Rooms Report</a>	

<?php	
}
 ?>
	

        <h4 class="modal-title">Sales Report per user</h4>
      </div>
      <div class="modal-body">
      


				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewgroupreceiptreportbyuser' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>

		  			  		<input type="hidden" name="type" value="all" class="form-control"  placeholder="Enter type">

  <div class="form-group">
    <label for="inputbranchname" class="col-sm-2 control-label">Counter</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchname"  id="branchname" required>
	
	
	<option value=""  >---Select Branch/Counter Name--</option>
<?php
									 if( $viewallaction==true){
										 ?>
					<option value="all"  >All branches/Counters</option>
									<?php
									 }
							
	?>
	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option selected="selected" value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</div>
  </div>
	
	
				  		<input type="hidden" name="view" value="viewgroupreceiptreport" class="form-control" required placeholder="Enter sales type">

     <div class="form-group">
    <label for="inputuser" class="col-sm-2 control-label">User?</label>
    <div class="col-sm-10">
	<select class="form-control" name="user" required>
	
	<option value=""  >---Select user---</option>

						<?php
	
		
		
		 if($cashiersales==true){
			$allusers = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category','user');
	?>
		<option value="all"  selected="selected">-All users-</option>

	<?php

 }else{
				 			$allusers = $this->usermodel->populatealldatanoarraythree('people', 'userid',$userid,'status',1,'category','user');

 
  
 }
  ?>

	
	
	
	<?php 
				
				
	

	
if(is_array($allusers)) {

   foreach($allusers as $userrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $userrow->id;   ?>"><?=  $userrow->firstname ."- ".$userrow->surname ."(". $userrow->email.")"; ?></option>



	<?php

}} else {
    echo 'No user available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('people'); ?>

	</div>
  </div>
  
  
  
  
  
  
  
  
  
	
	
	
	
	
  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$finalstartdate); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">	To Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="todate" value="<?php echo set_value('todate',$finalendate); ?>" class="form-control" required placeholder="Enter End date">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
  
    
     
   

	 <div class="form-group">
    <label for="inputviewmaincategory" class="col-sm-2 control-label">Department Category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="maincategory"  id="maincategory" required>
	
	<option selected="selected" value="all"  >---All/Any Category--</option>

	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('maincategory','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main category available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('maincategory'); ?>

	</div>
  </div>

  

	 <div class="form-group">
    <label for="inputgroup" class="col-sm-2 control-label">Group Items?</label>
    <div class="col-sm-10">
	<select class="form-control" name="group"  required>
	
	
	<option value=""  >---Use Group Items?--</option>

					<option  selected="selected"  value="yes">Yes</option>
					<option value="No">No(Everything)</option>

</select>
		

		
	</div>
  </div>
	
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_addevent" class="btn btn-default"> View Sales  </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>
			<div id="deleteModel" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Delete</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to delete this item? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('user/deletebyid' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
 <input type="hidden" id="table"name="table" class="table" placeholder="table" value="sales">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/startsales">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Delete  </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>		
	
	
	
	
	
	
	
	
	
	

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

 
</div>


















