--
--



--
-- Name: date_time_(integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.date_time_(id_ integer) RETURNS timestamp without time zone
    LANGUAGE plpgsql
    AS $_$
DECLARE
    dato timestamp  without time zone;
BEGIN
SELECT date_time FROM attendance INTO dato WHERE id =$1; 
RETURN dato;
END;
$_$;


ALTER FUNCTION public.date_time_(id_ integer) OWNER TO postgres;

--
-- Name: date_time_(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.date_time_(id_ timestamp without time zone) RETURNS timestamp without time zone
    LANGUAGE plpgsql
    AS $_$
DECLARE
    dato INTEGER;
BEGIN
SELECT date_time FROM attendance INTO dato WHERE id =$1; 
RETURN dato;
END;
$_$;


ALTER FUNCTION public.date_time_(id_ timestamp without time zone) OWNER TO postgres;

--
-- Name: exit(integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.exit(id_ integer) RETURNS integer
    LANGUAGE plpgsql
    AS $_$
DECLARE
    dato INTEGER;
	user_ INTEGER;
BEGIN
SELECT user_id FROM attendance INTO user_ WHERE id=$1;
SELECT COALESCE(id,0) FROM attendance INTO dato WHERE user_id = user_ 
	AND date_time IN (SELECT MIN(date_time) FROM attendance WHERE date_time>date_time_($1) AND user_id = user_)
	AND enter=0; 
RETURN dato;
END;
$_$;


ALTER FUNCTION public.exit(id_ integer) OWNER TO postgres;

--
-- Name: in_array(text, text[]); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.in_array(elem text, arr text[]) RETURNS boolean
    LANGUAGE plpgsql
    AS $$
BEGIN
	RETURN arr @> array[elem];
END;
$$;


ALTER FUNCTION public.in_array(elem text, arr text[]) OWNER TO postgres;




--
-- Name: record_time_(integer, integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.record_time_(id_ integer, enter integer) RETURNS integer
    LANGUAGE plpgsql
    AS $_$
DECLARE
    retval_ integer=10;
	retval TIMESTAMP WITHOUT TIME ZONE;
BEGIN
	retval = NOW();
	INSERT INTO attendance 
		(user_id,enter,date_time,last_modified,rate)
			VALUES
		($1,$2,retval ,retval,(SELECT salary FROM employee WHERE id=user_id)) ;
	SELECT @@ROWCOUNT INTO retval;
	RETURN retval_;
END;
$_$;


ALTER FUNCTION public.record_time_(id_ integer, enter integer) OWNER TO postgres;


ALTER FUNCTION public.username(id1 integer) OWNER TO postgres;

--
-- Name: usr_address(integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.usr_address(id_ integer) RETURNS text
    LANGUAGE plpgsql
    AS $_$
DECLARE
    dato text;
BEGIN
select "content" from usr_data into dato where id_persona=$1 and id_type=3 and sort=1; 
RETURN dato::text;
END;
$_$;


ALTER FUNCTION public.usr_address(id_ integer) OWNER TO postgres;

--
-- Name: usr_chosen_name(integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.usr_chosen_name(id1 integer) RETURNS text
    LANGUAGE plpgsql
    AS $_$
DECLARE
    relac text;
BEGIN
select chosen_name from usr into relac where id=$1; 
RETURN relac::text;
END;
$_$;


ALTER FUNCTION public.usr_chosen_name(id1 integer) OWNER TO postgres;

--
-- Name: usr_chosen_name(text); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.usr_chosen_name(id1 text) RETURNS text
    LANGUAGE plpgsql
    AS $_$
DECLARE
    relac text;
BEGIN
select chosen_name from usr into relac where code=$1; 
RETURN relac::text;
END;
$_$;


ALTER FUNCTION public.usr_chosen_name(id1 text) OWNER TO postgres;

--
-- Name: usr_code(integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.usr_code(id1 integer) RETURNS text
    LANGUAGE plpgsql
    AS $_$
DECLARE
    relac text;
BEGIN
select code from usr into relac where id=$1; 
RETURN relac::text;
END;
$_$;


ALTER FUNCTION public.usr_code(id1 integer) OWNER TO postgres;

--
-- Name: usr_data(integer, integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.usr_data(id_ integer, tipo integer) RETURNS text
    LANGUAGE plpgsql
    AS $_$
DECLARE
    dato text;
BEGIN
select "content" from usr_data into dato where id_persona=$1 and id_type=$2 and sort=1; 
RETURN dato::text;
END;
$_$;


ALTER FUNCTION public.usr_data(id_ integer, tipo integer) OWNER TO postgres;

--
-- Name: usr_data(integer, text); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.usr_data(id_ integer, tipo text) RETURNS text
    LANGUAGE plpgsql
    AS $_$
DECLARE
    dato text;
BEGIN
select "content" from usr_data into dato where id_persona=$1 and id_type in (select id from usr_content_types where descripcion = $2) and sort=1; 
RETURN dato::text;
END;
$_$;


ALTER FUNCTION public.usr_data(id_ integer, tipo text) OWNER TO postgres;

--
-- Name: usr_email(integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.usr_email(id_ integer) RETURNS text
    LANGUAGE plpgsql
    AS $_$
DECLARE
    dato text;
BEGIN
select "content" from usr_data into dato where id_persona=$1 and id_type=1 and sort=1; 
RETURN dato::text;
END;
$_$;


ALTER FUNCTION public.usr_email(id_ integer) OWNER TO postgres;

--
-- Name: usr_fullname(integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.usr_fullname(id1 integer) RETURNS text
    LANGUAGE plpgsql
    AS $$
DECLARE
    relac text;
BEGIN
select usr_fullname(id1,false) into relac; 
RETURN relac::text;
END;
$$;


ALTER FUNCTION public.usr_fullname(id1 integer) OWNER TO postgres;

--
-- Name: usr_fullname(text); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.usr_fullname(id1 text) RETURNS text
    LANGUAGE plpgsql
    AS $_$
DECLARE
    relac text;
BEGIN
select id::text from usr into relac where code=$1;
select usr_fullname(relac::integer) into relac; 
RETURN relac::text;
END;
$_$;


ALTER FUNCTION public.usr_fullname(id1 text) OWNER TO postgres;


ALTER FUNCTION public.usr_fullname(id1 integer, not_ch_name boolean) OWNER TO postgres;

--
-- Name: usr_id(text); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.usr_id(code1 text) RETURNS integer
    LANGUAGE plpgsql
    AS $$
DECLARE
    retval integer;
BEGIN
select id from usr into retval where upper(code)=UPPER(code1); 
RETURN retval::integer;
END;
$$;


ALTER FUNCTION public.usr_id(code1 text) OWNER TO postgres;

--
-- Name: usr_phone(integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.usr_phone(id_ integer) RETURNS text
    LANGUAGE plpgsql
    AS $_$
DECLARE
    dato text;
BEGIN
select "content" from usr_data into dato where id_persona=$1 and id_type=2 and sort=1; 
RETURN dato::text;
END;
$_$;


ALTER FUNCTION public.usr_phone(id_ integer) OWNER TO postgres;


ALTER FUNCTION public.usr_sys_insert(id1 integer, firstname1 text, lastname1 text, chosen_name1 text, code1 text, password1 text, role_id1 integer) OWNER TO postgres;


ALTER FUNCTION public.usr_sys_update(id1 integer, id2 integer, firstname2 text, lastname2 text, chosen_name2 text, code2 text, password2 text, role_id2 integer) OWNER TO postgres;


ALTER FUNCTION public.usr_sys_update(id1 integer, id2 integer, firstname2 text, lastname2 text, chosen_name2 text, code2 text, password2 text, role_id2 integer, pepe text) OWNER TO postgres;


ALTER FUNCTION public.usuarios_insert(id1 integer, firstname1 text, lastname1 text, chosen_name1 text, code1 text, document1 text, nit1 text, registro_tributario1 text, direccion1 text, departamento1 text, municipio1 text, giro1 text, email1 text, telefono1 text, pais1 text) OWNER TO postgres;


ALTER FUNCTION public.usuarios_update(id1 integer, id2 integer, firstname2 text, lastname2 text, chosen_name2 text, code2 text, document2 text, nit2 text, registro_tributario2 text, direccion2 text, departamento2 text, municipio2 text, giro2 text, email2 text, telefono2 text, pais2 text) OWNER TO postgres;



--
-- Name: attendance; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.attendance (
    id integer NOT NULL,
    user_id integer NOT NULL,
    date_time timestamp without time zone DEFAULT now() NOT NULL,
    last_modified timestamp without time zone DEFAULT now() NOT NULL,
    enter integer,
    status integer DEFAULT 1,
    rate numeric
);


ALTER TABLE public.attendance OWNER TO postgres;

--
-- Name: attendance_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.attendance_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.attendance_id_seq OWNER TO postgres;

--
-- Name: attendance_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.attendance_id_seq OWNED BY public.attendance.id;


ALTER TABLE public.attendance_report OWNER TO postgres;


ALTER TABLE public.attendance_report_active OWNER TO postgres;

--
-- Name: attendance_statuses; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.attendance_statuses (
    id integer NOT NULL,
    description text
);


ALTER TABLE public.attendance_statuses OWNER TO postgres;

--
-- Name: attendance_statuses_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.attendance_statuses_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.attendance_statuses_id_seq OWNER TO postgres;

--
-- Name: attendance_statuses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.attendance_statuses_id_seq OWNED BY public.attendance_statuses.id;


ALTER TABLE public.attendance_view OWNER TO postgres;

--
-- Name: usr; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.usr (
    id integer NOT NULL,
    up integer DEFAULT 1,
    firstname text,
    lastname text,
    chosen_name text,
    code text NOT NULL
);


ALTER TABLE public.usr OWNER TO postgres;


ALTER TABLE public.usr_sys OWNER TO postgres;

--
-- Name: usr_x_persons; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.usr_x_persons (
    id integer NOT NULL,
    person_id integer NOT NULL,
    document text,
    nit text,
    registro_tributario text,
    departamento text,
    municipio text,
    giro text,
    up integer DEFAULT 1,
    salary numeric
);


ALTER TABLE public.usr_x_persons OWNER TO postgres;

--
-- Name: employee; Type: VIEW; Schema: public; Owner: postgres
--

CREATE VIEW public.employee AS
 SELECT u.id,
    u.firstname,
    u.lastname,
    x.salary
   FROM (public.usr_sys u
     JOIN public.usr_x_persons x ON ((x.person_id = u.id)))
  WHERE (u.role_id > 1);


ALTER TABLE public.employee OWNER TO postgres;

--
-- Name: usr_content_types; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.usr_content_types (
    id integer NOT NULL,
    descripcion text
);


ALTER TABLE public.usr_content_types OWNER TO postgres;

--
-- Name: usr_content_types_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.usr_content_types_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.usr_content_types_id_seq OWNER TO postgres;

--
-- Name: usr_content_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.usr_content_types_id_seq OWNED BY public.usr_content_types.id;


--
-- Name: usr_data; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.usr_data (
    id integer NOT NULL,
    id_persona integer,
    id_type integer,
    content text,
    sort integer DEFAULT 1 NOT NULL
);


ALTER TABLE public.usr_data OWNER TO postgres;

--
-- Name: usr_data_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.usr_data_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.usr_data_id_seq OWNER TO postgres;

--
-- Name: usr_data_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.usr_data_id_seq OWNED BY public.usr_data.id;


--
-- Name: usr_persons_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.usr_persons_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.usr_persons_id_seq OWNER TO postgres;

--
-- Name: usr_persons_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.usr_persons_id_seq OWNED BY public.usr.id;


--
-- Name: usr_sys_roles; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.usr_sys_roles (
    id integer NOT NULL,
    descripcion text
);


ALTER TABLE public.usr_sys_roles OWNER TO postgres;

--
-- Name: usr_sys_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.usr_sys_roles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.usr_sys_roles_id_seq OWNER TO postgres;

--
-- Name: usr_sys_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.usr_sys_roles_id_seq OWNED BY public.usr_sys_roles.id;


--
-- Name: usr_x_persons_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.usr_x_persons_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.usr_x_persons_id_seq OWNER TO postgres;

--
-- Name: usr_x_persons_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.usr_x_persons_id_seq OWNED BY public.usr_x_persons.id;


--
-- Name: usr_x_sys_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.usr_x_sys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.usr_x_sys_id_seq OWNER TO postgres;

--
-- Name: usr_x_sys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.usr_x_sys_id_seq OWNED BY public.usr_x_sys.id;


--
-- Name: variables; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.variables (
    id integer NOT NULL,
    code text NOT NULL,
    valor text
);


ALTER TABLE public.variables OWNER TO postgres;

--
-- Name: variables_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.variables_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.variables_id_seq OWNER TO postgres;

--
-- Name: variables_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.variables_id_seq OWNED BY public.variables.id;


--
-- Name: attendance id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.attendance ALTER COLUMN id SET DEFAULT nextval('public.attendance_id_seq'::regclass);


--
-- Name: attendance_statuses id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.attendance_statuses ALTER COLUMN id SET DEFAULT nextval('public.attendance_statuses_id_seq'::regclass);


--
-- Name: usr id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr ALTER COLUMN id SET DEFAULT nextval('public.usr_persons_id_seq'::regclass);


--
-- Name: usr_content_types id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_content_types ALTER COLUMN id SET DEFAULT nextval('public.usr_content_types_id_seq'::regclass);


--
-- Name: usr_data id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_data ALTER COLUMN id SET DEFAULT nextval('public.usr_data_id_seq'::regclass);


--
-- Name: usr_sys_roles id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_sys_roles ALTER COLUMN id SET DEFAULT nextval('public.usr_sys_roles_id_seq'::regclass);


--
-- Name: usr_x_persons id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_x_persons ALTER COLUMN id SET DEFAULT nextval('public.usr_x_persons_id_seq'::regclass);


--
-- Name: variables id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.variables ALTER COLUMN id SET DEFAULT nextval('public.variables_id_seq'::regclass);


--
-- Data for Name: attendance; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.attendance (id, user_id, date_time, last_modified, enter, status, rate) FROM stdin;
383	3701	2022-04-26 19:50:27.907794	2022-04-27 18:23:13.250603	1	0	16
384	3701	2022-04-26 23:08:05.924819	2022-04-27 18:23:15.221823	0	0	16
429	2	2022-05-05 07:43:07.811731	2022-05-05 07:43:07.811731	0	1	15
430	2	2022-05-05 10:15:52.531144	2022-05-05 10:51:52.531144	1	1	15
431	2	2022-05-05 11:45:24.43563	2022-05-05 11:45:24.43563	0	1	15
432	2	2022-05-05 12:01:03.705597	2022-05-05 12:01:03.705597	1	1	15
366	3695	2022-04-25 20:00:08.255103	2022-04-25 20:09:08.255103	1	0	20
369	3695	2022-04-26 00:59:05.401178	2022-04-26 00:59:05.401178	0	0	20
374	3695	2022-04-26 19:50:26.907794	2022-04-26 19:50:26.907794	1	0	20
377	3695	2022-04-26 23:22:43.62062	2022-04-26 23:22:43.62062	0	0	20
388	3695	2022-04-27 19:56:55.25648	2022-04-27 19:56:55.25648	1	0	20
389	3695	2022-04-27 22:45:57.006492	2022-04-27 19:56:57.006492	0	0	20
397	3695	2022-04-28 19:39:09.732498	2022-04-28 19:39:09.732498	1	0	20
398	3695	2022-04-28 23:09:04.560897	2022-04-28 23:09:04.560897	0	0	20
402	3695	2022-05-01 08:18:20.033414	2022-05-01 08:18:20.033414	1	0	20
444	2	2022-05-06 11:00:52.639117	2022-05-06 11:00:52.639117	0	1	15
467	3701	2022-05-05 19:48:54.617125	2022-05-11 20:05:54.617125	1	1	16
404	3695	2022-05-01 14:10:05.995735	2022-05-01 14:10:05.995735	0	0	20
405	3695	2022-05-01 16:54:04.888216	2022-05-01 16:54:04.888216	1	0	20
406	3695	2022-05-01 21:25:01.16323	2022-05-01 21:25:01.16323	0	0	20
410	3695	2022-05-02 23:13:36.048527	2022-05-02 23:13:36.048527	0	0	20
411	3695	2022-05-03 20:09:38.347168	2022-05-02 23:13:38.347168	1	0	20
415	3695	2022-05-03 23:43:36.505668	2022-05-03 20:09:36.505668	0	0	20
409	3695	2022-05-02 20:13:32.727188	2022-05-02 23:13:32.727188	1	0	20
423	3695	2022-05-04 19:18:56.228854	2022-05-04 19:18:56.228854	1	0	20
424	3695	2022-05-04 22:13:47.089409	2022-05-04 22:13:47.089409	0	0	20
419	3701	2022-05-03 20:09:51.743117	2022-05-04 16:45:51.743117	1	0	16
420	3701	2022-05-03 23:43:54.712138	2022-05-04 16:45:54.712138	0	0	16
446	2	2022-05-06 11:55:13.099078	2022-05-06 11:55:13.099078	1	1	15
445	3695	2022-05-05 23:02:38.422315	2022-05-06 11:02:38.422315	0	1	20
427	3701	2022-05-04 19:18:56.228854	2022-05-04 19:18:57.228854	1	0	20
428	3701	2022-05-04 22:13:47.089409	2022-05-04 22:13:58.089409	0	0	20
468	3701	2022-05-05 23:02:56.116963	2022-05-11 20:05:56.116963	0	1	16
433	2	2022-05-05 15:26:20.449182	2022-05-05 15:26:20.449182	0	1	15
434	2	2022-05-05 16:01:46.564504	2022-05-05 16:01:46.564504	1	1	15
367	3705	2022-04-25 20:00:27.96422	2022-04-25 20:09:27.96422	1	0	16
368	3705	2022-04-26 00:50:36.099849	2022-04-26 00:50:36.099849	0	0	16
375	3705	2022-04-26 19:51:28.733415	2022-04-26 19:51:28.733415	1	0	16
376	3705	2022-04-26 23:07:05.924819	2022-04-26 23:07:05.924819	0	0	16
387	3705	2022-04-27 19:55:14.990964	2022-04-27 19:55:14.990964	1	0	16
390	3705	2022-04-27 22:44:21.302708	2022-04-27 22:44:21.302708	0	0	16
401	3705	2022-05-01 08:17:54.754728	2022-05-01 08:17:54.754728	1	0	16
403	3705	2022-05-01 14:08:10.936644	2022-05-01 14:08:10.936644	0	0	16
414	3705	2022-05-03 20:08:42.854281	2022-05-03 20:08:42.854281	1	1	16
416	3705	2022-05-03 23:43:01.543749	2022-05-03 23:43:01.543749	0	1	16
385	2	2022-04-27 19:04:51.050995	2022-04-27 19:04:51.050995	1	0	15
447	2	2022-05-06 12:30:47.251818	2022-05-06 13:52:47.251818	0	1	15
448	3705	2022-05-07 07:33:55.50547	2022-05-07 07:33:55.50547	1	1	16
449	3695	2022-05-07 07:38:40.555448	2022-05-07 07:38:40.555448	1	1	20
426	2	2022-05-05 07:15:14.162205	2022-05-05 07:15:14.162205	1	1	15
386	2	2022-04-27 19:32:21.446897	2022-04-27 19:32:21.446897	0	0	15
391	2	2022-04-28 05:02:34.470559	2022-04-28 05:02:34.470559	1	0	15
392	2	2022-04-28 06:10:25.958848	2022-04-28 06:10:25.958848	0	0	15
452	2	2022-05-10 06:53:24.504143	2022-05-10 06:53:24.504143	1	1	15
453	2	2022-05-10 07:40:37.9371	2022-05-10 07:40:37.9371	0	1	15
393	2	2022-04-28 07:27:55.946619	2022-04-28 07:27:55.946619	1	0	15
394	2	2022-04-28 07:49:04.459054	2022-04-28 07:49:04.459054	0	0	15
395	2	2022-04-28 13:16:48.575355	2022-04-28 13:16:48.575355	1	0	15
396	2	2022-04-28 14:17:51.757107	2022-04-28 15:07:51.757107	0	0	15
400	2	2022-04-29 12:30:18.76791	2022-04-29 12:30:18.76791	0	0	15
399	2	2022-04-29 11:30:16.260811	2022-04-29 12:30:16.260811	1	0	15
412	2	2022-05-03 15:52:46.596084	2022-05-03 15:52:46.596084	1	0	15
413	2	2022-05-03 16:10:32.041182	2022-05-03 16:10:32.041182	0	0	15
418	2	2022-05-04 16:02:19.452232	2022-05-04 16:02:19.452232	1	0	15
422	2	2022-05-04 18:29:42.815325	2022-05-04 18:29:42.815325	0	0	15
435	2	2022-05-05 16:17:07.683391	2022-05-05 16:17:07.683391	0	1	15
437	3695	2022-05-05 19:48:43.173321	2022-05-05 19:48:43.173321	1	1	20
438	2	2022-05-06 07:20:06.388222	2022-05-06 07:20:06.388222	1	1	15
454	2	2022-05-10 09:32:14.872284	2022-05-10 09:32:14.872284	1	1	15
441	2	2022-05-06 08:25:17.551521	2022-05-06 08:25:17.551521	0	1	15
442	2	2022-05-06 10:28:52.532648	2022-05-06 10:28:52.532648	1	1	15
455	2	2022-05-10 17:15:43.348175	2022-05-10 17:15:43.348175	0	1	15
458	2	2022-05-11 10:26:30.794283	2022-05-11 10:26:30.794283	1	1	15
461	2	2022-05-11 19:39:53.277483	2022-05-11 19:39:53.277483	1	1	15
443	3706	2022-05-05 23:00:45.265818	2022-05-06 11:00:45.265818	0	0	18
451	3695	2022-05-09 19:30:40.736029	2022-05-09 22:56:40.736029	1	1	20
456	3695	2022-05-09 23:33:23.924664	2022-05-10 19:56:23.924664	0	1	20
457	3695	2022-05-10 20:00:42.598709	2022-05-10 23:33:42.598709	1	1	20
462	3695	2022-05-10 23:33:47.188295	2022-05-11 19:48:47.188295	0	1	20
463	3695	2022-05-11 19:50:54.657972	2022-05-11 19:50:54.657972	1	1	20
474	3695	2022-05-11 22:34:14.691381	2022-05-11 22:34:14.691381	0	1	20
469	3701	2022-05-09 19:30:57.723763	2022-05-11 20:05:57.723763	1	1	16
470	3701	2022-05-09 23:33:58.756138	2022-05-11 20:05:58.756138	0	1	16
471	3701	2022-05-10 20:06:49.760934	2022-05-11 20:06:49.760934	1	1	16
472	3701	2022-05-10 23:33:50.626112	2022-05-11 20:06:50.626112	0	1	16
459	2	2022-05-11 11:00:58.55311	2022-05-11 11:17:58.55311	0	1	15
473	2	2022-05-11 20:34:53.429265	2022-05-11 20:22:53.429265	0	1	15
478	3701	2022-05-11 19:04:06.18432	2022-05-12 12:04:06.18432	1	1	18
479	3701	2022-05-11 22:33:07.35798	2022-05-12 12:04:07.35798	0	1	18
460	3705	2022-05-07 11:30:38.119854	2022-05-11 19:23:38.119854	0	1	16
450	3695	2022-05-07 11:30:11.802366	2022-05-09 19:30:11.802366	0	1	20
421	3706	2022-05-04 18:23:38.949751	2022-05-04 18:23:38.949751	1	0	18
425	3706	2022-05-04 22:14:33.778812	2022-05-04 22:14:33.778812	0	0	18
436	3706	2022-05-05 18:48:33.23462	2022-05-05 18:48:33.23462	1	0	18
465	3706	2022-05-10 19:54:10.908045	2022-05-11 19:54:10.908045	1	0	18
466	3706	2022-05-10 23:33:12.997789	2022-05-11 19:54:12.997789	0	0	18
476	3706	2022-05-11 19:00:06.18432	2022-05-12 12:04:06.18432	1	0	18
477	3706	2022-05-11 22:30:07.35798	2022-05-12 12:04:07.35798	0	0	18
\.


--
-- Data for Name: attendance_statuses; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.attendance_statuses (id, description) FROM stdin;
1	Active
2	Paid
0	Deleted
\.


--
-- Data for Name: usr; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.usr (id, up, firstname, lastname, chosen_name, code) FROM stdin;
3698	1	Lorena	\N	Lorena	Lorena
2	1	Manuel Mauricio	Grande Pineda	Mauricio Grande	sysadmin
3699	1	Morena	Lazo	Morena	Morena
3697	1	Clara	Ramos	Clara	Clara
3700	1	Gabriela	Orellana	Gaby Orellana	Gaby
3705	1	Verónica Esmeralda	Hernández	Vero	Vero
3695	1	Gloria	Portillo	Gloria	Gloria
3701	1	Guillermo	Granillo	Jimmy Granillo	Jimmy
3706	1	Evelyn	Mineros	Evelyn	Evelyn
\.


--
-- Data for Name: usr_content_types; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.usr_content_types (id, descripcion) FROM stdin;
1	email
2	telefono
3	direccion
4	pais
5	fax
\.


--
-- Data for Name: usr_data; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.usr_data (id, id_persona, id_type, content, sort) FROM stdin;
4014	3695	1	portillog1169@gmail.com	1
4015	3695	4	USA	1
4018	3695	2	13237199786	1
4017	3695	5	13237535639	1
4019	3697	2	12133640611	1
4016	3695	3	1100 West 74th Street, 90044	1
18	2	3	El Bálsamo, Calle a Tilapa, Huizúcar, La Libertad	1
20	2	4	El Salvador	1
1	2	1	mgrande@uca.edu.sv	1
19	2	2	7106-7549	1
2831	2	5	22106659	1
\.


--
-- Data for Name: usr_sys_roles; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.usr_sys_roles (id, descripcion) FROM stdin;
0	Down
1	Patron
2	Manager
3	Care giver
\.


--
-- Data for Name: usr_x_persons; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.usr_x_persons (id, person_id, document, nit, registro_tributario, departamento, municipio, giro, up, salary) FROM stdin;
38	2	01435575-0	0813-020766-001-9		1	Huizucar		1	15
3362	3695	\N	\N	\N	California	Los Angeles	\N	1	20
3363	3697	\N	\N	\N	California	Los Angeles	\N	1	18
3368	3705	\N	\N	\N	California	Los Angeles	\N	1	16
3364	3698	\N	\N	\N	California	Los Angeles	\N	1	15
3365	3699	\N	\N	\N	California	\N	\N	1	15
3366	3700	\N	\N	\N	California	Los Angeles	\N	1	15
3367	3701	\N	\N	\N	California	Los Angeles	\N	1	16
3369	3706	\N	\N	\N	California	Los Angeles	\N	1	18
\.


--
-- Data for Name: variables; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.variables (id, code, valor) FROM stdin;
\.



--
-- Name: usr_sys_roles 000iii; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_sys_roles
    ADD CONSTRAINT "000iii" UNIQUE (descripcion);


--
-- Name: attendance attendance_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.attendance
    ADD CONSTRAINT attendance_pkey PRIMARY KEY (id);


--
-- Name: usr_data dd442; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_data
    ADD CONSTRAINT dd442 UNIQUE (id_persona, id_type, sort);


--
-- Name: usr dfsdf; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr
    ADD CONSTRAINT dfsdf PRIMARY KEY (id);


--
-- Name: variables do; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.variables
    ADD CONSTRAINT "do" UNIQUE (code);


--
-- Name: usr_data fe45; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_data
    ADD CONSTRAINT fe45 PRIMARY KEY (id);


--
-- Name: usr grwe; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr
    ADD CONSTRAINT grwe UNIQUE (code);


--
-- Name: usr_x_persons hvbdf; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_x_persons
    ADD CONSTRAINT hvbdf UNIQUE (person_id);


--
-- Name: usr_sys_roles id0000; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_sys_roles
    ADD CONSTRAINT id0000 PRIMARY KEY (id);


--
-- Name: variables lo; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.variables
    ADD CONSTRAINT lo PRIMARY KEY (id);


--
-- Name: usr_content_types serialid; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_content_types
    ADD CONSTRAINT serialid PRIMARY KEY (id);


--
-- Name: usr_x_persons tr; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_x_persons
    ADD CONSTRAINT tr PRIMARY KEY (id);


--
-- Name: usr_sys _INSERT; Type: RULE; Schema: public; Owner: postgres
--

CREATE RULE "_INSERT" AS
    ON INSERT TO public.usr_sys DO INSTEAD  SELECT public.usr_sys_insert(new.id, new.firstname, new.lastname, new.chosen_name, new.code, new.password, new.role_id) AS usr_sys_insert;


--
-- Name: usr_sys _UPDATE; Type: RULE; Schema: public; Owner: postgres
--

CREATE RULE "_UPDATE" AS
    ON UPDATE TO public.usr_sys DO INSTEAD  SELECT public.usr_sys_update(old.id, new.id, new.firstname, new.lastname, new.chosen_name, new.code, new.password, new.role_id) AS usr_sys_update;


--
-- Name: attendance attendance_fk_user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.attendance
    ADD CONSTRAINT attendance_fk_user_id FOREIGN KEY (user_id) REFERENCES public.usr(id) NOT VALID;


--
-- Name: usr_data dd44; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_data
    ADD CONSTRAINT dd44 FOREIGN KEY (id_type) REFERENCES public.usr_content_types(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: usr_data df56; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_data
    ADD CONSTRAINT df56 FOREIGN KEY (id_persona) REFERENCES public.usr(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: usr_x_persons erdfg; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.usr_x_persons
    ADD CONSTRAINT erdfg FOREIGN KEY (person_id) REFERENCES public.usr(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
--

