Exemplo n.º 1
0
    def displayData(self):
        pass
        sql = "SELECT acc_invoices.ck_ref, \
                        Format(invoices.date, 'DD-MM-YYYY'), \
                        Format(int(invoice_items.amount),'#,###') \
                 FROM invoices i \
                 JOIN invoice_items ii ON i.ck_ref = ii.ck_ref \
                WHERE i.student_id = '%s' \
                  AND i.schYr= %d" % (gVar.student_id, gVar.schYr)
        
        myDict = fetch.DATA_STR(sql)
        self.payments_list.SetItemMap(myDict)
        
        self.pay_records = pay_records = len(myDict)
        
        if pay_records:
              txt = "Record: 1/%d" % pay_records
        else: txt = 'No Records'
        self.txt_ctrl_pay_records.SetValue(txt)
        
        sql = "SELECT Format(int(SUM(invoice_items.amount)),'#,###') \
                 FROM invoices i \
                 JOIN invoice_items ii ON i.ck_ref = ii.ck_ref \
                WHERE i.student_id = '%s' \
                  AND i.schYr= %d" % (gVar.student_id, gVar.schYr)

        res = fetch.getStr(sql)
        self.txt_ctrl_pay_total.SetValue(res)
Exemplo n.º 2
0
 def displayData(self, student_id):
     sql = "SELECT b.name \
              FROM students s \
              JOIN blood_groups b ON s.blood_type_id = b.id \
             WHERE s.id =%d" % student_id
     blood_group =  fetch.getStr(sql)
     
     self.data_medical_notes.SetValue(str(blood_group))
Exemplo n.º 3
0
    def loadAddress(self, guardian_id):
	# change kode tothe selected address
        sql = "SELECT address \
	         FROM guardians \
		WHERE id = %d" % guardian_id
        address = fetch.getStr(sql)
	
        self.text_ctrl_full_address.SetValue(address)
        items = self.splitAddress(address)
	if not len(items)==11:
	    return
	
	street,house,estate,block,road,kelurahan,kecamatan,kabupaten,postcode,province,country = self.splitAddress(address)
	street    = street.strip()
	house     = house.strip()
	estate    = estate.strip()
	block     = block.strip()
	road      = road.strip()
	kelurahan = kelurahan.strip()
	kecamatan = kecamatan.strip()
	kabupaten = kabupaten.strip()
	postcode  = postcode.strip()
	province  = province.strip()
	country   = country.strip()
	
	self.text_ctrl_block.SetValue(block)
	self.text_ctrl_house.SetValue(house)
	self.text_ctrl_road.SetValue(road)
	self.text_ctrl_street.SetValue(street)
	if estate:
	    self.checkbox_within_estate.SetValue(1)
	    self.selectResidesPanel()
	    self.restore_str(self.combo_estate, estate)
	  
	try :
	    postcode = int(postcode)
	    postcode = postcode*1
	    if isinstance(postcode, int):
		self.num_ctrl_postcode.SetValue(int(postcode))
		kecamatanID = self.cmbID(self.combo_kecamatan)
		self.loadCmbsUnderKecID(kecamatanID)
		self.restore_str(self.combo_kelurahan, kelurahan)
		
	    else:
		self.restore_str(self.combo_country, country)
		self.restore_str(self.combo_country, province)
		self.restore_str(self.combo_country, kabupaten)
		self.restore_str(self.combo_country, kecamatan)
		self.restore_str(self.combo_country, kelurahan)
	except:
            pass
Exemplo n.º 4
0
    def OnPaymentItemSelected(self, evt):
        pid   = self.payments_list.GetSelectedID()
        index = self.payments_list.GetFirstSelected()
        reciptNo = self.payments_list.getColumnText(index, 1)
        
        if self.pay_records:
              txt = "Record: %d/%d" % (index+1, self.pay_records)
        else: txt = 'No Records'
        self.txt_ctrl_pay_records.SetValue(txt)
        
        sql = "SELECT ii.product_id,  ii.name,    ii.other, \
                      ii.date_from,   ii.date_to, ii.month_from, pd.month_to, \
                      ii.price, Format(int(pd.amount),'#,###') AS amount, ii.item_name \
                 FROM invoices  i \
                 JOIN invoice_items ii ON i.id = ii.invoice_id \
                WHERE i.ck_ref='%s'" % reciptNo  # Format(int(invoice_items.amount),'#,###')

        mylist = fetch.getAllDict(sql)
        
        index = 0
        myDict = {}
    
        for row in mylist:
            name_value = [index, ]
            # prepare name
            item_name =row['item_name']
            if item_name:
                name_value.append(item_name)
            # perpare value
            name_value.append(row['amount'])
            
            #name_value[0]     = index
            name_value        = tuple(name_value)
            
            myDict[index] = name_value
            index +=1
        
        self.details_list.SetItemMap(myDict)
        
        self.detail_records = len(myDict)
        if myDict:
              txt = "Record: 1/%d" % self.detail_records
        else: txt = 'No Records'
        self.txt_ctrl_details_records.SetValue(txt)
        
        sql = "SELECT Format(SUM(amount),'#,###') \
                 FROM invoice_items  \
                WHERE ck_ref='%s'" % reciptNo 
        #rintsql
        self.txt_ctrl_details_total.SetValue(str(fetch.getStr(sql)))