on_update -> master/detail grid – calculate field

Questionson_update -> master/detail grid – calculate field
Ronald asked 2 years ago

Hello,

I have a problem with on_update. I want to set the variable “Bearbeitet” to 1 and calculate the gross price. But $data[“params”][“Lg_Spanne”] and $data[“params”][“VAT”] are empty.

Firebug: Array ( [ID] => 46459 [params] => Array ( [LgEP_netto_Neu] => 133 [Bearbeitet] => 1 [LgVP_exkl_neu] => 0 ) )

$e[“on_update”] = array(“update_client”, null, true);

function update_client(&$data)
{
$request_ID = $data[“ID”];

$data[“params”][“Bearbeitet”] = 1;
$LgEP1 = strtr($d[“LgEP_netto_Neu”], “,”, “.”);
$LgEP2 = doubleval($LgEP1);
$data[“params”][“LgVP_exkl_neu”] = ($LgEP2 + $data[“params”][“Lg_Spanne”]) * ($data[“params”][“VAT”]/100 + 1);

}

The on_data_display event works, it calculate the gross price but doesn’t insert it in the table.

$e[“on_data_display”] = array(“filter_display”, null, true);

function filter_display($data)
{
foreach($data[“params”] as &$d)
{
if (!is_null($d[“LgEP_netto_Neu”]))
{
$LgEP1 = strtr($d[“LgEP_netto_Neu”], “,”, “.”);
$LgEP2 = doubleval($LgEP1);
$d[“LgVP_exkl_neu”] = ($LgEP2 + $d[“Lg_Spanne”]) * ($d[“VAT”]/100 + 1);
}
}
}

I hope you can help me. Thanks!

Ronald

1 Answers
Abu Ghufran Staff answered 2 years ago

Hello,

Apologies for the delay.
You only get those columns posted back on server on edit/add that are:
$col[“editable”] = true;

Others are not posted back.
So if you want them to be readonly on display, you can have another column with same data and make it editable:true and hidden:true and keep the readonly column as it is.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

4 + 15 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?