Skip to content

Commit

Permalink
Merge pull request #3932 from ONE-F-M/188720605
Browse files Browse the repository at this point in the history
feat: Proof of Work Attendance report
  • Loading branch information
ibtesam-onefm authored Jan 15, 2025
2 parents 2048507 + 64cb830 commit 09ce885
Show file tree
Hide file tree
Showing 5 changed files with 588 additions and 0 deletions.
Empty file.
168 changes: 168 additions & 0 deletions one_fm/one_fm/report/proof_of_work/proof_of_work.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Cairo:[email protected]&display=swap" rel="stylesheet">
<style>
.subject {
text-align: center;
margin-bottom: 10px;
}
h2 {
color: #111;
}
.container {
display: flex;
justify-content: space-between;
border: 0px solid #fff;
padding: 0;
}
.section {
width: 50%;
box-sizing: border-box;
padding: 0;
}
.english {
font-family: Arial, sans-serif;
text-align: left;
}
.arabic {
font-family: "Cairo", sans-serif;
text-align: right;
direction: rtl;
}
.section p {
margin: 5px 0;
line-height: 1.6;
}
.details {
font-weight: bold;
}
ul li {
margin-bottom: 5px;
}
.bordered {
border: 0px solid #fff;
padding: 10px;
min-height: 100px;
}
.section .bordered {
margin: 0;
}
.row {
display: flex;
}
.row .section {
flex: 1;
display: flex;
flex-direction: column;
justify-content: stretch;
}
.bordered-flex {
flex-grow: 1;
}
</style>
<div class="">
<h2 class="text-center">{%= __("Proof of Work Report") %}</h2>
<div class="subject">
<table class="table table-borderless">
<tr>
<td class="english">
<p>
Acknowledgement of receipt of service according to the contract dated .....................<br>
Submitted to the company: ...................................................................<br>
The undersigned hereby approves receipt of the service provided by <br> One Facilities Management Company LLC according to the contract concluded between them<br>
</p>
</td>
<td class="arabic" style="text-align: right;">
<p>
إقرار باستلام الخدمة طبقاً للعقد المبرم بتاريخ ….. / …/ …….<br>
مقدم إلى الشركة: ………….<br>
يقر الموقع أدناه باستلام الخدمة المقدمة من شركة ون لإدارة المرافق ذ.م.م طبقاً للعقد المبرم بينهما
<br>
</p>
</td>
</tr>
</table>
</div>
<table class="table table-bordered">
<!-- heading -->
<thead>
<tr>
<th> # </th>
{% for col in columns %}
{% if col.name && col._id !== "_check" %}
<th
{% if col.minWidth %}
style="min-width: {{ col.minWidth }}px"
{% endif %}
{% if col.docfield && frappe.model.is_numeric_field(col.docfield) %}
class="text-right"
{% endif %}
>
{{ __(col.name) }}</th>
{% endif %}
{% endfor %}
</tr>
</thead>
<!-- body -->
<tbody>
{% for row in data %}
<tr style="height: 30px">
<td {% if row.bold == 1 %} style="font-weight: bold" {% endif %}>
<span> {{ row._index + 1 }} </span>
</td>
{% for col in columns %}
{% if col.name && col._id !== "_check" %}
{% var value = col.fieldname ? row[col.fieldname] : row[col.id] %}
{% var longest_word = cstr(value).split(' ').reduce((longest, word) => word.length > longest.length ? word : longest, ''); %}
<td {% if row.bold == 1 %} style="font-weight: bold" {% endif %} {% if longest_word.length > 45 %} class="overflow-wrap-anywhere" {% endif %}>
<span {% if col._index == 0 %} style="padding-left: {%= cint(row.indent) * 2 %}em" {% endif %}>
{% format_data = row.is_total_row && ["Currency", "Float"].includes(col.fieldtype) ? data[0] : row %}
{% if (row.is_total_row && col._index == 0) { %}
{{ __("Total") }}
{% } else { %}
{{
col.formatter
? col.formatter(row._index, col._index, value, col, format_data, true)
: col.format
? col.format(value, row, col, format_data)
: col.docfield
? frappe.format(value, col.docfield)
: value
}}
{% } %}
</span>
</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
<div class="subject">
<table class="table table-borderless">
<tr>
<td class="english">
<p>
Consent to receive the service:
<br><br>
Name:
<br><br>
Signature:__________________<br>
Date:<br>
</p>
</td>
<td class="arabic" style="text-align: right;">
<p>
الموافقه علر استلام الخدمه:
<br><br>
الاسم:
<br><br>
التوقيع: ____________________<br>
التاريخ:<br>
</p>
</td>
</tr>
</table>
</div>
<hr>
</div>
86 changes: 86 additions & 0 deletions one_fm/one_fm/report/proof_of_work/proof_of_work.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Copyright (c) 2025, omar jaber and contributors
// For license information, please see license.txt

frappe.query_reports["Proof of Work"] = {
"filters": [
{
"fieldname":"company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company"),
"reqd": 1
},
{
"fieldname": "month",
"label": __("Month"),
"fieldtype": "Select",
"reqd": 1 ,
"options": [
{ "value": 1, "label": __("Jan") },
{ "value": 2, "label": __("Feb") },
{ "value": 3, "label": __("Mar") },
{ "value": 4, "label": __("Apr") },
{ "value": 5, "label": __("May") },
{ "value": 6, "label": __("June") },
{ "value": 7, "label": __("July") },
{ "value": 8, "label": __("Aug") },
{ "value": 9, "label": __("Sep") },
{ "value": 10, "label": __("Oct") },
{ "value": 11, "label": __("Nov") },
{ "value": 12, "label": __("Dec") },
],
"default": frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth() + 1
},
{
"fieldname":"year",
"label": __("Year"),
"fieldtype": "Select",
"reqd": 1
},
{
"fieldname":"operations_site",
"label": __("Operations Site"),
"fieldtype": "Link",
"options": "Operations Site",
"reqd": 1
},
{
"fieldname":"project",
"label": __("Project"),
"fieldtype": "Link",
"options": "Project",
"reqd": 0
},
{
"fieldname":"roster_type",
"label": __("Roster Type"),
"fieldtype": "Select",
"options": "\nBasic\nOver-Time",
"reqd": 0
},
],
onload: function() {
frappe.call({
method: "one_fm.one_fm.report.proof_of_work.proof_of_work.get_attendance_years",
callback: function(r) {
var year_filter = frappe.query_report.get_filter('year');
year_filter.df.options = r.message;
year_filter.df.default = r.message.split("\n")[0];
year_filter.refresh();
year_filter.set_input(year_filter.df.default);
}
});
},
formatter: function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data);
if (column.colIndex > 2){
if (value == "A") value = "<span style='color:red'>" + value + "</span>";
else if (value == "DO") value = "<span style='color:black'>" + value + "</span>";
else if (value == "L") value = "<span style='color:#318AD8'>" + value + "</span>";
else value = "<span style='color:green'>" + value + "</span>";
}

return value;
},
};
45 changes: 45 additions & 0 deletions one_fm/one_fm/report/proof_of_work/proof_of_work.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"add_total_row": 0,
"columns": [],
"creation": "2025-01-10 12:16:45.969866",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"filters": [],
"idx": 0,
"is_standard": "Yes",
"letter_head": "",
"letterhead": null,
"modified": "2025-01-15 08:38:42.786418",
"modified_by": "Administrator",
"module": "One Fm",
"name": "Proof of Work",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Attendance",
"report_name": "Proof of Work",
"report_type": "Script Report",
"roles": [
{
"role": "Operations Supervisor"
},
{
"role": "Site Supervisor"
},
{
"role": "Projects Manager"
},
{
"role": "HR User"
},
{
"role": "Operations Manager"
},
{
"role": "Operation Admin"
},
{
"role": "System Manager"
}
]
}
Loading

0 comments on commit 09ce885

Please sign in to comment.