DATEV-Automatikkonten mit Bruttobeträgen exportieren
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 1m3s
Build and Push Docker Images / build-frontend (push) Successful in 35s
Build and Push Docker Images / build-website (push) Successful in 35s
Build and Push Docker Images / build-central-services-api (push) Successful in 34s
Build and Push Docker Images / build-docs (push) Successful in 34s
Build and Push Docker Images / build-central-services-admin (push) Successful in 35s
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 1m3s
Build and Push Docker Images / build-frontend (push) Successful in 35s
Build and Push Docker Images / build-website (push) Successful in 35s
Build and Push Docker Images / build-central-services-api (push) Successful in 34s
Build and Push Docker Images / build-docs (push) Successful in 34s
Build and Push Docker Images / build-central-services-admin (push) Successful in 35s
This commit is contained in:
@@ -93,7 +93,7 @@ const getIncomingInvoiceTaxOverride = (invoice: any) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCreatedDocumentRevenueLines = (document: any) => {
|
export const getCreatedDocumentRevenueLines = (document: any) => {
|
||||||
const totals = getCreatedDocumentTotal(document);
|
const totals = getCreatedDocumentTotal(document);
|
||||||
|
|
||||||
if (document.taxType === "13b UStG") {
|
if (document.taxType === "13b UStG") {
|
||||||
@@ -105,8 +105,8 @@ const getCreatedDocumentRevenueLines = (document: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{ account: "8400", amount: Number(totals.net19.toFixed(2)) },
|
{ account: "8400", amount: Number((totals.net19 + totals.total19).toFixed(2)) },
|
||||||
{ account: "8334", amount: Number(totals.net7.toFixed(2)) },
|
{ account: "8334", amount: Number((totals.net7 + totals.total7).toFixed(2)) },
|
||||||
{ account: "8290", amount: Number(totals.net0.toFixed(2)) },
|
{ account: "8290", amount: Number(totals.net0.toFixed(2)) },
|
||||||
].filter((line) => line.amount !== 0);
|
].filter((line) => line.amount !== 0);
|
||||||
};
|
};
|
||||||
|
|||||||
29
backend/tests/datevExport.test.ts
Normal file
29
backend/tests/datevExport.test.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import test from "node:test";
|
||||||
|
import { getCreatedDocumentRevenueLines } from "../src/utils/export/datev";
|
||||||
|
|
||||||
|
test("exports gross amounts for DATEV automatic revenue accounts", () => {
|
||||||
|
const revenueLines = getCreatedDocumentRevenueLines({
|
||||||
|
rows: [
|
||||||
|
{ mode: "position", quantity: 1, price: 100, discountPercent: 0, taxPercent: 19 },
|
||||||
|
{ mode: "position", quantity: 2, price: 50, discountPercent: 0, taxPercent: 7 },
|
||||||
|
{ mode: "position", quantity: 1, price: 50, discountPercent: 0, taxPercent: 0 },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(revenueLines, [
|
||||||
|
{ account: "8400", amount: 119 },
|
||||||
|
{ account: "8334", amount: 107 },
|
||||||
|
{ account: "8290", amount: 50 },
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("preserves negative gross amounts for cancellations", () => {
|
||||||
|
const revenueLines = getCreatedDocumentRevenueLines({
|
||||||
|
rows: [
|
||||||
|
{ mode: "position", quantity: -1, price: 100, discountPercent: 0, taxPercent: 19 },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(revenueLines, [{ account: "8400", amount: -119 }]);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user