diff --git a/.vscode/launch.json b/.vscode/launch.json index 1c27231c..40d4a6b9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,5 +1,4 @@ { - "version": "0.6.2", "configurations": [ { "name": "WEB: Vite (Chrome)", diff --git a/apps/server/package.json b/apps/server/package.json index 42478500..99be28f6 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -1,6 +1,6 @@ { "name": "@erp/factuges-server", - "version": "0.6.2", + "version": "0.6.3", "private": true, "scripts": { "build": "tsup src/index.ts --config tsup.config.ts", diff --git a/apps/web/package.json b/apps/web/package.json index cf0cea65..5720fac4 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -1,7 +1,7 @@ { "name": "@erp/factuges-web", "private": true, - "version": "0.6.2", + "version": "0.6.3", "type": "module", "scripts": { "dev": "vite --host --clearScreen false", diff --git a/modules/auth/package.json b/modules/auth/package.json index ce0848fe..481e1b6d 100644 --- a/modules/auth/package.json +++ b/modules/auth/package.json @@ -1,6 +1,6 @@ { "name": "@erp/auth", - "version": "0.6.2", + "version": "0.6.3", "private": true, "type": "module", "sideEffects": false, diff --git a/modules/core/package.json b/modules/core/package.json index 5f9a9086..c7a4c6c2 100644 --- a/modules/core/package.json +++ b/modules/core/package.json @@ -1,6 +1,6 @@ { "name": "@erp/core", - "version": "0.6.2", + "version": "0.6.3", "private": true, "type": "module", "sideEffects": false, diff --git a/modules/customer-invoices/package.json b/modules/customer-invoices/package.json index 5d76875b..3ba001e6 100644 --- a/modules/customer-invoices/package.json +++ b/modules/customer-invoices/package.json @@ -1,6 +1,6 @@ { "name": "@erp/customer-invoices", - "version": "0.6.2", + "version": "0.6.3", "private": true, "type": "module", "sideEffects": false, diff --git a/modules/customer-invoices/src/api/application/issued-invoices/snapshot-builders/report/issued-invoice-report-snapshot-builder.ts b/modules/customer-invoices/src/api/application/issued-invoices/snapshot-builders/report/issued-invoice-report-snapshot-builder.ts index dac74328..3b40ec6f 100644 --- a/modules/customer-invoices/src/api/application/issued-invoices/snapshot-builders/report/issued-invoice-report-snapshot-builder.ts +++ b/modules/customer-invoices/src/api/application/issued-invoices/snapshot-builders/report/issued-invoice-report-snapshot-builder.ts @@ -1,5 +1,6 @@ -import { DateHelper, MoneyDTOHelper, PercentageDTOHelper } from "@erp/core"; +import { MoneyDTOHelper, PercentageDTOHelper } from "@erp/core"; import type { ISnapshotBuilder, ISnapshotBuilderParams } from "@erp/core/api"; +import { DateHelper } from "@repo/rdx-utils"; import type { IIssuedInvoiceFullSnapshot } from "../full"; diff --git a/modules/customer-invoices/src/api/application/proformas/mappers/create-proforma-input.mapper.ts b/modules/customer-invoices/src/api/application/proformas/mappers/create-proforma-input.mapper.ts index 3bceabf0..1cfc2df7 100644 --- a/modules/customer-invoices/src/api/application/proformas/mappers/create-proforma-input.mapper.ts +++ b/modules/customer-invoices/src/api/application/proformas/mappers/create-proforma-input.mapper.ts @@ -1,4 +1,3 @@ -import { NumberHelper } from "@erp/core"; import { DiscountPercentage } from "@erp/core/api"; import { CurrencyCode, @@ -12,7 +11,7 @@ import { extractOrPushError, maybeFromNullableResult, } from "@repo/rdx-ddd"; -import { Maybe, Result } from "@repo/rdx-utils"; +import { Maybe, NumberHelper, Result } from "@repo/rdx-utils"; import type { CreateProformaRequestDTO } from "../../../../common"; import { diff --git a/modules/customer-invoices/src/api/application/proformas/mappers/update-proforma-input.mapper.ts b/modules/customer-invoices/src/api/application/proformas/mappers/update-proforma-input.mapper.ts index 0c2d98e4..8a8e7395 100644 --- a/modules/customer-invoices/src/api/application/proformas/mappers/update-proforma-input.mapper.ts +++ b/modules/customer-invoices/src/api/application/proformas/mappers/update-proforma-input.mapper.ts @@ -1,4 +1,3 @@ -import { NumberHelper } from "@erp/core"; import { DiscountPercentage } from "@erp/core/api"; import { CurrencyCode, @@ -12,7 +11,7 @@ import { extractOrPushError, maybeFromNullableResult, } from "@repo/rdx-ddd"; -import { Result, isNullishOrEmpty, toPatchField } from "@repo/rdx-utils"; +import { NumberHelper, Result, isNullishOrEmpty, toPatchField } from "@repo/rdx-utils"; import type { UpdateProformaByIdRequestDTO } from "../../../../common/dto"; import { diff --git a/modules/customer-invoices/src/api/application/proformas/services/proforma-public-services.interface.ts b/modules/customer-invoices/src/api/application/proformas/services/proforma-public-services.interface.ts index abe1a25f..b7911bff 100644 --- a/modules/customer-invoices/src/api/application/proformas/services/proforma-public-services.interface.ts +++ b/modules/customer-invoices/src/api/application/proformas/services/proforma-public-services.interface.ts @@ -2,7 +2,7 @@ import type { UniqueID } from "@repo/rdx-ddd"; import type { Result } from "@repo/rdx-utils"; import type { Proforma } from "../../../domain/proformas"; -import type { IProformaFullSnapshot } from "../snapshot-builders"; +import type { ProformaFullSnapshot } from "../snapshot-builders"; import type { IProformaCreatorParams } from "./proforma-creator"; @@ -35,7 +35,7 @@ export interface IProformaPublicServices { getProformaSnapshotById: ( id: UniqueID, context: IProformaServicesContext - ) => Promise>; + ) => Promise>; generateProformaReport: (id: unknown, options: unknown, context: unknown) => null; } diff --git a/modules/customer-invoices/src/api/application/proformas/snapshot-builders/full/proforma-full-snapshot-builder.ts b/modules/customer-invoices/src/api/application/proformas/snapshot-builders/full/proforma-full-snapshot-builder.ts index 0f658e3d..6a16137c 100644 --- a/modules/customer-invoices/src/api/application/proformas/snapshot-builders/full/proforma-full-snapshot-builder.ts +++ b/modules/customer-invoices/src/api/application/proformas/snapshot-builders/full/proforma-full-snapshot-builder.ts @@ -8,8 +8,10 @@ import type { IProformaItemsFullSnapshotBuilder } from "./proforma-items-full-sn import type { IProformaRecipientFullSnapshotBuilder } from "./proforma-recipient-full-snapshot-builder"; import type { IProformaTaxesFullSnapshotBuilder } from "./proforma-taxes-full-snapshot-builder"; +export type ProformaFullSnapshot = GetProformaByIdResponseDTO; + export interface IProformaFullSnapshotBuilder - extends ISnapshotBuilder {} + extends ISnapshotBuilder {} export class ProformaFullSnapshotBuilder implements IProformaFullSnapshotBuilder { constructor( @@ -19,7 +21,7 @@ export class ProformaFullSnapshotBuilder implements IProformaFullSnapshotBuilder //private readonly paymentMethodBuilder: IProformaPaymentMethodFullSnapshotBuilder ) {} - toOutput(proforma: Proforma): GetProformaByIdResponseDTO { + toOutput(proforma: Proforma): ProformaFullSnapshot { const items = this.itemsBuilder.toOutput(proforma.items); const recipient = this.recipientBuilder.toOutput(proforma); const taxes = this.taxesBuilder.toOutput(proforma.taxes()); @@ -37,7 +39,7 @@ export class ProformaFullSnapshotBuilder implements IProformaFullSnapshotBuilder company_id: proforma.companyId.toString(), invoice_number: proforma.invoiceNumber.toString(), - status: proforma.status.toPrimitive() as GetProformaByIdResponseDTO["status"], + status: proforma.status.toPrimitive() as ProformaFullSnapshot["status"], series: maybeToNullable(proforma.series, (value) => value.toString()), invoice_date: proforma.invoiceDate.toDateString(), diff --git a/modules/customer-invoices/src/api/application/proformas/snapshot-builders/report/proforma-items-report-snapshot-builder.ts b/modules/customer-invoices/src/api/application/proformas/snapshot-builders/report/proforma-items-report-snapshot-builder.ts index 1b0b72d1..ab927071 100644 --- a/modules/customer-invoices/src/api/application/proformas/snapshot-builders/report/proforma-items-report-snapshot-builder.ts +++ b/modules/customer-invoices/src/api/application/proformas/snapshot-builders/report/proforma-items-report-snapshot-builder.ts @@ -1,16 +1,16 @@ import { MoneyDTOHelper, PercentageDTOHelper, QuantityDTOHelper } from "@erp/core"; import type { ISnapshotBuilder, ISnapshotBuilderParams } from "@erp/core/api"; -import type { IProformaFullSnapshot } from "../full"; +import type { ProformaFullSnapshot } from "../full"; import type { ProformaReportItemSnapshot } from "./proforma-report-item-snapshot.interface"; export interface IProformaItemReportSnapshotBuilder - extends ISnapshotBuilder {} + extends ISnapshotBuilder {} export class ProformaItemReportSnapshotBuilder implements IProformaItemReportSnapshotBuilder { toOutput( - items: IProformaFullSnapshot["items"], + items: ProformaFullSnapshot["items"], params?: ISnapshotBuilderParams ): ProformaReportItemSnapshot[] { const locale = params?.locale as string; diff --git a/modules/customer-invoices/src/api/application/proformas/snapshot-builders/report/proforma-report-snapshot-builder.ts b/modules/customer-invoices/src/api/application/proformas/snapshot-builders/report/proforma-report-snapshot-builder.ts index 9f058191..b906e9ca 100644 --- a/modules/customer-invoices/src/api/application/proformas/snapshot-builders/report/proforma-report-snapshot-builder.ts +++ b/modules/customer-invoices/src/api/application/proformas/snapshot-builders/report/proforma-report-snapshot-builder.ts @@ -1,29 +1,30 @@ -import { DateHelper, MoneyDTOHelper, PercentageDTOHelper } from "@erp/core"; +import { MoneyDTOHelper, PercentageDTOHelper } from "@erp/core"; import type { ISnapshotBuilder, ISnapshotBuilderParams } from "@erp/core/api"; +import { DateHelper } from "@repo/rdx-utils"; -import type { IProformaFullSnapshot } from "../full"; +import type { ProformaFullSnapshot } from "../full"; import type { ProformaReportItemSnapshot } from "./proforma-report-item-snapshot.interface"; import type { ProformaReportSnapshot } from "./proforma-report-snapshot.interface"; import type { ProformaReportTaxSnapshot } from "./proforma-report-tax-snapshot.interface"; export interface IProformaReportSnapshotBuilder - extends ISnapshotBuilder {} + extends ISnapshotBuilder {} export class ProformaReportSnapshotBuilder implements IProformaReportSnapshotBuilder { constructor( private readonly itemsBuilder: ISnapshotBuilder< - IProformaFullSnapshot["items"], + ProformaFullSnapshot["items"], ProformaReportItemSnapshot[] >, private readonly taxesBuilder: ISnapshotBuilder< - IProformaFullSnapshot["taxes"], + ProformaFullSnapshot["taxes"], ProformaReportTaxSnapshot[] > ) {} toOutput( - snapshot: IProformaFullSnapshot, + snapshot: ProformaFullSnapshot, params?: ISnapshotBuilderParams ): ProformaReportSnapshot { const locale = params?.locale as string; @@ -90,7 +91,7 @@ export class ProformaReportSnapshotBuilder implements IProformaReportSnapshotBui }; } - private formatAddress(recipient: IProformaFullSnapshot["recipient"]): string { + private formatAddress(recipient: ProformaFullSnapshot["recipient"]): string { const lines: string[] = []; if (recipient.street) lines.push(recipient.street); diff --git a/modules/customer-invoices/src/api/application/snapshot-builders/reports/issued-invoices/issued-invoice.report.presenter.ts b/modules/customer-invoices/src/api/application/snapshot-builders/reports/issued-invoices/issued-invoice.report.presenter.ts index 44699b82..b62c2ad1 100644 --- a/modules/customer-invoices/src/api/application/snapshot-builders/reports/issued-invoices/issued-invoice.report.presenter.ts +++ b/modules/customer-invoices/src/api/application/snapshot-builders/reports/issued-invoices/issued-invoice.report.presenter.ts @@ -1,5 +1,6 @@ -import { DateHelper, MoneyDTOHelper, PercentageDTOHelper } from "@erp/core"; +import { MoneyDTOHelper, PercentageDTOHelper } from "@erp/core"; import { Presenter } from "@erp/core/api"; +import { DateHelper } from "@repo/rdx-utils"; import type { GetIssuedInvoiceByIdResponseDTO } from "../../../../../common/dto"; diff --git a/modules/customer-invoices/src/api/domain/proformas/services/proforma-items-totals-calculator.ts b/modules/customer-invoices/src/api/domain/proformas/services/proforma-items-totals-calculator.ts index 0333d01a..542684b2 100644 --- a/modules/customer-invoices/src/api/domain/proformas/services/proforma-items-totals-calculator.ts +++ b/modules/customer-invoices/src/api/domain/proformas/services/proforma-items-totals-calculator.ts @@ -47,28 +47,26 @@ export class ProformaItemsTotalsCalculator { const amounts = item.totals(); // Subtotales - subtotalAmount = subtotalAmount.add(amounts.subtotalAmount.roundUsingScale(2)); + subtotalAmount = subtotalAmount.add(amounts.subtotalAmount); // Descuentos - itemDiscountAmount = itemDiscountAmount.add(amounts.itemDiscountAmount.roundUsingScale(2)); - globalDiscountAmount = globalDiscountAmount.add( - amounts.globalDiscountAmount.roundUsingScale(2) - ); - totalDiscountAmount = totalDiscountAmount.add(amounts.totalDiscountAmount.roundUsingScale(2)); + itemDiscountAmount = itemDiscountAmount.add(amounts.itemDiscountAmount); + globalDiscountAmount = globalDiscountAmount.add(amounts.globalDiscountAmount); + totalDiscountAmount = totalDiscountAmount.add(amounts.totalDiscountAmount); // Base imponible - taxableAmount = taxableAmount.add(amounts.taxableAmount.roundUsingScale(2)); + taxableAmount = taxableAmount.add(amounts.taxableAmount); // Impuestos individuales - ivaAmount = ivaAmount.add(amounts.ivaAmount.roundUsingScale(2)); - recAmount = recAmount.add(amounts.recAmount.roundUsingScale(2)); - retentionAmount = retentionAmount.add(amounts.retentionAmount.roundUsingScale(2)); + ivaAmount = ivaAmount.add(amounts.ivaAmount); + recAmount = recAmount.add(amounts.recAmount); + retentionAmount = retentionAmount.add(amounts.retentionAmount); // Total impuestos del ítem - taxesAmount = taxesAmount.add(amounts.taxesAmount.roundUsingScale(2)); + taxesAmount = taxesAmount.add(amounts.taxesAmount); // Total final del ítem - totalAmount = totalAmount.add(amounts.totalAmount.roundUsingScale(2)); + totalAmount = totalAmount.add(amounts.totalAmount); } return { diff --git a/modules/customer-invoices/src/api/domain/proformas/services/proforma-taxes-calculator.ts b/modules/customer-invoices/src/api/domain/proformas/services/proforma-taxes-calculator.ts index 1288292b..2cc3073c 100644 --- a/modules/customer-invoices/src/api/domain/proformas/services/proforma-taxes-calculator.ts +++ b/modules/customer-invoices/src/api/domain/proformas/services/proforma-taxes-calculator.ts @@ -37,6 +37,7 @@ export class ProformaTaxesCalculator { const ivaAmount = this.toInvoiceAmount(g.ivaAmount); const recAmount = this.toInvoiceAmount(g.recAmount); const retentionAmount = this.toInvoiceAmount(g.retentionAmount); + //const taxesAmount = this.toInvoiceAmount(g.taxesAmount); const taxesAmount = ivaAmount.add(recAmount).subtract(retentionAmount); diff --git a/modules/customer-invoices/src/api/infrastructure/proformas/di/proforma-public-services.ts b/modules/customer-invoices/src/api/infrastructure/proformas/di/proforma-public-services.ts index 8de5d95f..1cc67a37 100644 --- a/modules/customer-invoices/src/api/infrastructure/proformas/di/proforma-public-services.ts +++ b/modules/customer-invoices/src/api/infrastructure/proformas/di/proforma-public-services.ts @@ -5,7 +5,7 @@ import type { Transaction } from "sequelize"; import { type IProformaCreatorParams, - type IProformaFullSnapshot, + type ProformaFullSnapshot, buildProformaCreator, buildProformaFinder, buildProformaSnapshotBuilders, @@ -36,7 +36,7 @@ export type ProformaPublicServices = { getProformaSnapshotById: ( id: UniqueID, context: ProformaServicesContext - ) => Promise>; + ) => Promise>; createProforma: ( id: UniqueID, diff --git a/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-taxes-card.tsx b/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-taxes-card.tsx new file mode 100644 index 00000000..65bf5e5a --- /dev/null +++ b/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-taxes-card.tsx @@ -0,0 +1,193 @@ +import { + Card, + CardContent, + CardHeader, + CardTitle, + Checkbox, + Field, + FieldContent, + FieldDescription, + FieldGroup, + FieldLabel, + FieldSet, + Input, + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@repo/shadcn-ui/components"; +import { FileText } from "lucide-react"; + +export const ProformaTaxesCard = () => { + return ( + + +
+
+
+ +
+ Impuestos +

Configuración fiscal de la proforma

+
+
+
+ + +
+ + + + + Régimen fiscal + + + + +
+
+ +
+
+ + + + + + + + Aplicar el mismo IVA a todas las líneas de la proforma + + + + + + IVA por defecto + + + + + +
+
+ + +
+ + + +
+ + + +
+ + + Retención + +
+ + + +
+
+
+
+
+
+ ); +}; + +interface SectionIntroProps { + title: string; + description: string; + variant?: "default" | "primary"; +} + +const SectionIntro = ({ title, description, variant = "default" }: SectionIntroProps) => { + return ( + + +

+ {title} +

+ + {description} +
+
+ ); +}; + +interface CheckboxFieldProps { + id: string; + label: string; +} + +const CheckboxField = ({ id, label }: CheckboxFieldProps) => { + return ( + + + + + {label} + + + ); +}; diff --git a/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-update-editor-form.tsx b/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-update-editor-form.tsx index cde0e129..107b559a 100644 --- a/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-update-editor-form.tsx +++ b/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-update-editor-form.tsx @@ -14,6 +14,7 @@ import type { } from "../../controllers"; import { ProformaTotalsSummary } from "../blocks"; +import { ProformaTaxesCard } from "./proforma-taxes-card"; import { ProformaUpdateHeaderEditor } from "./proforma-update-header-editor"; import { ProformaUpdateItemsEditor } from "./proforma-update-items-editor"; import { ProformaUpdateTaxEditor } from "./proforma-update-tax-editor"; @@ -74,6 +75,10 @@ export const ProformaUpdateEditorForm = ({ +
+ +
+
-
- -
- {icon ? ( -
- {" "} - {icon}{" "} -
- ) : null} - -
- {title ? {title} : null} - {description ? ( - {description} - ) : null} + +
+ {icon ? ( +
+ {" "} + {icon}{" "}
-
-
+ ) : null} - {children} -
+
+ {title ? {title} : null} + {description ? ( + {description} + ) : null} +
+
+ + + {children} ); }; diff --git a/packages/rdx-utils/package.json b/packages/rdx-utils/package.json index b2872413..03497ab7 100644 --- a/packages/rdx-utils/package.json +++ b/packages/rdx-utils/package.json @@ -1,6 +1,6 @@ { "name": "@repo/rdx-utils", - "version": "0.6.2", + "version": "0.6.3", "private": true, "type": "module", "sideEffects": false, diff --git a/packages/shadcn-ui/src/styles/globals.css b/packages/shadcn-ui/src/styles/globals.css index 68060dc8..a7db38ae 100644 --- a/packages/shadcn-ui/src/styles/globals.css +++ b/packages/shadcn-ui/src/styles/globals.css @@ -13,14 +13,27 @@ @source "../**/*.{ts,tsx}"; :root { + --primary: #0b7ad0; + --primary-foreground: #ffffff; + + --primary-50: #eef8ff; + --primary-100: #d9efff; + --primary-200: #bce4ff; + --primary-300: #8ed3ff; + --primary-400: #58b8f4; + --primary-500: #2e9be4; + --primary-600: #0b7ad0; + --primary-700: #0862a8; + --primary-800: #0a528a; + --primary-900: #0d456f; + --primary-950: #092b49; + --background: #ffffff; --foreground: #0a0a0a; --card: #ffffff; --card-foreground: #0a0a0a; --popover: #ffffff; --popover-foreground: #0a0a0a; - --primary: #0b7ad0; - --primary-foreground: #ffffff; --secondary: #e4e8ef; --secondary-foreground: #6a8aa3; --muted: #f5f5f5; @@ -64,14 +77,27 @@ } .dark { + --primary: #125cff; + --primary-foreground: #eff6ff; + + --primary-50: #eff6ff; + --primary-100: #dbeafe; + --primary-200: #bfdbfe; + --primary-300: #93c5fd; + --primary-400: #60a5fa; + --primary-500: #3b82f6; + --primary-600: #125cff; + --primary-700: #1d4ed8; + --primary-800: #1e40af; + --primary-900: #1e3a8a; + --primary-950: #172554; + --background: #0a0a0a; --foreground: #fafafa; --card: #171717; --card-foreground: #fafafa; --popover: #171717; --popover-foreground: #fafafa; - --primary: #125cff; - --primary-foreground: #eff6ff; --secondary: #26262b; --secondary-foreground: #fafafa; --muted: #262626; @@ -107,6 +133,18 @@ } @theme inline { + --color-primary-50: var(--primary-50); + --color-primary-100: var(--primary-100); + --color-primary-200: var(--primary-200); + --color-primary-300: var(--primary-300); + --color-primary-400: var(--primary-400); + --color-primary-500: var(--primary-500); + --color-primary-600: var(--primary-600); + --color-primary-700: var(--primary-700); + --color-primary-800: var(--primary-800); + --color-primary-900: var(--primary-900); + --color-primary-950: var(--primary-950); + --color-background: var(--background); --color-foreground: var(--foreground); --color-card: var(--card); diff --git a/tools/fastreportcli-net-core-skia/FastReportCliGenerator/publish/linux/FastReportCliGenerator b/tools/fastreportcli-net-core-skia/FastReportCliGenerator/publish/linux/FastReportCliGenerator index d66b67e4..4da963d4 100755 Binary files a/tools/fastreportcli-net-core-skia/FastReportCliGenerator/publish/linux/FastReportCliGenerator and b/tools/fastreportcli-net-core-skia/FastReportCliGenerator/publish/linux/FastReportCliGenerator differ diff --git a/tools/fastreportcli-net-core-skia/FastReportCliGenerator/publish/windows/FastReportCliGenerator.exe b/tools/fastreportcli-net-core-skia/FastReportCliGenerator/publish/windows/FastReportCliGenerator.exe index 24bfa7fa..4291a074 100755 Binary files a/tools/fastreportcli-net-core-skia/FastReportCliGenerator/publish/windows/FastReportCliGenerator.exe and b/tools/fastreportcli-net-core-skia/FastReportCliGenerator/publish/windows/FastReportCliGenerator.exe differ