2
0
mirror of https://github.com/frappe/books.git synced 2024-09-19 19:19:02 +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.',
fieldtype: 'Data',
hidden: form => {
return form.individualType === 'Registered Regular' ? 0 : 1;
return form.gstType === 'Registered Regular' ? 0 : 1;
}
});
party.fields.splice(4, 0, {
fieldname: 'individualType',
fieldname: 'gstType',
label: 'GST Registration Type',
fieldtype: 'Select',
options: ['Unregistered', 'Registered Regular', 'Consumer']

View File

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

View File

@ -1,44 +1,43 @@
let title = 'General Ledger';
let filterFields = [
{
fieldtype: 'Select',
options: ['', 'Invoice', 'Payment', 'Bill'],
label: 'Reference Type',
fieldname: 'referenceType'
},
{
fieldtype: 'DynamicLink',
references: 'referenceType',
label: 'Reference Name',
fieldname: 'referenceName'
},
{
fieldtype: 'Link',
target: 'Account',
label: 'Account',
fieldname: 'account'
},
{
fieldtype: 'Link',
target: 'Party',
label: 'Party',
fieldname: 'party'
},
{
fieldtype: 'Date',
label: 'From Date',
fieldname: 'fromDate'
},
{
fieldtype: 'Date',
label: 'To Date',
fieldname: 'toDate'
}
];
const viewConfig = {
title,
filterFields,
filterFields: [
{
fieldtype: 'Select',
options: ['', 'Invoice', 'Payment', 'Bill'],
label: 'Reference Type',
fieldname: 'referenceType'
},
{
fieldtype: 'DynamicLink',
references: 'referenceType',
label: 'Reference Name',
fieldname: 'referenceName'
},
{
fieldtype: 'Link',
target: 'Account',
label: 'Account',
fieldname: 'account'
},
{
fieldtype: 'Link',
target: 'Party',
label: 'Party',
fieldname: 'party'
},
{
fieldtype: 'Date',
label: 'From Date',
fieldname: 'fromDate'
},
{
fieldtype: 'Date',
label: 'To Date',
fieldname: 'toDate'
}
],
method: 'general-ledger',
linkFields: [
{
@ -46,7 +45,9 @@ const viewConfig = {
type: 'primary',
action: async report => {
async function getReportDetails() {
let [rows, columns] = await report.getReportData(filterFields);
let [rows, columns] = await report.getReportData(
report.currentFilters
);
let columnData = columns.map(column => {
return {
id: column.id,
@ -74,7 +75,7 @@ const viewConfig = {
label: 'Clear Filters',
type: 'secondary',
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'
}
],
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() {
return [

View File

@ -58,44 +58,6 @@ export default {
groupItems: [],
activeGroup: 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() {
@ -131,6 +93,7 @@ export default {
<style lang="scss">
@import '../styles/variables.scss';
@import '../styles/animation.scss';
.page-sidebar {
height: 100vh;
@ -149,19 +112,4 @@ export default {
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>

View File

@ -1,16 +1,29 @@
<template>
<div class="branch">
<div class="branch-label px-3 py-2" @click.self="toggleChildren">
<div class="d-flex align-items-center" @click="toggleChildren">
<feather-icon class="mr-1" :name="iconName" v-show="iconName" />
<span>{{ label }}</span>
<div class="ml-auto d-flex align-items-center" v-if="rootType != null">
<span>
{{ currency }}
<span style="font-weight: 800">{{ Math.abs(computedBalance) }}</span>
{{ creditOrDebit }}
</span>
</div>
<div
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" />
<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">
<span>
{{ currency }}
<span style="font-weight: 800">{{ Math.abs(computedBalance) }}</span>
{{ creditOrDebit }}
</span>
</div>
</div>
<div :class="['branch-children', expanded ? '' : 'd-none']">
@ -29,13 +42,16 @@
</div>
</template>
<script>
import { setTimeout } from 'timers';
const Branch = {
props: ['label', 'parentValue', 'doctype', 'balance', 'currency', 'rootType'],
data() {
return {
expanded: false,
children: null,
nodeBalance: this.balance
nodeBalance: this.balance,
editing: false
};
},
computed: {
@ -72,7 +88,22 @@ const Branch = {
await this.getChildren();
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.$emit('updateBalance', this.nodeBalance);
},
@ -130,4 +161,13 @@ export default Branch;
.branch-children {
padding-left: 2.25rem;
}
.btn-edit {
font-size: 10px;
padding: 1px 4px;
opacity: 0.7;
&:hover {
opacity: 1;
}
}
</style>

View File

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