From 6454ee31138aea52f8533460dbf9869e8563a480 Mon Sep 17 00:00:00 2001 From: Henrique-Miranda Date: Thu, 2 May 2019 23:18:14 -0300 Subject: [PATCH] Add print entry service order and print budget. --- database.py | 4 +- exportPDF.py | 264 +++++++++++++++++++++++++++++++++++++++++---- main.py | 72 +++++++------ requirements.txt | 5 +- sorder.py | 55 ++++++---- ui_forms/sorder.ui | 90 ++++++++++++---- 6 files changed, 391 insertions(+), 99 deletions(-) diff --git a/database.py b/database.py index ee4ce0a..6e92930 100644 --- a/database.py +++ b/database.py @@ -129,12 +129,10 @@ def createDB(self): self.cursor.execute( ''' CREATE TABLE IF NOT EXISTS os_itens ( - id INTEGER PRIMARY KEY AUTOINCREMENT, osId INTEGER, description TEXT NOT NULL, - amount REAL NOT NULL, + amount INTEGER NOT NULL, value REAL NOT NULL, - subTotal REAL NOT NULL, FOREIGN KEY(osId) REFERENCES service_order(id) ON UPDATE CASCADE); ''' ) diff --git a/exportPDF.py b/exportPDF.py index be24e4a..cc1e2aa 100644 --- a/exportPDF.py +++ b/exportPDF.py @@ -3,25 +3,28 @@ from reportlab.lib.enums import TA_CENTER, TA_LEFT from reportlab.lib.pagesizes import A4 from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image +from reportlab.platypus.tables import Table, TableStyle from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import mm +from reportlab.lib import colors +paper = '58mm' -def makePDF(compId, osId, paper): +def makePDF(osId = 1, osType = 2): banco = Database('database.db') # Company info result = resultc = banco.queryDB(f"""SELECT logo, name, slogan, adress, number, - adress2, district, city, state, tel, cell1, cell2, email, site FROM company WHERE id={compId}""") + adress2, district, city, state, tel, cell1, cell2, email, site FROM company WHERE id=1""") logo = resultc[0][0] compName = resultc[0][1] slogan = resultc[0][2] compAdress = f'{resultc[0][3]}, {resultc[0][4]}, {resultc[0][5]}, {resultc[0][6]}, {resultc[0][7]} - {resultc[0][8]}' - compTel = f'{resultc[0][9]} / {resultc[0][10]} / {resultc[0][11]}' + compTel = f'{resultc[0][9]} / {resultc[0][10]}' compEmail = resultc[0][12] compSite = resultc[0][13] # END Company info # OS info - result = banco.queryDB(f'SELECT clients.name, entryDate, clients.adress, clients.number,clients.adress2, clients.district, clients.city, clients.state, clients.tel, clients.cell1, clients.cell2, deviceType, brand, model, color, acessories, deviceStatus, defect, obs1, status FROM service_order INNER JOIN clients ON clients.id=service_order.idCli WHERE service_order.id={osId}') + result = banco.queryDB(f'SELECT clients.name, entryDate, clients.adress, clients.number,clients.adress2, clients.district, clients.city, clients.state, clients.tel, clients.cell1, clients.cell2, deviceType, brand, model, color, acessories, deviceStatus, defect, defectFound, obs1, obs2, status, partTotalValue, serviceValue, total FROM service_order INNER JOIN clients ON clients.id=service_order.idCli WHERE service_order.id={osId}') print('RES: ', result) osNumber = osId cliName = result[0][0] @@ -35,16 +38,25 @@ def makePDF(compId, osId, paper): acessories = result[0][15] deviceStatus = result[0][16] defect = result[0][17] - obs = result[0][18] - status = result[0][19] + defectFound = result[0][18] + obs = result[0][19] + obs2 = result[0][19] + status = result[0][21] + partTotalValue = result[0][22] + serviceValue = result[0][23] + total = result[0][24] printDate = time.strftime("%d/%m/%Y %H:%M:%S") - warrantyTerms = [ + Terms = [ 'Ao deixar seu equipamento retire o chip e cartão de memória, não nos responsabilizamos por estes itens.', 'Os aparelhos não retirados no prazo máximo de 90 dias contados a partir da data em que for orçado, será cobrado uma taxa de R$10,00 por dia para cobrir custos de armazenamento.', 'O aparelho só será devolvido para o titular deste documento, caso necessário o titular poderá solicitar retirada por terceiros.'] + warrantyTerms = [ + 'A empresa da 90 dias de garantia nas peças aplicadas e serviços realizados.', + 'A garantia não cobre defeitos causados pelo usuário ou mau uso do aparelho, como quebra ou arranhões nas peças trocas.', + 'A violação do lacre de garantia ou a desmontagem do aparelho por pessoas não autorizadas acarretará na perca da garantia.'] # END OS info - def docA4(): + def entryA4(): fileName = f'{os.getcwd()}/OS_DIR/os{osNumber}.pdf' doc = SimpleDocTemplate(fileName ,pagesize=A4, rightMargin=72, leftMargin=72, topMargin=30, bottomMargin=18) Story=[] @@ -83,7 +95,7 @@ def docA4(): Story.append(Spacer(1, 12)) ptext = f"Nome: {cliName}" Story.append(Paragraph(ptext, style["left"])) - ptext = f"Endereço: {adress}" + ptext = f"End'80mm'ereço: {adress}" Story.append(Paragraph(ptext, style["left"])) ptext = f"Tel.: { tel}" Story.append(Paragraph(ptext, style["left"])) @@ -116,7 +128,7 @@ def docA4(): ptext = 'CONDIÇÕES DE SERVIÇOS:' Story.append(Paragraph(ptext, style["center"])) Story.append(Spacer(1, 12)) - for n, l in enumerate(warrantyTerms, 1): + for n, l in enumerate(Terms, 1): ptext = f'{n} - {l}' Story.append(Paragraph(ptext, style["left"])) Story.append(Spacer(1, 20)) @@ -141,10 +153,104 @@ def docA4(): doc.build(Story) - def doc58mm(): + def budgetA4(): + fileName = f'{os.getcwd()}/OS_DIR/os{osNumber}.pdf' + doc = SimpleDocTemplate(fileName ,pagesize=A4, rightMargin=72, leftMargin=72, topMargin=30, bottomMargin=18) + Story=[] + # LOGO + im = Image(logo, 30*mm, 30*mm, hAlign='CENTER') + Story.append(im) + Story.append(Spacer(1, 12)) + # END LOGO + + # HEAD + style=getSampleStyleSheet() + style.add(ParagraphStyle(name='center', fontSize=12, alignment=TA_CENTER, spaceAfter=3)) + ptext = f"{compName}" + Story.append(Paragraph(ptext, style["center"])) + ptext = f"{slogan}" + Story.append(Paragraph(ptext, style["center"])) + ptext = f"{compTel}" + Story.append(Paragraph(ptext, style["center"])) + ptext = f"{compEmail}" + Story.append(Paragraph(ptext, style["center"])) + ptext = f"{compSite}" + Story.append(Paragraph(ptext, style["center"])) + ptext = f"{compAdress}" + Story.append(Paragraph(ptext, style["center"])) + Story.append(Spacer(1, 12)) + # END HEAD + # OS DATA + trace = f"{'-'*109}" + Story.append(Paragraph(trace, style["center"])) + Story.append(Spacer(1, 12)) + style.add(ParagraphStyle(name='left', fontSize=12, spaceAfter=3, alignment=TA_LEFT)) + ptext = f"ORÇAMENTO ORDEM DE SERVIÇO Nº{osNumber}" + Story.append(Paragraph(ptext, style["center"])) + Story.append(Spacer(1, 12)) + Story.append(Paragraph(trace, style["center"])) + Story.append(Spacer(1, 12)) + ptext = f"Nome: {cliName}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Tel.: { tel}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Equipamento: {device}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Marca: {brand}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Modelo: {model}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Cor: {color}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Problema relatado: {defect}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Defeito encontrado: {defectFound}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Observações: {obs2}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Data de Entrada: {entryDate}" + Story.append(Paragraph(ptext, style["left"])) + Story.append(Spacer(1, 12)) + # END OS DATA + + ptext = 'PEÇAS APLICADAS:' + Story.append(Paragraph(ptext, style["center"])) + Story.append(Spacer(1, 20)) + data=[('Descrição', 'Quantidade', 'Valor Un', 'Subtotal'), + ('Touch Samsung G530', 1, 15, 15)] + table = Table(data) + table.setStyle(TableStyle([('INNERGRID', (0,0), (-1, -1), 0.25, colors.black), + ('BOX', (0,0), (-1, -1), 0.25, colors.black), + ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'), + ('ALIGN', (0,0), (-1,-1), 'CENTER')])) + Story.append(table) + Story.append(Spacer(1, 20)) + ptext = f'Valor total de peças: {partTotalValue}' + Story.append(Paragraph(ptext, style["center"])) + ptext = f'Valor da Mão de Obra: {serviceValue}' + Story.append(Paragraph(ptext, style["center"])) + ptext = f'Valor Total a Pagar: {total}' + Story.append(Paragraph(ptext, style["center"])) + ptext = 'Orçamento válido por 10 dias.' + Story.append(Paragraph(ptext, style["center"])) + Story.append(Spacer(1, 12)) + ptext = f'Hoje {printDate} declaro ter recebido e assinado este orçamento e autorizo o andamento do serviço.' + Story.append(Paragraph(ptext, style["center"])) + # Assignature + Story.append(Spacer(1, 12)) + ptext = "_________________________________________________" + Story.append(Paragraph(ptext, style["center"])) + Story.append(Spacer(1, 20)) + ptext = f'Visto: {cliName}' + Story.append(Paragraph(ptext, style["center"])) + # END Assignature + + doc.build(Story) + + def entry58mm(): fileName = f'{os.getcwd()}/OS_DIR/os{osNumber}.pdf' pagesize=(57.86*mm, 209.9*mm) - doc = SimpleDocTemplate(fileName ,pagesize=pagesize, rightMargin=5, leftMargin=10, topMargin=5, bottomMargin=5) + doc = SimpleDocTemplate(fileName ,pagesize=pagesize, rightMargin=7, leftMargin=8, topMargin=0, bottomMargin=0) Story=[] # LOGO im = Image(logo, 15*mm, 15*mm, hAlign='CENTER') @@ -170,7 +276,7 @@ def doc58mm(): Story.append(Spacer(1, 3)) # END HEAD - ptext = f"------------------------------------" + ptext = "------------------------------------" Story.append(Paragraph(ptext, style["center"])) Story.append(Spacer(1, 3)) @@ -179,7 +285,7 @@ def doc58mm(): ptext = f"COMPROVANTE DE ENTRADA OS Nº{osNumber}" Story.append(Paragraph(ptext, style["center"])) Story.append(Spacer(1, 3)) - ptext = f"------------------------------------" + ptext = "------------------------------------" Story.append(Paragraph(ptext, style["center"])) Story.append(Spacer(1, 3)) ptext = f"Nome: {cliName}" @@ -219,7 +325,7 @@ def doc58mm(): ptext = 'CONDIÇÕES DE SERVIÇOS:' Story.append(Paragraph(ptext, style["center"])) Story.append(Spacer(1, 3)) - for n, l in enumerate(warrantyTerms, 1): + for n, l in enumerate(Terms, 1): ptext = f'{n} - {l}' Story.append(Paragraph(ptext, style["left"])) Story.append(Spacer(1, 5)) @@ -244,15 +350,129 @@ def doc58mm(): doc.build(Story) - def doc80mm(): + def budget58mm(): + fileName = f'{os.getcwd()}/OS_DIR/os{osNumber}.pdf' + pagesize=(57.86*mm, 209.9*mm) + doc = SimpleDocTemplate(fileName ,pagesize=pagesize, rightMargin=7, leftMargin=8, topMargin=0, bottomMargin=0) + Story=[] + # LOGO + im = Image(logo, 15*mm, 15*mm, hAlign='CENTER') + Story.append(im) + Story.append(Spacer(1, 3)) + # END LOGO + + # HEAD + style=getSampleStyleSheet() + style.add(ParagraphStyle(name='center', fontsize=9, alignment=TA_CENTER)) + ptext = f"{compName}" + Story.append(Paragraph(ptext, style["center"])) + ptext = f"{slogan}" + Story.append(Paragraph(ptext, style["center"])) + ptext = f"{compTel}" + Story.append(Paragraph(ptext, style["center"])) + ptext = f"{compEmail}" + Story.append(Paragraph(ptext, style["center"])) + ptext = f"{compSite}" + Story.append(Paragraph(ptext, style["center"])) + ptext = f"{compAdress}" + Story.append(Paragraph(ptext, style["center"])) + Story.append(Spacer(1, 3)) + # END HEAD + + ptext = f"------------------------------------" + Story.append(Paragraph(ptext, style["center"])) + + # OS DATA + style.add(ParagraphStyle(name='left', fontsize=9, spaceAfter=1, alignment=TA_LEFT)) + ptext = f"ORÇAMENTO OS Nº{osNumber}" + Story.append(Paragraph(ptext, style["center"])) + ptext = f"------------------------------------" + Story.append(Paragraph(ptext, style["center"])) + Story.append(Spacer(1, 3)) + ptext = f"Nome: {cliName}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Tel.: { tel}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Equipamento: {device}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Marca: {brand}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Modelo: {model}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Cor: {color}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Problema relatado: {defect}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Defeito encontrado: {defectFound}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Observações: {obs2}" + Story.append(Paragraph(ptext, style["left"])) + ptext = f"Data de Entrada: {entryDate}" + Story.append(Paragraph(ptext, style["left"])) + Story.append(Spacer(1, 3)) + # END OS DATA + + ptext = 'PEÇAS APLICADAS:' + Story.append(Paragraph(ptext, style["center"])) + Story.append(Spacer(1, 3)) + data=[('Des.', 'Quan.', 'Val.Un', 'Sub.'), + ('Touch Samsung G530', 1, 15, 15)] + table = Table(data) + table.setStyle(TableStyle([('INNERGRID', (0,0), (-1,-1), 0.50, colors.black), + ('BOX', (0,0), (-1, -1), 0.50, colors.black), + ('FONTNAME', (0,0), (-1,-1), 'Helvetica-Bold'), + ('ALIGN', (0,0), (-1,-1), 'CENTER'), + ('FONTSIZE', (0,0), (-1,-1), 5), + ('VALIGN', (0,0), (-1,-1), 'MIDDLE')])) + Story.append(table) + Story.append(Spacer(1, 3)) + ptext = f'Valor total de peças: {partTotalValue}' + Story.append(Paragraph(ptext, style["center"])) + ptext = f'Valor da Mão de Obra: {serviceValue}' + Story.append(Paragraph(ptext, style["center"])) + ptext = f'Valor Total a Pagar: {total}' + Story.append(Paragraph(ptext, style["center"])) + ptext = 'Orçamento válido por 10 dias.' + Story.append(Paragraph(ptext, style["center"])) + Story.append(Spacer(1, 12)) + ptext = f'Hoje {printDate} declaro ter recebido e assinado este orçamento e autorizo o andamento do serviço.' + Story.append(Paragraph(ptext, style["center"])) + # Assignature + Story.append(Spacer(1, 12)) + ptext = "_______________________" + Story.append(Paragraph(ptext, style["center"])) + Story.append(Spacer(1, 20)) + ptext = f'Visto: {cliName}' + Story.append(Paragraph(ptext, style["center"])) + # END Assignature + + doc.build(Story) + + def entry80mm(): pass if not 'OS_DIR' in os.listdir(): os.mkdir('OS_DIR') - if paper == 'A4': - docA4() - elif paper == '58mm': - doc58mm() - elif paper == '80mm': - doc80mm() + if osType == 1: + if paper == 'A4': + entryA4() + if paper == '58mm': + entry58mm() + if paper == '80mm': + entry80mm() + elif osType == 2: + if paper == 'A4': + budgetA4() + if paper == '58mm': + budget58mm() + if paper == '80mm': + budget80mm() + + elif osType == 3: + if paper == 'A4': + outA4() + if paper == '58mm': + out58mm() + if paper == '80mm': + out80mm() diff --git a/main.py b/main.py index 55cd4be..2538145 100644 --- a/main.py +++ b/main.py @@ -442,9 +442,7 @@ def loadOs(id): self.sorder.leObs1.setText(result[0][36]) self.sorder.leDefectsFound.setText(result[0][37]) self.sorder.leServiceDone.setText(result[0][38]) - self.sorder.spPartsValue.setValue(result[0][39]) self.sorder.spServiceValue.setValue(result[0][40]) - self.sorder.spTotalValue.setValue(result[0][41]) self.sorder.leObs2.setText(result[0][42]) self.sorder.lbStatus2.setText(result[0][43]) self.sorder.cbStatus.setCurrentText(result[0][43]) @@ -454,22 +452,32 @@ def loadOs(id): self.sorder.pbDelivery.setEnabled(True) else: self.sorder.pbDelivery.setEnabled(False) + if self.sorder.cbStatus.currentText() in ('Oçamento concluído', 'Orçamento aprovado', 'Consertado', 'Em execução do serviço', 'Aguardando peça de reposição'): + self.sorder.pbPrint2.setEnabled(True) + else: + self.sorder.pbPrint2.setEnabled(False) + if self.sorder.cbStatus.currentText() in ('Consertado', 'Equipamento devolvido'): + self.sorder.pbPrint3.setEnabled(True) + else: + self.sorder.pbPrint3.setEnabled(False) #dbConn = Database('database.db') - result = dbConn.queryDB(f"""SELECT * FROM os_itens WHERE osId={id}""") + result = self.dbConn.queryDB(f"""SELECT * FROM os_itens WHERE osId={id}""") print(result) defectFound = self.sorder.leDefectsFound.text() + ptotal = 0 if result: self.sorder.twBudget.setRowCount(len(result)) self.sorder.twBudget.setColumnCount(4) - ptotal = 0 for row, item in enumerate(result): - self.sorder.twBudget.setItem(row, 0, QTableWidgetItem(item[2])) - self.sorder.twBudget.setItem(row, 1, QTableWidgetItem(str(item[3]))) - self.sorder.twBudget.setItem(row, 2, QTableWidgetItem(str(item[4]))) - self.sorder.twBudget.setItem(row, 3, QTableWidgetItem(str(item[5]))) - ptotal+=item[4] + self.sorder.twBudget.setItem(row, 0, QTableWidgetItem(item[1])) + self.sorder.twBudget.setItem(row, 1, QTableWidgetItem(str(item[2]))) + self.sorder.twBudget.setItem(row, 2, QTableWidgetItem(str(item[3]))) + self.sorder.twBudget.setItem(row, 3, QTableWidgetItem(str(item[2]*item[3]))) + ptotal+=float(self.sorder.twBudget.item(row, 3).text()) self.sorder.spPartsValue.setValue(ptotal) - defectFound = self.sorder.leDefectsFound.text() + header = self.sorder.twBudget.horizontalHeader() + header.setSectionResizeMode(QHeaderView.ResizeToContents) + self.sorder.spTotalValue.setValue(ptotal+self.sorder.spServiceValue.value()) else: #dbConn = Database('database.db') @@ -507,12 +515,12 @@ def saveOs(): print('Salvando OS...') idCli = int(self.sorder.leCodCli.text()) type = self.sorder.cbType.currentText() - assert type != '', 'Selecione um tipo de aparelho!' + assert type, 'Selecione um tipo de aparelho!' brand = self.sorder.cbBrand.currentText() - assert brand != '', 'Selecione uma Marca!' + assert brand, 'Selecione uma Marca!' model = self.sorder.leModel.text() color = self.sorder.leColor.text() - assert color != '', 'Selecione uma cor!' + assert color, 'Selecione uma cor!' ns = self.sorder.leNs.text() br = self.sorder.leBarCode.text() imei1 = self.sorder.leImei1.text() @@ -520,16 +528,17 @@ def saveOs(): acessories = self.sorder.leAcessories.text() deviceStatus = self.sorder.leDeviceStatus.text() defect = self.sorder.leDefect.text() - assert defect != '', 'Descreva o defeito do aparelho!' + assert defect, 'Descreva o defeito do aparelho!' obs1 = self.sorder.leObs1.text() defectFound = self.sorder.leDefectsFound.text() serviceDone = self.sorder.leServiceDone.text() obs2 = self.sorder.leObs2.text() - status = self.sorder.cbStatus.currentText() partsValue = self.sorder.spPartsValue.value() serviceValue = self.sorder.spServiceValue.value() total = partsValue + serviceValue - rnumber = self.sorder.twBudget.rowCount() + status = self.sorder.cbStatus.currentText() + if status in ('Orçamento aprovado', 'Consertado', 'Aguardando peça de reposição', 'Orçamento concluído', 'Equipamento devolvido consertado', 'Orçamento reprovado', 'Em execução do serviço'): + assert total, 'Antes disso insira um valor de serviço ou peça na aba orçamento.' except AssertionError as e: msg = QMessageBox() @@ -546,20 +555,23 @@ def saveOs(): partTotalValue={partsValue}, serviceValue={serviceValue}, total={total}, obs2='{obs2}', status='{status}' WHERE id={id}""" #dbConn = Database('database.db') self.dbConn.queryDB(sql) - print(rnumber) + rnumber = self.sorder.twBudget.rowCount() if rnumber: + sql = f"DELETE FROM os_itens WHERE osId={id}" + self.dbConn.queryDB(sql) for row in range(rnumber): desc = self.sorder.twBudget.item(row, 0).text() - amount = float(self.sorder.twBudget.item(row, 1).text()) + amount = int(self.sorder.twBudget.item(row, 1).text()) value = float(self.sorder.twBudget.item(row, 2).text()) - stotal = float(self.sorder.twBudget.item(row, 3).text()) - sql = f"INSERT INTO os_itens (osId, description, amount, value, subTotal) VALUES ({id}, '{desc}', {amount}, {value}, {stotal})" + sql = f"INSERT INTO os_itens (osId, description, amount, value) VALUES ({id}, '{desc}', {amount}, {value})" #dbConn = Database('database.db') print('SQL', sql) - try: - self.dbConn.queryDB(sql) - except: - pass + self.dbConn.queryDB(sql) + if not rnumber and self.sorder.spPartsValue.value(): + sql = f"DELETE FROM os_itens WHERE osId={id}" + self.dbConn.queryDB(sql) + self.sorder.spPartsValue.setValue(0.0) + loadOs(id) else: sql = f"""INSERT INTO service_order (idCli, entryDate, altDate, lastAlter, @@ -575,9 +587,9 @@ def saveOs(): lrid = self.dbConn.queryDB(sql) self.openSO(lrid) - def printSo(id): + def printSo(id, osType): from exportPDF import makePDF - makePDF(1, id, 'A4') + makePDF(id, osType) PDF_PATH = f'{os.getcwd()}/OS_DIR/os{id}.pdf' try: import platform @@ -599,7 +611,9 @@ def printSo(id): self.sorder.pbSearch.clicked.connect(self.sorder.pbExit.click) self.sorder.pbSearch.clicked.connect(lambda: self.openCliEdit(int(self.sorder.leCodCli.text()))) self.sorder.cbStatus.currentTextChanged.connect(lambda: self.sorder.lbStatus2.setText(self.sorder.cbStatus.currentText())) - self.sorder.pbPrint.clicked.connect(lambda: printSo(id)) + self.sorder.pbPrint.clicked.connect(lambda: printSo(id, 1)) + self.sorder.pbPrint2.clicked.connect(lambda: printSo(id, 2)) + self.sorder.pbPrint3.clicked.connect(lambda: printSo(id, 3)) def addToTable(): row = self.sorder.twBudget.rowCount()+1 self.sorder.twBudget.setRowCount(row) @@ -611,10 +625,8 @@ def addToTable(): self.sorder.twBudget.setItem(row-1, 1, QTableWidgetItem(str(amount))) self.sorder.twBudget.setItem(row-1, 2, QTableWidgetItem(str(pvalue))) self.sorder.twBudget.setItem(row-1, 3, QTableWidgetItem(str(svalue))) - self.sorder.twBudget.itemDoubleClicked.connect(lambda: self.sorder.twBudget.removeRow(self.sorder.twBudget.currentRow())) + self.sorder.twBudget.itemClicked.connect(lambda: self.sorder.twBudget.removeRow(self.sorder.twBudget.currentRow())) self.sorder.pbAddPart.clicked.connect(addToTable) - header = self.sorder.twBudget.horizontalHeader() - header.setSectionResizeMode(QHeaderView.ResizeToContents) self.SOrder.setModal(True) self.SOrder.show() loadOs(id) diff --git a/requirements.txt b/requirements.txt index b799e92..e4f1575 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,8 @@ chardet==3.0.4 idna==2.8 Pillow==6.0.0 pycpfcnpj==1.5.1 -PySide2==5.11.2 -reportlab==3.5.19 +PySide2==5.12.3 +reportlab==3.5.20 requests==2.21.0 +shiboken2==5.12.3 urllib3==1.24.2 diff --git a/sorder.py b/sorder.py index 23000f2..7604ad6 100644 --- a/sorder.py +++ b/sorder.py @@ -3,8 +3,8 @@ # Form implementation generated from reading ui file 'sorder.ui', # licensing of 'sorder.ui' applies. # -# Created: Sat Apr 27 13:27:00 2019 -# by: pyside2-uic running on PySide2 5.12.2 +# Created: Thu May 2 22:55:12 2019 +# by: pyside2-uic running on PySide2 5.12.3 # # WARNING! All changes made in this file will be lost! @@ -13,7 +13,7 @@ class Ui_SOrderEdit(object): def setupUi(self, SOrderEdit): SOrderEdit.setObjectName("SOrderEdit") - SOrderEdit.resize(915, 696) + SOrderEdit.resize(915, 698) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("IMG/logoblack.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) SOrderEdit.setWindowIcon(icon) @@ -628,23 +628,24 @@ def setupUi(self, SOrderEdit): self.verticalLayout_8.addWidget(self.twBudget) self.horizontalLayout_21 = QtWidgets.QHBoxLayout() self.horizontalLayout_21.setObjectName("horizontalLayout_21") + self.lbServiceValue = QtWidgets.QLabel(self.tab_4) + self.lbServiceValue.setObjectName("lbServiceValue") + self.horizontalLayout_21.addWidget(self.lbServiceValue) + self.spServiceValue = QtWidgets.QDoubleSpinBox(self.tab_4) + self.spServiceValue.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons) + self.spServiceValue.setMaximum(1e+86) + self.spServiceValue.setObjectName("spServiceValue") + self.horizontalLayout_21.addWidget(self.spServiceValue) self.lbPartsValue = QtWidgets.QLabel(self.tab_4) self.lbPartsValue.setObjectName("lbPartsValue") self.horizontalLayout_21.addWidget(self.lbPartsValue) self.spPartsValue = QtWidgets.QDoubleSpinBox(self.tab_4) + self.spPartsValue.setReadOnly(True) self.spPartsValue.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons) self.spPartsValue.setSuffix("") self.spPartsValue.setMaximum(1e+85) self.spPartsValue.setObjectName("spPartsValue") self.horizontalLayout_21.addWidget(self.spPartsValue) - self.lbServiceValue = QtWidgets.QLabel(self.tab_4) - self.lbServiceValue.setObjectName("lbServiceValue") - self.horizontalLayout_21.addWidget(self.lbServiceValue) - self.spServiceValue = QtWidgets.QDoubleSpinBox(self.tab_4) - self.spServiceValue.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons) - self.spServiceValue.setMaximum(1e+86) - self.spServiceValue.setObjectName("spServiceValue") - self.horizontalLayout_21.addWidget(self.spServiceValue) self.lbTotalValue = QtWidgets.QLabel(self.tab_4) self.lbTotalValue.setObjectName("lbTotalValue") self.horizontalLayout_21.addWidget(self.lbTotalValue) @@ -708,7 +709,23 @@ def setupUi(self, SOrderEdit): self.cbStatus.addItem("") self.cbStatus.addItem("") self.cbStatus.addItem("") + self.cbStatus.addItem("") self.horizontalLayout_22.addWidget(self.cbStatus) + self.label_2 = QtWidgets.QLabel(SOrderEdit) + self.label_2.setObjectName("label_2") + self.horizontalLayout_22.addWidget(self.label_2) + self.pbPrint = QtWidgets.QPushButton(SOrderEdit) + self.pbPrint.setEnabled(False) + self.pbPrint.setObjectName("pbPrint") + self.horizontalLayout_22.addWidget(self.pbPrint) + self.pbPrint2 = QtWidgets.QPushButton(SOrderEdit) + self.pbPrint2.setEnabled(False) + self.pbPrint2.setObjectName("pbPrint2") + self.horizontalLayout_22.addWidget(self.pbPrint2) + self.pbPrint3 = QtWidgets.QPushButton(SOrderEdit) + self.pbPrint3.setEnabled(False) + self.pbPrint3.setObjectName("pbPrint3") + self.horizontalLayout_22.addWidget(self.pbPrint3) spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_22.addItem(spacerItem3) self.verticalLayout.addLayout(self.horizontalLayout_22) @@ -717,10 +734,6 @@ def setupUi(self, SOrderEdit): self.pbSave = QtWidgets.QPushButton(SOrderEdit) self.pbSave.setObjectName("pbSave") self.horizontalLayout_9.addWidget(self.pbSave) - self.pbPrint = QtWidgets.QPushButton(SOrderEdit) - self.pbPrint.setEnabled(False) - self.pbPrint.setObjectName("pbPrint") - self.horizontalLayout_9.addWidget(self.pbPrint) self.pbNewOs = QtWidgets.QPushButton(SOrderEdit) self.pbNewOs.setEnabled(False) self.pbNewOs.setObjectName("pbNewOs") @@ -865,10 +878,10 @@ def retranslateUi(self, SOrderEdit): self.twBudget.horizontalHeaderItem(1).setText(QtWidgets.QApplication.translate("SOrderEdit", "Quantidade", None, -1)) self.twBudget.horizontalHeaderItem(2).setText(QtWidgets.QApplication.translate("SOrderEdit", "Valor un", None, -1)) self.twBudget.horizontalHeaderItem(3).setText(QtWidgets.QApplication.translate("SOrderEdit", "Subtotal", None, -1)) - self.lbPartsValue.setText(QtWidgets.QApplication.translate("SOrderEdit", "Valor peças:", None, -1)) - self.spPartsValue.setPrefix(QtWidgets.QApplication.translate("SOrderEdit", "R$", None, -1)) self.lbServiceValue.setText(QtWidgets.QApplication.translate("SOrderEdit", "Valor serviço:", None, -1)) self.spServiceValue.setPrefix(QtWidgets.QApplication.translate("SOrderEdit", "R$", None, -1)) + self.lbPartsValue.setText(QtWidgets.QApplication.translate("SOrderEdit", "Valor peças:", None, -1)) + self.spPartsValue.setPrefix(QtWidgets.QApplication.translate("SOrderEdit", "R$", None, -1)) self.lbTotalValue.setText(QtWidgets.QApplication.translate("SOrderEdit", "Valor Total:", None, -1)) self.spTotalValue.setPrefix(QtWidgets.QApplication.translate("SOrderEdit", "R$", None, -1)) self.lbObs2.setText(QtWidgets.QApplication.translate("SOrderEdit", "Observações:", None, -1)) @@ -892,9 +905,13 @@ def retranslateUi(self, SOrderEdit): self.cbStatus.setItemText(7, QtWidgets.QApplication.translate("SOrderEdit", "Sem peça de reposição", None, -1)) self.cbStatus.setItemText(8, QtWidgets.QApplication.translate("SOrderEdit", "Defeito não encontrado", None, -1)) self.cbStatus.setItemText(9, QtWidgets.QApplication.translate("SOrderEdit", "Consertado", None, -1)) - self.cbStatus.setItemText(10, QtWidgets.QApplication.translate("SOrderEdit", "Equipamento devolvido", None, -1)) + self.cbStatus.setItemText(10, QtWidgets.QApplication.translate("SOrderEdit", "Equipamento devolvido consertado", None, -1)) + self.cbStatus.setItemText(11, QtWidgets.QApplication.translate("SOrderEdit", "Equipamento devolvido sem reparo", None, -1)) + self.label_2.setText(QtWidgets.QApplication.translate("SOrderEdit", "Imprimir nota:", None, -1)) + self.pbPrint.setText(QtWidgets.QApplication.translate("SOrderEdit", "Entrada", None, -1)) + self.pbPrint2.setText(QtWidgets.QApplication.translate("SOrderEdit", "Orçamento", None, -1)) + self.pbPrint3.setText(QtWidgets.QApplication.translate("SOrderEdit", "Saída", None, -1)) self.pbSave.setText(QtWidgets.QApplication.translate("SOrderEdit", "Salvar", None, -1)) - self.pbPrint.setText(QtWidgets.QApplication.translate("SOrderEdit", "Imprimir", None, -1)) self.pbNewOs.setText(QtWidgets.QApplication.translate("SOrderEdit", "Nova OS", None, -1)) self.pbDelivery.setText(QtWidgets.QApplication.translate("SOrderEdit", "Entregar", None, -1)) self.pbExit.setText(QtWidgets.QApplication.translate("SOrderEdit", "Sair", None, -1)) diff --git a/ui_forms/sorder.ui b/ui_forms/sorder.ui index d13d4ba..8033563 100755 --- a/ui_forms/sorder.ui +++ b/ui_forms/sorder.ui @@ -7,7 +7,7 @@ 0 0 915 - 696 + 698 @@ -1478,16 +1478,25 @@ Descrição + + AlignCenter + Quantidade + + AlignCenter + Valor un + + AlignCenter + @@ -1502,45 +1511,48 @@ - + - Valor peças: + Valor serviço: - + QAbstractSpinBox::NoButtons R$ - - - - 10000000000000000146306952306748730309700429878646550592786107871697963642511482159104.000000000000000 + 100000000000000001463069523067487303097004298786465505927861078716979636425114821591040.000000000000000 - + - Valor serviço: + Valor peças: - + + + true + QAbstractSpinBox::NoButtons R$ + + + - 100000000000000001463069523067487303097004298786465505927861078716979636425114821591040.000000000000000 + 10000000000000000146306952306748730309700429878646550592786107871697963642511482159104.000000000000000 @@ -1706,11 +1718,53 @@ - Equipamento devolvido + Equipamento devolvido consertado + + + + + Equipamento devolvido sem reparo + + + + Imprimir nota: + + + + + + + false + + + Entrada + + + + + + + false + + + Orçamento + + + + + + + false + + + Saída + + + @@ -1735,16 +1789,6 @@ - - - - false - - - Imprimir - - -