mirror of
https://origin.cursor.com/mrdevmx/panels.git
synced 2026-10-09 21:43:17 +00:00
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Summary Implementa el módulo **Programa de obra** por proyecto, vinculado al presupuesto ya existente. ### Flujo 1. Cargar presupuesto (requisito) 2. Definir fechas de inicio/término en el proyecto 3. Crear programa: **importar Excel Neodata/Opus**, **generar automático** o **crear vacío** 4. Editar en cuadrícula (conceptos con `Barra=` y partidas con erogaciones semanales) 5. Visualizar Gantt resumido y comparativo **programado vs ejecutado** ### Backend - Tablas: `work_programs`, `work_program_periods`, `work_program_concept_slots`, `work_program_partida_amounts`, `work_program_progress` - RPC: list/get, replace (import), generate (wizard), update celdas, recalculate partidas, vs-cost - Parser Excel para formatos **por concepto** (`Barra=`) y **por partida** (montos semanales) - Tests con fixtures reales del usuario ### Frontend - Nueva página `/programa-obra` con pestañas: Conceptos, Partidas, Gantt, Programado vs costos - Diálogos de importación y generación automática - Menú principal, enlace en ficha de proyecto, banner en presupuesto ### Permisos Reutiliza `manage_budget` en MVP. ## Test plan - [x] `deno test api/work_program_excel_test.ts` (5 tests) - [x] `deno check` API modules - [x] `npm run build` web-panel - [ ] Migrar DB (`029`, `030`) en entorno con Postgres - [ ] Importar Excel por concepto y por partida en obra con presupuesto - [ ] Generar automático con estrategia keyword - [ ] Recalcular partidas desde conceptos - [ ] Verificar tab Programado vs costos con gastos registrados <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-3985fe74-d26b-4506-bd4d-f9ad57374141?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-3985fe74-d26b-4506-bd4d-f9ad57374141&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div>
84 lines
3.3 KiB
Vue
84 lines
3.3 KiB
Vue
<template>
|
|
<div>
|
|
<div v-if="summary.length" class="kpi-row mb-3">
|
|
<div class="kpi-card">
|
|
<span class="kpi-label">Programado total</span>
|
|
<strong>{{ money(totalScheduled) }}</strong>
|
|
</div>
|
|
<div class="kpi-card">
|
|
<span class="kpi-label">Ejecutado total</span>
|
|
<strong>{{ money(totalExecuted) }}</strong>
|
|
</div>
|
|
<div class="kpi-card">
|
|
<span class="kpi-label">Δ acumulado</span>
|
|
<strong :class="deltaClass">{{ money(totalExecuted - totalScheduled) }}</strong>
|
|
</div>
|
|
</div>
|
|
|
|
<DataTable :value="summary" scrollable scroll-height="40vh" size="small" table-style="min-width: 52rem">
|
|
<Column field="label" header="Semana" />
|
|
<Column field="scheduled_amount" header="Programado">
|
|
<template #body="{ data }">{{ money(data.scheduled_amount) }}</template>
|
|
</Column>
|
|
<Column field="executed_amount" header="Ejecutado">
|
|
<template #body="{ data }">{{ money(data.executed_amount) }}</template>
|
|
</Column>
|
|
<Column header="Δ">
|
|
<template #body="{ data }">
|
|
<span :class="Number(data.executed_amount) > Number(data.scheduled_amount) ? 'cost-critical-text' : ''">
|
|
{{ money(Number(data.executed_amount) - Number(data.scheduled_amount)) }}
|
|
</span>
|
|
</template>
|
|
</Column>
|
|
</DataTable>
|
|
|
|
<div class="section-title mt-4 mb-2">Por partida</div>
|
|
<DataTable :value="byChapter" size="small" scrollable scroll-height="28vh">
|
|
<Column field="chapter_code" header="Código" style="width: 6rem" />
|
|
<Column field="chapter_name" header="Partida" />
|
|
<Column field="scheduled_amount" header="Programado">
|
|
<template #body="{ data }">{{ money(data.scheduled_amount) }}</template>
|
|
</Column>
|
|
<Column field="executed_amount" header="Ejecutado">
|
|
<template #body="{ data }">{{ money(data.executed_amount) }}</template>
|
|
</Column>
|
|
<Column field="budget_amount" header="Presupuesto">
|
|
<template #body="{ data }">{{ money(data.budget_amount) }}</template>
|
|
</Column>
|
|
</DataTable>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const props = defineProps<{
|
|
byPeriod: { label: string; scheduled_amount: number; executed_amount: number }[];
|
|
byChapter: { chapter_code: string; chapter_name: string; scheduled_amount: number; executed_amount: number; budget_amount: number }[];
|
|
}>();
|
|
|
|
const summary = computed(() => props.byPeriod || []);
|
|
const byChapter = computed(() => props.byChapter || []);
|
|
|
|
const totalScheduled = computed(() => summary.value.reduce((s, r) => s + Number(r.scheduled_amount || 0), 0));
|
|
const totalExecuted = computed(() => summary.value.reduce((s, r) => s + Number(r.executed_amount || 0), 0));
|
|
const deltaClass = computed(() => (totalExecuted.value > totalScheduled.value ? "cost-critical-text" : ""));
|
|
|
|
function money(v: number) {
|
|
return new Intl.NumberFormat("es-MX", { style: "currency", currency: "MXN" }).format(Number(v || 0));
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.kpi-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
|
|
.kpi-card {
|
|
flex: 1;
|
|
min-width: 9rem;
|
|
padding: 0.65rem 0.85rem;
|
|
border: 1px solid var(--surface-border);
|
|
border-radius: 8px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.2rem;
|
|
}
|
|
.kpi-label { font-size: 0.75rem; color: var(--text-color-secondary); }
|
|
.section-title { font-weight: 600; font-size: 0.9rem; }
|
|
</style>
|