Compare commits

...

12 commits
main ... main

Author SHA1 Message Date
teutat3s a4f2aa7658
Merge pull request 'add check for user_company field, keep defaulting to user_name' (#4) from user_company into main
Reviewed-on: momo/invoiceplane-template#4
Reviewed-by: b12f <b12f@noreply.git.pub.solar>
2024-10-08 14:43:41 +00:00
teutat3s 099d168ef4
add check for user_company field, keep defaulting
to user_name. To use this, set the "Company" field in the user profile
2024-10-08 14:52:48 +02:00
teutat3s 8fd252d743
devshell: add phpactor LSP 2024-10-07 15:41:44 +02:00
teutat3s da9eac700b
flake: add lock file, update description, bump
nixpkgs to 24.05
2024-10-07 15:39:03 +02:00
teutat3s 08292f95f9
Update gitignore 2024-10-07 15:37:44 +02:00
teutat3s 6cf6f7d88d
flake: fix build for multiple target systems 2024-10-07 15:37:30 +02:00
teutat3s eaad78f00e
flake: also build for aarch64-linux 2024-10-07 15:37:22 +02:00
teutat3s d5e7cb73a8
Merge pull request 'dev: add editorconfig' (#3) from editorconfig into main
Reviewed-on: momo/invoiceplane-template#3
Reviewed-by: teutat3s <teutat3s@noreply.git.pub.solar>
2024-08-15 19:12:20 +00:00
b12f d59893ebcb
Merge pull request 'Improve check for non-existent variables' (#2) from custom-field-check-with-isset into main
Reviewed-on: momo/invoiceplane-template#2
Reviewed-by: teutat3s <teutat3s@noreply.git.pub.solar>
Reviewed-by: b12f <b12f@noreply.git.pub.solar>
2024-08-15 14:17:20 +00:00
b12f b0dabc8dfc
dev: add editorconfig 2024-08-15 16:00:19 +02:00
hensoko d8fb72b1b1
Update momo.php 2024-08-15 10:55:41 +02:00
Benjamin Yule Bädorf ba61a4fb5b
docs: add docs for custom fields, rename template 2024-08-12 11:31:37 +02:00
6 changed files with 219 additions and 57 deletions

76
.editorconfig Normal file
View file

@ -0,0 +1,76 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 2
# Ignore diffs/patches
[*.{diff,patch}]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_size = unset
charset = unset
indent_style = unset
indent_size = unset
[{.*,secrets}/**]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
charset = unset
indent_style = unset
indent_size = unset
[*.rom]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
charset = unset
indent_style = unset
indent_size = unset
[*.py]
indent_size = 4
[*.md]
max_line_length = off
trim_trailing_whitespace = false
# Ignore diffs/patches
[*.{diff,patch}]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_size = unset
charset = unset
indent_style = unset
indent_size = unset
[{.*,secrets}/**]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
charset = unset
indent_style = unset
indent_size = unset
[*.rom]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
charset = unset
indent_style = unset
indent_size = unset
[*.py]
indent_size = 4
[*.md]
max_line_length = off
trim_trailing_whitespace = false

1
.gitignore vendored
View file

@ -1 +1,2 @@
tags tags
result

View file

@ -8,10 +8,18 @@ This Template is adopted from the original one with some minor changes:
- Altered spacing and fields due to DIN 5008 - Altered spacing and fields due to DIN 5008
- Moved zip-code in front of city - Moved zip-code in front of city
This Template has hardcoded German text.
## Installation ## Installation
Simply add the files into `application/views/invoice_templates/pdf` and select them in Invoiceplane's *System Settings -> Invoices* as PDF templates. Simply add the files into `application/views/invoice_templates/pdf` and select them in Invoiceplane's *System Settings -> Invoices* as PDF templates.
### Extra fields
You can add a "Leistungszeitraum" for any invoice by defining the two custom date fields: `Leistungszeitraum-Anfang` and `Leistungszeitraum-Ende`. These will not be shown on the invoice if either is not set.
You can also add a description text for the full invoice by adding a text custom field called `Beschreibung`.
## Example ## Example
![Screenshot](screenshot.png) ![Screenshot](screenshot.png)

58
flake.lock Normal file
View file

@ -0,0 +1,58 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1727826117,
"narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1728193676,
"narHash": "sha256-PbDWAIjKJdlVg+qQRhzdSor04bAPApDqIv2DofTyynk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ecbc1ca8ffd6aea8372ad16be9ebbb39889e55b6",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1727825735,
"narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,8 +1,8 @@
{ {
description = "b12f invoiceplane template"; description = "momo invoiceplane template";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
}; };
@ -12,10 +12,18 @@
inputs.flake-parts.flakeModules.easyOverlay inputs.flake-parts.flakeModules.easyOverlay
]; ];
systems = [ "x86_64-linux" ]; systems = [ "x86_64-linux" "aarch64-linux" ];
perSystem = args@{ system, pkgs, lib, config, ... }: let perSystem = { config, pkgs, final, ... }: {
invoiceplane-template = pkgs.stdenv.mkDerivation { devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
phpactor
];
};
overlayAttrs = {
inherit (config.packages) invoiceplane-template;
};
packages.invoiceplane-template = pkgs.stdenv.mkDerivation {
name = "invoiceplane-template"; name = "invoiceplane-template";
src = ./.; src = ./.;
installPhase = '' installPhase = ''
@ -23,12 +31,6 @@
cp *.php $out/ cp *.php $out/
''; '';
}; };
in {
packages.default = invoiceplane-template;
packages.invoiceplane-template = invoiceplane-template;
overlayAttrs = {
inherit (config.packages) invoiceplane-template;
};
}; };
}; };
} }

View file

@ -104,9 +104,15 @@ footer .notes {
<div id="client"> <div id="client">
<div id="sichtfenster-absender"> <div id="sichtfenster-absender">
<?php if ($invoice->user_company !== ""): ?>
<?php
echo htmlsc($invoice->user_company) . ' - ' . htmlsc($invoice->user_address_1) . ' - ' . htmlsc($invoice->user_zip) . ' ' . htmlsc($invoice->user_city);
?>
<?php else: ?>
<?php <?php
echo htmlsc($invoice->user_name) . ' - ' . htmlsc($invoice->user_address_1) . ' - ' . htmlsc($invoice->user_zip) . ' ' . htmlsc($invoice->user_city); echo htmlsc($invoice->user_name) . ' - ' . htmlsc($invoice->user_address_1) . ' - ' . htmlsc($invoice->user_zip) . ' ' . htmlsc($invoice->user_city);
?> ?>
<?php endif; ?>
<hr /> <hr />
</div> </div>
<div> <div>
@ -159,7 +165,13 @@ footer .notes {
<!-- client is extracted due to absolute position --> <!-- client is extracted due to absolute position -->
<div id="company"> <div id="company">
<div><b><?php _htmlsc($invoice->user_name); ?></b></div> <div><b>
<?php if ($invoice->user_company !== "") : ?>
<?php _htmlsc($invoice->user_company); ?>
<?php else: ?>
<?php _htmlsc($invoice->user_name); ?>
<?php endif; ?>
</b></div>
<?php if ($invoice->user_vat_id) { <?php if ($invoice->user_vat_id) {
echo '<div>' . trans('vat_id_short') . ': ' . $invoice->user_vat_id . '</div>'; echo '<div>' . trans('vat_id_short') . ': ' . $invoice->user_vat_id . '</div>';
} }
@ -229,7 +241,7 @@ footer .notes {
<p class="invoice-meta"> <p class="invoice-meta">
Rechnungsnummer: <?php echo $invoice->invoice_number; ?><br /> Rechnungsnummer: <?php echo $invoice->invoice_number; ?><br />
<?php if ($custom_fields['invoice']['Leistungszeitraum-Anfang'] && $custom_fields['invoice']['Leistungszeitraum-Ende']): ?> <?php if (isset($custom_fields['invoice']['Leistungszeitraum-Anfang']) && isset($custom_fields['invoice']['Leistungszeitraum-Ende'])): ?>
Leistungszeitraum: Leistungszeitraum:
<?php echo date_from_mysql($custom_fields['invoice']['Leistungszeitraum-Anfang'], true); ?> <?php echo date_from_mysql($custom_fields['invoice']['Leistungszeitraum-Anfang'], true); ?>
- -
@ -237,7 +249,7 @@ footer .notes {
<?php endif; ?> <?php endif; ?>
</p> </p>
<?php if ($custom_fields['invoice']['Beschreibung']): ?> <?php if (isset($custom_fields['invoice']['Beschreibung'])): ?>
<p> <p>
<?php echo $custom_fields['invoice']['Beschreibung']; ?> <?php echo $custom_fields['invoice']['Beschreibung']; ?>
</p> </p>
@ -384,7 +396,12 @@ footer .notes {
<?php if (!$isPaid): ?> <?php if (!$isPaid): ?>
<p> <p>
Bitte überweisen Sie den Rechnungsbetrag innerhalb von <?php echo (-1 * $invoice->days_overdue); ?> Tagen auf untenstehendes Konto:<br /> Bitte überweisen Sie den Rechnungsbetrag innerhalb von <?php echo (-1 * $invoice->days_overdue); ?> Tagen auf untenstehendes Konto:<br />
Inhaber: <?php echo $invoice->user_name; ?><br /> Inhaber:
<?php if ($invoice->user_company !== "") : ?>
<?php echo $invoice->user_company; ?><br />
<?php else: ?>
<?php echo $invoice->user_name; ?><br />
<?php endif; ?>
IBAN: <?php echo $invoice->user_iban; ?><br /> IBAN: <?php echo $invoice->user_iban; ?><br />
<?php echo invoice_qrcode($invoice->invoice_id); ?> <?php echo invoice_qrcode($invoice->invoice_id); ?>
</p> </p>