Question

In product section -Custom COLUMNS ON THE PRODUCT SELECTION PAGE

Hi Team,

We are adding one custom column in production section and we are comparing price and quantity with Vat (custom column).Here that value is not passing to the "TotalAmount".But in alerts calculation value is showing correct but that value is not set into the Total Amount column.

Here we are following academy link:

https://academy.bpmonline.com/documents/technic-sdk/7-13/configuration-editable-columns-product-selection-page

Here my code:

define("ProductSelectionSchema", [],

    function() {

        return {

            methods: {

                getEditableColumns: function() {

                    // Getting an array of editable columns.

                    var columns = this.callParent(arguments);

                    // Adding the [Discount,%] column to the array of editable columns.

                    columns.push("Price");

                    // Adding a custom column.

                    columns.push("Quantity");

                    //this.get("Price")

                   //"columns": ["Price","DiscountPercent","UsrTaxx","Quantity","Usrvats"],

                   // window.alert(columns);

                    return columns;

                },

                setColumnHandlers: function(item) {

                    this.callParent(arguments);

                    // Bind the event handler of the user column change event.

                    item.on("change:Price", this.onCustomPriceChanged);

                                       // item.on("change:Quantity", this.onCustomPriceChanged1);

                },

                // A handler method that will be called when the field value is changed.

                onCustomPriceChanged: function(item, value) {

                    window.console.log("Changed: ", item, value);

                    window.alert(value);

                 var quant=this.get("Quantity");

var rs=this.get("Price");

                    window.alert("Quantity"+quant);

var DiscountPercent=this.get("DiscountPercent");

DiscountPercent=DiscountPercent/100;

var taxpercentage=this.get("UsrTaxx");

var UsrVATper=this.get("Usrvats");

var vatpercentage =UsrVATper ;

//window.alert("taxpercentage" +taxpercentage);

taxpercentage=taxpercentage/100;

vatpercentage=0.14;

var amount = (value*quant);

var priceandquantityamount=amount+(amount*0.14);

//window.alert("UsrVATper"+vatpercentage);

window.alert("priceandquantityamount"+priceandquantityamount);

window.alert("TotalAmount"+priceandquantityamount);

if(rs!==0 || quant!==0 ||taxpercentage!==0)

{

this.set("TotalAmount", priceandquantityamount);

var TotalAmount=this.get("TotalAmount");

window.alert(TotalAmount);

}

                    

                    

                },                                

            }

        };

    });

 

Can anyone help on this issue

Regards,

praveenkumar

Like 0

Like

1 comments

Hello



It seems that the issue occurs because of incorrect attribute. After I have changed it,`s name and deleted "datavaluetype" property,  it became possible to work with "totalamount" attribute`s value.

http://prntscr.com/nnvyz2



So, to resolve the issue, please change the attribute as on screenshot.



Regards,

Alex

Show all comments