$document_name => '' $document_type_A => '' $document_type_B => '' $document_type_C => '' $stock_alta => '' $stock_borrado => '' tmpValuesDataSource.priceTypeId = None tmpValuesDataSource.priceWithIva = 0 ownOrganizationBlock.clear() ownOrganizationBlock.initQuery() ownOrganizationBlock.processQuery() print "iva condition" , str(ownOrganizationBlock.condIVAEntry) print "entity id", str(ownOrganizationBlock.ownOrganizationIdEntry) tmpValuesDataSource.ownOrganizationId = str(ownOrganizationBlock.ownOrganizationIdEntry) tmpValuesDataSource.ownIVACond = str(ownOrganizationBlock.condIVAEntry) tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp() import hack if len(str(ownDocAuxBlock.withIvaEntry)) and \ len(str(ownItemBlock.unitPriceAuxEntry)) and \ len(str(ownItemBlock.ivaEntry)): if int(str(ownDocAuxBlock.withIvaEntry)): ownItemBlock.unitPriceEntry = hack.a2f(ownItemBlock.unitPriceAuxEntry,4)/ round(1+hack.a2f(ownItemBlock.ivaEntry,4)/100,4) else: ownItemBlock.unitPriceEntry = str(ownItemBlock.unitPriceAuxEntry) invoiceType = str(ownDocumentBlock.invoiceTypeEntry).strip().lower() if invoiceType == 'a': ownDocumentBlock.typeEntry = '"'.$document_type_A.'"' elif invoiceType == 'b': ownDocumentBlock.typeEntry = '"'.$document_type_B.'"' elif invoiceType == 'c': ownDocumentBlock.typeEntry = '"'.$document_type_C.'"' else: ownDocumentBlock.typeEntry = '' 0 and len(ownItemBlock.prodNameSEntry) > 0: if not str(ownDocumentBlock.invoiceTypeEntry): genericBox("Falta el tipo de comprobante",["Aceptar"]) else: setFocus(currencyTypeBlock.currencyBox.payEntry) callTrigger('currencyWorkTrigger') ]]> import hack ownDocumentBlock.numberEntry = str(ownPosDocumentBlock.documentNumberEntry) #cargo pos ownDocumentBlock.ownPosEntityIdEntry = str(ownPosBlock.ownPosEntityIdEntry) #/cargo pos ownDocumentBlock.dueDateEntry = str(payBlock.dateEntry) ownDocumentBlock.dateEntry = str(tmpBlock.tmpDateEntry) if len(ownDocumentBlock.dateEntry) == 0: ownDocumentBlock.dateEntry = ownDocumentDataSource.getTimeStamp() from gnue.common.GDataObjects import ConnectionError as DBError try: postChangeAdvance = 0 ownDocumentBlock.postChanges() postChangeAdvance = 1 ownPosDocumentBlock.documentNumberEntry.postAtomicModify (lambda x: int(x)+1) postChangeAdvance = 2 proceedingBlock.postChanges() #cargo documento de retenciones callTrigger('retentionCommitTrigger') callTrigger('proceedingCommitTrigger') postChangeAdvance = 5 #lOwnDocId = str(ownDocumentBlock.idEntry) #if stock by invoice if str(ownPosBlock.stockByInvoice) == "1": print "llamado al trigger" callTrigger('$stock_alta') callTrigger('taxFillTrigger') ownItemTaxBlock.postChanges() ownDocumentTaxTotalBlock.postChanges() commitConnection() except DBError, err: rollbackConnection() message = ["el comprobante","el número del comprobante","el procedimiento General", "el procedimiento del comprobante","las monedas de pago del comprobante", "el stock" ] genericBox("Hay problemas para grabar "+message[postChangeAdvance]+"\n"+str(err),['Aceptar']) # this one's called from the print trigger, so let it know something went wrong raise tmpValuesDataSource.priceWithIva = 0 setFocus(ownItemBlock.prodCodeSEntry) tmpValuesDataSource.priceTypeId = None tmpValuesDataSource.priceWithIva = 0 clear() tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp() #setFocus(ownDocumentBlock.clientCodeEntry) callTrigger('rollbackTrigger') ownDocumentBlock.clear() exit() import hack lQty = hack.a2f(ownItemBlock.qtyEntry,4) lBonus = hack.a2f(ownItemBlock.bonusEntry,4) lDiscount = hack.a2f(ownItemBlock.discountEntry,4) lUnitPrice = hack.a2f(ownItemBlock.unitPriceEntry,4) lItemPrice = round((lQty * lUnitPrice) - lBonus - lDiscount,2) # lo traigo de tax_formula #ivaSourceCode = str(tmpValuesDataSource.IVAGraft) #amount = lItemPrice #taxPercent = hack.a2f(ownItemBlock.ivaEntry,4) #exec(ivaSourceCode) #aca debo cargarlo en item tax #ownItemBlock.taxAmountEntry = hack.a2f(graft(ownIVACond,alienIVACond,amount,taxPercent),4) # IVA lTTax = hack.a2f(totalBlock.ivaEntry,2) amount = lItemPrice taxPercent = hack.a2f(ownItemBlock.ivaEntry,2) #print "iva fmla",str(tmpValuesDataSource.IVAGraft) #print "iva RNI fmla",tmpValuesDataSource.IVARNIGraft if str(tmpValuesDataSource.IVAGraft) != "None": ivaSourceCode=str(tmpValuesDataSource.IVAGraft) exec(ivaSourceCode) lTTax -= hack.a2f(ownItemBlock.ivaAmountEntry,2) ownItemBlock.ivaAmountEntry = hack.a2f(graft(amount,taxPercent),4) lTTax += hack.a2f(ownItemBlock.ivaAmountEntry,2) if str(tmpValuesDataSource.IVARNIGraft) != "None": print "hay iva RNI" #if not ownItemIVARNIBlock.getCurrentRecord().isEmpty(): # ownItemIVARNIBlock.newRecord() ivaRNISourceCode=str(tmpValuesDataSource.IVARNIGraft) exec(ivaRNISourceCode) lTTax -= hack.a2f(ownItemBlock.ivaRNIAmountEntry,4) ownItemBlock.ivaRNIAmountEntry = hack.a2f(graft(amount,taxPercent),4) lTTax += hack.a2f(ownItemBlock.ivaRNIAmountEntry,4) ownItemBlock.itemNetoEntry = lItemPrice ownItemBlock.itemTotalEntry = lItemPrice + hack.a2f(ownItemBlock.ivaRNIAmountEntry,2)+hack.a2f(ownItemBlock.ivaAmountEntry,2) #sumo el total del documento lTNeto = 0 lRecords = ownItemDataSource.getRecords() for index in range(len(lRecords)): lRecord = lRecords[index] lQty = hack.a2f(lRecord.getField("own_product_item.qty"),4) #print "cantidad: ",lQty lBonus = hack.a2f(lRecord.getField("own_item.bonus"),4) lDiscount = hack.a2f(lRecord.getField("own_item.discount"),4) lUnitPrice = hack.a2f(lRecord.getField("own_product_item.unit_price"),4) lItemPrice = round((lQty * lUnitPrice) - lBonus - lDiscount,2) lTNeto += lItemPrice #lTTax += hack.a2f(lRecord.getField("own_item_tax.amount"),4) ownDocumentBlock.netTotalEntry = str(round(lTNeto,2)) totalBlock.netoEntry = str(round(lTNeto,2)) ownDocumentBlock.taxTotalEntry = str(round(lTTax,2)) totalBlock.ivaEntry = str(round(lTTax,2)) totalBlock.totalEntry = str(round(lTNeto+lTTax,2)) payBlock.cashEntry = str(round(lTNeto+lTTax,2)) payBlock.ctaCteEntry = "0.0" if ($document_type_A == 4) { if str(ownDocumentBlock.relatedToEntry)and (str(totalBlock.printDespatchNote) == "1") : genericBox("Solo se incluira como relacionado el remito generado\n",['Aceptar']) } print "volvi" if ($document_type_A == 4) { import hack reportNo= str(ownDocumentBlock.typeEntry) #print 'here nos iva cond _ ell iva cond: %s, %s' % (str(tmpValuesDataSource.alienIVACond), str(tmpValuesDataSource.ownIVACond)) if str(tmpValuesDataSource.alienIVACond)=='2' and str(tmpValuesDataSource.ownIVACond)=='1': # hack to use alternative report and print config reportNo= '4_and_half' report='productInvoice-%s' % reportNo print 'here: %s' % reportNo print "llamo al hack.pleasePrint" hack.pleasePrint (self, reportNo, report, [ 'id='+str(ownDocumentBlock.idEntry) ],str(ownPosDocumentBlock.documentPrintCommand)) } callTrigger('rollbackTrigger') if ($document_type_A == 4) { import hack print "entro al trigger" if str(totalBlock.printDespatchNote) == "1": # defino la funcion de callback def invoiceForDespatchNote (despatchNoteId,despatchNoteNumber): print "id",despatchNoteId,"number",despatchNoteNumber ownDocumentBlock.relatedToEntry = str(despatchNoteNumber).strip().rjust(8).replace(' ','0') #solo para que no ensucie el update if str(ownDocumentBlock.dueDateEntry) == "": ownDocumentBlock.dueDateEntry = None documentRelationBlock.despatchEntry = str(despatchNoteId) documentRelationBlock.invoiceEntry = str(ownDocumentBlock.idEntry) documentRelationBlock.relationTypeEntry = str('"'.PAPO::invoiceOfDespatchNote.'"') from gnue.common.GDataObjects import ConnectionError as DBError try: print "largo el post changes" documentRelationBlock.postChanges() ownDocumentBlock.postChanges() commitConnection() except DBError, err: genericBox("Hay problemas para grabar el numero de remito\n"+str(err),['Aceptar']) rollbackConnection() callTrigger('invoiceForDespatchNoteTrigger') # fin de definicion print "llamo al otro form" runForm ('despatchNote.gfd', {'invoiceid':str(ownDocumentBlock.idEntry),'invdocblock':ownDocumentBlock,'invitemblock':ownItemBlock ,'callback': invoiceForDespatchNote }) else: print "no llamo a despatch note" } 1: def callback (returnValue): global block if returnValue >= 0: clientResultBlock.jumpRecord(returnValue) ownDocumentBlock.clientRecipientBox.clientCodeEntry = str(clientResultBlock.uidEntry) ownDocumentBlock.clientRecipientBox.clientNameEntry = str(clientResultBlock.nameEntry) ownDocumentBlock.clientRecipientBox.clientEntry = str(clientResultBlock.idEntry) callTrigger('startWaitingModeTrigger') callTrigger('bringClientDataTrigger') callTrigger('endWaitingModeTrigger') runForm ('clientSelect.gfd', {'data': clientResultBlock, 'callback': callback}) elif recordCount == 1: clientResultBlock.jumpRecord(0) ownDocumentBlock.clientRecipientBox.clientCodeEntry = str(clientResultBlock.uidEntry) ownDocumentBlock.clientRecipientBox.clientNameEntry = str(clientResultBlock.nameEntry) ownDocumentBlock.clientRecipientBox.clientEntry = str(clientResultBlock.idEntry) callTrigger('startWaitingModeTrigger') callTrigger('bringClientDataTrigger') callTrigger('endWaitingModeTrigger') ]]>