diff --git a/app/resources/database/migrations/20241113005029_incoviba_2287310996733f_7d_5ac_59c.php b/app/resources/database/migrations/20241113010315_incoviba_17303572256733fad_3df_01b.php similarity index 91% rename from app/resources/database/migrations/20241113005029_incoviba_2287310996733f_7d_5ac_59c.php rename to app/resources/database/migrations/20241113010315_incoviba_17303572256733fad_3df_01b.php index 1900f53..24585df 100644 --- a/app/resources/database/migrations/20241113005029_incoviba_2287310996733f_7d_5ac_59c.php +++ b/app/resources/database/migrations/20241113010315_incoviba_17303572256733fad_3df_01b.php @@ -2,454 +2,13 @@ use Phinx\Db\Adapter\MysqlAdapter; -class Incoviba2287310996733f7d5ac59c extends Phinx\Migration\AbstractMigration +class Incoviba17303572256733fad3df01b extends Phinx\Migration\AbstractMigration { public function change() { $this->execute('SET unique_checks=0; SET foreign_key_checks=0;'); $this->execute("ALTER DATABASE CHARACTER SET 'utf8mb3';"); $this->execute("ALTER DATABASE COLLATE='utf8mb3_general_ci';"); - $this->table('movimientos_auxiliares', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb3', - 'collation' => 'utf8mb3_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('id', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - 'identity' => true, - ]) - ->addColumn('movimiento_id', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - 'after' => 'id', - ]) - ->addColumn('cargo', 'integer', [ - 'null' => true, - 'default' => null, - 'limit' => 10, - 'signed' => false, - 'after' => 'movimiento_id', - ]) - ->addColumn('abono', 'integer', [ - 'null' => true, - 'default' => null, - 'limit' => 10, - 'signed' => false, - 'after' => 'cargo', - ]) - ->addIndex(['movimiento_id'], [ - 'name' => 'movimiento_id', - 'unique' => false, - ]) - ->addForeignKey('movimiento_id', 'movimientos', 'id', [ - 'constraint' => 'movimientos_auxiliares_ibfk_2', - 'update' => 'CASCADE', - 'delete' => 'CASCADE', - ]) - ->create(); - $this->table('datos_personas', [ - 'id' => false, - 'primary_key' => ['persona_rut'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb3', - 'collation' => 'utf8mb3_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('persona_rut', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - ]) - ->addColumn('direccion_id', 'integer', [ - 'null' => true, - 'default' => null, - 'limit' => 10, - 'signed' => false, - 'after' => 'persona_rut', - ]) - ->addColumn('telefono', 'integer', [ - 'null' => true, - 'default' => null, - 'limit' => 10, - 'signed' => false, - 'after' => 'direccion_id', - ]) - ->addColumn('email', 'string', [ - 'null' => true, - 'default' => null, - 'limit' => 100, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'telefono', - ]) - ->addColumn('sexo', 'enum', [ - 'null' => true, - 'default' => null, - 'limit' => 2, - 'values' => ['M', 'F', 'NA'], - 'after' => 'email', - ]) - ->addColumn('fecha_nacimiento', 'date', [ - 'null' => true, - 'default' => null, - 'after' => 'sexo', - ]) - ->addColumn('estado_civil', 'enum', [ - 'null' => true, - 'default' => null, - 'limit' => 10, - 'values' => ['casado', 'soltero', 'divorciado'], - 'after' => 'fecha_nacimiento', - ]) - ->addColumn('nacionalidad', 'string', [ - 'null' => true, - 'default' => null, - 'limit' => 100, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'estado_civil', - ]) - ->addColumn('profesion', 'string', [ - 'null' => true, - 'default' => null, - 'limit' => 100, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'nacionalidad', - ]) - ->addIndex(['direccion_id'], [ - 'name' => 'direccion_id', - 'unique' => false, - ]) - ->addIndex(['telefono'], [ - 'name' => 'telefono', - 'unique' => false, - ]) - ->addForeignKey('direccion_id', 'direccion', 'id', [ - 'constraint' => 'datos_personas_ibfk_4', - 'update' => 'SET_NULL', - 'delete' => 'SET_NULL', - ]) - ->addForeignKey('persona_rut', 'personas', 'rut', [ - 'constraint' => 'datos_personas_ibfk_7', - 'update' => 'CASCADE', - 'delete' => 'CASCADE', - ]) - ->create(); - $this->table('personas', [ - 'id' => false, - 'primary_key' => ['rut'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb3', - 'collation' => 'utf8mb3_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('rut', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - ]) - ->addColumn('digito', 'char', [ - 'null' => false, - 'limit' => 1, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'rut', - ]) - ->addColumn('nombres', 'string', [ - 'null' => false, - 'limit' => 100, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'digito', - ]) - ->addColumn('apellido_paterno', 'string', [ - 'null' => false, - 'limit' => 100, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'nombres', - ]) - ->addColumn('apellido_materno', 'string', [ - 'null' => false, - 'limit' => 100, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'apellido_paterno', - ]) - ->create(); - $this->table('tipos_estados_facturas', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb3', - 'collation' => 'utf8mb3_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('id', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - 'identity' => true, - ]) - ->addColumn('descripcion', 'string', [ - 'null' => false, - 'limit' => 100, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'id', - ]) - ->create(); - $this->table('estados_facturas', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb3', - 'collation' => 'utf8mb3_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('id', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - 'identity' => true, - ]) - ->addColumn('factura_id', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - 'after' => 'id', - ]) - ->addColumn('fecha', 'date', [ - 'null' => false, - 'after' => 'factura_id', - ]) - ->addColumn('tipo_id', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - 'after' => 'fecha', - ]) - ->addIndex(['factura_id'], [ - 'name' => 'factura_id', - 'unique' => false, - ]) - ->addIndex(['tipo_id'], [ - 'name' => 'tipo_id', - 'unique' => false, - ]) - ->addForeignKey('factura_id', 'facturas', 'id', [ - 'constraint' => 'estados_facturas_ibfk_3', - 'update' => 'CASCADE', - 'delete' => 'CASCADE', - ]) - ->addForeignKey('tipo_id', 'tipos_estados_facturas', 'id', [ - 'constraint' => 'estados_facturas_ibfk_4', - 'update' => 'CASCADE', - 'delete' => 'CASCADE', - ]) - ->create(); - $this->table('sociedades', [ - 'id' => false, - 'primary_key' => ['rut'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb3', - 'collation' => 'utf8mb3_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('rut', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - ]) - ->addColumn('digito', 'char', [ - 'null' => false, - 'limit' => 1, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'rut', - ]) - ->addColumn('nombre', 'string', [ - 'null' => false, - 'limit' => 100, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'digito', - ]) - ->addColumn('razon', 'text', [ - 'null' => false, - 'limit' => 65535, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'nombre', - ]) - ->addColumn('tipo_sociedad_id', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - 'after' => 'razon', - ]) - ->addColumn('contacto_rut', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - 'after' => 'tipo_sociedad_id', - ]) - ->addIndex(['tipo_sociedad_id'], [ - 'name' => 'tipo_sociedad_id', - 'unique' => false, - ]) - ->addIndex(['contacto_rut'], [ - 'name' => 'representante_rut', - 'unique' => false, - ]) - ->addForeignKey('tipo_sociedad_id', 'tipo_sociedad', 'id', [ - 'constraint' => 'sociedades_ibfk_1', - 'update' => 'RESTRICT', - 'delete' => 'CASCADE', - ]) - ->addForeignKey('contacto_rut', 'personas', 'rut', [ - 'constraint' => 'sociedades_ibfk_2', - 'update' => 'RESTRICT', - 'delete' => 'CASCADE', - ]) - ->create(); - $this->table('proveedores', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb3', - 'collation' => 'utf8mb3_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('id', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - 'identity' => true, - ]) - ->addColumn('inmobiliaria_rut', 'integer', [ - 'null' => false, - 'limit' => 8, - 'signed' => false, - 'after' => 'id', - ]) - ->addColumn('sociedad_rut', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - 'after' => 'inmobiliaria_rut', - ]) - ->addIndex(['inmobiliaria_rut'], [ - 'name' => 'inmobiliaria_rut', - 'unique' => false, - ]) - ->addIndex(['sociedad_rut'], [ - 'name' => 'sociedad_rut', - 'unique' => false, - ]) - ->addForeignKey('inmobiliaria_rut', 'inmobiliaria', 'rut', [ - 'constraint' => 'proveedores_ibfk_1', - 'update' => 'RESTRICT', - 'delete' => 'CASCADE', - ]) - ->addForeignKey('sociedad_rut', 'sociedades', 'rut', [ - 'constraint' => 'proveedores_ibfk_2', - 'update' => 'RESTRICT', - 'delete' => 'CASCADE', - ]) - ->create(); - $this->table('auxiliar_detalles', [ - 'id' => false, - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb3', - 'collation' => 'utf8mb3_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) - ->addColumn('auxiliar_id', 'integer', [ - 'null' => false, - 'limit' => 10, - 'signed' => false, - ]) - ->addColumn('centro_costo_id', 'integer', [ - 'null' => true, - 'default' => null, - 'limit' => 10, - 'signed' => false, - 'after' => 'auxiliar_id', - ]) - ->addColumn('rut', 'integer', [ - 'null' => true, - 'default' => null, - 'limit' => 8, - 'signed' => false, - 'after' => 'centro_costo_id', - ]) - ->addColumn('digito', 'char', [ - 'null' => true, - 'default' => null, - 'limit' => 1, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'rut', - ]) - ->addColumn('nombre', 'string', [ - 'null' => true, - 'default' => null, - 'limit' => 255, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'digito', - ]) - ->addColumn('categoria', 'string', [ - 'null' => true, - 'default' => null, - 'limit' => 100, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'nombre', - ]) - ->addColumn('detalle', 'text', [ - 'null' => true, - 'default' => null, - 'limit' => 65535, - 'collation' => 'utf8mb3_general_ci', - 'encoding' => 'utf8mb3', - 'after' => 'categoria', - ]) - ->addIndex(['auxiliar_id'], [ - 'name' => 'auxiliar_id', - 'unique' => false, - ]) - ->addIndex(['centro_costo_id'], [ - 'name' => 'centro_costo_id', - 'unique' => false, - ]) - ->addForeignKey('auxiliar_id', 'movimientos_auxiliares', 'id', [ - 'constraint' => 'auxiliar_detalles_ibfk_3', - 'update' => 'CASCADE', - 'delete' => 'CASCADE', - ]) - ->addForeignKey('centro_costo_id', 'centros_costos', 'id', [ - 'constraint' => 'auxiliar_detalles_ibfk_5', - 'update' => 'CASCADE', - 'delete' => 'SET_NULL', - ]) - ->create(); $this->table('tipo_estado_cierre', [ 'id' => false, 'primary_key' => ['id'], diff --git a/app/resources/database/migrations/20241113010320_create_personas.php b/app/resources/database/migrations/20241113010320_create_personas.php new file mode 100644 index 0000000..0e1a6ff --- /dev/null +++ b/app/resources/database/migrations/20241113010320_create_personas.php @@ -0,0 +1,30 @@ +table('personas', ['id' => false, 'primary_key' => ['rut', 'digito']]) + ->addColumn('rut', 'integer', ['identity' => true, 'signed' => false, 'null' => false]) + ->addColumn('digito', 'string', ['limit' => 1, 'null' => false]) + ->addColumn('nombres', 'string', ['limit' => 255, 'null' => false]) + ->addColumn('apellido_paterno', 'string', ['limit' => 255, 'null' => false]) + ->addColumn('apellido_materno', 'string', ['limit' => 255, 'null' => false]) + ->create(); + } +} diff --git a/app/resources/database/migrations/20241113010328_create_proveedores.php b/app/resources/database/migrations/20241113010328_create_proveedores.php new file mode 100644 index 0000000..3ad64f5 --- /dev/null +++ b/app/resources/database/migrations/20241113010328_create_proveedores.php @@ -0,0 +1,31 @@ +table('proveedores', ['id' => false, 'primary_key' => ['rut', 'digito']]) + ->addColumn('rut', 'integer', ['identity' => true, 'signed' => false, 'null' => false]) + ->addColumn('digito', 'string', ['limit' => 1, 'null' => false]) + ->addColumn('nombre', 'string', ['limit' => 255, 'null' => false]) + ->addColumn('razon', 'string', ['limit' => 255, 'null' => true]) + ->addColumn('contacto_rut', 'integer', ['signed' => false, 'null' => true]) + ->addForeignKey('contacto_rut', 'personas', ['rut'], ['delete' => 'CASCADE', 'update' => 'CASCADE']) + ->create(); + } +} diff --git a/app/resources/database/migrations/20241113010900_create_datos_proveedores.php b/app/resources/database/migrations/20241113010900_create_datos_proveedores.php new file mode 100644 index 0000000..63a392d --- /dev/null +++ b/app/resources/database/migrations/20241113010900_create_datos_proveedores.php @@ -0,0 +1,31 @@ +table('datos_proveedores') + ->addColumn('proveedor_rut', 'integer', ['signed' => false, 'null' => false]) + ->addForeignKey('proveedor_rut', 'proveedores', ['rut'], ['delete' => 'CASCADE', 'update' => 'CASCADE']) + ->addColumn('direccion_id', 'integer', ['signed' => false, 'null' => true]) + ->addForeignKey('direccion_id', 'direccion', ['id'], ['delete' => 'CASCADE', 'update' => 'CASCADE']) + ->addColumn('telefono', 'string', ['limit' => 255, 'null' => true]) + ->addColumn('giro', 'string', ['limit' => 255, 'null' => true]) + ->create(); + } +} diff --git a/app/resources/database/migrations/20241113011622_create_datos_personas.php b/app/resources/database/migrations/20241113011622_create_datos_personas.php new file mode 100644 index 0000000..5dd680c --- /dev/null +++ b/app/resources/database/migrations/20241113011622_create_datos_personas.php @@ -0,0 +1,36 @@ +table('datos_personas') + ->addColumn('persona_rut', 'integer', ['signed' => false, 'null' => false]) + ->addForeignKey('persona_rut', 'personas', ['rut'], ['delete' => 'CASCADE', 'update' => 'CASCADE']) + ->addColumn('direccion_id', 'integer', ['signed' => false, 'null' => true]) + ->addForeignKey('direccion_id', 'direccion', ['id'], ['delete' => 'CASCADE', 'update' => 'CASCADE']) + ->addColumn('telefono', 'string', ['limit' => 255, 'null' => true]) + ->addColumn('email', 'string', ['limit' => 255, 'null' => true]) + ->addColumn('fecha_nacimiento', 'datetime', ['null' => true]) + ->addColumn('sexo', 'string', ['limit' => 255, 'null' => true]) + ->addColumn('estado_civil', 'string', ['limit' => 255, 'null' => true]) + ->addColumn('nacionalidad', 'string', ['limit' => 255, 'null' => true]) + ->addColumn('ocupacion', 'string', ['limit' => 255, 'null' => true]) + ->create(); + } +} diff --git a/app/resources/database/migrations/20241128151402_create_venta_abono_cuota.php b/app/resources/database/migrations/20241128151402_create_venta_abono_cuota.php new file mode 100644 index 0000000..7be5db8 --- /dev/null +++ b/app/resources/database/migrations/20241128151402_create_venta_abono_cuota.php @@ -0,0 +1,30 @@ +table('venta_abono_cuotas') + ->addColumn('venta_id', 'integer', ['signed' => false, 'null' => false]) + ->addForeignKey('venta_id', 'venta', ['id'], ['delete' => 'CASCADE', 'update' => 'CASCADE']) + ->addColumn('pago_id', 'integer', ['signed' => false, 'null' => false]) + ->addForeignKey('pago_id', 'pago', ['id'], ['delete' => 'CASCADE', 'update' => 'CASCADE']) + ->addColumn('numero', 'integer', ['signed' => false, 'null' => false, 'default' => 1]) + ->create(); + } +} diff --git a/app/resources/database/schema.php b/app/resources/database/schema.php index 41a8b15..2327372 100644 --- a/app/resources/database/schema.php +++ b/app/resources/database/schema.php @@ -8,1564 +8,6 @@ return array ( ), 'tables' => array ( - 'movimientos_auxiliares' => - array ( - 'table' => - array ( - 'table_name' => 'movimientos_auxiliares', - 'engine' => 'InnoDB', - 'table_comment' => '', - 'table_collation' => 'utf8mb3_general_ci', - 'character_set_name' => 'utf8mb3', - 'row_format' => 'Dynamic', - ), - 'columns' => - array ( - 'id' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'movimientos_auxiliares', - 'COLUMN_NAME' => 'id', - 'ORDINAL_POSITION' => 1, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'PRI', - 'EXTRA' => 'auto_increment', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'movimiento_id' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'movimientos_auxiliares', - 'COLUMN_NAME' => 'movimiento_id', - 'ORDINAL_POSITION' => 2, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'MUL', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'cargo' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'movimientos_auxiliares', - 'COLUMN_NAME' => 'cargo', - 'ORDINAL_POSITION' => 3, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'abono' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'movimientos_auxiliares', - 'COLUMN_NAME' => 'abono', - 'ORDINAL_POSITION' => 4, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - ), - 'indexes' => - array ( - 'PRIMARY' => - array ( - 1 => - array ( - 'Table' => 'movimientos_auxiliares', - 'Non_unique' => 0, - 'Key_name' => 'PRIMARY', - 'Seq_in_index' => 1, - 'Column_name' => 'id', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - 'movimiento_id' => - array ( - 1 => - array ( - 'Table' => 'movimientos_auxiliares', - 'Non_unique' => 1, - 'Key_name' => 'movimiento_id', - 'Seq_in_index' => 1, - 'Column_name' => 'movimiento_id', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - ), - 'foreign_keys' => - array ( - 'movimientos_auxiliares_ibfk_2' => - array ( - 'TABLE_NAME' => 'movimientos_auxiliares', - 'COLUMN_NAME' => 'movimiento_id', - 'CONSTRAINT_NAME' => 'movimientos_auxiliares_ibfk_2', - 'REFERENCED_TABLE_NAME' => 'movimientos', - 'REFERENCED_COLUMN_NAME' => 'id', - 'UPDATE_RULE' => 'CASCADE', - 'DELETE_RULE' => 'CASCADE', - ), - ), - ), - 'datos_personas' => - array ( - 'table' => - array ( - 'table_name' => 'datos_personas', - 'engine' => 'InnoDB', - 'table_comment' => '', - 'table_collation' => 'utf8mb3_general_ci', - 'character_set_name' => 'utf8mb3', - 'row_format' => 'Dynamic', - ), - 'columns' => - array ( - 'persona_rut' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'datos_personas', - 'COLUMN_NAME' => 'persona_rut', - 'ORDINAL_POSITION' => 1, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'PRI', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'direccion_id' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'datos_personas', - 'COLUMN_NAME' => 'direccion_id', - 'ORDINAL_POSITION' => 2, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'MUL', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'telefono' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'datos_personas', - 'COLUMN_NAME' => 'telefono', - 'ORDINAL_POSITION' => 3, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'MUL', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'email' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'datos_personas', - 'COLUMN_NAME' => 'email', - 'ORDINAL_POSITION' => 4, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'varchar', - 'CHARACTER_MAXIMUM_LENGTH' => 100, - 'CHARACTER_OCTET_LENGTH' => 300, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'varchar(100)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'sexo' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'datos_personas', - 'COLUMN_NAME' => 'sexo', - 'ORDINAL_POSITION' => 5, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'enum', - 'CHARACTER_MAXIMUM_LENGTH' => 2, - 'CHARACTER_OCTET_LENGTH' => 6, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'enum(\'M\',\'F\',\'NA\')', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'fecha_nacimiento' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'datos_personas', - 'COLUMN_NAME' => 'fecha_nacimiento', - 'ORDINAL_POSITION' => 6, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'date', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'date', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'estado_civil' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'datos_personas', - 'COLUMN_NAME' => 'estado_civil', - 'ORDINAL_POSITION' => 7, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'enum', - 'CHARACTER_MAXIMUM_LENGTH' => 10, - 'CHARACTER_OCTET_LENGTH' => 30, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'enum(\'casado\',\'soltero\',\'divorciado\')', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'nacionalidad' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'datos_personas', - 'COLUMN_NAME' => 'nacionalidad', - 'ORDINAL_POSITION' => 8, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'varchar', - 'CHARACTER_MAXIMUM_LENGTH' => 100, - 'CHARACTER_OCTET_LENGTH' => 300, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'varchar(100)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'profesion' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'datos_personas', - 'COLUMN_NAME' => 'profesion', - 'ORDINAL_POSITION' => 9, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'varchar', - 'CHARACTER_MAXIMUM_LENGTH' => 100, - 'CHARACTER_OCTET_LENGTH' => 300, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'varchar(100)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - ), - 'indexes' => - array ( - 'PRIMARY' => - array ( - 1 => - array ( - 'Table' => 'datos_personas', - 'Non_unique' => 0, - 'Key_name' => 'PRIMARY', - 'Seq_in_index' => 1, - 'Column_name' => 'persona_rut', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - 'direccion_id' => - array ( - 1 => - array ( - 'Table' => 'datos_personas', - 'Non_unique' => 1, - 'Key_name' => 'direccion_id', - 'Seq_in_index' => 1, - 'Column_name' => 'direccion_id', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => 'YES', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - 'telefono' => - array ( - 1 => - array ( - 'Table' => 'datos_personas', - 'Non_unique' => 1, - 'Key_name' => 'telefono', - 'Seq_in_index' => 1, - 'Column_name' => 'telefono', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => 'YES', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - ), - 'foreign_keys' => - array ( - 'datos_personas_ibfk_4' => - array ( - 'TABLE_NAME' => 'datos_personas', - 'COLUMN_NAME' => 'direccion_id', - 'CONSTRAINT_NAME' => 'datos_personas_ibfk_4', - 'REFERENCED_TABLE_NAME' => 'direccion', - 'REFERENCED_COLUMN_NAME' => 'id', - 'UPDATE_RULE' => 'SET NULL', - 'DELETE_RULE' => 'SET NULL', - ), - 'datos_personas_ibfk_7' => - array ( - 'TABLE_NAME' => 'datos_personas', - 'COLUMN_NAME' => 'persona_rut', - 'CONSTRAINT_NAME' => 'datos_personas_ibfk_7', - 'REFERENCED_TABLE_NAME' => 'personas', - 'REFERENCED_COLUMN_NAME' => 'rut', - 'UPDATE_RULE' => 'CASCADE', - 'DELETE_RULE' => 'CASCADE', - ), - ), - ), - 'personas' => - array ( - 'table' => - array ( - 'table_name' => 'personas', - 'engine' => 'InnoDB', - 'table_comment' => '', - 'table_collation' => 'utf8mb3_general_ci', - 'character_set_name' => 'utf8mb3', - 'row_format' => 'Dynamic', - ), - 'columns' => - array ( - 'rut' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'personas', - 'COLUMN_NAME' => 'rut', - 'ORDINAL_POSITION' => 1, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'PRI', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'digito' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'personas', - 'COLUMN_NAME' => 'digito', - 'ORDINAL_POSITION' => 2, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'char', - 'CHARACTER_MAXIMUM_LENGTH' => 1, - 'CHARACTER_OCTET_LENGTH' => 3, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'char(1)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'nombres' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'personas', - 'COLUMN_NAME' => 'nombres', - 'ORDINAL_POSITION' => 3, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'varchar', - 'CHARACTER_MAXIMUM_LENGTH' => 100, - 'CHARACTER_OCTET_LENGTH' => 300, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'varchar(100)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'apellido_paterno' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'personas', - 'COLUMN_NAME' => 'apellido_paterno', - 'ORDINAL_POSITION' => 4, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'varchar', - 'CHARACTER_MAXIMUM_LENGTH' => 100, - 'CHARACTER_OCTET_LENGTH' => 300, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'varchar(100)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'apellido_materno' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'personas', - 'COLUMN_NAME' => 'apellido_materno', - 'ORDINAL_POSITION' => 5, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'varchar', - 'CHARACTER_MAXIMUM_LENGTH' => 100, - 'CHARACTER_OCTET_LENGTH' => 300, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'varchar(100)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - ), - 'indexes' => - array ( - 'PRIMARY' => - array ( - 1 => - array ( - 'Table' => 'personas', - 'Non_unique' => 0, - 'Key_name' => 'PRIMARY', - 'Seq_in_index' => 1, - 'Column_name' => 'rut', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - ), - 'foreign_keys' => NULL, - ), - 'tipos_estados_facturas' => - array ( - 'table' => - array ( - 'table_name' => 'tipos_estados_facturas', - 'engine' => 'InnoDB', - 'table_comment' => '', - 'table_collation' => 'utf8mb3_general_ci', - 'character_set_name' => 'utf8mb3', - 'row_format' => 'Dynamic', - ), - 'columns' => - array ( - 'id' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'tipos_estados_facturas', - 'COLUMN_NAME' => 'id', - 'ORDINAL_POSITION' => 1, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'PRI', - 'EXTRA' => 'auto_increment', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'descripcion' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'tipos_estados_facturas', - 'COLUMN_NAME' => 'descripcion', - 'ORDINAL_POSITION' => 2, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'varchar', - 'CHARACTER_MAXIMUM_LENGTH' => 100, - 'CHARACTER_OCTET_LENGTH' => 300, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'varchar(100)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - ), - 'indexes' => - array ( - 'PRIMARY' => - array ( - 1 => - array ( - 'Table' => 'tipos_estados_facturas', - 'Non_unique' => 0, - 'Key_name' => 'PRIMARY', - 'Seq_in_index' => 1, - 'Column_name' => 'id', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - ), - 'foreign_keys' => NULL, - ), - 'estados_facturas' => - array ( - 'table' => - array ( - 'table_name' => 'estados_facturas', - 'engine' => 'InnoDB', - 'table_comment' => '', - 'table_collation' => 'utf8mb3_general_ci', - 'character_set_name' => 'utf8mb3', - 'row_format' => 'Dynamic', - ), - 'columns' => - array ( - 'id' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'estados_facturas', - 'COLUMN_NAME' => 'id', - 'ORDINAL_POSITION' => 1, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'PRI', - 'EXTRA' => 'auto_increment', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'factura_id' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'estados_facturas', - 'COLUMN_NAME' => 'factura_id', - 'ORDINAL_POSITION' => 2, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'MUL', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'fecha' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'estados_facturas', - 'COLUMN_NAME' => 'fecha', - 'ORDINAL_POSITION' => 3, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'date', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'date', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'tipo_id' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'estados_facturas', - 'COLUMN_NAME' => 'tipo_id', - 'ORDINAL_POSITION' => 4, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'MUL', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - ), - 'indexes' => - array ( - 'PRIMARY' => - array ( - 1 => - array ( - 'Table' => 'estados_facturas', - 'Non_unique' => 0, - 'Key_name' => 'PRIMARY', - 'Seq_in_index' => 1, - 'Column_name' => 'id', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - 'factura_id' => - array ( - 1 => - array ( - 'Table' => 'estados_facturas', - 'Non_unique' => 1, - 'Key_name' => 'factura_id', - 'Seq_in_index' => 1, - 'Column_name' => 'factura_id', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - 'tipo_id' => - array ( - 1 => - array ( - 'Table' => 'estados_facturas', - 'Non_unique' => 1, - 'Key_name' => 'tipo_id', - 'Seq_in_index' => 1, - 'Column_name' => 'tipo_id', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - ), - 'foreign_keys' => - array ( - 'estados_facturas_ibfk_3' => - array ( - 'TABLE_NAME' => 'estados_facturas', - 'COLUMN_NAME' => 'factura_id', - 'CONSTRAINT_NAME' => 'estados_facturas_ibfk_3', - 'REFERENCED_TABLE_NAME' => 'facturas', - 'REFERENCED_COLUMN_NAME' => 'id', - 'UPDATE_RULE' => 'CASCADE', - 'DELETE_RULE' => 'CASCADE', - ), - 'estados_facturas_ibfk_4' => - array ( - 'TABLE_NAME' => 'estados_facturas', - 'COLUMN_NAME' => 'tipo_id', - 'CONSTRAINT_NAME' => 'estados_facturas_ibfk_4', - 'REFERENCED_TABLE_NAME' => 'tipos_estados_facturas', - 'REFERENCED_COLUMN_NAME' => 'id', - 'UPDATE_RULE' => 'CASCADE', - 'DELETE_RULE' => 'CASCADE', - ), - ), - ), - 'sociedades' => - array ( - 'table' => - array ( - 'table_name' => 'sociedades', - 'engine' => 'InnoDB', - 'table_comment' => '', - 'table_collation' => 'utf8mb3_general_ci', - 'character_set_name' => 'utf8mb3', - 'row_format' => 'Dynamic', - ), - 'columns' => - array ( - 'rut' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'sociedades', - 'COLUMN_NAME' => 'rut', - 'ORDINAL_POSITION' => 1, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'PRI', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'digito' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'sociedades', - 'COLUMN_NAME' => 'digito', - 'ORDINAL_POSITION' => 2, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'char', - 'CHARACTER_MAXIMUM_LENGTH' => 1, - 'CHARACTER_OCTET_LENGTH' => 3, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'char(1)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'nombre' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'sociedades', - 'COLUMN_NAME' => 'nombre', - 'ORDINAL_POSITION' => 3, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'varchar', - 'CHARACTER_MAXIMUM_LENGTH' => 100, - 'CHARACTER_OCTET_LENGTH' => 300, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'varchar(100)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'razon' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'sociedades', - 'COLUMN_NAME' => 'razon', - 'ORDINAL_POSITION' => 4, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'text', - 'CHARACTER_MAXIMUM_LENGTH' => 65535, - 'CHARACTER_OCTET_LENGTH' => 65535, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'text', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'tipo_sociedad_id' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'sociedades', - 'COLUMN_NAME' => 'tipo_sociedad_id', - 'ORDINAL_POSITION' => 5, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'MUL', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'contacto_rut' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'sociedades', - 'COLUMN_NAME' => 'contacto_rut', - 'ORDINAL_POSITION' => 6, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'MUL', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - ), - 'indexes' => - array ( - 'PRIMARY' => - array ( - 1 => - array ( - 'Table' => 'sociedades', - 'Non_unique' => 0, - 'Key_name' => 'PRIMARY', - 'Seq_in_index' => 1, - 'Column_name' => 'rut', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - 'tipo_sociedad_id' => - array ( - 1 => - array ( - 'Table' => 'sociedades', - 'Non_unique' => 1, - 'Key_name' => 'tipo_sociedad_id', - 'Seq_in_index' => 1, - 'Column_name' => 'tipo_sociedad_id', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - 'representante_rut' => - array ( - 1 => - array ( - 'Table' => 'sociedades', - 'Non_unique' => 1, - 'Key_name' => 'representante_rut', - 'Seq_in_index' => 1, - 'Column_name' => 'contacto_rut', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - ), - 'foreign_keys' => - array ( - 'sociedades_ibfk_1' => - array ( - 'TABLE_NAME' => 'sociedades', - 'COLUMN_NAME' => 'tipo_sociedad_id', - 'CONSTRAINT_NAME' => 'sociedades_ibfk_1', - 'REFERENCED_TABLE_NAME' => 'tipo_sociedad', - 'REFERENCED_COLUMN_NAME' => 'id', - 'UPDATE_RULE' => 'RESTRICT', - 'DELETE_RULE' => 'CASCADE', - ), - 'sociedades_ibfk_2' => - array ( - 'TABLE_NAME' => 'sociedades', - 'COLUMN_NAME' => 'contacto_rut', - 'CONSTRAINT_NAME' => 'sociedades_ibfk_2', - 'REFERENCED_TABLE_NAME' => 'personas', - 'REFERENCED_COLUMN_NAME' => 'rut', - 'UPDATE_RULE' => 'RESTRICT', - 'DELETE_RULE' => 'CASCADE', - ), - ), - ), - 'proveedores' => - array ( - 'table' => - array ( - 'table_name' => 'proveedores', - 'engine' => 'InnoDB', - 'table_comment' => '', - 'table_collation' => 'utf8mb3_general_ci', - 'character_set_name' => 'utf8mb3', - 'row_format' => 'Dynamic', - ), - 'columns' => - array ( - 'id' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'proveedores', - 'COLUMN_NAME' => 'id', - 'ORDINAL_POSITION' => 1, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'PRI', - 'EXTRA' => 'auto_increment', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'inmobiliaria_rut' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'proveedores', - 'COLUMN_NAME' => 'inmobiliaria_rut', - 'ORDINAL_POSITION' => 2, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(8) unsigned', - 'COLUMN_KEY' => 'MUL', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'sociedad_rut' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'proveedores', - 'COLUMN_NAME' => 'sociedad_rut', - 'ORDINAL_POSITION' => 3, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'MUL', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - ), - 'indexes' => - array ( - 'PRIMARY' => - array ( - 1 => - array ( - 'Table' => 'proveedores', - 'Non_unique' => 0, - 'Key_name' => 'PRIMARY', - 'Seq_in_index' => 1, - 'Column_name' => 'id', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - 'inmobiliaria_rut' => - array ( - 1 => - array ( - 'Table' => 'proveedores', - 'Non_unique' => 1, - 'Key_name' => 'inmobiliaria_rut', - 'Seq_in_index' => 1, - 'Column_name' => 'inmobiliaria_rut', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - 'sociedad_rut' => - array ( - 1 => - array ( - 'Table' => 'proveedores', - 'Non_unique' => 1, - 'Key_name' => 'sociedad_rut', - 'Seq_in_index' => 1, - 'Column_name' => 'sociedad_rut', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - ), - 'foreign_keys' => - array ( - 'proveedores_ibfk_1' => - array ( - 'TABLE_NAME' => 'proveedores', - 'COLUMN_NAME' => 'inmobiliaria_rut', - 'CONSTRAINT_NAME' => 'proveedores_ibfk_1', - 'REFERENCED_TABLE_NAME' => 'inmobiliaria', - 'REFERENCED_COLUMN_NAME' => 'rut', - 'UPDATE_RULE' => 'RESTRICT', - 'DELETE_RULE' => 'CASCADE', - ), - 'proveedores_ibfk_2' => - array ( - 'TABLE_NAME' => 'proveedores', - 'COLUMN_NAME' => 'sociedad_rut', - 'CONSTRAINT_NAME' => 'proveedores_ibfk_2', - 'REFERENCED_TABLE_NAME' => 'sociedades', - 'REFERENCED_COLUMN_NAME' => 'rut', - 'UPDATE_RULE' => 'RESTRICT', - 'DELETE_RULE' => 'CASCADE', - ), - ), - ), - 'auxiliar_detalles' => - array ( - 'table' => - array ( - 'table_name' => 'auxiliar_detalles', - 'engine' => 'InnoDB', - 'table_comment' => '', - 'table_collation' => 'utf8mb3_general_ci', - 'character_set_name' => 'utf8mb3', - 'row_format' => 'Dynamic', - ), - 'columns' => - array ( - 'auxiliar_id' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'auxiliar_detalles', - 'COLUMN_NAME' => 'auxiliar_id', - 'ORDINAL_POSITION' => 1, - 'COLUMN_DEFAULT' => NULL, - 'IS_NULLABLE' => 'NO', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'MUL', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'centro_costo_id' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'auxiliar_detalles', - 'COLUMN_NAME' => 'centro_costo_id', - 'ORDINAL_POSITION' => 2, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(10) unsigned', - 'COLUMN_KEY' => 'MUL', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'rut' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'auxiliar_detalles', - 'COLUMN_NAME' => 'rut', - 'ORDINAL_POSITION' => 3, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'int', - 'CHARACTER_MAXIMUM_LENGTH' => NULL, - 'CHARACTER_OCTET_LENGTH' => NULL, - 'NUMERIC_PRECISION' => 10, - 'NUMERIC_SCALE' => 0, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => NULL, - 'COLLATION_NAME' => NULL, - 'COLUMN_TYPE' => 'int(8) unsigned', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'digito' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'auxiliar_detalles', - 'COLUMN_NAME' => 'digito', - 'ORDINAL_POSITION' => 4, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'char', - 'CHARACTER_MAXIMUM_LENGTH' => 1, - 'CHARACTER_OCTET_LENGTH' => 3, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'char(1)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'nombre' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'auxiliar_detalles', - 'COLUMN_NAME' => 'nombre', - 'ORDINAL_POSITION' => 5, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'varchar', - 'CHARACTER_MAXIMUM_LENGTH' => 255, - 'CHARACTER_OCTET_LENGTH' => 765, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'varchar(255)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'categoria' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'auxiliar_detalles', - 'COLUMN_NAME' => 'categoria', - 'ORDINAL_POSITION' => 6, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'varchar', - 'CHARACTER_MAXIMUM_LENGTH' => 100, - 'CHARACTER_OCTET_LENGTH' => 300, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'varchar(100)', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - 'detalle' => - array ( - 'TABLE_CATALOG' => 'def', - 'TABLE_NAME' => 'auxiliar_detalles', - 'COLUMN_NAME' => 'detalle', - 'ORDINAL_POSITION' => 7, - 'COLUMN_DEFAULT' => 'NULL', - 'IS_NULLABLE' => 'YES', - 'DATA_TYPE' => 'text', - 'CHARACTER_MAXIMUM_LENGTH' => 65535, - 'CHARACTER_OCTET_LENGTH' => 65535, - 'NUMERIC_PRECISION' => NULL, - 'NUMERIC_SCALE' => NULL, - 'DATETIME_PRECISION' => NULL, - 'CHARACTER_SET_NAME' => 'utf8mb3', - 'COLLATION_NAME' => 'utf8mb3_general_ci', - 'COLUMN_TYPE' => 'text', - 'COLUMN_KEY' => '', - 'EXTRA' => '', - 'PRIVILEGES' => 'select,insert,update,references', - 'COLUMN_COMMENT' => '', - 'IS_GENERATED' => 'NEVER', - 'GENERATION_EXPRESSION' => NULL, - ), - ), - 'indexes' => - array ( - 'auxiliar_id' => - array ( - 1 => - array ( - 'Table' => 'auxiliar_detalles', - 'Non_unique' => 1, - 'Key_name' => 'auxiliar_id', - 'Seq_in_index' => 1, - 'Column_name' => 'auxiliar_id', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => '', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - 'centro_costo_id' => - array ( - 1 => - array ( - 'Table' => 'auxiliar_detalles', - 'Non_unique' => 1, - 'Key_name' => 'centro_costo_id', - 'Seq_in_index' => 1, - 'Column_name' => 'centro_costo_id', - 'Collation' => 'A', - 'Sub_part' => NULL, - 'Packed' => NULL, - 'Null' => 'YES', - 'Index_type' => 'BTREE', - 'Comment' => '', - 'Index_comment' => '', - ), - ), - ), - 'foreign_keys' => - array ( - 'auxiliar_detalles_ibfk_3' => - array ( - 'TABLE_NAME' => 'auxiliar_detalles', - 'COLUMN_NAME' => 'auxiliar_id', - 'CONSTRAINT_NAME' => 'auxiliar_detalles_ibfk_3', - 'REFERENCED_TABLE_NAME' => 'movimientos_auxiliares', - 'REFERENCED_COLUMN_NAME' => 'id', - 'UPDATE_RULE' => 'CASCADE', - 'DELETE_RULE' => 'CASCADE', - ), - 'auxiliar_detalles_ibfk_5' => - array ( - 'TABLE_NAME' => 'auxiliar_detalles', - 'COLUMN_NAME' => 'centro_costo_id', - 'CONSTRAINT_NAME' => 'auxiliar_detalles_ibfk_5', - 'REFERENCED_TABLE_NAME' => 'centros_costos', - 'REFERENCED_COLUMN_NAME' => 'id', - 'UPDATE_RULE' => 'CASCADE', - 'DELETE_RULE' => 'SET NULL', - ), - ), - ), 'tipo_estado_cierre' => array ( 'table' => diff --git a/app/resources/routes/04_ventas.php b/app/resources/routes/04_ventas.php index 625f139..2ce4212 100644 --- a/app/resources/routes/04_ventas.php +++ b/app/resources/routes/04_ventas.php @@ -32,7 +32,11 @@ $app->group('/venta/{venta_id:[0-9]+}', function($app) { $app->get('/add[/]', [Ventas\Bonos::class, 'add']); }); $app->group('/escritura', function($app) { + $app->group('/cuotas', function($app) { + $app->get('[/]', Ventas\Abono\Cuotas::class); + }); $app->get('/add[/]', [Ventas\Escrituras::class, 'add']); + $app->get('[/]', [Ventas\Escrituras::class, 'show']); }); $app->group('/credito', function($app) { $app->get('[/]', [Ventas\Creditos::class, 'show']); diff --git a/app/resources/routes/api/ventas.php b/app/resources/routes/api/ventas.php index 954eb1c..c79874b 100644 --- a/app/resources/routes/api/ventas.php +++ b/app/resources/routes/api/ventas.php @@ -35,6 +35,12 @@ $app->group('/venta/{venta_id}', function($app) { $app->post('/add[/]', [Ventas\Bonos::class, 'add']); }); $app->group('/escritura', function($app) { + $app->group('/cuotas', function($app) { + $app->post('/add[/]', [Ventas\Abonos\Cuotas::class, 'add']); + }); + $app->group('/cuota/{cuota_id:[0-9]+}', function($app) { + $app->post('/edit[/]', [Ventas\Abonos\Cuotas::class, 'edit']); + }); $app->post('/add[/]', [Ventas\Escrituras::class, 'add']); }); $app->group('/credito', function($app) { diff --git a/app/resources/views/ventas/escrituras/abono/cuotas.blade.php b/app/resources/views/ventas/escrituras/abono/cuotas.blade.php new file mode 100644 index 0000000..bd45901 --- /dev/null +++ b/app/resources/views/ventas/escrituras/abono/cuotas.blade.php @@ -0,0 +1,166 @@ +@extends('ventas.base') + +@section('venta_subtitle') + Cuotas - Abono a Escritura +@endsection + +@section('venta_content') + + + + + + + + + + + + + + + + @foreach ($cuotas as $cuota) + + + + + + + + + + @endforeach + +
#FechaValorEstado + +
$UF
{{$cuota->numero}}{{$cuota->pago->fecha->format('d-m-Y')}}{{$format->pesos($cuota->pago->valor)}}{{$format->ufs($cuota->pago->valor())}} + {{ucwords($cuota->pago->currentEstado->tipoEstadoPago->descripcion)}} + @if (in_array($cuota->pago->currentEstado->tipoEstadoPago->descripcion, ['abonado', 'depositado'])) +
+ {{$cuota->pago->currentEstado->fecha->format('d-m-Y')}} + @endif +
+ @if (in_array($cuota->pago->currentEstado->tipoEstadoPago->descripcion, ['depositado', 'no pagado'])) +
+
+
+
+ + +
+
+ + @if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'depositado') + + @endif +
+
+ @endif +
+ + +
+ + @include('ventas.escrituras.abono.cuotas.add_modal') + @include('ventas.escrituras.abono.cuotas.edit_modal') +@endsection + +@push('page_scripts') + +@endpush diff --git a/app/resources/views/ventas/escrituras/abono/cuotas/add_modal.blade.php b/app/resources/views/ventas/escrituras/abono/cuotas/add_modal.blade.php new file mode 100644 index 0000000..a02ef3b --- /dev/null +++ b/app/resources/views/ventas/escrituras/abono/cuotas/add_modal.blade.php @@ -0,0 +1,87 @@ + + +@push('page_scripts') + +@endpush diff --git a/app/resources/views/ventas/escrituras/abono/cuotas/edit_modal.blade.php b/app/resources/views/ventas/escrituras/abono/cuotas/edit_modal.blade.php new file mode 100644 index 0000000..1bd143b --- /dev/null +++ b/app/resources/views/ventas/escrituras/abono/cuotas/edit_modal.blade.php @@ -0,0 +1,130 @@ + + +@push('page_scripts') + +@endpush diff --git a/app/resources/views/ventas/escrituras/add.blade.php b/app/resources/views/ventas/escrituras/add.blade.php index 24234a4..82ea3ad 100644 --- a/app/resources/views/ventas/escrituras/add.blade.php +++ b/app/resources/views/ventas/escrituras/add.blade.php @@ -14,6 +14,7 @@

Crédito {{$format->ufs($venta->formaPago()->credito->pago->valor())}}

@endif + Agregar Cuotas
diff --git a/app/resources/views/ventas/escrituras/show.blade.php b/app/resources/views/ventas/escrituras/show.blade.php index 5be5aab..fd50174 100644 --- a/app/resources/views/ventas/escrituras/show.blade.php +++ b/app/resources/views/ventas/escrituras/show.blade.php @@ -5,6 +5,24 @@ @endsection @section('venta_content') + @if (count($venta->formaPago()->cuotasAbono) > 0) + Ver Cuotas +
+
+ Cuotas +
+
+
+ {{$format->pesos($venta->formaPago()->cuotasAbono('pesos'))}} +
+
+ {{$format->ufs($venta->formaPago()->cuotasAbono())}} +
+
+
+ @else + Agregar Cuotas + @endif
@@ -15,6 +33,26 @@
+
+ +
+
$
+ +
+
+
+ + +
@endsection @@ -27,12 +65,13 @@ data.set('venta', {{$venta->id}}) const fecha = $('#fecha').calendar('get date') data.set('fecha', fecha.toISOString()) + data.set('estado', $('#estado').dropdown('get value')) return fetchAPI(url, {method: 'post', body: data}).then(response => { if (response.ok) { return response.json() } }).then(json => { - if (!json.edited) { + if (!json.success) { return } window.location = '{{$urls->base}}/venta/{{$venta->id}}' @@ -41,6 +80,8 @@ $(document).ready(() => { calendar_date_options.initialDate = new Date({{$venta->currentEstado()->fecha->format('Y, m-1, j')}}) $('#fecha').calendar(calendar_date_options) + $('#estado').dropdown() + $('#estado').dropdown('set selected', '{{$venta->currentEstado()->id}}') $('#edit_form').submit(event => { event.preventDefault() editEscritura() diff --git a/app/resources/views/ventas/show/forma_pago/escritura.blade.php b/app/resources/views/ventas/show/forma_pago/escritura.blade.php index 25be00c..7781d80 100644 --- a/app/resources/views/ventas/show/forma_pago/escritura.blade.php +++ b/app/resources/views/ventas/show/forma_pago/escritura.blade.php @@ -15,8 +15,18 @@ @if ($escritura !== null) - {{$format->ufs($escritura->pago->valor())}} - {{$format->pesos($escritura->pago->valor)}} + + {{$format->ufs($escritura->pago->valor())}} + @if (count($venta->formaPago()->cuotasAbono) > 0) +
+ ({{$format->ufs($venta->formaPago()->cuotasAbono())}}) + @endif + + + {{$format->pesos($escritura->pago->valor)}} + @if (count($venta->formaPago()->cuotasAbono) > 0) +
+ ({{$format->pesos($venta->formaPago()->cuotasAbono('pesos'))}}) + @endif + {{$escritura->pago->currentEstado->fecha->format('d-m-Y')}} @if ($escritura->pago->currentEstado->tipoEstadoPago->descripcion === 'no pagado') diff --git a/app/src/Controller/API/Ventas/Abonos/Cuotas.php b/app/src/Controller/API/Ventas/Abonos/Cuotas.php new file mode 100644 index 0000000..180898b --- /dev/null +++ b/app/src/Controller/API/Ventas/Abonos/Cuotas.php @@ -0,0 +1,79 @@ +getParsedBody(); + $output = [ + 'input' => $input, + 'cuota' => null, + 'success' => false, + ]; + try { + $input['valor'] = $valorService->clean($input['valor']); + if (isset($input['uf']) and !empty($input['uf'])) { + $uf = $ufService->get(new DateTimeImmutable($input['fecha'])); + $input['valor'] = $uf * $valorService->clean($input['uf']); + } + $pagoData = array_intersect_key($input, array_flip(['fecha', 'valor'])); + $pago = $pagoService->add($pagoData); + $cuotaData = array_intersect_key($input, array_flip(['venta_id', 'numero'])); + $cuotaData['pago_id'] = $pago->id; + $cuota = $cuotaRepository->create($cuotaData); + $output['cuota'] = $cuotaRepository->save($cuota); + $output['success'] = true; + } catch (Implement\Exception\EmptyResult) {} + return $this->withJson($response, $output); + } + public function edit(ServerRequestInterface $request, ResponseInterface $response, + Service\Venta\Pago $pagoService, + Repository\Venta\EstadoPago $estadoPagoRepository, + Service\UF $ufService, + Service\Valor $valorService, + Repository\Venta\Abono\Cuota $cuotaRepository, int $cuota_id): ResponseInterface + { + $input = $request->getParsedBody(); + $output = [ + 'input' => $input, + 'cuota' => null, + 'success' => false, + ]; + try { + $cuota = $cuotaRepository->fetchById($cuota_id); + $input['valor'] = $valorService->clean($input['valor']); + if (isset($input['uf']) and !empty($input['uf'])) { + $uf = $ufService->get(new DateTimeImmutable($input['fecha'])); + $input['valor'] = $uf * $valorService->clean($input['uf']); + } + $pagoData = array_intersect_key($input, array_flip(['fecha', 'valor'])); + $pago = $pagoService->edit($cuota->pago, $pagoData); + if ($input['tipo_estado_id'] !== $pago->currentEstado->tipoEstadoPago->id) { + $estadoData = array_intersect_key($input, array_flip(['fecha'])); + $estadoData['pago'] = $cuota->pago->id; + $estadoData['estado'] = $input['tipo_estado_id']; + $estado = $estadoPagoRepository->create($estadoData); + $estadoPagoRepository->save($estado); + } + $output['cuota'] = $cuota; + $output['success'] = true; + } catch (Implement\Exception\EmptyResult) {} + return $this->withJson($response, $output); + } +} diff --git a/app/src/Controller/API/Ventas/Pagos.php b/app/src/Controller/API/Ventas/Pagos.php index ea8d5f7..002981f 100644 --- a/app/src/Controller/API/Ventas/Pagos.php +++ b/app/src/Controller/API/Ventas/Pagos.php @@ -100,12 +100,13 @@ class Pagos 'pago_id' => $pago_id, 'input' => $body, 'pago' => null, - 'depositado' => false + 'depositado' => false, + 'success' => false ]; try { $pago = $pagoService->getById($pago_id); $fecha = new DateTimeImmutable($body['fecha']); - $output['depositado'] = $pagoService->depositar($pago, $fecha); + $output['depositado'] = $output['success'] = $pagoService->depositar($pago, $fecha); $output['pago'] = json_decode(json_encode($pagoService->getById($pago_id)), JSON_OBJECT_AS_ARRAY); $output['pago']['valor_uf'] = $formatService->ufs($output['pago']['valor_uf']); } catch (EmptyResult) {} @@ -129,12 +130,13 @@ class Pagos 'pago_id' => $pago_id, 'input' => $body, 'pago' => null, - 'abonado' => false + 'abonado' => false, + 'success' => false, ]; try { $pago = $pagoService->getById($pago_id); $fecha = new DateTimeImmutable($body['fecha']); - $output['abonado'] = $pagoService->abonar($pago, $fecha); + $output['abonado'] = $output['success'] = $pagoService->abonar($pago, $fecha); $output['pago'] = json_decode(json_encode($pagoService->getById($pago_id)), JSON_OBJECT_AS_ARRAY); $output['pago']['valor_uf'] = $formatService->ufs($output['pago']['valor_uf']); $output['input']['fecha'] = $fecha->format('d-m-Y'); diff --git a/app/src/Controller/Ventas/Abono/Cuotas.php b/app/src/Controller/Ventas/Abono/Cuotas.php new file mode 100644 index 0000000..ac1a51f --- /dev/null +++ b/app/src/Controller/Ventas/Abono/Cuotas.php @@ -0,0 +1,32 @@ +getById($venta_id); + } catch (EmptyResult $e) {} + $cuotas = []; + try { + $cuotas = $cuotaRepository->fetchByVenta($venta_id); + } catch (EmptyResult $e) {} + $estados = []; + try { + $estados = $estadoPagoRepository->fetchAll(); + } catch (EmptyResult $e) {} + return $view->render($response, 'ventas.escrituras.abono.cuotas', compact('venta', 'cuotas', 'estados')); + } +} diff --git a/app/src/Controller/Ventas/Escrituras.php b/app/src/Controller/Ventas/Escrituras.php index 31b71c4..c865fb1 100644 --- a/app/src/Controller/Ventas/Escrituras.php +++ b/app/src/Controller/Ventas/Escrituras.php @@ -10,10 +10,12 @@ use Psr\Http\Message\ServerRequestInterface; class Escrituras { public function show(ServerRequestInterface $request, ResponseInterface $response, View $view, + Repository\Venta\TipoEstadoPago $estadoPagoRepository, Service\Venta $ventaService, int $venta_id): ResponseInterface { $venta = $ventaService->getById($venta_id); - return $view->render($response, 'ventas.escrituras.show', compact('venta')); + $estados = $estadoPagoRepository->fetchAll(); + return $view->render($response, 'ventas.escrituras.show', compact('venta', 'estados')); } public function informe(ServerRequestInterface $request, ResponseInterface $response, View $view, Service\Venta $ventaService, int $venta_id): ResponseInterface diff --git a/app/src/Model/DatosPersona.php b/app/src/Model/DatosPersona.php index c27f0d0..722c17f 100644 --- a/app/src/Model/DatosPersona.php +++ b/app/src/Model/DatosPersona.php @@ -14,7 +14,7 @@ class DatosPersona extends Ideal\Model public ?string $sexo; public ?string $estadoCivil; public ?string $nacionalidad; - public ?string $profesion; + public ?string $ocupacion; public function jsonSerialize(): mixed { @@ -26,7 +26,7 @@ class DatosPersona extends Ideal\Model 'sexo' => $this->sexo, 'estadoCivil' => $this->estadoCivil, 'nacionalidad' => $this->nacionalidad, - 'profesion' => $this->profesion, + 'profesion' => $this->ocupacion, ]; } } diff --git a/app/src/Model/Venta/Abono/Cuota.php b/app/src/Model/Venta/Abono/Cuota.php new file mode 100644 index 0000000..24e36e4 --- /dev/null +++ b/app/src/Model/Venta/Abono/Cuota.php @@ -0,0 +1,20 @@ + $this->venta->id, + 'pago' => $this->pago + ]); + } +} diff --git a/app/src/Model/Venta/FormaPago.php b/app/src/Model/Venta/FormaPago.php index ee06f0d..9badadc 100644 --- a/app/src/Model/Venta/FormaPago.php +++ b/app/src/Model/Venta/FormaPago.php @@ -11,6 +11,7 @@ class FormaPago implements JsonSerializable public ?Subsidio $subsidio = null; public ?Credito $credito = null; public ?Pago $devolucion = null; + public ?array $cuotasAbono = null; public function anticipo(string $moneda = Pago::UF): float { @@ -24,6 +25,9 @@ class FormaPago implements JsonSerializable if ($this->escritura !== null) { $sum += $this->escritura->pago->valor($moneda); } + if (count($this->cuotasAbono) > 0) { + $sum += $this->cuotasAbono($moneda); + } return $sum; } public function prometido(string $moneda = Pago::UF): float @@ -52,6 +56,15 @@ class FormaPago implements JsonSerializable } return $sum; } + public function cuotasAbono(string $moneda = Pago::UF): float + { + return array_reduce($this->cuotasAbono, function($sum, $cuota) use ($moneda) { + if ($cuota->currentEstado->tipoEstadoPago->descripcion === 'abonado') { + return $sum + $cuota->pago->valor($moneda); + } + return $sum; + }, 0); + } public function ids(): array { return [ @@ -72,7 +85,8 @@ class FormaPago implements JsonSerializable 'bono_pie' => $this->bonoPie ?? null, 'subsidio' => $this->subsidio ?? null, 'credito' => $this->credito ?? null, - 'devolucion' => $this->devolucion ?? null + 'devolucion' => $this->devolucion ?? null, + 'cuotas_abono' => $this->cuotasAbono ?? [] ]; } } diff --git a/app/src/Repository/DatosPersona.php b/app/src/Repository/DatosPersona.php index 3b9c0c0..bc008b1 100644 --- a/app/src/Repository/DatosPersona.php +++ b/app/src/Repository/DatosPersona.php @@ -58,7 +58,7 @@ class DatosPersona extends Ideal\Repository 'nacionalidad', 'profesion' ], [ $model->persona->rut, $model->direccion?->id, $model->telefono, $model->email, $model->fechaNacimiento, - $model->sexo, $model->estadoCivil, $model->nacionalidad, $model->profesion + $model->sexo, $model->estadoCivil, $model->nacionalidad, $model->ocupacion ]); return $model; } diff --git a/app/src/Repository/Venta/Abono/Cuota.php b/app/src/Repository/Venta/Abono/Cuota.php new file mode 100644 index 0000000..2e41138 --- /dev/null +++ b/app/src/Repository/Venta/Abono/Cuota.php @@ -0,0 +1,61 @@ +setTable('venta_abono_cuotas'); + } + + public function create(?array $data = null): Model\Venta\Abono\Cuota + { + $map = (new Implement\Repository\MapperParser(['numero'])) + ->register('venta_id', (new Implement\Repository\Mapper()) + ->setProperty('venta') + ->setFunction(function($data) { + return $this->ventaRepository->fetchById($data['venta_id']); + }) + ) + ->register('pago_id', (new Implement\Repository\Mapper()) + ->setProperty('pago') + ->setFunction(function($data) { + return $this->pagoService->getById($data['pago_id']); + }) + ); + return $this->parseData(new Model\Venta\Abono\Cuota(), $data, $map); + } + + public function save(Define\Model $model): Model\Venta\Abono\Cuota + { + $model->id = $this->saveNew(['venta_id', 'pago_id', 'numero'], [$model->venta->id, $model->pago->id, $model->numero]); + return $model; + } + + public function edit(Define\Model $model, array $new_data): Model\Venta\Abono\Cuota + { + return $this->update($model, ['venta_id', 'pago_id', 'numero'], $new_data); + } + + /** + * @throws EmptyResult + */ + public function fetchByVenta(int $venta_id): array + { + $query = $this->connection->getQueryBuilder() + ->select() + ->from($this->getTable()) + ->where('venta_id = ?'); + return $this->fetchMany($query, [$venta_id]); + } +} diff --git a/app/src/Service/Venta/FormaPago.php b/app/src/Service/Venta/FormaPago.php index 440ac96..105fe18 100644 --- a/app/src/Service/Venta/FormaPago.php +++ b/app/src/Service/Venta/FormaPago.php @@ -16,6 +16,7 @@ class FormaPago extends Ideal\Service protected Credito $creditoService, protected Repository\Venta\Escritura $escrituraRepository, protected Subsidio $subsidioService, + protected Repository\Venta\Abono\Cuota $cuotaRepository, protected Pago $pagoService, protected Valor $valorService) { @@ -43,6 +44,9 @@ class FormaPago extends Ideal\Service try { $formaPago->devolucion = $this->pagoService->getDevolucionByVenta($venta_id); } catch (Implement\Exception\EmptyResult) {} + try { + $formaPago->cuotasAbono = $this->cuotaRepository->fetchByVenta($venta_id); + } catch (Implement\Exception\EmptyResult) {} return $formaPago; } diff --git a/app/tests/performance/APITest.php b/app/tests/performance/APITest.php deleted file mode 100644 index eff09ca..0000000 --- a/app/tests/performance/APITest.php +++ /dev/null @@ -1,17 +0,0 @@ - 'http://proxy']); - $start = microtime(true); - $response = $client->get('/api', ['headers' => ['Authorization' => 'Bearer ' . md5($_ENV['API_KEY'])]]); - $end = microtime(true); - $this->assertLessThanOrEqual(1000, $end - $start); - } -} diff --git a/app/tests/units/common/Alias/ViewTest.php b/app/tests/units/common/Alias/ViewTest.php deleted file mode 100644 index 4b7fd28..0000000 --- a/app/tests/units/common/Alias/ViewTest.php +++ /dev/null @@ -1,36 +0,0 @@ - - - - - Test - - -Test - - -HTML; - mkdir('/tmp/views'); - mkdir('/tmp/cache', 777); - file_put_contents('/tmp/views/test.blade.php', $contents); - $view = new View('/tmp/views', '/tmp/cache'); - $body = $this->getMockBuilder(StreamInterface::class)->getMock(); - $body->method('getContents')->willReturn($contents); - $response = $this->getMockBuilder(ResponseInterface::class)->getMock(); - $response->method('getBody')->willReturn($body); - $output = $view->render($response, 'test'); - $this->assertEquals($contents, $output->getBody()->getContents()); - } -} diff --git a/app/tests/units/common/Implement/ConnectionTest.php b/app/tests/units/common/Implement/ConnectionTest.php deleted file mode 100644 index b6f6f59..0000000 --- a/app/tests/units/common/Implement/ConnectionTest.php +++ /dev/null @@ -1,8 +0,0 @@ -generateBuildTest(); - $this->assertEquals($expected, $menu->build(1)); - } - } - protected function generateBuildTest(): array - { - $modelCount = mt_rand(3, 100); - $expected = []; - $models = []; - for ($j = 0; $j < $modelCount; $j ++) { - $model = $this->generateModel(); - $models []= $model; - $expected []= "id}\">title{$model->id}"; - } - $expected = implode(PHP_EOL, $expected); - $connection = $this->getMockBuilder(Define\Connection::class)->getMock(); - $repository = $this->getMockBuilder(Repository\Menu::class)->setConstructorArgs(compact('connection'))->getMock(); - $permissionsRepository = $this->getMockBuilder(Repository\Permission::class)->setConstructorArgs(compact('connection'))->getMock(); - $permissions = $this->getMockBuilder(Service\Permission::class)->setConstructorArgs([$permissionsRepository])->getMock(); - $repository->method('fetchByUser')->willReturn($models); - $menu = new Service\Menu($repository, $permissions, (object) ['base' => 'http://localhost']); - - return [$expected, $menu]; - } - protected function generateModel(): Model\Menu - { - $id = mt_rand(1, 100000); - $model = $this->getMockBuilder(Model\Menu::class)->getMock(); - $model->id = $id; - $model->url = "url{$id}"; - $model->title = "title{$id}"; - - return $model; - } -} diff --git a/testing.compose.yml b/testing.compose.yml index f63aa53..a07fd12 100644 --- a/testing.compose.yml +++ b/testing.compose.yml @@ -24,6 +24,12 @@ services: env_file: ${APP_PATH:-.}/.test.db.env volumes: - test-db:/var/lib/mysql + networks: + - default + - adminer_network volumes: test-db: {} + +networks: + adminer_network: {}