示例#1
0
 def displayData(self, student_id):
     #rint'panel_student_details.displayData', student_id
     return
     self.panel_student_bio.displayData(student_id)
     self.contact_panels=[]
     
     if student_id:
         sql = "SELECT mother_id, father_id, guardian_id \
                  FROM students \
                 WHERE id = %d" % int(student_id)
         details = fetch.getOneDict(sql)
         #rintsql, details
         if not details:
             #rint'no guardians'
             return
         mother_id   = details['mother_id']
         father_id   = details['mother_id']
         guardian_id = details['guardian_id']
         
         if father_id:
             sql = "SELECT * \
                      FROM guardians \
                     WHERE id = %d" % int(mother_id)
             details = fetch.getOneDict(sql)
 
             if details['name']:
                 p=self.OnAddGuardian(wx.Event)
                 p.head('FATHER')
                 p.displayData(student_id, mother_id, 'father')
                 
         if mother_id:
             sql = "SELECT * FROM guardians \
                     WHERE id = %d" % int(mother_id)
             details = fetch.getOneDict(sql)
 
             if details['name']:
                 ##rintdetails['name']
                 p=self.OnAddGuardian(wx.Event)
                 p.head('MOTHER')
                 #p.labelHead.SetBackgroundColour((255, 200, 255))
                 p.displayData(student_id, mother_id, 'mother')
                 
         if guardian_id:
             sql = "SELECT * \
                      FROM guardians \
                     WHERE id = %d" % int(guardian_id)
             details = fetch.getOneDict(sql)
             
             p = self.OnAddGuardian()
             p.head('GUARDIAN')
             
             p.displayData(student_id, guardian_id, 'guardian')
             
     self.Layout()
示例#2
0
    def displayData(self, student_id, NoInduk, form_id):
        #rint'panel_edit_booking_status : displayData'
        
        loadCmb.courses_forYear(self.choice_course, gVar.schYr+1)
        self.form_id  = form_id
        
        # query for rereg
        sql = "SELECT s.id, s.name sbf.rereg_status \
                 FROM students s  \
                 JOIN students_by_form sbf ON sbf.student_id = s.id \
                WHERE s.id = d \
                  AND sbf.form_id = %d" % (student_id, form_id)
        res = fetch.getOneDict(sql)

        name = res['name']
        self.text_ctrl_name.SetValue(name)
        
        rereg_statusData = res['rereg_status']
        
        if rereg_statusData:
            rereg_statusData = rereg_statusData.split(',')
            rereg_status = rereg_statusData[0]
            if not rereg_status:
                rereg_status ='?'
        
        else:
            rereg_status = "?"
            
        try:
            course_id    = rereg_statusData[1]
        except:
            course_id = 0
        try:
            refNo = rereg_statusData[2]
        except:
            refNo = ''    
        
        
        self.showHideCourses(rereg_status =='continue')# or rereg_status =='retake')
        
        if rereg_status =='?':
            self.choice_status.Select(0) # ?
            
        else:
            if rereg_status == "exit":
                self.choice_status.Select(3) 
                
            elif rereg_status == "retake":
                self.choice_status.Select(2)
                #loadCmb.restore(self.choice_course, course_id)
                
            elif rereg_status == "continue":
                #rint"rereg_status == continue"
                self.choice_status.Select(1)
                loadCmb.restore(self.choice_course, course_id)
    
        self.text_ctrl_refNo.SetValue('')
        self.Layout()
示例#3
0
    def displayData(self, student_id):
        #rint'displayData:',student_id
        if not student_id:  self.clearCtrls()
        
        self.panel_studentView.displayData(student_id)
        
        sql = "SELECT KOrangTua, KWali \
                 FROM Siswa \
                WHERE CKID = %d" % int(student_id)
        details = fetch.getOneDict(sql)
        #rintsql, details
        if not details: return
        KOrangTua = details['KOrangTua']
        KWali     = details['KWali']
        
        if KOrangTua:
            sql = "SELECT * FROM OrangTua \
                WHERE Kode = %d" % int(KOrangTua)
            details = fetch.getOneDict(sql)

            if details['NamaA']:
                ##rintdetails['NamaA']
                p=self.OnAddGuardian(wx.Event)
                p.head('FATHER')
                #p.labelHead.SetBackgroundColour((255, 200, 255))
                p.displayData(student_id, KOrangTua, 'father')
                
            if details['NamaI']:
                ##rintdetails['NamaI']
                p=self.OnAddGuardian(wx.Event)
                p.head('MOTHER')
                #p.labelHead.SetBackgroundColour((255, 255, 200))
                p.displayData(student_id, KOrangTua, 'mother')
                
        if KWali:
            sql = "SELECT * FROM Wali \
                WHERE Kode = %d" % int(KWali)
            details = fetch.getOneDict(sql)
            ##rintsql, details
            p = self.OnAddGuardian(wx.Event)
            p.head('GUARDIAN')
            #p.labelHead.SetBackgroundColour((200, 255, 255))
            p.displayData(student_id, KWali, 'guardian')
示例#4
0
    def student_has_other_guardian(self, student_id):
	sql = "SELECT father_id, mother_id, guardian_id FROM students WHERE id = %d" % student_id
	res = fetch.getOneDict(sql)
	father_id   = res['father_id']
	mother_id   = res['mother_id']
	guardian_id = res['guardian_id']
	
    
	if father_id or mother_id or guardian_id:
	    return True
	else:
	    return False
示例#5
0
    def displayData(self, student_id):
        self.student_id = student_id
        #rint'panel_guardian_details > student_id', student_id
        sql = "SELECT father_id, mother_id, guardian_id FROM students WHERE id=%d" % student_id
        ##rintsql
        student_details = fetch.getOneDict(sql)
        
 
        father_id   = student_details['father_id']
        mother_id   = student_details['mother_id']
        guardian_id = student_details['guardian_id']
        
        self.notebook_pane_1.displayData('father',   father_id,   self.student_id)
        self.notebook_pane_2.displayData('mother',   mother_id,   self.student_id)
        self.notebook_pane_3.displayData('guardian', guardian_id, self.student_id)
示例#6
0
    def invoice_details(self, invoice_id):
        sql = "SELECT item_name, qnty, price, total_amount \
                 FROM acc_invoice_items \
                WHERE invoice_id =%d \
                ORDER BY id" % invoice_id
        item_list = fetch.getAllDict(sql)

        sql = "SELECT i.amount, i.ck_ref, i.date, i.schYr, s.name, s.NoInduk, f.name AS form_name \
                 FROM acc_invoices i \
                 JOIN students s ON s.id=i.student_id \
                 JOIN students_by_form sbf ON sbf.student_id = s.id \
                 JOIN forms f ON sbf.form_id = f.id \
                WHERE i.id=%d" % invoice_id
        inv_details = fetch.getOneDict(sql)

        return (inv_details, item_list)
示例#7
0
    def OnPostcode(self, evt):
        #rint'OnPostcode'
        if self.numCtrlActive:  return
        
        postcode = self.num_ctrl_postcode.GetValue()
        if postcode:
            for c in self.combos: c.SetSelection(-1)
            sql = "SELECT id, itemName \
                     FROM address_items \
                    WHERE itemType= 'kecamatan' \
		      AND postcode = %d" % postcode
            res = fetch.getOneDict(sql)
            if res:
                iid  = res['id']
                kecamatan = res['itemName']
                loadCmb.restore(self.combo_kecamatan, iid)
                #fetch.msg('postcode')
                self.loadCmbsUnderKecID(iid)
示例#8
0
    def displayData(self, student_id, NoInduk, KKelas):
        #rint"panel_edit_rereg_status : displayData"
        # query for bookings
        #sql = "SELECT Kode, Nama, Status FROM CSiswa WHERE Kode%d" % student_id
        loadCmb.courses_forYear(self.choice_course, gVar.schYr+1)
        self.KKelas  = KKelas
        self.NoInduk = NoInduk
        # query for rereg
        sql = "SELECT s.id, s.NoInduk, s.name, sbf.rereg_status, sbf.next_course_id \
                 FROM students_by_form \
                 JOIN students ON sbf.student_id = Siswa.id \
                WHERE sbf.student_id = '%s' \
                  AND f.id = %d" % (student_id, form_id)
        res = fetch.getOneDict(sql)
        
        self.next_level = fetch.form_level(KKelas)+1
        
        #rintsql, res
        if res:
            name = res['Nama']
            self.text_ctrl_name.SetValue(name)
            
            rereg_status = res['ReregStatus']
            course_id    = res['NextCourseID']
            
            if rereg_status =='?':
                self.choice_status.Select(0) # ?
                        
            elif rereg_status == "continue":
                #rint "continue"
                loadCmb.courses_forLevel_forYear(self.choice_course, gVar.schYr+1, self.next_level)
                loadCmb.restore(self.choice_course, course_id)
                    
            elif rereg_status == "retake":
                    self.choice_status.Select(2)    
            
            elif rereg_status == "exit":
                    self.choice_status.Select(3)
                    
            self.showHideCourses(rereg_status =='continue' or rereg_status =='retake')

            self.text_ctrl_refNo.SetValue('')
            self.Layout()
示例#9
0
 def displaySelected(self):
     self.text_ctrl_supplier_name.SetValue('')
     self.text_ctrl_supplier_address.SetValue('')
     self.text_ctrl_supplier_telp.SetValue('')
          
     sql = "SELECT name, address, telp FROM suppliers WHERE id = %d" % self.sid
     supplier = fetch.getOneDict(sql)
     
     if supplier:
         name = supplier['name']
         address = supplier['address']
         telp = supplier['telp']
         
         if not name    : name =''
         if not address : address = ''
         if not telp    : telp   = ''
         
         self.text_ctrl_supplier_name.SetValue(name)
         self.text_ctrl_supplier_address.SetValue(str(address))
         self.text_ctrl_supplier_telp.SetValue(str(telp))
示例#10
0
 def OnSelectCell(self, pos):
     #rint'OnSelectCell', pos
     row, col = pos
     if not row or not col: return
     
     sid = self.grid.GetCellValue(row, 0)
     txt = 'Record: %s/%s' % (row+1, self.records)
     self.text_ctrl_records.SetValue(txt)
     
     
     if sid:
         sql = "SELECT ck_ref,  supplier_ref \
                  FROM acc_journal  \
                 WHERE id = %d" % int(sid)
         res = fetch.getOneDict(sql)
         #rintsql, res
         if res:
             ck_ref,  supplier_ref = res['ck_ref'], res['supplier_ref']
             self.text_ctrl_ref_ck.SetValue(str(ck_ref))
             self.text_ctrl_ref_supplier.SetValue(str(supplier_ref))
示例#11
0
    def displayData(self, jid=0):
        self.jurnal_id = jid
        
        
        self.loadSuppliers()
        self.loadDivisions()
        self.loadAccounts()
        
        if jid:
            self.jurnal_id = jid
            txt = 'Edit Transaction No. %d' % self.jurnal_id
            self.SetTitle(txt)
            
            sql = "SELECT Kode, Tanggal, Transaksi + Keterangan AS description, \
                          NoBuktiKantor, NoBuktiSuplier, KSuplier, KDivisi, PettyCash \
                     FROM Jurnal \
                    WHERE Kode = %d" % self.jurnal_id
            res = fetch.getOneDict(sql)
            #rintsql, res

            
            
            
            self.checkbox_pettycash.SetValue(res['PettyCash'])
            #self.text_ctrl_nobuktikantor.SetValue(res['NoBuktiKantor'])
            self.datepicker_ctrl_1.SetValue(res['Tanggal'])
            self.text_ctrl_tans_descript.SetValue(res['description'])
            self.text_ctrl_supplierrefno.SetValue(res['NoBuktiSuplier'])
            
            loadCmb.restore(self.choice_supplier, res['KSuplier'])
            loadCmb.restore(self.choice_division, res['KDivisi'])
            
            self.listDebitItems()
            self.listCreditItems()
            
        else:
            self.jurnal_id = fetch.nextID('Jurnal')
            
        self.text_ctrl_ckrefno.SetValue(str(self.jurnal_id))    
示例#12
0
    def loadData(self, guardian_id):
	sql = "SELECT * \
                 FROM guardians \
		WHERE id = %d" % guardian_id
	
        res = fetch.getOneDict(sql)
	if not res: return

	name     = res['name']
	address  = res['address']
	faith_id = res['faith_id']
	dob      = res['dob']
	telp     = res['telp']
	hp       = res['hp']
	wilayah  = res['wilayah']
	pob      = res['pob']
	occupation_main_id = res['occupation_main_id']
	occupation_other   = res['occupation_other']
	nationality        = res['nationality']

	return (name, address, faith_id, dob, telp, hp, wilayah, 
		pob, occupation_main_id, occupation_other, nationality)
示例#13
0
    def displayData(self):
        self.student_id = student_id = gVar.student_id
        #return
        #rint"panel_edit_booking : displayData"
        self.clearCtrls()
        
        if student_id == 0:
            self.enableCtrls(True)
            self.button_edit.SetLabelText('Cancel')
            sql = "SELECT MAX (id) FROM students"
            student_id = fetch.getDig(sql)+1
            self.label_ctrl_booking_id.SetLabelText(str(student_id))
            
        else:
            self.button_save.Hide()
            self.button_edit.SetLabelText('Edit')
            self.enableCtrls(False)
            
        loadCmb.courses_forYear(self.choice_joining_course, gVar.schYr)

        self.text_ctrl_student_name.Enable(student_id == 0)
        if student_id:
            
            sql = "SELECT * FROM students WHERE student_id = %d" % int(student_id)
            res = fetch.getOneDict(sql)

            name                 = res['name']
            student_id           = res['student_id']
            gender               = res['gender']
            register_course_id   = res['register_course_id']
            registration_status  = res['reg_status']
            dob                  = res['dob']
            schYr                = res['register_schYr']
  
            self.label_heading.SetLabelText('Editing Booking For:')
            self.label_ctrl_booking_id.SetLabelText(str(student_id))
    
            self.text_ctrl_student_name.SetValue(name)

            if gender:
                self.choice_gender.SetSelection(0)
            else:
                self.choice_gender.SetSelection(1)
            
            self.date_dob.SetValue(dob)
            
            course_id = res['register_course_id']
            loadCmb.restore(self.choice_joining_course, course_id)
            
            #KSekolahPindah = res['KSekolahPindah']
            #loadCmb.restore(self.choice_previous_school, KSekolahPindah)

            #if not registration_status: registration_status = 0
            loadCmb.restore(self.choice_status, registration_status)
            
            sql = "SELECT * \
                     FROM acc_invoices i \
                     JOIN acc_invoice_items ii ON ii.invoice_id = i.id \
                    WHERE i.student_id = %d ORDER BY (ck_ref)" % gVar.student_id
            res = fetch.getAllDict(sql)

            mystr =""
            for r in res: 
                k = r.pop('student_id')
                
                ck_ref = r.pop('ck_ref')
                mystr += '%s : %s \n' % ('ck_ref', ck_ref)
                
                date = r.pop('Tanggal')
                mystr += '%s : %s \n' % ('Date', date)
                
                for key in r:
                    val = r[key]
                    if val: 
                        l = '%s : %s \n' % (key, r[key])
                        mystr += l
                mystr += "\n"    
   
            self.text_ctrl_notes.SetValue(mystr)
            """
            
            self.date_booking_fee            = DateCtrl(self.panel_booking, -1)
            
            self.text_ctrl_booking_receiptNo = wx.TextCtrl(self.panel_booking, -1, "")
            
            self.date_test                   = DateCtrl(self.panel_booking, -1)
            
            self.choice_result_test          = wx.Choice(self.panel_booking, -1, choices=["A: Strong", "B: Good", "C: Medium", "D:Weak", "E:Very Weak"])
            
            self.date_retest                 = DateCtrl(self.panel_booking, -1)
            
            self.choice_result_retest        = wx.Choice(self.panel_booking, -1, choices=["Acceptable", "Not Acceptable"])
            
            self.date_offer_letter_sent      = DateCtrl(self.panel_booking, -1)
            
            self.text_ctrl_offer_ref         = wx.TextCtrl(self.panel_booking, -1, "")
            
            self.date_offer_accepted         = DateCtrl(self.panel_booking, -1)
            
            self.text_ctrl_accept_receiptNo  = wx.TextCtrl(self.panel_booking, -1, "")
            
            self.text_ctrl_notes             = wx.TextCtrl(self.panel_notes, -1, "", style=wx.TE_MULTILINE)"""
            
        else:
            self.enableCtrls()