--
--

\restrict A8HFrwa2JNdMUddjos6f4aGMibDu1rjChxPbIKPPvj10wlW5ML5qqgQd9OWjLxn


SET transaction_timeout = 0;
SELECT pg_catalog.set_config('search_path', '', false);

--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON SCHEMA public IS '';




--
-- Name: account_mappings; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.account_mappings (
    id integer NOT NULL,
    mapping_code character varying(50) NOT NULL,
    mapping_name character varying(100) NOT NULL,
    account_id integer NOT NULL,
    description text,
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: account_mappings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.account_mappings ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.account_mappings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: account_transactions; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.account_transactions (
    id integer NOT NULL,
    store_id integer,
    branch_id integer DEFAULT 1 NOT NULL,
    sale_id integer,
    account_type character varying(50) NOT NULL,
    account_id integer,
    cheque_id integer,
    card_type_id integer,
    card_last_four character varying(4),
    card_transaction_ref character varying(100),
    is_reconciled boolean DEFAULT false NOT NULL,
    amount numeric(10,2) NOT NULL,
    tip_amount numeric(10,2) DEFAULT 0.00,
    description character varying(255),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: account_transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.account_transactions ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.account_transactions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: account_types; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.account_types (
    id integer NOT NULL,
    type_code character varying(10) NOT NULL,
    type_name character varying(50) NOT NULL,
    default_side character varying(255) NOT NULL,
    description text,
    sort_order integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: account_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.account_types ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.account_types_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: bank_access; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.bank_access (
    user_id integer NOT NULL,
    bank_account_id integer NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer
);


--
-- Name: bank_accounts; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.bank_accounts (
    id integer NOT NULL,
    bank_name character varying(100) NOT NULL,
    account_title character varying(150) NOT NULL,
    chart_of_account_id integer,
    mapped_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    mapped_by integer,
    account_number character varying(50) NOT NULL,
    iban character varying(50),
    branch_name character varying(100),
    branch_code character varying(50),
    swift_code character varying(50),
    address text,
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: bank_accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.bank_accounts ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.bank_accounts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: bom_components; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.bom_components (
    id integer NOT NULL,
    bom_id integer NOT NULL,
    component_item_id integer NOT NULL,
    quantity numeric(12,6) NOT NULL
);


--
-- Name: bom_components_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.bom_components ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.bom_components_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: bom_master; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.bom_master (
    id integer NOT NULL,
    item_id integer NOT NULL,
    description text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: bom_master_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.bom_master ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.bom_master_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: branch_access; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.branch_access (
    user_id integer NOT NULL,
    branch_id integer NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer
);


--
-- Name: branch_info; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.branch_info (
    id integer NOT NULL,
    default_store_id integer,
    branch_name character varying(255),
    branch_code character varying(20),
    branch_address text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    ntn character varying(30),
    strn character varying(30),
    branch_phone character varying(50),
    facebook_url character varying(255),
    instagram_url character varying(255),
    youtube_url character varying(255),
    province character varying(100) DEFAULT 'Punjab'::character varying,
    is_active boolean DEFAULT true,
    branch_type character varying(255) DEFAULT 'branch'::character varying,
    is_default boolean DEFAULT false
);


--
-- Name: branch_info_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.branch_info ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.branch_info_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: card_types; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.card_types (
    id integer NOT NULL,
    card_code character varying(50) NOT NULL,
    card_name character varying(100) NOT NULL,
    display_name character varying(100),
    icon_class character varying(100) DEFAULT 'fas fa-credit-card'::character varying,
    color_class character varying(100) DEFAULT 'btn-outline-primary'::character varying,
    default_charge_rate numeric(5,2) DEFAULT 0.00,
    sort_order integer DEFAULT 0,
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    revenue_account_id integer
);


--
-- Name: COLUMN card_types.revenue_account_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.card_types.revenue_account_id IS 'Chart of accounts revenue line for this card type; NULL = use rev_CardSale mapping';


--
-- Name: card_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.card_types ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.card_types_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: categories; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.categories (
    id integer NOT NULL,
    name character varying(100) NOT NULL,
    icon character varying(255) DEFAULT 'assets/img/categories/category-01.png'::character varying,
    is_active boolean DEFAULT true NOT NULL
);


--
-- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.categories ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.categories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: chart_of_accounts; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.chart_of_accounts (
    id integer NOT NULL,
    account_code character varying(20) NOT NULL,
    account_name character varying(100) NOT NULL,
    account_type character varying(255) NOT NULL,
    account_category character varying(255) NOT NULL,
    parent_account_id integer,
    account_level integer DEFAULT 1,
    is_active boolean DEFAULT true,
    description text,
    opening_balance numeric(15,2) DEFAULT 0.00,
    current_balance numeric(15,2) DEFAULT 0.00,
    store_id integer DEFAULT 1,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: chart_of_accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.chart_of_accounts ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.chart_of_accounts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: cheque_books; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.cheque_books (
    id integer NOT NULL,
    bank_account_id integer NOT NULL,
    branch_id integer DEFAULT 1 NOT NULL,
    first_cheque_number character(6) NOT NULL,
    last_cheque_number character(6) NOT NULL,
    cheque_count integer DEFAULT 0 NOT NULL,
    notes character varying(255),
    created_by integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: cheque_books_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.cheque_books ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.cheque_books_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: cheques; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.cheques (
    id integer NOT NULL,
    cheque_book_id integer NOT NULL,
    bank_account_id integer NOT NULL,
    branch_id integer DEFAULT 1 NOT NULL,
    cheque_number character(6) NOT NULL,
    status character varying(255) DEFAULT 'unused'::character varying NOT NULL,
    amount numeric(12,2),
    sale_id integer,
    payee_name character varying(255),
    issue_date date,
    cleared_date date,
    bounced_date date,
    memo character varying(500),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: cheques_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.cheques ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.cheques_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: cus_outstanding; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.cus_outstanding (
    id integer NOT NULL,
    sale_id integer NOT NULL,
    customer_id integer NOT NULL,
    amount numeric(10,2) NOT NULL,
    status character varying(255) DEFAULT 'unpaid'::character varying,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: cus_outstanding_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.cus_outstanding ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.cus_outstanding_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: cus_payments; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.cus_payments (
    id integer NOT NULL,
    store_id integer,
    customer_id integer NOT NULL,
    sale_id integer,
    balance_entry_id integer,
    amount_paid numeric(10,2) NOT NULL,
    payment_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    remarks character varying(255)
);


--
-- Name: cus_payments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.cus_payments ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.cus_payments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: customer_balance_entries; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.customer_balance_entries (
    id integer NOT NULL,
    entry_number character varying(30) NOT NULL,
    customer_id integer NOT NULL,
    store_id integer DEFAULT 1,
    entry_type character varying(255) DEFAULT 'receivable'::character varying NOT NULL,
    amount numeric(12,2) NOT NULL,
    remaining_amount numeric(12,2) NOT NULL,
    reference_no character varying(50),
    remarks character varying(255),
    map_account_id integer,
    journal_entry_id integer,
    status character varying(255) DEFAULT 'posted'::character varying NOT NULL,
    created_by integer NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: customer_balance_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.customer_balance_entries ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.customer_balance_entries_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: customer_categories; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.customer_categories (
    id integer NOT NULL,
    category_name character varying(100) NOT NULL,
    description text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: customer_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.customer_categories ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.customer_categories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: customer_subscription_invoices; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.customer_subscription_invoices (
    id integer NOT NULL,
    subscription_id integer NOT NULL,
    sale_id integer NOT NULL,
    period_start date NOT NULL,
    period_end date NOT NULL,
    amount numeric(12,2) DEFAULT 0.00 NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: customer_subscription_invoices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.customer_subscription_invoices ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.customer_subscription_invoices_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: customer_subscriptions; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.customer_subscriptions (
    id integer NOT NULL,
    store_id integer,
    customer_id integer NOT NULL,
    item_id integer NOT NULL,
    subscription_plan_id integer,
    status character varying(255) DEFAULT 'active'::character varying NOT NULL,
    start_date date NOT NULL,
    current_period_end date NOT NULL,
    next_renewal_date date,
    amount numeric(12,2) DEFAULT 0.00 NOT NULL,
    auto_renew boolean DEFAULT false NOT NULL,
    notes text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: customer_subscriptions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.customer_subscriptions ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.customer_subscriptions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: customers; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.customers (
    id integer NOT NULL,
    primary_store_id integer,
    name character varying(100) NOT NULL,
    phone character varying(20),
    email character varying(100),
    address text,
    is_walk_in boolean DEFAULT false,
    ntn character varying(20),
    province character varying(100) DEFAULT 'Punjab'::character varying,
    active boolean DEFAULT true NOT NULL,
    discount_applied character varying(255) DEFAULT 'N'::character varying,
    discount_rate numeric(5,2) DEFAULT 0.00,
    withholding_rate numeric(5,2) DEFAULT 0.00,
    category_id integer,
    customer_type character varying(255) DEFAULT 'retail'::character varying NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: customers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.customers ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.customers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: deal_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.deal_items (
    id integer NOT NULL,
    deal_id integer NOT NULL,
    selection_type character varying(255) NOT NULL,
    category_id integer,
    sub_category_id integer,
    item_id integer,
    sort_order integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    min_selection integer DEFAULT 1,
    max_selection integer DEFAULT 1
);


--
-- Name: deal_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.deal_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.deal_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: deals; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.deals (
    id integer NOT NULL,
    item_id integer NOT NULL,
    deal_name character varying(100) NOT NULL,
    deal_price numeric(10,2) NOT NULL,
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: deals_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.deals ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.deals_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: delivery_orders; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.delivery_orders (
    id integer NOT NULL,
    store_id integer,
    sale_id integer NOT NULL,
    customer_id integer NOT NULL,
    rider_id integer,
    delivery_status character varying(255) DEFAULT 'pending'::character varying,
    delivery_address text,
    delivery_time timestamp without time zone,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: delivery_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.delivery_orders ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.delivery_orders_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: delivery_riders; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.delivery_riders (
    id integer NOT NULL,
    assigned_store_id integer,
    name character varying(100) NOT NULL,
    phone character varying(20),
    email character varying(100),
    vehicle_number character varying(50),
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: delivery_riders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.delivery_riders ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.delivery_riders_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: dinein_floors; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.dinein_floors (
    id integer NOT NULL,
    store_id integer,
    name character varying(100) NOT NULL,
    description text,
    is_active boolean DEFAULT true,
    background_image character varying(255),
    layout_canvas_width integer DEFAULT 1200 NOT NULL,
    layout_canvas_height integer DEFAULT 800 NOT NULL,
    CONSTRAINT dinein_floors_layout_canvas_height_check CHECK (((layout_canvas_height >= 300) AND (layout_canvas_height <= 3000))),
    CONSTRAINT dinein_floors_layout_canvas_width_check CHECK (((layout_canvas_width >= 400) AND (layout_canvas_width <= 4000)))
);


--
-- Name: COLUMN dinein_floors.background_image; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.dinein_floors.background_image IS 'Relative path to floor plan background template image (uploaded from Dine-In Setup)';


--
-- Name: COLUMN dinein_floors.layout_canvas_width; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.dinein_floors.layout_canvas_width IS 'Floor plan editor canvas width in pixels (layout positions are stored as % of this size)';


--
-- Name: COLUMN dinein_floors.layout_canvas_height; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.dinein_floors.layout_canvas_height IS 'Floor plan editor canvas height in pixels (layout positions are stored as % of this size)';


--
-- Name: dinein_floors_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.dinein_floors ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.dinein_floors_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: dinein_tables; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.dinein_tables (
    id integer NOT NULL,
    store_id integer,
    floor_id integer NOT NULL,
    table_name character varying(50) NOT NULL,
    seats integer DEFAULT 4,
    status character varying(255) DEFAULT 'available'::character varying,
    is_active boolean DEFAULT true,
    table_shape character varying(20) DEFAULT 'square'::character varying NOT NULL,
    layout_x numeric(6,3),
    layout_y numeric(6,3),
    layout_w numeric(6,3) DEFAULT 8.000 NOT NULL,
    layout_h numeric(6,3) DEFAULT 8.000 NOT NULL,
    layout_rotation smallint DEFAULT 0 NOT NULL,
    is_layout_placed boolean DEFAULT false NOT NULL,
    color character varying(7) DEFAULT '#3b82f6'::character varying NOT NULL,
    CONSTRAINT dinein_tables_layout_h_check CHECK (((layout_h > (0)::numeric) AND (layout_h <= (100)::numeric))),
    CONSTRAINT dinein_tables_layout_rotation_check CHECK (((layout_rotation >= 0) AND (layout_rotation <= 359))),
    CONSTRAINT dinein_tables_layout_w_check CHECK (((layout_w > (0)::numeric) AND (layout_w <= (100)::numeric))),
    CONSTRAINT dinein_tables_layout_x_check CHECK (((layout_x IS NULL) OR ((layout_x >= (0)::numeric) AND (layout_x <= (100)::numeric)))),
    CONSTRAINT dinein_tables_layout_y_check CHECK (((layout_y IS NULL) OR ((layout_y >= (0)::numeric) AND (layout_y <= (100)::numeric)))),
    CONSTRAINT dinein_tables_table_shape_check CHECK (((table_shape)::text = ANY (ARRAY[('square'::character varying)::text, ('round'::character varying)::text])))
);


--
-- Name: COLUMN dinein_tables.layout_x; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.dinein_tables.layout_x IS 'Table left position on floor plan as % of floor layout_canvas_width (NULL = not placed yet)';


--
-- Name: COLUMN dinein_tables.layout_y; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.dinein_tables.layout_y IS 'Table top position on floor plan as % of floor layout_canvas_height (NULL = not placed yet)';


--
-- Name: COLUMN dinein_tables.layout_w; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.dinein_tables.layout_w IS 'Table width on floor plan as % of floor layout_canvas_width';


--
-- Name: COLUMN dinein_tables.layout_h; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.dinein_tables.layout_h IS 'Table height on floor plan as % of floor layout_canvas_height';


--
-- Name: COLUMN dinein_tables.layout_rotation; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.dinein_tables.layout_rotation IS 'Table rotation on floor plan in degrees (0–359)';


--
-- Name: COLUMN dinein_tables.is_layout_placed; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.dinein_tables.is_layout_placed IS 'True when table has been positioned on the floor plan editor; false = POS may use auto grid';


--
-- Name: COLUMN dinein_tables.color; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.dinein_tables.color IS 'Hex color for table tile on dine-in floor plan (e.g. #3b82f6)';


--
-- Name: dinein_tables_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.dinein_tables ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.dinein_tables_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: discount_categories; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.discount_categories (
    id integer NOT NULL,
    category_name character varying(100) NOT NULL,
    display_order integer DEFAULT 0,
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: discount_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.discount_categories ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.discount_categories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: discounts; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.discounts (
    id integer NOT NULL,
    discount_name character varying(100) NOT NULL,
    discount_code character varying(20),
    discount_type character varying(255) NOT NULL,
    discount_rate numeric(10,2) NOT NULL,
    discount_cap numeric(10,2),
    category_id integer,
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: discounts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.discounts ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.discounts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: expense_accounts; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.expense_accounts (
    id integer NOT NULL,
    category_id integer NOT NULL,
    subcategory_id integer NOT NULL,
    name character varying(100) NOT NULL,
    chart_of_account_id integer,
    mapped_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    mapped_by integer
);


--
-- Name: expense_accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.expense_accounts ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.expense_accounts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: expense_categories; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.expense_categories (
    id integer NOT NULL,
    name character varying(100) NOT NULL
);


--
-- Name: expense_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.expense_categories ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.expense_categories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: expense_subcategories; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.expense_subcategories (
    id integer NOT NULL,
    category_id integer NOT NULL,
    name character varying(100) NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: expense_subcategories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.expense_subcategories ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.expense_subcategories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: expenses; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.expenses (
    id integer NOT NULL,
    store_id integer,
    branch_id integer,
    shift_id integer,
    expense_payment_group_id character varying(36),
    account_id integer NOT NULL,
    remarks text,
    amount numeric(10,2) NOT NULL,
    expense_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    payment_method character varying(255) DEFAULT 'cash'::character varying,
    bank_account_id integer,
    journal_entry_id integer,
    status character varying(255) DEFAULT 'approved'::character varying,
    approved_by integer,
    approved_at timestamp without time zone,
    reversal_date date,
    reversal_reason text,
    reversal_journal_id integer,
    rejection_reason text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: expenses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.expenses ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.expenses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: fbr_config; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.fbr_config (
    id integer NOT NULL,
    is_enabled boolean,
    display_name character varying(255) DEFAULT 'FBR'::character varying NOT NULL,
    api_url character varying(255),
    pos_id bigint,
    usin character varying(50)
);


--
-- Name: fbr_config_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.fbr_config ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.fbr_config_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: fbr_digital; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.fbr_digital (
    id integer NOT NULL,
    is_enabled boolean DEFAULT false,
    api_url character varying(255),
    token text,
    mode character varying(255) DEFAULT 'sandbox'::character varying,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    validate_api_url character varying(255),
    sandbox_token text,
    production_token text,
    post_api_url_sandbox character varying(255) DEFAULT 'https://gw.fbr.gov.pk/di_data/v1/di/postinvoicedata_sb'::character varying,
    post_api_url_production character varying(255) DEFAULT 'https://gw.fbr.gov.pk/di_data/v1/di/postinvoicedata'::character varying,
    validate_api_url_sandbox character varying(255) DEFAULT 'https://gw.fbr.gov.pk/di_data/v1/di/validateinvoicedata_sb'::character varying,
    validate_api_url_production character varying(255) DEFAULT 'https://gw.fbr.gov.pk/di_data/v1/di/validateinvoicedata'::character varying,
    business_activity character varying(100) DEFAULT 'Manufacturer'::character varying,
    business_sector character varying(100) DEFAULT 'All Other Sectors'::character varying,
    eligible_scenario_ids text,
    block_sale_on_failure boolean DEFAULT true
);


--
-- Name: fbr_digital_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.fbr_digital ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.fbr_digital_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: fbr_digital_invoices; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.fbr_digital_invoices (
    id integer NOT NULL,
    sale_id integer NOT NULL,
    fbr_invoice_number character varying(100) NOT NULL,
    qr_code text,
    scenario_id character varying(20),
    response_status character varying(50) DEFAULT 'success'::character varying,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: fbr_digital_invoices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.fbr_digital_invoices ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.fbr_digital_invoices_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: fbr_digital_logs; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.fbr_digital_logs (
    id integer NOT NULL,
    sale_id integer,
    scenario_id character varying(20),
    endpoint character varying(255),
    request_data text,
    response_data text,
    http_status integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: fbr_digital_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.fbr_digital_logs ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.fbr_digital_logs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: fbr_digital_scenarios; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.fbr_digital_scenarios (
    id integer NOT NULL,
    scenario_id character varying(20) NOT NULL,
    status character varying(20) DEFAULT 'pending'::character varying,
    request_data text,
    response_data text,
    fbr_invoice_number character varying(100),
    error_message text,
    tested_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: fbr_digital_scenarios_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.fbr_digital_scenarios ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.fbr_digital_scenarios_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: fbr_invoices; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.fbr_invoices (
    id integer NOT NULL,
    sale_id integer NOT NULL,
    fbr_invoice_number character varying(100) NOT NULL,
    qr_code text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: fbr_invoices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.fbr_invoices ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.fbr_invoices_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: fbr_logs; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.fbr_logs (
    id integer NOT NULL,
    sale_id integer,
    response text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: fbr_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.fbr_logs ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.fbr_logs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: fiscal_period_setup; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.fiscal_period_setup (
    start_year character varying(50) NOT NULL,
    start_month integer,
    start_day integer,
    month_count integer,
    open_year integer
);


--
-- Name: fiscal_periods; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.fiscal_periods (
    id integer NOT NULL,
    period_code character varying(50),
    period_name character varying(50) NOT NULL,
    period_year integer,
    start_date date NOT NULL,
    end_date date NOT NULL,
    is_closed boolean DEFAULT false,
    period_status character varying(50) DEFAULT 'Open'::character varying,
    closed_by integer,
    closed_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: fiscal_periods_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.fiscal_periods ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.fiscal_periods_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: hold_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.hold_items (
    id integer NOT NULL,
    store_id integer,
    hold_id integer,
    item_id integer,
    item_name character varying(100),
    quantity numeric(12,3),
    unit_price numeric(10,2),
    original_unit_price numeric(10,2),
    discount_type character varying(255) DEFAULT 'none'::character varying NOT NULL,
    discount_value numeric(10,2) DEFAULT 0.00 NOT NULL,
    discount_per_unit numeric(10,2) DEFAULT 0.00 NOT NULL,
    discount_amount numeric(10,2) DEFAULT 0.00 NOT NULL,
    tax_rate numeric(5,2),
    modifiers text,
    remarks text,
    void_status character varying(255) DEFAULT 'active'::character varying NOT NULL,
    template_id integer,
    is_deal boolean DEFAULT false,
    deal_selections text,
    serial_ids text
);


--
-- Name: hold_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.hold_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.hold_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: hold_orders; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.hold_orders (
    id integer NOT NULL,
    token_number integer,
    shift_id integer,
    store_id integer,
    customer_name character varying(100),
    customer_id integer,
    table_id integer,
    order_mode character varying(50),
    rider_id integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    total_amount numeric(10,2) DEFAULT 0.00,
    discount_id integer,
    discount_type character varying(255) DEFAULT 'none'::character varying,
    discount_value numeric(10,2) DEFAULT 0.00,
    discount_amount numeric(10,2) DEFAULT 0.00,
    order_taker_id integer,
    number_of_guests integer,
    reserved_invoice_number character varying(20)
);


--
-- Name: hold_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.hold_orders ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.hold_orders_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: inventory_lots; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.inventory_lots (
    id integer NOT NULL,
    item_id integer NOT NULL,
    store_id integer,
    branch_id integer DEFAULT 1 NOT NULL,
    purchase_id integer,
    purchase_item_id integer,
    lot_number character varying(50),
    expiry_date date NOT NULL,
    mfg_date date,
    qty_received numeric(12,3) NOT NULL,
    qty_on_hand numeric(12,3) NOT NULL,
    unit_cost numeric(10,2),
    status_code character varying(20) DEFAULT 'active'::character varying NOT NULL,
    remarks text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    CONSTRAINT inventory_lots_qty_on_hand_check CHECK ((qty_on_hand >= (0)::numeric)),
    CONSTRAINT inventory_lots_qty_on_hand_lte_received_check CHECK ((qty_on_hand <= qty_received)),
    CONSTRAINT inventory_lots_qty_received_check CHECK ((qty_received > (0)::numeric)),
    CONSTRAINT inventory_lots_status_code_check CHECK (((status_code)::text = ANY (ARRAY[('active'::character varying)::text, ('depleted'::character varying)::text, ('expired'::character varying)::text, ('written_off'::character varying)::text])))
);


--
-- Name: TABLE inventory_lots; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE public.inventory_lots IS 'Per-batch stock for expiry-tracked items. Created on purchase; qty_on_hand reduced on sale (FEFO) in a later phase.';


--
-- Name: COLUMN inventory_lots.lot_number; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.inventory_lots.lot_number IS 'Optional supplier batch / lot number from purchase.';


--
-- Name: COLUMN inventory_lots.expiry_date; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.inventory_lots.expiry_date IS 'Product expiry date for this batch.';


--
-- Name: COLUMN inventory_lots.mfg_date; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.inventory_lots.mfg_date IS 'Optional manufacturing date; expiry may be derived from shelf life in a later phase.';


--
-- Name: COLUMN inventory_lots.status_code; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.inventory_lots.status_code IS 'active = has stock; depleted = qty 0; expired = past expiry; written_off = manual disposal.';


--
-- Name: inventory_lots_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.inventory_lots ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.inventory_lots_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: inventory_movements; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.inventory_movements (
    id integer NOT NULL,
    item_id integer NOT NULL,
    store_id integer,
    branch_id integer DEFAULT 1 NOT NULL,
    movement_type character varying(255) NOT NULL,
    reference_type character varying(255) DEFAULT 'manual'::character varying,
    reference_id integer,
    quantity numeric(12,6) NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    lot_id integer
);


--
-- Name: COLUMN inventory_movements.lot_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.inventory_movements.lot_id IS 'Optional link to inventory_lots when movement is lot-specific (sale/purchase return/wastage).';


--
-- Name: inventory_movements_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.inventory_movements ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.inventory_movements_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: item_barcodes; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.item_barcodes (
    id integer NOT NULL,
    item_id integer NOT NULL,
    barcode character varying(100) NOT NULL,
    barcode_label character varying(100),
    is_active boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    scan_mode character varying(10) DEFAULT 'loose'::character varying NOT NULL
);


--
-- Name: item_barcodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.item_barcodes ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.item_barcodes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: item_line_discounts; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.item_line_discounts (
    id integer NOT NULL,
    item_id integer NOT NULL,
    discount_type character varying(255) NOT NULL,
    discount_value numeric(10,2) DEFAULT 0.00 NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    starts_at date,
    expires_at date,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


--
-- Name: item_line_discounts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.item_line_discounts ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.item_line_discounts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: item_modifier_group_assignments; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.item_modifier_group_assignments (
    id integer NOT NULL,
    item_id integer NOT NULL,
    modifier_group_id integer NOT NULL,
    is_required boolean DEFAULT false,
    sort_order integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: item_modifier_group_assignments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.item_modifier_group_assignments ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.item_modifier_group_assignments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: item_modifier_groups; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.item_modifier_groups (
    id integer NOT NULL,
    name character varying(100) NOT NULL,
    display_name character varying(100) NOT NULL,
    description text,
    is_required boolean DEFAULT false,
    is_multiple_choice boolean DEFAULT false,
    max_selections integer,
    min_selections integer DEFAULT 1,
    is_active boolean DEFAULT true,
    sort_order integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: item_modifier_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.item_modifier_groups ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.item_modifier_groups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: item_modifiers; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.item_modifiers (
    id integer NOT NULL,
    name character varying(100) NOT NULL,
    short_name character varying(50),
    price_adjustment numeric(10,2) DEFAULT 0.00,
    cost_adjustment numeric(10,2) DEFAULT 0.00,
    is_default boolean DEFAULT false,
    is_active boolean DEFAULT true,
    sort_order integer DEFAULT 0,
    prep_time_adjustment integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: item_modifiers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.item_modifiers ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.item_modifiers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: item_serial_transactions; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.item_serial_transactions (
    id bigint NOT NULL,
    serial_id bigint NOT NULL,
    item_id integer NOT NULL,
    trans_type character varying(3) NOT NULL,
    doc_type character varying(20) NOT NULL,
    doc_id bigint NOT NULL,
    header_id bigint,
    branch_id integer,
    user_id integer,
    remarks character varying(500),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


--
-- Name: item_serial_transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.item_serial_transactions ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.item_serial_transactions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: item_serials; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.item_serials (
    id bigint NOT NULL,
    item_id integer NOT NULL,
    serial_no character varying(191) NOT NULL,
    details text,
    cost_price numeric(10,2),
    selling_price numeric(10,2),
    warranty_name character varying(255),
    warranty_expiry date,
    status_code character varying(3) DEFAULT 'SIN'::character varying NOT NULL,
    branch_id integer,
    supplier_id integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


--
-- Name: item_serials_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.item_serials ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.item_serials_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.items (
    id integer NOT NULL,
    item_code character varying(50) NOT NULL,
    sku_number character varying(100) NOT NULL,
    name character varying(100) NOT NULL,
    description text,
    retail_price numeric(10,2) NOT NULL,
    wholesale_price numeric(10,2),
    cost_price numeric(10,2) NOT NULL,
    reorder_quantity integer DEFAULT 0,
    reorder_level integer DEFAULT 0,
    tax_type character varying(255) NOT NULL,
    tax_rate_id integer,
    category_id integer,
    sub_category_id integer,
    bulk_qty integer,
    bulk_price numeric(10,2),
    pkg_qty integer,
    uom_id integer NOT NULL,
    item_type character varying(255) DEFAULT 'loose'::character varying NOT NULL,
    product_image character varying(255),
    display_color character varying(50),
    item_role character varying(255) DEFAULT 'stock'::character varying NOT NULL,
    is_serialized boolean DEFAULT false NOT NULL,
    is_third_schedule boolean DEFAULT false NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    supplier_id integer,
    prep_time integer,
    fbr_uom character varying(100),
    fbr_sale_type character varying(150),
    is_scale_item boolean DEFAULT false NOT NULL,
    tracks_expiry boolean DEFAULT false NOT NULL
);


--
-- Name: COLUMN items.is_scale_item; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.items.is_scale_item IS 'When true, POS parses scale/variable-weight barcodes for this item.';


--
-- Name: COLUMN items.tracks_expiry; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN public.items.tracks_expiry IS 'When true, purchase must capture expiry (and optional lot/batch) and stock is tracked in inventory_lots.';


--
-- Name: items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: journal_entries; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.journal_entries (
    id integer NOT NULL,
    entry_number character varying(50) NOT NULL,
    entry_date date NOT NULL,
    period_id integer,
    transaction_date date NOT NULL,
    source_type character varying(255) NOT NULL,
    reference_id integer,
    description text,
    total_debit numeric(15,2) DEFAULT 0.00,
    total_credit numeric(15,2) DEFAULT 0.00,
    status character varying(255) DEFAULT 'draft'::character varying,
    store_id integer DEFAULT 1,
    branch_id integer DEFAULT 1 NOT NULL,
    user_id integer NOT NULL,
    posted_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    branch_code character varying(50) NOT NULL,
    source_entry_id integer NOT NULL
);


--
-- Name: journal_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.journal_entries ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.journal_entries_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: journal_entry_lines; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.journal_entry_lines (
    id integer NOT NULL,
    journal_entry_id integer NOT NULL,
    account_id integer NOT NULL,
    debit_amount numeric(15,2) DEFAULT 0.00,
    credit_amount numeric(15,2) DEFAULT 0.00,
    description text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    branch_code character varying(50) NOT NULL,
    source_line_id integer NOT NULL
);


--
-- Name: journal_entry_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.journal_entry_lines ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.journal_entry_lines_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: kds_activity_log; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.kds_activity_log (
    id integer NOT NULL,
    store_id integer,
    kds_order_id integer,
    kds_order_item_id integer,
    action character varying(50) NOT NULL,
    details text,
    description text,
    user_id integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: kds_activity_log_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.kds_activity_log ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.kds_activity_log_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: kds_cleanup_log; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.kds_cleanup_log (
    id integer NOT NULL,
    cleanup_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    retention_days integer DEFAULT 7,
    orders_deleted integer DEFAULT 0,
    order_items_deleted integer DEFAULT 0,
    activity_logs_deleted integer DEFAULT 0,
    total_records_deleted integer DEFAULT 0,
    execution_time_ms integer DEFAULT 0,
    status character varying(255) DEFAULT 'success'::character varying,
    message text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: kds_cleanup_log_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.kds_cleanup_log ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.kds_cleanup_log_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: kds_order_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.kds_order_items (
    id integer NOT NULL,
    store_id integer,
    kds_order_id integer NOT NULL,
    sale_item_id integer NOT NULL,
    hold_item_id integer,
    item_id integer NOT NULL,
    item_name character varying(100) NOT NULL,
    quantity numeric(12,3) NOT NULL,
    unit_price numeric(10,2) NOT NULL,
    total_price numeric(10,2) NOT NULL,
    item_status character varying(255) DEFAULT 'pending'::character varying NOT NULL,
    special_instructions text,
    preparation_notes text,
    prepared_at timestamp without time zone,
    served_at timestamp without time zone,
    prepared_by integer,
    served_by integer,
    sort_order integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    item_status_type character varying(255) DEFAULT 'original'::character varying,
    served_quantity numeric(12,3) DEFAULT 0.000,
    total_quantity numeric(12,3) DEFAULT 0.000
);


--
-- Name: kds_order_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.kds_order_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.kds_order_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: kds_orders; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.kds_orders (
    id integer NOT NULL,
    store_id integer,
    sale_id integer NOT NULL,
    hold_id integer,
    invoice_number character varying(50) NOT NULL,
    order_number character varying(50) NOT NULL,
    table_number character varying(20),
    customer_name character varying(100),
    order_type character varying(255) DEFAULT 'dine_in'::character varying NOT NULL,
    order_status character varying(255) DEFAULT 'pending'::character varying NOT NULL,
    priority character varying(255) DEFAULT 'normal'::character varying NOT NULL,
    estimated_time integer,
    notes text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    prepared_at timestamp without time zone,
    served_at timestamp without time zone,
    created_by integer,
    prepared_by integer,
    served_by integer,
    order_taker_id integer,
    order_sequence integer DEFAULT 1,
    parent_order_id integer
);


--
-- Name: kds_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.kds_orders ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.kds_orders_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: kds_settings; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.kds_settings (
    id integer NOT NULL,
    store_id integer,
    setting_key character varying(100) NOT NULL,
    setting_value text,
    description text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: kds_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.kds_settings ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.kds_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: kds_station_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.kds_station_items (
    id integer NOT NULL,
    store_id integer,
    station_id integer NOT NULL,
    item_id integer NOT NULL,
    preparation_time integer,
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: kds_station_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.kds_station_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.kds_station_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: kds_stations; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.kds_stations (
    id integer NOT NULL,
    store_id integer,
    name character varying(100) NOT NULL,
    description text,
    printer_id integer,
    enable_kot_print boolean DEFAULT true,
    color character varying(7) DEFAULT '#007bff'::character varying,
    is_active boolean DEFAULT true,
    sort_order integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    preparation_time integer DEFAULT 10
);


--
-- Name: kds_stations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.kds_stations ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.kds_stations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: kpra_config; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.kpra_config (
    id integer NOT NULL,
    is_enabled boolean DEFAULT false,
    key character varying(255),
    pos_id character varying(100),
    business_id character varying(50),
    api_url character varying(255) DEFAULT 'http://kpra.gov.pk/rims/integration/'::character varying,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: kpra_config_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.kpra_config ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.kpra_config_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: kpra_invoices; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.kpra_invoices (
    id integer NOT NULL,
    sale_id integer NOT NULL,
    kpra_invoice_number character varying(100) NOT NULL,
    qr_code_url text,
    qr_code_image text,
    response_status character varying(10),
    response_message text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: kpra_invoices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.kpra_invoices ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.kpra_invoices_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: kpra_logs; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.kpra_logs (
    id integer NOT NULL,
    sale_id integer,
    request_data text,
    response_data text,
    status_code character varying(10),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: kpra_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.kpra_logs ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.kpra_logs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: languages; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.languages (
    id integer NOT NULL,
    code character varying(5) NOT NULL,
    name character varying(50) NOT NULL,
    native_name character varying(50) NOT NULL,
    flag character varying(100),
    rtl boolean DEFAULT false,
    active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: languages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.languages ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.languages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: line_discount_rules; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.line_discount_rules (
    id integer NOT NULL,
    scope_type character varying(20) NOT NULL,
    scope_id integer NOT NULL,
    discount_type character varying(20) DEFAULT 'percent'::character varying NOT NULL,
    discount_value numeric(10,2) DEFAULT 0.00 NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    starts_at date,
    expires_at date,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    CONSTRAINT line_discount_rules_discount_type_check CHECK (((discount_type)::text = ANY (ARRAY[('percent'::character varying)::text, ('fixed'::character varying)::text]))),
    CONSTRAINT line_discount_rules_scope_type_check CHECK (((scope_type)::text = ANY (ARRAY[('category'::character varying)::text, ('sub_category'::character varying)::text])))
);


--
-- Name: TABLE line_discount_rules; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE public.line_discount_rules IS 'Default POS line discounts by product category or sub-category. Item-specific rules stay in item_line_discounts. Precedence: item > sub_category > category.';


--
-- Name: line_discount_rules_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.line_discount_rules ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.line_discount_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: modifier_group_assignments; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.modifier_group_assignments (
    id integer NOT NULL,
    modifier_id integer NOT NULL,
    modifier_group_id integer NOT NULL,
    is_required boolean DEFAULT false,
    sort_order integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: modifier_group_assignments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.modifier_group_assignments ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.modifier_group_assignments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: modifier_template_options; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.modifier_template_options (
    id integer NOT NULL,
    template_id integer NOT NULL,
    name character varying(100) NOT NULL,
    price_adjustment numeric(10,2) DEFAULT 0.00,
    is_active boolean DEFAULT true,
    sort_order integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: modifier_template_options_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.modifier_template_options ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.modifier_template_options_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: modifier_templates; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.modifier_templates (
    id integer NOT NULL,
    name character varying(100) NOT NULL,
    icon character varying(50) DEFAULT 'layers'::character varying,
    is_active boolean DEFAULT true,
    sort_order integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: modifier_templates_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.modifier_templates ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.modifier_templates_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: order_takers; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.order_takers (
    id integer NOT NULL,
    assigned_store_id integer,
    name character varying(100) NOT NULL,
    employee_id character varying(50),
    phone character varying(20),
    email character varying(100),
    commission_rate numeric(5,2) DEFAULT 0.00,
    password character varying(255) NOT NULL,
    user_id integer,
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: order_takers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.order_takers ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.order_takers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: payment_method_tax_rates; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.payment_method_tax_rates (
    id integer NOT NULL,
    payment_method character varying(50) NOT NULL,
    tax_rate numeric(5,2) DEFAULT 0.00 NOT NULL,
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: payment_method_tax_rates_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.payment_method_tax_rates ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.payment_method_tax_rates_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: payment_methods; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.payment_methods (
    id integer NOT NULL,
    method_name character varying(50) NOT NULL,
    display_name character varying(100),
    icon_class character varying(50),
    color_class character varying(50),
    is_active boolean DEFAULT true,
    requires_bank_account boolean DEFAULT false,
    sort_order integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: payment_methods_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.payment_methods ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.payment_methods_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: price_history; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.price_history (
    id integer NOT NULL,
    item_id integer NOT NULL,
    item_name character varying(100) NOT NULL,
    vendor_id integer,
    old_cost_price numeric(10,2),
    new_cost_price numeric(10,2),
    old_retail_price numeric(10,2),
    new_retail_price numeric(10,2),
    changed_by character varying(100),
    changed_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: price_history_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.price_history ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.price_history_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: print_devices; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.print_devices (
    id integer NOT NULL,
    name character varying(100) NOT NULL,
    connection_type character varying(255) NOT NULL,
    print_type character varying(255) DEFAULT 'all'::character varying,
    terminal_id integer,
    printer_name character varying(100),
    printer_type character varying(255) DEFAULT 'thermal'::character varying,
    print_mode character varying(255) DEFAULT 'auto'::character varying,
    copies integer DEFAULT 1 NOT NULL,
    ip_address character varying(100),
    is_active boolean DEFAULT true,
    is_default boolean DEFAULT false,
    auto_detect boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: print_devices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.print_devices ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.print_devices_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: production_cost_lines; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.production_cost_lines (
    id integer NOT NULL,
    production_item_id integer NOT NULL,
    cost_type character varying(255) DEFAULT 'other'::character varying NOT NULL,
    description character varying(255),
    quantity numeric(12,4),
    unit_rate numeric(12,4),
    amount numeric(12,2) DEFAULT 0.00 NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: production_cost_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.production_cost_lines ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.production_cost_lines_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: production_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.production_items (
    id integer NOT NULL,
    production_order_id integer NOT NULL,
    material_store_id integer,
    finish_store_id integer,
    item_id integer NOT NULL,
    quantity numeric(10,2) NOT NULL,
    unit_cost numeric(10,2) DEFAULT 0.00,
    total_cost numeric(10,2) DEFAULT 0.00,
    status character varying(255) DEFAULT 'pending'::character varying NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: production_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.production_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.production_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: production_materials; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.production_materials (
    id integer NOT NULL,
    production_item_id integer NOT NULL,
    material_item_id integer NOT NULL,
    quantity_consumed numeric(10,2) NOT NULL,
    unit_cost numeric(10,2) DEFAULT 0.00,
    total_cost numeric(10,2) DEFAULT 0.00,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: production_materials_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.production_materials ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.production_materials_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: production_orders; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.production_orders (
    id integer NOT NULL,
    order_number character varying(50) NOT NULL,
    production_date date NOT NULL,
    status character varying(255) DEFAULT 'pending'::character varying NOT NULL,
    remarks text,
    total_cost numeric(10,2) DEFAULT 0.00,
    created_by integer NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: production_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.production_orders ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.production_orders_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: purchase_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.purchase_items (
    id integer NOT NULL,
    store_id integer,
    purchase_id integer NOT NULL,
    item_id integer NOT NULL,
    item_name character varying(100) NOT NULL,
    quantity numeric(12,3) NOT NULL,
    unit_cost numeric(10,2) NOT NULL,
    total_cost numeric(10,2) NOT NULL,
    tax_rate numeric(5,2) DEFAULT 0.00
);


--
-- Name: purchase_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.purchase_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.purchase_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: purchase_order_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.purchase_order_items (
    id integer NOT NULL,
    purchase_order_id integer NOT NULL,
    item_id integer NOT NULL,
    item_name character varying(100) NOT NULL,
    quantity numeric(12,3) NOT NULL,
    quantity_loose numeric(12,3) DEFAULT 0.000 NOT NULL,
    unit_cost numeric(10,2) NOT NULL,
    retail_price numeric(10,2) DEFAULT 0.00 NOT NULL,
    total_cost numeric(10,2) NOT NULL,
    tax_rate numeric(5,2) DEFAULT 0.00,
    purchase_mode character varying(10) DEFAULT 'loose'::character varying NOT NULL,
    bulk_base_qty numeric(12,3) DEFAULT 0.000 NOT NULL
);


--
-- Name: purchase_order_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.purchase_order_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.purchase_order_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: purchase_orders; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.purchase_orders (
    id integer NOT NULL,
    po_number character varying(50) NOT NULL,
    vendor_id integer NOT NULL,
    store_id integer,
    branch_id integer DEFAULT 1 NOT NULL,
    po_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    total_amount numeric(10,2) DEFAULT 0.00 NOT NULL,
    tax_amount numeric(10,2) DEFAULT 0.00 NOT NULL,
    discount_amount numeric(10,2) DEFAULT 0.00 NOT NULL,
    net_amount numeric(10,2) DEFAULT 0.00 NOT NULL,
    notes text,
    status character varying(20) DEFAULT 'pending'::character varying NOT NULL,
    converted_purchase_id integer,
    converted_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: purchase_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.purchase_orders ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.purchase_orders_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: purchase_return_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.purchase_return_items (
    id integer NOT NULL,
    purchase_return_id integer NOT NULL,
    item_id integer NOT NULL,
    quantity numeric(12,3) NOT NULL,
    unit_cost numeric(10,2) NOT NULL,
    total_cost numeric(10,2) NOT NULL,
    tax_rate numeric(5,2) DEFAULT 0.00
);


--
-- Name: purchase_return_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.purchase_return_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.purchase_return_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: purchase_returns; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.purchase_returns (
    id integer NOT NULL,
    store_id integer,
    purchase_id integer,
    vendor_id integer NOT NULL,
    return_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    total_amount numeric(10,2) NOT NULL,
    remarks character varying(255),
    customer_remarks character varying(255),
    created_by integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: purchase_returns_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.purchase_returns ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.purchase_returns_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: purchases; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.purchases (
    id integer NOT NULL,
    store_id integer,
    branch_id integer DEFAULT 1 NOT NULL,
    purchase_number character varying(50) NOT NULL,
    vendor_id integer NOT NULL,
    purchase_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    total_amount numeric(10,2) NOT NULL,
    tax_amount numeric(10,2) DEFAULT 0.00,
    discount_amount numeric(10,2) DEFAULT 0.00,
    net_amount numeric(10,2) NOT NULL,
    payment_method character varying(255) DEFAULT 'cash'::character varying,
    status character varying(20) DEFAULT 'pending'::character varying,
    source_po_id integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    advance_tax_rate numeric(5,2) DEFAULT 0.00 NOT NULL,
    advance_tax_amount numeric(10,2) DEFAULT 0.00 NOT NULL
);


--
-- Name: purchases_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.purchases ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.purchases_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: quotation_drafts; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.quotation_drafts (
    id integer NOT NULL,
    user_id integer NOT NULL,
    store_id integer NOT NULL,
    payload text NOT NULL,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: quotation_drafts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.quotation_drafts ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.quotation_drafts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: quotation_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.quotation_items (
    id integer NOT NULL,
    quotation_id integer NOT NULL,
    item_id integer NOT NULL,
    item_name character varying(100) NOT NULL,
    quantity numeric(12,3) NOT NULL,
    unit_price numeric(10,2) NOT NULL,
    total_price numeric(10,2) NOT NULL,
    tax_rate numeric(5,2) DEFAULT 0.00,
    line_discount_percent numeric(5,2) DEFAULT 0.00 NOT NULL,
    remarks text
);


--
-- Name: quotation_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.quotation_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.quotation_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: quotations; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.quotations (
    id integer NOT NULL,
    store_id integer,
    quotation_number character varying(50) NOT NULL,
    customer_id integer,
    customer_name character varying(100),
    quotation_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    subtotal numeric(10,2) DEFAULT 0.00 NOT NULL,
    tax_amount numeric(10,2) DEFAULT 0.00,
    discount_amount numeric(10,2) DEFAULT 0.00,
    net_amount numeric(10,2) DEFAULT 0.00 NOT NULL,
    status character varying(255) DEFAULT 'draft'::character varying,
    remarks text,
    created_by integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: quotations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.quotations ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.quotations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: rights; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.rights (
    id integer NOT NULL,
    name character varying(100) NOT NULL,
    description text,
    category character varying(100)
);


--
-- Name: rights_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.rights ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.rights_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: role_rights; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.role_rights (
    role_id integer NOT NULL,
    right_id integer NOT NULL
);


--
-- Name: roles; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.roles (
    id integer NOT NULL,
    name character varying(100) NOT NULL
);


--
-- Name: roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.roles ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.roles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sale_item_modifiers; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sale_item_modifiers (
    id integer NOT NULL,
    sale_item_id integer NOT NULL,
    modifier_id integer NOT NULL,
    modifier_group_id integer NOT NULL,
    modifier_name character varying(100) NOT NULL,
    price_adjustment numeric(10,2) DEFAULT 0.00,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: sale_item_modifiers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sale_item_modifiers ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.sale_item_modifiers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sale_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sale_items (
    id integer NOT NULL,
    store_id integer,
    sale_id integer NOT NULL,
    item_id integer NOT NULL,
    item_name character varying(100) NOT NULL,
    quantity numeric(12,3) NOT NULL,
    unit_price numeric(10,2) NOT NULL,
    original_unit_price numeric(10,2),
    total_price numeric(10,2) NOT NULL,
    discount_type character varying(255) DEFAULT 'none'::character varying NOT NULL,
    discount_value numeric(10,2) DEFAULT 0.00 NOT NULL,
    discount_per_unit numeric(10,2) DEFAULT 0.00 NOT NULL,
    discount_amount numeric(10,2) DEFAULT 0.00 NOT NULL,
    tax_rate numeric(5,2) DEFAULT 0.00,
    remarks text,
    is_deal boolean DEFAULT false,
    deal_selections text
);


--
-- Name: sale_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sale_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.sale_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sale_return_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sale_return_items (
    id integer NOT NULL,
    sale_return_id integer NOT NULL,
    item_id integer NOT NULL,
    quantity numeric(12,3) NOT NULL,
    unit_price numeric(10,2) NOT NULL,
    total_price numeric(10,2) NOT NULL,
    tax_rate numeric(5,2) DEFAULT 0.00
);


--
-- Name: sale_return_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sale_return_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.sale_return_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sale_returns; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sale_returns (
    id integer NOT NULL,
    store_id integer,
    sale_id integer,
    return_source character varying(20) DEFAULT 'invoice'::character varying NOT NULL,
    customer_id integer NOT NULL,
    return_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    total_amount numeric(10,2) NOT NULL,
    remarks character varying(255),
    customer_remarks character varying(255),
    payment_method character varying(255) DEFAULT 'cash'::character varying,
    bank_account_id integer,
    created_by integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    shift_id integer
);


--
-- Name: sale_returns_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sale_returns ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.sale_returns_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sales; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sales (
    id integer NOT NULL,
    terminal_id integer,
    store_id integer,
    branch_id integer DEFAULT 1 NOT NULL,
    invoice_number character varying(50) NOT NULL,
    sale_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    customer_name character varying(100),
    customer_id integer,
    total_amount numeric(10,2) NOT NULL,
    tax_amount numeric(10,2) DEFAULT 0.00,
    discount_amount numeric(10,2) DEFAULT 0.00,
    withholding_amount numeric(10,2) DEFAULT 0.00,
    discount_id integer,
    net_amount numeric(10,2) NOT NULL,
    payment_method character varying(50) DEFAULT 'cash'::character varying,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    shift_id integer,
    is_fbr_enabled boolean DEFAULT false,
    is_kpra_enabled boolean DEFAULT false,
    zatca_phase2_invoice_id bigint,
    table_id integer,
    order_mode character varying(50),
    discount_type character varying(255),
    discount_value numeric(10,2) DEFAULT 0.00,
    service_charges numeric(10,2) DEFAULT 0.00,
    tip_amount numeric(10,2) DEFAULT 0.00,
    order_taker_id integer,
    number_of_guests integer,
    void_id integer,
    is_fbr_digital_enabled boolean DEFAULT false
);


--
-- Name: sales_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sales ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.sales_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: setting_categories; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.setting_categories (
    id integer NOT NULL,
    name character varying(100) NOT NULL,
    code character varying(50) NOT NULL
);


--
-- Name: setting_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.setting_categories ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.setting_categories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: setting_options; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.setting_options (
    id integer NOT NULL,
    setting_id integer NOT NULL,
    option_label character varying(100),
    option_value character varying(100)
);


--
-- Name: setting_options_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.setting_options ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.setting_options_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: settings; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.settings (
    id integer NOT NULL,
    store_id integer,
    category_id integer NOT NULL,
    name character varying(100) NOT NULL,
    code character varying(100) NOT NULL,
    type character varying(255),
    value text,
    default_value text,
    description text,
    is_active boolean DEFAULT true
);


--
-- Name: settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.settings ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: shift_logs; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.shift_logs (
    id integer NOT NULL,
    store_id integer,
    shift_id integer NOT NULL,
    action_type character varying(255) NOT NULL,
    amount numeric(10,2) DEFAULT 0.00,
    note text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: shift_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.shift_logs ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.shift_logs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: shifts; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.shifts (
    id integer NOT NULL,
    store_id integer,
    branch_id integer DEFAULT 1 NOT NULL,
    user_id integer NOT NULL,
    start_time timestamp without time zone NOT NULL,
    end_time timestamp without time zone,
    opening_cash numeric(10,2) DEFAULT 0.00,
    closing_cash numeric(10,2) DEFAULT 0.00,
    expected_cash numeric(10,2) DEFAULT 0.00,
    actual_cash numeric(10,2) DEFAULT 0.00,
    discrepancy numeric(10,2) DEFAULT 0.00,
    status character varying(255) DEFAULT 'open'::character varying,
    open_journal_entry_id integer,
    close_journal_entry_id integer
);


--
-- Name: shifts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.shifts ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.shifts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: site_installation; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.site_installation (
    id integer NOT NULL,
    installation_role character varying(20) DEFAULT 'branch_server'::character varying NOT NULL,
    license_key character varying(100),
    machine_id character varying(255),
    last_verified_at timestamp without time zone,
    license_cache text,
    license_type character varying(20),
    setup_completed_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    CONSTRAINT site_installation_role_chk CHECK (((installation_role)::text = ANY (ARRAY[('branch_server'::character varying)::text, ('cloud_hub'::character varying)::text])))
);


--
-- Name: site_installation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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


--
-- Name: site_installation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.site_installation_id_seq OWNED BY public.site_installation.id;


--
-- Name: stock_adjustment_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.stock_adjustment_items (
    id integer NOT NULL,
    adjustment_id integer NOT NULL,
    item_id integer NOT NULL,
    item_name character varying(100) NOT NULL,
    current_quantity numeric(12,6) NOT NULL,
    adjustment_quantity numeric(12,6) NOT NULL,
    new_quantity numeric(12,6) NOT NULL,
    cost_price numeric(10,2) NOT NULL,
    current_stock_value numeric(12,2) NOT NULL,
    adjustment_value numeric(12,2) NOT NULL,
    new_stock_value numeric(12,2) NOT NULL
);


--
-- Name: stock_adjustment_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.stock_adjustment_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.stock_adjustment_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: stock_adjustments; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.stock_adjustments (
    id integer NOT NULL,
    adjustment_number character varying(50) NOT NULL,
    store_id integer NOT NULL,
    adjustment_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    total_items integer DEFAULT 0,
    total_adjustment_value numeric(12,2) DEFAULT 0.00,
    total_current_stock_value numeric(12,2) DEFAULT 0.00,
    total_new_stock_value numeric(12,2) DEFAULT 0.00,
    remarks text,
    created_by integer NOT NULL,
    journal_entry_id integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: stock_adjustments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.stock_adjustments ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.stock_adjustments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: stock_transfer_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.stock_transfer_items (
    id integer NOT NULL,
    to_store_id integer,
    from_store_id integer,
    transfer_id integer NOT NULL,
    item_id integer NOT NULL,
    item_name character varying(100) NOT NULL,
    quantity numeric(12,6) NOT NULL,
    cost_price numeric(10,2),
    remarks text
);


--
-- Name: stock_transfer_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.stock_transfer_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.stock_transfer_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: stock_transfers; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.stock_transfers (
    id integer NOT NULL,
    transfer_number character varying(50) NOT NULL,
    from_store_id integer NOT NULL,
    to_store_id integer NOT NULL,
    transfer_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    status character varying(255) DEFAULT 'pending'::character varying,
    total_items integer DEFAULT 0,
    total_quantity numeric(12,6) DEFAULT 0.000000,
    notes text,
    requested_by integer,
    approved_by integer,
    received_by integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: stock_transfers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.stock_transfers ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.stock_transfers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: store_inventory; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.store_inventory (
    id integer NOT NULL,
    store_id integer NOT NULL,
    item_id integer NOT NULL,
    quantity numeric(12,6) DEFAULT 0.000000,
    last_updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: store_inventory_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.store_inventory ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.store_inventory_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: stores; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.stores (
    id integer NOT NULL,
    branch_id integer DEFAULT 1 NOT NULL,
    store_name character varying(100) NOT NULL,
    store_code character varying(20) NOT NULL,
    address text,
    phone character varying(20),
    email character varying(100),
    manager_name character varying(100),
    is_active boolean DEFAULT true,
    is_default boolean DEFAULT false,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: stores_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.stores ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.stores_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sub_categories; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sub_categories (
    id integer NOT NULL,
    category_id integer NOT NULL,
    name character varying(100) NOT NULL,
    display_color character varying(50),
    is_active boolean DEFAULT true NOT NULL
);


--
-- Name: sub_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sub_categories ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.sub_categories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: subscription_plans; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.subscription_plans (
    id integer NOT NULL,
    store_id integer,
    name character varying(100) NOT NULL,
    billing_interval character varying(255) NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: subscription_plans_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.subscription_plans ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.subscription_plans_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sup_outstanding; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sup_outstanding (
    id integer NOT NULL,
    purchase_id integer,
    vendor_id integer NOT NULL,
    amount numeric(10,2) NOT NULL,
    status character varying(255) DEFAULT 'unpaid'::character varying,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: sup_outstanding_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sup_outstanding ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.sup_outstanding_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sup_payments; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sup_payments (
    id integer NOT NULL,
    store_id integer,
    vendor_id integer NOT NULL,
    purchase_id integer,
    balance_entry_id integer,
    amount_paid numeric(10,2) NOT NULL,
    discount_amount numeric(10,2) DEFAULT 0.00,
    withholding_rate numeric(5,2) DEFAULT 0.00,
    withholding_amount numeric(10,2) DEFAULT 0.00,
    gross_settlement_amount numeric(10,2) DEFAULT 0.00,
    net_cash_paid numeric(10,2) DEFAULT 0.00,
    payment_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    remarks character varying(255)
);


--
-- Name: sup_payments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sup_payments ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.sup_payments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: supplier_balance_entries; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.supplier_balance_entries (
    id integer NOT NULL,
    entry_number character varying(30) NOT NULL,
    vendor_id integer NOT NULL,
    store_id integer DEFAULT 1,
    entry_type character varying(255) DEFAULT 'payable'::character varying NOT NULL,
    amount numeric(12,2) NOT NULL,
    remaining_amount numeric(12,2) NOT NULL,
    reference_no character varying(50),
    remarks character varying(255),
    map_account_id integer,
    journal_entry_id integer,
    status character varying(255) DEFAULT 'posted'::character varying NOT NULL,
    created_by integer NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: supplier_balance_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.supplier_balance_entries ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.supplier_balance_entries_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sync_conflicts; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sync_conflicts (
    id bigint NOT NULL,
    table_name character varying(100) NOT NULL,
    pk_value text NOT NULL,
    direction character varying(20) NOT NULL,
    branch_code character varying(50),
    conflict_type character varying(50) NOT NULL,
    local_snapshot jsonb,
    remote_snapshot jsonb,
    detected_at timestamp with time zone DEFAULT now() NOT NULL,
    resolved boolean DEFAULT false NOT NULL,
    resolved_by character varying(100),
    resolved_at timestamp with time zone,
    resolution_note text
);


--
-- Name: sync_conflicts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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


--
-- Name: sync_conflicts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.sync_conflicts_id_seq OWNED BY public.sync_conflicts.id;


--
-- Name: sync_dead_letter; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sync_dead_letter (
    id bigint NOT NULL,
    job_table_id bigint,
    table_name character varying(100) NOT NULL,
    direction character varying(20) NOT NULL,
    pk_value text,
    payload jsonb,
    error_message text NOT NULL,
    error_code character varying(100),
    first_seen_at timestamp with time zone DEFAULT now() NOT NULL,
    last_seen_at timestamp with time zone DEFAULT now() NOT NULL,
    attempt_count integer DEFAULT 1 NOT NULL,
    status character varying(20) DEFAULT 'pending'::character varying NOT NULL
);


--
-- Name: sync_dead_letter_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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


--
-- Name: sync_dead_letter_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.sync_dead_letter_id_seq OWNED BY public.sync_dead_letter.id;


--
-- Name: sync_entity_policies; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sync_entity_policies (
    entity_name character varying(100) NOT NULL,
    direction_policy character varying(20) NOT NULL,
    source_of_truth character varying(20) NOT NULL,
    conflict_strategy character varying(50) DEFAULT 'upsert_on_unique'::character varying NOT NULL,
    delete_strategy character varying(50) DEFAULT 'none'::character varying NOT NULL,
    notes text,
    is_active boolean DEFAULT true NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    CONSTRAINT sync_entity_policies_direction_policy_check CHECK (((direction_policy)::text = ANY ((ARRAY['push_only'::character varying, 'pull_only'::character varying, 'bi_directional'::character varying, 'disabled'::character varying])::text[]))),
    CONSTRAINT sync_entity_policies_source_of_truth_check CHECK (((source_of_truth)::text = ANY ((ARRAY['branch'::character varying, 'cloud'::character varying, 'mixed'::character varying, 'none'::character varying])::text[])))
);


--
-- Name: sync_job_tables; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sync_job_tables (
    id bigint NOT NULL,
    job_id bigint NOT NULL,
    table_name character varying(100) NOT NULL,
    direction character varying(20) NOT NULL,
    started_at timestamp with time zone DEFAULT now() NOT NULL,
    finished_at timestamp with time zone,
    rows_read bigint DEFAULT 0,
    rows_upserted bigint DEFAULT 0,
    rows_skipped bigint DEFAULT 0,
    rows_failed bigint DEFAULT 0,
    status character varying(20) DEFAULT 'running'::character varying NOT NULL,
    last_error text
);


--
-- Name: sync_job_tables_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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


--
-- Name: sync_job_tables_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.sync_job_tables_id_seq OWNED BY public.sync_job_tables.id;


--
-- Name: sync_jobs; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sync_jobs (
    id bigint NOT NULL,
    started_at timestamp with time zone DEFAULT now() NOT NULL,
    finished_at timestamp with time zone,
    direction character varying(20) NOT NULL,
    mode_label character varying(255),
    branch_code character varying(50),
    status character varying(20) DEFAULT 'running'::character varying NOT NULL,
    error_summary text
);


--
-- Name: sync_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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


--
-- Name: sync_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.sync_jobs_id_seq OWNED BY public.sync_jobs.id;


--
-- Name: sync_settings; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sync_settings (
    id integer NOT NULL,
    sync_allow boolean DEFAULT false,
    db_prefix character varying(50),
    sync_mode character varying(255) DEFAULT 'HO'::character varying,
    server_name character varying(100),
    database_name character varying(100),
    username character varying(100),
    password character varying(255),
    last_sync_date timestamp without time zone,
    sync_status character varying(255) DEFAULT 'pending'::character varying,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    is_cloud_hub boolean DEFAULT false
);


--
-- Name: sync_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sync_settings ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.sync_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sync_table_checkpoints; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sync_table_checkpoints (
    id bigint NOT NULL,
    table_name character varying(100) NOT NULL,
    direction character varying(20) NOT NULL,
    branch_code character varying(50),
    last_sync_at timestamp with time zone,
    last_sync_id bigint,
    extra_cursor jsonb,
    updated_at timestamp with time zone DEFAULT now() NOT NULL
);


--
-- Name: sync_table_checkpoints_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

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


--
-- Name: sync_table_checkpoints_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.sync_table_checkpoints_id_seq OWNED BY public.sync_table_checkpoints.id;


--
-- Name: table_transfer_logs; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.table_transfer_logs (
    id integer NOT NULL,
    source_table_id integer,
    target_table_id integer,
    hold_order_id integer,
    transferred_by integer,
    transfer_type character varying(255) DEFAULT 'transfer'::character varying NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: table_transfer_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.table_transfer_logs ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.table_transfer_logs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: tax_rates; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.tax_rates (
    id integer NOT NULL,
    name character varying(100) NOT NULL,
    rate numeric(5,2) NOT NULL
);


--
-- Name: tax_rates_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.tax_rates ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.tax_rates_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: terminals; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.terminals (
    id integer NOT NULL,
    terminal_name character varying(100) NOT NULL,
    computer_name character varying(100),
    ip_address character varying(50),
    terminal_type character varying(50) DEFAULT 'POS'::character varying,
    branch_id integer,
    store_id integer,
    description text,
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone
);


--
-- Name: terminals_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.terminals ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.terminals_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: translations; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.translations (
    id integer NOT NULL,
    language_code character varying(5) NOT NULL,
    key character varying(255) NOT NULL,
    value text NOT NULL,
    context character varying(100),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: translations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.translations ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.translations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: uom_groups; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.uom_groups (
    id integer NOT NULL,
    code character varying(10) NOT NULL,
    name character varying(50) NOT NULL
);


--
-- Name: uom_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.uom_groups ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.uom_groups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: uoms; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.uoms (
    id integer NOT NULL,
    name character varying(50) NOT NULL,
    symbol character varying(10) NOT NULL,
    group_id integer NOT NULL,
    base_quantity numeric(10,4) DEFAULT 1.0000,
    is_base boolean DEFAULT false
);


--
-- Name: uoms_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.uoms ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.uoms_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: user_language_preferences; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.user_language_preferences (
    id integer NOT NULL,
    user_id integer NOT NULL,
    language_code character varying(5) NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: user_language_preferences_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.user_language_preferences ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.user_language_preferences_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: users; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.users (
    id integer NOT NULL,
    assigned_store_id integer,
    default_branch_id integer DEFAULT 1 NOT NULL,
    username character varying(100) NOT NULL,
    email character varying(100),
    password character varying(255),
    role_id integer,
    is_active boolean DEFAULT true,
    last_login timestamp without time zone,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    pin character varying(10),
    profile_picture character varying(255),
    pin_required_for_void boolean DEFAULT true,
    pin_login_enabled boolean DEFAULT false NOT NULL,
    cash_access boolean DEFAULT true NOT NULL
);


--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.users ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: vendors; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.vendors (
    id integer NOT NULL,
    primary_store_id integer,
    name character varying(100) NOT NULL,
    contact_number character varying(20),
    email character varying(100),
    address text,
    is_active boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    payable_account_id integer
);


--
-- Name: vendors_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.vendors ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.vendors_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: video_help; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.video_help (
    id integer NOT NULL,
    page_name character varying(100) NOT NULL,
    page_title character varying(255) NOT NULL,
    video_url text NOT NULL,
    video_title character varying(255) NOT NULL,
    description text,
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: video_help_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.video_help ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.video_help_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: void_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.void_items (
    id integer NOT NULL,
    source_type character varying(255) NOT NULL,
    source_id integer NOT NULL,
    hold_item_id integer,
    sale_item_id integer,
    item_id integer NOT NULL,
    item_name character varying(255) NOT NULL,
    quantity numeric(12,3) NOT NULL,
    unit_price numeric(10,2) NOT NULL,
    tax_rate numeric(6,2),
    modifiers jsonb,
    remarks character varying(500),
    void_reason_id integer NOT NULL,
    voided_by integer NOT NULL,
    voided_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


--
-- Name: void_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.void_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.void_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: void_orders; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.void_orders (
    id integer NOT NULL,
    store_id integer,
    sale_id integer NOT NULL,
    void_reason_id integer NOT NULL,
    voided_by integer NOT NULL,
    voided_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    notes text,
    original_amount numeric(10,2)
);


--
-- Name: void_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.void_orders ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.void_orders_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: void_reasons; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.void_reasons (
    id integer NOT NULL,
    reason_name character varying(100) NOT NULL,
    description text,
    is_active boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: void_reasons_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.void_reasons ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.void_reasons_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: warranties; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.warranties (
    id integer NOT NULL,
    name character varying(100) NOT NULL,
    months integer DEFAULT 0 NOT NULL,
    days integer DEFAULT 0 NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


--
-- Name: warranties_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.warranties ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.warranties_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: wastage; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.wastage (
    id integer NOT NULL,
    wastage_number character varying(50) NOT NULL,
    store_id integer NOT NULL,
    branch_id integer DEFAULT 1 NOT NULL,
    wastage_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    total_items integer DEFAULT 0,
    total_wastage_value numeric(12,2) DEFAULT 0.00,
    remarks text,
    created_by integer NOT NULL,
    journal_entry_id integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: wastage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.wastage ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.wastage_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: wastage_items; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.wastage_items (
    id integer NOT NULL,
    wastage_id integer NOT NULL,
    item_id integer NOT NULL,
    item_name character varying(255) NOT NULL,
    quantity numeric(12,6) NOT NULL,
    cost_price numeric(12,4) DEFAULT 0.0000 NOT NULL,
    line_value numeric(12,2) NOT NULL,
    loss_reason character varying(100)
);


--
-- Name: wastage_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.wastage_items ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.wastage_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: zatca_config; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.zatca_config (
    id integer NOT NULL,
    is_enabled boolean DEFAULT false,
    invoice_format character varying(255) DEFAULT 'pdf'::character varying,
    qr_code_size integer DEFAULT 150,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: zatca_config_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.zatca_config ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.zatca_config_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: zatca_invoices; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.zatca_invoices (
    id integer NOT NULL,
    sale_id integer NOT NULL,
    invoice_number character varying(100) NOT NULL,
    invoice_type character varying(255) DEFAULT 'simplified'::character varying,
    invoice_date timestamp without time zone NOT NULL,
    seller_vat character varying(50),
    buyer_vat character varying(50),
    buyer_name character varying(255),
    total_amount numeric(10,2) NOT NULL,
    tax_amount numeric(10,2) NOT NULL,
    amount_excluding_tax numeric(10,2) NOT NULL,
    qr_code_data text,
    qr_code_image_url text,
    invoice_data text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: zatca_invoices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.zatca_invoices ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.zatca_invoices_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: zatca_phase2_api_logs; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.zatca_phase2_api_logs (
    id bigint NOT NULL,
    zatca_phase2_invoice_id bigint,
    endpoint character varying(255) NOT NULL,
    http_method character varying(10) DEFAULT 'POST'::character varying NOT NULL,
    request_headers text,
    request_body text,
    response_status integer,
    response_headers text,
    response_body text,
    duration_ms integer,
    correlation_id character varying(255),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: zatca_phase2_api_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.zatca_phase2_api_logs ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.zatca_phase2_api_logs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: zatca_phase2_certificates; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.zatca_phase2_certificates (
    id bigint NOT NULL,
    store_id integer,
    environment character varying(255) DEFAULT 'sandbox'::character varying NOT NULL,
    device_identifier character varying(150),
    certificate_type character varying(255) DEFAULT 'compliance_csid'::character varying NOT NULL,
    certificate_serial character varying(255),
    issuer_dn text,
    subject_dn text,
    valid_from timestamp without time zone,
    valid_to timestamp without time zone,
    csr_pem text,
    certificate_pem text,
    private_key_ref character varying(255),
    fingerprint_sha256 character varying(128),
    is_active boolean DEFAULT false NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: zatca_phase2_certificates_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.zatca_phase2_certificates ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.zatca_phase2_certificates_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: zatca_phase2_device_state; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.zatca_phase2_device_state (
    id bigint NOT NULL,
    store_id integer NOT NULL,
    terminal_id integer,
    device_identifier character varying(150) NOT NULL,
    last_icv bigint DEFAULT 0 NOT NULL,
    last_invoice_uuid character(36),
    last_invoice_hash character varying(512),
    last_submission_at timestamp without time zone,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: zatca_phase2_device_state_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.zatca_phase2_device_state ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.zatca_phase2_device_state_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: zatca_phase2_invoices; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.zatca_phase2_invoices (
    id bigint NOT NULL,
    sale_id integer NOT NULL,
    invoice_number character varying(100) NOT NULL,
    invoice_type character varying(255) DEFAULT 'simplified'::character varying NOT NULL,
    uuid character(36) NOT NULL,
    icv bigint,
    previous_invoice_hash character varying(512),
    invoice_hash character varying(512),
    unsigned_xml text,
    signed_xml text,
    canonical_xml_hash character varying(512),
    qr_tlv_base64 text,
    authority_submission_type character varying(255),
    authority_invoice_ref character varying(255),
    authority_status character varying(50),
    authority_response_code character varying(50),
    authority_response_message text,
    status character varying(255) DEFAULT 'draft'::character varying NOT NULL,
    retry_count integer DEFAULT 0 NOT NULL,
    next_retry_at timestamp without time zone,
    last_error_at timestamp without time zone,
    last_error_message text,
    submitted_at timestamp without time zone,
    cleared_at timestamp without time zone,
    reported_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: zatca_phase2_invoices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.zatca_phase2_invoices ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.zatca_phase2_invoices_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: zatca_phase2_jobs; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.zatca_phase2_jobs (
    id bigint NOT NULL,
    zatca_phase2_invoice_id bigint NOT NULL,
    job_type character varying(255) NOT NULL,
    status character varying(255) DEFAULT 'pending'::character varying NOT NULL,
    attempt_count integer DEFAULT 0 NOT NULL,
    max_attempts integer DEFAULT 8 NOT NULL,
    run_after timestamp without time zone,
    locked_at timestamp without time zone,
    locked_by character varying(100),
    last_error text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: zatca_phase2_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.zatca_phase2_jobs ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.zatca_phase2_jobs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: zatca_phase2_status_history; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.zatca_phase2_status_history (
    id bigint NOT NULL,
    zatca_phase2_invoice_id bigint NOT NULL,
    from_status character varying(50),
    to_status character varying(50) NOT NULL,
    event_source character varying(255) DEFAULT 'system'::character varying NOT NULL,
    reason_code character varying(100),
    reason_message text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: zatca_phase2_status_history_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.zatca_phase2_status_history ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.zatca_phase2_status_history_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: site_installation id; Type: DEFAULT; Schema: public; Owner: -
--

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


--
-- Name: sync_conflicts id; Type: DEFAULT; Schema: public; Owner: -
--

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


--
-- Name: sync_dead_letter id; Type: DEFAULT; Schema: public; Owner: -
--

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


--
-- Name: sync_job_tables id; Type: DEFAULT; Schema: public; Owner: -
--

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


--
-- Name: sync_jobs id; Type: DEFAULT; Schema: public; Owner: -
--

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


--
-- Name: sync_table_checkpoints id; Type: DEFAULT; Schema: public; Owner: -
--

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


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

COPY public.account_mappings (id, mapping_code, mapping_name, account_id, description, is_active, created_at, updated_at) FROM stdin;
13	ast_TaxRecoverable	Tax Recoverable	26	Input tax recoverable	t	2025-11-05 22:16:22	2025-11-05 22:16:22
14	ast_Equipment	Equipment	28	Kitchen equipment, POS systems	t	2025-11-05 22:16:22	2025-11-05 22:16:22
15	ast_Furniture	Furniture and Fixtures	29	Tables, chairs, decor	t	2025-11-05 22:16:22	2025-11-05 22:16:22
16	ast_Vehicles	Vehicles	30	Delivery vehicles	t	2025-11-05 22:16:22	2025-11-05 22:16:22
17	ast_Buildings	Buildings	31	Restaurant premises	t	2025-11-05 22:16:22	2025-11-05 22:16:22
18	ast_AccumulatedDepreciation	Accumulated Depreciation	32	Accumulated depreciation	t	2025-11-05 22:16:22	2025-11-05 22:16:22
19	lib_Supplier	Accounts Payable	34	Money owed to suppliers	t	2025-11-05 22:16:22	2025-11-05 22:16:22
20	lib_Accrued	Accrued Expenses	35	Accrued wages, utilities	t	2025-11-05 22:16:22	2025-11-05 22:16:22
21	lib_Tax	Taxes Payable	36	Sales tax, income tax	t	2025-11-05 22:16:22	2025-11-05 22:16:22
22	lib_Unearned	Unearned Revenue	37	Advance payments received	t	2025-11-05 22:16:22	2025-11-05 22:16:22
23	eqt_Investment	Owner's Investment	38	Initial and additional investments	t	2025-11-05 22:16:22	2025-11-05 22:16:22
24	eqt_RetainedEarnings	Retained Earnings	39	Accumulated profits/losses	t	2025-11-05 22:16:22	2025-11-05 22:16:22
25	eqt_CurrentYear	Current Year Earnings	40	Current year profit/loss	t	2025-11-05 22:16:22	2025-11-05 22:16:22
26	exp_Expenses	Operating Expenses	7	All operating expenses	t	2025-11-05 22:16:22	2025-11-05 22:16:22
27	exp_Payroll	Payroll Expenses	8	Wages and salaries	t	2025-11-05 22:16:22	2025-11-05 22:16:22
1	rev_Sale	Sales Revenue	1	Primary sales income	t	2025-11-05 22:16:22	2025-11-05 22:16:22
2	rev_Service	Service Income	2	Service-related income	t	2025-11-05 22:16:22	2025-11-05 22:16:22
3	rev_Discount	Sales Discount	3	Sales discounts given	t	2025-11-05 22:16:22	2025-11-05 22:16:22
4	rev_Return	Sales Return	4	Sales returns and refunds	t	2025-11-05 22:16:22	2025-11-05 22:16:22
5	rev_Other	Other Income	5	Miscellaneous income	t	2025-11-05 22:16:22	2025-11-05 22:16:22
6	exp_CostOfSales	Cost of Goods Sold	6	Direct cost of inventory sold	t	2025-11-05 22:16:22	2025-11-05 22:16:22
7	ast_Cash	Cash in Hand	20	Physical cash on hand	t	2025-11-05 22:16:22	2025-11-05 22:16:22
8	ast_Bank	Bank Accounts	21	All bank accounts	t	2025-11-05 22:16:22	2025-11-05 22:16:22
9	ast_PettyCash	Petty Cash	22	Petty cash fund	t	2025-11-05 22:16:22	2025-11-05 22:16:22
10	ast_Customer	Accounts Receivable	23	Money owed by customers	t	2025-11-05 22:16:22	2025-11-05 22:16:22
11	ast_Stock	Inventory	24	Stock and supplies	t	2025-11-05 22:16:22	2025-11-05 22:16:22
12	ast_Prepaid	Prepaid Expenses	25	Prepaid rent, insurance, etc.	t	2025-11-05 22:16:22	2025-11-05 22:16:22
28	exp_Rent	Rent Expense	9	Premises rent	t	2025-11-05 22:16:22	2025-11-05 22:16:22
29	exp_Utilities	Utilities	10	Electricity, water, gas	t	2025-11-05 22:16:22	2025-11-05 22:16:22
30	exp_Marketing	Marketing	11	Advertising and promotion	t	2025-11-05 22:16:22	2025-11-05 22:16:22
31	exp_Supplies	Supplies	12	Operating supplies	t	2025-11-05 22:16:22	2025-11-05 22:16:22
32	exp_Maintenance	Maintenance	13	Equipment maintenance	t	2025-11-05 22:16:22	2025-11-05 22:16:22
33	exp_Insurance	Insurance	14	Business insurance	t	2025-11-05 22:16:22	2025-11-05 22:16:22
34	exp_ProfessionalFees	Professional Fees	15	Legal, accounting fees	t	2025-11-05 22:16:22	2025-11-05 22:16:22
35	exp_BankCharges	Bank Charges	16	Bank fees and charges	t	2025-11-05 22:16:22	2025-11-05 22:16:22
36	exp_Depreciation	Depreciation	17	Asset depreciation	t	2025-11-05 22:16:22	2025-11-05 22:16:22
37	exp_StockLoss	Stock Loss	41	Account for tracking inventory losses and stock adjustments	t	2025-11-05 22:16:23	2025-11-05 22:16:23
38	rev_StockGain	Stock Gain	45	Revenue from inventory count increases / stock adjustments	t	2026-04-03 18:59:27	2026-04-03 18:59:27
39	ast_CardUnsettled	Card Unsettled Receipts	46	Card receipts awaiting settlement	t	2026-04-24 17:33:50	2026-04-24 17:33:50
40	rev_CashSale	Cash Sales	48	Revenue credited for cash POS sales	t	2026-06-20 22:31:44.535898	2026-06-20 22:31:44.535898
41	rev_CardSale	Card Sales	49	Default revenue credited for card/QR POS sales	t	2026-06-20 22:31:44.5422	2026-06-20 22:31:44.5422
42	ast_AdvanceTax	Advance Income Tax	50	Advance income tax withheld on supplier purchases	t	2026-06-20 22:31:44.569326	2026-06-20 22:31:44.569326
43	ast_POSCash	Cash in Register (POS)	51	POS drawer / till cash during shift	t	2026-06-30 23:49:36.513756	2026-06-30 23:49:36.513756
44	exp_CashOverShort	Cash Over / Short	43	Shift close cash shortage (debit) or overage (credit)	t	2026-06-30 23:49:36.513756	2026-06-30 23:49:36.513756
45	exp_BankAdjustments	Bank Adjustments	52	Bank balance reconciliation adjustments	t	2026-07-05 23:23:29.269163	2026-07-05 23:23:29.269163
\.


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

COPY public.account_transactions (id, store_id, branch_id, sale_id, account_type, account_id, cheque_id, card_type_id, card_last_four, card_transaction_ref, is_reconciled, amount, tip_amount, description, created_at) FROM stdin;
1	1	1	1	cash	\N	\N	\N	\N	\N	f	1200.00	0.00	Cash payment for invoice INV-001739	2026-06-27 16:18:39.265818
2	1	1	2	cash	\N	\N	\N	\N	\N	f	600.00	0.00	Cash payment for invoice INV-001741	2026-06-27 16:20:48.701629
3	1	1	2	cash	\N	\N	\N	\N	\N	f	-600.00	0.00	Cash refund for sale return #1 (Sale #2)	2026-06-27 16:48:30.011887
4	1	1	6	cash	\N	\N	\N	\N	\N	f	600.00	0.00	Cash payment for invoice INV-001755	2026-06-27 17:33:15.078443
5	1	1	7	card	\N	\N	1	\N	\N	t	600.00	0.00	Card payment for invoice INV-001757	2026-06-27 17:33:40.862228
6	1	1	\N	bank	1	\N	\N	\N	\N	f	588.00	0.00	Card reconciliation bank revenue - CR20260627173653	2026-06-27 17:36:53.74188
7	1	1	\N	card	\N	\N	\N	\N	\N	t	-600.00	0.00	Card settlement cleared - CR20260627173653	2026-06-27 17:36:53.74188
8	1	1	8	card	\N	\N	1	\N	\N	t	3000.00	0.00	Card payment for invoice INV-001760	2026-06-27 17:44:24.936127
9	1	1	\N	bank	1	\N	\N	\N	\N	f	2940.00	0.00	Card reconciliation bank revenue - CR20260627174652	2026-06-27 17:46:52.332192
10	1	1	\N	card	\N	\N	\N	\N	\N	t	-3000.00	0.00	Card settlement cleared - CR20260627174652	2026-06-27 17:46:52.332192
11	1	1	9	card	\N	\N	1	\N	\N	f	600.00	0.00	Card payment for invoice INV-001762	2026-06-27 17:51:58.526334
12	1	1	\N	cash	\N	\N	\N	\N	\N	f	-400.00	0.00	Cash refund for quick sale return #2	2026-06-27 20:38:19.579734
13	1	1	\N	cash	\N	\N	\N	\N	\N	f	-400.00	0.00	Cash refund for quick sale return #3	2026-06-27 20:50:35.206325
14	1	1	\N	cash	\N	\N	\N	\N	\N	f	-500.00	0.00	Cash refund for quick sale return #4	2026-06-27 21:05:01.198191
15	1	1	8	cash	\N	\N	\N	\N	\N	f	-3000.00	0.00	Cash refund for sale return #5 (Sale #8)	2026-06-27 21:05:39.674218
16	1	1	10	bank	1	\N	\N	\N	\N	f	500.00	0.00	Bank payment for invoice INV-001849	2026-06-27 23:23:56.098112
17	1	1	11	cash	\N	\N	\N	\N	\N	f	2500.00	0.00	Cash payment for invoice INV-001854	2026-06-27 23:26:21.288787
18	1	1	12	cash	\N	\N	\N	\N	\N	f	5000.00	0.00	Cash payment for invoice INV-001859	2026-06-27 23:29:33.539785
19	1	1	13	card	\N	\N	1	\N	\N	f	500.00	0.00	Card payment for invoice INV-001865	2026-06-27 23:35:52.040946
20	1	1	14	cash	\N	\N	\N	\N	\N	f	600.00	0.00	Cash payment for invoice INV-001868	2026-06-27 23:38:11.365771
21	1	1	15	card	\N	\N	1	\N	\N	f	4648.00	0.00	Card payment for invoice INV-001883	2026-06-27 23:47:23.88103
22	1	1	17	cash	\N	\N	\N	\N	\N	f	9398.00	0.00	Cash payment for invoice INV-001893	2026-06-27 23:59:26.180175
23	1	1	18	cash	\N	\N	\N	\N	\N	f	1550.00	0.00	Cash payment for invoice INV-001899	2026-06-28 15:38:12.189924
24	1	1	19	cash	\N	\N	\N	\N	\N	f	1500.00	0.00	Cash payment for invoice INV-001910	2026-06-28 15:38:49.195687
25	1	1	21	cash	\N	\N	\N	\N	\N	f	174.00	0.00	Cash payment for invoice INV-001921	2026-06-28 15:49:57.707477
26	1	1	22	cash	\N	\N	\N	\N	\N	f	174.00	0.00	Cash payment for invoice INV-001922	2026-06-28 15:52:59.983254
27	1	1	23	card	\N	\N	1	\N	\N	f	2500.00	0.00	Card payment for invoice INV-001917	2026-06-28 15:55:58.057683
28	1	1	24	cash	\N	\N	\N	\N	\N	f	156.60	0.00	Cash payment for invoice INV-001929	2026-06-28 16:00:59.64607
29	1	1	25	cash	\N	\N	\N	\N	\N	f	500.00	0.00	Cash payment for invoice INV-002011	2026-06-28 20:34:34.66646
30	1	1	26	cash	\N	\N	\N	\N	\N	f	174.00	0.00	Cash payment for invoice INV-002018	2026-06-28 20:40:47.496242
31	1	1	27	cash	\N	\N	\N	\N	\N	f	174.00	0.00	Cash payment for invoice INV-002014	2026-06-28 20:41:00.600289
32	1	1	28	cash	\N	\N	\N	\N	\N	f	6590.00	0.00	Cash payment for invoice INV-002118	2026-06-29 00:28:32.267826
33	1	1	29	cash	\N	\N	\N	\N	\N	f	500.00	0.00	Cash payment for invoice INV-002155	2026-06-29 20:56:18.074322
34	1	1	30	cash	\N	\N	\N	\N	\N	f	5026.00	0.00	Cash payment for invoice INV-002157	2026-06-29 20:56:43.109778
35	1	1	31	cash	\N	\N	\N	\N	\N	f	500.00	0.00	Cash payment for invoice INV-002161	2026-06-29 20:58:04.986546
36	1	1	32	cash	\N	\N	\N	\N	\N	f	500.00	0.00	Cash payment for invoice INV-002153	2026-06-29 20:59:55.697068
37	1	1	33	cash	\N	\N	\N	\N	\N	f	1000.00	0.00	Cash payment for invoice INV-002113	2026-06-29 21:00:07.728721
38	1	1	34	cash	\N	\N	\N	\N	\N	f	500.00	0.00	Cash payment for invoice INV-002176	2026-06-29 21:11:20.16049
39	1	1	35	cash	\N	\N	\N	\N	\N	f	174.00	0.00	Cash payment for invoice INV-002180	2026-06-29 21:12:45.597111
40	1	1	36	cash	\N	\N	\N	\N	\N	f	174.00	0.00	Cash payment for invoice INV-002179	2026-06-29 21:35:53.115125
41	1	1	37	cash	\N	\N	\N	\N	\N	f	5260.00	0.00	Cash payment for invoice INV-002222	2026-06-29 23:10:25.677345
42	1	1	38	cash	\N	\N	\N	\N	\N	f	7200.00	0.00	Cash payment for invoice INV-002229	2026-06-29 23:22:10.80282
43	1	1	39	cash	\N	\N	\N	\N	\N	f	174.00	0.00	Cash payment for invoice INV-002236	2026-06-30 14:08:12.963299
45	1	1	41	cash	\N	\N	\N	\N	\N	f	696.00	0.00	Cash payment for invoice INV-002253	2026-06-30 17:54:29.388503
44	1	1	40	card	\N	\N	1	\N	\N	t	630.00	0.00	Card payment for invoice INV-002248	2026-06-30 17:35:55.212332
46	1	1	\N	bank	1	\N	\N	\N	\N	f	620.55	0.00	Card reconciliation bank revenue - CR20260630175525	2026-06-30 17:55:25.705433
47	1	1	\N	card	\N	\N	\N	\N	\N	t	-630.00	0.00	Card settlement cleared - CR20260630175525	2026-06-30 17:55:25.705433
48	\N	1	1	cash	\N	\N	\N	\N	\N	f	-500.00	0.00	Supplier payment for Vendor ID 1	2026-06-30 17:57:00.782894
49	1	1	42	cash	\N	\N	\N	\N	\N	f	3976.00	0.00	Cash payment for invoice INV-001931	2026-06-30 20:16:06.850872
50	1	1	43	cash	\N	\N	\N	\N	\N	f	600.00	0.00	Cash payment for invoice INV-002258	2026-06-30 20:17:11.523021
51	1	1	45	cash	\N	\N	\N	\N	\N	f	8250.00	0.00	Cash payment for invoice INV-002219	2026-06-30 23:45:07.303607
52	1	1	46	cash	\N	\N	\N	\N	\N	f	100.00	0.00	Cash payment for invoice INV-002172	2026-06-30 23:45:17.43258
53	1	1	47	cash	\N	\N	\N	\N	\N	f	5132.00	0.00	Cash payment for invoice INV-002195	2026-06-30 23:50:48.422004
54	1	1	48	cash	\N	\N	\N	\N	\N	f	500.00	0.00	Cash payment for invoice INV-002186	2026-06-30 23:51:24.899064
55	1	1	49	cash	\N	\N	\N	\N	\N	f	500.00	0.00	Cash payment for invoice INV-002183	2026-06-30 23:51:32.05904
56	1	1	50	cash	\N	\N	\N	\N	\N	f	500.00	0.00	Cash payment for invoice INV-001949	2026-06-30 23:51:40.639017
57	1	1	51	cash	\N	\N	\N	\N	\N	f	7726.00	0.00	Cash payment for invoice INV-001946	2026-06-30 23:53:23.952759
58	1	1	52	cash	\N	\N	\N	\N	\N	f	100.00	0.00	Cash payment for invoice INV-001943	2026-06-30 23:53:34.002636
59	1	1	53	cash	\N	\N	\N	\N	\N	f	6364.00	0.00	Cash payment for invoice INV-001945	2026-06-30 23:53:59.498923
60	1	1	\N	cash	\N	\N	\N	\N	\N	f	-83942.60	0.00	Shift #2 close — transfer to Cash in Hand - Clear POS drawer — shift #2 close (JE #70)	2026-06-30 00:00:00
61	1	1	\N	cash	\N	\N	\N	\N	\N	f	30000.00	0.00	Shift #2 close — transfer to Cash in Hand - Verified cash counted — shift #2 close (JE #70)	2026-06-30 00:00:00
62	1	1	55	cash	\N	\N	\N	\N	\N	f	500.00	0.00	Cash payment for invoice INV-002280	2026-06-30 23:55:56.886399
63	1	1	56	cash	\N	\N	\N	\N	\N	f	1200.00	0.00	Cash payment for invoice INV-002282	2026-06-30 23:57:06.492092
64	1	1	\N	cash	\N	\N	\N	\N	\N	f	-1700.00	0.00	Shift #3 close — transfer to Cash in Hand - Clear POS drawer — shift #3 close (JE #73)	2026-07-01 00:00:00
65	1	1	\N	cash	\N	\N	\N	\N	\N	f	1700.00	0.00	Shift #3 close — transfer to Cash in Hand - Verified cash counted — shift #3 close (JE #73)	2026-07-01 00:00:00
66	1	1	57	cash	\N	\N	\N	\N	\N	f	5450.00	0.00	Cash payment for invoice INV-002298	2026-07-01 00:30:55.094637
67	1	1	58	cash	\N	\N	\N	\N	\N	f	1100.00	0.00	Cash payment for invoice INV-002354	2026-07-01 07:18:16.242081
68	\N	1	1	purchase_return	2	\N	\N	\N	\N	f	100.00	0.00	Purchase return #1 - Amount: 100	2026-07-03 17:42:46.469898
69	\N	1	\N	bank	1	\N	\N	\N	\N	f	-3486.26	0.00	Supplier payment for Vendor ID 3	2026-07-03 18:14:39.092614
70	\N	1	\N	bank	1	\N	\N	\N	\N	f	-450.00	0.00	Supplier payment for Vendor ID 3	2026-07-03 18:22:49.275835
71	1	1	\N	bank	2	\N	\N	\N	\N	f	20000.00	0.00	Opening Balance (Date: 2026-07-03)	2026-07-03 00:00:00
72	\N	1	\N	cash	\N	\N	\N	\N	\N	f	-2500.00	0.00	Supplier payment for Vendor ID 3	2026-07-03 18:34:09.957315
73	\N	1	\N	bank	2	\N	\N	\N	\N	f	-2000.00	0.00	Supplier payment for Vendor ID 3	2026-07-03 18:44:14.953546
74	1	1	59	cash	\N	\N	\N	\N	\N	f	1550.00	0.00	Cash payment for invoice INV-002305	2026-07-03 18:46:36.150746
75	1	1	60	cash	\N	\N	\N	\N	\N	f	1800.00	0.00	Cash payment for invoice INV-002304	2026-07-04 15:34:34.728404
76	1	1	\N	cash	\N	\N	\N	\N	\N	f	-9900.00	0.00	Shift #4 close — transfer to Cash in Hand - Clear POS drawer — shift #4 close (JE #93)	2026-07-04 00:00:00
78	1	1	63	bank	2	\N	\N	\N	\N	f	4400.00	0.00	Bank payment for invoice INV-002395	2026-07-04 15:51:09.803316
77	1	1	62	card	\N	\N	1	\N	\N	t	1800.00	0.00	Card payment for invoice INV-002384	2026-07-04 15:47:12.057129
79	1	1	64	card	\N	\N	1	\N	\N	t	1150.00	0.00	Card payment for invoice INV-002400	2026-07-04 15:53:35.681333
80	1	1	\N	bank	1	\N	\N	\N	\N	f	2935.25	0.00	Card reconciliation bank revenue - CR20260704155458	2026-07-04 15:54:58.512526
81	1	1	\N	card	\N	\N	\N	\N	\N	t	-2950.00	0.00	Card settlement cleared - CR20260704155458	2026-07-04 15:54:58.512526
82	1	1	65	cash	\N	\N	\N	\N	\N	f	1150.00	0.00	Cash payment for invoice INV-002402	2026-07-04 16:07:19.620796
83	1	1	\N	bank	1	\N	\N	\N	\N	f	-200.00	0.00	Transfer OUT to Asnaff Bank - BT202607050001	2026-07-05 00:00:00
84	1	1	\N	bank	2	\N	\N	\N	\N	f	200.00	0.00	Transfer IN from test bank - BT202607050001	2026-07-05 00:00:00
85	1	1	\N	bank	2	\N	\N	\N	\N	f	200.00	0.00	Opening Balance (Date: 2026-07-05)	2026-07-05 00:00:00
86	1	1	\N	bank	2	\N	\N	\N	\N	f	-300.00	0.00	Bank Adjustment - test	2026-07-05 23:23:50.25261
87	1	1	66	cash	\N	\N	\N	\N	\N	f	674.00	0.00	Cash payment for invoice INV-002406	2026-07-06 16:28:54.012261
88	1	1	67	cash	\N	\N	\N	\N	\N	f	500.00	0.00	Cash payment for invoice INV-002435	2026-07-07 22:37:23.604273
89	1	1	\N	bank	1	\N	\N	\N	\N	f	-500.00	0.00	test (From: Bank Accounts)	2026-07-08 15:54:54.05254
90	1	1	68	cash	\N	\N	\N	\N	\N	f	650.00	0.00	Cash payment for invoice INV-002447	2026-07-08 21:06:06.092249
\.


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

COPY public.account_types (id, type_code, type_name, default_side, description, sort_order, created_at) FROM stdin;
1	AST	Assets	DR	All asset accounts	1	2025-11-05 22:16:22
2	LBT	Liabilities	CR	All liability accounts	2	2025-11-05 22:16:22
3	EQT	Equity	CR	All equity accounts	3	2025-11-05 22:16:22
4	REV	Revenue	CR	All revenue accounts	4	2025-11-05 22:16:22
5	EXP	Expenses	DR	All expense accounts	5	2025-11-05 22:16:22
\.


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

COPY public.bank_access (user_id, bank_account_id, created_at, created_by) FROM stdin;
\.


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

COPY public.bank_accounts (id, bank_name, account_title, chart_of_account_id, mapped_at, mapped_by, account_number, iban, branch_name, branch_code, swift_code, address, is_active, created_at) FROM stdin;
1	test bank	test bank	21	2026-06-27 17:36:36.08286	1	123						t	2026-06-27 17:36:36.08286
2	Asnaff Bank	Asnaff Bank	18	2026-07-03 18:28:37.025795	1	Asnaff Bank						t	2026-07-03 18:28:37.025795
\.


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

COPY public.bom_components (id, bom_id, component_item_id, quantity) FROM stdin;
1	1	9	0.400000
\.


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

COPY public.bom_master (id, item_id, description, created_at) FROM stdin;
1	17	\N	2026-06-28 15:52:38.469103
\.


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

COPY public.branch_access (user_id, branch_id, created_at, created_by) FROM stdin;
1	1	2026-07-09 19:41:13.199691	1
1	2	2026-07-09 19:41:13.199691	1
4	1	2026-06-02 18:23:52.854543	1
\.


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

COPY public.branch_info (id, default_store_id, branch_name, branch_code, branch_address, created_at, ntn, strn, branch_phone, facebook_url, instagram_url, youtube_url, province, is_active, branch_type, is_default) FROM stdin;
2	\N	Branch 2	br2		2026-07-09 19:09:31.113879				\N	\N	\N	Punjab	t	branch	f
1	1	Demo License	br1	Islamabad	2026-06-20 21:33:12.603353				\N	\N	\N	Punjab	t	branch	t
\.


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

COPY public.card_types (id, card_code, card_name, display_name, icon_class, color_class, default_charge_rate, sort_order, is_active, created_at, revenue_account_id) FROM stdin;
1	VISA	VISA	VISA Card	fab fa-cc-visa	btn-outline-primary	0.00	1	t	2025-11-05 22:16:38	49
2	MASTER	MasterCard	MasterCard	fab fa-cc-mastercard	btn-outline-warning	0.00	2	t	2025-11-05 22:16:38	49
3	QR	QR Code	QR Payment	fas fa-qrcode	btn-outline-success	0.00	3	t	2025-11-05 22:16:38	49
\.


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

COPY public.categories (id, name, icon, is_active) FROM stdin;
1	Desserts	assets/img/categories/food.png	t
2	Burgers	assets/img/categories/burger.png	t
3	Pizza	assets/img/categories/pizza.png	t
4	GSK	assets/img/categories/accessories.png	f
5	Getz	assets/img/categories/accessories.png	f
\.


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

COPY public.chart_of_accounts (id, account_code, account_name, account_type, account_category, parent_account_id, account_level, is_active, description, opening_balance, current_balance, store_id, created_at, updated_at) FROM stdin;
1	4000	Sales Revenue	revenue	revenue	\N	1	t	Primary sales income	0.00	43450.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
2	4001	Service Income	revenue	revenue	\N	1	t	Service-related income	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
3	4002	Sales Discount	revenue	revenue	\N	1	t	Sales discounts given	0.00	1005.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
4	4003	Sales Return	revenue	revenue	\N	1	t	Sales returns and refunds	0.00	-4900.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
29	2200	Furniture and Fixtures	asset	fixed_asset	\N	2	t	Tables, chairs, decor	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
30	2300	Vehicles	asset	fixed_asset	\N	2	t	Delivery vehicles	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
31	2400	Buildings	asset	fixed_asset	\N	2	t	Restaurant premises	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
32	2500	Accumulated Depreciation	asset	fixed_asset	\N	2	t	Accumulated depreciation	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
33	3000	Current Liabilities	liability	current_liability	\N	1	t	All current liabilities	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
34	3100	Accounts Payable	liability	current_liability	\N	2	t	Money owed to suppliers	0.00	39351.80	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
35	3200	Accrued Expenses	liability	current_liability	\N	2	t	Accrued wages, utilities	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
36	3300	Taxes Payable	liability	current_liability	\N	2	t	Sales tax, income tax	0.00	7471.78	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
37	3400	Unearned Revenue	liability	current_liability	\N	2	t	Advance payments received	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
38	4100	Owner's Investment	equity	equity	\N	2	t	Initial and additional investments	0.00	-500.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
39	4200	Retained Earnings	equity	equity	\N	2	t	Accumulated profits/losses	0.00	5200.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
40	4300	Current Year Earnings	equity	equity	\N	2	t	Current year profit/loss	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
41	6011	Stock Loss	expense	operating_expense	\N	2	t	Losses due to stock adjustments, damage, theft, or obsolescence	0.00	500.00	1	2025-11-05 22:16:23	2026-06-02 21:15:22.959671
42	6012	Sample Test Bank	asset	current_asset	\N	1	t		0.00	0.00	1	2026-03-29 16:17:23	2026-06-02 21:15:22.959671
43	7910	Cash Adjustments	expense	other_expense	\N	2	t	Adjustments made to reconcile cash balances	0.00	63842.60	1	2026-04-02 19:24:27	2026-06-02 21:15:22.959671
44	7911	Supplier Account Payable	liability	current_liability	\N	1	t		0.00	1000.00	1	2026-04-02 20:07:09	2026-06-02 21:15:22.959671
45	4005	Stock Gain	revenue	revenue	\N	1	t	Income from physical inventory increases (stock adjustments)	0.00	2500.00	1	2026-04-03 18:59:27	2026-06-02 21:15:22.959671
46	1104	Card Unsettled Receipts	asset	current_asset	19	3	t	Card payments pending settlement from bank/processor	0.00	8248.00	1	2026-04-24 17:33:50	2026-06-02 21:15:22.959671
48	4010	Cash Sales	revenue	revenue	1	2	t	Revenue from cash sales at POS	0.00	98194.00	1	2026-06-20 22:31:44.523561	2026-06-20 22:31:44.523561
49	4011	Card Sales	revenue	revenue	1	2	t	Revenue from card / QR sales at POS (default when card type has no mapping)	0.00	15200.00	1	2026-06-20 22:31:44.534785	2026-06-20 22:31:44.534785
50	1510	Advance Income Tax	asset	current_asset	\N	2	t	Advance / prepaid income tax on purchases (adjustable against income tax)	0.00	18.44	1	2026-06-20 22:31:44.567662	2026-06-20 22:31:44.567662
52	7900	Bank Adjustments	expense	other_expense	\N	2	t	Adjustments made to reconcile bank balances	0.00	300.00	1	2026-07-05 23:23:29.269163	2026-07-05 23:23:29.269163
5	4004	Other Income	revenue	revenue	\N	1	t	Miscellaneous income	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
6	5000	Cost of Goods Sold	expense	cost_of_sales	\N	1	t	Direct cost of inventory sold	0.00	46130.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
7	6000	Operating Expenses	expense	operating_expense	\N	1	t	All operating expenses	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
8	6001	Payroll Expenses	expense	operating_expense	\N	2	t	Wages and salaries	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
9	6002	Rent Expense	expense	operating_expense	\N	2	t	Premises rent	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
10	6003	Utilities	expense	operating_expense	\N	2	t	Electricity, water, gas	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
11	6004	Marketing	expense	operating_expense	\N	2	t	Advertising and promotion	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
12	6005	Supplies	expense	operating_expense	\N	2	t	Operating supplies	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
51	1105	Cash in Register (POS)	asset	current_asset	19	3	t	Cash in POS drawer during open shifts. Cash sales post here; shift close moves verified cash to Cash in Hand.	0.00	-60796.60	1	2026-06-30 23:49:36.513756	2026-06-30 23:49:36.513756
13	6006	Maintenance	expense	operating_expense	\N	2	t	Equipment maintenance	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
14	6007	Insurance	expense	operating_expense	\N	2	t	Business insurance	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
15	6008	Professional Fees	expense	operating_expense	\N	2	t	Legal, accounting fees	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
16	6009	Bank Charges	expense	operating_expense	\N	2	t	Bank fees and charges	0.00	96.20	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
17	6010	Depreciation	expense	operating_expense	\N	2	t	Asset depreciation	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
18	1000	Current Assets	asset	current_asset	\N	1	t	All current assets	0.00	24500.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
19	1100	Cash and Cash Equivalents	asset	current_asset	\N	2	t	Cash and bank accounts	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
20	1101	Cash in Hand	asset	current_asset	\N	3	t	Physical cash on hand	0.00	128464.60	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
21	1102	Bank Accounts	asset	current_asset	\N	3	t	All bank accounts	0.00	947.54	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
22	1103	Petty Cash	asset	current_asset	\N	3	t	Petty cash fund	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
23	1200	Accounts Receivable	asset	current_asset	\N	2	t	Money owed by customers	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
24	1300	Inventory	asset	current_asset	\N	2	t	Stock and supplies	0.00	-4460.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
25	1400	Prepaid Expenses	asset	current_asset	\N	2	t	Prepaid rent, insurance, etc.	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
26	1500	Tax Recoverable	asset	current_asset	\N	2	t	Input tax recoverable	0.00	181.80	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
27	2000	Fixed Assets	asset	fixed_asset	\N	1	t	All fixed assets	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
28	2100	Equipment	asset	fixed_asset	\N	2	t	Kitchen equipment, POS systems	0.00	0.00	1	2025-11-05 22:16:22	2026-06-02 21:15:22.959671
\.


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

COPY public.cheque_books (id, bank_account_id, branch_id, first_cheque_number, last_cheque_number, cheque_count, notes, created_by, created_at) FROM stdin;
\.


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

COPY public.cheques (id, cheque_book_id, bank_account_id, branch_id, cheque_number, status, amount, sale_id, payee_name, issue_date, cleared_date, bounced_date, memo, created_at, updated_at) FROM stdin;
\.


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

COPY public.cus_outstanding (id, sale_id, customer_id, amount, status, created_at) FROM stdin;
1	16	1	38544.00	unpaid	2026-06-27 23:52:35.854736
2	44	1	600.00	unpaid	2026-06-30 20:17:55.821982
\.


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

COPY public.cus_payments (id, store_id, customer_id, sale_id, balance_entry_id, amount_paid, payment_date, remarks) FROM stdin;
\.


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

COPY public.customer_balance_entries (id, entry_number, customer_id, store_id, entry_type, amount, remaining_amount, reference_no, remarks, map_account_id, journal_entry_id, status, created_by, created_at, updated_at) FROM stdin;
\.


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

COPY public.customer_categories (id, category_name, description, created_at) FROM stdin;
1	j		2026-06-27 23:51:48.982673
\.


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

COPY public.customer_subscription_invoices (id, subscription_id, sale_id, period_start, period_end, amount, created_at) FROM stdin;
\.


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

COPY public.customer_subscriptions (id, store_id, customer_id, item_id, subscription_plan_id, status, start_date, current_period_end, next_renewal_date, amount, auto_renew, notes, created_at, updated_at) FROM stdin;
\.


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

COPY public.customers (id, primary_store_id, name, phone, email, address, is_walk_in, ntn, province, active, discount_applied, discount_rate, withholding_rate, category_id, customer_type, created_at) FROM stdin;
1	\N	teset	030245548		test sdf ads	f	\N	Punjab	t	N	0.00	0.00	\N	retail	2026-06-27 16:57:52.313115
2	\N	Hadii Khan	00	harispc87@gmail.com		t			t	N	0.00	0.00	1	retail	2026-06-27 23:51:56.872969
3	\N	Muhammad Asnaff	03195354523	muhammadasnaffkhan@gmail.com	House 39 Street !7-b Burma Town Islamabad	f	\N	Punjab	t	N	0.00	0.00	\N	retail	2026-06-29 20:56:55.863125
4	\N	Delivery customer	0312958		Islamabad	f	\N	Punjab	t	N	0.00	0.00	\N	retail	2026-07-01 07:17:48.736587
\.


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

COPY public.deal_items (id, deal_id, selection_type, category_id, sub_category_id, item_id, sort_order, created_at, min_selection, max_selection) FROM stdin;
10	1	item	\N	\N	17	0	2026-06-29 22:57:45.136966	1	1
11	1	subcategory	\N	9	\N	1	2026-06-29 22:57:45.136966	1	1
12	1	subcategory	\N	8	\N	2	2026-06-29 22:57:45.136966	1	1
\.


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

COPY public.deals (id, item_id, deal_name, deal_price, is_active, created_at, updated_at) FROM stdin;
1	23	Deal 1	2050.00	t	2026-06-29 22:53:33.962856	2026-06-29 22:53:33.962856
\.


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

COPY public.delivery_orders (id, store_id, sale_id, customer_id, rider_id, delivery_status, delivery_address, delivery_time, created_at) FROM stdin;
1	\N	31	3	1	pending	House 39 Street !7-b Burma Town Islamabad	2026-06-29 21:57:00	2026-06-29 20:58:04.986546
2	\N	58	4	1	pending	Islamabad	2026-07-01 08:17:00	2026-07-01 07:18:16.242081
\.


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

COPY public.delivery_riders (id, assigned_store_id, name, phone, email, vehicle_number, is_active, created_at) FROM stdin;
1	\N	Muhammad Asnaff	03195354523	muhammadasnaffkhan@gmail.com		t	2026-06-29 20:57:24.05958
\.


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

COPY public.dinein_floors (id, store_id, name, description, is_active, background_image, layout_canvas_width, layout_canvas_height) FROM stdin;
2	\N	Floor 2		t	\N	1200	800
4	\N	Roof Top		t	\N	1200	800
3	\N	Ground Fllor		t	assets/img/dinein/floors/floor_1782670115_a94d422b.jpg	1200	800
1	\N	Floor1		t	\N	1200	800
\.


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

COPY public.dinein_tables (id, store_id, floor_id, table_name, seats, status, is_active, table_shape, layout_x, layout_y, layout_w, layout_h, layout_rotation, is_layout_placed, color) FROM stdin;
12	\N	4	501	4	available	t	square	59.052	10.002	17.271	30.388	0	t	#b2388c
13	\N	4	502	4	available	t	square	16.781	43.279	17.271	30.388	0	t	#23cd9a
8	\N	3	G1	4	available	t	square	54.783	50.145	19.122	31.823	0	t	#3b82f6
9	\N	3	G2	4	available	t	square	21.747	50.051	19.122	31.823	0	t	#3bf73e
10	\N	3	g3	4	available	t	square	21.790	14.118	18.914	30.285	0	t	#f7b23b
11	\N	3	g4	4	available	t	square	54.735	14.376	18.914	30.285	0	t	#f73b86
2	\N	1	2	4	available	t	square	57.514	7.073	18.791	33.555	0	t	#3b82f6
3	\N	1	3	4	available	t	square	14.714	53.364	18.791	33.555	0	t	#3b82f6
1	\N	1	f1	4	available	t	square	57.718	55.749	18.791	33.555	0	t	#3b82f6
7	\N	1	f7	4	available	t	square	37.154	28.243	16.447	29.692	0	t	#86f73b
6	\N	2	103	4	available	t	round	53.083	20.435	29.615	40.000	0	t	#3b82f6
15	\N	1	121	4	available	t	round	\N	\N	8.000	8.000	0	f	#d6d8dc
5	\N	2	101	4	available	t	round	14.104	20.790	29.615	40.000	0	t	#3bf7a6
4	\N	1	5	4	occupied	t	square	14.042	7.149	18.791	33.555	0	t	#3b82f6
14	\N	4	503	4	occupied	t	round	37.063	24.932	17.271	30.388	0	t	#d83bf7
\.


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

COPY public.discount_categories (id, category_name, display_order, is_active, created_at, updated_at) FROM stdin;
\.


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

COPY public.discounts (id, discount_name, discount_code, discount_type, discount_rate, discount_cap, category_id, is_active, created_at, updated_at) FROM stdin;
\.


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

COPY public.expense_accounts (id, category_id, subcategory_id, name, chart_of_account_id, mapped_at, mapped_by) FROM stdin;
\.


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

COPY public.expense_categories (id, name) FROM stdin;
\.


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

COPY public.expense_subcategories (id, category_id, name, created_at, updated_at) FROM stdin;
\.


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

COPY public.expenses (id, store_id, branch_id, shift_id, expense_payment_group_id, account_id, remarks, amount, expense_date, payment_method, bank_account_id, journal_entry_id, status, approved_by, approved_at, reversal_date, reversal_reason, reversal_journal_id, rejection_reason, created_at, updated_at) FROM stdin;
\.


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

COPY public.fbr_config (id, is_enabled, display_name, api_url, pos_id, usin) FROM stdin;
\.


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

COPY public.fbr_digital (id, is_enabled, api_url, token, mode, created_at, updated_at, validate_api_url, sandbox_token, production_token, post_api_url_sandbox, post_api_url_production, validate_api_url_sandbox, validate_api_url_production, business_activity, business_sector, eligible_scenario_ids, block_sale_on_failure) FROM stdin;
\.


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

COPY public.fbr_digital_invoices (id, sale_id, fbr_invoice_number, qr_code, scenario_id, response_status, created_at) FROM stdin;
\.


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

COPY public.fbr_digital_logs (id, sale_id, scenario_id, endpoint, request_data, response_data, http_status, created_at) FROM stdin;
\.


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

COPY public.fbr_digital_scenarios (id, scenario_id, status, request_data, response_data, fbr_invoice_number, error_message, tested_at, created_at, updated_at) FROM stdin;
\.


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

COPY public.fbr_invoices (id, sale_id, fbr_invoice_number, qr_code, created_at) FROM stdin;
\.


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

COPY public.fbr_logs (id, sale_id, response, created_at) FROM stdin;
\.


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

COPY public.fiscal_period_setup (start_year, start_month, start_day, month_count, open_year) FROM stdin;
2025	7	1	12	2025
2026	7	1	12	2026
\.


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

COPY public.fiscal_periods (id, period_code, period_name, period_year, start_date, end_date, is_closed, period_status, closed_by, closed_at, created_at, updated_at) FROM stdin;
1	202507	2025 July	2025	2025-07-01	2025-07-31	t	Closed	\N	2026-07-01 00:00:54.290333	2026-06-26 20:10:11.033839	2026-06-26 20:10:11.033839
2	202508	2025 August	2025	2025-08-01	2025-08-31	t	Closed	\N	2026-07-01 00:00:54.300912	2026-06-26 20:10:11.037301	2026-06-26 20:10:11.037301
3	202509	2025 September	2025	2025-09-01	2025-09-30	t	Closed	\N	2026-07-01 00:00:54.303345	2026-06-26 20:10:11.043472	2026-06-26 20:10:11.043472
4	202510	2025 October	2025	2025-10-01	2025-10-31	t	Closed	\N	2026-07-01 00:00:54.305843	2026-06-26 20:10:11.050744	2026-06-26 20:10:11.050744
5	202511	2025 November	2025	2025-11-01	2025-11-30	t	Closed	\N	2026-07-01 00:00:54.30765	2026-06-26 20:10:11.05684	2026-06-26 20:10:11.05684
6	202512	2025 December	2025	2025-12-01	2025-12-31	t	Closed	\N	2026-07-01 00:00:54.310774	2026-06-26 20:10:11.057717	2026-06-26 20:10:11.057717
7	202601	2026 January	2025	2026-01-01	2026-01-31	t	Closed	\N	2026-07-01 00:00:54.313219	2026-06-26 20:10:11.058414	2026-06-26 20:10:11.058414
8	202602	2026 February	2025	2026-02-01	2026-02-28	t	Closed	\N	2026-07-01 00:00:54.315544	2026-06-26 20:10:11.059055	2026-06-26 20:10:11.059055
9	202603	2026 March	2025	2026-03-01	2026-03-31	t	Closed	\N	2026-07-01 00:00:54.317731	2026-06-26 20:10:11.059815	2026-06-26 20:10:11.059815
10	202604	2026 April	2025	2026-04-01	2026-04-30	t	Closed	\N	2026-07-01 00:00:54.31993	2026-06-26 20:10:11.060367	2026-06-26 20:10:11.060367
11	202605	2026 May	2025	2026-05-01	2026-05-31	t	Closed	\N	2026-07-01 00:00:54.322058	2026-06-26 20:10:11.060932	2026-06-26 20:10:11.060932
12	202606	2026 June	2025	2026-06-01	2026-06-30	t	Closed	\N	2026-07-01 00:00:54.323651	2026-06-26 20:10:11.061402	2026-06-26 20:10:11.061402
13	202607	2026 July	2026	2026-07-01	2026-07-31	f	Current	\N	\N	2026-07-01 00:01:02.355006	2026-07-01 00:01:02.355006
14	202608	2026 August	2026	2026-08-01	2026-08-31	f	Open	\N	\N	2026-07-01 00:01:02.355796	2026-07-01 00:01:02.355796
15	202609	2026 September	2026	2026-09-01	2026-09-30	f	Open	\N	\N	2026-07-01 00:01:02.356313	2026-07-01 00:01:02.356313
16	202610	2026 October	2026	2026-10-01	2026-10-31	f	Open	\N	\N	2026-07-01 00:01:02.356828	2026-07-01 00:01:02.356828
17	202611	2026 November	2026	2026-11-01	2026-11-30	f	Open	\N	\N	2026-07-01 00:01:02.357289	2026-07-01 00:01:02.357289
18	202612	2026 December	2026	2026-12-01	2026-12-31	f	Open	\N	\N	2026-07-01 00:01:02.357824	2026-07-01 00:01:02.357824
19	202701	2027 January	2026	2027-01-01	2027-01-31	f	Open	\N	\N	2026-07-01 00:01:02.35839	2026-07-01 00:01:02.35839
20	202702	2027 February	2026	2027-02-01	2027-02-28	f	Open	\N	\N	2026-07-01 00:01:02.358881	2026-07-01 00:01:02.358881
21	202703	2027 March	2026	2027-03-01	2027-03-31	f	Open	\N	\N	2026-07-01 00:01:02.359204	2026-07-01 00:01:02.359204
22	202704	2027 April	2026	2027-04-01	2027-04-30	f	Open	\N	\N	2026-07-01 00:01:02.359564	2026-07-01 00:01:02.359564
23	202705	2027 May	2026	2027-05-01	2027-05-31	f	Open	\N	\N	2026-07-01 00:01:02.359856	2026-07-01 00:01:02.359856
24	202706	2027 June	2026	2027-06-01	2027-06-30	f	Open	\N	\N	2026-07-01 00:01:02.360184	2026-07-01 00:01:02.360184
\.


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

COPY public.hold_items (id, store_id, hold_id, item_id, item_name, quantity, unit_price, original_unit_price, discount_type, discount_value, discount_per_unit, discount_amount, tax_rate, modifiers, remarks, void_status, template_id, is_deal, deal_selections, serial_ids) FROM stdin;
16	1	6	17	test item	1.000	150.00	150.00	none	0.00	0.00	0.00	18.00	[]		void	\N	f	\N	\N
18	1	8	7	test 3	1.000	600.00	600.00	none	0.00	0.00	0.00	0.00	[]		void	\N	f	\N	\N
19	1	8	12	bulk item	2.000	550.00	550.00	none	0.00	0.00	0.00	18.00	[]		void	\N	f	\N	\N
20	1	8	2	stock item	1.000	500.00	500.00	none	0.00	0.00	0.00	0.00	[]		void	\N	f	\N	\N
21	1	8	10	test 6	1.000	500.00	600.00	fixed	100.00	100.00	100.00	0.00	[]		void	\N	f	\N	\N
127	1	39	18	Crispy Chicken Burgers	1.000	500.00	500.00	none	0.00	0.00	0.00	0.00	[]		void	\N	f	\N	\N
140	1	44	20	Zinger Burger	1.000	700.00	700.00	none	0.00	0.00	0.00	0.00	[]		active	\N	f	\N	\N
141	1	45	1	Test Scale Items	1.000	400.00	400.00	none	0.00	0.00	0.00	0.00	[]		active	\N	f	\N	\N
142	1	45	2	stock item	1.000	500.00	500.00	none	0.00	0.00	0.00	0.00	[]		active	\N	f	\N	\N
143	1	45	3	stock item 3	1.000	600.00	600.00	none	0.00	0.00	0.00	0.00	[]		active	\N	f	\N	\N
144	1	45	25	Test Esajee  Tax	1.000	600.00	600.00	none	0.00	0.00	0.00	18.00	[]		active	\N	f	\N	\N
145	1	46	19	Classic Burger	2.000	600.00	600.00	none	0.00	0.00	0.00	0.00	[]		active	\N	f	\N	\N
146	1	46	20	Zinger Burger	2.000	700.00	700.00	none	0.00	0.00	0.00	0.00	[]		active	\N	f	\N	\N
147	1	46	21	Crunch Burger	1.000	250.00	250.00	none	0.00	0.00	0.00	0.00	[]		active	\N	f	\N	\N
148	1	47	2	stock item	1.000	500.00	500.00	none	0.00	0.00	0.00	0.00	[]		active	\N	f	\N	\N
149	1	47	3	stock item 3	1.000	600.00	600.00	none	0.00	0.00	0.00	0.00	[]		active	\N	f	\N	\N
\.


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

COPY public.hold_orders (id, token_number, shift_id, store_id, customer_name, customer_id, table_id, order_mode, rider_id, created_at, updated_at, total_amount, discount_id, discount_type, discount_value, discount_amount, order_taker_id, number_of_guests, reserved_invoice_number) FROM stdin;
44	1	5	1	Walk-in Customer	0	\N	take_away	\N	2026-07-06 19:54:31.893322	2026-07-06 19:54:31.893322	700.00	\N	none	0.00	0.00	\N	\N	INV-002431
45	\N	\N	1	Walk-in Customer	0	4	dine_in	\N	2026-07-08 21:25:07.538715	2026-07-08 21:25:07.538715	2100.00	\N	none	0.00	0.00	\N	\N	INV-002449
46	\N	\N	1	Walk-in Customer	0	14	dine_in	\N	2026-07-08 21:32:07.274492	2026-07-08 21:32:07.274492	2850.00	\N	none	0.00	0.00	\N	\N	INV-002453
47	2	5	1	Walk-in Customer	0	\N	take_away	\N	2026-07-08 21:32:16.883958	2026-07-08 21:32:16.883958	1100.00	\N	none	0.00	0.00	\N	\N	INV-002454
\.


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

COPY public.inventory_lots (id, item_id, store_id, branch_id, purchase_id, purchase_item_id, lot_number, expiry_date, mfg_date, qty_received, qty_on_hand, unit_cost, status_code, remarks, created_at, updated_at) FROM stdin;
1	14	1	1	12	36	\N	2026-07-21	\N	1.000	1.000	20.00	active	\N	2026-06-29 19:50:01.724505	2026-06-29 19:50:01.724505
2	15	1	1	12	37	\N	2026-06-23	\N	1.000	1.000	220.00	expired	\N	2026-06-29 19:50:01.724505	2026-06-29 19:50:01.724505
3	15	1	1	13	38	\N	2026-06-16	\N	1.000	1.000	220.00	expired	\N	2026-06-29 20:00:44.399093	2026-06-29 20:00:44.399093
4	14	1	1	15	48	\N	2026-07-01	\N	10.000	10.000	20.00	active	\N	2026-07-01 16:39:03.019843	2026-07-01 16:39:03.019843
5	15	1	1	16	49	\N	2026-07-02	\N	12.000	12.000	220.00	active	\N	2026-07-01 17:24:12.913428	2026-07-01 17:24:12.913428
6	26	1	1	17	51	\N	2026-07-04	\N	10.000	10.000	50.00	active	\N	2026-07-03 17:36:07.173708	2026-07-03 17:36:07.173708
7	26	2	1	18	52	\N	2026-07-09	\N	10.000	10.000	50.00	active	\N	2026-07-03 17:38:21.165533	2026-07-03 17:38:21.165533
\.


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

COPY public.inventory_movements (id, item_id, store_id, branch_id, movement_type, reference_type, reference_id, quantity, created_at, lot_id) FROM stdin;
1	2	1	1	in	purchase	1	1.000000	2026-06-26 20:37:10.005775	\N
2	4	1	1	in	purchase	1	1.000000	2026-06-26 20:37:10.005775	\N
3	2	1	1	in	purchase	2	1.000000	2026-06-26 20:44:33.852445	\N
4	4	1	1	in	purchase	2	1.000000	2026-06-26 20:44:33.852445	\N
5	3	1	1	in	purchase	2	1.000000	2026-06-26 20:44:33.852445	\N
6	5	1	1	in	purchase	2	1.000000	2026-06-26 20:44:33.852445	\N
7	6	1	1	in	purchase	2	1.000000	2026-06-26 20:44:33.852445	\N
8	7	1	1	in	purchase	2	1.000000	2026-06-26 20:44:33.852445	\N
9	8	1	1	in	purchase	2	1.000000	2026-06-26 20:44:33.852445	\N
10	9	1	1	in	purchase	2	1.000000	2026-06-26 20:44:33.852445	\N
11	10	1	1	in	purchase	2	1.000000	2026-06-26 20:44:33.852445	\N
12	2	1	1	in	purchase	3	1.000000	2026-06-27 00:32:00.804789	\N
13	5	1	1	in	purchase	3	1.000000	2026-06-27 00:32:00.804789	\N
14	3	1	1	in	purchase	3	1.000000	2026-06-27 00:32:00.804789	\N
15	6	1	1	in	purchase	3	2.000000	2026-06-27 00:32:00.804789	\N
16	6	1	1	in	purchase	4	1.000000	2026-06-27 00:33:16.415619	\N
17	2	1	1	out	sale	1	2.000000	2026-06-27 16:18:39.265818	\N
18	5	1	1	out	sale	2	1.000000	2026-06-27 16:20:48.701629	\N
19	5	1	1	in	sale_return	1	1.000000	2026-06-27 16:48:30.011887	\N
20	12	1	1	in	purchase	5	1.000000	2026-06-27 16:53:24.029537	\N
21	2	1	1	in	purchase	5	1.000000	2026-06-27 16:53:24.029537	\N
22	12	1	1	in	purchase	6	1.000000	2026-06-27 17:23:52.983548	\N
23	2	1	1	out	sale	6	1.000000	2026-06-27 17:33:15.078443	\N
24	4	1	1	out	sale	7	1.000000	2026-06-27 17:33:40.862228	\N
25	3	1	1	out	sale	8	5.000000	2026-06-27 17:44:24.936127	\N
26	4	1	1	out	sale	9	1.000000	2026-06-27 17:51:58.526334	\N
27	2	1	1	in	purchase	7	1.000000	2026-06-27 18:05:42.323292	\N
28	4	1	1	in	purchase	7	1.000000	2026-06-27 18:05:42.323292	\N
29	5	1	1	in	purchase	7	1.000000	2026-06-27 18:05:42.323292	\N
30	2	1	1	in	sale_return	2	1.000000	2026-06-27 20:38:19.579734	\N
31	2	1	1	in	sale_return	3	1.000000	2026-06-27 20:50:35.206325	\N
32	2	1	1	in	sale_return	4	1.000000	2026-06-27 21:05:01.198191	\N
33	3	1	1	in	sale_return	5	5.000000	2026-06-27 21:05:39.674218	\N
34	15	1	1	in	purchase	8	2.000000	2026-06-27 23:22:25.544512	\N
35	14	1	1	in	purchase	8	1.000000	2026-06-27 23:22:25.544512	\N
36	16	1	1	in	purchase	8	1.000000	2026-06-27 23:22:25.544512	\N
37	16	1	1	out	sale	10	1.000000	2026-06-27 23:23:56.098112	\N
38	15	1	1	out	sale	11	5.000000	2026-06-27 23:26:21.288787	\N
39	14	1	1	out	sale	12	1.000000	2026-06-27 23:29:33.539785	\N
40	5	1	1	out	sale	14	1.000000	2026-06-27 23:38:11.365771	\N
41	12	1	1	out	sale	15	2.000000	2026-06-27 23:47:23.88103	\N
42	10	1	1	out	sale	15	1.000000	2026-06-27 23:47:23.88103	\N
43	9	1	1	out	sale	15	1.000000	2026-06-27 23:47:23.88103	\N
44	6	1	1	out	sale	15	1.000000	2026-06-27 23:47:23.88103	\N
45	5	1	1	out	sale	15	1.000000	2026-06-27 23:47:23.88103	\N
46	4	1	1	out	sale	15	1.000000	2026-06-27 23:47:23.88103	\N
47	2	1	1	out	sale	15	1.000000	2026-06-27 23:47:23.88103	\N
48	10	1	1	out	sale	16	42.000000	2026-06-27 23:52:35.854736	\N
49	4	1	1	out	sale	16	2.000000	2026-06-27 23:52:35.854736	\N
50	2	1	1	out	sale	16	1.000000	2026-06-27 23:52:35.854736	\N
51	12	1	1	out	sale	16	4.000000	2026-06-27 23:52:35.854736	\N
52	6	1	1	out	sale	16	1.000000	2026-06-27 23:52:35.854736	\N
53	11	1	1	out	sale	16	2.000000	2026-06-27 23:52:35.854736	\N
54	9	1	1	out	sale	16	5.000000	2026-06-27 23:52:35.854736	\N
55	8	1	1	out	sale	16	8.000000	2026-06-27 23:52:35.854736	\N
56	7	1	1	out	sale	16	6.000000	2026-06-27 23:52:35.854736	\N
57	8	1	1	out	sale	17	1.000000	2026-06-27 23:59:26.180175	\N
58	7	1	1	out	sale	17	1.000000	2026-06-27 23:59:26.180175	\N
59	9	1	1	out	sale	17	1.000000	2026-06-27 23:59:26.180175	\N
60	10	1	1	out	sale	17	1.000000	2026-06-27 23:59:26.180175	\N
61	4	1	1	out	sale	17	1.000000	2026-06-27 23:59:26.180175	\N
62	2	1	1	out	sale	17	1.000000	2026-06-27 23:59:26.180175	\N
63	12	1	1	out	sale	17	1.000000	2026-06-27 23:59:26.180175	\N
64	6	1	1	out	sale	17	1.000000	2026-06-27 23:59:26.180175	\N
65	14	1	1	out	sale	17	1.000000	2026-06-27 23:59:26.180175	\N
66	6	1	1	out	sale	18	1.000000	2026-06-28 15:38:12.189924	\N
67	3	1	1	out	sale	18	1.000000	2026-06-28 15:38:12.189924	\N
68	1	1	1	out	sale	18	1.000000	2026-06-28 15:38:12.189924	\N
69	16	1	1	out	sale	19	1.000000	2026-06-28 15:38:49.195687	\N
70	15	1	1	out	sale	19	1.000000	2026-06-28 15:38:49.195687	\N
71	17	1	1	out	sale	21	1.000000	2026-06-28 15:49:57.707477	\N
72	9	1	1	out	sale	22	0.400000	2026-06-28 15:52:59.983254	\N
73	9	1	1	out	sale	24	0.400000	2026-06-28 16:00:59.64607	\N
74	9	1	1	out	sale	26	0.400000	2026-06-28 20:40:47.496242	\N
75	9	1	1	out	sale	27	0.400000	2026-06-28 20:41:00.600289	\N
76	5	1	1	out	sale	28	2.000000	2026-06-29 00:28:32.267826	\N
77	4	1	1	out	sale	28	1.000000	2026-06-29 00:28:32.267826	\N
78	2	1	1	out	sale	28	1.000000	2026-06-29 00:28:32.267826	\N
79	12	1	1	out	sale	28	2.000000	2026-06-29 00:28:32.267826	\N
80	11	1	1	out	sale	28	3.000000	2026-06-29 00:28:32.267826	\N
81	10	1	1	out	sale	28	1.000000	2026-06-29 00:28:32.267826	\N
82	8	1	1	out	sale	28	1.000000	2026-06-29 00:28:32.267826	\N
83	2	1	1	in	purchase	12	1.000000	2026-06-29 19:50:01.724505	\N
84	14	1	1	in	purchase	12	1.000000	2026-06-29 19:50:01.724505	\N
85	15	1	1	in	purchase	12	1.000000	2026-06-29 19:50:01.724505	\N
86	15	1	1	in	purchase	13	1.000000	2026-06-29 20:00:44.399093	\N
87	2	1	1	in	purchase	13	1.000000	2026-06-29 20:00:44.399093	\N
88	4	1	1	in	purchase	13	1.000000	2026-06-29 20:00:44.399093	\N
89	5	1	1	in	purchase	13	1.000000	2026-06-29 20:00:44.399093	\N
90	9	1	1	in	purchase	13	1.000000	2026-06-29 20:00:44.399093	\N
91	1	1	1	in	purchase	13	1.000000	2026-06-29 20:00:44.399093	\N
92	10	1	1	in	purchase	13	1.000000	2026-06-29 20:00:44.399093	\N
93	3	1	1	in	purchase	13	1.000000	2026-06-29 20:00:44.399093	\N
94	6	1	1	in	purchase	13	3.000000	2026-06-29 20:00:44.399093	\N
95	3	1	1	out	sale	30	1.000000	2026-06-29 20:56:43.109778	\N
96	11	1	1	out	sale	30	1.000000	2026-06-29 20:56:43.109778	\N
97	10	1	1	out	sale	30	1.000000	2026-06-29 20:56:43.109778	\N
98	8	1	1	out	sale	30	1.000000	2026-06-29 20:56:43.109778	\N
99	7	1	1	out	sale	30	1.000000	2026-06-29 20:56:43.109778	\N
100	1	1	1	out	sale	30	1.000000	2026-06-29 20:56:43.109778	\N
101	6	1	1	out	sale	30	1.000000	2026-06-29 20:56:43.109778	\N
102	12	1	1	out	sale	30	1.000000	2026-06-29 20:56:43.109778	\N
103	2	1	1	out	sale	30	1.000000	2026-06-29 20:56:43.109778	\N
104	15	1	1	out	sale	33	1.000000	2026-06-29 21:00:07.728721	\N
105	16	1	1	out	sale	33	1.000000	2026-06-29 21:00:07.728721	\N
106	9	1	1	out	sale	35	0.400000	2026-06-29 21:12:45.597111	\N
107	9	1	1	out	sale	36	0.400000	2026-06-29 21:35:53.115125	\N
108	24	1	1	out	sale	39	1.000000	2026-06-30 14:08:12.963299	\N
109	25	1	1	in	purchase	14	1.000000	2026-06-30 17:13:33.533921	\N
110	25	1	1	out	sale	40	1.000000	2026-06-30 17:35:55.212332	\N
111	25	1	1	out	sale	41	1.000000	2026-06-30 17:54:29.388503	\N
112	7	1	1	out	sale	42	1.000000	2026-06-30 20:16:06.850872	\N
113	1	1	1	out	sale	42	1.000000	2026-06-30 20:16:06.850872	\N
114	12	1	1	out	sale	42	1.000000	2026-06-30 20:16:06.850872	\N
115	2	1	1	out	sale	42	2.000000	2026-06-30 20:16:06.850872	\N
116	11	1	1	out	sale	42	1.000000	2026-06-30 20:16:06.850872	\N
117	5	1	1	out	sale	42	1.000000	2026-06-30 20:16:06.850872	\N
118	14	1	1	out	sale	42	1.000000	2026-06-30 20:16:06.850872	\N
119	5	1	1	out	sale	43	1.000000	2026-06-30 20:17:11.523021	\N
120	5	1	1	out	sale	44	1.000000	2026-06-30 20:17:55.821982	\N
121	14	1	1	out	sale	46	1.000000	2026-06-30 23:45:17.43258	\N
122	3	1	1	out	sale	47	1.000000	2026-06-30 23:50:48.422004	\N
123	1	1	1	out	sale	47	2.000000	2026-06-30 23:50:48.422004	\N
124	12	1	1	out	sale	47	1.000000	2026-06-30 23:50:48.422004	\N
125	11	1	1	out	sale	47	4.000000	2026-06-30 23:50:48.422004	\N
126	8	1	1	out	sale	47	1.000000	2026-06-30 23:50:48.422004	\N
127	16	1	1	out	sale	50	1.000000	2026-06-30 23:51:40.639017	\N
128	14	1	1	out	sale	51	1.000000	2026-06-30 23:53:23.952759	\N
129	4	1	1	out	sale	51	1.000000	2026-06-30 23:53:23.952759	\N
130	2	1	1	out	sale	51	1.000000	2026-06-30 23:53:23.952759	\N
131	12	1	1	out	sale	51	1.000000	2026-06-30 23:53:23.952759	\N
132	7	1	1	out	sale	51	1.000000	2026-06-30 23:53:23.952759	\N
133	8	1	1	out	sale	51	4.000000	2026-06-30 23:53:23.952759	\N
134	11	1	1	out	sale	51	1.000000	2026-06-30 23:53:23.952759	\N
135	5	1	1	out	sale	51	1.000000	2026-06-30 23:53:23.952759	\N
136	3	1	1	out	sale	51	1.000000	2026-06-30 23:53:23.952759	\N
137	6	1	1	out	sale	51	1.000000	2026-06-30 23:53:23.952759	\N
138	14	1	1	out	sale	52	1.000000	2026-06-30 23:53:34.002636	\N
139	2	1	1	out	sale	53	2.000000	2026-06-30 23:53:59.498923	\N
140	3	1	1	out	sale	53	1.000000	2026-06-30 23:53:59.498923	\N
141	4	1	1	out	sale	53	1.000000	2026-06-30 23:53:59.498923	\N
142	5	1	1	out	sale	53	1.000000	2026-06-30 23:53:59.498923	\N
143	6	1	1	out	sale	53	1.000000	2026-06-30 23:53:59.498923	\N
144	8	1	1	out	sale	53	1.000000	2026-06-30 23:53:59.498923	\N
145	11	1	1	out	sale	53	1.000000	2026-06-30 23:53:59.498923	\N
146	12	1	1	out	sale	53	2.000000	2026-06-30 23:53:59.498923	\N
147	14	1	1	out	sale	53	1.000000	2026-06-30 23:53:59.498923	\N
148	1	1	1	out	sale	53	1.000000	2026-06-30 23:53:59.498923	\N
149	2	1	1	out	sale	55	1.000000	2026-06-30 23:55:56.886399	\N
150	4	1	1	out	sale	56	2.000000	2026-06-30 23:57:06.492092	\N
151	14	1	1	in	purchase	15	10.000000	2026-07-01 16:39:03.019843	\N
152	14	1	1	out	stock_transfer_out	1	1.000000	2026-07-01 16:40:35.838283	\N
153	14	2	1	in	stock_transfer_in	1	1.000000	2026-07-01 16:40:35.842555	\N
154	15	1	1	in	purchase	16	12.000000	2026-07-01 17:24:12.913428	\N
155	6	1	1	in	purchase	16	2.000000	2026-07-01 17:24:12.913428	\N
156	6	1	1	out	stock_transfer_out	3	1.000000	2026-07-01 17:31:30.215613	\N
157	6	2	1	in	stock_transfer_in	3	1.000000	2026-07-01 17:31:30.224186	\N
158	14	1	1	out	stock_transfer_out	3	2.000000	2026-07-01 17:31:30.224813	\N
159	14	2	1	in	stock_transfer_in	3	2.000000	2026-07-01 17:31:30.22523	\N
160	14	1	1	out	stock_transfer_out	2	1.000000	2026-07-01 17:31:37.368403	\N
161	14	2	1	in	stock_transfer_in	2	1.000000	2026-07-01 17:31:37.376312	\N
162	14	1	1	out	stock_transfer_out	4	1.000000	2026-07-01 18:58:09.493966	\N
163	14	2	1	in	stock_transfer_in	4	1.000000	2026-07-01 18:58:09.513575	\N
164	14	2	1	out	stock_transfer_out	5	1.000000	2026-07-01 19:33:28.073011	\N
165	14	1	1	in	stock_transfer_in	5	1.000000	2026-07-01 19:33:28.085545	\N
166	26	1	1	in	purchase	17	10.000000	2026-07-03 17:36:07.173708	\N
167	26	2	1	in	purchase	18	10.000000	2026-07-03 17:38:21.165533	\N
168	26	2	1	out	purchase_return	1	2.000000	2026-07-03 17:42:46.469898	\N
169	6	2	1	in	purchase	19	100.000000	2026-07-03 17:55:04.726189	\N
170	6	1	1	in	purchase	20	10.000000	2026-07-03 18:06:21.912218	\N
171	12	1	1	in	purchase	20	10.000000	2026-07-03 18:06:21.912218	\N
172	26	1	1	out	wastage	1	10.000000	2026-07-03 18:55:27.639268	\N
173	26	1	1	adjustment	manual	1	50.000000	2026-07-03 19:04:17.496518	\N
174	26	1	1	out	stock_transfer_out	7	10.000000	2026-07-03 19:05:35.193502	\N
175	26	2	1	in	stock_transfer_in	7	10.000000	2026-07-03 19:05:35.738623	\N
176	26	1	1	out	stock_transfer_out	8	10.000000	2026-07-03 19:07:03.424912	\N
177	26	2	1	in	stock_transfer_in	8	10.000000	2026-07-03 19:07:04.401204	\N
178	7	1	1	out	sale	60	1.000000	2026-07-04 15:34:34.728404	\N
179	6	1	1	out	stock_transfer_out	9	1.000000	2026-07-06 16:06:50.576008	\N
180	6	2	1	in	stock_transfer_in	9	1.000000	2026-07-06 16:06:51.769936	\N
181	26	1	1	out	stock_transfer_out	9	1.000000	2026-07-06 16:06:51.775371	\N
182	26	2	1	in	stock_transfer_in	9	1.000000	2026-07-06 16:06:51.78443	\N
183	14	1	1	out	stock_transfer_out	9	1.000000	2026-07-06 16:06:51.786536	\N
184	14	2	1	in	stock_transfer_in	9	1.000000	2026-07-06 16:06:51.790464	\N
185	9	1	1	out	sale	66	0.400000	2026-07-06 16:28:54.012261	\N
\.


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

COPY public.item_barcodes (id, item_id, barcode, barcode_label, is_active, created_at, scan_mode) FROM stdin;
1	26	1111	\N	t	2026-07-03 17:33:36.831719	loose
\.


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

COPY public.item_line_discounts (id, item_id, discount_type, discount_value, is_active, starts_at, expires_at, created_at, updated_at) FROM stdin;
1	10	fixed	100.00	t	\N	\N	2026-06-27 18:02:05.933247	2026-06-27 18:02:34.088227
\.


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

COPY public.item_modifier_group_assignments (id, item_id, modifier_group_id, is_required, sort_order, created_at) FROM stdin;
1	13	1	f	0	2026-06-29 22:47:17.96895
2	22	1	f	0	2026-06-29 22:47:28.503154
\.


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

COPY public.item_modifier_groups (id, name, display_name, description, is_required, is_multiple_choice, max_selections, min_selections, is_active, sort_order, created_at, updated_at) FROM stdin;
1	flavors	Pizza Flavour		f	f	\N	1	t	0	2026-06-29 22:38:14.954899	2026-06-29 22:38:14.954899
\.


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

COPY public.item_modifiers (id, name, short_name, price_adjustment, cost_adjustment, is_default, is_active, sort_order, prep_time_adjustment, created_at, updated_at) FROM stdin;
1	Cheesy		10.00	0.00	f	t	0	0	2026-06-29 22:38:29.216966	2026-06-29 22:38:29.216966
2	Spicy		0.00	0.00	f	t	0	0	2026-06-29 22:38:39.956625	2026-06-29 22:38:39.956625
3	Meaty		0.00	0.00	f	t	0	0	2026-06-29 22:38:47.701092	2026-06-29 22:38:47.701092
4	Vegetarian		0.00	0.00	f	t	0	0	2026-06-29 22:38:59.031636	2026-06-29 22:38:59.031636
\.


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

COPY public.item_serial_transactions (id, serial_id, item_id, trans_type, doc_type, doc_id, header_id, branch_id, user_id, remarks, created_at) FROM stdin;
\.


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

COPY public.item_serials (id, item_id, serial_no, details, cost_price, selling_price, warranty_name, warranty_expiry, status_code, branch_id, supplier_id, created_at, updated_at) FROM stdin;
\.


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

COPY public.items (id, item_code, sku_number, name, description, retail_price, wholesale_price, cost_price, reorder_quantity, reorder_level, tax_type, tax_rate_id, category_id, sub_category_id, bulk_qty, bulk_price, pkg_qty, uom_id, item_type, product_image, display_color, item_role, is_serialized, is_third_schedule, is_active, supplier_id, prep_time, fbr_uom, fbr_sale_type, is_scale_item, tracks_expiry) FROM stdin;
1	10010	10010	Test Scale Items	\N	400.00	0.00	200.00	0	0	nil	\N	1	1	\N	\N	\N	1	loose	\N	\N	stock	f	f	t	\N	\N	\N	\N	t	f
2	10011	10011	stock item	\N	500.00	0.00	200.00	0	0	nil	\N	1	1	\N	\N	\N	1	loose	\N	\N	stock	f	f	t	\N	\N	\N	\N	f	f
3	10012	10012	stock item 3	\N	600.00	0.00	200.00	0	0	nil	\N	1	1	\N	\N	\N	1	loose	\N	\N	stock	f	f	t	\N	\N	\N	\N	f	f
4	10013	10013	stock item 2	\N	600.00	0.00	200.00	0	0	nil	\N	1	1	\N	\N	\N	1	loose	\N	\N	stock	f	f	t	\N	\N	\N	\N	f	f
5	10014	10014	test 1	\N	600.00	0.00	200.00	0	0	nil	\N	1	1	\N	\N	\N	1	loose	\N	\N	stock	f	f	t	\N	\N	\N	\N	f	f
6	10015	10015	chair	\N	550.00	0.00	150.00	0	0	nil	\N	1	1	\N	\N	\N	1	loose	1782748168_download__2_.jpg	\N	stock	f	f	t	\N	\N	\N	\N	f	f
7	10016	10016	Image item test	\N	600.00	0.00	200.00	0	0	nil	\N	1	1	\N	\N	\N	1	loose	1782747537_download__1_.jpg	\N	stock	f	f	t	\N	\N	\N	\N	f	f
8	202112280705	10017	test 4	\N	600.00	0.00	200.00	0	0	nil	\N	1	1	\N	\N	\N	1	loose	\N	\N	stock	f	f	t	\N	\N	\N	\N	f	f
9	10018	10018	test 5	\N	600.00	0.00	200.00	0	0	nil	\N	1	1	\N	\N	\N	1	loose	\N	\N	material	f	f	f	\N	\N	\N	\N	f	f
10	10019	10019	Serial Item	\N	600.00	0.00	200.00	0	0	nil	\N	1	1	\N	\N	\N	1	loose	\N	\N	stock	t	f	t	\N	\N	\N	\N	f	f
11	10020	10020	Tax Item	\N	550.00	0.00	200.00	0	0	excluded	1	1	1	\N	\N	\N	1	loose	\N	\N	stock	f	f	t	\N	\N	\N	\N	f	f
12	10021	10021	bulk item	\N	550.00	0.00	21.00	0	0	excluded	1	1	1	10	5000.00	1	1	bulk	\N	\N	stock	f	f	t	\N	\N	\N	\N	f	f
13	10022	10022	Crown Crust	\N	500.00	0.00	0.00	0	0	nil	\N	3	9	\N	\N	\N	1	loose	\N	success	non_stock	f	f	t	\N	\N	\N	\N	f	f
14	10023	10023	Panadol	\N	100.00	0.00	20.00	0	0	nil	\N	4	6	\N	\N	\N	1	loose	\N	\N	stock	f	f	t	\N	\N	\N	\N	f	t
15	10024	10024	Rizek	Omeprazole	500.00	0.00	220.00	0	0	nil	\N	5	7	\N	\N	\N	1	loose	\N	\N	stock	f	f	t	\N	\N	\N	\N	f	t
16	10025	10025	tablet	Omeprazole	500.00	0.00	200.00	0	0	nil	\N	5	7	\N	\N	\N	1	loose	1782587495_ChatGPT_Image_Jun_19__2026__06_42_10_PM.png	\N	stock	f	f	t	\N	\N	\N	\N	f	t
17	10026	10026	Cold Drink	\N	150.00	0.00	80.00	0	0	excluded	1	1	3	\N	\N	\N	1	loose	1782746975_download.jpg	\N	non_stock	f	f	t	\N	\N	\N	\N	f	f
18	202112280706	10027	Crispy Chicken Burgers	\N	500.00	0.00	100.00	0	0	nil	\N	2	8	\N	\N	\N	1	loose	1782754221_download__5_.jpg	\N	non_stock	f	f	t	\N	\N	\N	\N	f	f
19	202112280707	10028	Classic Burger	\N	600.00	0.00	150.00	0	0	nil	\N	2	8	\N	\N	\N	1	loose	1782754191_download__4_.jpg	\N	non_stock	f	f	t	\N	\N	\N	\N	f	f
20	202112280708	10029	Zinger Burger	\N	700.00	0.00	180.00	0	0	nil	\N	2	8	\N	\N	\N	1	loose	1782754162_download__3_.jpg	\N	non_stock	f	f	t	\N	\N	\N	\N	f	f
21	202112280709	10030	Crunch Burger	\N	600.00	0.00	250.00	0	0	nil	\N	2	8	\N	\N	\N	1	loose	1782754106_download.jpg	\N	non_stock	f	f	t	\N	\N	\N	\N	f	f
22	202112280710	10031	Malai Tikka	\N	650.00	0.00	350.00	0	0	nil	\N	3	9	\N	\N	\N	1	loose	\N	success	non_stock	f	f	t	\N	\N	\N	\N	f	f
23	202112280711	10032	Deal 1	\N	800.00	0.00	350.00	0	0	nil	\N	3	2	\N	\N	\N	1	loose	\N	success	non_stock	f	f	t	\N	\N	\N	\N	f	f
24	101	10033	Nimko	\N	150.00	0.00	0.00	0	0	included	\N	5	7	\N	\N	\N	1	loose	\N	\N	stock	f	f	t	\N	\N	\N	\N	f	f
25	202112280712	10034	Test Esajee  Tax	\N	600.00	0.00	400.00	0	0	excluded	1	1	3	\N	\N	\N	1	loose	\N	\N	stock	f	f	t	\N	\N	\N	\N	f	f
26	202112280713	10035	new item	\N	100.00	0.00	50.00	0	0	nil	\N	4	6	\N	\N	\N	1	loose	\N	\N	stock	f	f	t	\N	\N	\N	\N	f	t
\.


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

COPY public.journal_entries (id, entry_number, entry_date, period_id, transaction_date, source_type, reference_id, description, total_debit, total_credit, status, store_id, branch_id, user_id, posted_at, created_at, updated_at, branch_code, source_entry_id) FROM stdin;
1	JE2026060001	2026-06-26	12	2026-06-26	purchase	1	Purchase transaction #1	0.00	0.00	posted	1	1	1	2026-06-26 20:37:10.005775	2026-06-26 20:37:10.005775	2026-06-26 20:37:10.005775	br1	1
2	JE2026060002	2026-06-26	12	2026-06-26	purchase	2	Purchase transaction #2	0.00	0.00	posted	1	1	1	2026-06-26 20:44:33.852445	2026-06-26 20:44:33.852445	2026-06-26 20:44:33.852445	br1	2
3	JE2026060003	2026-06-27	12	2026-06-27	purchase	3	Purchase transaction #3	0.00	0.00	posted	1	1	1	2026-06-27 00:32:00.804789	2026-06-27 00:32:00.804789	2026-06-27 00:32:00.804789	br1	3
4	JE2026060004	2026-06-27	12	2026-06-27	purchase	4	Purchase transaction #4	0.00	0.00	posted	1	1	1	2026-06-27 00:33:16.415619	2026-06-27 00:33:16.415619	2026-06-27 00:33:16.415619	br1	4
5	JE2026060005	2026-06-27	12	2026-06-27	sale	1	Sale transaction #1	0.00	0.00	posted	1	1	1	2026-06-27 16:18:39.265818	2026-06-27 16:18:39.265818	2026-06-27 16:18:39.265818	br1	5
6	JE2026060006	2026-06-27	12	2026-06-27	sale	2	Sale transaction #2	0.00	0.00	posted	1	1	1	2026-06-27 16:20:48.701629	2026-06-27 16:20:48.701629	2026-06-27 16:20:48.701629	br1	6
7	JE2026060007	2026-06-27	12	2026-06-27	sale_return	1	Sale return #1	0.00	0.00	posted	1	1	1	2026-06-27 16:48:30.011887	2026-06-27 16:48:30.011887	2026-06-27 16:48:30.011887	br1	7
8	JE2026060008	2026-06-27	12	2026-06-27	purchase	5	Purchase transaction #5	0.00	0.00	posted	1	1	1	2026-06-27 16:53:24.029537	2026-06-27 16:53:24.029537	2026-06-27 16:53:24.029537	br1	8
9	JE2026060009	2026-06-27	12	2026-06-27	purchase	6	Purchase transaction #6	0.00	0.00	posted	1	1	1	2026-06-27 17:23:52.983548	2026-06-27 17:23:52.983548	2026-06-27 17:23:52.983548	br1	9
10	JE2026060010	2026-06-27	12	2026-06-27	sale	6	Sale transaction #6	0.00	0.00	posted	1	1	1	2026-06-27 17:33:15.078443	2026-06-27 17:33:15.078443	2026-06-27 17:33:15.078443	br1	10
11	JE2026060011	2026-06-27	12	2026-06-27	sale	7	Sale transaction #7	0.00	0.00	posted	1	1	1	2026-06-27 17:33:40.862228	2026-06-27 17:33:40.862228	2026-06-27 17:33:40.862228	br1	11
12	JE2026060012	2026-06-27	12	2026-06-27	card_reconciliation	0	Card reconciliation charges - CR20260627173653	0.00	0.00	posted	1	1	1	2026-06-27 17:36:53.74188	2026-06-27 17:36:53.74188	2026-06-27 17:36:53.74188	br1	12
13	JE2026060013	2026-06-27	12	2026-06-27	sale	8	Sale transaction #8	0.00	0.00	posted	1	1	1	2026-06-27 17:44:24.936127	2026-06-27 17:44:24.936127	2026-06-27 17:44:24.936127	br1	13
14	JE2026060014	2026-06-27	12	2026-06-27	card_reconciliation	0	Card reconciliation charges - CR20260627174652	0.00	0.00	posted	1	1	1	2026-06-27 17:46:52.332192	2026-06-27 17:46:52.332192	2026-06-27 17:46:52.332192	br1	14
15	JE2026060015	2026-06-27	12	2026-06-27	sale	9	Sale transaction #9	0.00	0.00	posted	1	1	1	2026-06-27 17:51:58.526334	2026-06-27 17:51:58.526334	2026-06-27 17:51:58.526334	br1	15
16	JE2026060016	2026-06-27	12	2026-06-27	purchase	7	Purchase transaction #7	0.00	0.00	posted	1	1	1	2026-06-27 18:05:42.323292	2026-06-27 18:05:42.323292	2026-06-27 18:05:42.323292	br1	16
17	JE2026060017	2026-06-27	12	2026-06-27	sale_return	2	Sale return #2	0.00	0.00	posted	1	1	1	2026-06-27 20:38:19.579734	2026-06-27 20:38:19.579734	2026-06-27 20:38:19.579734	br1	17
18	JE2026060018	2026-06-27	12	2026-06-27	sale_return	3	Sale return #3	0.00	0.00	posted	1	1	1	2026-06-27 20:50:35.206325	2026-06-27 20:50:35.206325	2026-06-27 20:50:35.206325	br1	18
19	JE2026060019	2026-06-27	12	2026-06-27	sale_return	4	Sale return #4	0.00	0.00	posted	1	1	1	2026-06-27 21:05:01.198191	2026-06-27 21:05:01.198191	2026-06-27 21:05:01.198191	br1	19
20	JE2026060020	2026-06-27	12	2026-06-27	sale_return	5	Sale return #5	0.00	0.00	posted	1	1	1	2026-06-27 21:05:39.674218	2026-06-27 21:05:39.674218	2026-06-27 21:05:39.674218	br1	20
21	JE2026060021	2026-06-27	12	2026-06-27	purchase	8	Purchase transaction #8	0.00	0.00	posted	1	1	1	2026-06-27 23:22:25.544512	2026-06-27 23:22:25.544512	2026-06-27 23:22:25.544512	br1	21
22	JE2026060022	2026-06-27	12	2026-06-27	sale	10	Sale transaction #10	0.00	0.00	posted	1	1	1	2026-06-27 23:23:56.098112	2026-06-27 23:23:56.098112	2026-06-27 23:23:56.098112	br1	22
23	JE2026060023	2026-06-27	12	2026-06-27	sale	11	Sale transaction #11	0.00	0.00	posted	1	1	1	2026-06-27 23:26:21.288787	2026-06-27 23:26:21.288787	2026-06-27 23:26:21.288787	br1	23
24	JE2026060024	2026-06-27	12	2026-06-27	sale	12	Sale transaction #12	0.00	0.00	posted	1	1	1	2026-06-27 23:29:33.539785	2026-06-27 23:29:33.539785	2026-06-27 23:29:33.539785	br1	24
25	JE2026060025	2026-06-27	12	2026-06-27	sale	13	Sale transaction #13	0.00	0.00	posted	1	1	1	2026-06-27 23:35:52.040946	2026-06-27 23:35:52.040946	2026-06-27 23:35:52.040946	br1	25
26	JE2026060026	2026-06-27	12	2026-06-27	sale	14	Sale transaction #14	0.00	0.00	posted	1	1	1	2026-06-27 23:38:11.365771	2026-06-27 23:38:11.365771	2026-06-27 23:38:11.365771	br1	26
27	JE2026060027	2026-06-27	12	2026-06-27	sale	15	Sale transaction #15	0.00	0.00	posted	1	1	1	2026-06-27 23:47:23.88103	2026-06-27 23:47:23.88103	2026-06-27 23:47:23.88103	br1	27
28	JE2026060028	2026-06-27	12	2026-06-27	sale	16	Sale transaction #16	0.00	0.00	posted	1	1	1	2026-06-27 23:52:35.854736	2026-06-27 23:52:35.854736	2026-06-27 23:52:35.854736	br1	28
29	JE2026060029	2026-06-27	12	2026-06-27	sale	17	Sale transaction #17	0.00	0.00	posted	1	1	1	2026-06-27 23:59:26.180175	2026-06-27 23:59:26.180175	2026-06-27 23:59:26.180175	br1	29
30	JE2026060030	2026-06-28	12	2026-06-28	sale	18	Sale transaction #18	0.00	0.00	posted	1	1	1	2026-06-28 15:38:12.189924	2026-06-28 15:38:12.189924	2026-06-28 15:38:12.189924	br1	30
31	JE2026060031	2026-06-28	12	2026-06-28	sale	19	Sale transaction #19	0.00	0.00	posted	1	1	1	2026-06-28 15:38:49.195687	2026-06-28 15:38:49.195687	2026-06-28 15:38:49.195687	br1	31
32	JE2026060032	2026-06-28	12	2026-06-28	sale	21	Sale transaction #21	0.00	0.00	posted	1	1	1	2026-06-28 15:49:57.707477	2026-06-28 15:49:57.707477	2026-06-28 15:49:57.707477	br1	32
33	JE2026060033	2026-06-28	12	2026-06-28	sale	22	Sale transaction #22	0.00	0.00	posted	1	1	1	2026-06-28 15:52:59.983254	2026-06-28 15:52:59.983254	2026-06-28 15:52:59.983254	br1	33
34	JE2026060034	2026-06-28	12	2026-06-28	sale	23	Sale transaction #23	0.00	0.00	posted	1	1	1	2026-06-28 15:55:58.057683	2026-06-28 15:55:58.057683	2026-06-28 15:55:58.057683	br1	34
35	JE2026060035	2026-06-28	12	2026-06-28	sale	24	Sale transaction #24	0.00	0.00	posted	1	1	1	2026-06-28 16:00:59.64607	2026-06-28 16:00:59.64607	2026-06-28 16:00:59.64607	br1	35
36	JE2026060036	2026-06-28	12	2026-06-28	sale	25	Sale transaction #25	0.00	0.00	posted	1	1	1	2026-06-28 20:34:34.66646	2026-06-28 20:34:34.66646	2026-06-28 20:34:34.66646	br1	36
37	JE2026060037	2026-06-28	12	2026-06-28	sale	26	Sale transaction #26	0.00	0.00	posted	1	1	1	2026-06-28 20:40:47.496242	2026-06-28 20:40:47.496242	2026-06-28 20:40:47.496242	br1	37
38	JE2026060038	2026-06-28	12	2026-06-28	sale	27	Sale transaction #27	0.00	0.00	posted	1	1	1	2026-06-28 20:41:00.600289	2026-06-28 20:41:00.600289	2026-06-28 20:41:00.600289	br1	38
39	JE2026060039	2026-06-29	12	2026-06-29	sale	28	Sale transaction #28	0.00	0.00	posted	1	1	1	2026-06-29 00:28:32.267826	2026-06-29 00:28:32.267826	2026-06-29 00:28:32.267826	br1	39
40	JE2026060040	2026-06-29	12	2026-06-29	purchase	12	Purchase transaction #12	0.00	0.00	posted	1	1	1	2026-06-29 19:50:01.724505	2026-06-29 19:50:01.724505	2026-06-29 19:50:01.724505	br1	40
41	JE2026060041	2026-06-29	12	2026-06-29	purchase	13	Purchase transaction #13	0.00	0.00	posted	1	1	1	2026-06-29 20:00:44.399093	2026-06-29 20:00:44.399093	2026-06-29 20:00:44.399093	br1	41
42	JE2026060042	2026-06-29	12	2026-06-29	sale	29	Sale transaction #29	0.00	0.00	posted	1	1	1	2026-06-29 20:56:18.074322	2026-06-29 20:56:18.074322	2026-06-29 20:56:18.074322	br1	42
43	JE2026060043	2026-06-29	12	2026-06-29	sale	30	Sale transaction #30	0.00	0.00	posted	1	1	1	2026-06-29 20:56:43.109778	2026-06-29 20:56:43.109778	2026-06-29 20:56:43.109778	br1	43
44	JE2026060044	2026-06-29	12	2026-06-29	sale	31	Sale transaction #31	0.00	0.00	posted	1	1	1	2026-06-29 20:58:04.986546	2026-06-29 20:58:04.986546	2026-06-29 20:58:04.986546	br1	44
45	JE2026060045	2026-06-29	12	2026-06-29	sale	32	Sale transaction #32	0.00	0.00	posted	1	1	1	2026-06-29 20:59:55.697068	2026-06-29 20:59:55.697068	2026-06-29 20:59:55.697068	br1	45
46	JE2026060046	2026-06-29	12	2026-06-29	sale	33	Sale transaction #33	0.00	0.00	posted	1	1	1	2026-06-29 21:00:07.728721	2026-06-29 21:00:07.728721	2026-06-29 21:00:07.728721	br1	46
47	JE2026060047	2026-06-29	12	2026-06-29	sale	34	Sale transaction #34	0.00	0.00	posted	1	1	1	2026-06-29 21:11:20.16049	2026-06-29 21:11:20.16049	2026-06-29 21:11:20.16049	br1	47
48	JE2026060048	2026-06-29	12	2026-06-29	sale	35	Sale transaction #35	0.00	0.00	posted	1	1	1	2026-06-29 21:12:45.597111	2026-06-29 21:12:45.597111	2026-06-29 21:12:45.597111	br1	48
49	JE2026060049	2026-06-29	12	2026-06-29	sale	36	Sale transaction #36	0.00	0.00	posted	1	1	1	2026-06-29 21:35:53.115125	2026-06-29 21:35:53.115125	2026-06-29 21:35:53.115125	br1	49
50	JE2026060050	2026-06-29	12	2026-06-29	sale	37	Sale transaction #37	0.00	0.00	posted	1	1	1	2026-06-29 23:10:25.677345	2026-06-29 23:10:25.677345	2026-06-29 23:10:25.677345	br1	50
51	JE2026060051	2026-06-29	12	2026-06-29	sale	38	Sale transaction #38	0.00	0.00	posted	1	1	1	2026-06-29 23:22:10.80282	2026-06-29 23:22:10.80282	2026-06-29 23:22:10.80282	br1	51
52	JE2026060052	2026-06-30	12	2026-06-30	sale	39	Sale transaction #39	0.00	0.00	posted	1	1	1	2026-06-30 14:08:12.963299	2026-06-30 14:08:12.963299	2026-06-30 14:08:12.963299	br1	52
53	JE2026060053	2026-06-30	12	2026-06-30	purchase	14	Purchase transaction #14	0.00	0.00	posted	1	1	1	2026-06-30 17:13:33.533921	2026-06-30 17:13:33.533921	2026-06-30 17:13:33.533921	br1	53
54	JE2026060054	2026-06-30	12	2026-06-30	sale	40	Sale transaction #40	0.00	0.00	posted	1	1	1	2026-06-30 17:35:55.212332	2026-06-30 17:35:55.212332	2026-06-30 17:35:55.212332	br1	54
55	JE2026060055	2026-06-30	12	2026-06-30	sale	41	Sale transaction #41	0.00	0.00	posted	1	1	1	2026-06-30 17:54:29.388503	2026-06-30 17:54:29.388503	2026-06-30 17:54:29.388503	br1	55
56	JE2026060056	2026-06-30	12	2026-06-30	card_reconciliation	0	Card reconciliation charges - CR20260630175525	0.00	0.00	posted	1	1	1	2026-06-30 17:55:25.705433	2026-06-30 17:55:25.705433	2026-06-30 17:55:25.705433	br1	56
57	JE2026060057	2026-06-30	12	2026-06-30	payment	1	Supplier payment #1	0.00	0.00	posted	1	1	1	2026-06-30 17:57:00.782894	2026-06-30 17:57:00.782894	2026-06-30 17:57:00.782894	br1	57
58	JE2026060058	2026-06-30	12	2026-06-30	sale	42	Sale transaction #42	0.00	0.00	posted	1	1	1	2026-06-30 20:16:06.850872	2026-06-30 20:16:06.850872	2026-06-30 20:16:06.850872	br1	58
59	JE2026060059	2026-06-30	12	2026-06-30	sale	43	Sale transaction #43	0.00	0.00	posted	1	1	1	2026-06-30 20:17:11.523021	2026-06-30 20:17:11.523021	2026-06-30 20:17:11.523021	br1	59
60	JE2026060060	2026-06-30	12	2026-06-30	sale	44	Sale transaction #44	0.00	0.00	posted	1	1	1	2026-06-30 20:17:55.821982	2026-06-30 20:17:55.821982	2026-06-30 20:17:55.821982	br1	60
61	JE2026060061	2026-06-30	12	2026-06-30	sale	45	Sale transaction #45	0.00	0.00	posted	1	1	1	2026-06-30 23:45:07.303607	2026-06-30 23:45:07.303607	2026-06-30 23:45:07.303607	br1	61
62	JE2026060062	2026-06-30	12	2026-06-30	sale	46	Sale transaction #46	0.00	0.00	posted	1	1	1	2026-06-30 23:45:17.43258	2026-06-30 23:45:17.43258	2026-06-30 23:45:17.43258	br1	62
63	JE2026060063	2026-06-30	12	2026-06-30	sale	47	Sale transaction #47	0.00	0.00	posted	1	1	1	2026-06-30 23:50:48.422004	2026-06-30 23:50:48.422004	2026-06-30 23:50:48.422004	br1	63
64	JE2026060064	2026-06-30	12	2026-06-30	sale	48	Sale transaction #48	0.00	0.00	posted	1	1	1	2026-06-30 23:51:24.899064	2026-06-30 23:51:24.899064	2026-06-30 23:51:24.899064	br1	64
65	JE2026060065	2026-06-30	12	2026-06-30	sale	49	Sale transaction #49	0.00	0.00	posted	1	1	1	2026-06-30 23:51:32.05904	2026-06-30 23:51:32.05904	2026-06-30 23:51:32.05904	br1	65
66	JE2026060066	2026-06-30	12	2026-06-30	sale	50	Sale transaction #50	0.00	0.00	posted	1	1	1	2026-06-30 23:51:40.639017	2026-06-30 23:51:40.639017	2026-06-30 23:51:40.639017	br1	66
67	JE2026060067	2026-06-30	12	2026-06-30	sale	51	Sale transaction #51	0.00	0.00	posted	1	1	1	2026-06-30 23:53:23.952759	2026-06-30 23:53:23.952759	2026-06-30 23:53:23.952759	br1	67
68	JE2026060068	2026-06-30	12	2026-06-30	sale	52	Sale transaction #52	0.00	0.00	posted	1	1	1	2026-06-30 23:53:34.002636	2026-06-30 23:53:34.002636	2026-06-30 23:53:34.002636	br1	68
69	JE2026060069	2026-06-30	12	2026-06-30	sale	53	Sale transaction #53	0.00	0.00	posted	1	1	1	2026-06-30 23:53:59.498923	2026-06-30 23:53:59.498923	2026-06-30 23:53:59.498923	br1	69
70	JE2026060070	2026-06-30	12	2026-06-30	shift_close	2	Shift #2 close — transfer to Cash in Hand	0.00	0.00	posted	1	1	1	2026-06-30 23:54:58.158633	2026-06-30 23:54:58.158633	2026-06-30 23:54:58.158633	br1	70
71	JE2026060071	2026-06-30	12	2026-06-30	sale	55	Sale transaction #55	0.00	0.00	posted	1	1	1	2026-06-30 23:55:56.886399	2026-06-30 23:55:56.886399	2026-06-30 23:55:56.886399	br1	71
72	JE2026060072	2026-06-30	12	2026-06-30	sale	56	Sale transaction #56	0.00	0.00	posted	1	1	1	2026-06-30 23:57:06.492092	2026-06-30 23:57:06.492092	2026-06-30 23:57:06.492092	br1	72
73	JE2026070001	2026-07-01	13	2026-07-01	shift_close	3	Shift #3 close — transfer to Cash in Hand	0.00	0.00	posted	1	1	1	2026-07-01 00:01:19.204055	2026-07-01 00:01:19.204055	2026-07-01 00:01:19.204055	br1	73
74	JE2026070002	2026-07-01	13	2026-07-01	sale	57	Sale transaction #57	0.00	0.00	posted	1	1	1	2026-07-01 00:30:55.094637	2026-07-01 00:30:55.094637	2026-07-01 00:30:55.094637	br1	74
75	JE2026070003	2026-07-01	13	2026-07-01	sale	58	Sale transaction #58	0.00	0.00	posted	1	1	1	2026-07-01 07:18:16.242081	2026-07-01 07:18:16.242081	2026-07-01 07:18:16.242081	br1	75
76	JE2026070004	2026-07-01	13	2026-07-01	purchase	15	Purchase transaction #15	0.00	0.00	posted	1	1	1	2026-07-01 16:39:03.019843	2026-07-01 16:39:03.019843	2026-07-01 16:39:03.019843	br1	76
77	JE2026070005	2026-07-01	13	2026-07-01	purchase	16	Purchase transaction #16	0.00	0.00	posted	1	1	1	2026-07-01 17:24:12.913428	2026-07-01 17:24:12.913428	2026-07-01 17:24:12.913428	br1	77
78	JE2026070006	2026-07-03	13	2026-07-03	purchase	17	Purchase transaction #17	0.00	0.00	posted	1	1	1	2026-07-03 17:36:07.173708	2026-07-03 17:36:07.173708	2026-07-03 17:36:07.173708	br1	78
79	JE2026070007	2026-07-03	13	2026-07-03	purchase	18	Purchase transaction #18	0.00	0.00	posted	2	1	1	2026-07-03 17:38:21.165533	2026-07-03 17:38:21.165533	2026-07-03 17:38:21.165533	br1	79
80	JE2026070008	2026-07-03	13	2026-07-03	purchase_return	1	Purchase return #1	0.00	0.00	posted	2	1	1	2026-07-03 17:42:46.469898	2026-07-03 17:42:46.469898	2026-07-03 17:42:46.469898	br1	80
81	JE2026070009	2026-07-03	13	2026-07-03	purchase	19	Purchase transaction #19	0.00	0.00	posted	2	1	1	2026-07-03 17:55:04.726189	2026-07-03 17:55:04.726189	2026-07-03 17:55:04.726189	br1	81
82	JE2026070010	2026-07-03	13	2026-07-03	purchase	20	Purchase transaction #20	0.00	0.00	posted	1	1	1	2026-07-03 18:06:21.912218	2026-07-03 18:06:21.912218	2026-07-03 18:06:21.912218	br1	82
83	JE2026070011	2026-07-03	13	2026-07-03	opening_balance	0	Supplier balance entry - SB-20260703-2329	0.00	0.00	posted	1	1	1	2026-07-03 18:11:56.091967	2026-07-03 18:11:56.091967	2026-07-03 18:11:56.091967	br1	83
84	JE2026070012	2026-07-03	13	2026-07-03	payment	3	Supplier payment #3	0.00	0.00	posted	1	1	1	2026-07-03 18:14:39.092614	2026-07-03 18:14:39.092614	2026-07-03 18:14:39.092614	br1	84
85	JE2026070013	2026-07-03	13	2026-07-03	payment	4	Supplier payment #4	0.00	0.00	posted	1	1	1	2026-07-03 18:22:49.275835	2026-07-03 18:22:49.275835	2026-07-03 18:22:49.275835	br1	85
86	JE2026070014	2026-07-03	13	2026-07-03	opening_balance	2	Bank opening balance: Asnaff Bank - Asnaff Bank	0.00	0.00	posted	1	1	1	2026-07-03 18:32:24.571561	2026-07-03 18:32:24.571561	2026-07-03 18:32:24.571561	br1	86
87	JE2026070015	2026-07-03	13	2026-07-03	payment	5	Supplier payment #5	0.00	0.00	posted	1	1	1	2026-07-03 18:34:09.957315	2026-07-03 18:34:09.957315	2026-07-03 18:34:09.957315	br1	87
88	JE2026070016	2026-07-03	13	2026-07-03	payment	6	Supplier payment #6	0.00	0.00	posted	1	1	1	2026-07-03 18:44:14.953546	2026-07-03 18:44:14.953546	2026-07-03 18:44:14.953546	br1	88
89	JE2026070017	2026-07-03	13	2026-07-03	sale	59	Sale transaction #59	0.00	0.00	posted	1	1	1	2026-07-03 18:46:36.150746	2026-07-03 18:46:36.150746	2026-07-03 18:46:36.150746	br1	89
90	JE2026070018	2026-07-03	13	2026-07-03	wastage	1	Stock wastage #1	0.00	0.00	posted	1	1	1	2026-07-03 18:55:27.639268	2026-07-03 18:55:27.639268	2026-07-03 18:55:27.639268	br1	90
91	JE2026070019	2026-07-03	13	2026-07-03	adjustment	1	Stock adjustment #1	0.00	0.00	posted	1	1	1	2026-07-03 19:04:17.496518	2026-07-03 19:04:17.496518	2026-07-03 19:04:17.496518	br1	91
92	JE2026070020	2026-07-04	13	2026-07-04	sale	60	Sale transaction #60	0.00	0.00	posted	1	1	1	2026-07-04 15:34:34.728404	2026-07-04 15:34:34.728404	2026-07-04 15:34:34.728404	br1	92
93	JE2026070021	2026-07-04	13	2026-07-04	shift_close	4	Shift #4 close — transfer to Cash in Hand	0.00	0.00	posted	1	1	1	2026-07-04 15:35:16.187676	2026-07-04 15:35:16.187676	2026-07-04 15:35:16.187676	br1	93
94	JE2026070022	2026-07-04	13	2026-07-04	sale	62	Sale transaction #62	0.00	0.00	posted	1	1	1	2026-07-04 15:47:12.057129	2026-07-04 15:47:12.057129	2026-07-04 15:47:12.057129	br1	94
95	JE2026070023	2026-07-04	13	2026-07-04	sale	63	Sale transaction #63	0.00	0.00	posted	1	1	1	2026-07-04 15:51:09.803316	2026-07-04 15:51:09.803316	2026-07-04 15:51:09.803316	br1	95
96	JE2026070024	2026-07-04	13	2026-07-04	sale	64	Sale transaction #64	0.00	0.00	posted	1	1	1	2026-07-04 15:53:35.681333	2026-07-04 15:53:35.681333	2026-07-04 15:53:35.681333	br1	96
97	JE2026070025	2026-07-04	13	2026-07-04	card_reconciliation	0	Card reconciliation charges - CR20260704155458	0.00	0.00	posted	1	1	1	2026-07-04 15:54:58.512526	2026-07-04 15:54:58.512526	2026-07-04 15:54:58.512526	br1	97
98	JE2026070026	2026-07-04	13	2026-07-04	sale	65	Sale transaction #65	0.00	0.00	posted	1	1	1	2026-07-04 16:07:19.620796	2026-07-04 16:07:19.620796	2026-07-04 16:07:19.620796	br1	98
99	JE2026070027	2026-07-05	13	2026-07-05	bank_transfer	0	Transfer: test bank (test bank) → Asnaff Bank (Asnaff Bank)	0.00	0.00	posted	1	1	1	2026-07-05 23:15:13.705598	2026-07-05 23:15:13.705598	2026-07-05 23:15:13.705598	br1	99
100	JE2026070028	2026-07-05	13	2026-07-05	opening_balance	2	Bank opening balance: Asnaff Bank - Asnaff Bank	0.00	0.00	posted	1	1	1	2026-07-05 23:22:21.766146	2026-07-05 23:22:21.766146	2026-07-05 23:22:21.766146	br1	100
101	JE2026070029	2026-07-05	13	2026-07-05	bank_adjustment	2	Bank Adjustment - Asnaff Bank - Asnaff Bank - test	0.00	0.00	posted	1	1	1	2026-07-05 23:23:50.25261	2026-07-05 23:23:50.25261	2026-07-05 23:23:50.25261	br1	101
102	JE2026070030	2026-07-06	13	2026-07-06	sale	66	Sale transaction #66	0.00	0.00	posted	1	1	1	2026-07-06 16:28:54.012261	2026-07-06 16:28:54.012261	2026-07-06 16:28:54.012261	br1	102
103	JE2026070031	2026-07-07	13	2026-07-07	sale	67	Sale transaction #67	0.00	0.00	posted	1	1	1	2026-07-07 22:37:23.604273	2026-07-07 22:37:23.604273	2026-07-07 22:37:23.604273	br1	103
104	JE2026070032	2026-07-08	13	2026-07-08	quick_transaction	0	test	0.00	0.00	posted	1	1	1	2026-07-08 15:54:54.044299	2026-07-08 15:54:54.010359	2026-07-08 15:54:54.010359	br1	104
105	JE2026070033	2026-07-08	13	2026-07-08	sale	68	Sale transaction #68	0.00	0.00	posted	1	1	1	2026-07-08 21:06:06.092249	2026-07-08 21:06:06.092249	2026-07-08 21:06:06.092249	br1	105
\.


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

COPY public.journal_entry_lines (id, journal_entry_id, account_id, debit_amount, credit_amount, description, created_at, branch_code, source_line_id) FROM stdin;
5	3	24	1200.00	0.00	Inventory purchase #3	2026-06-27 00:32:00.804789	br1	5
2	1	34	0.00	400.00	Accounts payable for purchase #1	2026-06-26 20:37:10.005775	br1	2
1	1	24	400.00	0.00	Inventory purchase #1	2026-06-26 20:37:10.005775	br1	1
4	2	34	0.00	1800.00	Accounts payable for purchase #2	2026-06-26 20:44:33.852445	br1	4
3	2	24	1800.00	0.00	Inventory purchase #2	2026-06-26 20:44:33.852445	br1	3
6	3	34	0.00	1200.00	Accounts payable for purchase #3	2026-06-27 00:32:00.804789	br1	6
8	4	34	0.00	250.00	Accounts payable for purchase #4	2026-06-27 00:33:16.415619	br1	8
7	4	24	250.00	0.00	Inventory purchase #4	2026-06-27 00:33:16.415619	br1	7
12	5	24	0.00	400.00	Inventory reduction for sale #1	2026-06-27 16:18:39.265818	br1	12
11	5	6	400.00	0.00	Cost of sales for sale #1	2026-06-27 16:18:39.265818	br1	11
10	5	48	0.00	1200.00	Sales revenue for sale #1	2026-06-27 16:18:39.265818	br1	10
9	5	20	1200.00	0.00	Cash receipt for sale #1	2026-06-27 16:18:39.265818	br1	9
16	6	24	0.00	200.00	Inventory reduction for sale #2	2026-06-27 16:20:48.701629	br1	16
15	6	6	200.00	0.00	Cost of sales for sale #2	2026-06-27 16:20:48.701629	br1	15
14	6	48	0.00	600.00	Sales revenue for sale #2	2026-06-27 16:20:48.701629	br1	14
13	6	20	600.00	0.00	Cash receipt for sale #2	2026-06-27 16:20:48.701629	br1	13
20	7	6	0.00	200.00	COGS reversal for sale return #1	2026-06-27 16:48:30.011887	br1	20
19	7	24	200.00	0.00	Inventory return for sale return #1	2026-06-27 16:48:30.011887	br1	19
18	7	4	600.00	0.00	Sales return #1	2026-06-27 16:48:30.011887	br1	18
17	7	20	0.00	600.00	Cash refund for sale return #1	2026-06-27 16:48:30.011887	br1	17
23	8	34	0.00	436.00	Accounts payable for purchase #5	2026-06-27 16:53:24.029537	br1	23
22	8	26	36.00	0.00	Purchase tax recoverable for purchase #5	2026-06-27 16:53:24.029537	br1	22
21	8	24	400.00	0.00	Inventory purchase #5	2026-06-27 16:53:24.029537	br1	21
26	9	34	0.00	236.00	Accounts payable for purchase #6	2026-06-27 17:23:52.983548	br1	26
25	9	26	36.00	0.00	Purchase tax recoverable for purchase #6	2026-06-27 17:23:52.983548	br1	25
24	9	24	200.00	0.00	Inventory purchase #6	2026-06-27 17:23:52.983548	br1	24
30	10	24	0.00	200.00	Inventory reduction for sale #6	2026-06-27 17:33:15.078443	br1	30
29	10	6	200.00	0.00	Cost of sales for sale #6	2026-06-27 17:33:15.078443	br1	29
28	10	48	0.00	600.00	Sales revenue for sale #6	2026-06-27 17:33:15.078443	br1	28
27	10	20	600.00	0.00	Cash receipt for sale #6	2026-06-27 17:33:15.078443	br1	27
34	11	24	0.00	200.00	Inventory reduction for sale #7	2026-06-27 17:33:40.862228	br1	34
33	11	6	200.00	0.00	Cost of sales for sale #7	2026-06-27 17:33:40.862228	br1	33
32	11	49	0.00	600.00	Sales revenue for sale #7	2026-06-27 17:33:40.862228	br1	32
31	11	46	600.00	0.00	Card receipt for sale #7	2026-06-27 17:33:40.862228	br1	31
37	12	46	0.00	600.00	Clear card unsettled balance - CR20260627173653	2026-06-27 17:36:53.74188	br1	37
36	12	16	12.00	0.00	Bank charges - CR20260627173653	2026-06-27 17:36:53.74188	br1	36
35	12	21	588.00	0.00	Card settlement net deposit - CR20260627173653	2026-06-27 17:36:53.74188	br1	35
41	13	24	0.00	1000.00	Inventory reduction for sale #8	2026-06-27 17:44:24.936127	br1	41
40	13	6	1000.00	0.00	Cost of sales for sale #8	2026-06-27 17:44:24.936127	br1	40
39	13	49	0.00	3000.00	Sales revenue for sale #8	2026-06-27 17:44:24.936127	br1	39
38	13	46	3000.00	0.00	Card receipt for sale #8	2026-06-27 17:44:24.936127	br1	38
44	14	46	0.00	3000.00	Clear card unsettled balance - CR20260627174652	2026-06-27 17:46:52.332192	br1	44
43	14	16	60.00	0.00	Card reconciliation charges - CR20260627174652	2026-06-27 17:46:52.332192	br1	43
42	14	21	2940.00	0.00	Card settlement net deposit - CR20260627174652	2026-06-27 17:46:52.332192	br1	42
48	15	24	0.00	200.00	Inventory reduction for sale #9	2026-06-27 17:51:58.526334	br1	48
47	15	6	200.00	0.00	Cost of sales for sale #9	2026-06-27 17:51:58.526334	br1	47
46	15	49	0.00	600.00	Sales revenue for sale #9	2026-06-27 17:51:58.526334	br1	46
45	15	46	600.00	0.00	Card receipt for sale #9	2026-06-27 17:51:58.526334	br1	45
52	16	36	0.00	9.00	Advance tax withheld on purchase #7	2026-06-27 18:05:42.323292	br1	52
51	16	34	0.00	600.00	Supplier invoice for purchase #7	2026-06-27 18:05:42.323292	br1	51
50	16	50	9.00	0.00	Advance income tax on purchase #7	2026-06-27 18:05:42.323292	br1	50
49	16	24	600.00	0.00	Inventory purchase #7	2026-06-27 18:05:42.323292	br1	49
56	17	6	0.00	200.00	COGS reversal for sale return #2	2026-06-27 20:38:19.579734	br1	56
55	17	24	200.00	0.00	Inventory return for sale return #2	2026-06-27 20:38:19.579734	br1	55
54	17	4	400.00	0.00	Sales return #2	2026-06-27 20:38:19.579734	br1	54
53	17	20	0.00	400.00	Cash refund for sale return #2	2026-06-27 20:38:19.579734	br1	53
60	18	6	0.00	200.00	COGS reversal for sale return #3	2026-06-27 20:50:35.206325	br1	60
59	18	24	200.00	0.00	Inventory return for sale return #3	2026-06-27 20:50:35.206325	br1	59
58	18	4	400.00	0.00	Sales return #3	2026-06-27 20:50:35.206325	br1	58
57	18	20	0.00	400.00	Cash refund for sale return #3	2026-06-27 20:50:35.206325	br1	57
64	19	6	0.00	200.00	COGS reversal for sale return #4	2026-06-27 21:05:01.198191	br1	64
63	19	24	200.00	0.00	Inventory return for sale return #4	2026-06-27 21:05:01.198191	br1	63
62	19	4	500.00	0.00	Sales return #4	2026-06-27 21:05:01.198191	br1	62
61	19	20	0.00	500.00	Cash refund for sale return #4	2026-06-27 21:05:01.198191	br1	61
68	20	6	0.00	1000.00	COGS reversal for sale return #5	2026-06-27 21:05:39.674218	br1	68
67	20	24	1000.00	0.00	Inventory return for sale return #5	2026-06-27 21:05:39.674218	br1	67
66	20	4	3000.00	0.00	Sales return #5	2026-06-27 21:05:39.674218	br1	66
65	20	20	0.00	3000.00	Cash refund for sale return #5	2026-06-27 21:05:39.674218	br1	65
70	21	34	0.00	660.00	Accounts payable for purchase #8	2026-06-27 23:22:25.544512	br1	70
69	21	24	660.00	0.00	Inventory purchase #8	2026-06-27 23:22:25.544512	br1	69
74	22	24	0.00	200.00	Inventory reduction for sale #10	2026-06-27 23:23:56.098112	br1	74
73	22	6	200.00	0.00	Cost of sales for sale #10	2026-06-27 23:23:56.098112	br1	73
72	22	1	0.00	500.00	Sales revenue for sale #10	2026-06-27 23:23:56.098112	br1	72
71	22	21	500.00	0.00	Bank receipt for sale #10	2026-06-27 23:23:56.098112	br1	71
78	23	24	0.00	1100.00	Inventory reduction for sale #11	2026-06-27 23:26:21.288787	br1	78
77	23	6	1100.00	0.00	Cost of sales for sale #11	2026-06-27 23:26:21.288787	br1	77
76	23	48	0.00	2500.00	Sales revenue for sale #11	2026-06-27 23:26:21.288787	br1	76
75	23	20	2500.00	0.00	Cash receipt for sale #11	2026-06-27 23:26:21.288787	br1	75
82	24	24	0.00	20.00	Inventory reduction for sale #12	2026-06-27 23:29:33.539785	br1	82
81	24	6	20.00	0.00	Cost of sales for sale #12	2026-06-27 23:29:33.539785	br1	81
80	24	48	0.00	5000.00	Sales revenue for sale #12	2026-06-27 23:29:33.539785	br1	80
79	24	20	5000.00	0.00	Cash receipt for sale #12	2026-06-27 23:29:33.539785	br1	79
84	25	49	0.00	500.00	Sales revenue for sale #13	2026-06-27 23:35:52.040946	br1	84
83	25	46	500.00	0.00	Card receipt for sale #13	2026-06-27 23:35:52.040946	br1	83
88	26	24	0.00	200.00	Inventory reduction for sale #14	2026-06-27 23:38:11.365771	br1	88
87	26	6	200.00	0.00	Cost of sales for sale #14	2026-06-27 23:38:11.365771	br1	87
86	26	48	0.00	600.00	Sales revenue for sale #14	2026-06-27 23:38:11.365771	br1	86
85	26	20	600.00	0.00	Cash receipt for sale #14	2026-06-27 23:38:11.365771	br1	85
93	27	24	0.00	1650.00	Inventory reduction for sale #15	2026-06-27 23:47:23.88103	br1	93
92	27	6	1650.00	0.00	Cost of sales for sale #15	2026-06-27 23:47:23.88103	br1	92
91	27	36	0.00	198.00	Sales tax payable for sale #15	2026-06-27 23:47:23.88103	br1	91
90	27	49	0.00	4450.00	Sales revenue for sale #15	2026-06-27 23:47:23.88103	br1	90
89	27	46	4648.00	0.00	Card receipt for sale #15	2026-06-27 23:47:23.88103	br1	89
98	28	24	0.00	14250.00	Inventory reduction for sale #16	2026-06-27 23:52:35.854736	br1	98
97	28	6	14250.00	0.00	Cost of sales for sale #16	2026-06-27 23:52:35.854736	br1	97
96	28	36	0.00	594.00	Sales tax payable for sale #16	2026-06-27 23:52:35.854736	br1	96
95	28	1	0.00	37950.00	Sales revenue for sale #16	2026-06-27 23:52:35.854736	br1	95
94	28	20	38544.00	0.00	Cash receipt for sale #16	2026-06-27 23:52:35.854736	br1	94
104	29	24	0.00	1670.00	Inventory reduction for sale #17	2026-06-27 23:59:26.180175	br1	104
103	29	6	1670.00	0.00	Cost of sales for sale #17	2026-06-27 23:59:26.180175	br1	103
102	29	48	0.00	4699.00	Additional billed amount for sale #17	2026-06-27 23:59:26.180175	br1	102
101	29	36	0.00	99.00	Sales tax payable for sale #17	2026-06-27 23:59:26.180175	br1	101
100	29	48	0.00	4600.00	Sales revenue for sale #17	2026-06-27 23:59:26.180175	br1	100
99	29	20	9398.00	0.00	Cash receipt for sale #17	2026-06-27 23:59:26.180175	br1	99
108	30	24	0.00	650.00	Inventory reduction for sale #18	2026-06-28 15:38:12.189924	br1	108
107	30	6	650.00	0.00	Cost of sales for sale #18	2026-06-28 15:38:12.189924	br1	107
106	30	48	0.00	1550.00	Sales revenue for sale #18	2026-06-28 15:38:12.189924	br1	106
105	30	20	1550.00	0.00	Cash receipt for sale #18	2026-06-28 15:38:12.189924	br1	105
112	31	24	0.00	420.00	Inventory reduction for sale #19	2026-06-28 15:38:49.195687	br1	112
111	31	6	420.00	0.00	Cost of sales for sale #19	2026-06-28 15:38:49.195687	br1	111
110	31	48	0.00	1500.00	Sales revenue for sale #19	2026-06-28 15:38:49.195687	br1	110
109	31	20	1500.00	0.00	Cash receipt for sale #19	2026-06-28 15:38:49.195687	br1	109
115	32	36	0.00	24.00	Sales tax payable for sale #21	2026-06-28 15:49:57.707477	br1	115
114	32	48	0.00	150.00	Sales revenue for sale #21	2026-06-28 15:49:57.707477	br1	114
113	32	20	174.00	0.00	Cash receipt for sale #21	2026-06-28 15:49:57.707477	br1	113
120	33	24	0.00	80.00	Inventory reduction for sale #22	2026-06-28 15:52:59.983254	br1	120
119	33	6	80.00	0.00	Cost of sales for sale #22	2026-06-28 15:52:59.983254	br1	119
118	33	36	0.00	24.00	Sales tax payable for sale #22	2026-06-28 15:52:59.983254	br1	118
117	33	48	0.00	150.00	Sales revenue for sale #22	2026-06-28 15:52:59.983254	br1	117
116	33	20	174.00	0.00	Cash receipt for sale #22	2026-06-28 15:52:59.983254	br1	116
122	34	49	0.00	2500.00	Sales revenue for sale #23	2026-06-28 15:55:58.057683	br1	122
121	34	46	2500.00	0.00	Card receipt for sale #23	2026-06-28 15:55:58.057683	br1	121
127	35	24	0.00	80.00	Inventory reduction for sale #24	2026-06-28 16:00:59.64607	br1	127
126	35	6	80.00	0.00	Cost of sales for sale #24	2026-06-28 16:00:59.64607	br1	126
125	35	36	0.00	21.60	Sales tax payable for sale #24	2026-06-28 16:00:59.64607	br1	125
124	35	48	0.00	135.00	Sales revenue for sale #24	2026-06-28 16:00:59.64607	br1	124
123	35	20	156.60	0.00	Cash receipt for sale #24	2026-06-28 16:00:59.64607	br1	123
129	36	48	0.00	500.00	Sales revenue for sale #25	2026-06-28 20:34:34.66646	br1	129
128	36	20	500.00	0.00	Cash receipt for sale #25	2026-06-28 20:34:34.66646	br1	128
134	37	24	0.00	80.00	Inventory reduction for sale #26	2026-06-28 20:40:47.496242	br1	134
133	37	6	80.00	0.00	Cost of sales for sale #26	2026-06-28 20:40:47.496242	br1	133
132	37	36	0.00	24.00	Sales tax payable for sale #26	2026-06-28 20:40:47.496242	br1	132
131	37	48	0.00	150.00	Sales revenue for sale #26	2026-06-28 20:40:47.496242	br1	131
130	37	20	174.00	0.00	Cash receipt for sale #26	2026-06-28 20:40:47.496242	br1	130
139	38	24	0.00	80.00	Inventory reduction for sale #27	2026-06-28 20:41:00.600289	br1	139
138	38	6	80.00	0.00	Cost of sales for sale #27	2026-06-28 20:41:00.600289	br1	138
137	38	36	0.00	24.00	Sales tax payable for sale #27	2026-06-28 20:41:00.600289	br1	137
136	38	48	0.00	150.00	Sales revenue for sale #27	2026-06-28 20:41:00.600289	br1	136
135	38	20	174.00	0.00	Cash receipt for sale #27	2026-06-28 20:41:00.600289	br1	135
144	39	24	0.00	2200.00	Inventory reduction for sale #28	2026-06-29 00:28:32.267826	br1	144
143	39	6	2200.00	0.00	Cost of sales for sale #28	2026-06-29 00:28:32.267826	br1	143
142	39	36	0.00	440.00	Sales tax payable for sale #28	2026-06-29 00:28:32.267826	br1	142
141	39	48	0.00	6150.00	Sales revenue for sale #28	2026-06-29 00:28:32.267826	br1	141
140	39	20	6590.00	0.00	Cash receipt for sale #28	2026-06-29 00:28:32.267826	br1	140
146	40	34	0.00	440.00	Accounts payable for purchase #12	2026-06-29 19:50:01.724505	br1	146
145	40	24	440.00	0.00	Inventory purchase #12	2026-06-29 19:50:01.724505	br1	145
148	41	34	0.00	2370.00	Accounts payable for purchase #13	2026-06-29 20:00:44.399093	br1	148
147	41	24	2370.00	0.00	Inventory purchase #13	2026-06-29 20:00:44.399093	br1	147
150	42	48	0.00	500.00	Sales revenue for sale #29	2026-06-29 20:56:18.074322	br1	150
149	42	20	500.00	0.00	Cash receipt for sale #29	2026-06-29 20:56:18.074322	br1	149
155	43	24	0.00	1850.00	Inventory reduction for sale #30	2026-06-29 20:56:43.109778	br1	155
154	43	6	1850.00	0.00	Cost of sales for sale #30	2026-06-29 20:56:43.109778	br1	154
153	43	36	0.00	176.00	Sales tax payable for sale #30	2026-06-29 20:56:43.109778	br1	153
152	43	48	0.00	4850.00	Sales revenue for sale #30	2026-06-29 20:56:43.109778	br1	152
151	43	20	5026.00	0.00	Cash receipt for sale #30	2026-06-29 20:56:43.109778	br1	151
157	44	48	0.00	500.00	Sales revenue for sale #31	2026-06-29 20:58:04.986546	br1	157
156	44	20	500.00	0.00	Cash receipt for sale #31	2026-06-29 20:58:04.986546	br1	156
159	45	48	0.00	500.00	Sales revenue for sale #32	2026-06-29 20:59:55.697068	br1	159
158	45	20	500.00	0.00	Cash receipt for sale #32	2026-06-29 20:59:55.697068	br1	158
163	46	24	0.00	420.00	Inventory reduction for sale #33	2026-06-29 21:00:07.728721	br1	163
162	46	6	420.00	0.00	Cost of sales for sale #33	2026-06-29 21:00:07.728721	br1	162
161	46	48	0.00	1000.00	Sales revenue for sale #33	2026-06-29 21:00:07.728721	br1	161
160	46	20	1000.00	0.00	Cash receipt for sale #33	2026-06-29 21:00:07.728721	br1	160
165	47	48	0.00	500.00	Sales revenue for sale #34	2026-06-29 21:11:20.16049	br1	165
164	47	20	500.00	0.00	Cash receipt for sale #34	2026-06-29 21:11:20.16049	br1	164
170	48	24	0.00	80.00	Inventory reduction for sale #35	2026-06-29 21:12:45.597111	br1	170
169	48	6	80.00	0.00	Cost of sales for sale #35	2026-06-29 21:12:45.597111	br1	169
168	48	36	0.00	24.00	Sales tax payable for sale #35	2026-06-29 21:12:45.597111	br1	168
167	48	48	0.00	150.00	Sales revenue for sale #35	2026-06-29 21:12:45.597111	br1	167
166	48	20	174.00	0.00	Cash receipt for sale #35	2026-06-29 21:12:45.597111	br1	166
175	49	24	0.00	80.00	Inventory reduction for sale #36	2026-06-29 21:35:53.115125	br1	175
174	49	6	80.00	0.00	Cost of sales for sale #36	2026-06-29 21:35:53.115125	br1	174
173	49	36	0.00	24.00	Sales tax payable for sale #36	2026-06-29 21:35:53.115125	br1	173
172	49	48	0.00	150.00	Sales revenue for sale #36	2026-06-29 21:35:53.115125	br1	172
171	49	20	174.00	0.00	Cash receipt for sale #36	2026-06-29 21:35:53.115125	br1	171
179	50	24	0.00	1280.00	Inventory reduction for sale #37	2026-06-29 23:10:25.677345	br1	179
178	50	6	1280.00	0.00	Cost of sales for sale #37	2026-06-29 23:10:25.677345	br1	178
177	50	48	0.00	5260.00	Sales revenue for sale #37	2026-06-29 23:10:25.677345	br1	177
176	50	20	5260.00	0.00	Cash receipt for sale #37	2026-06-29 23:10:25.677345	br1	176
183	51	24	0.00	2030.00	Inventory reduction for sale #38	2026-06-29 23:22:10.80282	br1	183
182	51	6	2030.00	0.00	Cost of sales for sale #38	2026-06-29 23:22:10.80282	br1	182
181	51	48	0.00	7200.00	Sales revenue for sale #38	2026-06-29 23:22:10.80282	br1	181
180	51	20	7200.00	0.00	Cash receipt for sale #38	2026-06-29 23:22:10.80282	br1	180
186	52	36	0.00	24.00	Sales tax payable for sale #39	2026-06-30 14:08:12.963299	br1	186
185	52	48	0.00	150.00	Sales revenue for sale #39	2026-06-30 14:08:12.963299	br1	185
184	52	20	174.00	0.00	Cash receipt for sale #39	2026-06-30 14:08:12.963299	br1	184
191	53	36	0.00	9.44	Advance tax withheld on purchase #14	2026-06-30 17:13:33.533921	br1	191
190	53	34	0.00	472.00	Supplier invoice for purchase #14	2026-06-30 17:13:33.533921	br1	190
189	53	50	9.44	0.00	Advance income tax on purchase #14	2026-06-30 17:13:33.533921	br1	189
188	53	26	72.00	0.00	Purchase tax recoverable for purchase #14	2026-06-30 17:13:33.533921	br1	188
187	53	24	400.00	0.00	Inventory purchase #14	2026-06-30 17:13:33.533921	br1	187
196	54	24	0.00	400.00	Inventory reduction for sale #40	2026-06-30 17:35:55.212332	br1	196
195	54	6	400.00	0.00	Cost of sales for sale #40	2026-06-30 17:35:55.212332	br1	195
194	54	36	0.00	30.00	Sales tax payable for sale #40	2026-06-30 17:35:55.212332	br1	194
193	54	49	0.00	600.00	Sales revenue for sale #40	2026-06-30 17:35:55.212332	br1	193
192	54	46	630.00	0.00	Card receipt for sale #40	2026-06-30 17:35:55.212332	br1	192
201	55	24	0.00	400.00	Inventory reduction for sale #41	2026-06-30 17:54:29.388503	br1	201
200	55	6	400.00	0.00	Cost of sales for sale #41	2026-06-30 17:54:29.388503	br1	200
199	55	36	0.00	96.00	Sales tax payable for sale #41	2026-06-30 17:54:29.388503	br1	199
198	55	48	0.00	600.00	Sales revenue for sale #41	2026-06-30 17:54:29.388503	br1	198
197	55	20	696.00	0.00	Cash receipt for sale #41	2026-06-30 17:54:29.388503	br1	197
204	56	46	0.00	630.00	Clear card unsettled balance - CR20260630175525	2026-06-30 17:55:25.705433	br1	204
203	56	16	9.45	0.00	Card reconciliation charges - CR20260630175525	2026-06-30 17:55:25.705433	br1	203
202	56	21	620.55	0.00	Card settlement net deposit - CR20260630175525	2026-06-30 17:55:25.705433	br1	202
206	57	20	0.00	500.00	Cash payment for supplier payment #1	2026-06-30 17:57:00.782894	br1	206
205	57	34	500.00	0.00	Accounts payable reduction for payment #1	2026-06-30 17:57:00.782894	br1	205
211	58	24	0.00	1420.00	Inventory reduction for sale #42	2026-06-30 20:16:06.850872	br1	211
210	58	6	1420.00	0.00	Cost of sales for sale #42	2026-06-30 20:16:06.850872	br1	210
209	58	36	0.00	176.00	Sales tax payable for sale #42	2026-06-30 20:16:06.850872	br1	209
208	58	48	0.00	3800.00	Sales revenue for sale #42	2026-06-30 20:16:06.850872	br1	208
207	58	20	3976.00	0.00	Cash receipt for sale #42	2026-06-30 20:16:06.850872	br1	207
215	59	24	0.00	200.00	Inventory reduction for sale #43	2026-06-30 20:17:11.523021	br1	215
214	59	6	200.00	0.00	Cost of sales for sale #43	2026-06-30 20:17:11.523021	br1	214
213	59	48	0.00	600.00	Sales revenue for sale #43	2026-06-30 20:17:11.523021	br1	213
212	59	20	600.00	0.00	Cash receipt for sale #43	2026-06-30 20:17:11.523021	br1	212
219	60	24	0.00	200.00	Inventory reduction for sale #44	2026-06-30 20:17:55.821982	br1	219
218	60	6	200.00	0.00	Cost of sales for sale #44	2026-06-30 20:17:55.821982	br1	218
217	60	1	0.00	600.00	Sales revenue for sale #44	2026-06-30 20:17:55.821982	br1	217
216	60	20	600.00	0.00	Cash receipt for sale #44	2026-06-30 20:17:55.821982	br1	216
223	61	24	0.00	1900.00	Inventory reduction for sale #45	2026-06-30 23:45:07.303607	br1	223
222	61	6	1900.00	0.00	Cost of sales for sale #45	2026-06-30 23:45:07.303607	br1	222
221	61	48	0.00	8250.00	Sales revenue for sale #45	2026-06-30 23:45:07.303607	br1	221
220	61	20	8250.00	0.00	Cash receipt for sale #45	2026-06-30 23:45:07.303607	br1	220
227	62	24	0.00	20.00	Inventory reduction for sale #46	2026-06-30 23:45:17.43258	br1	227
226	62	6	20.00	0.00	Cost of sales for sale #46	2026-06-30 23:45:17.43258	br1	226
225	62	48	0.00	100.00	Sales revenue for sale #46	2026-06-30 23:45:17.43258	br1	225
224	62	20	100.00	0.00	Cash receipt for sale #46	2026-06-30 23:45:17.43258	br1	224
232	63	24	0.00	1800.00	Inventory reduction for sale #47	2026-06-30 23:50:48.422004	br1	232
231	63	6	1800.00	0.00	Cost of sales for sale #47	2026-06-30 23:50:48.422004	br1	231
230	63	36	0.00	432.00	Sales tax payable for sale #47	2026-06-30 23:50:48.422004	br1	230
229	63	48	0.00	4700.00	Sales revenue for sale #47	2026-06-30 23:50:48.422004	br1	229
228	63	51	5132.00	0.00	Cash receipt for sale #47	2026-06-30 23:50:48.422004	br1	228
234	64	48	0.00	500.00	Sales revenue for sale #48	2026-06-30 23:51:24.899064	br1	234
233	64	51	500.00	0.00	Cash receipt for sale #48	2026-06-30 23:51:24.899064	br1	233
236	65	48	0.00	500.00	Sales revenue for sale #49	2026-06-30 23:51:32.05904	br1	236
235	65	51	500.00	0.00	Cash receipt for sale #49	2026-06-30 23:51:32.05904	br1	235
240	66	24	0.00	200.00	Inventory reduction for sale #50	2026-06-30 23:51:40.639017	br1	240
239	66	6	200.00	0.00	Cost of sales for sale #50	2026-06-30 23:51:40.639017	br1	239
238	66	48	0.00	500.00	Sales revenue for sale #50	2026-06-30 23:51:40.639017	br1	238
237	66	51	500.00	0.00	Cash receipt for sale #50	2026-06-30 23:51:40.639017	br1	237
245	67	24	0.00	2470.00	Inventory reduction for sale #51	2026-06-30 23:53:23.952759	br1	245
244	67	6	2470.00	0.00	Cost of sales for sale #51	2026-06-30 23:53:23.952759	br1	244
243	67	36	0.00	176.00	Sales tax payable for sale #51	2026-06-30 23:53:23.952759	br1	243
242	67	48	0.00	7550.00	Sales revenue for sale #51	2026-06-30 23:53:23.952759	br1	242
241	67	51	7726.00	0.00	Cash receipt for sale #51	2026-06-30 23:53:23.952759	br1	241
249	68	24	0.00	20.00	Inventory reduction for sale #52	2026-06-30 23:53:34.002636	br1	249
248	68	6	20.00	0.00	Cost of sales for sale #52	2026-06-30 23:53:34.002636	br1	248
247	68	48	0.00	100.00	Sales revenue for sale #52	2026-06-30 23:53:34.002636	br1	247
246	68	51	100.00	0.00	Cash receipt for sale #52	2026-06-30 23:53:34.002636	br1	246
254	69	24	0.00	2270.00	Inventory reduction for sale #53	2026-06-30 23:53:59.498923	br1	254
253	69	6	2270.00	0.00	Cost of sales for sale #53	2026-06-30 23:53:59.498923	br1	253
252	69	36	0.00	264.00	Sales tax payable for sale #53	2026-06-30 23:53:59.498923	br1	252
251	69	48	0.00	6100.00	Sales revenue for sale #53	2026-06-30 23:53:59.498923	br1	251
250	69	51	6364.00	0.00	Cash receipt for sale #53	2026-06-30 23:53:59.498923	br1	250
257	70	43	53942.60	0.00	Cash shortage — shift #2	2026-06-30 23:54:58.158633	br1	257
256	70	51	0.00	83942.60	Clear POS drawer — shift #2 close	2026-06-30 23:54:58.158633	br1	256
255	70	20	30000.00	0.00	Verified cash counted — shift #2 close	2026-06-30 23:54:58.158633	br1	255
261	71	24	0.00	200.00	Inventory reduction for sale #55	2026-06-30 23:55:56.886399	br1	261
260	71	6	200.00	0.00	Cost of sales for sale #55	2026-06-30 23:55:56.886399	br1	260
259	71	48	0.00	500.00	Sales revenue for sale #55	2026-06-30 23:55:56.886399	br1	259
258	71	51	500.00	0.00	Cash receipt for sale #55	2026-06-30 23:55:56.886399	br1	258
265	72	24	0.00	400.00	Inventory reduction for sale #56	2026-06-30 23:57:06.492092	br1	265
264	72	6	400.00	0.00	Cost of sales for sale #56	2026-06-30 23:57:06.492092	br1	264
263	72	48	0.00	1200.00	Sales revenue for sale #56	2026-06-30 23:57:06.492092	br1	263
262	72	51	1200.00	0.00	Cash receipt for sale #56	2026-06-30 23:57:06.492092	br1	262
267	73	51	0.00	1700.00	Clear POS drawer — shift #3 close	2026-07-01 00:01:19.204055	br1	267
266	73	20	1700.00	0.00	Verified cash counted — shift #3 close	2026-07-01 00:01:19.204055	br1	266
271	74	24	0.00	1210.00	Inventory reduction for sale #57	2026-07-01 00:30:55.094637	br1	271
270	74	6	1210.00	0.00	Cost of sales for sale #57	2026-07-01 00:30:55.094637	br1	270
269	74	48	0.00	5450.00	Sales revenue for sale #57	2026-07-01 00:30:55.094637	br1	269
268	74	51	5450.00	0.00	Cash receipt for sale #57	2026-07-01 00:30:55.094637	br1	268
275	75	24	0.00	250.00	Inventory reduction for sale #58	2026-07-01 07:18:16.242081	br1	275
274	75	6	250.00	0.00	Cost of sales for sale #58	2026-07-01 07:18:16.242081	br1	274
273	75	48	0.00	1100.00	Sales revenue for sale #58	2026-07-01 07:18:16.242081	br1	273
272	75	51	1100.00	0.00	Cash receipt for sale #58	2026-07-01 07:18:16.242081	br1	272
277	76	34	0.00	200.00	Accounts payable for purchase #15	2026-07-01 16:39:03.019843	br1	277
276	76	24	200.00	0.00	Inventory purchase #15	2026-07-01 16:39:03.019843	br1	276
279	77	34	0.00	3140.00	Accounts payable for purchase #16	2026-07-01 17:24:12.913428	br1	279
278	77	24	3140.00	0.00	Inventory purchase #16	2026-07-01 17:24:12.913428	br1	278
281	78	34	0.00	500.00	Accounts payable for purchase #17	2026-07-03 17:36:07.173708	br1	281
280	78	24	500.00	0.00	Inventory purchase #17	2026-07-03 17:36:07.173708	br1	280
283	79	34	0.00	500.00	Accounts payable for purchase #18	2026-07-03 17:38:21.165533	br1	283
282	79	24	500.00	0.00	Inventory purchase #18	2026-07-03 17:38:21.165533	br1	282
285	80	24	0.00	100.00	Inventory return #1	2026-07-03 17:42:46.469898	br1	285
284	80	34	100.00	0.00	Accounts payable reduction for return #1	2026-07-03 17:42:46.469898	br1	284
287	81	34	0.00	25000.00	Accounts payable for purchase #19	2026-07-03 17:55:04.726189	br1	287
286	81	24	25000.00	0.00	Inventory purchase #19	2026-07-03 17:55:04.726189	br1	286
290	82	34	0.00	1747.80	Accounts payable for purchase #20	2026-07-03 18:06:21.912218	br1	290
289	82	26	37.80	0.00	Purchase tax recoverable for purchase #20	2026-07-03 18:06:21.912218	br1	289
288	82	24	1710.00	0.00	Inventory purchase #20	2026-07-03 18:06:21.912218	br1	288
292	83	44	0.00	15000.00	Accounts payable liability	2026-07-03 18:11:56.091967	br1	292
291	83	39	15000.00	0.00	Supplier balance for #3	2026-07-03 18:11:56.091967	br1	291
296	84	3	0.00	5.00	Supplier discount for payment #3	2026-07-03 18:14:39.092614	br1	296
295	84	36	0.00	8.74	Withholding tax payable for supplier payment #3	2026-07-03 18:14:39.092614	br1	295
294	84	21	0.00	3486.26	Cash payment for supplier payment #3	2026-07-03 18:14:39.092614	br1	294
293	84	44	3500.00	0.00	Accounts payable reduction for payment #3	2026-07-03 18:14:39.092614	br1	293
299	85	36	0.00	50.00	Withholding tax payable for supplier payment #4	2026-07-03 18:22:49.275835	br1	299
298	85	21	0.00	450.00	Cash payment for supplier payment #4	2026-07-03 18:22:49.275835	br1	298
297	85	44	500.00	0.00	Accounts payable reduction for payment #4	2026-07-03 18:22:49.275835	br1	297
301	86	39	0.00	20000.00	Bank opening balance credit - 4200 - Retained Earnings	2026-07-03 18:32:24.571561	br1	301
300	86	18	20000.00	0.00	Bank opening balance - Asnaff Bank - Asnaff Bank	2026-07-03 18:32:24.571561	br1	300
304	87	36	0.00	2500.00	Withholding tax payable for supplier payment #5	2026-07-03 18:34:09.957315	br1	304
303	87	20	0.00	2500.00	Cash payment for supplier payment #5	2026-07-03 18:34:09.957315	br1	303
302	87	44	5000.00	0.00	Accounts payable reduction for payment #5	2026-07-03 18:34:09.957315	br1	302
308	88	3	0.00	1000.00	Supplier discount for payment #6	2026-07-03 18:44:14.953546	br1	308
307	88	36	0.00	2000.00	Withholding tax payable for supplier payment #6	2026-07-03 18:44:14.953546	br1	307
306	88	21	0.00	2000.00	Cash payment for supplier payment #6	2026-07-03 18:44:14.953546	br1	306
305	88	44	5000.00	0.00	Accounts payable reduction for payment #6	2026-07-03 18:44:14.953546	br1	305
312	89	24	0.00	980.00	Inventory reduction for sale #59	2026-07-03 18:46:36.150746	br1	312
311	89	6	980.00	0.00	Cost of sales for sale #59	2026-07-03 18:46:36.150746	br1	311
310	89	48	0.00	1550.00	Sales revenue for sale #59	2026-07-03 18:46:36.150746	br1	310
309	89	51	1550.00	0.00	Cash receipt for sale #59	2026-07-03 18:46:36.150746	br1	309
314	90	24	0.00	500.00	Inventory reduction wastage #1	2026-07-03 18:55:27.639268	br1	314
313	90	41	500.00	0.00	Wastage expense #1	2026-07-03 18:55:27.639268	br1	313
316	91	45	0.00	2500.00	Stock gain (adjustment) #1	2026-07-03 19:04:17.496518	br1	316
315	91	24	2500.00	0.00	Stock addition #1	2026-07-03 19:04:17.496518	br1	315
320	92	24	0.00	480.00	Inventory reduction for sale #60	2026-07-04 15:34:34.728404	br1	320
319	92	6	480.00	0.00	Cost of sales for sale #60	2026-07-04 15:34:34.728404	br1	319
318	92	48	0.00	1800.00	Sales revenue for sale #60	2026-07-04 15:34:34.728404	br1	318
317	92	51	1800.00	0.00	Cash receipt for sale #60	2026-07-04 15:34:34.728404	br1	317
322	93	43	9900.00	0.00	Cash shortage — shift #4	2026-07-04 15:35:16.187676	br1	322
321	93	51	0.00	9900.00	Clear POS drawer — shift #4 close	2026-07-04 15:35:16.187676	br1	321
326	94	24	0.00	430.00	Inventory reduction for sale #62	2026-07-04 15:47:12.057129	br1	326
325	94	6	430.00	0.00	Cost of sales for sale #62	2026-07-04 15:47:12.057129	br1	325
324	94	49	0.00	1800.00	Sales revenue for sale #62	2026-07-04 15:47:12.057129	br1	324
323	94	46	1800.00	0.00	Card receipt for sale #62	2026-07-04 15:47:12.057129	br1	323
330	95	24	0.00	1080.00	Inventory reduction for sale #63	2026-07-04 15:51:09.803316	br1	330
329	95	6	1080.00	0.00	Cost of sales for sale #63	2026-07-04 15:51:09.803316	br1	329
328	95	1	0.00	4400.00	Sales revenue for sale #63	2026-07-04 15:51:09.803316	br1	328
327	95	18	4400.00	0.00	Bank receipt for sale #63	2026-07-04 15:51:09.803316	br1	327
334	96	24	0.00	350.00	Inventory reduction for sale #64	2026-07-04 15:53:35.681333	br1	334
333	96	6	350.00	0.00	Cost of sales for sale #64	2026-07-04 15:53:35.681333	br1	333
332	96	49	0.00	1150.00	Sales revenue for sale #64	2026-07-04 15:53:35.681333	br1	332
331	96	46	1150.00	0.00	Card receipt for sale #64	2026-07-04 15:53:35.681333	br1	331
337	97	46	0.00	2950.00	Clear card unsettled balance - CR20260704155458	2026-07-04 15:54:58.512526	br1	337
336	97	16	14.75	0.00	Card reconciliation charges - CR20260704155458	2026-07-04 15:54:58.512526	br1	336
335	97	21	2935.25	0.00	Card settlement net deposit - CR20260704155458	2026-07-04 15:54:58.512526	br1	335
341	98	24	0.00	350.00	Inventory reduction for sale #65	2026-07-04 16:07:19.620796	br1	341
340	98	6	350.00	0.00	Cost of sales for sale #65	2026-07-04 16:07:19.620796	br1	340
339	98	48	0.00	1150.00	Sales revenue for sale #65	2026-07-04 16:07:19.620796	br1	339
338	98	51	1150.00	0.00	Cash receipt for sale #65	2026-07-04 16:07:19.620796	br1	338
343	99	21	0.00	200.00	Transfer OUT - BT202607050001	2026-07-05 23:15:13.705598	br1	343
342	99	18	200.00	0.00	Transfer IN - BT202607050001	2026-07-05 23:15:13.705598	br1	342
345	100	39	0.00	200.00	Bank opening balance credit - 4200 - Retained Earnings	2026-07-05 23:22:21.766146	br1	345
344	100	18	200.00	0.00	Bank opening balance - Asnaff Bank - Asnaff Bank	2026-07-05 23:22:21.766146	br1	344
347	101	18	0.00	300.00	Bank balance decrease - test	2026-07-05 23:23:50.25261	br1	347
346	101	52	300.00	0.00	Bank adjustment - test	2026-07-05 23:23:50.25261	br1	346
352	102	24	0.00	180.00	Inventory reduction for sale #66	2026-07-06 16:28:54.012261	br1	352
351	102	6	180.00	0.00	Cost of sales for sale #66	2026-07-06 16:28:54.012261	br1	351
350	102	36	0.00	24.00	Sales tax payable for sale #66	2026-07-06 16:28:54.012261	br1	350
349	102	48	0.00	650.00	Sales revenue for sale #66	2026-07-06 16:28:54.012261	br1	349
348	102	51	674.00	0.00	Cash receipt for sale #66	2026-07-06 16:28:54.012261	br1	348
356	103	24	0.00	100.00	Inventory reduction for sale #67	2026-07-07 22:37:23.604273	br1	356
355	103	6	100.00	0.00	Cost of sales for sale #67	2026-07-07 22:37:23.604273	br1	355
354	103	48	0.00	500.00	Sales revenue for sale #67	2026-07-07 22:37:23.604273	br1	354
353	103	51	500.00	0.00	Cash receipt for sale #67	2026-07-07 22:37:23.604273	br1	353
358	104	38	500.00	0.00	test - To: Owner's Investment	2026-07-08 15:54:54.039902	br1	358
357	104	21	0.00	500.00	test - From: Bank Accounts	2026-07-08 15:54:54.026707	br1	357
362	105	24	0.00	350.00	Inventory reduction for sale #68	2026-07-08 21:06:06.092249	br1	362
361	105	6	350.00	0.00	Cost of sales for sale #68	2026-07-08 21:06:06.092249	br1	361
360	105	48	0.00	650.00	Sales revenue for sale #68	2026-07-08 21:06:06.092249	br1	360
359	105	51	650.00	0.00	Cash receipt for sale #68	2026-07-08 21:06:06.092249	br1	359
\.


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

COPY public.kds_activity_log (id, store_id, kds_order_id, kds_order_item_id, action, details, description, user_id, created_at) FROM stdin;
\.


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

COPY public.kds_cleanup_log (id, cleanup_date, retention_days, orders_deleted, order_items_deleted, activity_logs_deleted, total_records_deleted, execution_time_ms, status, message, created_at) FROM stdin;
\.


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

COPY public.kds_order_items (id, store_id, kds_order_id, sale_item_id, hold_item_id, item_id, item_name, quantity, unit_price, total_price, item_status, special_instructions, preparation_notes, prepared_at, served_at, prepared_by, served_by, sort_order, created_at, item_status_type, served_quantity, total_quantity) FROM stdin;
\.


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

COPY public.kds_orders (id, store_id, sale_id, hold_id, invoice_number, order_number, table_number, customer_name, order_type, order_status, priority, estimated_time, notes, created_at, updated_at, prepared_at, served_at, created_by, prepared_by, served_by, order_taker_id, order_sequence, parent_order_id) FROM stdin;
\.


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

COPY public.kds_settings (id, store_id, setting_key, setting_value, description, created_at, updated_at) FROM stdin;
1	\N	enable_kds	0	Enable KDS system	2026-06-20 22:31:44.571827	2026-06-20 22:31:44.571827
\.


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

COPY public.kds_station_items (id, store_id, station_id, item_id, preparation_time, is_active, created_at) FROM stdin;
\.


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

COPY public.kds_stations (id, store_id, name, description, printer_id, enable_kot_print, color, is_active, sort_order, created_at, preparation_time) FROM stdin;
\.


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

COPY public.kpra_config (id, is_enabled, key, pos_id, business_id, api_url, created_at, updated_at) FROM stdin;
\.


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

COPY public.kpra_invoices (id, sale_id, kpra_invoice_number, qr_code_url, qr_code_image, response_status, response_message, created_at) FROM stdin;
\.


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

COPY public.kpra_logs (id, sale_id, request_data, response_data, status_code, created_at) FROM stdin;
\.


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

COPY public.languages (id, code, name, native_name, flag, rtl, active, created_at) FROM stdin;
1	en	English	English	us.png	f	t	2025-11-05 22:16:29
2	fa	Persian	فارسی	ir.png	t	t	2025-11-05 22:16:29
3	ur	Urdu	اردو	pk.png	t	t	2025-11-05 22:16:29
4	ar	Arabic	العربية	sa.png	t	t	2025-11-05 22:16:38
\.


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

COPY public.line_discount_rules (id, scope_type, scope_id, discount_type, discount_value, is_active, starts_at, expires_at, created_at, updated_at) FROM stdin;
5	sub_category	1	fixed	150.00	f	\N	\N	2026-06-27 18:52:06.342074	2026-06-27 18:59:39.065083
\.


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

COPY public.modifier_group_assignments (id, modifier_id, modifier_group_id, is_required, sort_order, created_at) FROM stdin;
1	1	1	f	0	2026-06-29 22:39:11.905974
2	3	1	f	0	2026-06-29 22:39:11.905974
3	2	1	f	0	2026-06-29 22:39:11.905974
4	4	1	f	0	2026-06-29 22:39:11.905974
\.


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

COPY public.modifier_template_options (id, template_id, name, price_adjustment, is_active, sort_order, created_at) FROM stdin;
\.


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

COPY public.modifier_templates (id, name, icon, is_active, sort_order, created_at) FROM stdin;
\.


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

COPY public.order_takers (id, assigned_store_id, name, employee_id, phone, email, commission_rate, password, user_id, is_active, created_at) FROM stdin;
\.


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

COPY public.payment_method_tax_rates (id, payment_method, tax_rate, is_active, created_at, updated_at) FROM stdin;
1	cash	16.00	t	2025-11-05 22:16:15	2026-05-20 20:20:00
2	card	5.00	t	2025-11-05 22:16:15	2026-05-20 20:20:03
4	bank	6.00	t	2025-11-05 22:16:15	2025-11-05 22:16:15
5	credit	0.00	t	2025-11-05 22:16:15	2025-11-05 22:16:15
6	cheque	6.00	t	2026-04-05 18:18:35	2026-04-05 18:18:35
3	easypaisa	6.00	t	2025-11-05 22:16:15	2025-11-05 22:16:15
\.


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

COPY public.payment_methods (id, method_name, display_name, icon_class, color_class, is_active, requires_bank_account, sort_order, created_at) FROM stdin;
1	cash	Cash Payment	fas fa-money-bill-wave	btn-outline-success	t	f	1	2025-08-17 19:35:24
2	card	Card Payment	fas fa-credit-card	btn-outline-primary	t	f	2	2025-08-17 19:35:24
4	bank	Bank Transfer	fas fa-university	btn-outline-warning	t	t	4	2025-08-17 19:35:24
5	credit	Credit Sale	fas fa-clock	btn-outline-secondary	t	f	5	2025-08-17 19:35:24
7	cheque	Cheque	fas fa-money-check-alt	btn-outline-secondary	t	t	6	2026-04-05 18:18:34
3	easypaisa	Easypaisa	fas fa-mobile-alt	btn-outline-info	t	t	3	2025-08-17 19:35:24
\.


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

COPY public.price_history (id, item_id, item_name, vendor_id, old_cost_price, new_cost_price, old_retail_price, new_retail_price, changed_by, changed_at) FROM stdin;
1	6	test 2	1	200.00	300.00	600.00	550.00	admin	2026-06-27 00:32:00.773866
2	6	test 2	1	300.00	250.00	550.00	550.00	admin	2026-06-27 00:33:16.086259
3	2	stock item	1	200.00	200.00	600.00	500.00	admin	2026-06-27 18:05:42.286352
4	15	Rizek	2	200.00	220.00	500.00	500.00	admin	2026-06-27 23:22:25.471322
5	26	new item	1	0.00	50.00	100.00	100.00	admin	2026-07-03 17:36:06.912582
6	6	chair	1	250.00	150.00	550.00	550.00	admin	2026-07-03 18:06:21.034244
7	12	bulk item	1	200.00	21.00	550.00	550.00	admin	2026-07-03 18:06:21.619823
\.


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

COPY public.print_devices (id, name, connection_type, print_type, terminal_id, printer_name, printer_type, print_mode, copies, ip_address, is_active, is_default, auto_detect, created_at) FROM stdin;
1	Counter Receipt Printer	usb	receipt	\N	BC-96AC	thermal	ask	1	192.168.1.24	t	t	t	2025-11-05 22:16:29
2	Kitchen KOT Printer	usb	kot	\N	Black Copper 80	thermal	ask	1	192.168.1.100	t	t	t	2025-11-05 22:16:29
3	Barcode Label Printer	usb	barcode	\N	Microsoft Print to PDF	thermal	auto	1	\N	t	f	t	2025-11-05 22:16:29
\.


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

COPY public.production_cost_lines (id, production_item_id, cost_type, description, quantity, unit_rate, amount, created_at) FROM stdin;
\.


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

COPY public.production_items (id, production_order_id, material_store_id, finish_store_id, item_id, quantity, unit_cost, total_cost, status, created_at) FROM stdin;
\.


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

COPY public.production_materials (id, production_item_id, material_item_id, quantity_consumed, unit_cost, total_cost, created_at) FROM stdin;
\.


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

COPY public.production_orders (id, order_number, production_date, status, remarks, total_cost, created_by, created_at, updated_at) FROM stdin;
1	PROD17835296421470	2026-07-08	pending		0.00	1	2026-07-08 21:54:02.51489	2026-07-08 21:54:02.51489
\.


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

COPY public.purchase_items (id, store_id, purchase_id, item_id, item_name, quantity, unit_cost, total_cost, tax_rate) FROM stdin;
1	1	1	2	stock item	1.000	200.00	200.00	0.00
2	1	1	4	stock item 2	1.000	200.00	200.00	0.00
3	1	2	2	stock item	1.000	200.00	200.00	0.00
4	1	2	4	stock item 2	1.000	200.00	200.00	0.00
5	1	2	3	stock item 3	1.000	200.00	200.00	0.00
6	1	2	5	test 1	1.000	200.00	200.00	0.00
7	1	2	6	test 2	1.000	200.00	200.00	0.00
8	1	2	7	test 3	1.000	200.00	200.00	0.00
9	1	2	8	test 4	1.000	200.00	200.00	0.00
10	1	2	9	test 5	1.000	200.00	200.00	0.00
11	1	2	10	test 6	1.000	200.00	200.00	0.00
12	1	3	2	stock item	1.000	200.00	200.00	0.00
13	1	3	5	test 1	1.000	200.00	200.00	0.00
14	1	3	3	stock item 3	1.000	200.00	200.00	0.00
15	1	3	6	test 2	2.000	300.00	600.00	0.00
16	1	4	6	test 2	1.000	250.00	250.00	0.00
17	1	5	12	bulk item	1.000	200.00	200.00	18.00
18	1	5	2	stock item	1.000	200.00	200.00	0.00
19	1	6	12	bulk item	1.000	200.00	200.00	18.00
20	1	7	2	stock item	1.000	200.00	200.00	0.00
21	1	7	4	stock item 2	1.000	200.00	200.00	0.00
22	1	7	5	test 1	1.000	200.00	200.00	0.00
23	1	8	15	Rizek	2.000	220.00	440.00	0.00
24	1	8	14	Panadol	1.000	20.00	20.00	0.00
25	1	8	16	tablet	1.000	200.00	200.00	0.00
35	1	12	2	stock item	1.000	200.00	200.00	0.00
36	1	12	14	Panadol	1.000	20.00	20.00	0.00
37	1	12	15	Rizek	1.000	220.00	220.00	0.00
38	1	13	15	Rizek	1.000	220.00	220.00	0.00
39	1	13	2	stock item	1.000	200.00	200.00	0.00
40	1	13	4	stock item 2	1.000	200.00	200.00	0.00
41	1	13	5	test 1	1.000	200.00	200.00	0.00
42	1	13	9	test 5	1.000	200.00	200.00	0.00
43	1	13	1	Test Scale Items	1.000	200.00	200.00	0.00
44	1	13	10	Serial Item	1.000	200.00	200.00	0.00
45	1	13	3	stock item 3	1.000	200.00	200.00	0.00
46	1	13	6	test 2	3.000	250.00	750.00	0.00
47	1	14	25	Test Esajee  Tax	1.000	400.00	400.00	18.00
48	1	15	14	Panadol	10.000	20.00	200.00	0.00
49	1	16	15	Rizek	12.000	220.00	2640.00	0.00
50	1	16	6	chair	2.000	250.00	500.00	0.00
51	1	17	26	new item	10.000	50.00	500.00	0.00
52	2	18	26	new item	10.000	50.00	500.00	0.00
53	2	19	6	chair	100.000	250.00	25000.00	0.00
54	1	20	6	chair	10.000	150.00	1500.00	0.00
55	1	20	12	bulk item	10.000	21.00	210.00	18.00
\.


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

COPY public.purchase_order_items (id, purchase_order_id, item_id, item_name, quantity, quantity_loose, unit_cost, retail_price, total_cost, tax_rate, purchase_mode, bulk_base_qty) FROM stdin;
1	1	6	chair	12.000	12.000	250.00	550.00	3000.00	0.00	loose	0.000
2	1	12	bulk item	110.000	110.000	200.00	550.00	22000.00	18.00	loose	10.000
\.


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

COPY public.purchase_orders (id, po_number, vendor_id, store_id, branch_id, po_date, total_amount, tax_amount, discount_amount, net_amount, notes, status, converted_purchase_id, converted_at, created_at) FROM stdin;
1	165156	1	1	1	2026-07-03 18:05:13	25000.00	3960.00	0.00	28960.00		converted	20	2026-07-03 18:06:21.912218	2026-07-03 18:05:13.008707
\.


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

COPY public.purchase_return_items (id, purchase_return_id, item_id, quantity, unit_cost, total_cost, tax_rate) FROM stdin;
1	1	26	2.000	50.00	100.00	0.00
\.


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

COPY public.purchase_returns (id, store_id, purchase_id, vendor_id, return_date, total_amount, remarks, customer_remarks, created_by, created_at) FROM stdin;
1	2	\N	2	2026-07-03 17:42:00	100.00	Purchase Return #1 (PRN)		1	2026-07-03 17:42:46.469898
\.


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

COPY public.purchases (id, store_id, branch_id, purchase_number, vendor_id, purchase_date, total_amount, tax_amount, discount_amount, net_amount, payment_method, status, source_po_id, created_at, advance_tax_rate, advance_tax_amount) FROM stdin;
1	1	1	453	1	2026-06-26 20:37:10	400.00	0.00	0.00	400.00	credit	received	0	2026-06-26 20:37:10.005775	0.00	0.00
2	1	1	456465	1	2026-06-26 20:44:33	1800.00	0.00	0.00	1800.00	credit	received	0	2026-06-26 20:44:33.852445	0.00	0.00
3	1	1	erwfsd	1	2026-06-27 00:32:00	1200.00	0.00	0.00	1200.00	credit	received	0	2026-06-27 00:32:00.804789	0.00	0.00
4	1	1	dsf	1	2026-06-27 00:33:16	250.00	0.00	0.00	250.00	credit	received	0	2026-06-27 00:33:16.415619	0.00	0.00
5	1	1	dfs	1	2026-06-27 16:53:24	400.00	36.00	0.00	436.00	credit	received	0	2026-06-27 16:53:24.029537	0.00	0.00
6	1	1	453e	1	2026-06-27 17:23:52	200.00	36.00	0.00	236.00	credit	received	0	2026-06-27 17:23:52.983548	0.00	0.00
7	1	1	45645	1	2026-06-27 18:05:42	600.00	0.00	0.00	591.00	credit	received	0	2026-06-27 18:05:42.323292	1.50	9.00
8	1	1	156489	2	2026-06-27 23:22:25	660.00	0.00	0.00	660.00	credit	received	0	2026-06-27 23:22:25.544512	0.00	0.00
12	1	1	5456	2	2026-06-29 19:50:01	440.00	0.00	0.00	440.00	credit	received	0	2026-06-29 19:50:01.724505	0.00	0.00
13	1	1	dss3	1	2026-06-29 20:00:44	2370.00	0.00	0.00	2370.00	credit	received	0	2026-06-29 20:00:44.399093	0.00	0.00
14	1	1	67656	1	2026-06-30 17:13:33	400.00	72.00	0.00	462.56	credit	received	0	2026-06-30 17:13:33.533921	2.00	9.44
15	1	1	r33	2	2026-07-01 16:39:03	200.00	0.00	0.00	200.00	credit	received	0	2026-07-01 16:39:03.019843	0.00	0.00
16	1	1	5548	2	2026-07-01 17:24:12	3140.00	0.00	0.00	3140.00	credit	received	0	2026-07-01 17:24:12.913428	0.00	0.00
17	1	1	165165	1	2026-07-03 17:36:07	500.00	0.00	0.00	500.00	credit	received	0	2026-07-03 17:36:07.173708	0.00	0.00
18	2	1	12313	2	2026-07-03 17:38:21	500.00	0.00	0.00	500.00	credit	received	0	2026-07-03 17:38:21.165533	0.00	0.00
19	2	1	1515	2	2026-07-03 17:55:04	25000.00	0.00	0.00	25000.00	credit	received	0	2026-07-03 17:55:04.726189	0.00	0.00
20	1	1	11222	1	2026-07-03 18:06:21	1710.00	37.80	0.00	1747.80	credit	received	1	2026-07-03 18:06:21.912218	0.00	0.00
\.


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

COPY public.quotation_drafts (id, user_id, store_id, payload, updated_at) FROM stdin;
\.


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

COPY public.quotation_items (id, quotation_id, item_id, item_name, quantity, unit_price, total_price, tax_rate, line_discount_percent, remarks) FROM stdin;
\.


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

COPY public.quotations (id, store_id, quotation_number, customer_id, customer_name, quotation_date, subtotal, tax_amount, discount_amount, net_amount, status, remarks, created_by, created_at, updated_at) FROM stdin;
\.


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

COPY public.rights (id, name, description, category) FROM stdin;
2	Item List		Products
31	Itemwise Sales Report	View sales report by items	Reports
33	Discount Report	View discount usage reports	Reports
34	Void Orders Report	View voided orders report	Reports
35	Sale Return Report	View sale returns report	Reports
36	Purchase Return Report	View purchase returns report	Reports
37	Order Taker Report	View order taker performance report	Reports
38	Stock Balance Report	View current stock balance	Reports
39	Stock Valuation Report	View stock valuation report	Reports
40	Reorder Report	View items that need reordering	Reports
41	Item Cost Report	View item cost analysis	Reports
42	Item Ledger Report	View item transaction ledger	Reports
43	Item Modifier Report	View item modifiers usage report	Reports
44	KDS Order Report	View kitchen display orders report	Reports
45	KPRA Sales Report	View KPRA integrated sales report	Reports
46	Production Reports	View production and manufacturing reports	Reports
47	Account Report	View account summary reports	Reports
48	Financial Reports	View financial statements and reports	Reports
49	Serial Tracking Report	View serial number tracking report	Reports
50	FBR Sales Report	View FBR integrated sales report	Reports
51	Profit & Loss	View profit and loss statement report	Reports
52	ZATCA Sales Report	View ZATCA integrated sales report	Reports
53	Customer List	View and manage customer list	Sales
54	Customer Balance	View customer balances and account statements	Sales
55	Customer Category	View and manage customer categories	Sales
56	Item Modifier Management	View and manage item modifiers	Sales
57	Void Reasons	View and manage void reasons	Sales
58	Quotations	View and manage quotations	Sales
59	Delivery Challan	View and manage delivery challans	Sales
60	Discount Management	View and manage discounts	Sales
61	Deal Management	View and manage deals	Sales
62	Order Takers	View and manage order takers	Sales
63	Tables	View and manage tables for dine-in	Sales
64	Floors	View and manage floors for dine-in	Sales
65	Riders	View and manage delivery riders	Sales
66	Delivery Orders	View and manage delivery orders	Sales
67	Items	View and manage items	Inventory
68	Item Categories	View and manage item categories	Inventory
69	UOM Management	View and manage unit of measurement	Inventory
70	Purchases	View and manage purchases	Inventory
71	Suppliers	View and manage suppliers	Inventory
72	Supplier Balance	View supplier balances and account statements	Inventory
73	Stock Transfer Request	Create and manage stock transfer requests	Inventory
1	Create User		User Management
3	Users List		User Management
4	Add Item		Products
5	View Taxes		Tax
6	View Taxes		Tax
7	Manage Categories		Products
8	Create Customer		Customers
9	Manage SubCategories		Products
10	Create Taxes		Tax
11	View Categories		Products
12	Delete Items		Products
13	Edit Items		Products
14	Edit Taxes		Tax
15	Add Expense		Expenses
16	Add Purchase		Purchases
17	Add Supplier		Vendors
18	Assign Rights		User Rights
19	Create Role		User Rights
20	View Expense Accounts		Expenses
21	Expense Categories		Expenses
22	Expense List		Expenses
23	Access POS		POS
24	Sales Report		Reports
25	Purchase Report		Reports
26	Edit Sale Price in POS	Allows editing item prices during sale in POS	POS
27	Daily Sales Report	View daily sales summary report	Reports
28	Shift Report	View cashier shift reports	Reports
29	Invoice Report	View detailed invoice reports	Reports
30	Invoice Profit Report	View invoice profit analysis	Reports
32	Tax Wise Report	View tax summary reports	Reports
74	Stock Transfer Approval	Approve stock transfer requests	Inventory
75	Stock Adjustment List	View stock adjustment list	Inventory
76	Stock Adjustment	Create new stock adjustments	Inventory
77	Production Orders	View and manage production orders	Inventory
78	Opening Balance	Manage opening balances	Inventory
79	Expenses	View and manage expenses	Accounts
80	Expense Accounts	View and manage expense accounts	Accounts
81	Expense Categories	View and manage expense categories	Accounts
82	Bank Accounts	View and manage bank accounts	Accounts
83	Payment Methods	View and manage payment methods	Accounts
84	Card Types	View and manage card types	Accounts
85	Customer Payments	View and manage customer payments	Accounts
86	Supplier Payments	View and manage supplier payments	Accounts
87	Bank Ledger	View bank account ledger with all transactions	Accounts
88	Cash Ledger	View cash account ledger with all transactions	Accounts
89	Chart of Accounts	View and manage chart of accounts	Financials
90	Account Mappings	View and manage account mappings	Financials
91	Period Management	View and manage accounting periods	Financials
92	Terminals	View and manage terminals	Hardware
93	Print Devices	View and manage print devices	Hardware
94	KOT/KDS	View and manage KOT/KDS management	Hardware
95	Tablet Orders	View and manage tablet orders	Hardware
96	Backup Tool	Access backup tool for database operations	Hardware
97	General Settings	Access general system settings	Settings
98	Branches	View and manage branches	Settings
99	Stores	View and manage stores	Settings
100	Sync Settings	Manage sync settings	Settings
101	Languages	Manage language settings	Settings
102	Tax Rates	View and manage tax rates	Settings
103	DB Operations	Access database operations panel	Settings
104	Users & Permissions	Manage users and permissions	Settings
105	Customer List	Manage customer	Sales
106	General Ledger	View detailed transaction history for accounts	Financials
107	Trial Balance	View trial balance report showing account balances	Financials
108	Account Ledger	View all cash and bank transactions with running balance	Financials
109	Profit Chart	View monthly profit analysis chart	Financials
110	Quick Transaction	Create quick financial transactions	Financials
111	Journal Entries	View and manage journal entries	Financials
112	Rider Sales Report	View rider-wise delivery sales report	Reports
113	Wastage	Record stock wastage and damage	Inventory
114	Cheques	View and manage cheque books and cheque status	Accounts
115	ITR Assistant	Access and use ITR Assistant chat/call features	Settings
116	Card Reconciliation	View and reconcile card transactions	Accounts
117	Subscriptions	View and manage customer subscriptions	Accounts
118	FBR Digital Sales Report	View FBR Digital integrated sales report	Reports
\.


--
