Item price + material value

Hi to all,
when I sell some items, in the Invoice, I have to sum the item price (defined in the price list) + anoter value depending of the type of material that I’m shipping (alloy value).

This value is not fixed but change monthly, so it’s a sort of another price to sum to the unit price.

Is there the possibility to have these two values splitted, instead of sum it with some customization in the unit price ? Becasue in this way If I want to analyse the amount of material value and item price, I have to calculate it every time.

Thanks

You can customize it to handle the alloy value separately from the item price. First, add a custom field for the alloy value and total price in the Sales Invoice Item form. Then, use a custom script to automatically add the alloy value to the item price when creating an invoice. This way, you can easily see and analyze both values without manual calculations.

sample script:

frappe.ui.form.on('Sales Invoice Item', {
    alloy_value: function(frm, cdt, cdn) {
        var item = locals[cdt][cdn];
        if(item.alloy_value && item.rate) {
            item.total_price = item.rate + item.alloy_value;
            frm.refresh_field('items');
        }
    },
    rate: function(frm, cdt, cdn) {
        var item = locals[cdt][cdn];
        if(item.alloy_value && item.rate) {
            item.total_price = item.rate + item.alloy_value;
            frm.refresh_field('items');
        }
    }
});

Thanks for your support.