/** * Make changes to the database. * * @return void */ public function up() { //ESTATUS: A=ACTIVO I=INACTIVO Laravel\Database\Schema::create('categoriamaterial', function ($table) { $table->increments('id'); $table->string('nombre', 30); $table->string('estatus', 1)->default('A'); $table->timestamps(); }); Laravel\Database\Schema::create('unidadmaterial', function ($table) { $table->increments('id'); $table->string('nombre', 30); $table->string('estatus', 1)->default('A'); $table->timestamps(); }); Laravel\Database\Schema::create('materiales', function ($table) { $table->increments('id'); $table->integer('cat_mat_id'); $table->integer('uni_mat_id'); $table->string('clave', 10); $table->unique('clave'); //Creamos un indice unico para este campo $table->string('nombre', 30); $table->float('stock_min'); $table->text('observaciones'); $table->string('estatus', 1)->default('A'); //Timestamps: created_at, updated_at $table->timestamps(); //Foreign Keys: $table->foreign('cat_mat_id')->references('id')->on('categoriamaterial'); $table->foreign('uni_mat_id')->references('id')->on('unidadmaterial'); }); }
/** * Make changes to the database. * * @return void */ public function up() { //ESTATUS: A=ACTIVO I=INACTIVO Laravel\Database\Schema::create('proveedores', function ($table) { $table->increments('id'); $table->string('clave', 12)->unique(); //Indice unico a este campo $table->string('nombre', 100); $table->string('direccion', 100); $table->string('colonia', 40); $table->string('ciudad', 30); $table->string('estado', 30); $table->string('pais', 30); $table->string('cp', 10); $table->string('rfc', 20); $table->string('tel1', 20); $table->string('tel2', 20); $table->string('fax', 20); $table->string('idRadio', 12); $table->string('contacto', 80); $table->string('email', 50); $table->string('tipo_proveedor', 10); //Proveedor u Acreedor $table->string('estatus', 12)->default('A'); $table->string('plazo', 12)->default(30); //Plazo que tiene para pagar $table->timestamps(); }); }
/** * Make changes to the database. * * @return void */ public function up() { // Laravel\Database\Schema::create('facturasxpagar', function ($table) { $table->increments('id'); //PK de la tabla. $table->string('folio_fxp', 20); $table->integer('proveedor_id'); // El proveedor de la factura $table->unique(array('folio_fxp', 'proveedor_id')); //Creamos un UNIQUE INDEX Compuesto $table->integer('plazo')->default(30); //Plazo que se tiene para pagar la factura $table->date('fecha_expedicion'); $table->date('fecha_vencimiento'); $table->decimal('subtotal', 19, 4); $table->float('piva'); //Porcentaje IVA $table->decimal('iva', 19, 4); $table->float('pdesc'); //Porcentaje Descuento $table->decimal('descuento', 19, 4); $table->decimal('total', 19, 4); $table->string('estatus', 1)->default('N'); //P = PAGADA, C = CANCELADA, I = INACTIVA, A=ATRASADAS, N=PENDIENTES //Timestamps: $table->timestamps(); //Foreign Keys $table->foreign('proveedor_id')->references('id')->on('proveedores'); }); Laravel\Database\Schema::create('detalle_fxp', function ($table) { $table->increments('id'); $table->integer('fxp_id'); // La fxp con la que se relacionara $table->string('concepto'); $table->float('cantidad'); $table->decimal('precio_unitario', 19, 4); $table->decimal('importe', 19, 4); $table->integer('material_id')->nullable(); //El material ID con que se relaciona si existe. //Timestamps: $table->timestamps(); //Foreign Keys $table->foreign('fxp_id')->references('id')->on('facturasxpagar'); }); }