gitea init
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../../models/invoicesmodel.php';
|
||||
|
||||
use App\Config;
|
||||
|
||||
require_once Config::includePath('head.php');
|
||||
require_once Config::includePath('navbar.php');
|
||||
require_once Config::includePath('pageheader.php');
|
||||
require_once Config::includePath('pagebodystart.php');
|
||||
?>
|
||||
|
||||
|
||||
<!-- CONTENT START -->
|
||||
|
||||
<div class="container-xl mt-4">
|
||||
<h2 class="mb-4">ახალი ინვოისის დამატება</h2>
|
||||
|
||||
<form action="dashboard.php?module=billing&submodule=invoices&action=store" method="POST">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">კლიენტი</label>
|
||||
<select name="client_id" class="form-select" required>
|
||||
<option value="">აირჩიე კლიენტი</option>
|
||||
<?php foreach ($clients as $client): ?>
|
||||
<option value="<?= $client['id'] ?>">
|
||||
<?= htmlspecialchars($client['first_name'] . ' ' . $client['last_name']) ?>
|
||||
</option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="form-label">პროდუქტები</label>
|
||||
|
||||
<div id="product-container">
|
||||
<div class="row product-item mb-2">
|
||||
<div class="col-md-5">
|
||||
<select name="products[]" class="form-select" required>
|
||||
<option value="">აირჩიე პროდუქტი</option>
|
||||
<?php foreach ($products as $product): ?>
|
||||
<option value="<?= $product['id'] ?>">
|
||||
<?= htmlspecialchars($product['name']) ?> (<?= $product['price'] ?> ₾)
|
||||
</option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<input type="number" name="amounts[]" step="0.01" class="form-control" placeholder="თანხა ₾" required>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<input type="text" name="descriptions[]" class="form-control" placeholder="აღწერა (არასავალდებულო)">
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<button type="button" class="btn btn-danger btn-remove">-</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" id="add-product" class="btn btn-secondary btn-sm mt-2">+ პროდუქტის დამატება</button>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">ინვოისის ნომერი (არასავალდებულო)</label>
|
||||
<input type="text" name="invoice_number" class="form-control"
|
||||
placeholder="მაგ: INV-2025-001"
|
||||
value="<?= htmlspecialchars($generatedInvoiceNumber) ?>" />
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">ინვოისის აღწერა</label>
|
||||
<textarea name="description" class="form-control" rows="3"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">გადასახდელი თანხა (₾)</label>
|
||||
<input type="number" step="0.01" name="total_amount" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">გადახდის მეთოდი</label>
|
||||
<input type="text" name="payment_method" class="form-control" value="საბანკო გადმორიცხვა" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">სტატუსი</label>
|
||||
<select name="status" class="form-select" required>
|
||||
<option value="დრაფტი">დრაფტი</option>
|
||||
<option value="გადაუხდელი">გადაუხდელი</option>
|
||||
<option value="გადასახდელი">გადასახდელი</option>
|
||||
<option value="გადახდილი">გადახდილი</option>
|
||||
<option value="გაუქმებული">გაუქმებული</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<div class="col">
|
||||
<label class="form-label">ინვოისის თარიღი</label>
|
||||
<input type="date" name="issue_date" class="form-control" value="<?= date('Y-m-d') ?>" required>
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">გადახდის ბოლო ვადა</label>
|
||||
<input type="date" name="due_date" class="form-control" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-check">
|
||||
<input type="checkbox" name="recurring" value="1" class="form-check-input">
|
||||
<span class="form-check-label">გადახდა განმეორებით (ყოველთვიურად)</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<button type="submit" class="btn btn-primary">ინვოისის შექმნა</button>
|
||||
<a href="list.php" class="btn btn-secondary">გაუქმება</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div></div>
|
||||
|
||||
|
||||
<?php require_once Config::includePath('footer.php'); ?>
|
||||
|
||||
<script>
|
||||
document.getElementById('add-product').addEventListener('click', function () {
|
||||
const container = document.getElementById('product-container');
|
||||
const item = container.querySelector('.product-item');
|
||||
const clone = item.cloneNode(true);
|
||||
|
||||
// reset values
|
||||
clone.querySelectorAll('input, select').forEach(el => el.value = '');
|
||||
container.appendChild(clone);
|
||||
});
|
||||
|
||||
// remove button
|
||||
document.addEventListener('click', function (e) {
|
||||
if (e.target.classList.contains('btn-remove')) {
|
||||
const allItems = document.querySelectorAll('.product-item');
|
||||
if (allItems.length > 1) {
|
||||
e.target.closest('.product-item').remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../../models/invoicesmodel.php';
|
||||
|
||||
|
||||
use App\Config;
|
||||
|
||||
require_once Config::includePath('head.php');
|
||||
require_once Config::includePath('navbar.php');
|
||||
require_once Config::includePath('pageheader.php');
|
||||
require_once Config::includePath('pagebodystart.php');
|
||||
|
||||
?>
|
||||
|
||||
<!-- CONTENT START -->
|
||||
<div class="page-wrapper">
|
||||
<div class="container-xl mt-4">
|
||||
<h2 class="mb-4">ინვოისის რედაქტირება</h2>
|
||||
|
||||
<form action="dashboard.php?module=billing&submodule=invoices&action=update" method="POST">
|
||||
<input type="hidden" name="id" value="<?= $invoice['id'] ?>">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">კლიენტი</label>
|
||||
<select name="client_id" class="form-select" required>
|
||||
<?php foreach ($clients as $client): ?>
|
||||
<option value="<?= $client['id'] ?>" <?= $invoice['client_id'] == $client['id'] ? 'selected' : '' ?>>
|
||||
<?= htmlspecialchars($client['first_name'] . ' ' . $client['last_name']) ?>
|
||||
</option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">ინვოისის ნომერი</label>
|
||||
<input type="text" name="invoice_number" class="form-control" value="<?= htmlspecialchars($invoice['invoice_number']) ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">აღწერა</label>
|
||||
<textarea name="description" class="form-control"><?= htmlspecialchars($invoice['description']) ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">გადახდის მეთოდი</label>
|
||||
<input type="text" name="payment_method" class="form-control" value="<?= htmlspecialchars($invoice['payment_method']) ?>" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">სტატუსი</label>
|
||||
<select name="status" class="form-select">
|
||||
<?php foreach (['დრაფტი', 'გადაუხდელი', 'გადასახდელი', 'გადახდილი', 'გაუქმებული'] as $status): ?>
|
||||
<option value="<?= $status ?>" <?= $invoice['status'] == $status ? 'selected' : '' ?>><?= $status ?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">თანხა (₾)</label>
|
||||
<input type="number" name="total_amount" class="form-control" step="0.01" value="<?= $invoice['total_amount'] ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">ინვოისის თარიღი</label>
|
||||
<input type="date" name="issue_date" class="form-control" value="<?= $invoice['issue_date'] ?>" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">გადახდის ბოლო ვადა</label>
|
||||
<input type="date" name="due_date" class="form-control" value="<?= $invoice['due_date'] ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="recurring" value="1" <?= $invoice['recurring'] ? 'checked' : '' ?>>
|
||||
<span class="form-check-label">გადახდა განმეორებით (ყოველთვიურად)</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<button type="submit" class="btn btn-primary">შენახვა</button>
|
||||
<a href="dashboard.php?module=billing&submodule=invoices&action=view&id=<?= $invoice['id'] ?>" class="btn btn-secondary">უკან</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require_once Config::includePath('footer.php'); ?>
|
||||
@@ -0,0 +1,64 @@
|
||||
<!-- ინვოისების სია + ფილტრები -->
|
||||
<?php require_once __DIR__ . '/../../models/invoicesmodel.php'; ?>
|
||||
<?php
|
||||
use App\Config;
|
||||
|
||||
InvoicesModel::setDb($pdo);
|
||||
$invoices = InvoicesModel::getAllInvoicesWithClientNames();
|
||||
|
||||
require_once Config::includePath('head.php');
|
||||
require_once Config::includePath('navbar.php');
|
||||
require_once Config::includePath('pageheader.php');
|
||||
require_once Config::includePath('pagebodystart.php');
|
||||
?>
|
||||
|
||||
<div class="container-xl mt-4">
|
||||
<div class="d-flex justify-content-between mb-3">
|
||||
<h2>ინვოისების სია</h2>
|
||||
<a href="dashboard.php?module=billing&submodule=invoices&action=create" class="btn btn-primary">+ ახალი ინვოისი</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>კლიენტი</th>
|
||||
<th>თანხა</th>
|
||||
<th>სტატუსი</th>
|
||||
<th>თარიღი</th>
|
||||
<th>ვადა</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($invoices as $invoice): ?>
|
||||
<tr>
|
||||
<td><?= $invoice['id'] ?></td>
|
||||
<td><?= htmlspecialchars($invoice['client_name']) ?></td>
|
||||
<td><?= number_format($invoice['total_amount'], 2) ?> ₾</td>
|
||||
<td>
|
||||
<span class="badge bg-light">
|
||||
<?= htmlspecialchars($invoice['status']) ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?= $invoice['issue_date'] ?></td>
|
||||
<td><?= $invoice['due_date'] ?></td>
|
||||
<td>
|
||||
<a href="dashboard.php?module=billing&submodule=invoices&action=view&id=<?= $invoice['id'] ?>" class="btn btn-sm btn-info">ნახვა</a>
|
||||
<a href="dashboard.php?module=billing&submodule=invoices&action=edit&id=<?= $invoice['id'] ?>" class="btn btn-sm btn-warning">რედაქტირება</a>
|
||||
<a href="dashboard.php?module=billing&submodule=invoices&action=delete&id=<?= $invoice['id'] ?>" class="btn btn-sm btn-danger" onclick="return confirm('ნამდვილად გსურს წაშლა?')">წაშლა</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Content END -->
|
||||
</div>
|
||||
</div>
|
||||
<?php require_once Config::includePath('footer.php'); ?>
|
||||
@@ -0,0 +1,167 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ka">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ინვოისი</title>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: DejaVu Sans;
|
||||
}
|
||||
body {
|
||||
font-family: DejaVu Sans;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
}
|
||||
.invoice-box {
|
||||
max-width: 800px;
|
||||
margin: auto;
|
||||
padding: 30px;
|
||||
border: 1px solid #eee;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.top-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.top-header img {
|
||||
max-width: 250px;
|
||||
}
|
||||
.bank-info {
|
||||
text-align: right;
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.green-banner {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
background: #4CAF50;
|
||||
color: white;
|
||||
padding: 5px 20px;
|
||||
transform: rotate(45deg);
|
||||
transform-origin: top right;
|
||||
font-size: 16px;
|
||||
}
|
||||
.section {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.gray-box {
|
||||
background: #eee;
|
||||
padding: 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 15px;
|
||||
}
|
||||
table, th, td {
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
th, td {
|
||||
padding: 10px;
|
||||
text-align: left;
|
||||
}
|
||||
th {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
.footer {
|
||||
margin-top: 30px;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
color: #777;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="invoice-box">
|
||||
<!-- <div class="green-banner">გადახდილია</div> -->
|
||||
<div class="top-header">
|
||||
<div>
|
||||
<h3>SELFHOSTING.GE</h3>
|
||||
</div>
|
||||
<div class="bank-info">
|
||||
ი/მ ლევან არაბული<br>
|
||||
პ/ნ: 01001080490<br><br>
|
||||
ბანკი: თიბისი ბანკი<br>
|
||||
ა/ნ: GE79TB7902736010100047<br><br>
|
||||
ბანკი: საქართველოს ბანკი<br>
|
||||
ა/ნ: GE85BG0000000534211842<br>
|
||||
იდენტიფიკატორი: 01001080490
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section gray-box">
|
||||
ინვოისი #: <?= htmlspecialchars($invoice['invoice_number']) ?><br>
|
||||
ინვოისის თარიღი: <?= htmlspecialchars($invoice['issue_date']) ?><br>
|
||||
გადახდის თარიღი: <?= htmlspecialchars($invoice['due_date']) ?>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<strong>მიმღები:</strong><br>
|
||||
<?= htmlspecialchars($invoice['first_name'] . ' ' . $invoice['last_name']) ?><br>
|
||||
<?php if (!empty($invoice['company_name'])): ?>
|
||||
<?= htmlspecialchars($invoice['company_name']) ?><br>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($invoice['address1'])): ?>
|
||||
<?= htmlspecialchars($invoice['address1']) ?><br>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($invoice['vat_number'])): ?>
|
||||
VAT: <?= htmlspecialchars($invoice['vat_number']) ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>დასახელება</th>
|
||||
<th>აღწერა</th>
|
||||
<th>თანხა</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($invoice['items'] as $item): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($item['name']) ?></td>
|
||||
<td><?= htmlspecialchars($item['description']) ?></td>
|
||||
<td><?= number_format($item['amount'], 2) ?> ლარი</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h3>ტრანზაქციები</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ინვოისის ნომერი</th>
|
||||
<th>გადახდის მეთოდი</th>
|
||||
<th>ტრანზაქციის ID</th>
|
||||
<th>თანხა</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td># <?= htmlspecialchars($invoice['invoice_number']) ?></td>
|
||||
<td><?= htmlspecialchars($invoice['payment_method']) ?></td>
|
||||
<td>-</td>
|
||||
<td><?= number_format($invoice['total_amount'], 2) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">ბალანსი</td>
|
||||
<td>0.00 GEL</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
Powered By Stack.ge | შექმნილია Stack.ge-ს მიერ
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,69 @@
|
||||
<!-- კონკრეტული ინვოისის ხილვა -->
|
||||
<?php require_once __DIR__ . '/../../models/invoicesmodel.php'; ?>
|
||||
|
||||
<?php
|
||||
use App\Config;
|
||||
|
||||
require_once Config::includePath('head.php');
|
||||
require_once Config::includePath('navbar.php');
|
||||
require_once Config::includePath('pageheader.php');
|
||||
require_once Config::includePath('pagebodystart.php');
|
||||
?>
|
||||
|
||||
|
||||
<!-- CONTENT START -->
|
||||
<?php if ($showAlert): ?>
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert" id="invoiceAlert">
|
||||
✅ ინვოისი წარმატებით გაიგზავნა!
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
<script>
|
||||
setTimeout(() => {
|
||||
const alertBox = document.getElementById('invoiceAlert');
|
||||
if (alertBox) alertBox.remove();
|
||||
}, 5000);
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="container-xl mt-4">
|
||||
<h2>ინვოისი # <?= $invoice['invoice_number'] ? htmlspecialchars($invoice['invoice_number']) : '' ?></h2>
|
||||
<p><strong>კლიენტი:</strong> <?= htmlspecialchars($invoice['first_name'] . ' ' . $invoice['last_name']) ?></p>
|
||||
<p><strong>სტატუსი:</strong> <?= htmlspecialchars($invoice['status']) ?></p>
|
||||
<p><strong>თარიღი:</strong> <?= $invoice['issue_date'] ?></p>
|
||||
<p><strong>ბოლო ვადა:</strong> <?= $invoice['due_date'] ?></p>
|
||||
<p><strong>გადასახდელი თანხა:</strong> <?= number_format($invoice['total_amount'], 2) ?> ₾</p>
|
||||
<p><strong>გადახდის მეთოდი:</strong> <?= htmlspecialchars($invoice['payment_method']) ?></p>
|
||||
<p><strong>აღწერა:</strong> <?= nl2br(htmlspecialchars($invoice['description'])) ?></p>
|
||||
|
||||
<?php if (!empty($productItems)): ?>
|
||||
<h4 class="mt-4">პროდუქტები</h4>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>პროდუქტი</th>
|
||||
<th>თანხა</th>
|
||||
<th>აღწერა</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($productItems as $item): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($item['name']) ?></td>
|
||||
<td><?= number_format($item['amount'], 2) ?> ₾</td>
|
||||
<td><?= htmlspecialchars($item['description']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="mt-4">
|
||||
<a href="dashboard.php?module=billing&submodule=invoices&action=send&id=<?= $invoice['id'] ?>" class="btn btn-primary">გაგზავნა</a>
|
||||
<a href="dashboard.php?module=billing&submodule=invoices&action=edit&id=<?= $invoice['id'] ?>" class="btn btn-secondary">რედაქტირება</a>
|
||||
<a href="dashboard.php?module=billing&submodule=invoices&action=delete&id=<?= $invoice['id'] ?>" class="btn btn-danger">წაშლა</a>
|
||||
<a href="dashboard.php?module=billing&submodule=invoices&action=list" class="btn btn-light">უკან</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php require_once Config::includePath('footer.php'); ?>
|
||||
Reference in New Issue
Block a user