| @ -0,0 +1,40 @@ | |||
| """Añado campos para kms recorridos y consumo | |||
| Revision ID: 9e2101dd8240 | |||
| Revises: | |||
| Create Date: 2024-08-02 10:21:54.566834 | |||
| """ | |||
| from alembic import op | |||
| import sqlalchemy as sa | |||
| # revision identifiers, used by Alembic. | |||
| revision = '9e2101dd8240' | |||
| down_revision = None | |||
| branch_labels = None | |||
| depends_on = None | |||
| def upgrade(): | |||
| # ### commands auto generated by Alembic - please adjust! ### | |||
| with op.batch_alter_table('repostajes', schema=None) as batch_op: | |||
| batch_op.add_column(sa.Column('kmsrecorridos', sa.Integer(), nullable=False)) | |||
| batch_op.add_column(sa.Column('consumo', sa.Integer(), nullable=False)) | |||
| with op.batch_alter_table('user', schema=None) as batch_op: | |||
| batch_op.create_unique_constraint(batch_op.f('uq_user_username'), ['username']) | |||
| # ### end Alembic commands ### | |||
| def downgrade(): | |||
| # ### commands auto generated by Alembic - please adjust! ### | |||
| with op.batch_alter_table('user', schema=None) as batch_op: | |||
| batch_op.drop_constraint(batch_op.f('uq_user_username'), type_='unique') | |||
| with op.batch_alter_table('repostajes', schema=None) as batch_op: | |||
| batch_op.drop_column('consumo') | |||
| batch_op.drop_column('kmsrecorridos') | |||
| # ### end Alembic commands ### | |||
| @ -0,0 +1,40 @@ | |||
| """Añado campos para kms recorridos y consumo. Valor por defecto = 0 | |||
| Revision ID: d880c87e5133 | |||
| Revises: df26e0c43964 | |||
| Create Date: 2024-08-02 10:27:56.828732 | |||
| """ | |||
| from alembic import op | |||
| import sqlalchemy as sa | |||
| # revision identifiers, used by Alembic. | |||
| revision = 'd880c87e5133' | |||
| down_revision = 'df26e0c43964' | |||
| branch_labels = None | |||
| depends_on = None | |||
| def upgrade(): | |||
| # ### commands auto generated by Alembic - please adjust! ### | |||
| with op.batch_alter_table('repostajes', schema=None) as batch_op: | |||
| batch_op.add_column(sa.Column('kmsrecorridos', sa.Integer(), nullable=True)) | |||
| batch_op.add_column(sa.Column('consumo', sa.Integer(), nullable=True)) | |||
| with op.batch_alter_table('user', schema=None) as batch_op: | |||
| batch_op.create_unique_constraint(batch_op.f('uq_user_username'), ['username']) | |||
| # ### end Alembic commands ### | |||
| def downgrade(): | |||
| # ### commands auto generated by Alembic - please adjust! ### | |||
| with op.batch_alter_table('user', schema=None) as batch_op: | |||
| batch_op.drop_constraint(batch_op.f('uq_user_username'), type_='unique') | |||
| with op.batch_alter_table('repostajes', schema=None) as batch_op: | |||
| batch_op.drop_column('consumo') | |||
| batch_op.drop_column('kmsrecorridos') | |||
| # ### end Alembic commands ### | |||
| @ -0,0 +1,40 @@ | |||
| """Añado campos para kms recorridos y consumo. Valor por defecto = 0 | |||
| Revision ID: df26e0c43964 | |||
| Revises: 9e2101dd8240 | |||
| Create Date: 2024-08-02 10:26:40.424171 | |||
| """ | |||
| from alembic import op | |||
| import sqlalchemy as sa | |||
| # revision identifiers, used by Alembic. | |||
| revision = 'df26e0c43964' | |||
| down_revision = '9e2101dd8240' | |||
| branch_labels = None | |||
| depends_on = None | |||
| def upgrade(): | |||
| # ### commands auto generated by Alembic - please adjust! ### | |||
| with op.batch_alter_table('repostajes', schema=None) as batch_op: | |||
| batch_op.add_column(sa.Column('kmsrecorridos', sa.Integer(), nullable=False)) | |||
| batch_op.add_column(sa.Column('consumo', sa.Integer(), nullable=False)) | |||
| with op.batch_alter_table('user', schema=None) as batch_op: | |||
| batch_op.create_unique_constraint(batch_op.f('uq_user_username'), ['username']) | |||
| # ### end Alembic commands ### | |||
| def downgrade(): | |||
| # ### commands auto generated by Alembic - please adjust! ### | |||
| with op.batch_alter_table('user', schema=None) as batch_op: | |||
| batch_op.drop_constraint(batch_op.f('uq_user_username'), type_='unique') | |||
| with op.batch_alter_table('repostajes', schema=None) as batch_op: | |||
| batch_op.drop_column('consumo') | |||
| batch_op.drop_column('kmsrecorridos') | |||
| # ### end Alembic commands ### | |||
| @ -0,0 +1,28 @@ | |||
| <table class="table app-table-hover mb-0 text-left"> | |||
| <thead> | |||
| <tr> | |||
| <th class="cell">#</th> | |||
| <th class="cell">Fecha</th> | |||
| <th class="cell">Vehículo</th> | |||
| <th class="cell">Kilómetros</th> | |||
| <th class="cell">Litros</th> | |||
| <th class="cell">Descuento</th> | |||
| <th class="cell">Precio/litro</th> | |||
| <th class="cell">Importe</th> | |||
| </tr> | |||
| </thead> | |||
| <tbody> | |||
| {% for repostaje in repostajes %} | |||
| <tr> | |||
| <td class="cell">{{ repostaje.id }}</td> | |||
| <td class="cell">{{ repostaje.fecha }}</td> | |||
| <td class="cell">{{ repostaje.vehiculos.matricula }}</td> | |||
| <td style="text-align: right" class="cell">{{ "%.0f"|format(repostaje.kms) }}</td> | |||
| <td style="text-align: right" class="cell">{{ "%.2f €"|format(repostaje.litros) }}</td> | |||
| <td style="text-align: right" class="cell">{{ "%.2f €"|format(repostaje.descuento) }}</td> | |||
| <td style="text-align: right" class="cell">{{ "%.2f €"|format(repostaje.precioxlitro) }}</td> | |||
| <td style="text-align: right" class="cell">{{ "%.2f €"|format(repostaje.importe) }}</td> | |||
| </tr> | |||
| {% endfor %} | |||
| </tbody> | |||
| </table> | |||
| @ -0,0 +1,39 @@ | |||
| <table class="table mb-0 text-left"> | |||
| <thead> | |||
| <tr> | |||
| <th class="cell">#</th> | |||
| <th class="cell">Fecha</th> | |||
| <th class="cell">Vehículo</th> | |||
| <th class="cell">Kilómetros</th> | |||
| <th class="cell">Litros</th> | |||
| <th class="cell">Descuento</th> | |||
| <th class="cell">Precio/litro</th> | |||
| <th class="cell">Importe</th> | |||
| <th class="cell">Recorridos</th> | |||
| <th class="cell">Consumo/100kms</th> | |||
| </tr> | |||
| </thead> | |||
| <tbody> | |||
| {% for repostaje in repostajes %} | |||
| {% if repostaje.vehiculo_id == vehiculo.id %} | |||
| <tr> | |||
| <td class="cell">{{ repostaje.id }}</td> | |||
| <td class="cell">{{ repostaje.fecha }}</td> | |||
| <td class="cell">{{ repostaje.vehiculos.matricula }}</td> | |||
| <td style="text-align: right" class="cell">{{ "%.0f"|format(repostaje.kms) }}</td> | |||
| <td style="text-align: right" class="cell">{{ "%.2f €"|format(repostaje.litros) }}</td> | |||
| <td style="text-align: right" class="cell">{{ "%.2f €"|format(repostaje.descuento) }}</td> | |||
| <td style="text-align: right" class="cell">{{ "%.2f €"|format(repostaje.precioxlitro) }}</td> | |||
| <td style="text-align: right" class="cell">{{ "%.2f €"|format(repostaje.importe) }}</td> | |||
| <td style="text-align: right" class="cell">{{ "%.2f €"|format(repostaje.kmsrecorridos) }}</td> | |||
| <td style="text-align: right" class="cell">{{ "%.2f €"|format(repostaje.consumo) }}</td> | |||
| </tr> | |||
| {% endif %} | |||
| {% endfor %} | |||
| </tbody> | |||
| </table> | |||