mirror of
https://github.com/frappe/books.git
synced 2024-11-09 23:30:56 +00:00
fix: dateRanges on PnL, Bal Sheet
This commit is contained in:
parent
7c60b71294
commit
9c7fa8f517
@ -230,7 +230,7 @@ export abstract class AccountReport extends LedgerReport {
|
|||||||
const toDate = dr.toDate.toMillis();
|
const toDate = dr.toDate.toMillis();
|
||||||
const fromDate = dr.fromDate.toMillis();
|
const fromDate = dr.fromDate.toMillis();
|
||||||
|
|
||||||
if (fromDate < entryDate && entryDate <= toDate) {
|
if (entryDate >= fromDate && entryDate < toDate) {
|
||||||
return dr;
|
return dr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,9 +278,9 @@ export abstract class AccountReport extends LedgerReport {
|
|||||||
let fromDate: string;
|
let fromDate: string;
|
||||||
|
|
||||||
if (this.basedOn === 'Until Date') {
|
if (this.basedOn === 'Until Date') {
|
||||||
toDate = this.toDate!;
|
toDate = DateTime.fromISO(this.toDate!).plus({ days: 1 }).toISODate();
|
||||||
const months = monthsMap[this.periodicity] * Math.max(this.count ?? 1, 1);
|
const months = monthsMap[this.periodicity] * Math.max(this.count ?? 1, 1);
|
||||||
fromDate = DateTime.fromISO(toDate).minus({ months }).toISODate();
|
fromDate = DateTime.fromISO(this.toDate!).minus({ months }).toISODate();
|
||||||
} else {
|
} else {
|
||||||
const fy = await getFiscalEndpoints(
|
const fy = await getFiscalEndpoints(
|
||||||
this.toYear!,
|
this.toYear!,
|
||||||
@ -299,7 +299,7 @@ export abstract class AccountReport extends LedgerReport {
|
|||||||
const { fromDate, toDate } = await this._getFromAndToDates();
|
const { fromDate, toDate } = await this._getFromAndToDates();
|
||||||
|
|
||||||
const dateFilter: string[] = [];
|
const dateFilter: string[] = [];
|
||||||
dateFilter.push('<=', toDate);
|
dateFilter.push('<', toDate);
|
||||||
dateFilter.push('>=', fromDate);
|
dateFilter.push('>=', fromDate);
|
||||||
|
|
||||||
filters.date = dateFilter;
|
filters.date = dateFilter;
|
||||||
@ -342,17 +342,17 @@ export abstract class AccountReport extends LedgerReport {
|
|||||||
let dateFilters = [
|
let dateFilters = [
|
||||||
{
|
{
|
||||||
fieldtype: 'Int',
|
fieldtype: 'Int',
|
||||||
fieldname: 'toYear',
|
fieldname: 'fromYear',
|
||||||
placeholder: t`To Year`,
|
placeholder: t`From Year`,
|
||||||
label: t`To Year`,
|
label: t`From Year`,
|
||||||
minvalue: 2000,
|
minvalue: 2000,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldtype: 'Int',
|
fieldtype: 'Int',
|
||||||
fieldname: 'fromYear',
|
fieldname: 'toYear',
|
||||||
placeholder: t`From Year`,
|
placeholder: t`To Year`,
|
||||||
label: t`From Year`,
|
label: t`To Year`,
|
||||||
minvalue: 2000,
|
minvalue: 2000,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
@ -407,16 +407,18 @@ export abstract class AccountReport extends LedgerReport {
|
|||||||
|
|
||||||
const dateColumns = this._dateRanges!.sort(
|
const dateColumns = this._dateRanges!.sort(
|
||||||
(a, b) => b.toDate.toMillis() - a.toDate.toMillis()
|
(a, b) => b.toDate.toMillis() - a.toDate.toMillis()
|
||||||
).map(
|
).map((d) => {
|
||||||
(d) =>
|
const toDate = d.toDate.minus({ days: 1 });
|
||||||
({
|
const label = this.fyo.format(toDate.toJSDate(), 'Date');
|
||||||
label: this.fyo.format(d.toDate.toJSDate(), 'Date'),
|
|
||||||
fieldtype: 'Data',
|
return {
|
||||||
fieldname: 'toDate',
|
label,
|
||||||
align: 'right',
|
fieldtype: 'Data',
|
||||||
width: ACC_BAL_WIDTH,
|
fieldname: 'toDate',
|
||||||
} as ColumnField)
|
align: 'right',
|
||||||
);
|
width: ACC_BAL_WIDTH,
|
||||||
|
} as ColumnField;
|
||||||
|
});
|
||||||
|
|
||||||
return [columns, dateColumns].flat();
|
return [columns, dateColumns].flat();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user