Exemple #1
0
    def onLoad(self, event):
        storeNum = self.storenum_tc.GetValue()
        listd = self.LSL.To_Dict()
        print(listd)
        q, d, sqlfile = self.LSL.GetSelectQD(
            listd['basic_store_info']['selects'])
        r = SQConnect(q, d, sqlfile).ONE()

        for key in listd:
            # selects = ','.join(listd[key]['selects'])
            # q = f'SELECT {selects} FROM {key}'
            # d = ()
            print(q, d, sqlfile)
            r = SQConnect(q, d, sqlfile).ONE()

            idx = 0
            for i in listd[key]['selects']:
                listd[key][i].update({'set': r[idx]})
                idx += 1

            pout.v(listd)

            for i in listd[key]:
                print(f'listd[{key}][{i}]')
                if not 'selects' in i:
                    setItem = listd[key][i]['set']
                    objItem = listd[key][i]['obj']
                    objItem.SetCtrl(setItem)
Exemple #2
0
    def onButton(self, event):
        obj = event.GetEventObject()
        named = obj.GetName()
        debug = False

        active_list = [
            ('Name', 'invMaint_priceSchemes_listctrl_name_txtctrl'),
            ('Schemed', 'invMaint_priceSchemes_listctrl_scheme_txtctrl'),
            ('Reduce By', 'invMaint_priceSchemes_listctrl_reduceby_numctrl')
        ]

        print("Button : ", named)
        if 'add' in named:
            listctrl = wx.FindWindowByName('invMaint_priceSchemes_listctrl')
            line = listctrl.GetItemCount()

            for label, name in active_list:
                print("Name : ", name)
                ctrl = wx.FindWindowByName(name)
                value = ctrl.GetValue()
                if not value:
                    ctrl.SetBackgroundColour('RED')
                    return

                print("LIST CTRL : ", listctrl.GetName())
                if '_name_' in name:
                    listctrl.InsertItem(line, value)
                    print("Set {0} : {1} on Line {2}".format(
                        'Name', value, line))

                if '_scheme_' in name:
                    listctrl.SetItem(line, 1, str(value))
                    print("Set {0} : {1} on Line {2}".format(
                        'Scheme', value, line))

                if '_reduceby_' in name:
                    listctrl.SetItem(line, 2, str(value))
                    print("Set {0} : {1} on Line {2}".format(
                        'Reduce By', value, line))

        if 'clear' in named:
            for label, name in active_list:
                print("Clear Name : ", name)
                wx.FindWindowByName(name).ClearCtrl()

        if 'delete' in named:
            lc_name = 'invMaint_priceSchemes_listctrl'
            print("Listctrl Name : ", lc_name)
            listctrl = wx.FindWindowByName(lc_name)
            line = listctrl.GetFirstSelected()
            print("item : ", listctrl)

            named = listctrl.GetItemText(line)
            print("Named : ", named)

            query = 'DELETE FROM item_pricing_schemes WHERE name=(?)'
            data = (named, )
            returnd = SQConnect(query, data).ONE()

            listctrl.DeleteItem(line)
Exemple #3
0
 def OnSave(self):
     print("Pricing Schemes")
     listctrl = wx.FindWindowByName('invMaint_priceSchemes_listctrl')
     count = listctrl.GetItemCount()
     for idx in range(count):
         name_scheme = listctrl.GetItemText(idx)
         print("Get Item {0} : {1}".format(listctrl.GetItem(idx),
                                           name_scheme))
         queryWhere = 'name=(?)'
         queryData = (name_scheme, )
         countd = QueryOps().QueryCheck('item_pricing_schemes', queryWhere,
                                        queryData)
         print("Countd : ", countd)
         if countd == 0:
             name = listctrl.GetItem(idx, 0).GetText().strip()
             schemeList = listctrl.GetItem(idx, 1).GetText().strip()
             reduceby = listctrl.GetItem(idx, 2).GetText()
             print("Name : {0}, Scheme : {1}, ReduceBy : {2}".format(
                 name, schemeList, reduceby))
             query = 'INSERT INTO item_pricing_schemes (name,scheme_list,reduce_by) VALUES ((?),(?),(?))'
             data = (
                 name,
                 schemeList,
                 reduceby,
             )
             returnd = SQConnect(query, data).ONE()
Exemple #4
0
    def onLoad(self, event):
        lc_name = 'invMaint_priceSchemes_listctrl'
        listctrl = wx.FindWindowByName(lc_name)
        query = 'SELECT scheme_list, reduce_by, name FROM item_pricing_schemes'
        data = ''
        pout.v(query)
        returnd = SQConnect(query, data).ALL()

        idx = 0
        for scheme_list, reduceby, named in returnd:
            setList = [(0, named), (1, scheme_list), (2, str(reduceby))]
            ListCtrl_Ops(lc_name).LCFill(setList, idx)
Exemple #5
0
    def OnLoad(self, event):
        load_list = [
            (self.dept_lb, 'department', 'id'),
            (self.cat_lb, 'category', 'id'),
            (self.subcat_lb, 'subcategory', 'id'),
            (self.material_lb, 'material', 'id'),
            (self.location_lb, 'location', 'id'),
            (self.zone_lb, 'zone', 'id'),
            (self.unit_lb, 'unittype', 'id'),
        ]

        for ctrl, tablename, fieldname in load_list:
            q = f'SELECT id FROM {tablename}'
            d = ()
            r = SQConnect(q, d, self.sqlfile).ALL()

            if len(r) > 0:
                a = Detupler(r).ListIt()
                ctrl.SetItems(a)
Exemple #6
0
    def onSave(self, event):
        # listd = self.LSL.To_Dict()
        # q,d, sqlfile = self.LSL.UpdateQD(listd['basic_store_info']['selects'], 'store_num')
        # pout.v(q, d, sqlfile)
        # r = SQConnect(q, d, sqlfile).ONE()

        sqlfile = self.storenum_tc.sqlfile
        storenumd = self.storenum_tc.GetCtrl()
        named = self.storename_tc.GetCtrl()
        addr1 = self.address1_tc.GetCtrl()
        addr2 = self.address2_tc.GetCtrl()
        cityd = self.city_tc.GetCtrl()
        stated = self.state_tc.GetCtrl()
        zipd = self.zipcode_tc.GetCtrl()
        phon1d = self.phone1_tc.GetCtrl()
        phon2d = self.phone2_tc.GetCtrl()
        faxd = self.fax_tc.GetCtrl()
        emaild = self.email_tc.GetCtrl()
        sited = self.website_tc.GetCtrl()
        logod = self.filepicker_c.GetCtrl()

        q = '''UPDATE basic_store_info 
               SET name=?, address1=?, address2=?, city=?, state=?, zip=?, phone1=?, phone2=?, fax=?, email=?, website=?, logo=?
               WHERE store_num=?'''
        d = (
            named,
            addr1,
            addr2,
            cityd,
            stated,
            zipd,
            phon1d,
            phon2d,
            faxd,
            emaild,
            sited,
            logod,
            storenumd,
        )
        r = SQConnect(q, d, sqlfile).ONE()
Exemple #7
0
 def GetInvCount(self):
     q = 'SELECT COUNT(*) FROM item_detailed'
     d = ()
     r = SQConnect(q, d, self.sql_file).ONE()
     return r