From f9e079cc42ab34f2fee82e1bcff9e89a5dc03009 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Wed, 20 Nov 2024 21:26:03 -0300 Subject: [PATCH 01/15] Migraciones --- ...15_incoviba_17303572256733fad_3df_01b.php} | 443 +---- .../20241113010320_create_personas.php | 30 + .../20241113010328_create_proveedores.php | 31 + ...0241113010900_create_datos_proveedores.php | 31 + .../20241113011622_create_datos_personas.php | 36 + app/resources/database/schema.php | 1558 ----------------- 6 files changed, 129 insertions(+), 2000 deletions(-) rename app/resources/database/migrations/{20241113005029_incoviba_2287310996733f_7d_5ac_59c.php => 20241113010315_incoviba_17303572256733fad_3df_01b.php} (91%) create mode 100644 app/resources/database/migrations/20241113010320_create_personas.php create mode 100644 app/resources/database/migrations/20241113010328_create_proveedores.php create mode 100644 app/resources/database/migrations/20241113010900_create_datos_proveedores.php create mode 100644 app/resources/database/migrations/20241113011622_create_datos_personas.php 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/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' => From cc5c90e2c064eade8174ee428b080bf56eb81919 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 11:40:53 -0300 Subject: [PATCH 02/15] Cleanup tests --- app/tests/performance/APITest.php | 17 ------- app/tests/units/common/Alias/ViewTest.php | 36 ------------- .../units/common/Implement/ConnectionTest.php | 8 --- app/tests/units/src/Service/MenuTest.php | 50 ------------------- 4 files changed, 111 deletions(-) delete mode 100644 app/tests/performance/APITest.php delete mode 100644 app/tests/units/common/Alias/ViewTest.php delete mode 100644 app/tests/units/common/Implement/ConnectionTest.php delete mode 100644 app/tests/units/src/Service/MenuTest.php 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; - } -} From 56d3a26cfff4a8f473c52c2d805f09655a7f9a48 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 11:41:03 -0300 Subject: [PATCH 03/15] Datos Persona --- app/src/Model/DatosPersona.php | 4 ++-- app/src/Repository/DatosPersona.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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/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; } From a2352d79f969d098eb3684ab6d61e9b6dba84008 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 11:41:19 -0300 Subject: [PATCH 04/15] Testing conectado a adminer --- testing.compose.yml | 6 ++++++ 1 file changed, 6 insertions(+) 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: {} From 4392f61db94226d927a2be0083420ea122e57de0 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 12:02:02 -0300 Subject: [PATCH 05/15] Cuota abono a escritura --- app/src/Model/Venta/Abono/Cuota.php | 19 ++++++++ app/src/Repository/Venta/Abono/Cuota.php | 59 ++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 app/src/Model/Venta/Abono/Cuota.php create mode 100644 app/src/Repository/Venta/Abono/Cuota.php diff --git a/app/src/Model/Venta/Abono/Cuota.php b/app/src/Model/Venta/Abono/Cuota.php new file mode 100644 index 0000000..e43ef16 --- /dev/null +++ b/app/src/Model/Venta/Abono/Cuota.php @@ -0,0 +1,19 @@ + $this->venta->id, + 'pago' => $this->pago + ]); + } +} diff --git a/app/src/Repository/Venta/Abono/Cuota.php b/app/src/Repository/Venta/Abono/Cuota.php new file mode 100644 index 0000000..8de133f --- /dev/null +++ b/app/src/Repository/Venta/Abono/Cuota.php @@ -0,0 +1,59 @@ +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->pagoRepository->fetchById($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'], [$model->venta->id, $model->pago->id]); + return $model; + } + + public function edit(Define\Model $model, array $new_data): Model\Venta\Abono\Cuota + { + return $this->update($model, ['venta_id', 'pago_id'], $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]); + } +} From 83ea955d89053627fe2796b86a8ccea77b2e5aef Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 12:02:49 -0300 Subject: [PATCH 06/15] Cuota abono en venta --- app/src/Model/Venta/FormaPago.php | 4 +++- app/src/Service/Venta/FormaPago.php | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/Model/Venta/FormaPago.php b/app/src/Model/Venta/FormaPago.php index ee06f0d..4ec882b 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 { @@ -72,7 +73,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/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; } From a844589d7f23c48796a5ea41772fbfc3782d52d3 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 14:06:00 -0300 Subject: [PATCH 07/15] Creacion de tabla --- ...0241128151402_create_venta_abono_cuota.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/resources/database/migrations/20241128151402_create_venta_abono_cuota.php 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..74d90c2 --- /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', ['size' => 10, 'signed' => false, 'null' => false]) + ->addForeignKey('venta_id', 'ventas', ['id'], ['delete' => 'CASCADE', 'update' => 'CASCADE']) + ->addColumn('pago_id', 'integer', ['size' => 10, 'signed' => false, 'null' => false]) + ->addForeignKey('pago_id', 'pagos', ['id'], ['delete' => 'CASCADE', 'update' => 'CASCADE']) + ->addColumn('numero', 'integer', ['signed' => false, 'null' => false, 'default' => 1]) + ->create(); + } +} From 1d268f9a94e382f40ad2b398260ab7034e69ff13 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 14:06:12 -0300 Subject: [PATCH 08/15] Controlador --- app/src/Controller/Ventas/Abono/Cuotas.php | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 app/src/Controller/Ventas/Abono/Cuotas.php diff --git a/app/src/Controller/Ventas/Abono/Cuotas.php b/app/src/Controller/Ventas/Abono/Cuotas.php new file mode 100644 index 0000000..318d65a --- /dev/null +++ b/app/src/Controller/Ventas/Abono/Cuotas.php @@ -0,0 +1,27 @@ +getById($venta_id); + } catch (EmptyResult $e) {} + $cuotas = []; + try { + $cuotas = $cuotaRepository->fetchByVenta($venta_id); + } catch (EmptyResult $e) {} + return $view->render($response, 'ventas.escrituras.abono.cuotas', compact('venta', 'cuotas')); + } +} From b13f8a5b20d9fb031e9fd65b66dcb49be61d6f5a Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 14:06:44 -0300 Subject: [PATCH 09/15] Numero de cuota --- app/src/Model/Venta/Abono/Cuota.php | 1 + app/src/Repository/Venta/Abono/Cuota.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/Model/Venta/Abono/Cuota.php b/app/src/Model/Venta/Abono/Cuota.php index e43ef16..24e36e4 100644 --- a/app/src/Model/Venta/Abono/Cuota.php +++ b/app/src/Model/Venta/Abono/Cuota.php @@ -8,6 +8,7 @@ class Cuota extends Ideal\Model { public Model\Venta $venta; public Model\Venta\Pago $pago; + public int $numero; public function jsonSerialize(): mixed { diff --git a/app/src/Repository/Venta/Abono/Cuota.php b/app/src/Repository/Venta/Abono/Cuota.php index 8de133f..6ad7d9b 100644 --- a/app/src/Repository/Venta/Abono/Cuota.php +++ b/app/src/Repository/Venta/Abono/Cuota.php @@ -14,11 +14,12 @@ class Cuota extends Ideal\Repository protected Repository\Venta\Pago $pagoRepository) { parent::__construct($connection); + $this->setTable('venta_abono_cuotas'); } public function create(?array $data = null): Model\Venta\Abono\Cuota { - $map = (new Implement\Repository\MapperParser()) + $map = (new Implement\Repository\MapperParser(['numero'])) ->register('venta_id', (new Implement\Repository\Mapper()) ->setProperty('venta') ->setFunction(function($data) { @@ -36,13 +37,13 @@ class Cuota extends Ideal\Repository public function save(Define\Model $model): Model\Venta\Abono\Cuota { - $model->id = $this->saveNew(['venta_id', 'pago_id'], [$model->venta->id, $model->pago->id]); + $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'], $new_data); + return $this->update($model, ['venta_id', 'pago_id', 'numero'], $new_data); } /** From 151d1d0209c95899f79a068a6a51ff17d8b048b7 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 14:06:58 -0300 Subject: [PATCH 10/15] Rutoa --- app/resources/routes/04_ventas.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/resources/routes/04_ventas.php b/app/resources/routes/04_ventas.php index 625f139..49400bb 100644 --- a/app/resources/routes/04_ventas.php +++ b/app/resources/routes/04_ventas.php @@ -32,6 +32,9 @@ $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->group('/credito', function($app) { From 3ff5f3f1a616a2e79eb49ababc62e27e68ddf11c Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 14:07:07 -0300 Subject: [PATCH 11/15] Vistas --- .../ventas/escrituras/abono/cuotas.blade.php | 83 +++++++++++ .../abono/cuotas/add_modal.blade.php | 94 ++++++++++++ .../abono/cuotas/edit_modal.blade.php | 138 ++++++++++++++++++ .../views/ventas/escrituras/add.blade.php | 1 + 4 files changed, 316 insertions(+) create mode 100644 app/resources/views/ventas/escrituras/abono/cuotas.blade.php create mode 100644 app/resources/views/ventas/escrituras/abono/cuotas/add_modal.blade.php create mode 100644 app/resources/views/ventas/escrituras/abono/cuotas/edit_modal.blade.php 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..af664d6 --- /dev/null +++ b/app/resources/views/ventas/escrituras/abono/cuotas.blade.php @@ -0,0 +1,83 @@ +@extends('ventas.base') + +@section('venta_subtitle') + Cuotas - Abono a Escritura +@endsection + +@section('venta_content') + + + + + + + + + + + + + @foreach ($cuotas as $cuota) + + + + + + + + + @endforeach + +
#FechaValor $UFEstado + +
{{$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)}} + + +
+ + @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..ea5541f --- /dev/null +++ b/app/resources/views/ventas/escrituras/abono/cuotas/add_modal.blade.php @@ -0,0 +1,94 @@ + + +@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..b25df7c --- /dev/null +++ b/app/resources/views/ventas/escrituras/abono/cuotas/edit_modal.blade.php @@ -0,0 +1,138 @@ + + +@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
From 4f0a56c7114eb51ded0a0ae54e663ea10676efb2 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 15:12:30 -0300 Subject: [PATCH 12/15] FIX: migracion --- .../20241128151402_create_venta_abono_cuota.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/resources/database/migrations/20241128151402_create_venta_abono_cuota.php b/app/resources/database/migrations/20241128151402_create_venta_abono_cuota.php index 74d90c2..7be5db8 100644 --- a/app/resources/database/migrations/20241128151402_create_venta_abono_cuota.php +++ b/app/resources/database/migrations/20241128151402_create_venta_abono_cuota.php @@ -20,10 +20,10 @@ final class CreateVentaAbonoCuota extends AbstractMigration public function change(): void { $this->table('venta_abono_cuotas') - ->addColumn('venta_id', 'integer', ['size' => 10, 'signed' => false, 'null' => false]) - ->addForeignKey('venta_id', 'ventas', ['id'], ['delete' => 'CASCADE', 'update' => 'CASCADE']) - ->addColumn('pago_id', 'integer', ['size' => 10, 'signed' => false, 'null' => false]) - ->addForeignKey('pago_id', 'pagos', ['id'], ['delete' => 'CASCADE', 'update' => 'CASCADE']) + ->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(); } From f4b8634cb406cdfc2a4f63250967296f8092f839 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 17:12:35 -0300 Subject: [PATCH 13/15] Agregar y editar abono cuotas. --- app/resources/routes/04_ventas.php | 1 + app/resources/routes/api/ventas.php | 3 + .../ventas/escrituras/abono/cuotas.blade.php | 6 +- .../abono/cuotas/add_modal.blade.php | 2 +- .../abono/cuotas/edit_modal.blade.php | 6 +- .../views/ventas/escrituras/show.blade.php | 32 +++++++++- .../Controller/API/Ventas/Abonos/Cuotas.php | 60 +++++++++++++++++++ app/src/Controller/Ventas/Abono/Cuotas.php | 7 ++- app/src/Controller/Ventas/Escrituras.php | 4 +- app/src/Repository/Venta/Abono/Cuota.php | 5 +- 10 files changed, 114 insertions(+), 12 deletions(-) create mode 100644 app/src/Controller/API/Ventas/Abonos/Cuotas.php diff --git a/app/resources/routes/04_ventas.php b/app/resources/routes/04_ventas.php index 49400bb..2ce4212 100644 --- a/app/resources/routes/04_ventas.php +++ b/app/resources/routes/04_ventas.php @@ -36,6 +36,7 @@ $app->group('/venta/{venta_id:[0-9]+}', 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..3a826a4 100644 --- a/app/resources/routes/api/ventas.php +++ b/app/resources/routes/api/ventas.php @@ -35,6 +35,9 @@ $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->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 index af664d6..1266beb 100644 --- a/app/resources/views/ventas/escrituras/abono/cuotas.blade.php +++ b/app/resources/views/ventas/escrituras/abono/cuotas.blade.php @@ -14,7 +14,7 @@ UF Estado - @@ -50,13 +50,13 @@ $(document).ready(function () { const addModal = new AddModal({ modal: '#add_cuota_modal', - form: '#add_cuota_form', + form: 'add_cuota_form', fecha: '#add_fecha', }) const editModal = new EditModal({ table: 'cuotas', modal: '#edit_cuota_modal', - form: '#edit_cuota_form', + form: 'edit_cuota_form', fecha: '#edit_fecha', estado: '#edit_estado' }) 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 index ea5541f..9b3336d 100644 --- a/app/resources/views/ventas/escrituras/abono/cuotas/add_modal.blade.php +++ b/app/resources/views/ventas/escrituras/abono/cuotas/add_modal.blade.php @@ -4,7 +4,7 @@
- +
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 index b25df7c..9e423a0 100644 --- a/app/resources/views/ventas/escrituras/abono/cuotas/edit_modal.blade.php +++ b/app/resources/views/ventas/escrituras/abono/cuotas/edit_modal.blade.php @@ -36,11 +36,11 @@ @@ -100,7 +100,7 @@ const body = new FormData(form) const fecha = $(this.props.fecha).calendar('get date') body.set('fecha', fecha.getFullYear() + '-' + (fecha.getMonth() + 1).toString().padStart(2, '0') + '-' + fecha.getDate().toString().padStart(2, '0')) - body.set('estado', $(this.props.estado).dropdown('get value')) + body.set('tipo_estado_id', $(this.props.estado).dropdown('get value')) const url = `{{$urls->api}}/venta/{{$venta->id}}/escritura/cuota/${this.data.id}/edit` const method = 'post' APIClient.fetch(url, {method, body}).then(response => { diff --git a/app/resources/views/ventas/escrituras/show.blade.php b/app/resources/views/ventas/escrituras/show.blade.php index 5be5aab..77d5447 100644 --- a/app/resources/views/ventas/escrituras/show.blade.php +++ b/app/resources/views/ventas/escrituras/show.blade.php @@ -5,6 +5,13 @@ @endsection @section('venta_content') + @if (count($venta->formaPago()->cuotasAbono) > 0) + Ver Cuotas +

{{$format->pesos(array_reduce($venta->formaPago()->cuotas, function($sum, $cuota) {return $sum + $cuota->pago->valor;}, 0))}}

+

{{$format->ufs(array_reduce($venta->formaPago()->cuotas, function($sum, $cuota) {return $sum + $cuota->pago->valor();}, 0.0))}}

+ @else + Agregar Cuotas + @endif
@@ -15,6 +22,26 @@
+
+ +
+
$
+ +
+
+
+ + +
@endsection @@ -27,12 +54,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 +69,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/src/Controller/API/Ventas/Abonos/Cuotas.php b/app/src/Controller/API/Ventas/Abonos/Cuotas.php new file mode 100644 index 0000000..f550a5e --- /dev/null +++ b/app/src/Controller/API/Ventas/Abonos/Cuotas.php @@ -0,0 +1,60 @@ +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, 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); + $output['cuota'] = $cuotaRepository->edit($cuota, $input); + $output['success'] = true; + } catch (Implement\Exception\EmptyResult) {} + return $this->withJson($response, $output); + } +} diff --git a/app/src/Controller/Ventas/Abono/Cuotas.php b/app/src/Controller/Ventas/Abono/Cuotas.php index 318d65a..ac1a51f 100644 --- a/app/src/Controller/Ventas/Abono/Cuotas.php +++ b/app/src/Controller/Ventas/Abono/Cuotas.php @@ -12,6 +12,7 @@ class Cuotas { public function __invoke(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService, + Repository\Venta\TipoEstadoPago $estadoPagoRepository, Repository\Venta\Abono\Cuota $cuotaRepository, View $view, int $venta_id): ResponseInterface { $venta = null; @@ -22,6 +23,10 @@ class Cuotas try { $cuotas = $cuotaRepository->fetchByVenta($venta_id); } catch (EmptyResult $e) {} - return $view->render($response, 'ventas.escrituras.abono.cuotas', compact('venta', 'cuotas')); + $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/Repository/Venta/Abono/Cuota.php b/app/src/Repository/Venta/Abono/Cuota.php index 6ad7d9b..2e41138 100644 --- a/app/src/Repository/Venta/Abono/Cuota.php +++ b/app/src/Repository/Venta/Abono/Cuota.php @@ -7,11 +7,12 @@ use Incoviba\Common\Implement; use Incoviba\Common\Implement\Exception\EmptyResult; use Incoviba\Model; use Incoviba\Repository; +use Incoviba\Service; class Cuota extends Ideal\Repository { public function __construct(Define\Connection $connection, protected Repository\Venta $ventaRepository, - protected Repository\Venta\Pago $pagoRepository) + protected Service\Venta\Pago $pagoService) { parent::__construct($connection); $this->setTable('venta_abono_cuotas'); @@ -29,7 +30,7 @@ class Cuota extends Ideal\Repository ->register('pago_id', (new Implement\Repository\Mapper()) ->setProperty('pago') ->setFunction(function($data) { - return $this->pagoRepository->fetchById($data['pago_id']); + return $this->pagoService->getById($data['pago_id']); }) ); return $this->parseData(new Model\Venta\Abono\Cuota(), $data, $map); From 52de72b507be302696efa6ec7a52c4ac5613aacb Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 17:38:21 -0300 Subject: [PATCH 14/15] Sumar cuotas. --- .../views/ventas/escrituras/show.blade.php | 17 ++++++++++++++--- .../ventas/show/forma_pago/escritura.blade.php | 14 ++++++++++++-- app/src/Model/Venta/FormaPago.php | 12 ++++++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/app/resources/views/ventas/escrituras/show.blade.php b/app/resources/views/ventas/escrituras/show.blade.php index 77d5447..fd50174 100644 --- a/app/resources/views/ventas/escrituras/show.blade.php +++ b/app/resources/views/ventas/escrituras/show.blade.php @@ -6,9 +6,20 @@ @section('venta_content') @if (count($venta->formaPago()->cuotasAbono) > 0) - Ver Cuotas -

{{$format->pesos(array_reduce($venta->formaPago()->cuotas, function($sum, $cuota) {return $sum + $cuota->pago->valor;}, 0))}}

-

{{$format->ufs(array_reduce($venta->formaPago()->cuotas, function($sum, $cuota) {return $sum + $cuota->pago->valor();}, 0.0))}}

+ Ver Cuotas +
+
+ Cuotas +
+
+
+ {{$format->pesos($venta->formaPago()->cuotasAbono('pesos'))}} +
+
+ {{$format->ufs($venta->formaPago()->cuotasAbono())}} +
+
+
@else Agregar Cuotas @endif 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/Model/Venta/FormaPago.php b/app/src/Model/Venta/FormaPago.php index 4ec882b..9badadc 100644 --- a/app/src/Model/Venta/FormaPago.php +++ b/app/src/Model/Venta/FormaPago.php @@ -25,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 @@ -53,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 [ From 8028b673fb65347cea7d6c92970d95952622c896 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 28 Nov 2024 19:14:14 -0300 Subject: [PATCH 15/15] FIX: Editar cuotas --- app/resources/routes/api/ventas.php | 3 + .../ventas/escrituras/abono/cuotas.blade.php | 105 ++++++++++++++++-- .../abono/cuotas/add_modal.blade.php | 7 -- .../abono/cuotas/edit_modal.blade.php | 20 +--- .../Controller/API/Ventas/Abonos/Cuotas.php | 23 +++- app/src/Controller/API/Ventas/Pagos.php | 10 +- 6 files changed, 130 insertions(+), 38 deletions(-) diff --git a/app/resources/routes/api/ventas.php b/app/resources/routes/api/ventas.php index 3a826a4..c79874b 100644 --- a/app/resources/routes/api/ventas.php +++ b/app/resources/routes/api/ventas.php @@ -38,6 +38,9 @@ $app->group('/venta/{venta_id}', 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 index 1266beb..bd45901 100644 --- a/app/resources/views/ventas/escrituras/abono/cuotas.blade.php +++ b/app/resources/views/ventas/escrituras/abono/cuotas.blade.php @@ -10,29 +10,60 @@ # Fecha - Valor $ - UF - Estado - + Valor + Estado + + + $ + UF + @foreach ($cuotas as $cuota) - {{$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)}} + {{$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 + - - @@ -78,6 +109,58 @@ console.debug(url) }) }) + + Array.from(document.getElementsByClassName('avance_pago_form')).forEach(form => { + form.addEventListener('submit', submitEvent => { + submitEvent.preventDefault() + return false + }) + const cdo = structuredClone(calendar_date_options) + cdo['initialDate'] = new Date() + cdo['maxDate'] = new Date() + @if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'depositado') + cdo['initialDate'] = new Date('{{$cuota->pago->currentEstado->fecha->format('Y-m-d')}}') + @endif + $(form).find('.ui.calendar').calendar(cdo) + }) + Array.from(document.getElementsByClassName('accept_button')).forEach(button => { + button.addEventListener('click', clickEvent => { + const id = $(clickEvent.currentTarget).data('id') + const method = 'post' + const form = Array.from(document.getElementsByClassName('avance_pago_form')).filter(form => parseInt(form.dataset.id) === id)[0] + const pago = form.dataset.pago + const estado = form.dataset.estado + const newEstado = estado === 'depositado' ? 'abonar' : 'depositar' + const url = `{{$urls->api}}/ventas/pago/${pago}/${newEstado}` + const body = new FormData() + const fecha = $(form).find('.ui.calendar').calendar('get date')[0] + body.set('fecha', fecha.getFullYear() + '-' + (fecha.getMonth() + 1).toString().padStart(2, '0') + '-' + fecha.getDate().toString().padStart(2, '0')) + + APIClient.fetch(url, {method, body}).then(response => { + if (response.ok) { + return response.json().then(json => { + if (json.success) { + window.location.reload() + } + }) + } + }) + }) + }) + Array.from(document.getElementsByClassName('cancel_button')).forEach(button => { + button.addEventListener('click', clickEvent => { + const id = $(clickEvent.currentTarget).data('id') + const method = 'post' + const form = Array.from(document.getElementsByClassName('avance_pago_form')).filter(form => parseInt(form.dataset.id) === id)[0] + const pago = form.dataset.pago + const url = `{{$urls->api}}/ventas/pago/${pago}/devolver` + const body = new FormData() + const fecha = $(form).find('.ui.calendar').calendar('get date')[0] + body.set('fecha', fecha.getFullYear() + '-' + (fecha.getMonth() + 1).toString().padStart(2, '0') + '-' + fecha.getDate().toString().padStart(2, '0')) + + console.debug(url, body) + }) + }) }) @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 index 9b3336d..a02ef3b 100644 --- a/app/resources/views/ventas/escrituras/abono/cuotas/add_modal.blade.php +++ b/app/resources/views/ventas/escrituras/abono/cuotas/add_modal.blade.php @@ -25,13 +25,6 @@ -
- -
-
UF
- -
-
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 index 9e423a0..1bd143b 100644 --- a/app/resources/views/ventas/escrituras/abono/cuotas/edit_modal.blade.php +++ b/app/resources/views/ventas/escrituras/abono/cuotas/edit_modal.blade.php @@ -25,13 +25,6 @@
-
- -
-
UF
- -
-