update Dashboard on rate model and total show
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -57,7 +57,7 @@ def client_edit_rate(rate_id):
|
|||||||
|
|
||||||
if result["success"]:
|
if result["success"]:
|
||||||
flash(result["message"], "success")
|
flash(result["message"], "success")
|
||||||
return redirect(url_for("engineering.client-rate"))
|
return redirect(url_for("engineering.client_rate_master"))
|
||||||
|
|
||||||
flash(result["message"], "danger")
|
flash(result["message"], "danger")
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ def client_edit_rate(rate_id):
|
|||||||
def client_delete_rate(rate_id):
|
def client_delete_rate(rate_id):
|
||||||
ClientRateService.delete_rate(rate_id)
|
ClientRateService.delete_rate(rate_id)
|
||||||
flash("Rate deleted successfully.", "success")
|
flash("Rate deleted successfully.", "success")
|
||||||
return redirect(url_for("engineering.client-rate"))
|
return redirect(url_for("engineering.client_rate_master"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -142,11 +142,21 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Sr No</th>
|
<th>Sr No</th>
|
||||||
<th>Strata Type & Depth</th>
|
<th>Strata Type & Depth</th>
|
||||||
|
|
||||||
<th class="text-end">Client Qty</th>
|
<th class="text-end">Client Qty</th>
|
||||||
|
<th class="text-end">Client Rate</th>
|
||||||
|
<th class="text-end">Client Amount</th>
|
||||||
|
|
||||||
<th class="text-end">Sub Contractor Qty</th>
|
<th class="text-end">Sub Contractor Qty</th>
|
||||||
<th class="text-end">Difference</th>
|
<th class="text-end">Sub Rate</th>
|
||||||
|
<th class="text-end">Sub Amount</th>
|
||||||
|
|
||||||
|
<th class="text-end">Qty Difference</th>
|
||||||
|
<th class="text-end">Rate Difference</th>
|
||||||
|
<th class="text-end">Amount Difference</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -162,13 +172,11 @@
|
|||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
let barChart;
|
let barChart;
|
||||||
let raBillChoice;
|
let raBillChoice;
|
||||||
|
|
||||||
/* Load RA Bills */
|
/* Load RA Bills */
|
||||||
function loadRABills(){
|
function loadRABills(){
|
||||||
|
|
||||||
let subcontractor = document.getElementById("subcontractor").value
|
let subcontractor = document.getElementById("subcontractor").value
|
||||||
let category = document.getElementById("category").value
|
let category = document.getElementById("category").value
|
||||||
|
|
||||||
@@ -176,30 +184,21 @@
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!subcontractor || !category) {
|
if (!subcontractor || !category) {
|
||||||
|
|
||||||
raBillChoice.clearStore();
|
raBillChoice.clearStore();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(`/dashboard/api/get-ra-bills?subcontractor=${subcontractor}&category=${category}`)
|
fetch(`/dashboard/api/get-ra-bills?subcontractor=${subcontractor}&category=${category}`)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|
||||||
raBillChoice.clearStore();
|
raBillChoice.clearStore();
|
||||||
|
|
||||||
let choices = [];
|
let choices = [];
|
||||||
|
|
||||||
data.ra_bills.forEach(function(bill){
|
data.ra_bills.forEach(function(bill){
|
||||||
|
|
||||||
choices.push({
|
choices.push({
|
||||||
|
|
||||||
value: bill,
|
value: bill,
|
||||||
|
|
||||||
label: bill
|
label: bill
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
raBillChoice.setChoices(
|
raBillChoice.setChoices(
|
||||||
@@ -208,7 +207,6 @@
|
|||||||
"label",
|
"label",
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -327,38 +325,87 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* TABLE */
|
/* TABLE */
|
||||||
function drawTable(data){
|
function drawTable(data) {
|
||||||
|
let html = "";
|
||||||
|
for (let i = 0; i < data.labels.length; i++) {
|
||||||
|
|
||||||
let html='';
|
|
||||||
for(let i=0;i<data.labels.length;i++){
|
|
||||||
const clientQty = Number(data.client_qty[i] || 0);
|
const clientQty = Number(data.client_qty[i] || 0);
|
||||||
const subQty = Number(data.sub_qty[i] || 0);
|
const subQty = Number(data.sub_qty[i] || 0);
|
||||||
const diff = clientQty - subQty;
|
|
||||||
|
|
||||||
html+=`
|
const clientRate = Number(data.client_rate[i] || 0);
|
||||||
|
const subRate = Number(data.sub_rate[i] || 0);
|
||||||
|
|
||||||
|
const clientAmount = Number(data.client_amount[i] || 0);
|
||||||
|
const subAmount = Number(data.sub_amount[i] || 0);
|
||||||
|
|
||||||
|
const qtyDiff = Number(data.qty_difference[i] || 0 );
|
||||||
|
const rateDiff = Number(data.rate_difference[i] || 0 );
|
||||||
|
const amountDiff = Number(data.amount_difference[i] || 0 );
|
||||||
|
|
||||||
|
html += `
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">${i + 1}</td>
|
<td class="text-center">
|
||||||
<td>${data.labels[i]}</td>
|
${i + 1}
|
||||||
<td class="text-end">${data.client_qty[i]}</td>
|
</td>
|
||||||
<td class="text-end">${data.sub_qty[i]}</td>
|
|
||||||
<td class="text-end fw-bold ${diff >= 0 ? 'text-success' : 'text-danger'}">${diff.toFixed(2)}</td>
|
<td>
|
||||||
|
${data.labels[i]}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- CLIENT -->
|
||||||
|
<td class="text-end">
|
||||||
|
${clientQty.toFixed(2)}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="text-end">
|
||||||
|
₹ ${clientRate.toFixed(2)}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="text-end fw-bold">
|
||||||
|
₹ ${clientAmount.toFixed(2)}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- SUBCONTRACTOR -->
|
||||||
|
<td class="text-end">
|
||||||
|
${subQty.toFixed(2)}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="text-end">
|
||||||
|
₹ ${subRate.toFixed(2)}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="text-end fw-bold">
|
||||||
|
₹ ${subAmount.toFixed(2)}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- DIFFERENCES -->
|
||||||
|
<td class="text-end fw-bold
|
||||||
|
${qtyDiff >= 0 ? 'text-success' : 'text-danger'}">
|
||||||
|
${qtyDiff.toFixed(2)}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="text-end fw-bold
|
||||||
|
${rateDiff >= 0 ? 'text-success' : 'text-danger'}">
|
||||||
|
₹ ${rateDiff.toFixed(2)}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="text-end fw-bold
|
||||||
|
${amountDiff >= 0 ? 'text-success' : 'text-danger'}">
|
||||||
|
₹ ${amountDiff.toFixed(2)}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector("#resultTable tbody").innerHTML = html;
|
document.querySelector(
|
||||||
|
"#resultTable tbody"
|
||||||
|
).innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EVENTS */
|
/* EVENTS */
|
||||||
document.getElementById("subcontractor").addEventListener("change", loadRABills);
|
document.getElementById("subcontractor").addEventListener("change", loadRABills);
|
||||||
|
|
||||||
document.getElementById("category").addEventListener("change", loadRABills);
|
document.getElementById("category").addEventListener("change", loadRABills);
|
||||||
|
|
||||||
document.getElementById("searchBtn").addEventListener("click", loadDashboard);
|
document.getElementById("searchBtn").addEventListener("click", loadDashboard);
|
||||||
|
|
||||||
document.getElementById("resetBtn").addEventListener("click", function () {location.reload();});
|
document.getElementById("resetBtn").addEventListener("click", function () {location.reload();});
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user