402 lines
21 KiB
PHP
402 lines
21 KiB
PHP
<?php
|
|
$enablePrototypeComments = true;
|
|
include '../../header-invoice.php';
|
|
?>
|
|
|
|
<div class="container-fluid flex-grow-1 container-p-y">
|
|
|
|
<div
|
|
class="d-flex flex-column flex-md-row justify-content-between align-items-start align-items-md-center mb-4 gap-3">
|
|
<div class="d-flex flex-column justify-content-center">
|
|
<h4 class="mb-1 text-body">Nowa Faktura Zakupowa</h4>
|
|
<p class="text-muted mb-0">Wprowadź koszt firmowy</p>
|
|
</div>
|
|
<div class="d-flex align-content-center flex-wrap gap-2">
|
|
<a href="app-purchase-list.php" class="btn btn-label-secondary">Anuluj</a>
|
|
<button type="submit" form="invoiceForm" class="btn btn-primary"><i class="bx bx-save me-1"></i> Zapisz
|
|
fakturę</button>
|
|
</div>
|
|
</div>
|
|
|
|
<form id="invoiceForm" onsubmit="return false">
|
|
|
|
<div class="row mb-4">
|
|
|
|
<div class="col-lg-2 col-md-12 mb-3 mb-lg-0">
|
|
<div class="card h-100 bg-label-secondary border-0">
|
|
<div class="card-body p-3 d-flex flex-column justify-content-center text-center">
|
|
<div class="avatar mx-auto mb-2">
|
|
<span class="avatar-initial rounded bg-white text-secondary"><i
|
|
class="bx bx-building-house fs-4"></i></span>
|
|
</div>
|
|
<h6 class="card-title mb-1 text-nowrap">Nabywca (My)</h6>
|
|
<small class="d-block fw-bold text-truncate">Magico Software</small>
|
|
<small class="text-muted text-truncate">NIP: 8652582386</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-lg-5 col-md-6 mb-3 mb-lg-0">
|
|
<div class="card h-100">
|
|
<div class="card-header border-bottom py-3">
|
|
<h6 class="card-title m-0"><i class="bx bx-store-alt me-2"></i>Sprzedawca</h6>
|
|
</div>
|
|
<div class="card-body pt-3">
|
|
<div class="card shadow-none border mb-3 position-relative">
|
|
<div class="card-body p-3 d-flex justify-content-between align-items-center"
|
|
style="min-height: 80px;">
|
|
<i class="text-muted">Wybierz dostawcę z listy...</i>
|
|
<button class="btn btn-outline-primary btn-sm position-absolute end-0 top-0 m-2"><i
|
|
class="bx bx-search"></i></button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="d-flex flex-column gap-2">
|
|
<label class="form-check form-switch m-0">
|
|
<input class="form-check-input" type="checkbox" id="descToggle">
|
|
<span class="form-check-label text-muted">Dodatkowy opis dostawcy</span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-lg-5 col-12">
|
|
<div class="card h-100">
|
|
<div class="card-header border-bottom py-3">
|
|
<h6 class="card-title m-0"><i class="bx bx-file me-2"></i>Dane Dokumentu</h6>
|
|
</div>
|
|
<div class="card-body pt-3">
|
|
|
|
<!-- KSeF Info Block -->
|
|
<div class="mb-4 p-3 bg-label-secondary rounded border-dashed border-2">
|
|
<div class="d-flex align-items-center mb-2 justify-content-between">
|
|
<div class="d-flex align-items-center">
|
|
<i class="bx bx-shield-quarter me-2 text-success"></i>
|
|
<span class="fw-bold small">DANE SYSTEMU KSeF</span>
|
|
</div>
|
|
<span class="badge bg-white text-success shadow-sm">ZWERYFIKOWANA</span>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="small text-muted d-block mb-1">Numer identyfikacyjny:</label>
|
|
<code class="p-2 bg-white border rounded d-block text-dark small fw-bold"
|
|
style="word-break: break-all;">8652582386-20260120-0C7F00A11237-B1</code>
|
|
</div>
|
|
<div class="row align-items-center gx-2">
|
|
<div class="col-auto">
|
|
<img src="https://api.qrserver.com/v1/create-qr-code/?size=90x90&data=KSEF_VERIFY_URL"
|
|
class="border p-1 bg-white rounded" alt="QR KSeF" width="60">
|
|
</div>
|
|
<div class="col">
|
|
<div class="d-flex gap-2 mb-2">
|
|
<button class="btn btn-sm btn-outline-primary w-100"><i
|
|
class="bx bx-download me-1"></i>UPO</button>
|
|
<button class="btn btn-sm btn-outline-secondary w-100"><i
|
|
class="bx bx-copy me-1"></i>Numer</button>
|
|
</div>
|
|
<small class="text-muted d-block" style="font-size: 0.7rem;">Faktura została pobrana
|
|
z KSeF i zweryfikowana poprawnie.</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row g-2 mb-3">
|
|
<div class="col-md-6">
|
|
<label class="form-label fw-bold">Numer faktury</label>
|
|
<input type="text" class="form-control" placeholder="np. FV/2026/02/105">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label small text-uppercase fw-bold text-muted">Data zakupu</label>
|
|
<input type="text" class="form-control date-picker" value="2026-02-17">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row g-2 mb-3">
|
|
<div class="col-6">
|
|
<label class="form-label small text-uppercase fw-bold text-muted">Data wyst.</label>
|
|
<input type="text" class="form-control date-picker" value="2026-02-17">
|
|
</div>
|
|
<div class="col-6">
|
|
<label class="form-label small text-uppercase fw-bold text-muted">Termin płat.</label>
|
|
<input type="text" class="form-control date-picker" value="2026-02-24">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row g-2 align-items-end">
|
|
<div class="col-5">
|
|
<label class="form-label small text-uppercase fw-bold text-muted">Metoda</label>
|
|
<select class="form-select">
|
|
<option value="przelew">Przelew</option>
|
|
<option value="gotowka">Gotówka</option>
|
|
<option value="karta">Karta</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-7">
|
|
<label class="form-label fw-bold">Zapłacono</label>
|
|
<div class="input-group">
|
|
<input type="number" id="paidInput" class="form-control" value="0.00">
|
|
<button class="btn btn-outline-primary px-2" type="button" id="payFullBtn"
|
|
data-bs-toggle="tooltip" title="Przepisz pełną kwotę">
|
|
Całość
|
|
</button>
|
|
<span class="input-group-text">PLN</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card mb-4">
|
|
<div
|
|
class="card-header bg-label-primary py-2 d-flex flex-wrap justify-content-between align-items-center gap-3">
|
|
<span class="fw-bold">Pozycje faktury</span>
|
|
|
|
<div class="d-flex align-items-center flex-wrap gap-3">
|
|
|
|
<div class="d-flex align-items-center">
|
|
<label class="text-muted small me-2 text-nowrap d-flex align-items-center">
|
|
Kategoria kosztu
|
|
<i class="bx bx-info-circle ms-1 text-primary cursor-pointer" data-bs-toggle="tooltip"
|
|
title="Listę kategorii możesz zdefiniować w: Ustawienia -> Słowniki"></i>
|
|
</label>
|
|
<select class="form-select form-select-sm" style="min-width: 150px;">
|
|
<option value="towary">Towary handlowe</option>
|
|
<option value="paliwo">Paliwo i eksploatacja</option>
|
|
<option value="biuro">Koszty biurowe</option>
|
|
<option value="uslugi">Usługi obce</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="vr h-100 my-auto text-muted"></div>
|
|
|
|
<div class="d-flex align-items-center">
|
|
<label class="text-muted small me-2 text-nowrap">Licz od:</label>
|
|
<select class="form-select form-select-sm" style="width: auto;">
|
|
<option value="brutto">Brutto</option>
|
|
<option value="netto">Netto</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card-body p-0">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th style="width: 40px;" class="text-center">Lp</th>
|
|
<th style="min-width: 250px;">Nazwa kosztu / Towaru</th>
|
|
<th style="width: 120px;">Kod / PKWiU</th>
|
|
<th style="width: 90px;">JM</th>
|
|
<th style="width: 100px;">Ilość</th>
|
|
<th style="width: 130px;">Cena Netto</th>
|
|
<th style="width: 100px;">VAT</th>
|
|
<th style="width: 130px;" class="text-end">Wartość Netto</th>
|
|
<th style="width: 130px;" class="text-end">Wartość Brutto</th>
|
|
<th style="width: 50px;"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="align-middle text-center text-muted">1</td>
|
|
<td class="p-2">
|
|
<input type="text" class="form-control border-0 shadow-none fw-medium"
|
|
placeholder="Np. Usługa księgowa, Paliwo...">
|
|
</td>
|
|
<td class="p-2">
|
|
<input type="text" class="form-control border-0 shadow-none text-muted"
|
|
placeholder="-">
|
|
</td>
|
|
<td class="p-2">
|
|
<select class="form-select border-0 shadow-none px-1">
|
|
<option value="szt">szt.</option>
|
|
<option value="usl">usł.</option>
|
|
<option value="m3">m3</option>
|
|
<option value="litr">litr</option>
|
|
</select>
|
|
</td>
|
|
<td class="p-2">
|
|
<input type="number" class="form-control border-0 shadow-none text-center fw-bold"
|
|
value="1" step="0.01">
|
|
</td>
|
|
<td class="p-2">
|
|
<input type="number" class="form-control border-0 shadow-none text-end" value="0.00"
|
|
step="0.01">
|
|
</td>
|
|
<td class="p-2">
|
|
<select class="form-select border-0 shadow-none px-1">
|
|
<option value="23">23%</option>
|
|
<option value="8">8%</option>
|
|
<option value="5">5%</option>
|
|
<option value="0">0%</option>
|
|
<option value="zw">ZW</option>
|
|
</select>
|
|
</td>
|
|
<td class="align-middle text-end pe-3 bg-lighter">0,00 zł</td>
|
|
<td class="align-middle text-end pe-3 bg-lighter fw-bold">0,00 zł</td>
|
|
<td class="align-middle text-center p-2">
|
|
<button class="btn btn-icon btn-sm btn-label-danger"><i
|
|
class="bx bx-trash"></i></button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="border-top p-3 text-end bg-light">
|
|
<button class="btn btn-primary btn-sm"><i class="bx bx-plus me-1"></i> Dodaj kolejną
|
|
pozycję</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-7 mb-4 mb-lg-0">
|
|
<div class="card h-100">
|
|
<div class="card-body">
|
|
|
|
<label class="form-label">Uwagi do dokumentu (wewnętrzne)</label>
|
|
<textarea class="form-control bg-lighter" rows="3"
|
|
placeholder="Wpisz uwagi widoczne tylko dla nas..."></textarea>
|
|
|
|
<div class="row g-2 mb-3 mt-3">
|
|
<div class="col-md-4">
|
|
<label class="form-label d-flex align-items-center">
|
|
Waluta dokumentu
|
|
<i class="bx bx-info-circle ms-1 fs-6 text-muted" data-bs-toggle="tooltip"
|
|
data-bs-placement="top"
|
|
title="Waluta w jakiej została wystawiona faktura przez dostawcę.">
|
|
</i>
|
|
</label>
|
|
<select class="form-select">
|
|
<option value="PLN">PLN</option>
|
|
<option value="EUR">EUR</option>
|
|
<option value="USD">USD</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-md-5">
|
|
<label class="form-label d-flex align-items-center">
|
|
Przelicznik (Kurs)
|
|
<i class="bx bx-info-circle ms-1 fs-6 text-muted" data-bs-toggle="tooltip"
|
|
data-bs-placement="top"
|
|
title="Kurs waluty z dnia poprzedzającego wystawienie faktury.">
|
|
</i>
|
|
</label>
|
|
<div class="input-group">
|
|
<input type="number" id="exchangeRateInput" class="form-control" value="1.0000"
|
|
disabled>
|
|
<button class="btn btn-outline-secondary" type="button" id="unlockRateBtn"
|
|
data-bs-toggle="tooltip" title="Odblokuj edycję kursu">
|
|
<i class="bx bx-lock-open-alt"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="d-flex align-items-center mt-3">
|
|
<label class="form-check form-switch m-0">
|
|
<input class="form-check-input" type="checkbox" checked>
|
|
<span class="form-check-label">Podzielona płatność (MPP)</span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-lg-5">
|
|
<div class="card h-100">
|
|
<div class="card-body">
|
|
<h6 class="card-title mb-4">Podsumowanie</h6>
|
|
|
|
<div class="d-flex justify-content-between mb-2">
|
|
<span class="text-muted">Suma Netto:</span>
|
|
<span class="fw-semibold">0,00 zł</span>
|
|
</div>
|
|
<div class="d-flex justify-content-between mb-3 border-bottom pb-2">
|
|
<span class="text-muted">Suma VAT:</span>
|
|
<span class="fw-semibold">0,00 zł</span>
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<span class="h5 mb-0">Do zapłaty:</span>
|
|
<span class="h4 mb-0 text-primary" id="finalTotal">0,00 zł</span>
|
|
</div>
|
|
|
|
<div class="alert alert-warning d-flex align-items-start align-items-sm-center mb-0"
|
|
role="alert">
|
|
<i class="bx bx-bell-ring me-2 fs-4 mt-1 mt-sm-0"></i>
|
|
<div class="small">
|
|
<strong>Status: Nierozliczona.</strong>
|
|
Faktura zostanie dodana do kalendarza płatności.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
<div class="content-backdrop fade"></div>
|
|
|
|
|
|
<?php include '../../footer.php'; ?>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
// Inicjalizacja Datepickerów
|
|
if (typeof flatpickr !== 'undefined') {
|
|
document.querySelectorAll('.date-picker').forEach(picker => {
|
|
flatpickr(picker, { dateFormat: 'Y-m-d' });
|
|
});
|
|
}
|
|
|
|
// Tooltipy
|
|
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
|
|
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
|
|
return new bootstrap.Tooltip(tooltipTriggerEl)
|
|
});
|
|
|
|
// Obsługa odblokowania kursu waluty
|
|
const unlockBtn = document.getElementById('unlockRateBtn');
|
|
const rateInput = document.getElementById('exchangeRateInput');
|
|
if (unlockBtn && rateInput) {
|
|
unlockBtn.addEventListener('click', function () {
|
|
rateInput.disabled = !rateInput.disabled;
|
|
if (!rateInput.disabled) {
|
|
rateInput.focus();
|
|
unlockBtn.classList.remove('btn-outline-secondary');
|
|
unlockBtn.classList.add('btn-primary');
|
|
unlockBtn.innerHTML = '<i class="bx bx-lock-open-alt"></i>';
|
|
} else {
|
|
unlockBtn.classList.add('btn-outline-secondary');
|
|
unlockBtn.classList.remove('btn-primary');
|
|
unlockBtn.innerHTML = '<i class="bx bx-lock-alt"></i>';
|
|
}
|
|
});
|
|
}
|
|
|
|
// Obsługa przycisku "Całość"
|
|
const payFullBtn = document.getElementById('payFullBtn');
|
|
const paidInput = document.getElementById('paidInput');
|
|
// Tutaj symulujemy pobranie kwoty z podsumowania (normalnie z logiki JS liczącej tabelę)
|
|
// Zakładamy, że user klika, a my bierzemy '0.00' lub cokolwiek tam jest
|
|
if (payFullBtn && paidInput) {
|
|
payFullBtn.addEventListener('click', function () {
|
|
// W prawdziwej aplikacji pobrałbyś sumę z obiektu calculateTotal()
|
|
// Tutaj dla przykładu wpiszemy placeholder, bo tabela jest pusta
|
|
paidInput.value = "1230.00"; // Przykładowa wartość
|
|
paidInput.focus();
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|