update flake, changes to template

This commit is contained in:
Jonas Heinrich 2025-01-07 10:08:03 +01:00
parent ad63f6f0df
commit cb747de19a
6 changed files with 67 additions and 50 deletions

View file

@ -0,0 +1,18 @@
## Invoiceplane Template for Heinrich-Malerbetrieb.de
### Setup
Run development server
```
nix run
```
Visit http://localhost:8080 , run the setup and after login browse to system settings. In the sub menu invoice, change default PDF template to `heinrichmalerbetrieb`.
### Configuration
General default settings which should be set
- User profile (company contact information), such as mail, address, phone and mail
- System settings in general and invoice: Upload company logo for login and invoice logo

15
flake.lock generated
View file

@ -2,17 +2,18 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1735531152, "lastModified": 1736100068,
"narHash": "sha256-As8I+ebItDKtboWgDXYZSIjGlKeqiLBvjxsQHUmAf1Q=", "narHash": "sha256-wtipqLxpphkpxTGJvVuej+msDzABUfWm5TeO31d00MY=",
"owner": "NixOS", "owner": "onny",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3ffbbdbac0566a0977da3d2657b89cbcfe9a173b", "rev": "68a0940f753446728b57c74db999ab08421e9d46",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "onny",
"ref": "nixos-24.11", "ref": "invoiceplane-https",
"type": "indirect" "repo": "nixpkgs",
"type": "github"
} }
}, },
"root": { "root": {

View file

@ -1,7 +1,8 @@
{ {
description = "Invoiceplane invoice template development shell"; description = "Invoiceplane invoice template development shell";
inputs.nixpkgs.url = "nixpkgs/nixos-24.11"; #inputs.nixpkgs.url = "nixpkgs/nixos-24.11";
inputs.nixpkgs.url = "github:onny/nixpkgs/invoiceplane-https";
outputs = { self, nixpkgs, ... }@inputs: outputs = { self, nixpkgs, ... }@inputs:
let let
@ -33,12 +34,18 @@
services.invoiceplane.sites."localhost" = { services.invoiceplane.sites."localhost" = {
enable = true; enable = true;
settings.IP_URL = "http://localhost:8080"; settings = {
IP_URL = "http://localhost:8080";
#DISABLE_SETUP = true;
#SETUP_COMPLETED = true;
};
}; };
services.caddy.virtualHosts."localhost".hostName = "http://localhost";
nixos-shell.mounts.extraMounts = { nixos-shell.mounts.extraMounts = {
"/var/lib/invoiceplane/localhost/pdf" = { "/var/lib/invoiceplane/localhost/pdf" = {
target = /home/onny/projects/invoiceplane-heinrichmalerbetrieb; target = ./.;
cache = "none"; cache = "none";
}; };
}; };

View file

@ -6,11 +6,23 @@
<link rel="stylesheet" <link rel="stylesheet"
href="<?php echo base_url(); ?>assets/<?php echo get_setting('system_theme', 'invoiceplane'); ?>/css/templates.css"> href="<?php echo base_url(); ?>assets/<?php echo get_setting('system_theme', 'invoiceplane'); ?>/css/templates.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/core/css/custom-pdf.css"> <link rel="stylesheet" href="<?php echo base_url(); ?>assets/core/css/custom-pdf.css">
<style>
.highlight {
color: #050582;
}
.logo {
width: 200px;
float: right;
}
.company {
font-size: 0.8rem;
}
</style>
</head> </head>
<body> <body>
<header class="clearfix"> <header class="clearfix">
<div id="logo"> <div id="logo" class="logo">
<?php echo invoice_logo_pdf(); ?> <?php echo invoice_logo_pdf(); ?>
</div> </div>
@ -31,22 +43,19 @@
if ($invoice->client_address_2) { if ($invoice->client_address_2) {
echo '<div>' . htmlsc($invoice->client_address_2) . '</div>'; echo '<div>' . htmlsc($invoice->client_address_2) . '</div>';
} }
echo '<br/>';
if ($invoice->client_city || $invoice->client_state || $invoice->client_zip) { if ($invoice->client_city || $invoice->client_state || $invoice->client_zip) {
echo '<div>'; echo '<div>';
if ($invoice->client_city) {
echo htmlsc($invoice->client_city) . ' ';
}
if ($invoice->client_state) {
echo htmlsc($invoice->client_state) . ' ';
}
if ($invoice->client_zip) { if ($invoice->client_zip) {
echo htmlsc($invoice->client_zip); echo htmlsc($invoice->client_zip) . ' ';
}
if ($invoice->client_city) {
echo htmlsc($invoice->client_city);
} }
echo '</div>'; echo '</div>';
} }
if ($invoice->client_country) {
echo '<div>' . get_country_name(trans('cldr'), $invoice->client_country) . '</div>';
}
echo '<br/>'; echo '<br/>';
@ -55,8 +64,7 @@
} ?> } ?>
</div> </div>
<div id="company"> <div id="company" class="company">
<div><?php _htmlsc($invoice->user_name); ?></div>
<?php if ($invoice->user_address_1) { <?php if ($invoice->user_address_1) {
echo '<div>' . htmlsc($invoice->user_address_1) . '</div>'; echo '<div>' . htmlsc($invoice->user_address_1) . '</div>';
} }
@ -65,14 +73,11 @@
} }
if ($invoice->user_city || $invoice->user_state || $invoice->user_zip) { if ($invoice->user_city || $invoice->user_state || $invoice->user_zip) {
echo '<div>'; echo '<div>';
if ($invoice->user_city) {
echo htmlsc($invoice->user_city) . ' ';
}
if ($invoice->user_state) {
echo htmlsc($invoice->user_state) . ' ';
}
if ($invoice->user_zip) { if ($invoice->user_zip) {
echo htmlsc($invoice->user_zip); echo htmlsc($invoice->user_zip) . ' ';
}
if ($invoice->user_city) {
echo htmlsc($invoice->user_city);
} }
echo '</div>'; echo '</div>';
} }
@ -80,8 +85,6 @@
echo '<div>' . get_country_name(trans('cldr'), $invoice->user_country) . '</div>'; echo '<div>' . get_country_name(trans('cldr'), $invoice->user_country) . '</div>';
} }
echo '<br/>';
if ($invoice->user_vat_id) { 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>';
} }
@ -89,14 +92,18 @@
echo '<div>' . trans('tax_code_short') . ': ' . $invoice->user_tax_code . '</div>'; echo '<div>' . trans('tax_code_short') . ': ' . $invoice->user_tax_code . '</div>';
} }
echo '<br/>';
if ($invoice->user_phone) { if ($invoice->user_phone) {
echo '<div>' . trans('phone_abbr') . ': ' . htmlsc($invoice->user_phone) . '</div>'; echo '<div>' . trans('phone_abbr') . ': ' . htmlsc($invoice->user_phone) . '</div>';
} }
if ($invoice->user_fax) { if ($invoice->user_fax) {
echo '<div>' . trans('fax_abbr') . ': ' . htmlsc($invoice->user_fax) . '</div>'; echo '<div>' . trans('fax_abbr') . ': ' . htmlsc($invoice->user_fax) . '</div>';
} }
if ($invoice->user_email) {
echo '<div class="highlight">' . htmlsc($invoice->user_email) . '</div>';
}
if ($invoice->user_web) {
echo '<div class="highlight">' . htmlsc($invoice->user_web) . '</div>';
}
?> ?>
</div> </div>
@ -129,22 +136,6 @@
<h1 class="invoice-title"><?php echo trans('invoice') . ' ' . $invoice->invoice_number; ?></h1> <h1 class="invoice-title"><?php echo trans('invoice') . ' ' . $invoice->invoice_number; ?></h1>
<?php
$leistungsort = $custom_fields['invoice']['leistung_ort'];
$leistung_von = $custom_fields['invoice']['leistung_von'];
$leistung_bis = $custom_fields['invoice']['leistung_bis'];
if ($leistung_von && $leistung_bis) {
$leistung_von = new DateTime($leistung_von);
$leistung_bis = new DateTime($leistung_bis);
$leistung_von = $leistung_von->format('d.m.Y');
$leistung_bis = $leistung_bis->format('d.m.Y');
echo '<div>Leistungszeitraum: ' . $leistung_von . ' bis ' . $leistung_bis . '</div>';
}
if ($leistungsort) {
echo '<div>Leistungsort: ' . $leistungsort . '</div>';
}
?>
<table class="item-table"> <table class="item-table">
<thead> <thead>
<tr> <tr>

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

BIN
logo.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB