ó F¬Vc@sxddlmZmZddlmZddlmZddlmZm Z ddl m Z ddl m Z mZmZddlmZddlmZdd lTdd lmZdd lmZdd lTdd lmZmZmZmZmZm Z dd l!m"Z"ddl#m$Z$ddl%m&Z&m'Z'ddl(m)Z)ddl*Z*dd l+Tde)fd„ƒYZ,de-fd„ƒYZ.de-fd„ƒYZ/de,e.efd„ƒYZ0de,e.efd„ƒYZ1defd„ƒYZ2defd„ƒYZ3d efd!„ƒYZ4d"efd#„ƒYZ5d$efd%„ƒYZ6d&efd'„ƒYZ7d(ee/fd)„ƒYZ8d*ee/fd+„ƒYZ9d,e fd-„ƒYZ:d.efd/„ƒYZ;d0„Z<d1e fd2„ƒYZ=d3e fd4„ƒYZ>d5e fd6„ƒYZ?d7efd8„ƒYZ@d9efd:„ƒYZAd;efd<„ƒYZBd=efd>„ƒYZCd?efd@„ƒYZDdA„ZEdS(Biÿÿÿÿ(t authenticatetlogin(tlogin_required(tImproperlyConfigured(treverset reverse_lazy(tQ(trender_to_responsetget_object_or_404tredirect(tTemplateResponse(tmethod_decorator(t*(t JasperClient(t serializers(tListViewt DetailViewt CreateViewt UpdateViewtFormViewt TemplateView(tsettings(tmessages(tHttpResponseRedirectt HttpResponse(tPaginationMixinNtDinamicPaginationMixincBseZd„Zd„ZRS(cCs@|jjjddƒ|_|jr9t|jƒ|_n|jS(Ntrppi (trequesttGETtgett paginate_bytint(tselftqueryset((s1/home/luisalfredo/Documentos/cisco/datos/views.pytget_paginate_bys cKs2tt|ƒj|}|j|jƒ|d<|S(NR(tsuperRtget_context_dataR#R"(R!tkwargstcontext((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR%s(t__name__t __module__R#R%(((s1/home/luisalfredo/Documentos/cisco/datos/views.pyRs t SearchMixincBs,eZd„Zd„Zd„Zd„ZRS(cCs|jjjddƒS(Ntsearcht(RRR(R!((s1/home/luisalfredo/Documentos/cisco/datos/views.pyt get_search%scCstdƒ‚dS(Ns3Debe especificar implementar el filtro de búsqueda(R(R!R"((s1/home/luisalfredo/Documentos/cisco/datos/views.pyt get_filter(scCs(tt|ƒjƒ}|j|ƒ}|S(N(R$R*t get_querysetR.(R!R"((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR/+scKs,tt|ƒj|}|jƒ|d<|S(NR+(R$R*R%R-(R!R&R'((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR%0s(R(R)R-R.R/R%(((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR*$s   t JasperMixcBs,eZejZdZdZidd„ZRS(t jasperadmincCsjt|j|j|jƒ}|j||s0dn||ƒ}t|dƒ}|j|dƒ|jƒdS(s€ Gennara reportes atravez del jasperserver :param path: :param namefile: :param params: :param tipo: default is PDF tPDFtwtdataN(R turltusernametpasswordt runReporttfiletwritetclose(R!tpathtnamefiletparamsttipotjtrettf((s1/home/luisalfredo/Documentos/cisco/datos/views.pytgenerateReport;s !N( R(R)Rt JASPERSERVERR5R6R7tNoneRC(((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR06s tListaUsuariosViewcBs>eZeZejjddƒjdƒZd„Zd„Z RS(tactivoitnombre_usuariocCs1|jƒ}|r-|jtd|ƒƒ}n|S(Ntnombre_usuario__icontains(R-tfilterR(R!R"R+((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR.Ss  cKs&tt|ƒj|}d|d<|S(Ntactivetcisco(R$RFR%(R!R&R'((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR%]s ( R(R)tUsuariostmodeltobjectsRJtorder_byR"R.R%(((s1/home/luisalfredo/Documentos/cisco/datos/views.pyRFOs tListaTarifasViewcBs8eZeZejjƒjdƒZd„Zd„Z RS(tidcCs1|jƒ}|r-|jtd|ƒƒ}n|S(Ntllamada__icontains(R-RJR(R!R"R+((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR.gs  cKs&tt|ƒj|}d|d<|S(NRKRL(R$RQR%(R!R&R'((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR%os ( R(R)tTarifasRNROtallRPR"R.R%(((s1/home/luisalfredo/Documentos/cisco/datos/views.pyRQcs tDetalleUsuariosViewcBseZeZeZd„ZRS(cKs&tt|ƒj|}d|d<|S(NRKRL(R$RVR%(R!R&R'((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR%ys (R(R)RMRNt UsuariosFormt form_classR%(((s1/home/luisalfredo/Documentos/cisco/datos/views.pyRVustDetalleTarifasViewcBseZeZeZd„ZRS(cKs&tt|ƒj|}d|d<|S(NRKRL(R$RYR%(R!R&R'((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR%ƒs (R(R)RTRNt TarifasFormRXR%(((s1/home/luisalfredo/Documentos/cisco/datos/views.pyRYstCrearUsuariosViewcBs/eZeZeZd„Zd„Zd„ZRS(cCstj|jdƒtdƒS(Ns"Se agrego el usuario correctamenteslista-usuarios(RtsuccessRR(R!((s1/home/luisalfredo/Documentos/cisco/datos/views.pytget_success_urlsc Cs{tjjd|jdd|jdd|jdddƒ}|retj|jdƒttdƒƒSt t |ƒj |ƒS( NRHt extensiont departamentotnombre_departamentoRGisCYa existe el usuario con el mismo nombre, extension y departamento.screar-usuarios( RMRORJt cleaned_dataRterrorRRRR$R[t form_valid(R!tformR"((s1/home/luisalfredo/Documentos/cisco/datos/views.pyRc‘s   cKs&tt|ƒj|}d|d<|S(NRKRL(R$R[R%(R!R&R'((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR%›s ( R(R)RMRNRWRXR]RcR%(((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR[‰s   tUpdateUsuariosViewcBs/eZeZeZd„Zd„Zd„ZRS(cCstj|jdƒtdƒS(Ns6La información del usuario se actualizo correctamenteslista-usuarios(RR\RR(R!((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR]¥scCs |jƒtt|ƒj|ƒS(N(tsaveR$ReRc(R!Rd((s1/home/luisalfredo/Documentos/cisco/datos/views.pyRc©s cKs&tt|ƒj|}d|d<|S(NRKRL(R$ReR%(R!R&R'((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR%­s ( R(R)RMRNRWRXR]RcR%(((s1/home/luisalfredo/Documentos/cisco/datos/views.pyRe¡s   tUpdateTarifasViewcBs/eZeZeZd„Zd„Zd„ZRS(cCstj|jdƒtdƒS(Ns7La información de la tarifa se actualizo correctamentes lista-tarifas(RR\RR(R!((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR]·scCs |jƒtt|ƒj|ƒS(N(RfR$RgRc(R!Rd((s1/home/luisalfredo/Documentos/cisco/datos/views.pyRc»s cKs&tt|ƒj|}d|d<|S(NRKRL(R$RgR%(R!R&R'((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR%¿s ( R(R)RTRNRZRXR]RcR%(((s1/home/luisalfredo/Documentos/cisco/datos/views.pyRg³s   tEliminarUsuariosViewcBs/eZeZeZd„Zd„Zd„ZRS(cCstj|jdƒtdƒS(Ns(Se ha eliminado el usuario correctamenteslista-usuarios(RR\RR(R!((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR]ÉscCsžtjjd|jdƒ}tjjdt|jƒƒ}|rctj |j dƒt t dƒƒS|j |j_ d|j_|jƒtt|ƒj|ƒS(NRRtpktcallingpartynumber__insAEl usuario no puede ser eliminado por que tiene asociado un bien.slista-usuariosi(RMRORR&tCamposRJtstrR^RRbRRRR_tinstanceRGRfR$RhRc(R!Rdt queryUsuariosR"((s1/home/luisalfredo/Documentos/cisco/datos/views.pyRcÍs  cKs0tt|ƒj|}d|dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrgq}|jƒr|jds}|jdsj}|jjdt}tjj ƒj ds|ƒ} t | ƒrt j |jduƒttdvƒƒS|jƒ} dwdl‰ˆj| dxƒ} t‡fdy†| ƒ} dz} tƒ}||_|jƒx–| D]Ž}|d{gkrn| dzkrŸ| j|ƒnPtjjt|d|ƒƒ}tjjtt||ƒd}|d~|d|jƒ| d€7} qnqnW|jƒt j |dƒq\t j |jd‚ƒttdvƒƒSnt!ƒ}t j |dƒt"dƒi|d„6d…t#|ƒƒS(†NtPOSTt cdrRecordTypetglobalCallID_callManagerIdtglobalCallID_callIdtorigLegCallIdentifiertdateTimeOriginationt origNodeIdtorigSpant origIpAddrtcallingpartynumbertcallingpartyUnicodeLoginUserIDtorigCause_locationtorigCause_valuetorigPrecedenceLeveltorigMediaTransportAddress_IPtorigMediaTransportAddress_PorttorigMediaCap_payloadCapabilitytorigMediaCap_maxFramesPerPackettorigMediaCap_g723BitRatetorigVideoCap_CodectorigVideoCap_BandwidthtorigVideoCap_ResolutiontorigVideoTransportAddress_IPtorigVideoTransportAddress_PorttorigRSVPAudioStattorigRSVPVideoStattdestLegIdentifiert destNodeIdtdestSpant destIpAddrtoriginalCalledPartyNumbertfinalCalledPartyNumbert"finalCalledPartyUnicodeLoginUserIDtdestCause_locationtdestCause_valuetdestPrecedenceLeveltdestMediaTransportAddress_IPtdestMediaTransportAddress_PorttdestMediaCap_payloadCapabilitytdestMediaCap_maxFramesPerPackettdestMediaCap_g723BitRatetdestVideoCap_CodectdestVideoCap_BandwidthtdestVideoCap_ResolutiontdestVideoTransportAddress_IPtdestVideoTransportAddress_PorttdestRSVPAudioStattdestRSVPVideoStattdateTimeConnecttdateTimeDisconnecttlastredirectdntpkidt"originalCalledPartyNumberPartitiontcallingPartyNumberPartitiontfinalCalledPartyNumberPartitiontlastRedirectDnPartitiontdurationtorigDeviceNametdestDeviceNametorigCallTerminationOnBehalfOftdestCallTerminationOnBehalfOft!origCalledPartyRedirectOnBehalfOftlastRedirectRedirectOnBehalfOftorigCalledPartyRedirectReasontlastRedirectRedirectReasontdestConversationIdtglobalCallId_ClusterIDtjoinOnBehalfOftcommenttauthCodeDescriptiontauthorizationLeveltclientMatterCodetorigDTMFMethodtdestDTMFMethodtcallSecuredStatustorigConversationIdtorigMediaCap_BandwidthtdestMediaCap_BandwidthtauthorizationCodeValuetoutpulsedCallingPartyNumbertoutpulsedCalledPartyNumbertorigIpv4v6AddrtdestIpv4v6AddrtorigVideoCap_Codec_Channel2torigVideoCap_Bandwidth_Channel2t origVideoCap_Resolution_Channel2t%origVideoTransportAddress_IP_Channel2t'origVideoTransportAddress_Port_Channel2torigVideoChannel_Role_Channel2tdestVideoCap_Codec_Channel2tdestVideoCap_Bandwidth_Channel2t destVideoCap_Resolution_Channel2t%destVideoTransportAddress_IP_Channel2t'destVideoTransportAddress_Port_Channel2tdestVideoChannel_Role_Channel2tincomingProtocolIDtincomingProtocolCallReftoutgoingProtocolIDtoutgoingProtocolCallReftcurrentRoutingReasontorigRoutingReasontlastRedirectingRoutingReasont huntPilotDNthuntPilotPartitiontcalledPartyPatternUsaget"outpulsedOriginalCalledPartyNumbertoutpulsedLastRedirectingNumbert wasCallQueuedttotalWaitTimeInQueuetcallingPartyNumber_uritoriginalCalledPartyNumber_uritfinalCalledPartyNumber_uritlastRedirectDn_urit parseoFechatarchivotperiodos=El archivo solo debe de ser ingresado una sola vez al sistemaRriÿÿÿÿs csˆj|dƒS(Nt,(tsplit(te(tstring(s1/home/luisalfredo/Documentos/cisco/datos/views.pyt'siR,it parseofechat periodo_idt archivo_idis'Se ha generado correctamente el archivosKNo existe un archivo agregado al formulario, vuelva a intentarlo por favor.sdatos/form.htmlRdtcontext_instance($tmethodRXRutFILEStis_validtnameRtArchivoRORURJtlenRRbRRtreadRìRêtmapRçRftremovetdatetimet fromtimestampR RktcreatetdicttzipRRR;R\t SubirArchivoRtRequestContext(R!RRtR&RdtfieldstvarRõRèR"tltlistatparestindttabtrowtparseo((Rìs1/home/luisalfredo/Documentos/cisco/datos/views.pytpostìs–                                +   cCs)tj|jdƒtt|ƒj|ƒS(Nscorrija los siguientes errores(RRbRR$Rrt form_invalid(R!Rd((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR BscKs9tt|ƒj|}tjjƒ|di| d 6t| j ƒd6dƒt d?ƒSnt|ƒd@krUt|ƒd kr|jd tjdi| dA6t| j ƒd6dƒt dƒS|jd tjdi| dA6t| j ƒd6dƒt dƒSndS(BNtusuarioRçtperiodo1tperiodo2R?tformatot extenciont tipo_llamadatduraciontimportetdepais$/llamadascisco/reportes/controlCiscoscontrolCisco.PDFt periodo_init periodo_fintusu_logR2s/media/controlCisco.PDFscontrolCisco.xlstxlss/media/controlCisco.xlsiRðit usuario_idiitentros./llamadascisco/reportes/cisco_extenciones_privscisco_extenciones_priv.PDFt no_extenciont no2_extencions!/media/cisco_extenciones_priv.PDFs)/llamadascisco/reportes/cisco_extencionesscisco_extenciones.PDFs/media/cisco_extenciones.PDFiÈi,scisco_extenciones_priv.xlss!/media/cisco_extenciones_priv.xlsscisco_extenciones.xlss/media/cisco_extenciones.xlsis&/llamadascisco/reportes/cisco_tip_lamascisco_tip_lama.PDFttip_llams/media/cisco_tip_lama.PDFscisco_tip_lama.xlss/media/cisco_tip_lama.xlsis&/llamadascisco/reportes/cisco_duracionscisco_duracion.PDFs/media/cisco_duracion.PDFscisco_duracion.xlstduarcions/media/cisco_duracion.xlsis%/llamadascisco/reportes/cisco_importescisco_importe.PDFs/media/cisco_importe.PDFscisco_importe.xlss/media/cisco_importe.xlsi tid_depa(RRutgetlisttuserR RCRt MEDIA_ROOTRlRRRt IndexErrorREtformat(R!RdRRðtper1tper2R?RRRRRRR&Rtvar2((s1/home/luisalfredo/Documentos/cisco/datos/views.pyRcTsæ   /   /   (   (   (   (       ,  +   $   +      !   !   !   !   !   !   !   !cCs)tj|jdƒtt|ƒj|ƒS(Nscorrija los siguientes errores(RRbRR$RR (R!Rd((s1/home/luisalfredo/Documentos/cisco/datos/views.pyR àscKs½d}tt|ƒj|}|jjjdksH|jjjdkrZtjjƒ}n8y.t jj d|jjƒ}|j jƒ}WnnX||dR?RHRKRLRNRORPRSRX(((s1/home/luisalfredo/Documentos/cisco/datos/views.pytsV  .     l»