Exemple #1
0
def _system_receiptform_(store_id):
    only = c.get_setting_영수증서식(orm, store_id)

    if c.is_GET():
        if c.is_json():
            response = Response(response=json.dumps(only.j),
                                status=200,
                                mimetype='text/plain')

            return response

        else:
            return c.display()
    elif c.is_POST():
        if c.is_json():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                next_one = c.newitem_web(orm.setting_영수증서식, c.session)
                _j = c.data_json()
                for k in _j:
                    _j[k] = [
                        x for x in _j[k].split(c.EOL) if len(x.strip()) > 0
                    ]
                    # pp.pprint(_j)
                next_one.j = only.j.copy()
                k = 0

                for i in next_one.j:
                    for j in _j.keys():
                        if i == j:
                            next_one.j[j] = _j[j]
                        k = k + 1
                ss.add(next_one)
                return 'modified'
Exemple #2
0
def _dashboard():
    if c.is_GET():
        pass
    elif c.is_POST():
        pass

    return c.display()
Exemple #3
0
def _login():
    error = ''
    if c.is_GET():
        pass
    elif c.is_POST():
        with orm.session_scope() as ss:  # type:c.typeof_Session

            id = c.data_POST('user')
            pw = c.data_POST('password')

            account = ss.query(orm.account) \
                .filter_by(아이디=id) \
                .first()

            if account is None:
                error = '아이디 또는 패스워드를 잘못 입력하셨습니다.'
            elif c.pw_hash(pw) != account.패스워드:
                error = '아이디 / 패스워드를 잘못 입력하셨습니다.'
            else:
                c.account_session(orm, account, c.session)
                if account.s == 0:
                    return c.redirect('http://asp.van.or.kr:8082/window')
                return c.redirect(c.url_for('hello_world'))

    return c.display(error=error)
Exemple #4
0
def _mobile():
    if c.is_GET():
        pass
    elif c.is_POST():
        pass

    return c.display()
Exemple #5
0
def _weather():
    if c.is_GET():
        pass
    elif c.is_POST():
        pass

    return c.display()
Exemple #6
0
def _system_menu2():
    store_id = c.session['store']
    only = c.get_settings(orm, store_id)

    id = c.dict_item(orm, store_id)
    il = list(id.values())
    # print(id, il)
    form_types[0]['l'] = il

    if c.is_GET():
        if c.is_json():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                menu2 = ss.query(orm.상품_품목) \
                    .filter_by(s=store_id) \
                    .filter_by(isdel=c.X) \
                    .all()
                menu2 = c.for_json_l(menu2)
                menu2 = {i['i']: i for i in menu2}
                menu2[0] = {'품목명': '미지정', '단가': 0}
                return c.jsonify(d=only.j['메뉴'], l=menu2)
        else:
            return c.render_template('system/menu2.html',
                                     item=None, form_types=form_types,
                                     MENUBORDER_WIDTH=c.MENUBORDER_WIDTH, MENUBORDER_HEIGHT=c.MENUBORDER_HEIGHT, )
    elif c.is_POST():
        with orm.session_scope() as ss:  # type:c.typeof_Session
            next_one = c.newitem_web(orm.setting, c.session)
            next_one.j = only.j.copy()
            for each in c.data_POST():
                next_one.j['메뉴'] = c.json.loads(each)
            ss.add(next_one)
            return 'modified'
Exemple #7
0
def _system_printer():
    store_id = c.session['store']
    only = c.get_settings(orm, store_id)
    available_networks = []
    networks = only.j['네트워크']
    adjusted = only.j['프린터']
    for each in networks:
        if each['enabled']:
            available_networks.append(each['기기명'])
    for each in adjusted:
        each['연결기기명'] = networks[each['network_id']]['기기명']
    for each in form_types:
        if each['name'] == '연결기기명':
            each['l'] = available_networks

    if c.is_GET():
        if c.is_json():
            return c.jsonify(adjusted)
        else:
            return c.display(thead=thead, form_types=form_types,
                             defnet=available_networks[0]
                             if len(available_networks) > 0
                             else '')
    elif c.is_POST():
        with orm.session_scope() as ss:  # type:c.typeof_Session
            next_one = c.newitem_web(orm.settings, c.session)
            next_one.j = only.j.copy()
            for each in c.data_POST():
                next_one.j['프린터'] = c.json.loads(each)
            for each in next_one.j['프린터']:
                for i in range(len(networks)):
                    if each['연결기기명'] == networks[i]['기기명']:
                        each['network_id'] = i
            ss.add(next_one)
            return 'modified'
Exemple #8
0
def _window():
    if c.is_GET():
        pass
    elif c.is_POST():
        pass

    return c.display()
Exemple #9
0
def _goods_item_list():
    store_id = c.session['store']
    if c.is_GET():
        pass
    elif c.is_POST():
        pass

    return c.display(store_id=store_id)
Exemple #10
0
def _info_staff1():
    if c.is_GET():
        pass
    elif c.is_POST():
        pass


    return c.display()
Exemple #11
0
def _dashboard():
    store_id = c.session['store']
    if c.is_GET():
        pass
    elif c.is_POST():
        pass

    return c.display(store_id=store_id)
Exemple #12
0
def _info_store1():
    if c.is_GET():
        return c.display()
    elif c.is_POST():

        user = request.form['content']
        print(user)

        return c.display()
Exemple #13
0
def _board_board_(_id):
    store_id = c.session['store']
    if c.is_GET():
        if True:  # c.is_json()
            l = []
            with orm.session_scope() as ss:  # type:c.typeof_Session
                q1 = ss.query(orm.상품_품목) \
                    .filter_by(s=store_id) \
                    .filter_by(isdel='X') \
                    .all()
                for x in q1:
                    dummy = x.__dict__.copy()
                    del dummy['_sa_instance_state']
                    for k, v in dummy.items():
                        if v is None:
                            dummy[k] = ''
                        elif isinstance(v, date):
                            dummy[k] = v.isoformat()
                        elif isinstance(v, datetime):
                            dummy[k] = v.isoformat(' ')
                    l.append(dummy)
            return c.jsonify(l)
    elif c.is_POST():
        with orm.session_scope() as ss:  # type:c.typeof_Session


            if c.data_POST()['i'] == '신규':

                only = c.newitem_web(orm.상품_품목, c.session)
                for k, v in c.data_POST().items():
                    if hasattr(only, k) and k != 'i':
                        if getattr(only, k) != v:
                            setattr(only, k, v)

                ss.add(only)
                return 'modified'

            elif c.data_POST()['i'] != '신규':
                only = c.simple_query(ss, orm.상품_품목, s=c.session['store'])

                for x in only:

                    if int(x.i) == int(c.data_POST()['i']):
                        for k, v in c.data_POST().items():
                            if hasattr(x, k) and k != 'i':
                                if getattr(x, k) != v:
                                    print(k, 'is changed')
                                    setattr(x, k, v)
                        x.issync = None
                        return 'modified'


            return 'modified'
Exemple #14
0
def _system_network():
    store_id = c.session['store']
    only = c.get_settings(orm, store_id)

    if c.is_GET():
        if c.is_json():
            return c.jsonify(only.j['네트워크'])
        else:
            return c.display(thead=thead, form_types=form_types)
    elif c.is_POST():
        with orm.session_scope() as ss:  # type:c.typeof_Session
            next_one = c.newitem_web(orm.settings, c.session)
            next_one.j = only.j.copy()
            for each in c.data_POST():
                next_one.j['네트워크'] = c.json.loads(each)
            ss.add(next_one)
            return 'modified'
Exemple #15
0
def _info_account_(store_id):
    if c.is_GET():
        if c.is_json():
            return c.jsonify(_get_account(store_id).for_json())
        else:
            return c.display()
    elif c.is_POST() or c.is_PUT():
        with orm.session_scope() as ss:  # type:c.typeof_Session
            only = ss.query(orm.account) \
                .filter_by(s=store_id) \
                .one()
            if only.패스워드 == c.pw_hash(c.data_POST('구패스워드')):
                only.패스워드 = c.pw_hash(c.data_POST('패스워드'))
            else:
                return 'diffrent'

        return 'modified'
Exemple #16
0
def _goods_item_upload_(_id):
    store_id = c.session['store']
    gd = c.dict_itemgroup(orm, store_id)
    if c.is_json():
        if c.is_GET():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                only = c.simple_query(ss, orm.상품_품목, no=_id)
                only.분류 = gd[only.분류no]
                return c.jsonify(c.for_json(only))
        elif c.is_POST():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                only = c.newitem_web(orm.상품_품목, c.session)
                for k, v in c.data_POST().items():
                    if hasattr(only, k) and k != 'no':
                        if getattr(only, k) != v:
                            setattr(only, k, v)
                only.분류no = c.fs2i(c.data_POST()['분류'].split('|',
                                                             1)[0].strip())
                ss.add(only)
                return 'added'
        elif c.is_PUT():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                only = c.simple_query(ss, orm.상품_품목, no=_id)
                if only.s == c.session['store']:
                    for k, v in c.data_POST().items():
                        if hasattr(only, k) and k != 'no':
                            if getattr(only, k) != v:
                                print(k, 'is changed')
                                setattr(only, k, v)
                    only.분류no = c.fs2i(c.data_POST()['분류'].split('|',
                                                                 1)[0].strip())
                    only.issync = None
                    return 'modified'
                else:
                    c.abort(403)
        elif c.is_DELETE():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                only = c.simple_query(ss, orm.상품_품목, no=_id)
                if only.s == c.session['store']:
                    only.isdel = c.O
                    only.issync = None
                    return 'deleted'
                else:
                    c.abort(403)
    c.abort(404)
Exemple #17
0
def _system_menugroup_(_id):
    sid = c.session['store']

    if c.is_json():
        if c.is_GET():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                r = c.simple_query(ss, orm.설정_메뉴그룹, id=_id)
                return c.jsonify(c.for_json(r))
        elif c.is_POST():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                r = c.newitem_web(orm.설정_메뉴그룹, c.session)
                cnt = menugroup_query(ss, sid).count()
                r.번호 = cnt + 1
                for k, v in c.data_POST().items():
                    if hasattr(r, k) and k != 'id':
                        if getattr(r, k) != v:
                            setattr(r, k, v)
                ss.add(r)
                return 'added'
        elif c.is_PUT():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                r = c.simple_query(ss, orm.설정_메뉴그룹, id=_id)
                if r.sid == c.session['store']:
                    for k, v in c.data_POST().items():
                        if hasattr(r, k) and k != 'id':
                            if getattr(r, k) != v:
                                print(k, 'is changed')
                                setattr(r, k, v)
                    r.issync = None
                    return 'modified'
                else:
                    c.abort(403)
        elif c.is_DELETE():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                r = c.simple_query(ss, orm.설정_메뉴그룹, id=_id)
                if r.sid == c.session['store']:
                    r.isdel = c.O
                    l = menugroup_query(ss, sid).all()
                    for i in range(len(l)):
                        l[i].번호 = i + 1
                    r.issync = None
                    return 'deleted'
                else:
                    c.abort(403)
    c.abort(404)
Exemple #18
0
def _goods_itemgroup_(_id):
    store_id = c.session['store']

    if c.is_json():
        if c.is_GET():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                only = c.simple_query(ss, orm.상품_분류, no=_id)
                return c.jsonify(c.for_json(only))
        elif c.is_POST():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                only = c.newitem_web(orm.상품_분류, c.session)
                cnt = itemgroup_query(ss, store_id).count()
                only.번호 = cnt + 1
                for k, v in c.data_POST().items():
                    if hasattr(only, k) and k != 'no':
                        if getattr(only, k) != v:
                            setattr(only, k, v)
                ss.add(only)
                return 'added'
        elif c.is_PUT():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                only = c.simple_query(ss, orm.상품_분류, no=_id)
                if only.s == c.session['store']:
                    for k, v in c.data_POST().items():
                        if hasattr(only, k) and k != 'no':
                            if getattr(only, k) != v:
                                print(k, 'is changed')
                                setattr(only, k, v)
                    only.issync = None
                    return 'modified'
                else:
                    c.abort(403)
        elif c.is_DELETE():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                only = c.simple_query(ss, orm.상품_분류, no=_id)
                if only.s == c.session['store']:
                    only.isdel = c.O
                    l = itemgroup_query(ss, store_id).all()
                    for i in range(len(l)):
                        l[i].번호 = i + 1
                    only.issync = None
                    return 'deleted'
                else:
                    c.abort(403)
    c.abort(404)
Exemple #19
0
def _system_table2():
    shop_id = c.session['store']
    only = c.get_settings(orm, shop_id)

    if c.is_GET():
        if c.is_json():
            return c.jsonify(only.j['테이블'])
        else:
            return c.render_template('system/table2.html',
                                     item=None, form_types=form_types,
                                     TABLEBORDER_WIDTH=c.TABLEBORDER_WIDTH, TABLEBORDER_HEIGHT=c.TABLEBORDER_HEIGHT, )
    elif c.is_POST():
        with orm.session_scope() as ss:  # type:c.typeof_Session
            next_one = c.newitem_web(orm.setting, c.session)
            next_one.j = only.j.copy()
            for each in c.data_POST():
                next_one.j['테이블'] = c.json.loads(each)
            ss.add(next_one)
            return 'modified'
Exemple #20
0
def _system_config_(store_id):
    only1 = get_config(orm, store_id)

    if c.is_GET():
        if c.is_json():
            response = Response(response=json.dumps(only1.j),
                                status=200,
                                mimetype='text/plain')

            return response
        else:
            return c.display()
    elif c.is_POST():
        if c.is_json():
            with orm.session_scope() as ss:  # type:c.typeof_Session
                next_one = c.newitem_web1(orm.setting_기능설정, c.session)
                next_one.j = only1.j.copy()
                for each in c.data_POST():
                    next_one.j = c.json.loads(each)

                ss.add(next_one)
                return 'modified'
Exemple #21
0
def _info_storepwd(store_id):
    if c.is_GET():
        if c.is_json():
            return c.jsonify(_get_store(store_id).for_json())
        else:
            return c.display()
    elif c.is_POST() or c.is_PUT():
        with orm.session_scope() as ss:  # type:c.typeof_Session
            only = ss.query(orm.정보_가게) \
                .filter_by(no=store_id) \
                .one()
            for k, v in c.data_POST().items():
                if getattr(only, k) != v:
                    print(k, 'is changed')
                    if k in ['개점일', '폐점일']:
                        try:
                            setattr(only, k, parser.parse(v))
                        except:
                            setattr(only, k, None)
                    else:
                        setattr(only, k, v)
            only.issync = None
        return c.display()
Exemple #22
0
def _goods_item_(_id):
    store_id = c.session['store']
    if c.is_GET():
        if True:  # c.is_json()
            l = []
            with orm.session_scope() as ss:  # type:c.typeof_Session
                q1 = ss.query(orm.상품_품목) \
                    .filter_by(s=store_id) \
                    .filter_by(isdel='X') \
                    .all()
                for x in q1:
                    dummy = x.__dict__.copy()
                    del dummy['_sa_instance_state']
                    for k, v in dummy.items():
                        if v is None:
                            dummy[k] = ''
                        elif isinstance(v, date):
                            dummy[k] = v.isoformat()
                        elif isinstance(v, datetime):
                            dummy[k] = v.isoformat(' ')
                    l.append(dummy)
            return c.jsonify(l)
    elif c.is_POST():
        with orm.session_scope() as ss:  # type:c.typeof_Session

            if c.data_POST()['i'] == '신규':

                only = c.newitem_web(orm.상품_품목, c.session)
                for k, v in c.data_POST().items():
                    if hasattr(only, k) and k != 'i':

                        if getattr(only, k) != v:
                            if k == '프린터j':
                                _lst = []
                                if v != '':
                                    for ch in v.split(','):
                                        _lst.append(int(ch.strip()))
                                v = _lst
                            setattr(only, k, v)

                ss.add(only)
                return 'modified'

            elif c.data_POST()['i'] != '신규':
                only = c.simple_query(ss, orm.상품_품목, s=c.session['store'])

                for x in only:

                    if int(x.i) == int(c.data_POST()['i']):
                        for k, v in c.data_POST().items():
                            if hasattr(x, k) and k != 'i':
                                if getattr(x, k) != v:
                                    if k == '프린터j':
                                        _lst = []
                                        if v != '':
                                            for ch in v.split(','):
                                                _lst.append(int(ch.strip()))
                                        v = _lst
                                    print(k, 'is changed')
                                    setattr(x, k, v)
                        x.issync = None
                        return 'modified'

            temp = []
            # for i in c.data_POST():
            #     for j in c.json.loads(i):
            #         temp.append(j)

            # print(temp)

            # only = c.simple_query(ss, orm.상품_품목, s=c.session['store'])
            # for i in temp:
            #     if '코드' not in i:
            #         only1 = c.newitem_web(orm.상품_품목, c.session)
            #         only1.품목명 = i['명']
            #         ss.add(only1)
            #
            #     elif i['코드'] != None:
            #
            #         for x in only:
            #             if x.i == i['코드']:
            #                 x.품목명 = i['명']
            #                 x.isdel = i['isdel']

            return 'modified'
Exemple #23
0
def _member_memberdata6():
    if c.is_GET():
        pass
    elif c.is_POST():
        pass
    return c.display()