In order to reset a document’s number to 1 every day, do the following:
In Settings –> Documents, at the corresponding document click on run SQL field (right to the list):
In the window that opens, copy and paste the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
EXECUTE BLOCK AS BEGIN update "eidhpar" set "eidhpar"."Ariumos"=2 where "eidhpar"."Aa"=:cd and (select count("pvlhseis"."Aa") from "pvlhseis" where "pvlhseis"."Parastatiko"=:cd and cast("Hmeromhnia" as date)=cast('NOW' as date))<2 ; update "pvlhseis" set "pvlhseis"."Ariumospar"=1 where "pvlhseis"."Aa"=:aa and (select count("pvlhseis"."Aa") from "pvlhseis" where "pvlhseis"."Parastatiko"=:cd and cast("Hmeromhnia" as date)=cast('NOW' as date))<2 ; END; |