Query on Date fields in Field Events
|1/26/2023 8:00:32 AM|
|PHPRunner General questions|
HHenny Sol author
When working on FieldEvents I stumbled on a problem when I had to query in the OnServer part on a Date field (facd) that I "took" from the current record in the ClientBefore part.
I wanted to calculate the netto amount (nett) and the high/low vat amount (btwh/btwl) from the entered bruto amount (brut). I picked all fields I needed in the ClientBefore.
Then I had to find the VATperc (perc) of the VATtype (btws) in the VATpercentages table (BtwPerc) that I had to use given the documentdate/invoicedate (facd) of the cost.
When the facd on the page was 19-1-2023 the facd that I picked in ClientBefore was 18-01-2023 23:00:00. After various attemtps my code worked OK by taking the 10 first chars of facd, creating a date, adding 1 day to the date and converting it to a string.
Below you'll find my coding:
$sql = "select from BtwPerc where btws=".$params["btws"]." and (";