2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00
This commit is contained in:
Rushabh Mehta 2018-02-19 12:36:51 +05:30
parent d09de107d9
commit 3567eb1776
4 changed files with 165 additions and 0 deletions

View File

@ -0,0 +1,36 @@
module.exports = {
"name": "Account",
"doctype": "DocType",
"documentClass": require("./AccountDocument.js"),
"isSingle": 0,
"keywordFields": [
"name",
"account_type"
],
"fields": [
{
"fieldname": "name",
"label": "Account Name",
"fieldtype": "Data",
"required": 1
},
{
"fieldname": "parent_account",
"label": "Parent Account",
"fieldtype": "Link",
"target": "Account"
},
{
"fieldname": "account_type",
"label": "Account Type",
"fieldtype": "Select",
"options": [
"Asset",
"Liability",
"Equity",
"Income",
"Expense"
]
}
]
}

View File

@ -0,0 +1,17 @@
module.exports = {
"name": "Customer",
"doctype": "DocType",
"isSingle": 0,
"istable": 0,
"keywordFields": [
"name"
],
"fields": [
{
"fieldname": "name",
"label": "Name",
"fieldtype": "Data",
"required": 1
}
]
}

View File

@ -0,0 +1,67 @@
const frappe = require('frappejs');
module.exports = {
"name": "Invoice",
"doctype": "DocType",
"documentClass": require("./InvoiceDocument.js"),
"isSingle": 0,
"istable": 0,
"keywordFields": ["name", "customer"],
"settings": "InvoiceSettings",
"showTitle": true,
"fields": [
{
"fieldname": "date",
"label": "Date",
"fieldtype": "Date"
},
{
"fieldname": "customer",
"label": "Customer",
"fieldtype": "Link",
"target": "Customer",
"required": 1
},
{
"fieldname": "items",
"label": "Items",
"fieldtype": "Table",
"childtype": "InvoiceItem",
"required": true
},
{
"fieldname": "netTotal",
"label": "Total",
"fieldtype": "Currency",
formula: (doc) => doc.getSum('items', 'amount'),
"disabled": true
},
{
"fieldname": "taxes",
"label": "Taxes",
"fieldtype": "Table",
"childtype": "TaxSummary",
"disabled": true,
template: (doc, row) => {
return `<div class='row'>
<div class='col-6'><!-- empty left side --></div>
<div class='col-6'>${(doc.taxes || []).map(row => {
return `<div class='row'>
<div class='col-6'>${row.account} (${row.rate}%)</div>
<div class='col-6 text-right'>
${frappe.format(row.amount, {fieldtype:'Currency'})}
</div>
</div>`
}).join('')}
</div></div>`;
}
},
{
"fieldname": "grandTotal",
"label": "Total",
"fieldtype": "Currency",
formula: (doc) => doc.getGrandTotal(),
"disabled": true
}
]
}

View File

@ -0,0 +1,45 @@
module.exports = {
"name": "Item",
"doctype": "DocType",
"isSingle": 0,
"keywordFields": [
"name",
"description"
],
"fields": [
{
"fieldname": "name",
"label": "Item Name",
"fieldtype": "Data",
"required": 1
},
{
"fieldname": "description",
"label": "Description",
"fieldtype": "Text"
},
{
"fieldname": "unit",
"label": "Unit",
"fieldtype": "Select",
"options": [
"No",
"Kg",
"Gram",
"Hour",
"Day"
]
},
{
"fieldname": "tax",
"label": "Tax",
"fieldtype": "Link",
"target": "Tax"
},
{
"fieldname": "rate",
"label": "Rate",
"fieldtype": "Currency"
}
]
}