def button_add(self): 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 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 } z = g.insert('terms', y) 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 } z = g.insert('session', y) 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_add(self): s1 = self.le1.text() s2 = self.le2.text() g = Db() try: if (len(s1) > 0) and (len(s2) > 0): if self.sessionMain == 0: y = { 'name': s1.lower(), 'abbrv': s2.lower(), 'pubID': self.titleID, 'active': 0 } else: y = { 'name': s1.lower(), 'abbrv': s2.lower(), 'subID': self.sessionMain, 'pubID': self.titleIDx, 'active': 0 } g.insert('datas', y) 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): 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()] for j in _class: data = {} data['pubID'] = 'fee' data['subID'] = _term data['abbrv'] = _fee data['name'] = j cn = Db() feeStudent = self.feeStudents(_term, _students, _fee, _amount) check = cn.selectn('datas', '', 1, data) if (check and check['id'] == 0): pass else: data['description'] = _amount cn.insert('datas', data) ins = feeStudent tex = ' TOTAL of ' + str(ins) + ' inserted' self.feesPop.setText(tex)
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, 'subID': self.a, 'abbrv': s2} g.insert('datas', y) self.repaint()
def setSubject(self, a, b): session = self.session db = 'student_subject' + str(session) g = Db() for i in a: for j in b: f = g.selectn(db, '', 1, {'studentID': i, 'subjectID': j}) if f and f['id'] > 0: pass else: g.insert(db, {'studentID': i, 'subjectID': j})
def button_click(self, b): # shost is a QString object b.close() sid = self.sid s2 = self.le2.text() s1 = self.le.itemData(self.le.currentIndex()) g = Db() try: if (int(s2) > 0): y = { 'name': s1, 'subID': sid, 'pubID': 'ca', 'abbrv': s2, 'active': 0 } h = g.insert('datas', y) else: pass except: pass try: self.lunchForm() except: pass try: self.close() except: pass
def button_click(self, a): # shost is a QString object a.close() s1 = self.le.text() s2 = self.le2.date().toPyDate() s3 = self.le3.date().toPyDate() g = Db() try: if (len(s1) > 0): y = {'name': s1, 'start_date': s2, 'end_date': s3, 'active': 0} z = g.insert('session', y) if z and z > 0: g.createExpenses(z) g.createStores(z) g.createAwards(z) g.createConducts(z) g.createMails(z) g.createMedicals(z) else: pass except: pass try: self.button_close() except: pass try: self.close() except: pass
def button_click(self, a, b): # shost is a QString object b.close() self.a = a s1 = self.le.text() g = Db() try: if(len(s1) > 0): y = { 'name':s1, 'sessionID':self.a, 'start_date':s2, 'end_date':s3, 'active':0} z = g.insert('terms', y) if z and z > 0: g.createClass(z) g.createFee(z) g.createResult(z) else: pass except: pass try: self.lunchForm(self.a) except: pass try: self.close() except: pass
def button_click(self, a): # shost is a QString object a.close() s1 = self.le.text() s2 = self.le2.text() g = Db() try: if (len(s1) > 0) and (len(s2) > 0): y = { 'name': s1.lower(), 'abbrv': s2.lower(), 'pubID': 11, 'active': 0 } k = g.insert('datas', y) print(k) else: pass except: pass try: self.lunchForm() except: pass try: self.close() except: pass
def button_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 if self.r1.isChecked(): arr['gender'] = 0 else: arr['gender'] = 1 self.a = a g = Db() if ((arr['surname']) and (arr['firstname']) and (arr['schno'])): h = g.insert('students', arr) self.contFill(h)
def button_click(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 db = 'school_expenses' + str(_session) g = Db() ins = g.insert(db, arr) if int(ins) > 0: self.button_reset()
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_template(self, b): template = self.lTemplate.text() template =template.lower() if(len(template) > 0): g = Db() Ch = g.selectn('datas', '', 1, {'abbrv':template, 'pubID': 'temp'}) if Ch and Ch['id'] > 0: self.rTemplate.setText('Failed: Name already exist.') else: 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 try: if(len(title) > 0): y = { 'name':cla_store, 'subID':self.term, 'pubID':'temp', 'abbrv':template, 'description': save1, 'active':0} h = g.insert('datas', y) self.button_click() else: pass except: pass else: self.rTemplate.setText('Please give the template a name')
def button_click(self): ailment = self.ailmentData.toPlainText() treatment = self.treatmentData.toPlainText() _date = self.dateData.date().toPyDate() _date = time.mktime(_date.timetuple()) db = 'school_medicals' + str(self.sessionID) if len(ailment) > 0 and len(treatment) > 0: arr = {} arr['studentID'] = self.student arr['ailment'] = ailment arr['treatment'] = treatment arr['datepaid'] = _date g = Db() g.insert(db, arr) ## set subject self.getValue()
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, 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, 'pubID': 'rep', 'abbrv': 'rep', 'description': save1, 'active': 0 } h = g.insert('datas', y) else: pass except: pass self.button_close(self)
def button_click(self): fname = self.mainLink im1 = fname file1 = 'pic_thumb/' file2 = 'pic_main/' lnk = "logo.png" im1.thumbnail((128, 128)) im1.save(file1 + lnk, "PNG" ) im1.thumbnail((300, 300)) im1.save(file2 + lnk, "PNG") g = Db() sel = g.selectn('datas', '', 1, {'pubID':'datas', 'name':'logo'}) if sel and sel['id'] > 0: pass else: g.insert('datas', {'pubID':'datas', 'name':'logo', 'description': lnk}) self.setCurrentPix() self.button_close(self)
def button_click(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['studentID'] = self.student arr['action'] = action arr['reaction'] = reaction arr['datepaid'] = _date arr['staffname'] = staff arr['state'] = 1 g = Db() g.insert(db, arr) ## set subject self.getValue()
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 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 feeStudents(self, session, students, fee, amount): db = 'student_fee' + str(session) cn = Db() fd = [] ed = [] for s in students: data = {} data['studentID'] = s[0] data['feeID'] = fee chk = cn.selectn(db, '', 1, data) if (chk and int(chk['id']) > 0): #confirm if money available pass else: #if money not set , set e = cn.insert(db, data) ed.append(e) return len(ed)
def button_click(self, a, b): # shost is a QString object b.close() self.a = a 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) g = Db() try: if (len(s1) > 0 and len(s2) > 0 and len(s3) > 0 and len(s4) > 0): y = { 'name': s1, 'abbrv': s2, 'pubID': 12, 'subID': self.a, 'description': fil, 'active': 0 } w = g.insert('datas', y) print(w) else: pass except: pass try: self.lunchForm(self.a) except: pass try: self.close() except: pass
def button_click(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()] 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 _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'] = 2 #damaged elif self.r3.isChecked() and int(_store) > 0 and int( float(_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( float(_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( float(_quantity)) > 0 and self.borrowedData.currentIndex() > 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 if len(arr) > 0: db = 'school_stores' + str(_session) g = Db() ins = g.insert(db, arr) if int(ins) > 0: self.button_reset()
def chkFunc1(self, a, b, c): # checkbox select to make fuul payment self.a = a db_fee = 'student_fee' + str(self.term) db_pay = 'student_pay' + str(self.term) amount = self.payAmount.text() teller = self.teller.text() # get all paments made for that fee # get the check box g = Db() fee = g.selectn(db_fee, '', 1, {'id': a}) loc = self.holdfee[b] payfull = self.holdtextfee[b] pocc = self.holdpaid[b] poc = self.holdcpaid[b] d = pocc.text() try: ## fee was checked full pay ## confirm if money posted and its greater than or equals # confimr if teller number was provided ## if those conditions are met payment of fees is possible if (float(amount) >= float(d)) and len(str(teller)) > 0: # confirm if the checkbox was checked if poc.isChecked() == True: #if it was checked prepare to insert payment data pay = {} pay['studentID'] = self.student pay['accountID'] = self.payAmount.text() pay['teller'] = teller pay['feeID'] = fee['feeID'] pay['datepaid'] = self.payDate.date().toPyDate() # however confirm if full payment had bee made b4 dat = g.selectn(db_pay, '', '', { 'studentID': self.student, 'feeID': fee['feeID'] }) if dat and len(dat) > 0: mon = list() for dd in dat: mon.append(float(dd['amount'])) # full payment made # dont post # keep part pay disabled total_money_paid = sum(mon) #no payments required if float(total_money_paid) >= float(payfull): pass #payment required elif float(total_money_paid) < float(payfull): if float(amount) >= float(d): pay['amount'] = d #post h = g.insert(db_pay, pay) if int(h) > 0: # deduct from balance # keep part pay disabled] loc.hide() pocc.setDisabled(True) # recalculate self.reCalFull() self.reCalPart() self.reCalSingleBal() else: poc.show() else: msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setWindowTitle("Info") msg.setText("Insufficient funds.") msg.setStandardButtons(QMessageBox.Cancel) msg.exec_() loc.hide() pocc.setDisabled(True) # inform user else: # post payment if float(amount) >= float(d): pay['amount'] = d #post h = g.insert(db_pay, pay) if int(h) > 0: # deduct from balance # keep part pay disabled] loc.hide() pocc.setDisabled(True) # recalculate self.reCalFull() self.reCalSingleBal() else: poc.show() # money was not posted if len(str(self.teller.text())) > 0: pay = {} pay['studentID'] = self.student pay['teller'] = self.teller.text() pay['feeID'] = fee['feeID'] h = g.delete(db_pay, pay) poc.show() pocc.show() self.reCalFull() self.reCalSingleBal() else: msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setWindowTitle("Info") msg.setText( "Please provide the teller/receipt details before removing amount." ) msg.setStandardButtons(QMessageBox.Cancel) msg.exec_() #add to money ## if those conditions are not met # payment of fees is not possible # however user might want to revoke a payment # meaning checkbox was unchecked else: if loc.isChecked() == False: # prepare to remove payment pay = {} pay['studentID'] = self.student pay['teller'] = self.teller.text() pay['feeID'] = fee['feeID'] # remove payment h = g.delete(db_pay, pay) # confirm if removal was succesful if h == 1: # if successful poc.show() pocc.show() # refund balance # recalculate self.reCalFull() self.reCalSingleBal() else: # not sussefull # details not complete #restore it to check #loc.setChecked(True) poc.hide() pocc.hide() # inform user msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setWindowTitle("Safety Measure:") msg.setText( "You will need to enter the correct teller/receipt details for this payment before removing it" ) msg.setStandardButtons(QMessageBox.Cancel) msg.exec_() # user trying to make payment with no funds else: # uncheck user loc.setChecked(False) poc.show() pocc.show() #give info msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setWindowTitle(" Payment Error") msg.setText( "Please provide teller/receipt details or Insufficient funds to make full payments " ) msg.setStandardButtons(QMessageBox.Cancel) msg.exec_() except: if loc.isChecked() == False: # money was not posted if len(str(self.teller.text())) > 0: pay = {} pay['studentID'] = self.student pay['teller'] = self.teller.text() pay['feeID'] = fee['feeID'] h = g.delete(db_pay, pay) poc.show() pocc.show() self.reCalFull() self.reCalSingleBal() else: pass else: loc.setChecked(False) poc.show() pocc.show() msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setWindowTitle(" Payment Error:") msg.setText("Please insert amount and Teller/Receipt details ") msg.setStandardButtons(QMessageBox.Cancel) msg.exec_()
arr['surname'] = words() arr['firstname'] = words() arr['othername'] = words() arr['soo'] = random.choice(['kaduna', 'osun','enugu', 'ekiti', 'kano', 'lagos', 'plateau', 'benue']) arr['lga'] = random.choice(['chikun', 'ife','ileku', 'ikeja', 'ilesha', 'jos']) arr['nation'] = 'nigeria' arr['gender'] = random.choice([0, 1]) arr['addr'] = addrs() arr['dob'] = rdate() arr['admit'] = rdates() arr['g1'] = arr['surname']+' '+words()+' '+words() arr['g1rel'] = random.choice(relations) arr['g1p1'] = phons() arr['g1p2'] = phons() arr['g1email'] = arr['surname']+'@'+random.choice(['yahoo', 'gmail'])+'.com' arr['g1addr'] = addrs() arr['g2'] = arr['firstname']+' '+words()+' '+words() arr['g2rel'] = random.choice(relations) arr['g2p1'] = phons() arr['g2p2'] = phons() arr['g2email'] = words()+'@'+random.choice(['yahoo', 'gmail', 'hotmail'])+'.com' arr['g2addr'] = addrs() arr['active'] = random.choice([0,0,0,0,0,0,0,1]) if((arr['surname'] > 0) and (arr['firstname'] > 0) and (arr['surname'] > 0)): g.insert('students', arr) # print(surname)