Skip to content

Commit

Permalink
Edit sales - Pt1
Browse files Browse the repository at this point in the history
  • Loading branch information
Kev1nByte committed Jul 18, 2023
1 parent 86fd53d commit 08394c1
Show file tree
Hide file tree
Showing 7 changed files with 494 additions and 28 deletions.
4 changes: 2 additions & 2 deletions ajax/datatable-productos.ajax.php
Expand Up @@ -59,8 +59,8 @@ public function mostrarTablaProductos(){
"'.$productos[$i]["descripcion"].'",
"'.$categorias["categoria"].'",
"'.$stock.'",
"'.$productos[$i]["precio_compra"].'",
"'.$productos[$i]["precio_venta"].'",
"S/ '.$productos[$i]["precio_compra"].'",
"S/ '.$productos[$i]["precio_venta"].'",
"'.$productos[$i]["fecha"].'",
"'.$botones.'"
],';
Expand Down
10 changes: 10 additions & 0 deletions controllers/ventas.controlador.php
Expand Up @@ -59,6 +59,16 @@ static public function ctrCrearVenta(){

$comprasCliente = ModeloClientes::mdlActualizarCliente($tablaClientes, $item1a, $valor1a, $valor);

$item1b = "ultima_compra";

date_default_timezone_set('America/Lima');

$fecha = date('Y-m-d');
$hora = date('H:i:s');
$valor1b = $fecha.' '.$hora;

$fechaCliente = ModeloClientes::mdlActualizarCliente($tablaClientes, $item1b, $valor1b, $valor);

// GUARDAR LA COMPRA

$tabla = "ventas";
Expand Down
4 changes: 2 additions & 2 deletions models/ventas.modelos.php
Expand Up @@ -10,7 +10,7 @@ static public function mdlMostrarVentas($tabla, $item, $valor){

if($item != null){

$stmt = Conexion::conectar()->prepare("SELECT * FROM $tabla WHERE $item = :$item ORDER BY fecha DESC");
$stmt = Conexion::conectar()->prepare("SELECT * FROM $tabla WHERE $item = :$item ORDER BY id ASC");

$stmt -> bindParam(":".$item, $valor, PDO::PARAM_STR);

Expand All @@ -20,7 +20,7 @@ static public function mdlMostrarVentas($tabla, $item, $valor){

}else{

$stmt = Conexion::conectar()->prepare("SELECT * FROM $tabla ORDER BY fecha DESC");
$stmt = Conexion::conectar()->prepare("SELECT * FROM $tabla ORDER BY id ASC");

$stmt -> execute();

Expand Down
2 changes: 1 addition & 1 deletion views/modulos/clientes.php
Expand Up @@ -80,7 +80,7 @@
<td>'.$value["compras"].'</td>
<td>0000-00-00 00:00:00</td>
<td>'.$value["ultima_compra"].'</td>
<td>'.$value["fecha"].'</td>
Expand Down

0 comments on commit 08394c1

Please sign in to comment.