Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderators: ArturoRobles, ArturoRobles

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By ptmi1047

I have currency field in a grid and need to summarize it. I'm using currency mask in that field. The issue is the sum amount get wrong when input the value (screenshot attached). In Previous version of PM the currency mask worked fine.

Any suggestions to solve this issue?

2017-04-06_095207.jpg (4.58 KiB) Viewed 1196 times
By mishika

On applying the mask to a value it considers only the value of the digits up to the first delimiter.
To resolve your problem you can do the following:
1. Instead of taking a sum function for the currency column, take a new text field which will store the calculated sum of all the rows of the grid.
2. You can create a button on click of which the sum will be calculated.
3. Write the following javascript for your Dynaform:
Code: Select all
document.getElementById("mask").onclick = maskcurr;
function deleteList(gridID) {
  var oGrid = $("#"+gridID); 
  var iRow = oGrid.getNumberRows();
  for (; iRow > 0; iRow--) {
$("#gridVar001").onAddRow( function(aRow, oGrid, rowNumber) {
   $("#form\\[gridVar001\\]\\["+rowNumber+"\\]\\[currency\\]").maskNumber({integer: true});
} );
function maskcurr(){
  var val, total = 0;
  var totalRows = $("#gridVar001").getNumberRows();
  for (var i = 1; i <= totalRows; i++) {
    val = ($("#gridVar001").getValue(i, 2));
	val = val.replace(/,/g, "");
    total = total + parseFloat(val);
Hope this helps

Best Regards

ACTE is a national association representing thousa[…]

ACTE is a national association representing thousa[…]

MSSQLConnection.php on line 367

ACTE is a national association representing thousa[…]

Please, something similar is happening to me. I h[…]