mirror of
https://github.com/frappe/books.git
synced 2024-12-23 03:19:01 +00:00
Minor Fixes
This commit is contained in:
parent
466597459a
commit
2d2c9d4e6a
@ -1,12 +1,21 @@
|
||||
const party = require('./Party')
|
||||
const party = require('./Party');
|
||||
|
||||
party.fields.splice(3, 0, { //insert at 3rd position
|
||||
party.fields.splice(3, 0, {
|
||||
//insert at 3rd position
|
||||
fieldname: 'gstin',
|
||||
label: 'GSTIN No.',
|
||||
fieldtype: 'Data',
|
||||
hidden: 0
|
||||
})
|
||||
party.fields.join()
|
||||
const newParty = party
|
||||
hidden: form => {
|
||||
return form.individualType === 'Registered Regular' ? 0 : 1;
|
||||
}
|
||||
});
|
||||
party.fields.splice(4, 0, {
|
||||
fieldname: 'individualType',
|
||||
label: 'GST Registration Type',
|
||||
fieldtype: 'Select',
|
||||
options: ['Unregistered', 'Registered Regular', 'Consumer']
|
||||
});
|
||||
party.fields.join();
|
||||
const newParty = party;
|
||||
|
||||
module.exports = newParty
|
||||
module.exports = newParty;
|
||||
|
@ -43,7 +43,10 @@ module.exports = {
|
||||
target: 'Account',
|
||||
required: 1,
|
||||
getFilters: (query, doc) => {
|
||||
if (doc.paymentMethod === 'Cash')
|
||||
return { accountType: 'Cash', isGroup: 0 };
|
||||
return {
|
||||
accountType: ['in', ['Bank', 'Cash']],
|
||||
isGroup: 0
|
||||
};
|
||||
}
|
||||
@ -52,7 +55,7 @@ module.exports = {
|
||||
fieldname: 'paymentMethod',
|
||||
label: 'Payment Method',
|
||||
fieldtype: 'Select',
|
||||
options: ['', 'Cash', 'Cheque'],
|
||||
options: ['', 'Cash', 'Cheque', 'Transfer'],
|
||||
required: 1
|
||||
},
|
||||
{
|
||||
@ -71,7 +74,7 @@ module.exports = {
|
||||
label: 'Clearance Date',
|
||||
fieldtype: 'Date',
|
||||
hidden: doc => {
|
||||
return doc.paymentMethod === 'Cheque' ? 0 : 1;
|
||||
return doc.paymentMethod === 'Cash' ? 1 : 0;
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ module.exports = class PaymentServer extends BaseDocument {
|
||||
async afterSubmit() {
|
||||
for (let row of this.for) {
|
||||
if (['Invoice', 'Bill'].includes(row.referenceType)) {
|
||||
const { outstandingAmount, grandTotal } = await frappe.getDoc(
|
||||
let { outstandingAmount, grandTotal } = await frappe.getDoc(
|
||||
row.referenceType,
|
||||
row.referenceName
|
||||
);
|
||||
@ -26,6 +26,7 @@ module.exports = class PaymentServer extends BaseDocument {
|
||||
if (this.amount > outstandingAmount) {
|
||||
console.log('Over Payment');
|
||||
} else {
|
||||
console.log('Payment Done');
|
||||
await frappe.db.setValue(
|
||||
row.referenceType,
|
||||
row.referenceName,
|
||||
|
@ -13,10 +13,20 @@ class BankReconciliation {
|
||||
if (params.fromDate) filters.date.push('>=', params.fromDate);
|
||||
}
|
||||
|
||||
filters.paymentMethod = ['in', ['Cheque', 'Transfer']];
|
||||
|
||||
let data = await frappe.db.getAll({
|
||||
doctype: 'Payment',
|
||||
fields: ['date', 'account', 'paymentAccount', 'party', 'name', 'referenceDate','clearanceDate'],
|
||||
filters: filters,
|
||||
fields: [
|
||||
'date',
|
||||
'account',
|
||||
'paymentAccount',
|
||||
'party',
|
||||
'name',
|
||||
'referenceDate',
|
||||
'clearanceDate'
|
||||
],
|
||||
filters: filters
|
||||
});
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
@ -28,7 +38,7 @@ class BankReconciliation {
|
||||
account: data[i].paymentAccount,
|
||||
referenceName: data[i].name
|
||||
}
|
||||
})
|
||||
});
|
||||
data[i].credit = ledger[0].credit;
|
||||
data[i].debit = ledger[0].debit;
|
||||
data[i].referenceName = ledger[0].referenceName;
|
||||
|
@ -2,11 +2,18 @@ const title = 'Bank Reconciliation';
|
||||
module.exports = {
|
||||
title: title,
|
||||
method: 'bank-reconciliation',
|
||||
filterFields: [{
|
||||
filterFields: [
|
||||
{
|
||||
fieldtype: 'Link',
|
||||
target: 'Account',
|
||||
label: 'Payement Account',
|
||||
fieldname: 'paymentAccount'
|
||||
fieldname: 'paymentAccount',
|
||||
getFilters: () => {
|
||||
return {
|
||||
accountType: 'Bank',
|
||||
isGroup: 0
|
||||
};
|
||||
}
|
||||
},
|
||||
{
|
||||
fieldtype: 'Link',
|
||||
@ -26,7 +33,8 @@ module.exports = {
|
||||
}
|
||||
],
|
||||
getColumns() {
|
||||
return [{
|
||||
return [
|
||||
{
|
||||
label: 'Posting Date',
|
||||
fieldtype: 'Date',
|
||||
fieldname: 'date'
|
||||
|
@ -10,34 +10,48 @@ class GoodsAndServiceTax {
|
||||
}
|
||||
if (params.transferType) filters.transferType = params.transferType;
|
||||
|
||||
let invoiceNames = await frappe.db.getAll({
|
||||
doctype: 'Invoice',
|
||||
filter: filters
|
||||
});
|
||||
|
||||
let tableData = [];
|
||||
for (let invoice of invoiceNames) {
|
||||
const row = await this.getRow(invoice.name);
|
||||
tableData.push(row);
|
||||
}
|
||||
|
||||
if (Object.keys(filters).length != 0) {
|
||||
tableData = tableData.filter(row => {
|
||||
if (filters.account) return row.account === filters.account;
|
||||
if (filters.transferType)
|
||||
return row.transferType === filters.transferType;
|
||||
if (filters.place) return row.place === filters.place;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
return tableData;
|
||||
const data = await this.getReport(params.reportType, filters);
|
||||
return data;
|
||||
}
|
||||
|
||||
async getRow(invoiceName) {
|
||||
async getReport(type, filters) {
|
||||
if (['GSTR-1', 'GSTR-2'].includes(type)) {
|
||||
let entries = await frappe.db.getAll({
|
||||
doctype: type === 'GSTR-1' ? 'Invoice' : 'Bill',
|
||||
filter: filters
|
||||
});
|
||||
|
||||
let tableData = [];
|
||||
for (let entry of entries) {
|
||||
const row = await this.getRow({
|
||||
doctype: type === 'GSTR-1' ? 'Invoice' : 'Bill',
|
||||
name: entry.name
|
||||
});
|
||||
tableData.push(row);
|
||||
}
|
||||
|
||||
if (Object.keys(filters).length != 0) {
|
||||
tableData = tableData.filter(row => {
|
||||
if (filters.account) return row.account === filters.account;
|
||||
if (filters.transferType)
|
||||
return row.transferType === filters.transferType;
|
||||
if (filters.place) return row.place === filters.place;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
return tableData;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async getRow(entry) {
|
||||
let row = {};
|
||||
let invoiceDetails = await frappe.getDoc('Invoice', invoiceName);
|
||||
let customerDetails = await frappe.getDoc('Party', invoiceDetails.customer);
|
||||
let entryDetails = await frappe.getDoc(entry.doctype, entry.name);
|
||||
let customerDetails = await frappe.getDoc(
|
||||
'Party',
|
||||
entryDetails.customer || entryDetails.supplier
|
||||
);
|
||||
if (customerDetails.address) {
|
||||
let addressDetails = await frappe.getDoc(
|
||||
'Address',
|
||||
@ -46,15 +60,15 @@ class GoodsAndServiceTax {
|
||||
row.place = addressDetails.state || '';
|
||||
}
|
||||
row.gstin = customerDetails.gstin;
|
||||
row.cusName = invoiceDetails.customer;
|
||||
row.invNo = invoiceDetails.name;
|
||||
row.invDate = invoiceDetails.date;
|
||||
row.partyName = entryDetails.customer || entryDetails.supplier;
|
||||
row.invNo = entryDetails.name;
|
||||
row.invDate = entryDetails.date;
|
||||
|
||||
row.rate = 0;
|
||||
row.transferType = 'In State';
|
||||
invoiceDetails.taxes.forEach(tax => {
|
||||
entryDetails.taxes.forEach(tax => {
|
||||
row.rate += tax.rate;
|
||||
const taxAmt = (tax.rate * invoiceDetails.netTotal) / 100;
|
||||
const taxAmt = (tax.rate * entryDetails.netTotal) / 100;
|
||||
if (tax.account === 'IGST') {
|
||||
row.transferType = 'Out of State';
|
||||
row.igstAmt = taxAmt;
|
||||
@ -62,8 +76,8 @@ class GoodsAndServiceTax {
|
||||
if (tax.account === 'CGST') row.cgstAmt = taxAmt;
|
||||
if (tax.account === 'SGST') row.sgstAmt = taxAmt;
|
||||
});
|
||||
row.invAmt = invoiceDetails.grandTotal;
|
||||
row.taxAmt = invoiceDetails.netTotal;
|
||||
row.invAmt = entryDetails.grandTotal;
|
||||
row.taxAmt = entryDetails.netTotal;
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,12 @@ module.exports = {
|
||||
title: title,
|
||||
method: 'gst-taxes',
|
||||
filterFields: [
|
||||
{
|
||||
fieldtype: 'Select',
|
||||
label: 'Report Type',
|
||||
fieldname: 'reportType',
|
||||
options: ['', 'GSTR-1', 'GSTR-2', 'GSTR-3B']
|
||||
},
|
||||
{
|
||||
fieldtype: 'Data',
|
||||
label: 'Transfer Type',
|
||||
@ -35,8 +41,8 @@ module.exports = {
|
||||
},
|
||||
{
|
||||
fieldtype: 'Data',
|
||||
fieldname: 'cusName',
|
||||
label: 'Customer Name',
|
||||
fieldname: 'partyName',
|
||||
label: 'Party',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
|
@ -1,17 +1,50 @@
|
||||
<template>
|
||||
<div class="page-header px-4 py-3 border-bottom bg-white">
|
||||
<h5 class="m-0">{{ title }}</h5>
|
||||
<div class="page-header px-4 py-3 border-bottom bg-white d-flex align-items-center">
|
||||
<h5 class="m-0" v-if="title">{{ title }}</h5>
|
||||
<div v-if="breadcrumbs">
|
||||
<a v-for="(item, index) in clickableBreadcrumbs" :key="index" :href="item.route">
|
||||
<h5 class="breadCrumbRoute">
|
||||
{{ item.title }}
|
||||
<feather-icon name="arrow-right" style="color: #212529 !important;"></feather-icon>
|
||||
</h5>
|
||||
</a>
|
||||
<h5 class="breadCrumbRoute">{{ lastBreadcrumb.title }}</h5>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: ['title']
|
||||
props: ['title', 'breadcrumbs'],
|
||||
computed: {
|
||||
clickableBreadcrumbs() {
|
||||
return this.breadcrumbs.slice(0, this.breadcrumbs.length - 1);
|
||||
},
|
||||
lastBreadcrumb() {
|
||||
return this.breadcrumbs[this.breadcrumbs.length - 1];
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
<style lang="scss">
|
||||
@import '../styles/variables.scss';
|
||||
.page-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
.breadCrumbRoute {
|
||||
display: inline;
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #212529;
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
color: $frappe;
|
||||
}
|
||||
}
|
||||
.feather-icon {
|
||||
position: relative;
|
||||
bottom: -2px;
|
||||
}
|
||||
</style>
|
||||
|
@ -5,36 +5,36 @@
|
||||
<h6 class="m-0">{{ companyName }}</h6>
|
||||
</div>
|
||||
<div>
|
||||
<!-- <transition-group name="slide-fade-group"> -->
|
||||
<div v-for="group in groups" :key="group">
|
||||
<div
|
||||
:class="['sidebar-item px-1 py-2', activeGroup === group ? 'active' : '']"
|
||||
@click="toggleGroup(group)"
|
||||
style="user-select: none;"
|
||||
>
|
||||
<div class="d-flex align-items-center">
|
||||
<feather-icon
|
||||
class="mr-1"
|
||||
:name="openGroup === group ? 'chevron-down' : 'chevron-right'"
|
||||
/>
|
||||
{{group }}
|
||||
</div>
|
||||
</div>
|
||||
<transition name="slide-fade">
|
||||
<div v-if="openGroup === group">
|
||||
<div
|
||||
v-for="item in groupItems"
|
||||
style="user-select: none;"
|
||||
:class="['sidebar-item pl-4 py-2 ', isCurrentRoute(item.route) ? 'active' : '']"
|
||||
@click="routeTo(item.route)"
|
||||
:key="item.label"
|
||||
>
|
||||
<div class="d-flex align-items-center">{{ item.label }}</div>
|
||||
<transition-group name="slide-fade" mode="out-in">
|
||||
<div v-for="group in groups" :key="group">
|
||||
<div
|
||||
:class="['sidebar-item px-1 py-2', activeGroup === group ? 'active' : '']"
|
||||
@click="toggleGroup(group)"
|
||||
style="user-select: none;"
|
||||
>
|
||||
<div class="d-flex align-items-center">
|
||||
<feather-icon
|
||||
class="mr-1"
|
||||
:name="openGroup === group ? 'chevron-down' : 'chevron-right'"
|
||||
/>
|
||||
{{group }}
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</div>
|
||||
<!-- </transition-group> -->
|
||||
<transition name="slide-fade" mode="out-in">
|
||||
<div v-if="openGroup === group">
|
||||
<div
|
||||
v-for="item in groupItems"
|
||||
style="user-select: none;"
|
||||
:class="['sidebar-item pl-4 py-2 ', isCurrentRoute(item.route) ? 'active' : '']"
|
||||
@click="routeTo(item.route)"
|
||||
:key="item.label"
|
||||
>
|
||||
<div class="d-flex align-items-center">{{ item.label }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</div>
|
||||
</transition-group>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@ -150,24 +150,18 @@ export default {
|
||||
}
|
||||
}
|
||||
.slide-fade-enter-active {
|
||||
transition: all 0.2s ease;
|
||||
transition: all 0.6s ease 0.1s;
|
||||
}
|
||||
.slide-fade-leave-active {
|
||||
transition: all 0.3s ease-out;
|
||||
transition: all 0.3s ease;
|
||||
position: absolute;
|
||||
}
|
||||
.slide-fade-enter,
|
||||
.slide-fade-leave-to {
|
||||
transform: translateX(-5px);
|
||||
transform: translateX(-15px);
|
||||
opacity: 0;
|
||||
}
|
||||
// .slide-fade-group-enter-active {
|
||||
// transition: all 0.5s ease;
|
||||
// }
|
||||
// .slide-fade-group-leave-active {
|
||||
// transition: all 0.5s ease-out;
|
||||
// }
|
||||
// .slide-fade-group-enter,
|
||||
// .slide-fade-group-leave-to {
|
||||
// transform: translateY(-10px);
|
||||
// }
|
||||
.slide-fade-move {
|
||||
transition: transform 0.5s 0.1s;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div class="bg-light">
|
||||
<page-header :breadcrumbs="breadcrumbs" />
|
||||
<div class="form-container col-10 bg-white mt-4 ml-auto mr-auto border p-5">
|
||||
<form-actions
|
||||
v-if="shouldRenderForm"
|
||||
@ -51,6 +52,21 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
breadcrumbs() {
|
||||
if (this.doc)
|
||||
return [
|
||||
{
|
||||
title: this.doctype,
|
||||
route: '#/list/' + this.doctype
|
||||
},
|
||||
{
|
||||
title: this.doc._notInserted
|
||||
? 'New ' + this.doctype
|
||||
: this.doc.name,
|
||||
route: ''
|
||||
}
|
||||
];
|
||||
},
|
||||
shouldRenderForm() {
|
||||
return this.name && this.doc;
|
||||
},
|
||||
|
@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="p-4">
|
||||
<div class="px-3">
|
||||
<div class="row pb-4">
|
||||
<h4 class="col-6 d-flex">{{ reportConfig.title }}</h4>
|
||||
<!-- <h4 class="col-6 d-flex">{{ reportConfig.title }}</h4> -->
|
||||
<page-header :class="linksExists ? 'col-6':'col-12'" :breadcrumbs="breadcrumbs" />
|
||||
<report-links class="col-6 d-flex pr-0 flex-row-reverse" v-if="linksExists" :links="links"></report-links>
|
||||
</div>
|
||||
<div class="row pb-4">
|
||||
@ -24,12 +25,25 @@ import DataTable from 'frappe-datatable';
|
||||
import frappe from 'frappejs';
|
||||
import ReportFilters from 'frappejs/ui/pages/Report/ReportFilters';
|
||||
import ReportLinks from 'frappejs/ui/pages/Report/ReportLinks';
|
||||
import PageHeader from '@/components/PageHeader';
|
||||
import utils from 'frappejs/client/ui/utils';
|
||||
|
||||
export default {
|
||||
name: 'Report',
|
||||
props: ['reportName', 'reportConfig', 'filters'],
|
||||
computed: {
|
||||
breadcrumbs() {
|
||||
return [
|
||||
{
|
||||
title: 'Reports',
|
||||
route: '#/reportList'
|
||||
},
|
||||
{
|
||||
title: this.reportConfig.title,
|
||||
route: ''
|
||||
}
|
||||
];
|
||||
},
|
||||
filtersExists() {
|
||||
return (this.reportConfig.filterFields || []).length;
|
||||
},
|
||||
@ -39,7 +53,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
reportName() {
|
||||
//FIX: Report data forwards to next consecutively changed report
|
||||
//FIX: Report's data forwards to next consecutively changed report
|
||||
this.getReportData(this.filters);
|
||||
}
|
||||
},
|
||||
@ -114,7 +128,8 @@ export default {
|
||||
},
|
||||
components: {
|
||||
ReportFilters,
|
||||
ReportLinks
|
||||
ReportLinks,
|
||||
PageHeader
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -5,8 +5,7 @@ import ListView from '../pages/ListView';
|
||||
import FormView from '../pages/FormView/FormView';
|
||||
import PrintView from '../pages/PrintView';
|
||||
|
||||
// import Report from '../pages/Report';
|
||||
import Report from 'frappejs/ui/pages/Report';
|
||||
import Report from '../pages/Report';
|
||||
import reportViewConfig from '../../reports/view';
|
||||
|
||||
import DataImport from '../pages/DataImport';
|
||||
|
Loading…
Reference in New Issue
Block a user