Skip to content

Commit

Permalink
Add: Reports
Browse files Browse the repository at this point in the history
  • Loading branch information
jabir-tridz committed Jan 8, 2024
1 parent 27bd2ac commit c3f149f
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 4 deletions.
3 changes: 3 additions & 0 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
8. Customer Data
9. Repeated Customers
10. Employee Sales
11. Employee Item Wise Sales
12. Service Wise Sales
13. Time Wise Sales


### Customizable Branch Timings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
],
"idx": 0,
"is_standard": "Yes",
"modified": "2023-12-06 10:45:01.466600",
"modified": "2024-01-08 11:12:47.938817",
"modified_by": "Administrator",
"module": "URY Pulse",
"name": "Cancelled Invoices",
"owner": "Administrator",
"prepared_report": 0,
"query": "SELECT \n b.`posting_date` AS \"Date\",\n CONCAT(\n LPAD(IF(HOUR(b.`posting_time`) > 12, HOUR(b.`posting_time`) - 12, HOUR(b.`posting_time`)), 2, '0'),\n ':',\n SUBSTRING_INDEX(SUBSTRING_INDEX(b.`posting_time`, ':', 2), ':', -1),\n CASE WHEN HOUR(b.`posting_time`) >= 12 THEN ' PM' ELSE ' AM' END\n ) AS \"Time\",\n b.`name` AS \"Invoice:Link/POS Invoice\",\n b.`modified_by` AS \"Cancelled By\"\nFROM \n (\n SELECT %(start_date)s AS `date`\n UNION\n SELECT DATE_ADD(%(start_date)s, INTERVAL n DAY) AS `date`\n FROM (\n SELECT a.N + b.N * 10 + c.N * 100 + 1 AS n\n FROM (\n SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9\n ) AS a\n CROSS JOIN (\n SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9\n ) AS b\n CROSS JOIN (\n SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9\n ) AS c\n ORDER BY n\n ) AS nums\n WHERE DATE_ADD(%(start_date)s, INTERVAL n DAY) < %(end_date)s\n UNION\n SELECT %(end_date)s AS `date`\n \n ) AS date_list\nLEFT JOIN `tabPOS Invoice` b ON (\n b.`branch` = %(branch)s\n AND b.`docstatus` = 2 \n)\nLEFT JOIN `tabURY Report Settings` rs ON (\n rs.`branch` = %(branch)s\n)\nWHERE\n(\n ((rs.`hours` IS NULL OR rs.`hours` = 0) AND b.`posting_date` = date_list.`date`)\n OR (rs.`hours` > 0 AND TIMESTAMP(b.`posting_date`, b.`posting_time`) <= TIMESTAMP(DATE_ADD(date_list.`date`, INTERVAL 1 DAY), CONCAT(LPAD(rs.`hours`, 2, '0'), ':00:00')) AND TIMESTAMP(b.`posting_date`, b.`posting_time`) >= TIMESTAMP(date_list.`date`, CONCAT(LPAD(rs.`hours`, 2, '0'), ':00:00')))\n OR (rs.`branch` IS NULL AND b.`posting_date` = date_list.`date`)\n)\nGROUP BY \n date_list.`date`,b.`name`\nORDER BY \n date_list.`date` ASC, b.`name` ASC",
"query": "SELECT \n b.`posting_date` AS \"Date\",\n CONCAT(\n LPAD(IF(HOUR(b.`posting_time`) > 12, HOUR(b.`posting_time`) - 12, HOUR(b.`posting_time`)), 2, '0'),\n ':',\n SUBSTRING_INDEX(SUBSTRING_INDEX(b.`posting_time`, ':', 2), ':', -1),\n CASE WHEN HOUR(b.`posting_time`) >= 12 THEN ' PM' ELSE ' AM' END\n ) AS \"Time\",\n b.`name` AS \"Invoice:Link/POS Invoice\",\n b.`modified_by` AS \"Cancelled By\",\n b.`cancel_reason` AS \"Cancellation Reason\"\nFROM \n (\n SELECT %(start_date)s AS `date`\n UNION\n SELECT DATE_ADD(%(start_date)s, INTERVAL n DAY) AS `date`\n FROM (\n SELECT a.N + b.N * 10 + c.N * 100 + 1 AS n\n FROM (\n SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9\n ) AS a\n CROSS JOIN (\n SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9\n ) AS b\n CROSS JOIN (\n SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9\n ) AS c\n ORDER BY n\n ) AS nums\n WHERE DATE_ADD(%(start_date)s, INTERVAL n DAY) < %(end_date)s\n UNION\n SELECT %(end_date)s AS `date`\n \n ) AS date_list\nLEFT JOIN `tabPOS Invoice` b ON (\n b.`branch` = %(branch)s\n AND b.`docstatus` = 2 \n)\nLEFT JOIN `tabURY Report Settings` rs ON (\n rs.`branch` = %(branch)s\n)\nWHERE\n(\n ((rs.`hours` IS NULL OR rs.`hours` = 0) AND b.`posting_date` = date_list.`date`)\n OR (rs.`hours` > 0 AND TIMESTAMP(b.`posting_date`, b.`posting_time`) <= TIMESTAMP(DATE_ADD(date_list.`date`, INTERVAL 1 DAY), CONCAT(LPAD(rs.`hours`, 2, '0'), ':00:00')) AND TIMESTAMP(b.`posting_date`, b.`posting_time`) >= TIMESTAMP(date_list.`date`, CONCAT(LPAD(rs.`hours`, 2, '0'), ':00:00')))\n OR (rs.`branch` IS NULL AND b.`posting_date` = date_list.`date`)\n)\nGROUP BY \n date_list.`date`,b.`name`\nORDER BY \n date_list.`date` ASC, b.`name` ASC",
"ref_doctype": "POS Invoice",
"report_name": "Cancelled Invoices",
"report_type": "Query Report",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"add_total_row": 1,
"columns": [],
"creation": "2024-01-05 16:55:21.262143",
"disable_prepared_report": 0,
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"filters": [
{
"fieldname": "start_date",
"fieldtype": "Date",
"label": "From Date",
"mandatory": 1,
"wildcard_filter": 0
},
{
"fieldname": "end_date",
"fieldtype": "Date",
"label": "To Date",
"mandatory": 1,
"wildcard_filter": 0
},
{
"fieldname": "employee",
"fieldtype": "Link",
"label": "User",
"mandatory": 1,
"options": "User",
"wildcard_filter": 0
},
{
"fieldname": "branch",
"fieldtype": "Link",
"label": "Branch",
"mandatory": 1,
"options": "Branch",
"wildcard_filter": 0
}
],
"idx": 0,
"is_standard": "Yes",
"modified": "2024-01-05 17:06:30.301947",
"modified_by": "Administrator",
"module": "URY Pulse",
"name": "Employee Item Wise Sales",
"owner": "Administrator",
"prepared_report": 0,
"query": "SELECT\n b.`item_name` AS \"Item name\",\n SUM(b.`qty`) AS \"Qty\",\n SUM(b.`amount`) AS \"Amount\"\nFROM \n (\n SELECT %(start_date)s AS `date`\n UNION\n SELECT DATE_ADD(%(start_date)s, INTERVAL n DAY) AS `date`\n FROM (\n SELECT a.N + b.N * 10 + c.N * 100 + 1 AS n\n FROM (\n SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9\n ) AS a\n CROSS JOIN (\n SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9\n ) AS b\n CROSS JOIN (\n SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9\n ) AS c\n ORDER BY n\n ) AS nums\n WHERE DATE_ADD(%(start_date)s, INTERVAL n DAY) < %(end_date)s\n UNION\n SELECT %(end_date)s AS `date`\n ) AS date_list\nLEFT JOIN `tabPOS Invoice` a ON (\n a.`branch` = %(branch)s\n AND a.`status` IN (\"Consolidated\",\"Paid\") \n AND a.`docstatus` = 1\n)\nLEFT JOIN `tabURY Report Settings` rs ON (\n rs.`branch` = %(branch)s\n)\nINNER JOIN `tabPOS Invoice Item` b ON (\n\ta.name = b.parent\n)\nINNER JOIN `tabUser` e ON(\n e.`name` = %(employee)s\n AND e.`name`= a.`waiter`\n)\nWHERE\n(\n ((rs.`hours` IS NULL OR rs.`hours` = 0) AND a.`posting_date` = date_list.`date`)\n OR (rs.`hours` > 0 AND TIMESTAMP(a.`posting_date`, a.`posting_time`) <= TIMESTAMP(DATE_ADD(date_list.`date`, INTERVAL 1 DAY), CONCAT(LPAD(rs.`hours`, 2, '0'), ':00:00')) AND TIMESTAMP(a.`posting_date`, a.`posting_time`) >= TIMESTAMP(date_list.`date`, CONCAT(LPAD(rs.`hours`, 2, '0'), ':00:00')))\n OR (rs.`branch` IS NULL AND a.`posting_date` = date_list.`date`)\n)\nGROUP BY \n b.`item_name`\nORDER BY \n date_list.`date` DESC",
"ref_doctype": "POS Invoice",
"report_name": "Employee Item Wise Sales",
"report_type": "Query Report",
"roles": [
{
"role": "Accounts Manager"
},
{
"role": "Accounts User"
},
{
"role": "URY Manager"
}
]
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"add_total_row": 0,
"columns": [],
"creation": "2024-01-05 15:55:03.793993",
"disable_prepared_report": 0,
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"filters": [
{
"fieldname": "start_date",
"fieldtype": "Date",
"label": "From Date",
"mandatory": 1,
"wildcard_filter": 0
},
{
"fieldname": "end_date",
"fieldtype": "Date",
"label": "To Date",
"mandatory": 1,
"wildcard_filter": 0
},
{
"fieldname": "branch",
"fieldtype": "Link",
"label": "Branch",
"mandatory": 1,
"options": "Branch",
"wildcard_filter": 0
}
],
"idx": 0,
"is_standard": "Yes",
"modified": "2024-01-05 15:55:03.793993",
"modified_by": "Administrator",
"module": "URY Pulse",
"name": "Service Wise Sales",
"owner": "Administrator",
"prepared_report": 0,
"query": "SELECT \n b.`posting_date` AS \"Date\",\n b.`order_type` AS \"Order Type\",\n SUM(b.`grand_total`) AS \"Grand Total\"\nFROM \n (\n SELECT %(start_date)s AS `date`\n UNION\n SELECT DATE_ADD(%(start_date)s, INTERVAL n DAY) AS `date`\n FROM (\n SELECT a.N + b.N * 10 + c.N * 100 + 1 AS n\n FROM (\n SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9\n ) AS a\n CROSS JOIN (\n SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9\n ) AS b\n CROSS JOIN (\n SELECT 0 AS N UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9\n ) AS c\n ORDER BY n\n ) AS nums\n WHERE DATE_ADD(%(start_date)s, INTERVAL n DAY) < %(end_date)s\n UNION\n SELECT %(end_date)s AS `date`\n ) AS date_list\nLEFT JOIN `tabPOS Invoice` b ON (\n b.`branch` = %(branch)s\n AND b.`status` IN (\"Consolidated\",\"Paid\") \n AND b.`docstatus` = 1\n)\nLEFT JOIN `tabURY Report Settings` rs ON (\n rs.`branch` = %(branch)s\n)\nWHERE\n (\n ((rs.`hours` IS NULL OR rs.`hours` = 0) AND b.`posting_date` = date_list.`date`)\n OR (rs.`hours` > 0 AND TIMESTAMP(b.`posting_date`, b.`posting_time`) <= TIMESTAMP(DATE_ADD(date_list.`date`, INTERVAL 1 DAY), CONCAT(LPAD(rs.`hours`, 2, '0'), ':00:00')) AND TIMESTAMP(b.`posting_date`, b.`posting_time`) >= TIMESTAMP(date_list.`date`, CONCAT(LPAD(rs.`hours`, 2, '0'), ':00:00')))\n OR (rs.`branch` IS NULL AND b.`posting_date` = date_list.`date`)\n )\nGROUP BY \n date_list.`date`, b.`order_type`\nORDER BY \n date_list.`date` ASC, b.`order_type` ASC",
"ref_doctype": "POS Invoice",
"report_name": "Service Wise Sales",
"report_type": "Query Report",
"roles": [
{
"role": "Accounts Manager"
},
{
"role": "Accounts User"
},
{
"role": "URY Manager"
}
]
}
Empty file.
49 changes: 49 additions & 0 deletions ury_pulse/ury_pulse/report/time_wise_sales/time_wise_sales.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"add_total_row": 0,
"columns": [],
"creation": "2024-01-05 15:05:51.590275",
"disable_prepared_report": 0,
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"filters": [
{
"fieldname": "date",
"fieldtype": "Date",
"label": "Date",
"mandatory": 1,
"wildcard_filter": 0
},
{
"fieldname": "branch",
"fieldtype": "Link",
"label": "Branch",
"mandatory": 1,
"options": "Branch",
"wildcard_filter": 0
}
],
"idx": 0,
"is_standard": "Yes",
"modified": "2024-01-05 15:14:38.448441",
"modified_by": "Administrator",
"module": "URY Pulse",
"name": "Time Wise Sales",
"owner": "Administrator",
"prepared_report": 0,
"query": "SELECT\n time_intervals.`Time Interval`,\n COALESCE(SUM(sales_by_interval.`Sales`), 0) AS 'Sales',\n COUNT(sales_by_interval.`Bill`) AS 'Bills'\nFROM (\n SELECT '12 AM - 02 AM' AS 'Time Interval', 1 AS 'Order'\n UNION ALL SELECT '02 AM - 04 AM', 2\n UNION ALL SELECT '04 AM - 06 AM', 3\n UNION ALL SELECT '06 AM - 08 AM', 4\n UNION ALL SELECT '08 AM - 10 AM', 5\n UNION ALL SELECT '10 AM - 12 PM', 6\n UNION ALL SELECT '12 PM - 02 PM', 7\n UNION ALL SELECT '02 PM - 04 PM', 8\n UNION ALL SELECT '04 PM - 06 PM', 9\n UNION ALL SELECT '06 PM - 08 PM', 10\n UNION ALL SELECT '08 PM - 10 PM', 11\n UNION ALL SELECT '10 PM - 12 AM', 12\n) AS time_intervals\nLEFT JOIN (\n SELECT\n CASE\n WHEN TIME(`posting_time`) BETWEEN '00:00:00' AND '01:59:59' THEN '12 AM - 02 AM'\n WHEN TIME(`posting_time`) BETWEEN '02:00:00' AND '03:59:59' THEN '02 AM - 04 AM'\n WHEN TIME(`posting_time`) BETWEEN '04:00:00' AND '05:59:59' THEN '04 AM - 06 AM'\n WHEN TIME(`posting_time`) BETWEEN '06:00:00' AND '07:59:59' THEN '06 AM - 08 AM'\n WHEN TIME(`posting_time`) BETWEEN '08:00:00' AND '09:59:59' THEN '08 AM - 10 AM'\n WHEN TIME(`posting_time`) BETWEEN '10:00:00' AND '11:59:59' THEN '10 AM - 12 PM'\n WHEN TIME(`posting_time`) BETWEEN '12:00:00' AND '13:59:59' THEN '12 PM - 02 PM'\n WHEN TIME(`posting_time`) BETWEEN '14:00:00' AND '15:59:59' THEN '02 PM - 04 PM'\n WHEN TIME(`posting_time`) BETWEEN '16:00:00' AND '17:59:59' THEN '04 PM - 06 PM'\n WHEN TIME(`posting_time`) BETWEEN '18:00:00' AND '19:59:59' THEN '06 PM - 08 PM'\n WHEN TIME(`posting_time`) BETWEEN '20:00:00' AND '21:59:59' THEN '08 PM - 10 PM'\n WHEN TIME(`posting_time`) BETWEEN '22:00:00' AND '23:59:59' THEN '10 PM - 12 AM'\n END AS 'Time Interval',\n `name` AS \"Bill\",\n `grand_total` AS 'Sales'\n FROM `tabPOS Invoice`\n WHERE \n DATE(`posting_date`) = DATE(%(date)s)\n AND `branch` = %(branch)s\n AND `docstatus` = 1\n AND `status` IN (\"Consolidated\", \"Paid\")\n) AS sales_by_interval\nON time_intervals.`Time Interval` = sales_by_interval.`Time Interval`\nGROUP BY time_intervals.`Time Interval`\nORDER BY time_intervals.`Order`;",
"ref_doctype": "POS Invoice",
"report_name": "Time Wise Sales",
"report_type": "Query Report",
"roles": [
{
"role": "Accounts Manager"
},
{
"role": "Accounts User"
},
{
"role": "URY Manager"
}
]
}
4 changes: 2 additions & 2 deletions ury_pulse/ury_pulse/report/today's_sales/today's_sales.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
],
"idx": 0,
"is_standard": "Yes",
"modified": "2023-12-06 10:42:50.067541",
"modified": "2024-01-07 18:53:11.244041",
"modified_by": "Administrator",
"module": "URY Pulse",
"name": "Today's Sales",
"owner": "Administrator",
"prepared_report": 0,
"query": "SELECT\n DAYNAME(curdate()) AS \"Today\",\n COUNT(b.`name`) AS \"Total Invoices\",\n SUM(b.`net_total`) AS \"Item Total\",\n SUM(b.`grand_total` - b.`net_total`) AS \"GST\",\n SUM(b.`grand_total`) AS \"Grand Total\",\n SUM(b.`grand_total` - b.`rounded_total`) AS \"Round Off\",\n SUM(b.`rounded_total` - b.`paid_amount` + b.`change_amount`) AS \"Cash Discounts\"\nFROM `tabPOS Invoice` b\nLEFT JOIN `tabURY Report Settings` rs ON (\n rs.`branch` = %(branch)s\n)\nWHERE \n b.`branch` = %(branch)s\n AND\n (\n ((rs.`hours` IS NULL OR rs.`hours` = 0) AND b.`posting_date` = curdate())\n OR (rs.`hours` > 0 AND TIMESTAMP(b.`posting_date`, b.`posting_time`) <= TIMESTAMP(DATE_ADD(curdate(), INTERVAL 1 DAY), CONCAT(LPAD(rs.`hours`, 2, '0'), ':00:00')) AND TIMESTAMP(b.`posting_date`, b.`posting_time`) >= TIMESTAMP(curdate(), CONCAT(LPAD(rs.`hours`, 2, '0'), ':00:00')))\n OR (rs.`branch` IS NULL AND b.`posting_date` = curdate())\n )\n AND b.`status` IN (\"Consolidated\", \"Paid\") \n AND b.`docstatus` = 1",
"query": "SELECT\n DAYNAME(curdate()) AS \"Today\",\n COUNT(b.`name`) AS \"Total Invoices\",\n ROUND(SUM(b.`net_total`),2) AS \"Item Total\",\n ROUND(SUM(b.`total_taxes_and_charges`),2) AS \"Total Taxes and Charges\",\n ROUND(SUM(b.`grand_total`),2) AS \"Grand Total\",\n ROUND(SUM(b.`grand_total` - b.`rounded_total`),2) AS \"Round Off\",\n ROUND(SUM(b.`rounded_total` - b.`paid_amount` + b.`change_amount`), 2)AS \"Cash Discounts\"\nFROM `tabPOS Invoice` b\nLEFT JOIN `tabURY Report Settings` rs ON (\n rs.`branch` = %(branch)s\n)\nWHERE\n b.`branch` = %(branch)s\n AND b.`docstatus` = 1\n AND b.`status` IN (\"Consolidated\", \"Paid\") \n AND(\n ((rs.`hours` IS NULL OR rs.`hours` = 0) AND b.`posting_date` = curdate())\n OR (rs.`hours` > 0 AND TIMESTAMP(b.`posting_date`, b.`posting_time`) <= TIMESTAMP(DATE_ADD(curdate(), INTERVAL 1 DAY), CONCAT(LPAD(rs.`hours`, 2, '0'), ':00:00')) AND TIMESTAMP(b.`posting_date`, b.`posting_time`) >= TIMESTAMP(curdate(), CONCAT(LPAD(rs.`hours`, 2, '0'), ':00:00')))\n OR (rs.`branch` IS NULL AND b.`posting_date` = curdate())\n )",
"ref_doctype": "POS Invoice",
"report_name": "Today's Sales",
"report_type": "Query Report",
Expand Down

0 comments on commit c3f149f

Please sign in to comment.