def __init__(self): self.create_date = func.now() self.write_date = func.now() self.write_uid = 1 obj_conexion = configuracion() engine = create_engine(obj_conexion.config()) Session = sessionmaker(bind=engine) self.session = Session()
def __init__(self): self.create_date =func.now() self.write_date = func.now() self.write_uid = 1 obj_conexion = configuracion() engine=create_engine(obj_conexion.config()) Session= sessionmaker(bind=engine) self.session=Session()
def descargar_archivo(self): obj_E_configuracion = configuracion() cnopts = pysftp.CnOpts() cnopts.hostkeys = None nom_archivo= self.obj_form.lne_archivo.text() with pysftp.Connection(host=obj_E_configuracion.host_server(), username=obj_E_configuracion.usu_server(), password=obj_E_configuracion.pass_server(),cnopts=cnopts) as sftp: #ert= sftp.get('/home/user/Documentos/prueba.txt') #ert= sftp.get('nom_archivo') destino =(obj_E_configuracion.ruta() + '/comprobante' +self.get_nom_archivo()) ert= sftp.get(self.obj_form.lne_archivo.text(),destino, preserve_mtime=False)
def guardar(self, obj_N_party_contacto, id_party): obj_conexion = configuracion() engine = create_engine(obj_conexion.config()) Session = sessionmaker(bind=engine) session = Session() #pyqtRemoveInputHook() #import pdb; pdb.set_trace() new_record = E_party_contacto(1) new_record.comment = "" new_record.value = obj_N_party_contacto.value new_record.type_contacto = obj_N_party_contacto.type_contacto new_record.id_party = id_party session.add(new_record) session.commit() session.close()
def imprimir(self): obj_ejercicio = "" for item in self.lista_ejercicio: if item.descripcion == self.obj_form.cbx_ejercicio_2.currentText(): obj_ejercicio = item obj_e_reporte = E_reporte() lista_SUMAS_SALDOS = obj_e_reporte.reporte_sumas_saldos( str(obj_ejercicio.id_ejercicio)) styleSheet = getSampleStyleSheet() otro_estilo = ParagraphStyle('', fontName='Times-Roman', fontSize=6, textColor='#000', leftIndent=230, rightIndent=50) otro_estilo2 = ParagraphStyle('', fontName='Times-Roman', fontSize=6, textColor='#000', leftIndent=230, rightIndent=50) style_barra = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=0, rightIndent=50) texto_principal = "" texto_secundario = ParagraphStyle('', fontSize=6, textColor='#000', leftIndent=5, rightIndent=0) texto_secundario2 = ParagraphStyle('', fontSize=6, textColor='#150', leftIndent=5, rightIndent=0) texto_secundario3 = ParagraphStyle('', fontSize=6, textColor='#FF0000', leftIndent=5, rightIndent=0) estilo_resultado = ParagraphStyle('', fontName='Times-Roman', fontSize=6, textColor='#000', leftIndent=1, rightIndent=50) estilo_resultado2 = ParagraphStyle('', fontSize=6, textColor='#000', leftIndent=1, rightIndent=0) estilo_texto = ParagraphStyle( '', fontSize=6, alignment=0, spaceBefore=0, spaceAfter=0, #backgroundColor = '#A9D0F5', textColor='#000', leftIndent=5) estilo_detalle_cuota = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=0, rightIndent=0) options = QFileDialog.Options() story = [] P = Paragraph("<b><u> SUMAS Y SALDOS</u></b> ", otro_estilo) story.append(P) story.append(Spacer(0, 2)) P = Paragraph( "<b><u>" + str(self.obj_cliente.razon_social).upper() + "</u></b> ", otro_estilo2) story.append(P) story.append(Spacer(0, -5)) cabezal = [[Paragraph('''<b> </b>''', styleSheet["BodyText"])], [ Paragraph(' <b> CODIGO </b> ', estilo_texto), Paragraph('<b> DESCRIPCIÓN </b> ', estilo_texto), Paragraph('<b> DEBE </b> ', estilo_texto), Paragraph('<b> HABER </b> ', estilo_texto), Paragraph('<b> SALDO </b> ', estilo_texto), Paragraph('<b> S.DEUDOR </b> ', estilo_texto), Paragraph('<b> S.ACREEDOR</b> ', estilo_texto) ]] t = "" asiento = "" saldo = 0 plan = "" total_resultado = 0.0 total_saldo_deudor = 0.0 total_saldo_acreedor = 0.0 centena_padre = 0 total_decenamil_padre = 0 obj_centena_padre = "" bandera_centena = True obj_centena_padre_Anterior = "" mil_padre = 0 bandera_mil = True obj_mil_padre_Anterior = "" diezmil_padre = 0 bandera_diezmil = True obj_diezmil_padre_Anterior = "" #pyqtRemoveInputHook() #import pdb;pdb.set_trace() for item in lista_SUMAS_SALDOS: centena_padre = obj_e_reporte.get_padre_centena( str(item[0]), self.obj_cliente.id_cliente) for item2 in centena_padre: mil_padre = obj_e_reporte.get_padre_mil( str(item2[1]), self.obj_cliente.id_cliente) for item3 in mil_padre: #pyqtRemoveInputHook() #import pdb;pdb.set_trace() diezmil_padre = obj_e_reporte.get_padre_diezmil( str(item3[1]), self.obj_cliente.id_cliente) for item4 in diezmil_padre: if bandera_diezmil == True: total_diezmil_padre = obj_e_reporte.calcular_diezmil_padre( str(item2[1]), self.obj_cliente.id_cliente) resultado = "" for result in total_diezmil_padre: resultado = result bandera_diezmil = False total_resultado = (resultado[0]) - float( resultado[1]) estiloCodigo4 = "<font size=6>" + str( item4[1]) + "</font>" estiloDescripcion4 = "<font size=6>" + str( item4[2]) + " </font>" estilodebe4 = "<font size=6>" + str( "-") + " </font>" estilohaber4 = "<font size=6>" + str( "-") + " </font>" estilosaldo4 = "<font size=6>" + str( total_resultado) + " </font>" estilosdeudor4 = "<font size=6>" + str( "-") + " </font>" estilosacredoor4 = "<font size=6>" + str( "-") + " </font>" cabezal.append([ Paragraph(estiloCodigo4, texto_secundario3), Paragraph(estiloDescripcion4, texto_secundario3), Paragraph(estilodebe4, texto_secundario3), Paragraph(estilohaber4, texto_secundario3), Paragraph(estilosaldo4, texto_secundario3), Paragraph(estilosdeudor4, texto_secundario3), Paragraph(estilosacredoor4, texto_secundario3) ]) elif obj_diezmil_padre_Anterior[2] != item4[2]: total_diezmil_padre = obj_e_reporte.calcular_diezmil_padre( str(item2[1]), self.obj_cliente.id_cliente) resultado = "" for result in total_diezmil_padre: resultado = result total_resultado = (resultado[0]) - float( resultado[1]) estiloCodigo4 = "<font size=6>" + str( item4[1]) + "</font>" estiloDescripcion4 = "<font size=6>" + str( item4[2]) + " </font>" estilodebe4 = "<font size=6>" + str( "-") + " </font>" estilohaber4 = "<font size=6>" + str( "-") + " </font>" estilosaldo4 = "<font size=6>" + str( total_resultado) + " </font>" estilosdeudor4 = "<font size=6>" + str( "-") + " </font>" estilosacredoor4 = "<font size=6>" + str( "-") + " </font>" cabezal.append([ Paragraph(estiloCodigo4, texto_secundario3), Paragraph(estiloDescripcion4, texto_secundario3), Paragraph(estilodebe4, texto_secundario3), Paragraph(estilohaber4, texto_secundario3), Paragraph(estilosaldo4, texto_secundario3), Paragraph(estilosdeudor4, texto_secundario3), Paragraph(estilosacredoor4, texto_secundario3) ]) obj_diezmil_padre_Anterior = item4 if bandera_mil == True: total_mil_padre = obj_e_reporte.calcular_mil_padre( str(item2[1]), self.obj_cliente.id_cliente) resultado = "" for result in total_mil_padre: resultado = result bandera_mil = False total_resultado = (resultado[0]) - float(resultado[1]) estiloCodigo3 = "<font size=6>" + str( item3[1]) + "</font>" estiloDescripcion3 = "<font size=6>" + str( item3[2]) + " </font>" estilodebe3 = "<font size=6>" + str("-") + " </font>" estilohaber3 = "<font size=6>" + str("-") + " </font>" estilosaldo3 = "<font size=6>" + str( total_resultado) + " </font>" estilosdeudor3 = "<font size=6>" + str( "-") + " </font>" estilosacredoor3 = "<font size=6>" + str( "-") + " </font>" cabezal.append([ Paragraph(estiloCodigo3, texto_secundario3), Paragraph(estiloDescripcion3, texto_secundario3), Paragraph(estilodebe3, texto_secundario3), Paragraph(estilohaber3, texto_secundario3), Paragraph(estilosaldo3, texto_secundario3), Paragraph(estilosdeudor3, texto_secundario3), Paragraph(estilosacredoor3, texto_secundario3) ]) elif obj_mil_padre_Anterior[2] != item3[2]: total_mil_padre = obj_e_reporte.calcular_mil_padre( str(item2[1]), self.obj_cliente.id_cliente) resultado = "" for result in total_mil_padre: resultado = result try: total_resultado = (resultado[0]) - float( resultado[1]) except: total_resultado = 0 estiloCodigo3 = "<font size=6>" + str( item3[1]) + "</font>" estiloDescripcion3 = "<font size=6>" + str( item3[2]) + " </font>" estilodebe3 = "<font size=6>" + str("-") + " </font>" estilohaber3 = "<font size=6>" + str("-") + " </font>" estilosaldo3 = "<font size=6>" + str( total_resultado) + " </font>" estilosdeudor3 = "<font size=6>" + str( "-") + " </font>" estilosacredoor3 = "<font size=6>" + str( "-") + " </font>" cabezal.append([ Paragraph(estiloCodigo3, texto_secundario3), Paragraph(estiloDescripcion3, texto_secundario3), Paragraph(estilodebe3, texto_secundario3), Paragraph(estilohaber3, texto_secundario3), Paragraph(estilosaldo3, texto_secundario3), Paragraph(estilosdeudor3, texto_secundario3), Paragraph(estilosacredoor3, texto_secundario3) ]) obj_mil_padre_Anterior = item3 if bandera_centena == True: total_centena_padre = obj_e_reporte.calcular_centena_padre( str(item2[1]), self.obj_cliente.id_cliente) resultado = "" for result in total_centena_padre: resultado = result bandera_centena = False try: total_resultado = (resultado[0]) - float(resultado[1]) except: total_resultado = 0 estiloCodigo = "<font size=6>" + str(item2[1]) + "</font>" estiloDescripcion = "<font size=6>" + str( item2[2]) + " </font>" estilodebe = "<font size=6>" + str( resultado[0]) + " </font>" estilohaber = "<font size=6>" + str( resultado[1]) + " </font>" estilosaldo = "<font size=6>" + str( total_resultado) + " </font>" estilosdeudor = "<font size=6>" + str("-") + " </font>" estilosacredoor = "<font size=6>" + str("-") + " </font>" cabezal.append([ Paragraph(estiloCodigo, texto_secundario2), Paragraph(estiloDescripcion, texto_secundario2), Paragraph(estilodebe, texto_secundario2), Paragraph(estilohaber, texto_secundario2), Paragraph(estilosaldo, texto_secundario2), Paragraph(estilosdeudor, texto_secundario2), Paragraph(estilosacredoor, texto_secundario2) ]) elif obj_centena_padre_Anterior[2] != item2[2]: total_centena_padre = obj_e_reporte.calcular_centena_padre( str(item2[1]), self.obj_cliente.id_cliente) resultado = "" for result in total_centena_padre: resultado = result try: total_resultado = (resultado[0]) - float(resultado[1]) except: total_resultado = 0 estiloCodigo = "<font size=6>" + str(item2[1]) + "</font>" estiloDescripcion = "<font size=6>" + str( item2[2]) + " </font>" estilodebe = "<font size=6>" + str( resultado[0]) + " </font>" estilohaber = "<font size=6>" + str( resultado[1]) + " </font>" estilosaldo = "<font size=6>" + str( total_resultado) + " </font>" estilosdeudor = "<font size=6>" + str("-") + " </font>" estilosacredoor = "<font size=6>" + str("-") + " </font>" cabezal.append([ Paragraph(estiloCodigo, texto_secundario2), Paragraph(estiloDescripcion, texto_secundario2), Paragraph(estilodebe, texto_secundario2), Paragraph(estilohaber, texto_secundario2), Paragraph(estilosaldo, texto_secundario2), Paragraph(estilosdeudor, texto_secundario2), Paragraph(estilosacredoor, texto_secundario2) ]) obj_centena_padre_Anterior = item2 if plan != item[1]: plan = item[1] total_resultado = total_resultado + float(item[4]) estiloCodigo = "<font size=6>" + str(item[0]) + "</font>" estiloDescripcion = "<font size=6>" + str(item[1]) + " </font>" estilodebe = "<font size=6>" + str(item[2]) + " </font>" estilohaber = "<font size=6>" + str(item[3]) + " </font>" estilosaldo = "<font size=6>" + str(item[4]) + " </font>" if float(item[4]) < 0: total_saldo_deudor = total_saldo_deudor + float(item[4]) estilosdeudor = estilosaldo estilosacredoor = "<font size=6>----</font>" else: estilosdeudor = "<font size=6>----</font>" estilosacredoor = estilosaldo total_saldo_acreedor = total_saldo_acreedor + float( item[4]) cabezal.append([ Paragraph(estiloCodigo, texto_secundario), Paragraph(estiloDescripcion, texto_secundario), Paragraph(estilodebe, texto_secundario), Paragraph(estilohaber, texto_secundario), Paragraph(estilosaldo, texto_secundario), Paragraph(estilosdeudor, texto_secundario), Paragraph(estilosacredoor, texto_secundario) ]) t = Table(cabezal, (50, 200, 60, 60, 60, 60, 60)) t.setStyle( TableStyle([('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white)])) story.append(t) resultado = [[Paragraph('''<b> </b>''', styleSheet["BodyText"])], [ Paragraph(' <b> RESULTADO DEL EJERCICIO : </b> ', estilo_resultado), Paragraph('<b> </b> ' "" + str(total_resultado), estilo_resultado2), Paragraph('<b> </b> ' "" + str(total_saldo_deudor), estilo_resultado2), Paragraph('<b> </b> ' "" + str(total_saldo_acreedor), estilo_resultado2) ]] #resultado.append([Paragraph("RESULTADO DEL EJERCICIO : "+str(total_resultado), estilo_resultado), # Paragraph(""+ str(total_saldo_deudor), estilo_resultado), # Paragraph(""+ str(total_saldo_acreedor), estilo_resultado)]) t = Table(resultado, (370, 60, 60, 60)) t.setStyle( TableStyle([('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white)])) story.append(t) #P = Paragraph("RESULTADO DEL EJERCICIO : "+str(total_resultado), estilo_resultado) #story.append(P) #story.append(Spacer(0, 2)) #P = Paragraph("RESULTADO SALDO DEUDOR : "+str(total_saldo_deudor), estilo_resultado) #story.append(P) #story.append(Spacer(0, 2)) #P = Paragraph("RESULTADO SALDO ACREEDOR : "+str(total_saldo_acreedor), estilo_resultado) #story.append(P) #story.append(Spacer(0, 2)) # ---------------------------------------CAMBIAR RUTA (LA PALABRA slam2016 POR LA RUTA DESEADA DE LA PC)------------------------------------------------# # pyqtRemoveInputHook() # import pdb;pdb.set_trace() obj_config = configuracion() cadena = obj_config.ruta() file_path = cadena + "/pdf/reportes/libro_suma_saldos" + str( datetime.date.today().year) + "_" + str( datetime.date.today().month) # ---EJEMPLO de windows: c:/Users/tatilu-----------------------------------------------------------------------# if not os.path.exists(file_path): os.makedirs(file_path) doc = SimpleDocTemplate(file_path + "/libro_suma_saldos " + self.obj_cliente.nombre + "_" + self.obj_cliente.apellido + ".pdf", pagesize=A4, rightMargin=14, leftMargin=14, topMargin=5, bottomMargin=18) doc.build(story) msgBox = QMessageBox() msgBox.setWindowTitle("Estado de Reporte") msgBox.setText("El reporte se ha generado correctamente") msgBox.exec_() if sys.platform == 'linux': subprocess.call([ "xdg-open", file_path + "/libro_suma_saldos " + self.obj_cliente.nombre + "_" + self.obj_cliente.apellido + ".pdf" ]) else: os.startfile(file_path + "/libro_suma_saldos " + self.obj_cliente.nombre + "_" + self.obj_cliente.apellido + ".pdf")
def ticket(self): monto_ticket=0 for item in self.lista_ticket: monto_ticket = monto_ticket + item.importe_cobrado obj_E_ticket = E_ticket() obj_E_ticket.monto = monto_ticket obj_E_ticket.fecha = datetime.date.today() obj_E_ticket.nro_credito = self.nro_credito_ticket obj_E_ticket.write_uid = self.singleton_idusu.idusu obj_E_ticket.guardar_ticket(obj_E_ticket) nro_ticket = obj_E_ticket.buscar_ticket(self.nro_credito_ticket) obj_E_party = E_party_party() obj_asoc = obj_E_party.get_party_party(self.obj_form.lne_dni.text()) obj_E_address = E_party_address() obj_address = obj_E_address.get_party_address(obj_asoc.id_party) fec_hoy= datetime.date.today() hoy = fec_hoy.strftime("%d/%m/%Y") styleSheet=getSampleStyleSheet() img=Image("cabezal3.png",150,35) img.hAlign = "RIGHT" otro_estilo= ParagraphStyle('',fontSize =6,textColor = '#000',leftIndent = 0,rightIndent = 100) style_barra= ParagraphStyle('',fontSize =10,textColor = '#000',leftIndent = 0,rightIndent = 50) texto_principal = "" texto_secundario = ParagraphStyle('',fontSize =10,textColor = '#000',leftIndent = 0,rightIndent = 0) texto_banner2 = ParagraphStyle('',fontSize =6,textColor = '#000',leftIndent =-150,rightIndent = 0) estilo_texto = ParagraphStyle('', fontSize = 5, alignment = 0, spaceBefore = 0, spaceAfter = 0, #backColor = '#fff', textColor = '#000', leftIndent = 5 ) h = ""#Paragraph("<br/><br/><br/>aa<br/><b>Buenos Aires 53 -Local 2 y 3 -Tel.:02920-432424/ Cel.:02920-15695353</b> ",texto_banner2) banner = [ [ img,h] ] banner2 = [[Paragraph('''<font size=3> <b> </b></font>''',styleSheet["BodyText"])], [Paragraph("<b>Buenos Aires 53 -Local 2 y 3 -Tel.:02920-432424/ Cel.:02920-15695353</b><br/><b> Viedma - Río Negro - E-mail: [email protected]</b> ",texto_banner2)]] banner3 = [[Paragraph('''<font size=8> <b> </b></font>''',styleSheet["BodyText"])], [Paragraph("<b>RECIBO N° " + str(nro_ticket) + "<br/>Fecha: " + str (hoy)+ "<br/> CUIT: 30-71446302-7 <br/> ING. BRUTOS: 45969604 <br/> INIC. ACTIVIDADES: 20/05/2014</b> ",texto_secundario)]] options = QFileDialog.Options() story=[] ban = Table( banner, colWidths=300, rowHeights=70,hAlign = "RIGHT") ban2 = Table( banner2, colWidths=300, rowHeights=10) ban3 = Table(banner3, colWidths=318, rowHeights=75, hAlign='RIGHT') tban3=ban3 tban3.setStyle(TableStyle([ ('INNERGRID', (0,1), (-1,-1), 0.25, colors.white), ('BOX', (0,1), (0,-1), 0.25, colors.white), ('BACKGROUND',(0,1),(-1,1),colors.white) ])) #story.append(Spacer(100,10)) ##superior d = Drawing(100, 1) d.add(Line(-5, -15, 585, -15)) story.append(d) #izquierda d = Drawing(100, 1) d.add(Line(-5, -15, -5, -94)) story.append(d) story.append(ban) story.append(Spacer(0,1)) story.append(ban2) story.append(Spacer(0,-150)) story.append(tban3) #centro d = Drawing(100, 1) d.add(Line(250, -2, 250, 79)) story.append(d) #derecha d = Drawing(100, 1) d.add(Line(585, -1, 585, 79)) story.append(d) #inferior d = Drawing(100, 1) d.add(Line(-5, 0, 585, 0)) story.append(d) story.append(Spacer(150,-10)) cabezal =[[Paragraph('''<font size=8> <b> </b></font>''',styleSheet["BodyText"])], [Paragraph('<font size=8> <b> Señor(es): '+ obj_asoc.apellido +", "+obj_asoc.nombre +'</b> <br/> <b> Domicilio: ' +obj_address.domicilio +'</b><br/></font>',estilo_texto)]] tcabezal=Table(cabezal, (590)) tcabezal.setStyle(TableStyle([ ('INNERGRID', (0,1), (-1,-1), 0.25, colors.black), ('BOX', (0,1), (-1,-1), 0.25, colors.black), ('BACKGROUND',(0,1),(-1,1),colors.white) ])) story.append(tcabezal) story.append(Spacer(0,-15)) integrantes = [[Paragraph('''<font size=10> <b> </b></font>''',styleSheet["BodyText"])], [Paragraph('''<font size=10> <b> </b>Credito N°</font>''',estilo_texto), Paragraph('''<font size=10> <b> </b>Cuota N°</font>''',estilo_texto), Paragraph('''<font size=10> <b> </b>Monto</font>''',estilo_texto), Paragraph('''<font size=10> <b> </b>Vencimiento</font>''',estilo_texto), Paragraph('''<font size=10> <b> </b>Estado</font>''',estilo_texto), Paragraph('''<font size=10> <b> </b>Descuento</font>''',estilo_texto), Paragraph('''<font size=10> <b> </b>Interes</font>''',estilo_texto), Paragraph('''<font size=10> <b> </b>Importe</font>''',estilo_texto)]] for item in self.lista_ticket: #obj_cuotas.nro_credito = self.nro_credito_historial #obj_cuotas.importe_primer_venc = self.vencimiento_historial.text() #obj_cuotas.primer_Vencimiento = self.vencimiento_historial.text() estilonro_credi= " <font size=8>" + str(item.nro_credito) + "</font>" estilonro_cta= " <font size=8>" + str(item.nro_cuota) + "</font>" estilomonto = " <font size=8>" + str(item.importe_primer_venc) + "</font>" estiloprimer_venc = " <font size=8>" + str(item.primer_Vencimiento) + "</font>" estiloestado_cta = " <font size=8>" + item.estado_cuota + "</font>" estilodescuento = " <font size=8>" + str(item.descuento) + "</font>" estilointeres = " <font size=8>" + str(item.punitorios) + "</font>" estiloimporte = " <font size=8>" + str(item.importe_cobrado) + "</font>" integrantes.append([Paragraph(estilonro_credi,estilo_texto), Paragraph(estilonro_cta,estilo_texto), Paragraph(estilomonto,estilo_texto), Paragraph(estiloprimer_venc,estilo_texto), Paragraph(estiloestado_cta,estilo_texto), Paragraph(estilodescuento,estilo_texto), Paragraph(estilointeres,estilo_texto), Paragraph(estiloimporte,estilo_texto)]) tintegrantes=Table(integrantes,(60,60,60,70,70,70,70,70)) tintegrantes.setStyle(TableStyle([ ('INNERGRID', (0,1), (-1,-1), 0.25, colors.black), ('BOX', (0,1), (-1,-1), 0.25, colors.black), ('BACKGROUND',(0,1),(-1,1),colors.lightgrey) ])) story.append(tintegrantes) cant_list = len(self.lista_ticket) if(cant_list <10): result = 11-cant_list for item in range(1,result): story.append(Spacer(0,8)) story.append(Spacer(0,1)) #pyqtRemoveInputHook() #import pdb; pdb.set_trace() a = ("%.2f" % monto_ticket) totales =[[Paragraph('''<font size=8> <b> </b></font>''',styleSheet["BodyText"])], [Paragraph("<b>Importe: $"+str(a) +" </b>",style_barra)]] tota = Table(totales, colWidths=200, rowHeights=20, hAlign='RIGHT') #t=Table(totales, (590)) tota.setStyle(TableStyle([ ('INNERGRID', (0,1), (-1,-1), 0.25, colors.black), ('BOX', (0,1), (-1,-1), 0.25, colors.black), ('BACKGROUND',(0,1),(-1,1),colors.white) ])) story.append(tota) if cant_list >= 1 and cant_list < 6: story.append(Spacer(0,50)) elif cant_list > 6 and cant_list < 10: story.append(Spacer(0,25)) #dejo un mesaje tengo que agregar un while que compara si la cantidad de cuotas pagas es igual # a cantidad el credito esta cancelado #pyqtRemoveInputHook() #import pdb; #pdb.set_trace() if self.credito_cancelado: totales = [[Paragraph('''<font size=5> <b> </b></font>''', styleSheet["BodyText"])], [Paragraph("<b>CREDITO CANCELADO</b>", style_barra)]] tota = Table(totales, colWidths=200, rowHeights=20, hAlign='LEFT') # t=Table(totales, (590)) tota.setStyle(TableStyle([ ('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white) ])) story.append(tota) #-------------Duplicado------------------# ##superior d = Drawing(100, 1) d.add(Line(-5, -15, 585, -15)) story.append(d) #izquierda d = Drawing(100, 1) d.add(Line(-5, -15, -5, -94)) story.append(d) story.append(ban) story.append(Spacer(0,1)) story.append(ban2) story.append(Spacer(0,-150)) story.append(tban3) #centro d = Drawing(100, 1) d.add(Line(250, -2, 250, 79)) story.append(d) #derecha d = Drawing(100, 1) d.add(Line(585, -1, 585, 79)) story.append(d) #inferior d = Drawing(100, 1) d.add(Line(-5, 0, 585, 0)) story.append(d) story.append(Spacer(150,-10)) story.append(Spacer(0,10)) story.append(tcabezal) story.append(Spacer(0,10)) story.append(tintegrantes) cant_list = len(self.lista_ticket) if(cant_list <10): result = 11-cant_list for item in range(1,result): story.append(Spacer(0,8)) story.append(Spacer(0,1)) story.append(tota) if cant_list >= 1 and cant_list < 6: story.append(Spacer(0,50)) elif cant_list > 6 and cant_list < 10: story.append(Spacer(0,25)) #---------------------------------------CAMBIAR RUTA (LA PALABRA slam2016 POR LA RUTA DESEADA DE LA PC)------------------------------------------------# obj_config = configuracion() cadena = obj_config.ruta() file_path = cadena + "/pdf/ticket/ticket"+str(datetime.date.today().year)+"_"+str(datetime.date.today().month) #---EJEMPLO de windows: c:/Users/tatilu-----------------------------------------------------------------------# if not os.path.exists(file_path): os.makedirs(file_path) doc = SimpleDocTemplate(file_path +"/ticket"+ obj_asoc.apellido +"_"+obj_asoc.nombre +".pdf", pagesize=A4, rightMargin=0.5,leftMargin=0.5, topMargin=5,bottomMargin=18) doc.build(story ) msgBox = QMessageBox() msgBox.setWindowTitle("Estado de Ticket") msgBox.setText("El ticket se ha generado correctamente : ticket" + obj_asoc.apellido +"_"+obj_asoc.nombre ) msgBox.exec_() if sys.platform == 'linux': subprocess.call(["xdg-open", file_path +"/ticket"+ obj_asoc.apellido +"_"+obj_asoc.nombre +".pdf"]) else: os.startfile( file_path +"/ticket"+ obj_asoc.apellido +"_"+obj_asoc.nombre +".pdf")
def generar_30dias(self): obj_N_cuotas = N_cuotas(1) self.listado_cuotas_30_dias = obj_N_cuotas.lista_cuotas_venc_30_dias() styleSheet = getSampleStyleSheet() #pyqtRemoveInputHook() #import pdb; pdb.set_trace() img = Image("cabezal.png", 250, 75) img.hAlign = "LEFT" #pyqtRemoveInputHook() #import pdb; pdb.set_trace() otro_estilo = ParagraphStyle('', fontSize=20, textColor='#000', leftIndent=200, rightIndent=50) style_barra = ParagraphStyle('', fontSize=13, textColor='#000', backColor='#f5f5f5', borderColor='#a3a3a3', borderWidth=1, borderPadding=(1, 2, 5)) texto_principal = "" estilo_texto = ParagraphStyle( '', fontSize=22, alignment=0, spaceBefore=0, spaceAfter=0, #backColor = '#fff', textColor='#999', leftIndent=10) h = Paragraph(texto_principal, estilo_texto) banner = [[img, h]] options = QFileDialog.Options() story = [] ban = Table(banner, colWidths=300, rowHeights=10) ban.setStyle([('ALIGN', (0, 0), (0, 0), 'LEFT'), ('ALIGN', (0, 0), (1, 0), 'LEFT'), ('VALIGN', (0, 0), (1, 0), 'TOP'), ('TEXTCOLOR', (0, 1), (0, -1), colors.blue)]) story.append(ban) story.append(Spacer(0, -17)) P = Paragraph("<b>Reportes</b> ", otro_estilo) story.append(P) story.append(Spacer(0, 25)) P = Paragraph( "<b>Cuotas vencidas hasta 30 dias</b> " + str(datetime.datetime.now()), style_barra) story.append(P) story.append(Spacer(0, 25)) #nombre apellido dni Nro prestamo nro cuota monto integrantes = [[ Paragraph('''<font size=12> <b> </b></font>''', styleSheet["BodyText"]) ], [ 'Apellido', 'Nombre', 'D.N.I:', 'Nro Crédito:', 'Nro Cuota', 'Monto' ]] #pyqtRemoveInputHook() #import pdb; pdb.set_trace() for item in self.listado_cuotas_30_dias: monto_adeudado = float(item.importe_primer_venc) + float( item.punitorios) obj_N_credito = N_creditos(1) obj_credito = obj_N_credito.buscar_credito_por_nro_credito( item.nro_credito) obj_N_datos_personales_cliente = N_datos_personales_cliente() obj_party = obj_N_datos_personales_cliente.buscar_party_party_por_id( obj_credito.id_party) integrantes.append([ str(obj_party.apellido), str(obj_party.nombre), str(obj_party.nro_doc), str(item.nro_credito), str(item.nro_cuota), str(monto_adeudado) ]) t = Table(integrantes, (150, 135, 100, 55, 55, 55)) t.setStyle( TableStyle([('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.lightgrey)])) story.append(t) story.append(Spacer(0, 15)) obj_config = configuracion() cadena = obj_config.ruta() file_path = cadena + "/pdf/listados/list_morosos_30dias" + str( datetime.date.today().year) + "_" + str( datetime.date.today().month) if not os.path.exists(file_path): os.makedirs(file_path) doc = SimpleDocTemplate(file_path + "/listado_de_morosos_30dias.pdf") doc.build(story) msgBox = QMessageBox() msgBox.setWindowTitle("Estado de Listado") msgBox.setText( "El Listado se ha generado correctamente : ticket listado_de_morosos_30dias.pdf" ) msgBox.exec_() if sys.platform == 'linux': subprocess.call( ["xdg-open", file_path + "/listado_de_morosos_30dias.pdf"]) else: os.startfile(file_path + "/listado_de_morosos_30dias.pdf")
def imprimir(self): #monto_total_credito_letras = to_word(int(self.obj_form.lne_importe_prestamo_creditonuevo.text()),'EUR') #cant_cta_letras = to_word(int(self.obj_form.spbx_cantidad_cuotas_creditonuevo.text()),'EUR') obj_E_party = E_party_party() obj_asoc = obj_E_party.get_party_party( self.obj_form.lne_nro_doc_creditonuevo.text()) obj_N_party_address = N_party_address("a") obj_party_address = obj_N_party_address.get_party_address( obj_asoc.id_party) fec_hoy = datetime.date.today() hoy = fec_hoy.strftime("%d/%m/%Y") styleSheet = getSampleStyleSheet() img = Image("cabezalcaida.png", 100, 25) img.hAlign = "RIGHT" otro_estilo = ParagraphStyle('', fontSize=9, textColor='#000', leftIndent=-44, rightIndent=150) fec_estilo = ParagraphStyle('', fontSize=9, textColor='#000', leftIndent=360, rightIndent=0) style_barra = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=0, rightIndent=10) texto_principal = "" estilo_texto = ParagraphStyle( '', fontSize=5, alignment=0, spaceBefore=0, spaceAfter=0, #backColor = '#fff', textColor='#000', leftIndent=5) h = Paragraph(texto_principal, estilo_texto) banner = [[img, h]] options = QFileDialog.Options() story = [] ban = Table(banner, colWidths=270, rowHeights=-25) story.append(ban) story.append(Spacer(0, 25)) P = Paragraph("<b> Fecha: </b>" + str(hoy) + "", fec_estilo) story.append(P) story.append(Spacer(0, 5)) P = Paragraph( "<b>Sr/a: </b>" + obj_asoc.apellido + " " + obj_asoc.nombre + " ", otro_estilo) story.append(P) story.append(Spacer(0, 5)) # P=Paragraph("<|b>DNI: </b>" + obj_asoc.num_doc + " " , otro_estilo) # story.append(P) # story.append(Spacer(0,5)) P = Paragraph("<b>Domicilio: </b>" + obj_party_address.domicilio + " ", otro_estilo) story.append(P) story.append(Spacer(0, 5)) P = Paragraph("<b>Localidad: </b>" + obj_party_address.ciudad + " ", otro_estilo) story.append(P) story.append(Spacer(0, 5)) integrantes = [ [ Paragraph('''<font size=10> <b> </b></font>''', styleSheet["BodyText"]) ], [ Paragraph('''<font size=10> <b> N° Cuota</b></font>''', estilo_texto), Paragraph('''<font size=10> <b> 1er Venc </b></font>''', estilo_texto), Paragraph( '''<font size=10> <b> Importe 1er Venc </b></font>''', estilo_texto) ] ] for row in xrange( self.obj_form.tw_lista_cuotas_creditonuevo.rowCount()): nro_cuota = self.obj_form.tw_lista_cuotas_creditonuevo.item( row, 0).text() capital = self.obj_form.tw_lista_cuotas_creditonuevo.item( row, 1).text() interes = self.obj_form.tw_lista_cuotas_creditonuevo.item( row, 2).text() _1er_Venc = self.obj_form.tw_lista_cuotas_creditonuevo.item( row, 4).text() fec_venc = datetime.datetime.strptime(_1er_Venc, "%Y-%m-%d %H:%M:%S") importe_1er_Venc = self.obj_form.tw_lista_cuotas_creditonuevo.item( row, 5).text() #pyqtRemoveInputHook() #import pdb; pdb.set_trace() mes = self.convert_Mes(fec_venc.month) estilonom_plan = " <font size=9>" + nro_cuota + "</font>" estilodescuento = " <font size=9>" + str( fec_venc.day) + "/ " + mes + " </font>" estilointeres = " <font size=9>" + importe_1er_Venc + "</font>" integrantes.append([ Paragraph(estilonom_plan, estilo_texto), Paragraph(estilodescuento, estilo_texto), Paragraph(estilointeres, estilo_texto) ]) t = Table(integrantes, (175, 175, 175)) t.setStyle( TableStyle([ ('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.lightgrey) ])) story.append(t) story.append(Spacer(0, 25)) P = Paragraph( "*** Informamos que ante el pago fuera de término, la empresa aplicará interés por mora***", style_barra) story.append(P) #---------------------------------------CAMBIAR RUTA (LA PALABRA slam2016 POR LA RUTA DESEADA DE LA PC)------------------------------------------------# #pyqtRemoveInputHook() #import pdb; pdb.set_trace() obj_config = configuracion() cadena = obj_config.ruta() file_path = cadena + "/pdf/credito/credito" + str( datetime.date.today().year) + "_" + str( datetime.date.today().month) if not os.path.exists(file_path): os.makedirs(file_path) doc = SimpleDocTemplate(file_path + "/credito_" + obj_asoc.apellido + "_" + obj_asoc.nombre + ".pdf") doc.build(story) msgBox = QMessageBox() msgBox.setWindowTitle("Estado de Credito") msgBox.setText("El Credito se ha generado correctamente") msgBox.exec_() if sys.platform == 'linux': subprocess.call([ "xdg-open", file_path + "/credito_" + obj_asoc.apellido + "_" + obj_asoc.nombre + ".pdf" ]) else: os.startfile(file_path + "/credito_" + obj_asoc.apellido + "_" + obj_asoc.nombre + ".pdf") return True
def __init__(self,id): a = id obj_conexion = configuracion() engine=create_engine(obj_conexion.config()) Session= sessionmaker(bind=engine) self.session=Session()
def __init__(self, slam): slam1 = slam obj_conexion = configuracion() engine=create_engine(obj_conexion.config()) Session= sessionmaker(bind=engine) self.session=Session()
def reporte(self): fec_hoy= datetime.date.today() hoy = fec_hoy.strftime("%d/%m/%Y") obj_e_cuotas = E_cuotas(1) styleSheet=getSampleStyleSheet() img=Image("cabezalcaida.png",100,25) img.hAlign = "RIGHT" otro_estilo= ParagraphStyle('',fontSize =9,textColor = '#000',leftIndent = -44,rightIndent = 150) fec_estilo= ParagraphStyle('',fontSize =9,textColor = '#000',leftIndent = 360,rightIndent = 0) style_barra= ParagraphStyle('',fontSize = 10,textColor = '#000',leftIndent = 0,rightIndent = 10) texto_principal = "" estilo_texto = ParagraphStyle('', fontSize = 5, alignment = 0, spaceBefore = 0, spaceAfter = 0, #backColor = '#fff', textColor = '#000', leftIndent = 5 ) h = Paragraph( texto_principal, estilo_texto) banner = [ [ img,h ] ] options = QFileDialog.Options() story=[] ban = Table( banner, colWidths=270, rowHeights=-25) story.append(ban) story.append(Spacer(0,25)) P=Paragraph("<b> Fecha: </b>" + str(hoy)+"",fec_estilo) story.append(P) story.append(Spacer(0,5)) #grilla cabezal integrantes = [[Paragraph('''<font size=10> <b> </b></font>''', styleSheet["BodyText"])], [Paragraph('''<font size=10> <b> Cliente</b></font>''', estilo_texto), Paragraph('''<font size=10> <b> Monto</b></font>''', estilo_texto)]] t="" list_cuotas=list() list_cuotas = obj_e_cuotas.reporte_deuda_por_cliente() #pyqtRemoveInputHook() #import pdb;pdb.set_trace() for item in list_cuotas: #pyqtRemoveInputHook() #import pdb; pdb.set_trace() apellido = item[1] nombre = item[2] monto = item[0] estiloape_nom= " <font size=9>" + apellido +', '+nombre + "</font>" estilodescuento= " <font size=9>" + str(monto) + " </font>" integrantes.append([Paragraph(estiloape_nom, estilo_texto), Paragraph(estilodescuento, estilo_texto)]) t=Table(integrantes, (175, 175)) t.setStyle(TableStyle([ ('INNERGRID', (0,1), (-1,-1), 0.25, colors.black), ('BOX', (0,1), (-1,-1), 0.25, colors.black), ('BACKGROUND',(0,1),(-1,1),colors.lightgrey) ])) story.append(t) # ---------------------------------------CAMBIAR RUTA (LA PALABRA slam2016 POR LA RUTA DESEADA DE LA PC)------------------------------------------------# # pyqtRemoveInputHook() # import pdb; pdb.set_trace() obj_config = configuracion() cadena = obj_config.ruta() file_path = cadena + "/pdf/credito/credito" + str(datetime.date.today().year) + "_" + str( datetime.date.today().month) if not os.path.exists(file_path): os.makedirs(file_path) doc = SimpleDocTemplate(file_path + "/reporte_cliente_deuda.pdf") doc.build(story) msgBox = QMessageBox() msgBox.setWindowTitle("Reporte Cliente Deuda") msgBox.setText("El Reporte fue generado correctamente") msgBox.exec_() if sys.platform == 'linux': subprocess.call(["xdg-open", file_path + "/reporte_cliente_deuda.pdf"]) else: os.startfile(file_path + "/reporte_cliente_deuda.pdf") return True
def imprimir(self): obj_ejercicio = "" for item in self.lista_ejercicio: if item.descripcion == self.obj_form.cbx_ejercicio.currentText(): obj_ejercicio = item obj_e_reporte = E_reporte() lista_diario_gral = obj_e_reporte.reporte_diario_general( str(obj_ejercicio.id_ejercicio)) styleSheet = getSampleStyleSheet() otro_estilo = ParagraphStyle('', fontSize=8, textColor='#000', leftIndent=150, rightIndent=50) style_barra = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=0, rightIndent=50) texto_principal = "" texto_secundario = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=200, rightIndent=1) estilo_texto = ParagraphStyle('', fontSize=7, alignment=0, spaceBefore=0, spaceAfter=0, textColor='#000', leftIndent=15) estilo_texto2 = ParagraphStyle( '', fontSize=9, alignment=0, spaceBefore=-1, spaceAfter=-1, #backColor = '#819FF7', textColor='#000', leftIndent=5) estilo_detalle_cuota = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=0, rightIndent=0) options = QFileDialog.Options() story = [] P = Paragraph( '<b> EJERCICIO N° </b>' + str(obj_ejercicio.descripcion).upper() + " DESDE " + str(obj_ejercicio.fec_inicio) + " al " + str(obj_ejercicio.fec_fin), otro_estilo) story.append(P) story.append(Spacer(0, -5)) cabezal = [[Paragraph('''<b> </b>''', styleSheet["BodyText"])], [ Paragraph(' <b> FECHA </b> ', estilo_texto), Paragraph('<b> NRO </b> ', estilo_texto), Paragraph('<b> DESCRIPCIÓN </b> ', estilo_texto), Paragraph('<b> DEBE </b> ', estilo_texto), Paragraph('<b> HABER </b> ', estilo_texto) ]] t = "" asiento = "" nro = 1 for item in lista_diario_gral: #pyqtRemoveInputHook() #import pdb; pdb.set_trace() if asiento != item[1]: fecha = item[0] asiento = item[1] estilofecha = "<b><font size=6>" + str( item[0]).upper() + "</font></b>" estilonro = " <font size=6>" + str(nro) + "</font>" estilodescripcion = "<b><font size=6>" + str( item[1]).upper() + " </font></b>" estilodebe = "<font size=6>-</font>" estilohaber = "<font size=6>-</font>" cabezal.append([ Paragraph(estilofecha, estilo_texto2), Paragraph(estilonro, estilo_texto), Paragraph(estilodescripcion, estilo_texto2), Paragraph(estilodebe, estilo_texto2), Paragraph(estilohaber, estilo_texto2) ]) t = Table(cabezal, (60, 30, 270, 75, 75)) t.setStyle( TableStyle([ ('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white) ])) #story.append(t) nro = nro + 1 estilocodigo = " <font size=6>" + str(item[3]) + "</font>" estilonro = " <font size=6>" + "-" + "</font>" estilodescripcion = " <font size=6>" + str( item[2]) + " </font>" estilodebe = " <font size=6> " + str(item[4]) + " </font>" estilohaber = " <font size=6> " + str(item[5]) + " </font>" cabezal.append([ Paragraph(estilocodigo, estilo_texto), Paragraph(estilonro, estilo_texto), Paragraph(estilodescripcion, estilo_texto), Paragraph(estilodebe, estilo_texto), Paragraph(estilohaber, estilo_texto) ]) t = Table(cabezal, (60, 30, 270, 75, 75)) t.setStyle( TableStyle([ ('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white) ])) else: estilocodigo = " <font size=6>" + str(item[3]) + "</font>" estilonro = " <font size=6>" + "-" + "</font>" estilodescripcion = " <font size=6>" + str( item[2]) + " </font>" estilodebe = " <font size=6> " + str(item[4]) + " </font>" estilohaber = " <font size=6> " + str(item[5]) + " </font>" cabezal.append([ Paragraph(estilocodigo, estilo_texto), Paragraph(estilonro, estilo_texto), Paragraph(estilodescripcion, estilo_texto), Paragraph(estilodebe, estilo_texto), Paragraph(estilohaber, estilo_texto) ]) t = Table(cabezal, (60, 30, 270, 75, 75)) t.setStyle( TableStyle([ ('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white) ])) story.append(t) P = Paragraph('<b> RESULTADO </b>' " DEBE " " HABER", otro_estilo) story.append(P) story.append(Spacer(0, -5)) #---------------------------------------CAMBIAR RUTA (LA PALABRA slam2016 POR LA RUTA DESEADA DE LA PC)------------------------------------------------# #pyqtRemoveInputHook() #import pdb;pdb.set_trace() obj_config = configuracion() cadena = obj_config.ruta() file_path = cadena + "/pdf/reportes/diario_general" + str( datetime.date.today().year) + "_" + str( datetime.date.today().month) #---EJEMPLO de windows: c:/Users/tatilu-----------------------------------------------------------------------# if not os.path.exists(file_path): os.makedirs(file_path) doc = SimpleDocTemplate(file_path + "/diario_general " + self.obj_cliente.nombre + "_" + self.obj_cliente.apellido + ".pdf", pagesize=A4, rightMargin=14, leftMargin=14, topMargin=5, bottomMargin=18) doc.build(story) msgBox = QMessageBox() msgBox.setWindowTitle("Estado de Reporte") msgBox.setText("El reporte se ha generado correctamente") msgBox.exec_() if sys.platform == 'linux': subprocess.call([ "xdg-open", file_path + "/diario_general " + self.obj_cliente.nombre + "_" + self.obj_cliente.apellido + ".pdf" ]) else: os.startfile(file_path + "/diario_general " + self.obj_cliente.nombre + "_" + self.obj_cliente.apellido + ".pdf")
def actualizar_cliente(self,id_party): # party party if (self.obj_form.lne_apellido_actualizar.text() !="") and (self.obj_form.lne_nombre_actualizar.text() !="") and (self.obj_form.lne_nro_doc_actualizar.text() !="") and (self.obj_form.lne_nro_cliente.text() !=""): obj_N_datos_personales_cliente = N_datos_personales_cliente() obj_party_party=obj_N_datos_personales_cliente.buscar_party_party_por_id(self.obj_form.lne_id_party_actualizar.text()) self.id_party = obj_party_party.id_party obj_party_party = N_datos_personales_cliente() obj_party_party.apellido = self.obj_form.lne_apellido_actualizar.text().upper() obj_party_party.nombre = self.obj_form.lne_nombre_actualizar.text().upper() obj_party_party.tipo_doc = self.obj_form.cbx_tipo_doc_actualizar.currentText() obj_party_party.nro_doc = self.obj_form.lne_nro_doc_actualizar.text() obj_party_party.estado_civil = self.obj_form.cbx_estado_civil_actualizar.currentText() obj_party_party.fec_nac = self.obj_form.dte_nacimiento_actualizar.text() obj_party_party.limite_credito = self.obj_form.lne_limite_credito_actualizar.text() obj_party_party.estado = self.obj_form.cbx_estado_actualizar.currentText() obj_N_datos_personales_cliente.actualizar_party_party(obj_party_party, self.id_party) obj_party_cliente = N_party_cliente(self.id_party) #pyqtRemoveInputHook() #import pdb; pdb.set_trace() obj_comentario = obj_party_cliente.actualizar_comentario(self.id_party, self.obj_form.txte_observaciones_actualizar.toPlainText()) self.nro_cliente = obj_party_cliente.get_nro_cliente(self.id_party) self.obj_form.lne_nro_cliente.setText(str(self.nro_cliente)) #pyqtRemoveInputHook() #import pdb; pdb.set_trace() # tabla address ciudad = self.obj_form.lne_barrio_actualizar.text() obj_N_party_address = N_party_address(ciudad) obj_N_party_address.domicilio = self.obj_form.lne_domicilio_actualizar.text() obj_N_party_address.barrio = self.obj_form.lne_barrio_actualizar.text() obj_N_party_address.ciudad = self.obj_form.cbx_ciudad_actualizar.currentText() #boton guardar obj_party_address= N_party_address(ciudad) obj_party_address.actualizar_party_address(obj_N_party_address, self.id_party) # actualizo tabla contact obj_party_contacto3= N_party_contacto(1) obj_party_contacto3.type_contacto= "Telefono" obj_party_contacto3.value =self.obj_form.lne_telefono_actualizar.text() obj_party_contacto_email=N_party_contacto(1) obj_party_contacto_email.type_contacto="Email" obj_party_contacto_email.value= self.obj_form.lne_email_actualizar.text() obj_N_party_contacto=N_party_contacto(1) #obj_N_party_contacto.domicilio = self.obj_form.txte_observaciones_actualizar.text() obj_N_party_contacto.actualizar_party_contact(obj_party_contacto3, self.id_party) obj_N_party_contacto.actualizar_party_contact(obj_party_contacto_email, self.id_party) #actualizo party datos laborales organismo = self.obj_form.lne_organismo_actualizar.text() obj_N_datos_laborales = N_datos_laborales() obj_N_datos_laborales.sueldo = self.obj_form.lne_sueldo_actualizar.text() obj_N_datos_laborales.anti_laboral = self.obj_form.lne_antiguedad_actualizar.text() obj_N_datos_laborales.tel_laboral = self.obj_form.lne_telefono_laboral_actualizar.text() obj_N_datos_laborales.dom_laboral = self.obj_form.lne_domicilio_laboral_actualizar.text() obj_N_datos_laborales.organismo = self.obj_form.lne_organismo_actualizar.text() obj_N_datos_laborales.ocupacion = self.obj_form.lne_ocupacion_actualizar.text() obj_N_datos_laborales.categoria = self.obj_form.lne_categoria_actualizar.text() if self.obj_form.ckbx_recibo_sueldo_actualizar.isChecked(): obj_N_datos_laborales.posee_recibo_sueldo = True else: obj_N_datos_laborales.posee_recibo_sueldo = False #boton guardar obj_datos_laborales= N_datos_laborales() obj_datos_laborales.actualizar_datos_laborales(obj_N_datos_laborales,self.id_party) # tabla party otros------------ cuit = self.obj_form.lne_cuit_actualizar.text() obj_N_party_otros = N_party_otros(cuit) obj_N_party_otros.tipo_iva = self.obj_form.cbx_tipo_iva_actualizar.currentText() obj_N_party_otros.cuit = self.obj_form.lne_cuit_actualizar.text() obj_N_party_otros.cbu = self.obj_form.lne_cbu_actualizar.text() obj_N_party_otros.num_beneficio = self.obj_form.lne_nro_beneficio_actualizar.text() if self.obj_form.ckbx_facturas_actualizar.isChecked(): obj_N_party_otros.presento_factura = True if self.obj_form.ckbx_veraz_actualizar.isChecked(): obj_N_party_otros.figura_veraz = True if self.obj_form.ckbx_jub_pens_actualizar.isChecked(): obj_N_party_otros.es_jubilado_pensionado = True #if self.obj_form.ckbx_monotributista_actualizar.isChecked(): # obj_N_party_otros.monotributista = True #if self.obj_form.ckbx_cliente_bloqueado_actualizar.isChecked(): # obj_N_party_otros.cliente_bloqueado = True #boton guardar obj_party_otros= N_party_otros(cuit) obj_party_otros.actualizar_party_otros(obj_N_party_otros,self.id_party) #grilla actualizar obj_N_garante = N_party_garante(1) obj_N_garante.actualizar_lista_garante(self.list_garante, self.nro_cliente) #lne_archivo if self.obj_form.lne_archivo.text() != self.descripcion_archivo: nom_archivo = self.get_nom_archivo() #Actualizar archivo obj_config = configuracion() file_path = obj_config.ruta_server()+"/comprobantes" if not os.path.exists(file_path): os.makedirs(file_path) obj_archivo= E_archivo() obj_archivo.id_party= self.id_party obj_archivo.descripcion = file_path + nom_archivo obj_archivo.tipo_doc = "Comprobante creditos pre-existentes" obj_archivo.fec_create = datetime.date.today() obj_E_archivo = E_archivo() obj_E_archivo.actualizar(obj_archivo) cnopts = pysftp.CnOpts() cnopts.hostkeys = None try: with pysftp.Connection(host=obj_config.host_server(), username=obj_config.usu_server(), password=obj_config.pass_server(),cnopts=cnopts) as sftp: #sftp.put('/home/user/Documentos/credired/vencimientos/prueba.txt', '/home/user/Documentos/prueba.txt', confirm=True, preserve_mtime=False) # upload file to public/ on remote #sftp.put_r('/home/user/Documentos/credired/vencimientos', '/home/user/Documentos/', confirm=True, preserve_mtime=False) sftp.put(self.obj_form.lne_archivo.text(), obj_archivo.descripcion, confirm=True, preserve_mtime=False) # upload file to public/ on remote except: msgBox = QMessageBox() msgBox.setWindowTitle("Aviso") msgBox.setText("No se pudo actulizar el archivo") msgBox.exec_() msgBox = QMessageBox() msgBox.setWindowTitle("Aviso") msgBox.setText("Cliente actualizado.") msgBox.exec_() else: msgBox = QMessageBox() msgBox.setWindowTitle("Advertencia") msgBox.setText("Revisar campos obligatorios: Nombre, Apellido y Dni.") msgBox.exec_()
def ticket(self): monto_ticket = 0 for item in self.lista_ticket: monto_ticket = monto_ticket + item.importe_cobrado obj_E_ticket = E_ticket() obj_E_ticket.monto = monto_ticket obj_E_ticket.fecha = datetime.date.today() obj_E_ticket.nro_credito = self.nro_credito_ticket obj_E_ticket.write_uid = self.singleton_idusu.idusu obj_E_ticket.guardar_ticket(obj_E_ticket) nro_ticket = obj_E_ticket.buscar_ticket(self.nro_credito_ticket) obj_E_party = E_party_party() obj_asoc = obj_E_party.get_party_party(self.obj_form.lne_dni.text()) obj_E_address = E_party_address() obj_address = obj_E_address.get_party_address(obj_asoc.id_party) fec_hoy = datetime.date.today() hoy = fec_hoy.strftime("%d/%m/%Y") styleSheet = getSampleStyleSheet() img = Image("cabezal3.png", 150, 35) img.hAlign = "RIGHT" otro_estilo = ParagraphStyle('', fontSize=6, textColor='#000', leftIndent=0, rightIndent=100) style_barra = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=0, rightIndent=50) texto_principal = "" texto_secundario = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=0, rightIndent=0) texto_banner2 = ParagraphStyle('', fontSize=6, textColor='#000', leftIndent=-150, rightIndent=0) estilo_texto = ParagraphStyle( '', fontSize=5, alignment=0, spaceBefore=0, spaceAfter=0, #backColor = '#fff', textColor='#000', leftIndent=5) h = "" #Paragraph("<br/><br/><br/>aa<br/><b>Buenos Aires 53 -Local 2 y 3 -Tel.:02920-432424/ Cel.:02920-15695353</b> ",texto_banner2) banner = [[img, h]] banner2 = [ [ Paragraph('''<font size=3> <b> </b></font>''', styleSheet["BodyText"]) ], [ Paragraph( "<b>Buenos Aires 53 -Local 2 y 3 -Tel.:02920-432424/ Cel.:02920-15695353</b><br/><b> Viedma - Río Negro - E-mail: [email protected]</b> ", texto_banner2) ] ] banner3 = [ [ Paragraph('''<font size=8> <b> </b></font>''', styleSheet["BodyText"]) ], [ Paragraph( "<b>RECIBO N° " + str(nro_ticket) + "<br/>Fecha: " + str(hoy) + "<br/> CUIT: 30-71446302-7 <br/> ING. BRUTOS: 45969604 <br/> INIC. ACTIVIDADES: 20/05/2014</b> ", texto_secundario) ] ] options = QFileDialog.Options() story = [] ban = Table(banner, colWidths=300, rowHeights=70, hAlign="RIGHT") ban2 = Table(banner2, colWidths=300, rowHeights=10) ban3 = Table(banner3, colWidths=318, rowHeights=75, hAlign='RIGHT') tban3 = ban3 tban3.setStyle( TableStyle([('INNERGRID', (0, 1), (-1, -1), 0.25, colors.white), ('BOX', (0, 1), (0, -1), 0.25, colors.white), ('BACKGROUND', (0, 1), (-1, 1), colors.white)])) #story.append(Spacer(100,10)) ##superior d = Drawing(100, 1) d.add(Line(-5, -15, 585, -15)) story.append(d) #izquierda d = Drawing(100, 1) d.add(Line(-5, -15, -5, -94)) story.append(d) story.append(ban) story.append(Spacer(0, 1)) story.append(ban2) story.append(Spacer(0, -150)) story.append(tban3) #centro d = Drawing(100, 1) d.add(Line(250, -2, 250, 79)) story.append(d) #derecha d = Drawing(100, 1) d.add(Line(585, -1, 585, 79)) story.append(d) #inferior d = Drawing(100, 1) d.add(Line(-5, 0, 585, 0)) story.append(d) story.append(Spacer(150, -10)) cabezal = [ [ Paragraph('''<font size=8> <b> </b></font>''', styleSheet["BodyText"]) ], [ Paragraph( '<font size=8> <b> Señor(es): ' + obj_asoc.apellido + ", " + obj_asoc.nombre + '</b> <br/> <b> Domicilio: ' + obj_address.domicilio + '</b><br/></font>', estilo_texto) ] ] tcabezal = Table(cabezal, (590)) tcabezal.setStyle( TableStyle([('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white)])) story.append(tcabezal) story.append(Spacer(0, -15)) integrantes = [ [ Paragraph('''<font size=10> <b> </b></font>''', styleSheet["BodyText"]) ], [ Paragraph('''<font size=10> <b> </b>Credito N°</font>''', estilo_texto), Paragraph('''<font size=10> <b> </b>Cuota N°</font>''', estilo_texto), Paragraph('''<font size=10> <b> </b>Monto</font>''', estilo_texto), Paragraph('''<font size=10> <b> </b>Vencimiento</font>''', estilo_texto), Paragraph('''<font size=10> <b> </b>Estado</font>''', estilo_texto), Paragraph('''<font size=10> <b> </b>Descuento</font>''', estilo_texto), Paragraph('''<font size=10> <b> </b>Interes</font>''', estilo_texto), Paragraph('''<font size=10> <b> </b>Importe</font>''', estilo_texto) ] ] for item in self.lista_ticket: #obj_cuotas.nro_credito = self.nro_credito_historial #obj_cuotas.importe_primer_venc = self.vencimiento_historial.text() #obj_cuotas.primer_Vencimiento = self.vencimiento_historial.text() estilonro_credi = " <font size=8>" + str( item.nro_credito) + "</font>" estilonro_cta = " <font size=8>" + str(item.nro_cuota) + "</font>" estilomonto = " <font size=8>" + str( item.importe_primer_venc) + "</font>" estiloprimer_venc = " <font size=8>" + str( item.primer_Vencimiento) + "</font>" estiloestado_cta = " <font size=8>" + item.estado_cuota + "</font>" estilodescuento = " <font size=8>" + str( item.descuento) + "</font>" estilointeres = " <font size=8>" + str(item.punitorios) + "</font>" estiloimporte = " <font size=8>" + str( item.importe_cobrado) + "</font>" integrantes.append([ Paragraph(estilonro_credi, estilo_texto), Paragraph(estilonro_cta, estilo_texto), Paragraph(estilomonto, estilo_texto), Paragraph(estiloprimer_venc, estilo_texto), Paragraph(estiloestado_cta, estilo_texto), Paragraph(estilodescuento, estilo_texto), Paragraph(estilointeres, estilo_texto), Paragraph(estiloimporte, estilo_texto) ]) tintegrantes = Table(integrantes, (60, 60, 60, 70, 70, 70, 70, 70)) tintegrantes.setStyle( TableStyle([ ('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.lightgrey) ])) story.append(tintegrantes) cant_list = len(self.lista_ticket) if (cant_list < 10): result = 11 - cant_list for item in range(1, result): story.append(Spacer(0, 8)) story.append(Spacer(0, 1)) #pyqtRemoveInputHook() #import pdb; pdb.set_trace() a = ("%.2f" % monto_ticket) totales = [[ Paragraph('''<font size=8> <b> </b></font>''', styleSheet["BodyText"]) ], [Paragraph("<b>Importe: $" + str(a) + " </b>", style_barra)]] tota = Table(totales, colWidths=200, rowHeights=20, hAlign='RIGHT') #t=Table(totales, (590)) tota.setStyle( TableStyle([('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white)])) story.append(tota) if cant_list >= 1 and cant_list < 6: story.append(Spacer(0, 50)) elif cant_list > 6 and cant_list < 10: story.append(Spacer(0, 25)) #dejo un mesaje tengo que agregar un while que compara si la cantidad de cuotas pagas es igual # a cantidad el credito esta cancelado #pyqtRemoveInputHook() #import pdb; #pdb.set_trace() if self.credito_cancelado: totales = [[ Paragraph('''<font size=5> <b> </b></font>''', styleSheet["BodyText"]) ], [Paragraph("<b>CREDITO CANCELADO</b>", style_barra)]] tota = Table(totales, colWidths=200, rowHeights=20, hAlign='LEFT') # t=Table(totales, (590)) tota.setStyle( TableStyle([('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white)])) story.append(tota) #-------------Duplicado------------------# ##superior d = Drawing(100, 1) d.add(Line(-5, -15, 585, -15)) story.append(d) #izquierda d = Drawing(100, 1) d.add(Line(-5, -15, -5, -94)) story.append(d) story.append(ban) story.append(Spacer(0, 1)) story.append(ban2) story.append(Spacer(0, -150)) story.append(tban3) #centro d = Drawing(100, 1) d.add(Line(250, -2, 250, 79)) story.append(d) #derecha d = Drawing(100, 1) d.add(Line(585, -1, 585, 79)) story.append(d) #inferior d = Drawing(100, 1) d.add(Line(-5, 0, 585, 0)) story.append(d) story.append(Spacer(150, -10)) story.append(Spacer(0, 10)) story.append(tcabezal) story.append(Spacer(0, 10)) story.append(tintegrantes) cant_list = len(self.lista_ticket) if (cant_list < 10): result = 11 - cant_list for item in range(1, result): story.append(Spacer(0, 8)) story.append(Spacer(0, 1)) story.append(tota) if cant_list >= 1 and cant_list < 6: story.append(Spacer(0, 50)) elif cant_list > 6 and cant_list < 10: story.append(Spacer(0, 25)) #---------------------------------------CAMBIAR RUTA (LA PALABRA slam2016 POR LA RUTA DESEADA DE LA PC)------------------------------------------------# obj_config = configuracion() cadena = obj_config.ruta() file_path = cadena + "/pdf/ticket/ticket" + str( datetime.date.today().year) + "_" + str( datetime.date.today().month) #---EJEMPLO de windows: c:/Users/tatilu-----------------------------------------------------------------------# if not os.path.exists(file_path): os.makedirs(file_path) doc = SimpleDocTemplate(file_path + "/ticket" + obj_asoc.apellido + "_" + obj_asoc.nombre + ".pdf", pagesize=A4, rightMargin=0.5, leftMargin=0.5, topMargin=5, bottomMargin=18) doc.build(story) msgBox = QMessageBox() msgBox.setWindowTitle("Estado de Ticket") msgBox.setText("El ticket se ha generado correctamente : ticket" + obj_asoc.apellido + "_" + obj_asoc.nombre) msgBox.exec_() if sys.platform == 'linux': subprocess.call([ "xdg-open", file_path + "/ticket" + obj_asoc.apellido + "_" + obj_asoc.nombre + ".pdf" ]) else: os.startfile(file_path + "/ticket" + obj_asoc.apellido + "_" + obj_asoc.nombre + ".pdf")
def reporte(self): fec_hoy = datetime.date.today() hoy = fec_hoy.strftime("%d/%m/%Y") obj_e_cuotas = E_cuotas(1) styleSheet = getSampleStyleSheet() img = Image("cabezalcaida.png", 100, 25) img.hAlign = "RIGHT" otro_estilo = ParagraphStyle('', fontSize=9, textColor='#000', leftIndent=-44, rightIndent=150) fec_estilo = ParagraphStyle('', fontSize=9, textColor='#000', leftIndent=360, rightIndent=0) style_barra = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=0, rightIndent=10) texto_principal = "" estilo_texto = ParagraphStyle( '', fontSize=5, alignment=0, spaceBefore=0, spaceAfter=0, #backColor = '#fff', textColor='#000', leftIndent=5) h = Paragraph(texto_principal, estilo_texto) banner = [[img, h]] options = QFileDialog.Options() story = [] ban = Table(banner, colWidths=270, rowHeights=-25) story.append(ban) story.append(Spacer(0, 25)) P = Paragraph("<b> Fecha: </b>" + str(hoy) + "", fec_estilo) story.append(P) story.append(Spacer(0, 5)) #grilla cabezal integrantes = [[ Paragraph('''<font size=10> <b> </b></font>''', styleSheet["BodyText"]) ], [ Paragraph( '''<font size=10> <b> Cliente</b></font>''', estilo_texto), Paragraph('''<font size=10> <b> Monto</b></font>''', estilo_texto) ]] t = "" list_cuotas = list() list_cuotas = obj_e_cuotas.reporte_deuda_por_cliente() #pyqtRemoveInputHook() #import pdb;pdb.set_trace() for item in list_cuotas: #pyqtRemoveInputHook() #import pdb; pdb.set_trace() apellido = item[1] nombre = item[2] monto = item[0] estiloape_nom = " <font size=9>" + apellido + ', ' + nombre + "</font>" estilodescuento = " <font size=9>" + str(monto) + " </font>" integrantes.append([ Paragraph(estiloape_nom, estilo_texto), Paragraph(estilodescuento, estilo_texto) ]) t = Table(integrantes, (175, 175)) t.setStyle( TableStyle([ ('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.lightgrey) ])) story.append(t) # ---------------------------------------CAMBIAR RUTA (LA PALABRA slam2016 POR LA RUTA DESEADA DE LA PC)------------------------------------------------# # pyqtRemoveInputHook() # import pdb; pdb.set_trace() obj_config = configuracion() cadena = obj_config.ruta() file_path = cadena + "/pdf/credito/credito" + str( datetime.date.today().year) + "_" + str( datetime.date.today().month) if not os.path.exists(file_path): os.makedirs(file_path) doc = SimpleDocTemplate(file_path + "/reporte_cliente_deuda.pdf") doc.build(story) msgBox = QMessageBox() msgBox.setWindowTitle("Reporte Cliente Deuda") msgBox.setText("El Reporte fue generado correctamente") msgBox.exec_() if sys.platform == 'linux': subprocess.call( ["xdg-open", file_path + "/reporte_cliente_deuda.pdf"]) else: os.startfile(file_path + "/reporte_cliente_deuda.pdf") return True
def imprimir(self): if self.bandera == True: fec_hoy = datetime.date.today() hoy = fec_hoy.strftime("%d/%m/%Y") styleSheet = getSampleStyleSheet() img = Image("cabezalcaida.png", 225, 50) otro_estilo = ParagraphStyle('', fontSize=20, textColor='#000', leftIndent=200, rightIndent=50) style_barra = ParagraphStyle('', fontSize=13, textColor='#000', leftIndent=300, rightIndent=0) estilo_cabezal = ParagraphStyle('', fontSize=15, textColor='#000', leftIndent=100, rightIndent=0) texto_principal = "" estilo_texto = ParagraphStyle( '', fontSize=12, alignment=0, spaceBefore=0, spaceAfter=0, #backColor = '#fff', textColor='#999', leftIndent=10) h = Paragraph(texto_principal, estilo_texto) banner = [[img, h]] options = QFileDialog.Options() story = [] ban = Table(banner, colWidths=0, rowHeights=10) story.append(ban) story.append(Spacer(0, 15)) P = Paragraph("<u>Registro de egresos diarios </u> ", estilo_cabezal) story.append(P) story.append(Spacer(0, 25)) P = Paragraph("<b>Fecha: " + str(hoy) + " </b> ", style_barra) story.append(P) story.append(Spacer(0, 5)) #nombre apellido dni Nro prestamo nro cuota monto integrantes = [[ Paragraph('''<font size=12> <b> </b></font>''', styleSheet["BodyText"]) ], [ 'N° Orden', 'Cliente', 'Nro. Credito', 'Cant. Cta', 'Monto Cta.', ' Total Crédito' ]] for item in self.lst_ord: integrantes.append([ str(item.id), str(item.apellido + ", " + item.nombre_cliente), str(item.nro_credito), str(item.cantidad_cuotas), str(item.importe_primer_venc), str(item.costo) ]) t = Table(integrantes, (50, 150, 75, 75, 75, 75)) t.setStyle( TableStyle([ ('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.lightgrey) ])) story.append(t) story.append(Spacer(0, 15)) obj_config = configuracion() cadena = obj_config.ruta() file_path = cadena + "pdf/ingresos/Reg_Egresos_" + str( datetime.date.today().year) + "_" + str( datetime.date.today().month) #---EJEMPLO de windows: c:/Users/tatilu-----------------------------------------------------------------------# if not os.path.exists(file_path): os.makedirs(file_path) doc = SimpleDocTemplate(file_path + "/Reg_Egresos_" + str(datetime.date.today()) + ".pdf") doc.build(story) msgBox = QMessageBox() msgBox.setWindowTitle("Estado de Egresos") msgBox.setText( "El Egreso se ha generado correctamente : Reg_Egresos_" + str(datetime.date.today())) msgBox.exec_() if sys.platform == 'linux': subprocess.call([ "xdg-open", file_path + "/Reg_Egresos_" + str(datetime.date.today()) + ".pdf" ]) else: os.startfile(file_path + "/Reg_Egresos_" + str(datetime.date.today()) + ".pdf")
def imprimir(self): #pyqtRemoveInputHook() #import pdb; pdb.set_trace() styleSheet = getSampleStyleSheet() img = Image("cabezal3.png", 150, 35) img.hAlign = "RIGHT" otro_estilo = ParagraphStyle('', fontSize=6, textColor='#000', leftIndent=0, rightIndent=100) style_barra = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=0, rightIndent=50) texto_principal = "" texto_secundario = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=0, rightIndent=0) texto_banner2 = ParagraphStyle('', fontSize=6, textColor='#000', leftIndent=-150, rightIndent=0) estilo_texto = ParagraphStyle( '', fontSize=5, alignment=0, spaceBefore=0, spaceAfter=0, #backColor = '#fff', textColor='#000', leftIndent=5) h = "" #Paragraph("<br/><br/><br/>aa<br/><b>Buenos Aires 53 -Local 2 y 3 -Tel.:02920-432424/ Cel.:02920-15695353</b> ",texto_banner2) banner = [[img, h]] obj_E_cooperativa_address = E_cooperativa_address() obj_coope_address = obj_E_cooperativa_address.get_coop_address() banner2 = [[ Paragraph('''<font size=3> <b> </b></font>''', styleSheet["BodyText"]) ], [ Paragraph( "<b> " + obj_coope_address.domicilio + " " + obj_coope_address.nro + " telefono: " + obj_coope_address.telefono + "</b>" + obj_coope_address.localidad + " - " + obj_coope_address.provincia + "- E-mail: " + str(obj_coope_address.email), texto_banner2) ]] options = QFileDialog.Options() story = [] ban = Table(banner, colWidths=300, rowHeights=70, hAlign="RIGHT") ban2 = Table(banner2, colWidths=300, rowHeights=10) #story.append(Spacer(100,10)) ##superior d = Drawing(100, 1) d.add(Line(-5, -15, 585, -15)) story.append(d) #izquierda d = Drawing(100, 1) d.add(Line(-5, -15, -5, -94)) story.append(d) story.append(ban) story.append(Spacer(0, 1)) story.append(ban2) story.append(Spacer(0, -150)) #centro d = Drawing(100, 1) d.add(Line(250, -2, 250, 79)) story.append(d) #derecha d = Drawing(100, 1) d.add(Line(585, -1, 585, 79)) story.append(d) #inferior d = Drawing(100, 1) d.add(Line(-5, 0, 585, 0)) story.append(d) story.append(Spacer(150, -10)) cabezal = [[ Paragraph('''<font size=8> <b> </b></font>''', styleSheet["BodyText"]) ], [ Paragraph( '<font size=8> <b> Listado ' + self.tipo + " " + self.titulo + " " + str(self.fecha) + '</b><br/></font>', estilo_texto) ]] tcabezal = Table(cabezal, (590)) tcabezal.setStyle( TableStyle([('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white)])) story.append(tcabezal) story.append(Spacer(0, 140)) detalle = [[ Paragraph('''<font size=8> <b> </b></font>''', styleSheet["BodyText"]) ], [ Paragraph( '<font size=8> <b>' + self.descripcion + '</b><br/></font>', estilo_texto) ]] tdetalle = Table(detalle, (590)) tdetalle.setStyle( TableStyle([('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white)])) story.append(tdetalle) obj_config = configuracion() cadena = obj_config.ruta() file_path = (cadena + "/pdf") #---EJEMPLO de windows: c:/Users/tatilu-----------------------------------------------------------------------# if not os.path.exists(file_path): os.makedirs(file_path) doc = SimpleDocTemplate(file_path + "nota" + self.tipo + ".pdf", pagesize=A4, rightMargin=0.5, leftMargin=0.5, topMargin=5, bottomMargin=18) doc.build(story) msgBox = QMessageBox() msgBox.setWindowTitle("Estado de Ticket") msgBox.setText("El Listado se ha generado correctamente") msgBox.exec_() if sys.platform == 'linux': subprocess.call( ["xdg-open", file_path + "nota_" + self.tipo + ".pdf"]) else: os.startfile(file_path + "nota_" + self.tipo + ".pdf")
def imprimir(self): obj_ejercicio = "" for item in self.lista_ejercicio: if item.descripcion == self.obj_form.cbx_ejercicio.currentText(): obj_ejercicio = item obj_e_reporte = E_reporte() lista_diario_gral = obj_e_reporte.reporte_libro_mayor( str(obj_ejercicio.id_ejercicio)) styleSheet = getSampleStyleSheet() otro_estilo = ParagraphStyle('', fontSize=8, textColor='#000', leftIndent=150, rightIndent=50) style_barra = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=0, rightIndent=50) texto_principal = ParagraphStyle('', fontName='Times-Roman', fontSize=6, textColor='#000', spaceBefore=-15, leftIndent=195, rightIndent=50) texto_principal2 = ParagraphStyle('', fontName='Times-Roman', fontSize=6, textColor='#000', spaceBefore=-15, leftIndent=200, rightIndent=50) texto_secundario = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=200, rightIndent=1) estilo_texto = ParagraphStyle( '', fontSize=7, alignment=0, spaceBefore=0, spaceAfter=0, #backColor = '#fff', textColor='#000', leftIndent=5) estilo_cuenta = ParagraphStyle( '', fontSize=7, alignment=0, spaceBefore=-15, spaceAfter=-10, #backColor = '#fff', textColor='#000', leftIndent=200) estilo_texto_plan_cta = ParagraphStyle('', fontSize=7, alignment=0, spaceBefore=0, spaceAfter=0, backColor='#ff9933', textColor='#000', leftIndent=5) estilo_detalle_cuota = ParagraphStyle('', fontSize=10, textColor='#000', leftIndent=0, rightIndent=0) options = QFileDialog.Options() story = [] título = [[Paragraph('''<b> </b>''', styleSheet["BodyText"])], [ Paragraph( "<b><u> MAYORES: " + str(self.obj_cliente.razon_social).upper() + "</u></b> ", texto_principal) ]] subtítulo = [[Paragraph('''<b> </b>''', styleSheet["BodyText"])], [ Paragraph( ' <b> (</b>' + str(obj_ejercicio.fec_inicio) + 'AL' + str(obj_ejercicio.fec_fin) + '<b>) </b>', texto_principal2) ]] t = Table(título, (550)) t.setStyle( TableStyle([('INNERGRID', (0, 1), (-1, -1), 0.25, colors.white), ('BOX', (0, 1), (-1, -1), 0.25, colors.white), ('BACKGROUND', (0, 1), (-1, 1), colors.white)])) story.append(t) story.append(Spacer(0, -10)) t = Table(subtítulo, (550)) t.setStyle( TableStyle([('INNERGRID', (0, 1), (-1, -1), 0.25, colors.white), ('BOX', (0, 1), (-1, -1), 0.25, colors.white), ('BACKGROUND', (0, 1), (-1, 1), colors.white)])) story.append(t) story.append(Spacer(0, 1)) #cabezal = [[Paragraph('''<b> </b>''',styleSheet["BodyText"])], # [Paragraph(' <b> FECHA </b> ',estilo_texto), # Paragraph('<b> DESCRIPCIÓN </b> ',estilo_texto), # Paragraph('<b> DEBE </b> ',estilo_texto), # Paragraph('<b> HABER </b> ',estilo_texto), # Paragraph('<b> SALDO </b> ',estilo_texto)]] t = "" asiento = "" saldo = 0 plan = "" #pyqtRemoveInputHook() #import pdb; pdb.set_trace() totales = False totaldebe = 0 totalhaber = 0 for item in lista_diario_gral: if plan != item[7]: if totales: estilofecha = "<font size=10>-- </font>" estiloplan = "<font size=10>TOTAL </font>" estilodebe = "<font size=10>" + str(totaldebe) + "</font>" estilohaber = "<font size=10>" + str( totalhaber) + "</font>" cabezal.append([ Paragraph(estilofecha, estilo_texto_plan_cta), Paragraph(estiloplan, estilo_texto_plan_cta), Paragraph(estilodebe, estilo_texto_plan_cta), Paragraph(estilohaber, estilo_texto_plan_cta) ]) t = Table(cabezal, (60, 160, 90, 90, 100)) t.setStyle( TableStyle([ ('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white) ])) story.append(t) título = [[Paragraph('''<b> </b>''', styleSheet["BodyText"])], [ Paragraph( "<b>" + str(item[8]) + str(item[7]) + "</b>", estilo_cuenta) ]] t = Table(título, (500)) t.setStyle( TableStyle([ ('INNERGRID', (0, 1), (-1, -1), 0.25, colors.white), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white) ])) story.append(t) story.append(Spacer(0, -15)) cabezal = [[Paragraph('''<b> </b>''', styleSheet["BodyText"])], [ Paragraph(' <b> FECHA </b> ', estilo_texto), Paragraph('<b> DESCRIPCIÓN </b> ', estilo_texto), Paragraph('<b> DEBE </b> ', estilo_texto), Paragraph('<b> HABER </b> ', estilo_texto), Paragraph('<b> SALDO </b> ', estilo_texto) ]] totaldebe = 0 totalhaber = 0 plan = item[7] #estilofecha = "<font size=10>" + str(item[8]) +"</font>" #estiloplan = "<font size=10>" + str(item[7])+ " </font>" #estilodebe = "<font size=10>-</font>" #estilohaber = "<font size=10>-</font>" #cabezal.append([Paragraph(estilofecha, estilo_texto_plan_cta), # Paragraph(estiloplan, estilo_texto_plan_cta), # Paragraph(estilodebe, estilo_texto_plan_cta), # Paragraph(estilohaber, estilo_texto_plan_cta)]) saldo = 0 estilofecha2 = " <font size=6>" + str(item[4]) + "</font>" estilodescripcion2 = " <font size=6>" + str( item[3]) + " </font>" estilodebe2 = " <font size=6> " + str(round(item[5], 2)) + " </font>" estilohaber2 = " <font size=6> " + str(round(item[6], 2)) + " </font>" #pyqtRemoveInputHook() #import pdb; pdb.set_trace() saldo = float(saldo) - float(item[6]) + float(item[5]) estilosaldo2 = " <font size=6> " + str(saldo) + " </font>" cabezal.append([ Paragraph(estilofecha2, estilo_texto), Paragraph(estilodescripcion2, estilo_texto), Paragraph(estilodebe2, estilo_texto), Paragraph(estilohaber2, estilo_texto), Paragraph(estilosaldo2, estilo_texto) ]) totales = True totaldebe = round(totaldebe + float(item[5]), 2) totalhaber = round(totalhaber + float(item[6]), 2) else: estilofecha2 = " <font size=6>" + str(item[4]) + "</font>" estilodescripcion2 = " <font size=6>" + str( item[3]) + " </font>" estilodebe2 = " <font size=6> " + str(round(item[5], 2)) + " </font>" estilohaber2 = " <font size=6> " + str(round(item[6], 2)) + " </font>" #pyqtRemoveInputHook() #import pdb; pdb.set_trace() saldo = round( float(saldo) - float(item[6]) + float(item[5]), 2) estilosaldo2 = " <font size=6> " + str(saldo) + " </font>" cabezal.append([ Paragraph(estilofecha2, estilo_texto), Paragraph(estilodescripcion2, estilo_texto), Paragraph(estilodebe2, estilo_texto), Paragraph(estilohaber2, estilo_texto), Paragraph(estilosaldo2, estilo_texto) ]) totaldebe = round(totaldebe + float(item[5]), 2) totalhaber = round(totalhaber + float(item[6]), 2) estilofecha = "<font size=10>-- </font>" estiloplan = "<font size=10>TOTAL </font>" estilodebe = "<font size=10>" + str(round(totaldebe, 2)) + "</font>" estilohaber = "<font size=10>" + str(round(totalhaber, 2)) + "</font>" cabezal.append([ Paragraph(estilofecha, estilo_texto_plan_cta), Paragraph(estiloplan, estilo_texto_plan_cta), Paragraph(estilodebe, estilo_texto_plan_cta), Paragraph(estilohaber, estilo_texto_plan_cta) ]) t = Table(cabezal, (100, 100, 100, 100, 100)) t.setStyle( TableStyle([('INNERGRID', (0, 1), (-1, -1), 0.25, colors.black), ('BOX', (0, 1), (-1, -1), 0.25, colors.black), ('BACKGROUND', (0, 1), (-1, 1), colors.white)])) story.append(t) #---------------------------------------CAMBIAR RUTA (LA PALABRA slam2016 POR LA RUTA DESEADA DE LA PC)------------------------------------------------# #pyqtRemoveInputHook() #import pdb;pdb.set_trace() obj_config = configuracion() cadena = obj_config.ruta() file_path = cadena + "/pdf/reportes/libro_mayor" + str( datetime.date.today().year) + "_" + str( datetime.date.today().month) #---EJEMPLO de windows: c:/Users/tatilu-----------------------------------------------------------------------# if not os.path.exists(file_path): os.makedirs(file_path) doc = SimpleDocTemplate(file_path + "/libro_mayor " + self.obj_cliente.nombre + "_" + self.obj_cliente.apellido + ".pdf", pagesize=A4, rightMargin=14, leftMargin=14, topMargin=5, bottomMargin=18) doc.build(story) msgBox = QMessageBox() msgBox.setWindowTitle("Estado de Reporte") msgBox.setText("El reporte se ha generado correctamente") msgBox.exec_() if sys.platform == 'linux': subprocess.call([ "xdg-open", file_path + "/libro_mayor " + self.obj_cliente.nombre + "_" + self.obj_cliente.apellido + ".pdf" ]) else: os.startfile(file_path + "/libro_mayor " + self.obj_cliente.nombre + "_" + self.obj_cliente.apellido + ".pdf")
def generar_30dias(self): obj_N_cuotas = N_cuotas(1) self.listado_cuotas_30_dias = obj_N_cuotas.lista_cuotas_venc_30_dias() styleSheet=getSampleStyleSheet() #pyqtRemoveInputHook() #import pdb; pdb.set_trace() img=Image("cabezal.png",250,75) img.hAlign = "LEFT" #pyqtRemoveInputHook() #import pdb; pdb.set_trace() otro_estilo= ParagraphStyle('',fontSize = 20,textColor = '#000',leftIndent = 200,rightIndent = 50) style_barra= ParagraphStyle('',fontSize = 13,textColor = '#000',backColor='#f5f5f5',borderColor ='#a3a3a3',borderWidth = 1,borderPadding = (1, 2, 5)) texto_principal = "" estilo_texto = ParagraphStyle('', fontSize = 22, alignment = 0, spaceBefore = 0, spaceAfter = 0, #backColor = '#fff', textColor = '#999', leftIndent = 10 ) h = Paragraph( texto_principal, estilo_texto) banner = [ [ img,h ] ] options = QFileDialog.Options() story=[] ban = Table( banner, colWidths=300, rowHeights=10) ban.setStyle([ ('ALIGN',(0,0),(0,0),'LEFT'),('ALIGN',(0,0),(1,0),'LEFT'), ('VALIGN',(0,0),(1,0),'TOP'), ('TEXTCOLOR',(0,1),(0,-1), colors.blue) ]) story.append(ban) story.append(Spacer(0,-17)) P= Paragraph("<b>Reportes</b> ",otro_estilo) story.append(P) story.append(Spacer(0,25)) P=Paragraph("<b>Cuotas vencidas hasta 30 dias</b> " + str(datetime.datetime.now()),style_barra) story.append(P) story.append(Spacer(0,25)) #nombre apellido dni Nro prestamo nro cuota monto integrantes = [[Paragraph('''<font size=12> <b> </b></font>''',styleSheet["BodyText"])], ['Apellido', 'Nombre', 'D.N.I:', 'Nro Crédito:','Nro Cuota','Monto']] #pyqtRemoveInputHook() #import pdb; pdb.set_trace() for item in self.listado_cuotas_30_dias: monto_adeudado = float(item.importe_primer_venc) + float(item.punitorios) obj_N_credito = N_creditos(1) obj_credito = obj_N_credito.buscar_credito_por_nro_credito(item.nro_credito) obj_N_datos_personales_cliente = N_datos_personales_cliente() obj_party = obj_N_datos_personales_cliente.buscar_party_party_por_id(obj_credito.id_party) integrantes.append([str(obj_party.apellido), str(obj_party.nombre), str(obj_party.nro_doc) ,str(item.nro_credito),str(item.nro_cuota), str(monto_adeudado)]) t=Table(integrantes, (150,135, 100, 55, 55,55)) t.setStyle(TableStyle([ ('INNERGRID', (0,1), (-1,-1), 0.25, colors.black), ('BOX', (0,1), (-1,-1), 0.25, colors.black), ('BACKGROUND',(0,1),(-1,1),colors.lightgrey) ])) story.append(t) story.append(Spacer(0,15)) obj_config = configuracion() cadena = obj_config.ruta() file_path = cadena + "/pdf/listados/list_morosos_30dias"+str(datetime.date.today().year)+"_"+str(datetime.date.today().month) if not os.path.exists(file_path): os.makedirs(file_path) doc=SimpleDocTemplate(file_path +"/listado_de_morosos_30dias.pdf") doc.build(story ) msgBox = QMessageBox() msgBox.setWindowTitle("Estado de Listado") msgBox.setText("El Listado se ha generado correctamente : ticket listado_de_morosos_30dias.pdf") msgBox.exec_() if sys.platform == 'linux': subprocess.call(["xdg-open", file_path +"/listado_de_morosos_30dias.pdf"]) else: os.startfile( file_path +"/listado_de_morosos_30dias.pdf")
def __init__(self): obj_conexion = configuracion() engine = create_engine(obj_conexion.config()) Session = sessionmaker(bind=engine) self.session = Session()
def imprimir(self): #monto_total_credito_letras = to_word(int(self.obj_form.lne_importe_prestamo_creditonuevo.text()),'EUR') #cant_cta_letras = to_word(int(self.obj_form.spbx_cantidad_cuotas_creditonuevo.text()),'EUR') obj_E_party = E_party_party() obj_asoc = obj_E_party.get_party_party(self.obj_form.lne_nro_doc_creditonuevo.text()) obj_N_party_address =N_party_address("a") obj_party_address =obj_N_party_address.get_party_address(obj_asoc.id_party) fec_hoy= datetime.date.today() hoy = fec_hoy.strftime("%d/%m/%Y") styleSheet=getSampleStyleSheet() img=Image("cabezalcaida.png",100,25) img.hAlign = "RIGHT" otro_estilo= ParagraphStyle('',fontSize =9,textColor = '#000',leftIndent = -44,rightIndent = 150) fec_estilo= ParagraphStyle('',fontSize =9,textColor = '#000',leftIndent = 360,rightIndent = 0) style_barra= ParagraphStyle('',fontSize = 10,textColor = '#000',leftIndent = 0,rightIndent = 10) texto_principal = "" estilo_texto = ParagraphStyle('', fontSize = 5, alignment = 0, spaceBefore = 0, spaceAfter = 0, #backColor = '#fff', textColor = '#000', leftIndent = 5 ) h = Paragraph( texto_principal, estilo_texto) banner = [ [ img,h ] ] options = QFileDialog.Options() story=[] ban = Table( banner, colWidths=270, rowHeights=-25) story.append(ban) story.append(Spacer(0,25)) P=Paragraph("<b> Fecha: </b>" + str(hoy)+"",fec_estilo) story.append(P) story.append(Spacer(0,5)) P=Paragraph("<b>Sr/a: </b>" + obj_asoc.apellido+ " "+ obj_asoc.nombre + " ",otro_estilo) story.append(P) story.append(Spacer(0,5)) # P=Paragraph("<|b>DNI: </b>" + obj_asoc.num_doc + " " , otro_estilo) # story.append(P) # story.append(Spacer(0,5)) P=Paragraph("<b>Domicilio: </b>" + obj_party_address.domicilio + " ",otro_estilo) story.append(P) story.append(Spacer(0,5)) P=Paragraph("<b>Localidad: </b>" + obj_party_address.ciudad + " ",otro_estilo) story.append(P) story.append(Spacer(0,5)) integrantes = [[Paragraph('''<font size=10> <b> </b></font>''',styleSheet["BodyText"])], [Paragraph('''<font size=10> <b> N° Cuota</b></font>''',estilo_texto), Paragraph('''<font size=10> <b> 1er Venc </b></font>''',estilo_texto), Paragraph('''<font size=10> <b> Importe 1er Venc </b></font>''',estilo_texto)]] for row in xrange(self.obj_form.tw_lista_cuotas_creditonuevo.rowCount ()): nro_cuota = self.obj_form.tw_lista_cuotas_creditonuevo.item(row,0).text() capital= self.obj_form.tw_lista_cuotas_creditonuevo.item(row,1).text() interes= self.obj_form.tw_lista_cuotas_creditonuevo.item(row,2).text() _1er_Venc= self.obj_form.tw_lista_cuotas_creditonuevo.item(row,4).text() fec_venc = datetime.datetime.strptime(_1er_Venc, "%Y-%m-%d %H:%M:%S") importe_1er_Venc= self.obj_form.tw_lista_cuotas_creditonuevo.item(row,5).text() #pyqtRemoveInputHook() #import pdb; pdb.set_trace() mes = self.convert_Mes(fec_venc.month) estilonom_plan= " <font size=9>" + nro_cuota + "</font>" estilodescuento= " <font size=9>" + str(fec_venc.day) + "/ " + mes + " </font>" estilointeres= " <font size=9>" + importe_1er_Venc + "</font>" integrantes.append([ Paragraph(estilonom_plan,estilo_texto), Paragraph(estilodescuento,estilo_texto), Paragraph(estilointeres,estilo_texto)]) t=Table(integrantes, (175, 175, 175)) t.setStyle(TableStyle([ ('INNERGRID', (0,1), (-1,-1), 0.25, colors.black), ('BOX', (0,1), (-1,-1), 0.25, colors.black), ('BACKGROUND',(0,1),(-1,1),colors.lightgrey) ])) story.append(t) story.append(Spacer(0,25)) P=Paragraph("*** Informamos que ante el pago fuera de término, la empresa aplicará interés por mora***",style_barra) story.append(P) #---------------------------------------CAMBIAR RUTA (LA PALABRA slam2016 POR LA RUTA DESEADA DE LA PC)------------------------------------------------# #pyqtRemoveInputHook() #import pdb; pdb.set_trace() obj_config = configuracion() cadena = obj_config.ruta() file_path = cadena + "/pdf/credito/credito"+str(datetime.date.today().year)+"_"+str(datetime.date.today().month) if not os.path.exists(file_path): os.makedirs(file_path) doc=SimpleDocTemplate(file_path+ "/credito_" + obj_asoc.apellido+ "_"+ obj_asoc.nombre + ".pdf") doc.build(story ) msgBox = QMessageBox() msgBox.setWindowTitle("Estado de Credito") msgBox.setText("El Credito se ha generado correctamente") msgBox.exec_() if sys.platform == 'linux': subprocess.call(["xdg-open", file_path +"/credito_" + obj_asoc.apellido+ "_"+ obj_asoc.nombre +".pdf"]) else: os.startfile( file_path +"/credito_" + obj_asoc.apellido+ "_"+ obj_asoc.nombre +".pdf") return True