2
0
mirror of https://github.com/frappe/books.git synced 2025-01-22 22:58:28 +00:00

- Chart of accounts action buttons

- Report Export with current filters
This commit is contained in:
thefalconx33 2019-07-24 15:02:53 +05:30
parent 68d3942628
commit ed357ecb46
8 changed files with 156 additions and 112 deletions

View File

@ -6,11 +6,11 @@ party.fields.splice(3, 0, {
label: 'GSTIN No.', label: 'GSTIN No.',
fieldtype: 'Data', fieldtype: 'Data',
hidden: form => { hidden: form => {
return form.individualType === 'Registered Regular' ? 0 : 1; return form.gstType === 'Registered Regular' ? 0 : 1;
} }
}); });
party.fields.splice(4, 0, { party.fields.splice(4, 0, {
fieldname: 'individualType', fieldname: 'gstType',
label: 'GST Registration Type', label: 'GST Registration Type',
fieldtype: 'Select', fieldtype: 'Select',
options: ['Unregistered', 'Registered Regular', 'Consumer'] options: ['Unregistered', 'Registered Regular', 'Consumer']

View File

@ -55,6 +55,11 @@ module.exports = {
label: 'Balance', label: 'Balance',
fieldtype: 'Currency' fieldtype: 'Currency'
}, },
{
label: 'Clearance Date',
fieldtype: 'Date',
fieldname: 'clearanceDate'
},
{ {
label: 'Ref. Type', label: 'Ref. Type',
fieldtype: 'Data', fieldtype: 'Data',
@ -70,11 +75,7 @@ module.exports = {
fieldtype: 'Date', fieldtype: 'Date',
fieldname: 'referenceDate' fieldname: 'referenceDate'
}, },
{
label: 'Clearance Date',
fieldtype: 'Date',
fieldname: 'clearanceDate'
},
{ {
label: 'Party', label: 'Party',
fieldtype: 'Link' fieldtype: 'Link'

View File

@ -1,5 +1,8 @@
let title = 'General Ledger'; let title = 'General Ledger';
let filterFields = [
const viewConfig = {
title,
filterFields: [
{ {
fieldtype: 'Select', fieldtype: 'Select',
options: ['', 'Invoice', 'Payment', 'Bill'], options: ['', 'Invoice', 'Payment', 'Bill'],
@ -34,11 +37,7 @@ let filterFields = [
label: 'To Date', label: 'To Date',
fieldname: 'toDate' fieldname: 'toDate'
} }
]; ],
const viewConfig = {
title,
filterFields,
method: 'general-ledger', method: 'general-ledger',
linkFields: [ linkFields: [
{ {
@ -46,7 +45,9 @@ const viewConfig = {
type: 'primary', type: 'primary',
action: async report => { action: async report => {
async function getReportDetails() { async function getReportDetails() {
let [rows, columns] = await report.getReportData(filterFields); let [rows, columns] = await report.getReportData(
report.currentFilters
);
let columnData = columns.map(column => { let columnData = columns.map(column => {
return { return {
id: column.id, id: column.id,
@ -74,7 +75,7 @@ const viewConfig = {
label: 'Clear Filters', label: 'Clear Filters',
type: 'secondary', type: 'secondary',
action: async report => { action: async report => {
await report.$router.replace(`/report/general-ledger`); await report.$router.push(`/report/general-ledger`);
} }
} }
], ],

View File

@ -30,6 +30,39 @@ module.exports = {
fieldname: 'toDate' fieldname: 'toDate'
} }
], ],
linkFields: [
{
label: 'Export',
type: 'primary',
action: async report => {
async function getReportDetails() {
let [rows, columns] = await report.getReportData(
report.currentFilters
);
let columnData = columns.map(column => {
return {
id: column.id,
content: column.content,
checked: true
};
});
return {
title: title,
rows: rows,
columnData: columnData
};
}
report.$modal.show({
modalProps: {
title: `Export ${title}`,
noFooter: true
},
component: require('../../src/components/ExportWizard').default,
props: await getReportDetails()
});
}
}
],
getColumns() { getColumns() {
return [ return [

View File

@ -58,44 +58,6 @@ export default {
groupItems: [], groupItems: [],
activeGroup: undefined, activeGroup: undefined,
openGroup: undefined openGroup: undefined
// items: [
// {
// label: 'Chart of Accounts',
// route: '/chartOfAccounts'
// },
// {
// label: 'Customers',
// route: '/list/Customer'
// },
// {
// label: 'Items',
// route: '/list/Item'
// },
// {
// label: 'Tax',
// route: '/list/Tax'
// },
// {
// label: 'Payments',
// route: '/list/Payment'
// },
// {
// label: 'Journal Entry',
// route: '/list/JournalEntry'
// },
// {
// label: 'Invoices',
// route: '/list/Invoice'
// },
// {
// label: 'Reports',
// route: '/reportList'
// },
// {
// label: 'Settings',
// route: '/settings'
// }
// ]
}; };
}, },
async mounted() { async mounted() {
@ -131,6 +93,7 @@ export default {
<style lang="scss"> <style lang="scss">
@import '../styles/variables.scss'; @import '../styles/variables.scss';
@import '../styles/animation.scss';
.page-sidebar { .page-sidebar {
height: 100vh; height: 100vh;
@ -149,19 +112,4 @@ export default {
background-color: $frappe; background-color: $frappe;
} }
} }
.slide-fade-enter-active {
transition: all 0.6s ease 0.1s;
}
.slide-fade-leave-active {
transition: all 0.3s ease;
position: absolute;
}
.slide-fade-enter,
.slide-fade-leave-to {
transform: translateX(-15px);
opacity: 0;
}
.slide-fade-move {
transition: transform 0.5s 0.1s;
}
</style> </style>

View File

@ -1,9 +1,23 @@
<template> <template>
<div class="branch"> <div class="branch">
<div class="branch-label px-3 py-2" @click.self="toggleChildren"> <div
<div class="d-flex align-items-center" @click="toggleChildren"> class="branch-label px-3 py-2 d-flex align-items-center"
@click="toggleChildren"
@mouseover="editing = true"
@mouseleave="editing = false"
>
<feather-icon class="mr-1" :name="iconName" v-show="iconName" /> <feather-icon class="mr-1" :name="iconName" v-show="iconName" />
<span>{{ label }}</span> <div>{{ label }}</div>
<div
class="btn btn-sm btn-secondary ml-2 py-0 btn-edit"
@click="$router.push(`/edit/Account/${label}`)"
v-if="editing && rootType != null"
>Edit</div>
<div
class="btn btn-sm btn-secondary ml-2 py-0 btn-edit"
@click="openFormModal({rootType, isGroup: 0, parentAccount: label})"
v-if="editing && rootType != null"
>Create</div>
<div class="ml-auto d-flex align-items-center" v-if="rootType != null"> <div class="ml-auto d-flex align-items-center" v-if="rootType != null">
<span> <span>
{{ currency }} {{ currency }}
@ -12,7 +26,6 @@
</span> </span>
</div> </div>
</div> </div>
</div>
<div :class="['branch-children', expanded ? '' : 'd-none']"> <div :class="['branch-children', expanded ? '' : 'd-none']">
<branch <branch
v-for="child in children" v-for="child in children"
@ -29,13 +42,16 @@
</div> </div>
</template> </template>
<script> <script>
import { setTimeout } from 'timers';
const Branch = { const Branch = {
props: ['label', 'parentValue', 'doctype', 'balance', 'currency', 'rootType'], props: ['label', 'parentValue', 'doctype', 'balance', 'currency', 'rootType'],
data() { data() {
return { return {
expanded: false, expanded: false,
children: null, children: null,
nodeBalance: this.balance nodeBalance: this.balance,
editing: false
}; };
}, },
computed: { computed: {
@ -72,7 +88,22 @@ const Branch = {
await this.getChildren(); await this.getChildren();
this.expanded = !this.expanded; this.expanded = !this.expanded;
}, },
async updateBalance(balance) { async openFormModal(filters) {
// const input = this.$refs.input;
const newDoc = await frappe.getNewDoc('Account');
let defaultValues = {};
for (let key of Object.keys(filters)) {
defaultValues[key] = filters[key];
}
this.$formModal.open(newDoc, { defaultValues });
newDoc.on('afterInsert', data => {
// if new doc was created
// then set the name of the doc in input
this.$formModal.close();
});
},
updateBalance(balance) {
this.nodeBalance += balance; this.nodeBalance += balance;
this.$emit('updateBalance', this.nodeBalance); this.$emit('updateBalance', this.nodeBalance);
}, },
@ -130,4 +161,13 @@ export default Branch;
.branch-children { .branch-children {
padding-left: 2.25rem; padding-left: 2.25rem;
} }
.btn-edit {
font-size: 10px;
padding: 1px 4px;
opacity: 0.7;
&:hover {
opacity: 1;
}
}
</style> </style>

View File

@ -31,6 +31,11 @@ import utils from 'frappejs/client/ui/utils';
export default { export default {
name: 'Report', name: 'Report',
props: ['reportName', 'reportConfig', 'filters'], props: ['reportName', 'reportConfig', 'filters'],
data() {
return {
currentFilters: this.filters
};
},
computed: { computed: {
breadcrumbs() { breadcrumbs() {
return [ return [
@ -67,6 +72,7 @@ export default {
}, },
methods: { methods: {
async getReportData(filters) { async getReportData(filters) {
this.currentFilters = filters;
let data = await frappe.call({ let data = await frappe.call({
method: this.reportConfig.method, method: this.reportConfig.method,
args: filters args: filters

15
src/styles/animation.scss Normal file
View File

@ -0,0 +1,15 @@
.slide-fade-enter-active {
transition: all 0.4s ease 0.1s;
}
.slide-fade-leave-active {
transition: all 0.2s ease;
position: absolute;
}
.slide-fade-enter,
.slide-fade-leave-to {
transform: translateX(-12px);
opacity: 0;
}
.slide-fade-move {
transition: transform 0.3s 0.1s;
}