def reload_data(self):
		dun=emtraffic.get_traffic_history("DUN")
		dunr=emtraffic.get_traffic_history("DUNR")
		pend=traffic.get_pending_traffic_history()
		pendr=traffic_roaming.get_pending_traffic_history()
		
		if len(dun)>0:
			minm=dun[0][0][1]*12+dun[0][0][0]-1;
			maxm=dun[len(dun)-1][0][1]*12+dun[len(dun)-1][0][0]-1;
		if len(dunr)>0:
			if len(dun)==0:
				minm=dunr[0][0][1]*12+dunr[0][0][0]-1;
				maxm=dunr[len(dunr)-1][0][1]*12+dunr[len(dunr)-1][0][0]-1;
			else:
				minm=min(minm,dunr[0][0][1]*12+dunr[0][0][0]-1);
				maxm=max(maxm,dunr[len(dunr)-1][0][1]*12+dunr[len(dunr)-1][0][0]-1);
		if len(dun)==0 and len(dunr)==0:
			minm=pend[0][1]*12+pend[0][0]-1;
			maxm=pend[0][1]*12+pend[0][0]-1;
		else:
			minm=min(minm,pend[0][1]*12+pend[0][0]-1);
			maxm=max(maxm,pend[0][1]*12+pend[0][0]-1);
		minm=min(minm,pendr[0][1]*12+pendr[0][0]-1);
		maxm=max(maxm,pendr[0][1]*12+pendr[0][0]-1);
			
		print minm
		print maxm
		
		datas=[]
		for h in xrange(minm, maxm+1):
			m=h%12
			a=h/12
			data=[[0,0],""]
			for d in xrange(0, len(dun)):
				if dun[d][0][1]==a and dun[d][0][0]-1==m:
					data[0][0]+=dun[d][1][0]+dun[d][1][1]
					break
			for d in xrange(0, len(dunr)):
				if dunr[d][0][1]==a and dunr[d][0][0]-1==m:
					data[0][1]+=dunr[d][1][0]+dunr[d][1][1]
					break
			if pend[0][1]==a and pend[0][0]-1==m:
				data[0][0]+=pend[1][0]+pend[1][1]
			if pendr[0][1]==a and pendr[0][0]-1==m:
				data[0][1]+=pendr[1][0]+pendr[1][1]
				
			months=[_(u"ene"),_(u"feb"),_(u"mar"),_(u"abr"),("may"),_(u"jun"),_(u"jul"),_(u"ago"),_(u"sep"),_(u"oct"),_(u"nov"),_(u"dic")]
			month=months[m]
			label="%s'%02i" % (month, a%100)
			data[0][0]/=1024*1024
			data[0][1]/=1024*1024			
			data[1]=label
			datas=datas+[data]

		self.set_values(datas)
예제 #2
0
    def get_history(self, imsi, is_roaming):
        traffic = self._traffics[is_roaming]
        tag = self.__get_tag(is_roaming)
        device = self.__get_device(imsi)
        billing_day = self.__get_billing_day(imsi)

        emtraffic.set_invoice_day(billing_day)
        traffic.set_device(device)
        return emtraffic.get_traffic_history(tag, device)
예제 #3
0
    def get_history(self, imsi, is_roaming):
        traffic = self._traffics[is_roaming]
        tag = self.__get_tag(is_roaming)
        device = self.__get_device(imsi)
        billing_day = self.__get_billing_day(imsi)

        emtraffic.set_invoice_day(billing_day)
        traffic.set_device(device)
        return emtraffic.get_traffic_history(tag, device)