def _earnings_day(): store_id = c.session['store'] if c.is_GET(): return c.display(store_id=store_id) else: return c.display(store_id=store_id)
def _info_staff1(): store_id = c.session['store'] if c.is_GET(): return c.display(store_id=store_id) else: return c.display(store_id=store_id)
def _system_configcert(): store_id = c.session['store'] if c.is_GET(): return c.display(store_id=store_id) else: return c.display(store_id=store_id)
def _system_receiptform(): store_id = c.session['store'] if c.is_GET(): return c.display(store_id=store_id) else: return c.display(store_id=store_id)
def _goods_item(): store_id = c.session['store'] if c.is_GET(): return c.display(store_id=store_id) else: return c.display(store_id=store_id)
def _system_menugroup(): store_id = c.session['store'] if c.is_GET(): return c.display(store_id=store_id) else: return c.display(store_id=store_id)
def board_board(): store_id = c.session['store'] if c.is_GET(): return c.display(store_id=store_id) else: return c.display(store_id=store_id)
def _info_store1(): if c.is_GET(): return c.display() elif c.is_POST(): user = request.form['content'] print(user) return c.display()
def _system_table(group_id): sid = c.session['store'] if c.is_json(): if c.is_GET(): with orm.session_scope() as ss: # type:c.typeof_Session l = c.for_json_l(table_query(ss, sid, group_id).all()) return c.jsonify(l) elif c.is_PUT(): with orm.session_scope() as ss: # type:c.typeof_Session for k, v in c.data_POST().items(): ol = json.loads(k) for o in ol: r = c.newitem_web(orm.설정_테이블, c.session) c.merge_(o, r) r.group_id = group_id r.issync = None ss.merge(r) return 'modified' else: with orm.session_scope() as ss: # type:c.typeof_Session if c.is_GET(): gl = c.for_json_l(tablegroup_query(ss, sid).all()) return c.display(item=c.newitem_web(orm.설정_테이블그룹, c.session), form_types=form_types, gl=gl, selected=group_id, TABLEBORDER_WIDTH=c.TABLEBORDER_WIDTH, TABLEBORDER_HEIGHT=c.TABLEBORDER_HEIGHT, ) c.abort(404)
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'
def _system_config1(): store_id = c.session['store'] if c.is_GET(): xml_path = c.os.path.join(c.os.path.dirname(__file__), '../../static/KBIZ_preferences.xml') f = open(xml_path, encoding='utf-8') tree = etree.parse(f) xml_root = tree.getroot() form_types = [] for a in xml_root: form_types.append({'name': a.get('name'), 'type': 'divider'}) for b in a: _c = { 'tag': None, 'name': b.get('key') + c.SEP + b.get('name'), 'type': b.get('value'), 'valid': None } if b.get('value') == 'select': _c['l'] = [] for d in b: _c['l'].append(d.get('name')) form_types.append(_c) return c.display(xml=xml_root, form_types=form_types, item={"no": store_id}, store_id=store_id)
def _mobile(): if c.is_GET(): pass elif c.is_POST(): pass return c.display()
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'
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)
def _weather(): if c.is_GET(): pass elif c.is_POST(): pass return c.display()
def _window(): if c.is_GET(): pass elif c.is_POST(): pass return c.display()
def _dashboard(): if c.is_GET(): pass elif c.is_POST(): pass return c.display()
def _dashboard(): store_id = c.session['store'] if c.is_GET(): pass elif c.is_POST(): pass return c.display(store_id=store_id)
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)
def _info_staff1(): if c.is_GET(): pass elif c.is_POST(): pass return c.display()
def _system_menugroup(): sid = c.session['store'] if c.is_GET(): if c.is_json(): with orm.session_scope() as ss: # type:c.typeof_Session l = c.for_json_l(menugroup_query(ss, sid).all()) return c.jsonify(l) return c.display(item=c.newitem_web(orm.설정_메뉴그룹, c.session), thead=thead, form_types=form_types, id=sid)
def _goods_itemgroup(): store_id = c.session['store'] if c.is_GET(): if c.is_json(): with orm.session_scope() as ss: # type:c.typeof_Session lst = c.for_json_l(itemgroup_query(ss, store_id).all()) return c.jsonify(lst) return c.display(item=c.newitem_web(orm.상품_분류, c.session), thead=thead, form_types=form_types, no=store_id)
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()
def _system_menu(group_id): sid = c.session['store'] id = c.dict_item(orm, sid) il = list(id.values()) # print(id, il) form_types[0]['l'] = il if c.is_json(): if c.is_GET(): with orm.session_scope() as ss: # type:c.typeof_Session l = c.for_json_l(menu_query(ss, sid, group_id).all()) for i in l: try: i['메뉴명'] = id[i['품목코드']] except: i['메뉴명'] = '미지정' return c.jsonify(l) elif c.is_PUT(): with orm.session_scope() as ss: # type:c.typeof_Session for k, v in c.data_POST().items(): ol = json.loads(k) for o in ol: r = c.newitem_web(orm.설정_메뉴, c.session) c.merge_(o, r) r.group_id = group_id try: r.품목코드 = c.fs2i(o['메뉴명'].split('|', 1)[0].strip()) except: r.품목코드 = 0 r.issync = None ss.merge(r) return 'modified' else: with orm.session_scope() as ss: # type:c.typeof_Session if c.is_GET(): gl = c.for_json_l(menugroup_query(ss, sid).all()) _g = [i for i in gl if i['id'] == group_id][0] return c.display( item=c.newitem_web(orm.설정_메뉴그룹, c.session), form_types=form_types, gl=gl, selected=group_id, 상하칸=_g['상하칸'], 좌우칸=_g['좌우칸'], MENUBORDER_WIDTH=c.MENUBORDER_WIDTH, MENUBORDER_HEIGHT=c.MENUBORDER_HEIGHT, ) c.abort(404)
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'
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'
def _goods_item_modify(): store_id = c.session['store'] with orm.session_scope() as ss: # type:c.typeof_Session gd = c.dict_itemgroup(orm, store_id) gl = list(gd.values()) form_types[0]['l'] = gl # print(gd, gl) if c.is_GET(): if c.is_json(): l = c.for_json_l( c.simple_query(ss, orm.상품_품목, s=store_id, order_by_asc='no')) for i in l: i['분류'] = gd[i['분류no']] i['idx'] = i['no'] i['enabled'] = True return c.jsonify(l) return c.display(item=c.newitem_web(orm.상품_품목, c.session), thead=thead, form_types=form_types, no=store_id, gl=gl)
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'
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()
def _member_memberdata6(): if c.is_GET(): pass elif c.is_POST(): pass return c.display()