ci: add prettier to pre-commit (backport #40206) (#40362)

* ci: add prettier to pre-commit

(cherry picked from commit 2c16036ef3)

* style: format js files

---------

Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com>
Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
mergify[bot]
2024-03-11 10:47:18 +05:30
committed by GitHub
parent 5f789d9abe
commit 7d3d2eb928
572 changed files with 24271 additions and 21331 deletions

View File

@@ -1,34 +1,33 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Address And Contacts"] = {
"filters": [
filters: [
{
"reqd": 1,
"fieldname":"party_type",
"label": __("Party Type"),
"fieldtype": "Link",
"options": "DocType",
"get_query": function() {
reqd: 1,
fieldname: "party_type",
label: __("Party Type"),
fieldtype: "Link",
options: "DocType",
get_query: function () {
return {
"filters": {
"name": ["in","Customer,Supplier,Sales Partner,Lead"],
}
}
}
filters: {
name: ["in", "Customer,Supplier,Sales Partner,Lead"],
},
};
},
},
{
"fieldname":"party_name",
"label": __("Party Name"),
"fieldtype": "Dynamic Link",
"get_options": function() {
let party_type = frappe.query_report.get_filter_value('party_type');
if(!party_type) {
fieldname: "party_name",
label: __("Party Name"),
fieldtype: "Dynamic Link",
get_options: function () {
let party_type = frappe.query_report.get_filter_value("party_type");
if (!party_type) {
frappe.throw(__("Please select Party Type first"));
}
return party_type;
}
}
]
}
},
},
],
};

View File

@@ -2,7 +2,5 @@
// For license information, please see license.txt
frappe.query_reports["Available Stock for Packing Items"] = {
"filters": [
]
}
filters: [],
};

View File

@@ -2,43 +2,43 @@
// License: GNU General Public License v3. See license.txt
frappe.query_reports["Customer Acquisition and Loyalty"] = {
"filters": [
filters: [
{
"fieldname": "view_type",
"label": __("View Type"),
"fieldtype": "Select",
"options": ["Monthly", "Territory Wise"],
"default": "Monthly",
"reqd": 1
fieldname: "view_type",
label: __("View Type"),
fieldtype: "Select",
options: ["Monthly", "Territory Wise"],
default: "Monthly",
reqd: 1,
},
{
"fieldname":"company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company"),
"reqd": 1
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company"),
reqd: 1,
},
{
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
"reqd": 1
fieldname: "from_date",
label: __("From Date"),
fieldtype: "Date",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
reqd: 1,
},
{
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
"reqd": 1
}
fieldname: "to_date",
label: __("To Date"),
fieldtype: "Date",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
reqd: 1,
},
],
'formatter': function(value, row, column, data, default_formatter) {
formatter: function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data);
if (data && data.bold) {
value = value.bold();
}
return value;
}
}
},
};

View File

@@ -2,20 +2,20 @@
// For license information, please see license.txt
frappe.query_reports["Customer Credit Balance"] = {
"filters": [
filters: [
{
"fieldname":"company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"reqd": 1,
"default": frappe.defaults.get_user_default("Company")
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
reqd: 1,
default: frappe.defaults.get_user_default("Company"),
},
{
"fieldname":"customer",
"label": __("Customer"),
"fieldtype": "Link",
"options": "Customer"
}
]
}
fieldname: "customer",
label: __("Customer"),
fieldtype: "Link",
options: "Customer",
},
],
};

View File

@@ -1,27 +1,26 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Customer-wise Item Price"] = {
"filters": [
filters: [
{
"label": __("Customer"),
"fieldname": "customer",
"fieldtype": "Link",
"options": "Customer",
"reqd": 1
label: __("Customer"),
fieldname: "customer",
fieldtype: "Link",
options: "Customer",
reqd: 1,
},
{
"label": __("Item"),
"fieldname": "item",
"fieldtype": "Link",
"options": "Item",
"get_query": () => {
label: __("Item"),
fieldname: "item",
fieldtype: "Link",
options: "Item",
get_query: () => {
return {
query: "erpnext.controllers.queries.item_query",
filters: { 'is_sales_item': 1 }
}
}
}
]
}
filters: { is_sales_item: 1 },
};
},
},
],
};

View File

@@ -2,19 +2,19 @@
// For license information, please see license.txt
frappe.query_reports["Inactive Customers"] = {
"filters": [
filters: [
{
"fieldname":"days_since_last_order",
"label": __("Days Since Last Order"),
"fieldtype": "Int",
"default": 60
fieldname: "days_since_last_order",
label: __("Days Since Last Order"),
fieldtype: "Int",
default: 60,
},
{
"fieldname":"doctype",
"label": __("Doctype"),
"fieldtype": "Select",
"default": "Sales Order",
"options": "Sales Order\nSales Invoice"
}
]
}
fieldname: "doctype",
label: __("Doctype"),
fieldtype: "Select",
default: "Sales Order",
options: "Sales Order\nSales Invoice",
},
],
};

View File

@@ -1,57 +1,56 @@
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Item-wise Sales History"] = {
"filters": [
filters: [
{
fieldname:"company",
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company"),
reqd: 1
reqd: 1,
},
{
fieldname:"from_date",
fieldname: "from_date",
reqd: 1,
label: __("From Date"),
fieldtype: "Date",
default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
},
{
fieldname:"to_date",
fieldname: "to_date",
reqd: 1,
default: frappe.datetime.get_today(),
label: __("To Date"),
fieldtype: "Date",
},
{
fieldname:"item_group",
fieldname: "item_group",
label: __("Item Group"),
fieldtype: "Link",
options: "Item Group"
options: "Item Group",
},
{
fieldname:"item_code",
fieldname: "item_code",
label: __("Item"),
fieldtype: "Link",
options: "Item",
get_query: () => {
return {
query: "erpnext.controllers.queries.item_query"
}
}
query: "erpnext.controllers.queries.item_query",
};
},
},
{
fieldname:"customer",
fieldname: "customer",
label: __("Customer"),
fieldtype: "Link",
options: "Customer"
}
options: "Customer",
},
],
"formatter": function (value, row, column, data, default_formatter) {
formatter: function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data);
let format_fields = ["delivered_quantity", "billed_amount"];
@@ -59,5 +58,5 @@ frappe.query_reports["Item-wise Sales History"] = {
value = "<span style='color:green;'>" + value + "</span>";
}
return value;
}
},
};

View File

@@ -1,144 +1,138 @@
// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
function get_filters() {
let filters = [
{
"fieldname":"company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company"),
"reqd": 1
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company"),
reqd: 1,
},
{
"fieldname":"period_start_date",
"label": __("Start Date"),
"fieldtype": "Date",
"reqd": 1,
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1)
fieldname: "period_start_date",
label: __("Start Date"),
fieldtype: "Date",
reqd: 1,
default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
},
{
"fieldname":"period_end_date",
"label": __("End Date"),
"fieldtype": "Date",
"reqd": 1,
"default": frappe.datetime.get_today()
fieldname: "period_end_date",
label: __("End Date"),
fieldtype: "Date",
reqd: 1,
default: frappe.datetime.get_today(),
},
{
"fieldname":"customer_group",
"label": __("Customer Group"),
"fieldtype": "Link",
"width": 100,
"options": "Customer Group",
fieldname: "customer_group",
label: __("Customer Group"),
fieldtype: "Link",
width: 100,
options: "Customer Group",
},
{
"fieldname":"customer",
"label": __("Customer"),
"fieldtype": "Link",
"width": 100,
"options": "Customer",
"get_query": () => {
var customer_group = frappe.query_report.get_filter_value('customer_group');
return{
"query": "erpnext.selling.report.payment_terms_status_for_sales_order.payment_terms_status_for_sales_order.get_customers_or_items",
"filters": [
['Customer', 'disabled', '=', '0'],
['Customer Group','name', '=', customer_group]
]
}
}
fieldname: "customer",
label: __("Customer"),
fieldtype: "Link",
width: 100,
options: "Customer",
get_query: () => {
var customer_group = frappe.query_report.get_filter_value("customer_group");
return {
query: "erpnext.selling.report.payment_terms_status_for_sales_order.payment_terms_status_for_sales_order.get_customers_or_items",
filters: [
["Customer", "disabled", "=", "0"],
["Customer Group", "name", "=", customer_group],
],
};
},
},
{
"fieldname":"item_group",
"label": __("Item Group"),
"fieldtype": "Link",
"width": 100,
"options": "Item Group",
fieldname: "item_group",
label: __("Item Group"),
fieldtype: "Link",
width: 100,
options: "Item Group",
},
{
"fieldname":"item",
"label": __("Item"),
"fieldtype": "Link",
"width": 100,
"options": "Item",
"get_query": () => {
var item_group = frappe.query_report.get_filter_value('item_group');
return{
"query": "erpnext.selling.report.payment_terms_status_for_sales_order.payment_terms_status_for_sales_order.get_customers_or_items",
"filters": [
['Item', 'disabled', '=', '0'],
['Item Group','name', '=', item_group]
]
}
}
fieldname: "item",
label: __("Item"),
fieldtype: "Link",
width: 100,
options: "Item",
get_query: () => {
var item_group = frappe.query_report.get_filter_value("item_group");
return {
query: "erpnext.selling.report.payment_terms_status_for_sales_order.payment_terms_status_for_sales_order.get_customers_or_items",
filters: [
["Item", "disabled", "=", "0"],
["Item Group", "name", "=", item_group],
],
};
},
},
{
"fieldname":"from_due_date",
"label": __("From Due Date"),
"fieldtype": "Date",
fieldname: "from_due_date",
label: __("From Due Date"),
fieldtype: "Date",
},
{
"fieldname":"to_due_date",
"label": __("To Due Date"),
"fieldtype": "Date",
fieldname: "to_due_date",
label: __("To Due Date"),
fieldtype: "Date",
},
{
"fieldname":"status",
"label": __("Status"),
"fieldtype": "MultiSelectList",
"width": 100,
get_data: function(txt) {
let status = ["Overdue", "Unpaid", "Completed", "Partly Paid"]
let options = []
for (let option of status){
fieldname: "status",
label: __("Status"),
fieldtype: "MultiSelectList",
width: 100,
get_data: function (txt) {
let status = ["Overdue", "Unpaid", "Completed", "Partly Paid"];
let options = [];
for (let option of status) {
options.push({
"value": option,
"label": __(option),
"description": ""
})
value: option,
label: __(option),
description: "",
});
}
return options
}
return options;
},
},
{
"fieldname":"only_immediate_upcoming_term",
"label": __("Show only the Immediate Upcoming Term"),
"fieldtype": "Check",
fieldname: "only_immediate_upcoming_term",
label: __("Show only the Immediate Upcoming Term"),
fieldtype: "Check",
},
]
];
return filters;
}
frappe.query_reports["Payment Terms Status for Sales Order"] = {
"filters": get_filters(),
"formatter": function(value, row, column, data, default_formatter){
if(column.fieldname == 'invoices' && value) {
let invoices = value.split(',');
filters: get_filters(),
formatter: function (value, row, column, data, default_formatter) {
if (column.fieldname == "invoices" && value) {
let invoices = value.split(",");
const invoice_formatter = (prev_value, curr_value) => {
if(prev_value != "") {
if (prev_value != "") {
return prev_value + ", " + default_formatter(curr_value, row, column, data);
}
else {
} else {
return default_formatter(curr_value, row, column, data);
}
}
return invoices.reduce(invoice_formatter, "")
}
else if (column.fieldname == 'paid_amount' && value){
};
return invoices.reduce(invoice_formatter, "");
} else if (column.fieldname == "paid_amount" && value) {
let formatted_value = default_formatter(value, row, column, data);
if(value > 0) {
formatted_value = "<span style='color:green;'>" + formatted_value + "</span>"
if (value > 0) {
formatted_value = "<span style='color:green;'>" + formatted_value + "</span>";
}
return formatted_value;
}
else if (column.fieldname == 'status' && value == 'Completed'){
} else if (column.fieldname == "status" && value == "Completed") {
return "<span style='color:green;'>" + default_formatter(value, row, column, data) + "</span>";
}
return default_formatter(value, row, column, data);
},
};

View File

@@ -1,6 +1,4 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Pending SO Items For Purchase Request"] = {
}
frappe.query_reports["Pending SO Items For Purchase Request"] = {};

View File

@@ -1,8 +1,8 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.require("assets/erpnext/js/sales_trends_filters.js", function() {
frappe.require("assets/erpnext/js/sales_trends_filters.js", function () {
frappe.query_reports["Quotation Trends"] = {
filters: erpnext.get_sales_trends_filters()
}
filters: erpnext.get_sales_trends_filters(),
};
});

View File

@@ -1,49 +1,56 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Sales Analytics"] = {
"filters": [
filters: [
{
fieldname: "tree_type",
label: __("Tree Type"),
fieldtype: "Select",
options: ["Customer Group", "Customer", "Item Group", "Item", "Territory", "Order Type", "Project"],
options: [
"Customer Group",
"Customer",
"Item Group",
"Item",
"Territory",
"Order Type",
"Project",
],
default: "Customer",
reqd: 1
reqd: 1,
},
{
fieldname: "doc_type",
label: __("based_on"),
fieldtype: "Select",
options: ["Sales Order","Delivery Note","Sales Invoice"],
options: ["Sales Order", "Delivery Note", "Sales Invoice"],
default: "Sales Invoice",
reqd: 1
reqd: 1,
},
{
fieldname: "value_quantity",
label: __("Value Or Qty"),
fieldtype: "Select",
options: [
{ "value": "Value", "label": __("Value") },
{ "value": "Quantity", "label": __("Quantity") },
{ value: "Value", label: __("Value") },
{ value: "Quantity", label: __("Quantity") },
],
default: "Value",
reqd: 1
reqd: 1,
},
{
fieldname: "from_date",
label: __("From Date"),
fieldtype: "Date",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
reqd: 1
reqd: 1,
},
{
fieldname:"to_date",
fieldname: "to_date",
label: __("To Date"),
fieldtype: "Date",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
reqd: 1
reqd: 1,
},
{
fieldname: "company",
@@ -51,21 +58,21 @@ frappe.query_reports["Sales Analytics"] = {
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company"),
reqd: 1
reqd: 1,
},
{
fieldname: "range",
label: __("Range"),
fieldtype: "Select",
options: [
{ "value": "Weekly", "label": __("Weekly") },
{ "value": "Monthly", "label": __("Monthly") },
{ "value": "Quarterly", "label": __("Quarterly") },
{ "value": "Yearly", "label": __("Yearly") }
{ value: "Weekly", label: __("Weekly") },
{ value: "Monthly", label: __("Monthly") },
{ value: "Quarterly", label: __("Quarterly") },
{ value: "Yearly", label: __("Yearly") },
],
default: "Monthly",
reqd: 1
}
reqd: 1,
},
],
get_datatable_options(options) {
return Object.assign(options, {
@@ -73,32 +80,26 @@ frappe.query_reports["Sales Analytics"] = {
events: {
onCheckRow: function (data) {
if (!data) return;
const data_doctype = $(
data[2].html
)[0].attributes.getNamedItem("data-doctype").value;
const data_doctype = $(data[2].html)[0].attributes.getNamedItem("data-doctype").value;
const tree_type = frappe.query_report.filters[0].value;
if (data_doctype != tree_type) return;
const row_name = data[2].content;
const raw_data = frappe.query_report.chart.data;
const new_datasets = raw_data.datasets;
const element_found = new_datasets.some(
(element, index, array) => {
if (element.name == row_name) {
array.splice(index, 1);
return true;
}
return false;
const element_found = new_datasets.some((element, index, array) => {
if (element.name == row_name) {
array.splice(index, 1);
return true;
}
);
return false;
});
const slice_at = { Customer: 4, Item: 5 }[tree_type] || 3;
if (!element_found) {
new_datasets.push({
name: row_name,
values: data
.slice(slice_at, data.length - 1)
.map(column => column.content),
values: data.slice(slice_at, data.length - 1).map((column) => column.content),
});
}
@@ -106,7 +107,9 @@ frappe.query_reports["Sales Analytics"] = {
labels: raw_data.labels,
datasets: new_datasets,
};
const new_options = Object.assign({}, frappe.query_report.chart_options, {data: new_data});
const new_options = Object.assign({}, frappe.query_report.chart_options, {
data: new_data,
});
frappe.query_report.render_chart(new_options);
frappe.query_report.raw_chart_data = new_data;

View File

@@ -1,82 +1,81 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Sales Order Analysis"] = {
"filters": [
filters: [
{
"fieldname": "company",
"label": __("Company"),
"fieldtype": "Link",
"width": "80",
"options": "Company",
"reqd": 1,
"default": frappe.defaults.get_default("company")
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
width: "80",
options: "Company",
reqd: 1,
default: frappe.defaults.get_default("company"),
},
{
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "Date",
"width": "80",
"reqd": 1,
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
fieldname: "from_date",
label: __("From Date"),
fieldtype: "Date",
width: "80",
reqd: 1,
default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
},
{
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
"width": "80",
"reqd": 1,
"default": frappe.datetime.get_today()
fieldname: "to_date",
label: __("To Date"),
fieldtype: "Date",
width: "80",
reqd: 1,
default: frappe.datetime.get_today(),
},
{
"fieldname": "sales_order",
"label": __("Sales Order"),
"fieldtype": "MultiSelectList",
"width": "80",
"options": "Sales Order",
"get_data": function(txt) {
fieldname: "sales_order",
label: __("Sales Order"),
fieldtype: "MultiSelectList",
width: "80",
options: "Sales Order",
get_data: function (txt) {
return frappe.db.get_link_options("Sales Order", txt);
},
"get_query": () =>{
get_query: () => {
return {
filters: { "docstatus": 1 }
}
}
filters: { docstatus: 1 },
};
},
},
{
"fieldname": "warehouse",
"label": __("Warehouse"),
"fieldtype": "Link",
"options": "Warehouse"
fieldname: "warehouse",
label: __("Warehouse"),
fieldtype: "Link",
options: "Warehouse",
},
{
"fieldname": "status",
"label": __("Status"),
"fieldtype": "MultiSelectList",
"width": "80",
get_data: function(txt) {
let status = ["To Bill", "To Deliver", "To Deliver and Bill", "Completed"]
let options = []
for (let option of status){
fieldname: "status",
label: __("Status"),
fieldtype: "MultiSelectList",
width: "80",
get_data: function (txt) {
let status = ["To Bill", "To Deliver", "To Deliver and Bill", "Completed"];
let options = [];
for (let option of status) {
options.push({
"value": option,
"label": __(option),
"description": ""
})
value: option,
label: __(option),
description: "",
});
}
return options
}
return options;
},
},
{
"fieldname": "group_by_so",
"label": __("Group by Sales Order"),
"fieldtype": "Check",
"default": 0
}
fieldname: "group_by_so",
label: __("Group by Sales Order"),
fieldtype: "Check",
default: 0,
},
],
"formatter": function (value, row, column, data, default_formatter) {
formatter: function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data);
let format_fields = ["delivered_qty", "billed_amount"];
@@ -88,5 +87,5 @@ frappe.query_reports["Sales Order Analysis"] = {
value = "<span style='color:red;'>" + value + "</span>";
}
return value;
}
},
};

View File

@@ -1,8 +1,8 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.require("assets/erpnext/js/sales_trends_filters.js", function() {
frappe.require("assets/erpnext/js/sales_trends_filters.js", function () {
frappe.query_reports["Sales Order Trends"] = {
filters: erpnext.get_sales_trends_filters()
}
filters: erpnext.get_sales_trends_filters(),
};
});

View File

@@ -1,22 +1,20 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Sales Partner Commission Summary"] = {
"filters": [
filters: [
{
fieldname: "sales_partner",
label: __("Sales Partner"),
fieldtype: "Link",
options: "Sales Partner"
options: "Sales Partner",
},
{
fieldname: "doctype",
label: __("Document Type"),
fieldtype: "Select",
options: "Sales Order\nDelivery Note\nSales Invoice",
default: "Sales Order"
default: "Sales Order",
},
{
fieldname: "from_date",
@@ -25,30 +23,29 @@ frappe.query_reports["Sales Partner Commission Summary"] = {
default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
},
{
fieldname:"to_date",
fieldname: "to_date",
label: __("To Date"),
fieldtype: "Date",
default: frappe.datetime.get_today()
default: frappe.datetime.get_today(),
},
{
fieldname:"company",
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company")
default: frappe.defaults.get_user_default("Company"),
},
{
fieldname:"customer",
fieldname: "customer",
label: __("Customer"),
fieldtype: "Link",
options: "Customer",
},
{
fieldname:"territory",
fieldname: "territory",
label: __("Territory"),
fieldtype: "Link",
options: "Territory",
},
]
}
],
};

View File

@@ -1,63 +1,60 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Sales Partner Target Variance based on Item Group"] = {
"filters": [
filters: [
{
fieldname:"company",
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company")
default: frappe.defaults.get_user_default("Company"),
},
{
fieldname: "fiscal_year",
label: __("Fiscal Year"),
fieldtype: "Link",
options: "Fiscal Year",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today())
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
},
{
fieldname: "doctype",
label: __("Document Type"),
fieldtype: "Select",
options: "Sales Order\nDelivery Note\nSales Invoice",
default: "Sales Order"
default: "Sales Order",
},
{
fieldname: "period",
label: __("Period"),
fieldtype: "Select",
options: [
{ "value": "Monthly", "label": __("Monthly") },
{ "value": "Quarterly", "label": __("Quarterly") },
{ "value": "Half-Yearly", "label": __("Half-Yearly") },
{ "value": "Yearly", "label": __("Yearly") }
{ value: "Monthly", label: __("Monthly") },
{ value: "Quarterly", label: __("Quarterly") },
{ value: "Half-Yearly", label: __("Half-Yearly") },
{ value: "Yearly", label: __("Yearly") },
],
default: "Monthly"
default: "Monthly",
},
{
fieldname: "target_on",
label: __("Target On"),
fieldtype: "Select",
options: "Quantity\nAmount",
default: "Quantity"
default: "Quantity",
},
],
"formatter": function (value, row, column, data, default_formatter) {
formatter: function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data);
if (column.fieldname.includes('variance')) {
if (column.fieldname.includes("variance")) {
if (data[column.fieldname] < 0) {
value = "<span style='color:red'>" + value + "</span>";
}
else if (data[column.fieldname] > 0) {
} else if (data[column.fieldname] > 0) {
value = "<span style='color:green'>" + value + "</span>";
}
}
return value;
}
}
},
};

View File

@@ -1,21 +1,20 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Sales Partner Transaction Summary"] = {
"filters": [
filters: [
{
fieldname: "sales_partner",
label: __("Sales Partner"),
fieldtype: "Link",
options: "Sales Partner"
options: "Sales Partner",
},
{
fieldname: "doctype",
label: __("Document Type"),
fieldtype: "Select",
options: "Sales Order\nDelivery Note\nSales Invoice",
default: "Sales Order"
default: "Sales Order",
},
{
fieldname: "from_date",
@@ -24,48 +23,48 @@ frappe.query_reports["Sales Partner Transaction Summary"] = {
default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
},
{
fieldname:"to_date",
fieldname: "to_date",
label: __("To Date"),
fieldtype: "Date",
default: frappe.datetime.get_today()
default: frappe.datetime.get_today(),
},
{
fieldname:"company",
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company"),
reqd: 1
reqd: 1,
},
{
fieldname:"item_group",
fieldname: "item_group",
label: __("Item Group"),
fieldtype: "Link",
options: "Item Group",
},
{
fieldname:"brand",
fieldname: "brand",
label: __("Brand"),
fieldtype: "Link",
options: "Brand",
},
{
fieldname:"customer",
fieldname: "customer",
label: __("Customer"),
fieldtype: "Link",
options: "Customer",
},
{
fieldname:"territory",
fieldname: "territory",
label: __("Territory"),
fieldtype: "Link",
options: "Territory",
},
{
fieldname:"show_return_entries",
fieldname: "show_return_entries",
label: __("Show Return Entries"),
fieldtype: "Check",
default: 0,
},
]
}
],
};

View File

@@ -1,22 +1,20 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Sales Person Commission Summary"] = {
"filters": [
filters: [
{
fieldname: "sales_person",
label: __("Sales Person"),
fieldtype: "Link",
options: "Sales Person"
options: "Sales Person",
},
{
fieldname: "doc_type",
label: __("Document Type"),
fieldtype: "Select",
options: "Sales Order\nDelivery Note\nSales Invoice",
default: "Sales Order"
default: "Sales Order",
},
{
fieldname: "from_date",
@@ -25,30 +23,29 @@ frappe.query_reports["Sales Person Commission Summary"] = {
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
},
{
fieldname:"to_date",
fieldname: "to_date",
label: __("To Date"),
fieldtype: "Date",
default: frappe.datetime.get_today()
default: frappe.datetime.get_today(),
},
{
fieldname:"company",
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company")
default: frappe.defaults.get_user_default("Company"),
},
{
fieldname:"customer",
fieldname: "customer",
label: __("Customer"),
fieldtype: "Link",
options: "Customer",
},
{
fieldname:"territory",
fieldname: "territory",
label: __("Territory"),
fieldtype: "Link",
options: "Territory",
},
]
}
],
};

View File

@@ -1,15 +1,14 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Sales Person Target Variance Based On Item Group"] = {
"filters": [
filters: [
{
fieldname:"company",
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company")
default: frappe.defaults.get_user_default("Company"),
},
{
fieldname: "fiscal_year",
@@ -23,41 +22,39 @@ frappe.query_reports["Sales Person Target Variance Based On Item Group"] = {
label: __("Document Type"),
fieldtype: "Select",
options: "Sales Order\nDelivery Note\nSales Invoice",
default: "Sales Order"
default: "Sales Order",
},
{
fieldname: "period",
label: __("Period"),
fieldtype: "Select",
options: [
{ "value": "Monthly", "label": __("Monthly") },
{ "value": "Quarterly", "label": __("Quarterly") },
{ "value": "Half-Yearly", "label": __("Half-Yearly") },
{ "value": "Yearly", "label": __("Yearly") }
{ value: "Monthly", label: __("Monthly") },
{ value: "Quarterly", label: __("Quarterly") },
{ value: "Half-Yearly", label: __("Half-Yearly") },
{ value: "Yearly", label: __("Yearly") },
],
default: "Monthly"
default: "Monthly",
},
{
fieldname: "target_on",
label: __("Target On"),
fieldtype: "Select",
options: "Quantity\nAmount",
default: "Quantity"
default: "Quantity",
},
],
"formatter": function (value, row, column, data, default_formatter) {
formatter: function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data);
if (column.fieldname.includes('variance')) {
if (column.fieldname.includes("variance")) {
if (data[column.fieldname] < 0) {
value = "<span style='color:red'>" + value + "</span>";
}
else if (data[column.fieldname] > 0) {
} else if (data[column.fieldname] > 0) {
value = "<span style='color:green'>" + value + "</span>";
}
}
return value;
}
}
},
};

View File

@@ -2,19 +2,19 @@
// License: GNU General Public License v3. See license.txt
frappe.query_reports["Sales Person-wise Transaction Summary"] = {
"filters": [
filters: [
{
fieldname: "sales_person",
label: __("Sales Person"),
fieldtype: "Link",
options: "Sales Person"
options: "Sales Person",
},
{
fieldname: "doc_type",
label: __("Document Type"),
fieldtype: "Select",
options: "Sales Order\nDelivery Note\nSales Invoice",
default: "Sales Order"
default: "Sales Order",
},
{
fieldname: "from_date",
@@ -23,48 +23,48 @@ frappe.query_reports["Sales Person-wise Transaction Summary"] = {
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
},
{
fieldname:"to_date",
fieldname: "to_date",
label: __("To Date"),
fieldtype: "Date",
default: frappe.datetime.get_today()
default: frappe.datetime.get_today(),
},
{
fieldname:"company",
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company"),
reqd: 1
reqd: 1,
},
{
fieldname:"item_group",
fieldname: "item_group",
label: __("Item Group"),
fieldtype: "Link",
options: "Item Group",
},
{
fieldname:"brand",
fieldname: "brand",
label: __("Brand"),
fieldtype: "Link",
options: "Brand",
},
{
fieldname:"customer",
fieldname: "customer",
label: __("Customer"),
fieldtype: "Link",
options: "Customer",
},
{
fieldname:"territory",
fieldname: "territory",
label: __("Territory"),
fieldtype: "Link",
options: "Territory",
},
{
fieldname:"show_return_entries",
fieldname: "show_return_entries",
label: __("Show Return Entries"),
fieldtype: "Check",
default: 0,
},
]
}
],
};

View File

@@ -1,63 +1,60 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Territory Target Variance Based On Item Group"] = {
"filters": [
filters: [
{
fieldname:"company",
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company")
default: frappe.defaults.get_user_default("Company"),
},
{
fieldname: "fiscal_year",
label: __("Fiscal Year"),
fieldtype: "Link",
options: "Fiscal Year",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today())
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
},
{
fieldname: "doctype",
label: __("Document Type"),
fieldtype: "Select",
options: "Sales Order\nDelivery Note\nSales Invoice",
default: "Sales Order"
default: "Sales Order",
},
{
fieldname: "period",
label: __("Period"),
fieldtype: "Select",
options: [
{ "value": "Monthly", "label": __("Monthly") },
{ "value": "Quarterly", "label": __("Quarterly") },
{ "value": "Half-Yearly", "label": __("Half-Yearly") },
{ "value": "Yearly", "label": __("Yearly") }
{ value: "Monthly", label: __("Monthly") },
{ value: "Quarterly", label: __("Quarterly") },
{ value: "Half-Yearly", label: __("Half-Yearly") },
{ value: "Yearly", label: __("Yearly") },
],
default: "Monthly"
default: "Monthly",
},
{
fieldname: "target_on",
label: __("Target On"),
fieldtype: "Select",
options: "Quantity\nAmount",
default: "Quantity"
default: "Quantity",
},
],
"formatter": function (value, row, column, data, default_formatter) {
formatter: function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data);
if (column.fieldname.includes('variance')) {
if (column.fieldname.includes("variance")) {
if (data[column.fieldname] < 0) {
value = "<span style='color:red'>" + value + "</span>";
}
else if (data[column.fieldname] > 0) {
} else if (data[column.fieldname] > 0) {
value = "<span style='color:green'>" + value + "</span>";
}
}
return value;
}
}
},
};

View File

@@ -1,22 +1,23 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Territory-wise Sales"] = {
"breadcrumb":"Selling",
"filters": [
breadcrumb: "Selling",
filters: [
{
fieldname:"transaction_date",
fieldname: "transaction_date",
label: __("Transaction Date"),
fieldtype: "DateRange",
default: [frappe.datetime.add_months(frappe.datetime.get_today(),-1), frappe.datetime.get_today()],
default: [
frappe.datetime.add_months(frappe.datetime.get_today(), -1),
frappe.datetime.get_today(),
],
},
{
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
}
]
},
],
};