CREATE FUNCTION totchqastc(integer) RETURNS numeric
    LANGUAGE sql
    AS $_$select sum(chq_importe) from cheques where chq_idastoc= $1 ;$_$;


CREATE FUNCTION totchqastce(integer) RETURNS numeric
    LANGUAGE sql
    AS $_$select sum(chq_importe) from cheques where chq_idastoce= $1 ;$_$;


CREATE FUNCTION importedeastc(integer) RETURNS numeric
    LANGUAGE sql
    AS $_$select astc_importe from astoctas where astc_id= $1 ;$_$;


