Skip to content

Commit

Permalink
Merge pull request #14 from radinceorc/main
Browse files Browse the repository at this point in the history
Add the new fit
  • Loading branch information
sepehr-akbarzadeh authored Sep 16, 2024
2 parents 1dad1a5 + 28125e2 commit 1557d86
Show file tree
Hide file tree
Showing 41 changed files with 1,918 additions and 487 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ cython_debug/

kernel/
manage.py
media/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
Expand Down
Binary file modified docs/_static/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 14 additions & 9 deletions docs/source/getting_started/admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The admin layer customizes the Django admin interface to manage invoices efficie
Managing Invoices
-----------------

In the Django admin interface, you can manage various aspects of invoices, including creating, editing, and deleting them.
In the Django admin interface, you can manage various aspects of invoices, including creating, editing, deleting, and downloading them as PDFs.

Viewing Invoices
----------------
Expand Down Expand Up @@ -38,7 +38,6 @@ To create a new invoice:

4. Select design elements like logo, background, signature, and stamp.


5. Choose a template for the invoice. The system comes with three pre-defined templates, but you can create your own custom templates as well.

.. image:: ../../_static/4.png
Expand All @@ -47,7 +46,7 @@ To create a new invoice:
6. After saving the invoice, you can add custom columns to include additional details like delivery date or warranty period.

.. image:: ../../_static/5.png
:alt: Adding a custom columns
:alt: Adding a Custom Column

.. note::
Custom columns can only be added after the invoice has been created.
Expand All @@ -68,22 +67,28 @@ To show the details of an existing invoice:

.. image:: ../../_static/7.png
:alt: Showing the Selected Invoice

.. image:: ../../_static/8.png
:alt: Print the Selected Invoice

Exporting Invoices
------------------

The Django admin interface also allows you to export invoices as HTML files bundled in a ZIP archive.
The Django admin interface allows you to export invoices as HTML files bundled in a ZIP archive, or as PDFs.

Downloading Selected Invoices as PDF
------------------------------------

1. Select one or more invoices from the list.
2. Choose the `Download selected report as ZIP file` action from the dropdown menu.
2. Choose the `Download selected invoices as PDF` action from the dropdown menu.

.. image:: ../../_static/9.png
:alt: Exporting Invoices
:alt: Exporting Invoices as PDF

3. The ZIP file will include the invoice(s) and any associated static files like logos or signatures.
3. The system will generate the selected invoices in PDF format and download them to your local machine.

.. image:: ../../_static/10.png
:alt: Downloaded ZIP File
:alt: Exporting Invoices as ZIP

.. note::
If you select more than file it will convert the pdf to zip
104 changes: 42 additions & 62 deletions docs/source/getting_started/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,72 +11,63 @@ The `Invoice` model represents an invoice in the system, capturing essential det
Fields
^^^^^^

- `invoice_date`: The date when the invoice was created.
- `customer_name`: The name of the customer.
- `customer_email`: The email of the customer.
- `status`: The current status of the invoice (e.g., Paid, Unpaid).
- `notes`: Additional notes regarding the invoice.
- `category`: The category associated with this invoice.
- `due_date`: The date by which the invoice should be paid.
- `logo`: The logo displayed on the invoice.
- `signature`: The signature image for the invoice.
- `stamp`: The stamp image for the invoice.
- `template_choice`: The template used for rendering the invoice.

InvoiceCategory
---------------

The `InvoiceCategory` model represents categories that can be associated with invoices, helping to organize and classify them.

Fields
^^^^^^

- `title`: The title of the category.
- `description`: A description of the category.

InvoiceItem
- **invoice_date**: The date when the invoice was created.
- **customer_name**: The name of the customer.
- **customer_email**: The email of the customer.
- **status**: The current status of the invoice (e.g., Paid, Unpaid).
- **notes**: Additional notes regarding the invoice.
- **category**: JSONField that allows storing various categories in a dynamic format, such as Terms & Conditions or additional notes.
- **due_date**: The date by which the invoice should be paid.
- **logo**: An image field representing the company logo on the invoice.
- **signature**: The signature image for the invoice.
- **stamp**: The stamp image for the invoice.
- **tracking_code**: Enter the first 3-4 characters of the tracking code. The full code will be auto-generated as <prefix> + <date> + <random number>.
- **template_choice**: Specifies the template used for rendering the invoice.
- **contacts**: JSONField that stores the contact details (e.g., email, phone number) of the customer in a flexible format.

Item
-----------

The `InvoiceItem` model represents individual items within an invoice, detailing the products or services provided.
The `Item` model represents individual items within an invoice, detailing the products or services provided.

Fields
^^^^^^

- `description`: Description of the item.
- `quantity`: The quantity of the item.
- `unit_price`: The price per unit of the item.
- `total_price`: The total price for this item (calculated as quantity * unit price).
- `invoice`: The invoice associated with this item.
- **description**: Description of the item.
- **quantity**: The quantity of the item.
- **unit_price**: The price per unit of the item.
- **total_price**: The total price for this item (calculated as quantity * unit price).
- **invoice**: A ForeignKey linking the item to its associated invoice.

InvoiceColumn
Column
-------------

The `InvoiceColumn` model represents custom columns that can be added to individual items in an invoice.
The `Column` model represents custom columns that can be added to individual items in an invoice.

Fields
^^^^^^

- `priority`: The priority associated with each custom column.
- `column_name`: The name of the custom column (e.g., 'Delivery Date', 'Warranty Period').
- `value`: The value for the custom column in the specific invoice.
- `invoice`: The invoice associated with this custom column.
- `item`: The item associated with this custom column.
- **priority**: The display priority for this column.
- **column_name**: The name of the custom column (e.g., 'Delivery Date', 'Warranty Period').
- **value**: The value for the custom column in the specific invoice.
- **invoice**: The invoice associated with this custom column.
- **item**: The item associated with this custom column.

Expense
------------
-------

The `Expense` model represents the total amount for an invoice, including calculations for tax, discounts, and the final total.
The `Expense` model represents calculations for subtotals, taxes, discounts, and totals for an invoice.

Fields
^^^^^^

- `subtotal`: The sum of all item totals.
- `tax_percentage`: The tax percentage applied to the invoice.
- `discount_percentage`: The discount percentage applied to the invoice.
- `tax_amount`: The calculated tax amount.
- `discount_amount`: The calculated discount amount.
- `total_amount`: The final total after applying tax and discount.
- `invoice`: The invoice associated with this total.
- **subtotal**: The sum of all item totals.
- **tax_percentage**: The tax percentage applied to the invoice.
- **tax_amount**: The calculated tax amount.
- **discount_percentage**: The discount percentage applied to the invoice.
- **discount_amount**: The calculated discount amount.
- **total_amount**: The final total after applying tax and discount.
- **invoice**: A ForeignKey linking the expense to its associated invoice.

Admin Integration
-----------------
Expand All @@ -86,32 +77,21 @@ To integrate these models into the Django admin interface, register them in the
.. code-block:: python
from django.contrib import admin
from sage_invoice.models import (
Invoice,
InvoiceCategory,
InvoiceItem,
InvoiceColumn,
Expense,
)
from sage_invoice.models import Invoice, Item, Column, Expense
@admin.register(Invoice)
class InvoiceAdmin(admin.ModelAdmin):
list_display = ["title", "invoice_date", "customer_name", "status"]
@admin.register(InvoiceCategory)
class InvoiceCategoryAdmin(admin.ModelAdmin):
list_display = ["title", "description"]
@admin.register(InvoiceItem)
class InvoiceItemAdmin(admin.ModelAdmin):
@admin.register(Item)
class ItemAdmin(admin.ModelAdmin):
list_display = ["description", "quantity", "unit_price", "total_price"]
@admin.register(InvoiceColumn)
class InvoiceColumnAdmin(admin.ModelAdmin):
@admin.register(Column)
class ColumnAdmin(admin.ModelAdmin):
list_display = ["column_name", "priority", "value"]
Expand Down
16 changes: 15 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pillow = "^10.4.0"
django-sage-tools = "^0.2.2"
django-import-export = "^4.1.1"
bandit = { extras = [ "toml" ], version = "^1.7.9" }
django-jsonform = "^2.22.0"

[tool.poetry.group.dev.dependencies]
ruff = "^0.6.1"
Expand Down
30 changes: 0 additions & 30 deletions requirements/poetry.md

This file was deleted.

Loading

0 comments on commit 1557d86

Please sign in to comment.