2
0
mirror of https://github.com/frappe/books.git synced 2024-11-09 23:30:56 +00:00

print format

This commit is contained in:
Rushabh Mehta 2018-02-21 15:09:27 +05:30
parent 6b26f5acc8
commit 270051761a
9 changed files with 17096 additions and 185 deletions

5
dist/css/style.css vendored
View File

@ -7224,3 +7224,8 @@ mark {
left: auto; left: auto;
width: auto; width: auto;
min-width: 120px; } min-width: 120px; }
.print-page {
padding: 3rem;
line-height: 1.8; }
.print-page td, .print-page th {
padding: 0.5rem; }

17076
dist/js/bundle.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,65 @@
<h1>{{ _("Invoice") }}</h1> <h1>{{ doc.name }}</h1>
<div class="row py-4">
<div> <div class="col-6">
<p><b>Customer</b></p> <div><b>{{ frappe._("Customer") }}</b></div>
<p>{{ doc.customer }}</p> <div>{{ doc.customer }}</div>
</div>
<div class="col-6">
<div><b>{{ frappe._("Date") }}</b></div>
<div>{{ frappe.format(doc.date, 'Date') }}</div>
</div>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th></th>
<th>{{ frappe._("Item") }}</th>
<th class='text-right'>{{ frappe._("Qty") }}</th>
<th class='text-right'>{{ frappe._("Rate") }}</th>
<th class='text-right'>{{ frappe._("Amount") }}</th>
</tr>
</thead>
<tbody>
{% for row in doc.items %}
<tr>
<td class='text-right'>{{ row.idx + 1 }}</td>
<td>{{ row.item }}<br>{{ frappe.format(row.description, 'Text') }}</td>
<td class='text-right'>{{ row.quantity }}</td>
<td class='text-right'>{{ frappe.format(row.rate, 'Currency') }}</td>
<td class='text-right'>{{ frappe.format(row.amount, 'Currency') }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class='row'>
<div class='col-6'></div>
<div class='col-6'>
<div class='row'>
<div class='col-6'>
{{ frappe._("Total") }}
</div>
<div class='col-6 text-right'>
{{ frappe.format(doc.netTotal, 'Currency')}}
</div>
</div>
{% for tax in doc.taxes %}
<div class='row'>
<div class='col-6'>
{{ tax.account }} ({{ tax.rate }}%)
</div>
<div class='col-6 text-right'>
{{ frappe.format(tax.amount, 'Currency')}}
</div>
</div>
{% endfor %}
<div class='row py-3'>
<div class='col-6'>
<h5>{{ frappe._("Grand Total") }}</h5>
</div>
<div class='col-6 text-right'>
<h5>{{ frappe.format(doc.grandTotal, 'Currency')}}</h5>
</div>
</div>
</div>
</div>
</div> </div>

View File

@ -5,6 +5,6 @@ module.exports = class AccountList extends BaseList {
return ['name', 'account_type']; return ['name', 'account_type'];
} }
getRowHTML(data) { getRowHTML(data) {
return `<a href="#edit/account/${data.name}">${data.name} (${data.account_type})</a>`; return `${data.name} (${data.account_type})`;
} }
} }

View File

@ -4,7 +4,9 @@ module.exports = {
"name": "Invoice", "name": "Invoice",
"doctype": "DocType", "doctype": "DocType",
"documentClass": require("./InvoiceDocument.js"), "documentClass": require("./InvoiceDocument.js"),
"defaultPrintFormat": "Standard Invoice Format", "print": {
"printFormat": "Standard Invoice Format",
},
"isSingle": 0, "isSingle": 0,
"istable": 0, "istable": 0,
"keywordFields": ["name", "customer"], "keywordFields": ["name", "customer"],
@ -32,7 +34,7 @@ module.exports = {
}, },
{ {
"fieldname": "netTotal", "fieldname": "netTotal",
"label": "Total", "label": "Net Total",
"fieldtype": "Currency", "fieldtype": "Currency",
formula: (doc) => doc.getSum('items', 'amount'), formula: (doc) => doc.getSum('items', 'amount'),
"disabled": true "disabled": true
@ -50,7 +52,7 @@ module.exports = {
return `<div class='row'> return `<div class='row'>
<div class='col-6'>${row.account} (${row.rate}%)</div> <div class='col-6'>${row.account} (${row.rate}%)</div>
<div class='col-6 text-right'> <div class='col-6 text-right'>
${frappe.format(row.amount, {fieldtype:'Currency'})} ${frappe.format(row.amount, 'Currency')}
</div> </div>
</div>` </div>`
}).join('')} }).join('')}
@ -59,7 +61,7 @@ module.exports = {
}, },
{ {
"fieldname": "grandTotal", "fieldname": "grandTotal",
"label": "Total", "label": "Grand Total",
"fieldtype": "Currency", "fieldtype": "Currency",
formula: (doc) => doc.getGrandTotal(), formula: (doc) => doc.getGrandTotal(),
"disabled": true "disabled": true

View File

@ -8,6 +8,6 @@ module.exports = class InvoiceList extends BaseList {
getRowHTML(data) { getRowHTML(data) {
return `<div class="col-2">${data.name}</div> return `<div class="col-2">${data.name}</div>
<div class="col-5 text-muted">${data.customer}</div> <div class="col-5 text-muted">${data.customer}</div>
<div class="col-4 text-muted text-right">${frappe.format(data.grandTotal, {fieldtype:"Currency"})}</div>`; <div class="col-4 text-muted text-right">${frappe.format(data.grandTotal, "Currency")}</div>`;
} }
} }

View File

@ -17,16 +17,14 @@
"express": "^4.16.2", "express": "^4.16.2",
"flatpickr": "^4.3.2", "flatpickr": "^4.3.2",
"jquery": "^3.3.1", "jquery": "^3.3.1",
"moment": "^2.20.1",
"node-fetch": "^1.7.3", "node-fetch": "^1.7.3",
"nunjucks": "^3.1.0", "nunjucks": "^3.1.0",
"popper.js": "^1.12.9", "popper.js": "^1.12.9",
"rollup-plugin-ignore": "^1.0.3", "showdown": "^1.8.6",
"socket.io": "^2.0.4", "socket.io": "^2.0.4",
"socket.io-client": "^2.0.4",
"sortablejs": "^1.7.0", "sortablejs": "^1.7.0",
"sqlite3": "^3.1.13", "sqlite3": "^3.1.13"
"utf-8-validate": "^4.0.0",
"walk": "^2.3.9"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^7.2.4", "autoprefixer": "^7.2.4",

View File

@ -19,6 +19,7 @@ client.start({
frappe.desk.menu.addItem('Items', '#list/Item'); frappe.desk.menu.addItem('Items', '#list/Item');
frappe.desk.menu.addItem('Customers', '#list/Customer'); frappe.desk.menu.addItem('Customers', '#list/Customer');
frappe.desk.menu.addItem('Invoice', '#list/Invoice'); frappe.desk.menu.addItem('Invoice', '#list/Invoice');
frappe.desk.menu.addItem('Settings', () => frappe.desk.showFormModal('SystemSettings'));
frappe.router.default = '#list/ToDo'; frappe.router.default = '#list/ToDo';

View File

@ -598,7 +598,7 @@ camelcase@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a"
camelcase@^4.0.0: camelcase@^4.0.0, camelcase@^4.1.0:
version "4.1.0" version "4.1.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd"
@ -737,6 +737,14 @@ cliui@^3.0.3, cliui@^3.2.0:
strip-ansi "^3.0.1" strip-ansi "^3.0.1"
wrap-ansi "^2.0.0" wrap-ansi "^2.0.0"
cliui@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.0.0.tgz#743d4650e05f36d1ed2575b59638d87322bfbbcc"
dependencies:
string-width "^2.1.1"
strip-ansi "^4.0.0"
wrap-ansi "^2.0.0"
clone@^1.0.2: clone@^1.0.2:
version "1.0.3" version "1.0.3"
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.3.tgz#298d7e2231660f40c003c2ed3140decf3f53085f" resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.3.tgz#298d7e2231660f40c003c2ed3140decf3f53085f"
@ -1633,6 +1641,12 @@ find-up@^1.0.0:
path-exists "^2.0.0" path-exists "^2.0.0"
pinkie-promise "^2.0.0" pinkie-promise "^2.0.0"
find-up@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7"
dependencies:
locate-path "^2.0.0"
flat-cache@^1.2.1: flat-cache@^1.2.1:
version "1.3.0" version "1.3.0"
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481"
@ -2727,6 +2741,13 @@ loader-utils@^0.2.16:
json5 "^0.5.0" json5 "^0.5.0"
object-assign "^4.0.1" object-assign "^4.0.1"
locate-path@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"
dependencies:
p-locate "^2.0.0"
path-exists "^3.0.0"
lodash.assign@^4.2.0: lodash.assign@^4.2.0:
version "4.2.0" version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7"
@ -2828,6 +2849,12 @@ media-typer@0.3.0:
version "0.3.0" version "0.3.0"
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
mem@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76"
dependencies:
mimic-fn "^1.0.0"
meow@^3.7.0: meow@^3.7.0:
version "3.7.0" version "3.7.0"
resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb"
@ -2962,6 +2989,10 @@ mocha@^4.0.1:
mkdirp "0.5.1" mkdirp "0.5.1"
supports-color "4.4.0" supports-color "4.4.0"
moment@^2.20.1:
version "2.20.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.20.1.tgz#d6eb1a46cbcc14a2b2f9434112c1ff8907f313fd"
ms@2.0.0: ms@2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
@ -3266,6 +3297,14 @@ os-locale@^1.4.0:
dependencies: dependencies:
lcid "^1.0.0" lcid "^1.0.0"
os-locale@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2"
dependencies:
execa "^0.7.0"
lcid "^1.0.0"
mem "^1.1.0"
os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: os-tmpdir@^1.0.0, os-tmpdir@~1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
@ -3281,6 +3320,22 @@ p-finally@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
p-limit@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c"
dependencies:
p-try "^1.0.0"
p-locate@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43"
dependencies:
p-limit "^1.1.0"
p-try@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
package-json@^4.0.0: package-json@^4.0.0:
version "4.0.1" version "4.0.1"
resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.1.tgz#8869a0401253661c4c4ca3da6c2121ed555f5eed" resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.1.tgz#8869a0401253661c4c4ca3da6c2121ed555f5eed"
@ -3345,6 +3400,10 @@ path-exists@^2.0.0:
dependencies: dependencies:
pinkie-promise "^2.0.0" pinkie-promise "^2.0.0"
path-exists@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
path-is-absolute@^1.0.0: path-is-absolute@^1.0.0:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
@ -4591,6 +4650,12 @@ shebang-regex@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
showdown@^1.8.6:
version "1.8.6"
resolved "https://registry.yarnpkg.com/showdown/-/showdown-1.8.6.tgz#91ea4ee3b7a5448aaca6820a4e27e690c6ad771c"
dependencies:
yargs "^10.0.3"
signal-exit@^3.0.0, signal-exit@^3.0.2: signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2" version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
@ -5255,6 +5320,10 @@ which-module@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f"
which-module@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
which@1, which@^1.2.9: which@1, which@^1.2.9:
version "1.3.0" version "1.3.0"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a"
@ -5361,6 +5430,29 @@ yargs-parser@^5.0.0:
dependencies: dependencies:
camelcase "^3.0.0" camelcase "^3.0.0"
yargs-parser@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-8.1.0.tgz#f1376a33b6629a5d063782944da732631e966950"
dependencies:
camelcase "^4.1.0"
yargs@^10.0.3:
version "10.1.2"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-10.1.2.tgz#454d074c2b16a51a43e2fb7807e4f9de69ccb5c5"
dependencies:
cliui "^4.0.0"
decamelize "^1.1.1"
find-up "^2.1.0"
get-caller-file "^1.0.1"
os-locale "^2.0.0"
require-directory "^2.1.1"
require-main-filename "^1.0.1"
set-blocking "^2.0.0"
string-width "^2.0.0"
which-module "^2.0.0"
y18n "^3.2.1"
yargs-parser "^8.1.0"
yargs@^3.32.0: yargs@^3.32.0:
version "3.32.0" version "3.32.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995" resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995"