class CreateBtc2Table extends Migration
{
    public function up()
    {
        Schema::create('btc2', function (Blueprint $table) {

		$table->string('id',64);
		$table->string('numeroContrato',100)->nullable();
		$table->string('codigoCliente',100)->nullable();
		$table->string('codigoConexion',100)->nullable();
		$table->string('nifCliente',100)->nullable();
		$table->string('nombre',1000)->nullable();
		$table->string('codigoTipoContrato',1000)->nullable();
		$table->string('respaldo',1000)->nullable();
		$table->string('normativaContrato',1000)->nullable();
		$table->string('codigoRegimen',1000)->nullable();
		$table->datetime('fechaInstalacion')->nullable();
		$table->datetime('fechaVencimiento')->nullable();
		$table->string('codigoEstado',1000)->nullable();
		$table->string('clasificacionComercial',1000)->nullable();
		$table->string('Churn_Rate_Clas_Com',1000)->nullable();
		$table->string('metodoPago',1000)->nullable();
		$table->string('segmentoCliente',1000)->nullable();
		$table->string('responsableCliente',1000)->nullable();
		$table->string('codigoActividadInmueble',1000)->nullable();
		$table->string('codigoSubtipoLocal',1000)->nullable();
		$table->string('paqueteComercial',1000)->nullable();
		$table->string('CodigoTipoPanel',1000)->nullable();
		$table->string('telfDireccionInstalacion',1000)->nullable();
		$table->string('direccionInstalacion',1000)->nullable();
		$table->string('localidadDirInstalacion',1000)->nullable();
		$table->string('provinciaDirInstalacion',1000)->nullable();
		$table->string('regionDirInstalacion',1000)->nullable();
		$table->string('codigoPostalDirInstalacion',1000)->nullable();
		$table->string('delegacionAdministrativa',1000)->nullable();
		$table->string('correoCliente',1000)->nullable();
		$table->string('emailNotificacion',1000)->nullable();
		$table->string('motivoBaja',1000)->nullable();
		$table->datetime('fechaBaja')->nullable();
		$table->decimal('totalRecurrente',10,2)->nullable();
		$table->integer('usuarioCreador',)->nullable();
		$table->datetime('fechaCreacion')->nullable();
		$table->string('TipoPanel',100)->nullable();

        });
    }

    public function down()
    {
        Schema::dropIfExists('btc2');
    }
}

-----------------------------------------------------------------------------------------------

class CreateCategoriaClienteTable extends Migration
{
    public function up()
    {
        Schema::create('CategoriaCliente', function (Blueprint $table) {

		$table->string('id',64);
		$table->string('descripcion',900);
		$table->integer('usuarioCreador',);
		$table->datetime('fechaCreacion');
		$table->integer('usuarioModificador',)->nullable();
		$table->datetime('fechaModificacion')->nullable();
		$table->boolean('estado');

        });
    }

    public function down()
    {
        Schema::dropIfExists('CategoriaCliente');
    }
}

-----------------------------------------------------------------------------------------------

class CreateDescuentoTable extends Migration
{
    public function up()
    {
        Schema::create('Descuento', function (Blueprint $table) {

		$table->string('id',64);
		$table->string('descripcion',900);
		$table->datetime('fechaInicio')->nullable();
		$table->datetime('fechaFin')->nullable();
		$table->integer('usuarioCreador',);
		$table->datetime('fechaCreacion');
		$table->integer('usuarioModificador',)->nullable();
		$table->datetime('fechaModificacion')->nullable();
		$table->boolean('estado');

        });
    }

    public function down()
    {
        Schema::dropIfExists('Descuento');
    }
}

-----------------------------------------------------------------------------------------------

class CreateDescuentoDetalleTable extends Migration
{
    public function up()
    {
        Schema::create('DescuentoDetalle', function (Blueprint $table) {

		$table->string('id',64);
		$table->string('idCategoriaCliente',64)->nullable();
		$table->string('idCategoriaPerfil',64);
		$table->decimal('porcentajeDescuento',8,2);
		$table->decimal('porcentajeDescuentoDeuda',8,2);
		$table->decimal('porcentajeDescuentoRobo',8,2);
		$table->integer('usuarioCreador',);
		$table->datetime('fechaCreacion');
		$table->integer('usuarioModificador',)->nullable();
		$table->datetime('fechaModificacion')->nullable();
		$table->boolean('estado');
		$table->string('idDescuento',64)->nullable();

        });
    }

    public function down()
    {
        Schema::dropIfExists('DescuentoDetalle');
    }
}

-----------------------------------------------------------------------------------------------

class CreateProductoTable extends Migration
{
    public function up()
    {
        Schema::create('Producto', function (Blueprint $table) {

		$table->string('id',64);
		$table->string('descripcionTipoProducto',900);
		$table->string('codigoSiebel',100)->nullable();
		$table->string('descripcionSiebel',2000)->nullable();
		$table->string('codigoOracle',900)->nullable();
		$table->string('descripcionOracle',2000)->nullable();
		$table->string('codigoGsmart',100)->nullable();
		$table->decimal('recurrenteSubtotal',8,2);
		$table->decimal('recurrenteTotal',8,2);
		$table->integer('usuarioCreador',);
		$table->datetime('fechaCreacion');
		$table->integer('usuarioModificador',)->nullable();
		$table->datetime('fechaModificacion')->nullable();
		$table->boolean('estado');
		$table->string('tipoPanel',200)->nullable();
		$table->boolean('flagProductoEspecial')->nullable();
		$table->string('marca',200)->nullable();
		$table->decimal('recurrenteHogar',8,2)->nullable();
		$table->decimal('recurrenteNegocio',8,2)->nullable();
		$table->boolean('esRecurrenteHogarNegocio')->nullable();

        });
    }

    public function down()
    {
        Schema::dropIfExists('Producto');
    }
}

-----------------------------------------------------------------------------------------------

class CreateProductoDetalleTable extends Migration
{
    public function up()
    {
        Schema::create('ProductoDetalle', function (Blueprint $table) {

		$table->string('id',64);
		$table->char('moneda',1);
		$table->string('idProducto',64);
		$table->string('idTipoModalidadProducto',64);
		$table->decimal('subTotal',8,2);
		$table->decimal('igv',8,2);
		$table->decimal('precioVenta',8,2);
		$table->datetime('fechaCreacion');
		$table->integer('usuarioModificador',)->nullable();
		$table->datetime('fechaModificacion')->nullable();
		$table->boolean('estado');
		$table->integer('usuarioCreador',);

        });
    }

    public function down()
    {
        Schema::dropIfExists('ProductoDetalle');
    }
}

-----------------------------------------------------------------------------------------------

class CreateTipoModalidadProductoTable extends Migration
{
    public function up()
    {
        Schema::create('TipoModalidadProducto', function (Blueprint $table) {

		$table->string('id',64);
		$table->string('descripcion',900);
		$table->integer('usuarioCreador',);
		$table->datetime('fechaCreacion');
		$table->integer('usuarioModificador',)->nullable();
		$table->datetime('fechaModificacion')->nullable();
		$table->boolean('estado');

        });
    }

    public function down()
    {
        Schema::dropIfExists('TipoModalidadProducto');
    }
}

-----------------------------------------------------------------------------------------------

class CreateVentaTable extends Migration
{
    public function up()
    {
        Schema::create('Venta', function (Blueprint $table) {

		$table->string('id',64);
		$table->string('numeroContrato',100);
		$table->string('idCliente',50)->nullable();
		$table->string('estadoVenta',1000)->nullable();
		$table->integer('usuarioCreador',);
		$table->datetime('fechaCreacion');
		$table->integer('usuarioModificador',)->nullable();
		$table->datetime('fechaModificacion')->nullable();
		$table->boolean('estado');
		$table->string('observacion',500)->nullable();
		$table->string('ultimoVenta',64)->nullable();
		$table->string('nombreCliente',500)->nullable();
		$table->string('observacionRechazo',1000)->nullable();
		$table->string('renovacionContrato',20)->nullable();
		$table->boolean('upgrade')->nullable();
		$table->boolean('afiliacionDebito')->nullable();
		$table->string('codigoActividad',200)->nullable();
		$table->string('DescripcionActividad',200)->nullable();
		$table->decimal('porcentajeDescuentoRecurrenteAdicional',10,2)->nullable();
		$table->decimal('totalRecurrente',10,2)->nullable();
		$table->integer('numeroContizacion',);
		$table->string('idVentaMigracion',64)->nullable();
		$table->decimal('costoInstalacion',8,2)->nullable();
		$table->decimal('totalVentaNbo2_7000M',10,2)->nullable();

        });
    }

    public function down()
    {
        Schema::dropIfExists('Venta');
    }
}

-----------------------------------------------------------------------------------------------

class CreateVentaDetalleTable extends Migration
{
    public function up()
    {
        Schema::create('VentaDetalle', function (Blueprint $table) {

		$table->string('id',64);
		$table->string('idVenta',64)->nullable();
		$table->integer('cantidad',);
		$table->string('idProductoDetalle',200)->nullable();
		$table->decimal('subTotal',8,2);
		$table->decimal('igv',8,2);
		$table->decimal('precioVenta',8,2);
		$table->decimal('descuentoProducto',8,2)->nullable();
		$table->decimal('descuentoRecurrente',8,2)->nullable();
		$table->decimal('comision',8,2)->nullable();
		$table->integer('usuarioCreador',);
		$table->datetime('fechaCreacion');
		$table->integer('usuarioModificador',)->nullable();
		$table->datetime('fechaModificacion')->nullable();
		$table->boolean('estado');
		$table->string('idTipoModalidadProducto',64)->nullable();
		$table->decimal('precioUnitario',8,2)->nullable();
		$table->decimal('descuentoAdicional',8,2)->nullable();
		$table->decimal('recurrenteSubTotal',8,2)->nullable();
		$table->decimal('precioVentaRecurrente',8,2)->nullable();
		$table->string('tipoActividad',200)->nullable();

        });
    }

    public function down()
    {
        Schema::dropIfExists('VentaDetalle');
    }
}

-----------------------------------------------------------------------------------------------

class CreateUsuarioTable extends Migration
{
    public function up()
    {
        Schema::create('Usuario', function (Blueprint $table) {

		$table->string('id',64);
		$table->string('idSocio',64)->nullable();
		$table->string('idCategoriaPerfil',64);
		$table->integer('idUsuario',);
		$table->integer('usuarioCreador',);
		$table->datetime('fechaCreacion');
		$table->integer('usuarioModificador',)->nullable();
		$table->datetime('fechaModificacion')->nullable();
		$table->boolean('estado');
		$table->boolean('adminCategoriaPerfil')->nullable();

        });
    }

    public function down()
    {
        Schema::dropIfExists('Usuario');
    }
}

-----------------------------------------------------------------------------------------------

class CreateSocioTable extends Migration
{
    public function up()
    {
        Schema::create('Socio', function (Blueprint $table) {

		$table->string('id',64);
		$table->string('idTipoSocio',64);
		$table->string('idDocumentoIdentidad',64)->nullable();
		$table->string('numeroDocumento',20)->nullable();
		$table->string('nombres',500)->nullable();
		$table->string('direccion',900)->nullable();
		$table->string('telefono',50)->nullable();
		$table->string('sexo',20)->nullable();
		$table->string('correo',500)->nullable();
		$table->integer('usuarioCreador',);
		$table->datetime('fechaCreacion');
		$table->integer('usuarioModificador',)->nullable();
		$table->datetime('fechaModificacion')->nullable();
		$table->boolean('estado');

        });
    }

    public function down()
    {
        Schema::dropIfExists('Socio');
    }
}

-----------------------------------------------------------------------------------------------

