����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 3.128.190.205 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/t/sae/appsae/core/app/view/ |
Upload File : |
<?php if(isset($_GET["product_id"])): $stock_id = $_SESSION['stock_id']; $almacen = StockData::getByid($stock_id); $product = ProductData::getById($_GET["product_id"]); //compras $itotal2 = OperationData2::GetInputQByStock($product->id, $stock_id); //ordenes de compra $itotal_O = OperationData2::getBySumOC($product->barcode, $stock_id); //Total de entradas $entradas = $itotal2 + $itotal_O['0']->sum; //ventas en tabla t_sale_detail $vendedores = UserData::getByIdStock($stock_id); //print_r($vendedores); $totalV=0; $totalP=0; foreach($vendedores as $vendedor){ //ventas en tabla t_sale_detail por almacen //extraemos el valor de barcode del producto hijo $prod_hijo = ProductData::getBycodeItem($product->barcode); //print_r($prod_hijo); if($product->is_service == 3){ $operations3 = OperationData::getByPackOK($product->barcode, $vendedor->id_user); //print_r($operations3); }else{ //*********verificar productos hijo if(!empty($prod_hijo)){ //obtenemos los productos que se venden dentro de paquetes $operations3 = OperationData::getByc2OK($prod_hijo->id_item, $vendedor->id_user); //obtenemos los productos que se venden solos $operationsP = OperationData::getByPackOK($product->barcode, $vendedor->id_user); //print_r($operations3); } //********************************* } //productos en paquete foreach($operations3 as $op) { $totalV = $totalV + $op->qty; } if($product->is_service == 3){ }else{ //productos en paquete foreach($operationsP as $op) { $totalP = $totalP + $op->qty; } } } //obtenemos el multiplicador del producto padre para ver cuantas se vendieron $prod_padre = ProductData::getBycodePadre($prod_hijo->id_item); //print_r($prod_padre->qy); if(empty($prod_padre->qy)) { }else{ //obtenemos el total de ventas solas de este producto inventariable $factorM = $totalP*$prod_padre->qy; //multiplicamos las ventas del paquete por qy(cantidad de productos hijo dentro del paquete) $totalV = ($totalV*$prod_padre->qy) + $totalP - $factorM ; } //ajuste salida $totalAjusteS = -1*OperationData2::getOutputQByStock($product->id, $stock_id); //print_r($totalAjusteS); //devoluciones de tabla operations $operations4 = OperationData::getAllByProductIdAndStockDev($product->id, $stock_id); $totalDev=0; foreach($operations4 as $op2) { $totalDev = $totalDev + $op2->q; } //existencia $existencia = ($entradas - $totalV + $totalDev) + $totalAjusteS; ?> <?php endif; ?> <section class="content-header"> <h1> <?php if($product->is_service == 3): ?> <h1>Producto <small>Paquete</small></h1> <?php else: ?> <h1>Producto <small>Inventariable</small></h1> <?php endif; ?> </h1> </section> <div class="row"> <div class="col-md-12"> <div class="btn-group pull-right"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-download"></i> Descargar <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu"> <li><a href="report/history-word.php?id=<?php echo $product->id;?>&stock_id=<?php echo $_GET["stock"];?>">Word 2007 (.docx)</a></li> </ul> </div> <?php $array1=ProductData::getBycodeItem($product->barcode); //desglosamos todo el array foreach($array1 as $key=>$value){ if( $key == "stock") { // asignamos el valor de stock a una variable $sts=$value; } } ?> </div> </div> <!-- Content Header (Page header) --> <section class="content-header"> <h1> <h1><?php echo $product->barcode; ?>-<?php echo $product->name; ?> <small>Historial</small></h1> </h1> <ol class="breadcrumb"> <li><a href="./?view=home">Inicio</a></li> <li><a href="./?view=stocks">Almacenes</a></li> <li><a href="./?view=inventary&stock=<?php echo $almacen->id; ?>"><?php echo $almacen->name;?></a></li> <li class="active">Historial</li> </ol> </section> <!-- Main content --> <section class="content"> <div class="row"> <div class="col-md-4"> <div class="small-box bg-aqua"> <div class="inner"> <h3><?php echo $entradas; ?></h3> <p>Entradas</p> <p>(Devoluciones = <?php echo $totalDev; ?>)+(Compras = <?php echo $itotal2; ?>) +(OC = <?php echo $itotal_O['0']->sum; ?>)</p> </div> <div class="icon"> <i class="fa fa-usd"></i> </div> </div> </div> <div class="col-md-4"> <div class="small-box bg-green"> <div class="inner"> <h3><?php echo $existencia; ?></h3> <p>Disponible</p> <p>(Existencia - Ajustes_S=<?php echo $totalAjusteS;?>)( ini = <?php echo $sts; ?>)+ (O.C.)</p> </div> <div class="icon"> <i class="fa fa-cube"></i> </div> </div> <?php ?> </div> <div class="col-md-4"> <div class="small-box bg-yellow"> <div class="inner"> <h3><?php echo $totalV; ?></h3> <p>Salidas </p> <p>(Ventas = <?php echo $totalV; ?>)</p> </div> <div class="icon"> <i class="fa fa-shopping-cart"></i> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="clearfix"></div> <br> <?php $users2 = OperationData2::getAllByProductIdAndStock($product->id,$almacen->id); $montoE=0; $cantT=0; $compras=0; if(count($users2)>0){ // si hay usuarios ?> <div class="box"> <div class="box-header"> <h3 class="box-title">Movimientos Entradas</h3> </div><!-- /.box-header --> <div class="box-body"> <table class="table table-bordered datatable table-hover"> <thead> <th>Folio Compra</th> <th>Precio Costo</th> <th>Cantidad</th> <th>Fecha</th> <th>Tipo</th> <th></th> </thead> <?php foreach($users2 as $user){ ?> <tr> <td> <?php if($user->operation_type_id==1){ ?> <a href="index.php?view=onere&id=<?php echo $user->re_id;?>" class="btn btn-xs btn-default"><i class="glyphicon glyphicon-eye-open"></i></a>C <?php echo $user->re_id;?></td> <?php }else{ ?> <a href="index.php?view=onereAjuste&id=<?php echo $user->re_id;?>" class="btn btn-xs btn-success"><i class="glyphicon glyphicon-eye-open"></i></a>A <?php echo $user->re_id;?></td> <?php }?> <td>$<?php echo number_format($user->price_in,2);?></td> <td><?php $montoE = $montoE + ($user->q*$user->price_in); $cantT = $cantT + $user->q; $compras= $compras + $user->q; echo $user->q; ?></td> <?php $fecha = explode("-",$user->created_at); $fecha2 = explode(":",$fecha[2]); $fecha3 = explode(" ",$fecha2[0]); ?> <td><b><?php echo $fecha3[0]; echo "/"; echo $fecha[1]; echo "/"; echo $fecha[0]; ?></b></td> <td> <?php if($user->operation_type_id==1){ echo "Compra"; }else{ $folio = ReData::getById($user->re_id); if(isset($folio->stock_from_id)){ if($folio->stock_from_id >= 1 ){ echo "Traspaso-salida"; } } else{ echo "Ajuste-Salida"; } } ?> </td> <td style="width:130px;"><a href="#" id="oper-<?php echo $user->id; ?>" class="btn btn-danger btn-xs">Eliminar</a></td> <script> $("#oper-"+<?php echo $user->id; ?>).click(function(){ x = confirm("Estas seguro que quieres eliminar esto ??"); if(x==true){ window.location = "index.php?view=deleteoperation2&ref=history&pid=<?php echo $user->product_id;?>&opid=<?php echo $user->id;?>"; } }); </script> </tr> <?php } ?> </table> <div class="row"> <div class="col-md-4"> <div class="box box-primary"> <table class="table table-bordered"> <tr> <td>Gran total Compras:</td> <td align="right"><u><b>$ <?php echo number_format($montoE,2,'.',','); $TotalCompras = $montoE; ?></b></u></td> </tr> <tr> <td>Compras/Entradas:</td> <td align="right"><u><b><?php echo $compras; ?></b></u></td> </tr> </table> </div> </div> </div> </div><!-- /.box-body --> </div><!-- /.box --> <?php }else{ echo "<p class='alert alert-danger'>No hay Compras Normals de este producto</p>"; } ?> </div> </div> <?php //ORDENES DE COMPRA ?> <div class="row"> <div class="col-md-12"> <div class="clearfix"></div> <br> <?php $ordenesC = OperationData2::getAllByProductIdAndStock_OC($product->barcode,$almacen->id); //print_r($ordenesC); //die; $montoE=0; $cantT=0; $compras=0; if(count($ordenesC)>0){ // si hay usuarios ?> <div class="box"> <div class="box-header"> <h3 class="box-title">Movimientos Entradas(OC)</h3> </div><!-- /.box-header --> <div class="box-body"> <table class="table table-bordered datatable table-hover"> <thead> <th>Folio Compra</th> <th>Precio Costo</th> <th>Cantidad</th> <th>Fecha</th> <th>Tipo</th> <th></th> </thead> <?php foreach($ordenesC as $user){ ?> <tr> <td> <?php if($user->operation_type_id==1){ ?> <a href="index.php?view=onereO&id=<?php echo $user->re_id;?>" class="btn btn-xs btn-default"><i class="glyphicon glyphicon-eye-open"></i></a>C <?php echo $user->re_id;?></td> <?php }else{ ?> <a href="index.php?view=onereAjuste&id=<?php echo $user->re_id;?>" class="btn btn-xs btn-success"><i class="glyphicon glyphicon-eye-open"></i></a>A <?php echo $user->re_id;?></td> <?php }?> <td>$<?php echo number_format($user->price_in,2);?></td> <td><?php $montoE = $montoE + ($user->q*$user->price_in); $cantT = $cantT + $user->q; $compras= $compras + $user->q; echo $user->q; ?></td> <?php $fecha = explode("-",$user->created_at); $fecha2 = explode(":",$fecha[2]); $fecha3 = explode(" ",$fecha2[0]); ?> <td><b><?php echo $fecha3[0]; echo "/"; echo $fecha[1]; echo "/"; echo $fecha[0]; ?></b></td> <td> <?php if($user->operation_type_id==1){ echo "Compra OC"; }else{ $folio = ReData::getById($user->re_id); if(isset($folio->stock_from_id)){ if($folio->stock_from_id >= 1 ){ echo "Traspaso-salida"; } } else{ echo "Ajuste-Salida"; } } ?> </td> <td style="width:130px;"><a href="#" id="oper-<?php echo $user->id; ?>" class="btn btn-danger btn-xs">Eliminar</a></td> <script> $("#oper-"+<?php echo $user->id; ?>).click(function(){ x = confirm("Estas seguro que quieres eliminar esto ??"); if(x==true){ window.location = "index.php?view=deleteoperation2&ref=history&pid=<?php echo $user->product_id;?>&opid=<?php echo $user->id;?>"; } }); </script> </tr> <?php } ?> </table> <div class="row"> <div class="col-md-4"> <div class="box box-primary"> <table class="table table-bordered"> <tr> <td>Gran total Compras(OC):</td> <td align="right"><u><b>$ <?php echo number_format($montoE,2,'.',','); ?></b></u></td> </tr> <tr> <td>Compras/OC:</td> <td align="right"><u><b><?php echo $compras; ?></b></u></td> </tr> </table> </div> </div> </div> </div><!-- /.box-body --> </div><!-- /.box --> <?php }else{ echo "<p class='alert alert-danger'>No hay Ordenes de Compra de este producto</p>"; } ?> </div> </div> <div class="row"> <div class="col-md-12"> <div class="clearfix"></div> <br> <?php //ventas en tabla t_sale_detail $vendedores = UserData::getByIdStock($stock_id); //print_r($vendedores); $total_ventas=0; foreach($vendedores as $vendedor){ $users2 = OperationData::getByPackOK($product->barcode, $vendedor->id_user); if(count($users2)>0){ // si hay ?> <div class="box"> <div class="box-header"> <h3 class="box-title">Movimientos Ventas</h3> <small>Usuario No: <?php echo $vendedor->id_user?></small> </div><!-- /.box-header --> <div class="box-body"> <table class="table table-bordered datatable table-hover"> <thead> <th>Ticket venta</th> <th>Factura</th> <th>Precio</th> <th>Cantidad</th> <th>Folio</th> <th>Fecha Venta</th> <th>Fecha captura</th> <th></th> </thead> <?php $montoS= 0; $ventas=0; foreach($users2 as $user){ $search= $user->sale_id; //tabla t_sale $sell3 = SellData::getByIdSale($search); //tabla sell $sell34 = SellData::getBycStock($search, $vendedor->id_user); if(isset($sell34->id)) { $sell = $sell34->id; }else { $sell = "Error"; } ?> <tr> <td> <a href="index.php?view=onesell1&id=<?php echo $sell;?>&sale_id=<?php echo $user->sale_id;?>" class="btn btn-xs btn-default"><i class="glyphicon glyphicon-eye-open"></i></a> <?php echo $sell; $facturada = FacturaData::getByIdFacturada($sell); ?> </td> <td> <?php if(!isset($facturada->sell_id)){ echo "NO"; }else{ echo "SI"; } ?> </td> <td> $<?php echo number_format($user->price,2);?> </td> <td><?php echo $user->qty; $montoS= $montoS + ($user->qty*$user->price); $ventas=$ventas +$user->qty; ?></td> <td><?php echo $user->sale_id;?></td> <td><?php echo $sell3->sale_date;?></td> <td><?php echo $user->created_at;?></td> <td style="width:130px;"><a href="#" id="oper-<?php echo $user->autoid; ?>" class="btn btn-danger btn-xs">Eliminar</a></td> <script> $("#oper-"+<?php echo $user->autoid; ?>).click(function(){ x = confirm("Estas seguro que quieres eliminar esto ??"); if(x==true){ window.location = "index.php?view=deleteoperation2&ref=history&pid=<?php echo $user->barcode;?>&opid=<?php echo $user->autoid;?>"; } }); </script> </tr> <?php } ?> </table> <div class="row"> <div class="col-md-4"> <div class="box box-primary"> <table class="table table-bordered"> <tr> <td>Gran total Ventas:</td> <td align="right"><u><b>$ <?php $total_ventas+=$montoS; echo number_format($montoS,2,'.',','); ?></b></u></td> </tr> <?php if($product->is_service == 3): ?> <tr> <td>Cantidad de Ventas(PAQUETES):</td> <td align="right"><u><b><?php echo $ventas; ?></b></u></td> </tr> <?php else: ?> <?php if($user->unit == 'pz'): ?> <tr> <td>Cantidad de Ventas(INDIVIDUALES):</td> <td align="right"><u><b><?php echo $totalV; ?></b></u></td> </tr> <?php else: ?> <tr> <td>Cantidad de Ventas(INDIVIDUALES):</td> <td align="right"><u><b><?php echo $ventas; ?></b></u></td> </tr> <tr> <td>Cantidad de Ventas(PAQUETES):</td> <td align="right"><u><b><?php echo $totalV-$ventas; ?></b></u></td> </tr> <?php endif; ?> <?php endif; ?> </table> </div> </div> </div> </div><!-- /.box-body --> </div><!-- /.box --> <?php }else{ //$montoS=0; echo "<p class='alert alert-danger'>No hay Ventas de este producto para el <small>Usuario No.".$vendedor->id_user."</mall></p>"; } } ?> </div> </div> <div class="row"> <div class="col-md-12"> <div class="clearfix"></div> <br> <?php //ventas en tabla t_sale_detail $users2 = OperationData::getAllByProductIdAndStockDev($product->id,$almacen->id); //total de devoluciones inicialiacion $montoD =0; $devoluciones=0; if(count($users2)>0){ // si hay ?> <div class="box"> <div class="box-header"> <h3 class="box-title">Movimientos Devoluciones</h3> </div><!-- /.box-header --> <div class="box-body"> <table class="table table-bordered datatable table-hover"> <thead> <th>Ticket venta</th> <th>Precio</th> <th>Cantidad</th> <th>Folio</th> <th>Fecha</th> <th></th> </thead> <?php foreach($users2 as $user){ ?> <tr> <td> <a href="index.php?view=onesell1&id=<?php echo $user->id;?>" class="btn btn-xs btn-default"><i class="glyphicon glyphicon-eye-open"></i></a> <?php echo $user->id; ?> </td> <td> $ <?php echo number_format($user->price_out,2);?> </td> <td><?php echo $user->q;?></td> <?php $montoD = $montoD +($user->q*$user->price_out); $devoluciones=$devoluciones+$user->q; ?> <td><?php echo $user->sell_id;?></td> <td><?php echo $user->created_at;?></td> <td style="width:130px;"><a href="#" id="oper-<?php echo $user->autoid; ?>" class="btn btn-danger btn-xs">Eliminar</a></td> <script> $("#oper-"+<?php echo $user->autoid; ?>).click(function(){ x = confirm("Estas seguro que quieres eliminar esto ??"); if(x==true){ window.location = "index.php?view=deleteoperation2&ref=history&pid=<?php echo $user->barcode;?>&opid=<?php echo $user->autoid;?>"; } }); </script> </tr> <?php } ?> </table> <div class="row"> <div class="col-md-4"> <div class="box box-primary"> <table class="table table-bordered"> <tr> <td>Gran total Devoluciones:</td> <td align="right"><u><b>$ <?php echo number_format($montoD,2,'.',','); ?></b></u></td> </tr> <tr> <td>Cantidad Devoluciones:</td> <td align="right"><u><b><?php echo $devoluciones; ?></b></u></td> </tr> </table> </div> </div> </div> </div><!-- /.box-body --> </div><!-- /.box --> <?php }else{ echo "<p class='alert alert-danger'>No hay Devoluciones de este producto</p>"; } ?> </div> </div> <div class="box"> <div class="box-header"> <h3 class="box-title">Saldos Por Producto</h3> </div><!-- /.box-header --> <div class="box-body"> <table class="table table-bordered datatable table-hover"> <thead> <th>Compras</th> <th>Ventas</th> <th>Devoluciones</th> <th>Neto</th> </thead> <tr> <td align="right"><u><b>$ <?php echo number_format($TotalCompras ,2,'.',','); ?></b></u></td> <td align="right"><u><b>$ <?php echo number_format($total_ventas,2,'.',','); ?></b></u></td> <td align="right"><u><b>$ <?php echo number_format($montoD,2,'.',','); ?></b></u></td> <td align="right"><u><b>$ <?php echo number_format($total_ventas-$TotalCompras-$montoD,2,'.',','); ?></b></u></td> </tr> </table> </div> </div> <?php if( ($total_ventas-$TotalCompras) < 1 and isset($user->price) ): ?> <div class="small-box bg-red"> <div class="inner"> <h3>Analizar <u><?php if(isset($user->price)) { echo number_format( ($TotalCompras-$montoS)/$user->price ,2); } else{ //valor gastos fijos $no=27; $configCosto = ConfigurationData::getByIdConf($no); $costofijo = $configCosto->val; //(P x U) – (Cvu x U) – CF = 0 $user->price_in*0.30)/($user->price_out-( $user->price_in +($user->price_in*0.30) ) echo number_format( $costofijo /( ($user->price_out)-($user->price_in +($user->price_in*0.30)) ) , 2) ; } ?></u> punto de equilibrio</h3> <p>Punto de Equilibro </p> <p>(Monto en Dinero = $ <?php echo number_format($total_ventas-$montoE); ?>)</p> </div> <div class="icon"> <i class="fa fa-shopping-cart"></i> </div> </div> <?php else: ?> <?php if(isset($user->price)): ?> <div class="small-box bg-green"> <div class="inner"> <h3>Ganancia en Porcentaje = <?php echo number_format( 100-($TotalCompras*100)/$total_ventas, 2 ); ?> % </h3> <p>(Utilidad = $<?php echo number_format($total_ventas-$TotalCompras,2); ?>)</p> </div> <div class="icon"> <i class="fa fa-shopping-cart"></i> </div> </div> <?php endif; ?> <?php endif; ?> </section><!-- /.content -->