Skip to content

Commit

Permalink
feat: Beitragsabrechnung (LAN-844) (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra authored Aug 30, 2024
1 parent 0835a36 commit 09efe4a
Show file tree
Hide file tree
Showing 15 changed files with 522 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"actions": [],
"creation": "2024-07-11 19:13:40.115388",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"item_code",
"item_name",
"billed",
"credited",
"net_billed",
"rate",
"amount"
],
"fields": [
{
"fieldname": "item_code",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Item Code",
"options": "Item"
},
{
"fieldname": "item_name",
"fieldtype": "Data",
"label": "Item Name",
"read_only": 1
},
{
"columns": 1,
"fieldname": "rate",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Rate",
"options": "Company:company:default_currency"
},
{
"columns": 2,
"fieldname": "amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Amount",
"options": "Company:company:default_currency"
},
{
"columns": 1,
"fieldname": "billed",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Billed"
},
{
"columns": 1,
"fieldname": "credited",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Credited"
},
{
"columns": 1,
"fieldname": "net_billed",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Net Billed"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-08-30 20:01:57.750315",
"modified_by": "Administrator",
"module": "LANDA Sales",
"name": "LANDA Item Sales Summary",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024, ALYF GmbH and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class LANDAItemSalesSummary(Document):
pass
Empty file.
56 changes: 56 additions & 0 deletions landa/landa_sales/doctype/landa_payment_row/landa_payment_row.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"actions": [],
"creation": "2024-07-11 17:31:34.524661",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"payment_entry",
"payment_type",
"reference_date",
"amount"
],
"fields": [
{
"fetch_from": "payment_entry.reference_date",
"fieldname": "reference_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Reference Date"
},
{
"fieldname": "payment_entry",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Payment Entry",
"options": "Payment Entry"
},
{
"fieldname": "payment_type",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Payment Type",
"options": "Receive\nPay"
},
{
"fetch_from": "payment_entry.base_paid_amount",
"fieldname": "amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Amount",
"options": "Company:company:default_currency"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-07-11 17:56:13.983731",
"modified_by": "Administrator",
"module": "LANDA Sales",
"name": "LANDA Payment Row",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024, ALYF GmbH and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class LANDAPaymentRow(Document):
pass
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright (c) 2024, ALYF GmbH and contributors
// For license information, please see license.txt

frappe.ui.form.on("Statement of Fees and Payments", {
setup(frm) {
frm.set_query("customer_address", (doc) => {
return {
filters: [
["Dynamic Link", "link_doctype", "=", "Customer"],
["Dynamic Link", "link_name", "=", doc.customer],
],
};
});

frm.set_query("company_address", (doc) => {
return {
filters: [
["Dynamic Link", "link_doctype", "=", "Company"],
["Dynamic Link", "link_name", "=", doc.company],
],
};
});

frm.set_query("payment_entry", "payments", (doc) => {
return {
filters: {
company: doc.company,
year_of_settlement: doc.year_of_settlement,
party_type: "Customer",
party: doc.customer,
docstatus: 1,
},
};
});
},

refresh(frm) {
if (frm.is_new() && !frm.doc.year_of_settlement) {
frm.set_value("year_of_settlement", new Date().getFullYear() - 1);
}
},

async company(frm) {
if (frm.doc.company) {
const default_address = await frappe.xcall(
"erpnext.setup.doctype.company.company.get_default_company_address",
{ name: frm.doc.company, existing_address: frm.doc.company_address || "" }
);

if (default_address) {
frm.set_value("company_address", default_address);
} else {
frm.set_value("company_address", "");
}
}
},

customer_address(frm) {
erpnext.utils.get_address_display(frm, "customer_address", "customer_address_display");
},

company_address(frm) {
erpnext.utils.get_address_display(frm, "company_address", "company_address_display");
},
});
Loading

0 comments on commit 09efe4a

Please sign in to comment.