















Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!
















Crear las siguientes tablas: Tabla : Clientes Tabla: Tipo Llenar los siguientes registros en la tabla tipo: Tabla: Parametros Llenar los siguientes registros en la tabla parámetros:
Tabla: cabeceraventas Tabla: detalleventas MODELOS Modelo Tipo hasMany('App\CabeceraVenta','tipo_id','tipo_id'); } }
protected $table = 'detalleventas'; public $timestamps = false; protected $fillable = [ 'precio', 'cantidad', ]; public function ventas() { return $this->hasOne(CabeceraVenta::class,'venta_id','venta_id'); } public function productos() { return $this- >hasMany('App\Producto','producto_id','producto_id'); } } Modelo Parametro where('tipo_id', '=', $tipo_id)
Cliente hasMany('App\CabeceraVenta','cliente_id','cliente_id'); } } Producto php namespace App; use Illuminate\Database\Eloquent\Model; use DB; class Producto extends Model { protected $table = 'productos'; protected $primaryKey = 'producto_id'; public $timestamps = false;
@section('estilos')
@section('script')
@section('estilos')
@section('script')
Route::resource('venta', 'VentaController'); Route::get('EncontrarProducto/{producto_id}', 'VentaController@ProductoCodigo'); /* datos productos / Route::get('EncontrarProducto/{producto_id}', 'VentaController@ProductoCodig o'); / datos tipos */ Route::get('EncontrarTipo/{descripcion}', 'VentaController@PorTipo');
@extends('layouts.plantilla') @section('contenido')
LISTADO DE VENTAS Nuevo Registro
Buscar
@extends('layouts.plantilla') @section('estilos')
@endsection @section('contenido')
Registrar Venta
@csrf
Fecha
Tipo
@foreach($tipo as $itemtipo)
@endforeach
No Doc. :
Cliente
@foreach($cliente as $itemcliente)
@endforeach
Precio
Cantidad
Agregar al carrito
OPCIONES CODIGO DESCRIPCIÓN UNIDAD CANTIDAD P.VENTA IMPORTE
Total :
Registrar Cancelar
@endsection @section('script')
@endsection
var cont= 0 ; var total= 0 ;
$(".alert").removeClass("hidden"); $(".alert").addClass("alert-danger"); $(".alert").html("×"+ "Error! " + mensaje + "."); $('.alert').delay( 5000 ).hide( 400 ); } function agregarDetalle() { ruc=$("#ruc").val(); if (ruc=='') { mostrarMensajeError("Por favor seleccione el Cliente"); return false; } descripcion = $('#producto_id option:selected').text(); if (descripcion=='Seleccione Producto') { mostrarMensajeError("Por favor seleccione el Producto"); return false; } let cantidad=$("#cantidad").val(); let stock= $("#stock").val(); if (cantidad=='' || Number(cantidad)== 0 || cantidad==null) { mostrarMensajeError("Por favor ingrese cantidad del producto"); return false; } if (cantidad<= 0 ) { mostrarMensajeError("Por favor debe escribir cantidad del producto m ayor a 0"); return false; } if (Number(cantidad)>Number(stock)) { mostrarMensajeError("No se tiene tal cantidad de producto solo hay "
mostrarMensajeError("Por favor ingrese precio de venta del producto" ); return false; } cod_producto=$("#producto_id").val(); /* Buscar que codigo de producto no se repita */ var i= 0 ; var band=false; while (i'+ descripcion +''+number_format(subtotal[cont], 2 )+''; $('#detalles').append(fila);
return parseFloat( 0 ).toFixed(decimals); // si es mayor o menor que cero retorno el valor formateado como numero amount = '' + amount.toFixed(decimals); var amount_parts = amount.split('.'), regexp = /(\d+)(\d{3})/; while (regexp.test(amount_parts[ 0 ])) amount_parts[ 0 ] = amount_parts[ 0 ].replace(regexp, '$1' + ',' + '$2') ; return amount_parts.join('.'); }
paginate($this::PAGINATION); return view('movimiento.registro ventas.index',compact('venta')); } /**