Skip to content

Commit

Permalink
fix: refactored the code
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmalroshan123 committed Nov 8, 2024
1 parent 5fbd736 commit 494d255
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -640,28 +640,6 @@ frappe.ui.form.on('Jewellery Invoice Item', {

// // discount

// frappe.ui.form.on('Stone Detals - 2', {
// discount: function(frm, cdt, cdn) {
// calculate_discount_and_total(frm, cdt, cdn);
// }
// });

// function calculate_discount_and_total(frm, cdt, cdn) {
// let row = locals[cdt][cdn];
// let discounted_amount = flt(row.stone_charge) * (1 - flt(row.discount) / 100);

// // Update the row's final discounted amount
// frappe.model.set_value(cdt, cdn, 'custom_discount_final', discounted_amount);

// // Calculate and set the total discounted amount
// let total = frm.doc.stone_details.reduce((sum, r) =>
// sum + flt(r.stone_charge) * (1 - flt(r.discount) / 100), 0);

// frm.set_value('custom_discount_final', total);
// frm.refresh_fields(['stone_details', 'custom_discount_final']);
// }


frappe.ui.form.on('Stone Details - 2', {
discount: function(frm, cdt, cdn) {
calculate_discount_and_total(frm, cdt, cdn);
Expand Down

0 comments on commit 494d255

Please sign in to comment.