def button_edit(self): _session = self.session _amount = self.amountData.text() _teller = self.tellerData.text() _date = self.dateData.date().toPyDate() _date = time.mktime(_date.timetuple()) _description = self.descriptionData.toPlainText() _account = self.hold_account[self.accountData.currentIndex()] _expense = self.hold_expenses[self.expenseData.currentIndex()] if self.r1.isChecked(): _amount = float(_amount) else: _amount = float(_amount) * -1 arr = {} if _amount and not (_amount == 0) and int(_expense) > 0 and int(_account) > 0: arr['amount'] = _amount arr['datepaid'] = _date arr['description'] = _description arr['accountID'] = _account arr['expenseID'] = _expense arr['teller'] = _teller ups = {} ups['id'] = self.editID if int(self.editID) > 0: db = 'school_expenses' + str(_session) g = Db() g.update(db, arr, ups) if int(self.editID) > 0: self.button_reset()
def button_click(self, b): # shost is a QString object b.close() sid = self.sid mid = self.mid s2 = self.le2.text() s1 = self.le.itemData(self.le.currentIndex()) g = Db() try: if (int(s2) > 0): y = {'name': s1, 'abbrv': s2} z = {'id': mid} g.update('datas', y, z) else: pass except: pass try: self.lunchForm() except: pass try: self.close() except: pass
def setActive(self): g = Db() for i in self.hold_data: if self.hold_data[i].checkState(0) == Qt.Checked: g.update('datas', {'active': 0}, {'id': i}) else: g.update('datas', {'active': 1}, {'id': i})
def getChecked(self, a): g = Db() for i in self.hold_data: if self.hold_data[i].checkState(0) == Qt.Checked: g.update('datas', {'active': 0}, {'id': i}) else: g.update('datas', {'active': 1}, {'id': i}) if self.titleID == 1: #if class was changed only reload class menu on main window self.par.menuStudent() self.par.dropdownStudent()
def button_delete(self): row = self.getSelected() g = Db() try: if row and row > 0: y = {'abbrv': '', 'active': 2} z = {'id': row} g.update('datas', y, z) self.makeTree() else: pass except: pass
def button_click(self, a, b): # shost is a QString object b.close() s1 = self.le.text() s2 = self.le2.text() self.a = a g = Db() if (len(s1) > 0): y = {'name': s1.lower(), 'abbrv': s2.lower()} z = {'id': self.a} g.update('datas', y, z) self.form = SubjectForm() self.form.show() self.close()
def chkFunc(self, a, b): # shost is a QString object self.a = a self.b = b g = Db() g.update('session', {'active': 0}, {'active': 1}) if b.isChecked() == True: y = {'active': 1} else: y = {'active': 0} z = {'id': self.a} j = g.update('session', y, z) return j
def feeStudentsUpdate(self, session, students, fee, amount, sid): db = 'student_fee' + str(session) cn = Db() ed = [] ed1 = [] for s in students: datas = {} datas['studentID'] = s datas['feeID'] = fee #datas['active'] = sid data = {} data['studentID'] = s data['feeID'] = fee data['amount'] = amount data['active'] = sid e = cn.update(db, data, datas) if e == 1: ed1.append(e) else: e = cn.insert(db, data) ed.append(e) return [len(ed), len(ed1)]
def button_click(self, a, c, b): # shost is a QString object b.close() s1 = self.le.text() s2 = self.le2.text() fil = str(s3) + ":" + str(s4) + ":" + str(s5) self.a = a self.c = c g = Db() if (len(s1) > 0 and len(s2) > 0): y = {'name': s1, 'abbrv': s2, 'active': 0} z = {'id': self.a} g.update('datas', y, z) self.form = ExpenseTypeForm(self.c) self.form.show() self.close()
def button_edit(self): ailment = self.ailmentData.toPlainText() treatment = self.treatmentData.toPlainText() _date = self.dateData.date().toPyDate() _date = time.mktime(_date.timetuple()) db = 'school_medicals' + str(self.mainses) if len(ailment) > 0 and len(treatment) > 0: arr = {} arr['ailment'] = ailment arr['treatment'] = treatment arr['datepaid'] = _date g = Db() g.update(db, arr, {'id': self.mainrow}) ## set subject self.getValue()
def button_click(self, a): # shost is a QString object s1 = self.le.text() s2 = self.le2.text() self.a = a g = Db() if (len(s1) > 0): y = {'name': s1, 'abbrv': s2} z = {'id': self.a} return g.update('datas', y, z)
def button_click(self): subject = self.getValue() #clasz = self.classCombo.itemData(self.classCombo.currentIndex()) clasz = self.class_arr[self.classCombo.currentIndex()] ## set class g = Db() sel = g.selectn(self.db_class, '', 1, {'studentID': self.student}) if sel and sel['id'] > 0: if int(sel['classID']) == clasz: pass else: g.update(self.db_class, {'classID': clasz}, {'id': sel['id']}) else: g.insert(self.db_class, { 'studentID': self.student, 'classID': clasz }) if len(subject[0]) > 0: for a in subject[0]: sel = g.selectn(self.db_subject, '', 1, { 'studentID': self.student, 'subjectID': a }) if sel and int(sel['id']) > 0: pass else: g.insert(self.db_subject, { 'studentID': self.student, 'subjectID': a }) if len(subject[1]) > 0: for a in subject[1]: g.delete(self.db_subject, { 'studentID': self.student, 'subjectID': a }) ## set subject self.accept()
def button_click(self, a, b): # shost is a QString object b.close() s1 = self.le.text() s2 = self.le2.date().toPyDate() s3 = self.le3.date().toPyDate() self.a = a g = Db() if(len(s1) > 0): y = { 'name':s1, 'start_date':s2, 'end_date':s3} z = {'id':self.a} g.update('terms', y, z) if self.a and self.a > 0: g.createClass(self.a) g.createFee(self.a) g.createResult(self.a) self.form = TermForm(self.a) self.form.show() self.close()
def button_edit(self): action = self.actionData.toPlainText() reaction = self.reactionData.toPlainText() staff = self.staffData.text() _date = self.dateData.date().toPyDate() _date = time.mktime(_date.timetuple()) db = 'school_conducts' + str(self.sessionID) if len(action) > 0 and len(reaction) > 0: arr = {} arr['action'] = action arr['reaction'] = reaction arr['datepaid'] = _date arr['staffname'] = staff g = Db() g.update(db, arr, {'id': self.edit}) ## set subject self.getValue()
def button_save(self): row = self.editrow s1 = self.le1.text() s2 = self.le2.text() g = Db() try: if (len(s1) > 0) and (len(s2) > 0) and row and row > 0: y = {'name': s1.lower(), 'abbrv': s2.lower(), 'active': 0} z = {'id': row} g.update('datas', y, z) self.makeTree() self.button_reset() if self.titleID == 1: #if class was changed only relod class menu on main window self.par.menuStudent() self.par.dropdownStudent() else: pass except: pass
def button_click(self, a, c, b): # shost is a QString object b.close() s1 = self.le.text() s2 = self.le2.text() s3 = self.le3.text() s4 = self.le4.text() s5 = self.le5.text() fil = str(s3) + ":" + str(s4) + ":" + str(s5) self.a = a self.c = c g = Db() if (len(s1) > 0 and len(s2) > 0 and len(s3) > 0 and len(s4) > 0): y = {'name': s1, 'abbrv': s2, 'description': fil, 'active': 0} z = {'id': self.a} g.update('datas', y, z) self.form = GradingForm(self.c) self.form.show() self.close()
def button_click(self, b): set_arr = [] ass_arr = [] gra_arr = [] cla_arr = [] for i in self.set_arr: if self.set_arr[i].checkState(0) == Qt.Checked: set_arr.append(i) for i in self.ass_arr: if self.ass_arr[i].checkState(0) == Qt.Checked: ass_arr.append(i) for i in self.gra_arr: if self.gra_arr[i].checkState(0) == Qt.Checked: gra_arr.append(i) for i in self.cla_arr: if self.cla_arr[i].checkState(0) == Qt.Checked: cla_arr.append(i) title = self.titleData.text() themeColor = self.le5.text() themeFont = self.le6.text() cla_store = self.cla_arr cla_store = ','.join(str(x) for x in cla_store) set_arr = '::'.join(str(x) for x in set_arr) gra_arr = '::'.join(str(x) for x in gra_arr) ass_arr = '::'.join(str(x) for x in ass_arr) save1 = title.upper( ) + ':::' + themeColor + ':::' + themeFont + ':::' + ass_arr + ':::' + gra_arr + ':::' + set_arr g = Db() try: if (len(title) > 0): y = { 'name': cla_store, 'subID': self.term, 'description': save1 } h = g.update('datas', y, {'id': self.row}) else: pass except: pass self.button_close(self)
def button_click(self, a, b): # shost is a QString object b.close() s1 = self.le.text() s2 = self.le2.date().toPyDate() s3 = self.le3.date().toPyDate() self.a = a g = Db() if (len(s1) > 0): y = {'name': s1, 'start_date': s2, 'end_date': s3} z = {'id': self.a} g.update('session', y, z) if z and z > 0: g.createExpenses(self.a) g.createStores(self.a) g.createAwards(self.a) g.createConducts(self.a) g.createMails(self.a) g.createMedicals(self.a) self.form = SessionForm() self.form.show() self.close()
def button_click(self): arr = {} arr['namex'] = self.schoolNameData.text() arr['alias'] = self.schoolAliasData.text() arr['motto'] = self.schoolMottoData.text() arr['address'] = self.schoolAddressData.text() arr['city'] = self.schoolCityData.text() arr['country'] = self.schoolCountryData.text() arr['state'] = self.schoolStateData.text() arr['email1'] = self.schoolEmail1Data.text() arr['email2'] = self.schoolEmail2Data.text() arr['phone1'] = self.schoolPhone1Data.text() arr['phone2'] = self.schoolPhone2Data.text() arr['zip'] = self.schoolZipData.text() arr['pmb'] = self.schoolPmbData.text() arr['color1'] = self.colorPrimaryLbl.text() arr['color2'] = self.colorSecondaryLbl.text() #print(arr) db = 'datas' g = Db() for a in arr: s = g.selectn(db , '', 1, {'pubID':'datas', 'name':a}) if s and s['id'] > 0: if arr[a] and len(arr[a]) > 0: g.update(db, {'description': arr[a]}, {'id':s['id']}) else: g.delete(db, {'id':s['id']}) else: if arr[a] and len(arr[a]) > 0: print(arr[a]) g.insert(db, {'pubID': 'datas', 'name':a, 'description': arr[a]}) self.button_close(self)
def getChecked(self, a): arr_hold = [] g = Db() for i in self.hold_data: if self.hold_data[i].checkState(0) == Qt.Checked: arr_hold.append(i) self.hold_data[i].setCheckState(0, Qt.Checked) g.update('terms', {'active': 0}, {'active': 1}) g.update('terms', {'active': 1}, {'id': i}) tt = g.selectn('terms', '', 1, {'id': i}) g.update('session', {'active': 0}, {'active': 1}) g.update('session', {'active': 1}, {'id': tt['sessionID']}) g.selectn('session', '', 1, {'id': tt['sessionID']}) else: self.hold_data[i].setCheckState(0, Qt.Unchecked) self.reloadTerm()
def chkFunc(self, a, b): # shost is a QString object self.a = a self.b = b if b.isChecked() == True: y = {'active': 0} else: y = {'active': 1} g = Db() z = {'id': self.a} j = g.update('datas', y, z) return j
def classMoveStudent(self, session, moveclass, students): session = session classtable = 'student_class'+str(session) arr = [] g = Db() for student in students: f = g.select(classtable, '', 1, {'studentID':student}) if f and int(f[0]) > 1: h = g.update(classtable, {'classID': moveclass}, {'id': f[0]}) h = f[0] else: h = g.insert(classtable, {'studentID': student, 'classID': moveclass,'active': 0}) arr.append(h) return arr
def button_click(self): tex = ' Please wait processing, do not cancel or close..' self.feesPop.setText(tex) _term = self.term _class = self.cla _students = self.students _amount = self.feesAmount.text() _fee = self.hol[self.feesCombo.currentIndex()] feeStudent = 0 feeStudentUp = 0 ins = [] ups = [] for j in _class: st = self.getClassStudent([j]) post = StudentTable(self.term, [None], [None], [None]) _students = post.getIDs(st[1]) data = {} data['pubID'] = 'fee' data['subID'] = _term data['abbrv'] = _fee data['name'] = j cn = Db() check = cn.selectn('datas', '', 1, data) if (check and check['id'] > 0): if float(check['description']) == float(_amount): pass else: #update sid = cn.update('datas', {'description': _amount}, {'id': check['id']}) re = self.feeStudentsUpdate(_term, _students, _fee, _amount, check['id']) feeStudent = re[0] feeStudentUp = re[1] else: data['description'] = _amount sid = cn.insert('datas', data) if int(sid) > 0: feeStudent = self.feeStudents(_term, _students, _fee, _amount, sid) ins.append(int(feeStudent)) ups.append(int(feeStudentUp)) tex = ' TOTAL of ' + str(sum(ins)) + ' inserted ' + str( sum(ups)) + ' updated.' self.feesPop.setText(tex)
def button1_click(self, a): # shost is a QString object arr = {} arr['schno'] = self.schnoData.text() arr['surname'] = self.surnameData.text() arr['firstname'] = self.firstnameData.text() arr['othername'] = self.middlenameData.text() arr['soo'] = self.sooData.text() arr['lga'] = self.lgaData.text() arr['addr'] = self.addrData.toPlainText() dob = self.dobData.date() arr['dob'] = dob.toPyDate() admit = self.admitData.date() arr['admit'] = admit.toPyDate() arr['active'] = 0 arr['g1'] = self.g1Data.text() arr['g1rel'] = self.g1relData.itemData(self.g1relData.currentIndex()) arr['g1p1'] = self.g1p1Data.text() arr['g1p2'] = self.g1p2Data.text() arr['g1email'] = self.g1emailData.text() arr['g1addr'] = self.g1addData.text() arr['g2'] = self.g2Data.text() arr['g2rel'] = self.g2relData.itemData(self.g2relData.currentIndex()) arr['g2p1'] = self.g2p1Data.text() arr['g2p2'] = self.g2p2Data.text() arr['g2email'] = self.g2emailData.text() arr['g2addr'] = self.g2addData.text() self.a = a print(arr) g = Db() if ((arr['surname']) and (arr['firstname']) and (arr['schno'])): r = g.update('students', arr, {'id': self.a}) print(r) self.close()
def lunchDeleteForm(self, row): cn = Db() arr = cn.update('datas', {"active": 1}) self.close() self.__init__(self.term, self.termname)
def button_save(self): row = self.editrow s1 = self.le1.text() _datef = self.fromData.date().toPyDate() _datef = time.mktime(_datef.timetuple()) _datee = self.toData.date().toPyDate() _datee = time.mktime(_datee.timetuple()) g = Db() if (len(s1) > 0) and row and row > 0: if self.sessionID and self.sessionID > 0: try: if (len(s1) > 0): y = { 'name': s1.lower(), 'start_date': _datef, 'sessionID': self.sessionID, 'end_date': _datee, 'active': 0 } k = {'id': row} g.update('terms', y, k) z = row if z and z > 0: g.createClass(z) g.createSubject(z) g.createFee(z) g.createPay(z) g.createResult(z) g.createAffective(z) g.createPsychomoto(z) self.makeTree() self.button_reset() self.par.menuSession() self.par.dropdownSession() else: pass except: pass else: try: if (len(s1) > 0): y = { 'name': s1.lower(), 'start_date': _datef, 'end_date': _datee, 'active': 0 } k = {'id': row} g.update('session', y, k) z = row if z and z > 0: g.createExpenses(z) g.createStores(z) g.createAwards(z) g.createConducts(z) g.createMails(z) g.createMedicals(z) self.makeTree() self.button_reset() self.par.menuSession() self.par.dropdownSession() else: pass except: pass
def button_edit(self): _session = self.session _amounts = self.amountData.text() _teller = self.tellerData.text() _quantity = self.quantityData.text() _person = self.personData.text() _period = self.periodData.text() _date = self.dateData.date().toPyDate() _date = time.mktime(_date.timetuple()) _description = self.descriptionData.toPlainText() _store = self.hold_store[self.storeData.currentIndex()] _borrowed = self.hold_borrowed[self.borrowedData.currentIndex()] arr = {} #recieved if self.r1.isChecked() and _amounts and not ( _amounts == 0) and int(_store) > 0 and int(_quantity) > 0: _amount = float(_amounts) / float(_quantity) arr['amount'] = _amount arr['datepaid'] = _date arr['description'] = _description arr['itemID'] = _store arr['teller'] = _teller arr['quantity'] = _quantity arr['person'] = _person arr['state'] = 1 #issued elif self.r2.isChecked() and int(_store) > 0 and int(_quantity) > 0: _amount = float(_amounts) / float(_quantity) arr['amount'] = _amount arr['datepaid'] = _date arr['description'] = _description arr['itemID'] = _store arr['teller'] = _teller arr['quantity'] = _quantity arr['person'] = _person arr['state'] = 2 #damaged elif self.r3.isChecked() and int(_store) > 0 and int(_quantity) > 0: arr['datepaid'] = _date arr['description'] = _description arr['itemID'] = _store arr['teller'] = _teller arr['quantity'] = _quantity arr['person'] = _person arr['state'] = 3 elif self.r4.isChecked() and int(_store) > 0 and int(_quantity) > 0: arr['datepaid'] = _date arr['description'] = _description arr['itemID'] = _store arr['quantity'] = _quantity arr['person'] = _person arr['period'] = _period arr['state'] = 4 elif self.r5.isChecked() and int(_store) > 0 and int(_quantity) > 0: _borrowed = self.hold_borrowed[self.borrowedData.currentIndex()] arr['datepaid'] = _date arr['description'] = _description arr['itemID'] = _store arr['quantity'] = _quantity arr['person'] = _person arr['period'] = _period arr['active'] = _borrowed arr['state'] = 5 ups = {} ups['id'] = self.editID if int(self.editID) > 0 and len(arr) > 0: db = 'school_stores' + str(_session) g = Db() g.update(db, arr, ups) if int(self.editID) > 0: self.button_reset()