$entity_type => '' $entity_table => '' $entity_name => '' if ($entity_table eq "client") { } print 'commitTrigger' isOk= 1 message= '' # mandatory fields if not str($entity_tableBlock.nameEntry): message+= 'Debe ingresar un nombre\n' isOk= 0 if ($entity_table eq "client") { if not str($entity_tableBlock.priceTypeEntry): message+= 'Debe seleccionar una Lista de Precios\n' isOk= 0 } if not str($entity_tableTaxProfileBlock.taxProfileEntry): message+= 'Debe ingresar un categoría de IVA\n' isOk= 0 # responsable inscripto=> need cuit if str($entity_tableTaxProfileBlock.taxProfileEntry)=='1' and not str($entity_tableUID_CUIT_Block.uidEntry): message+= 'El $entity_tablee es Responsable Inscripto. Debe ingresar su CUIT.\n' isOk= 0 from gnue.common.GDataObjects import ConnectionError as DBError if isOk: if $entity_tableBlock.getCurrentRecord().isInserted(): print "Poniendo Nuevo" # entity_type 7 es $entity_name #clientBlock.clientEntityTypeEntry = if not creditLimit1Block.getCurrentRecord().isInserted(): creditLimit1Block.newRecord() creditLimit1Block.movementTypeEntry = 1 # creditLimit1Block.creditLimitEntry = "0.0" if not $entity_tableUID_CUIT_Block.getCurrentRecord().isInserted(): $entity_tableUID_CUIT_Block.newRecord() # 1 es CUIT $entity_tableUID_CUIT_Block.uid_CUIT_TypeEntry = 1 if not $entity_tableUID_IB_Block.getCurrentRecord().isInserted(): $entity_tableUID_IB_Block.newRecord() # 2 es Ingresos Brutos $entity_tableUID_IB_Block.uid_IB_TypeEntry = 2 if not $entity_tableCodeBlock.getCurrentRecord().isInserted(): $entity_tableCodeBlock.newRecord() # 3 es Codigo $entity_tableCodeBlock.$entity_tableCodeType = 3 # clientTaxProfileBlock.newRecord() try: postChangeAdvance = 0 $entity_tableBlock.postChanges() # porque esto? # para que los labels de la ultima pagina se actualizen apropiadamente tmpId = str($entity_tableBlock.$entity_tableIdEntry) $entity_tableBlock.clear() $entity_tableBlock.initQuery() $entity_tableBlock.$entity_tableIdEntry = tmpId $entity_tableBlock.processQuery() if ($entity_table eq "client") { callTrigger("show$entity_tablePriceTypeTrigger") } # modified database entityTypesBlock.$entity_tableEntityEntry = str($entity_tableBlock.$entity_tableIdEntry) entityTypesBlock.$entity_tableEntityTypeEntry = $entity_type # le doy de alta a las 4 direcciones basicas addressBlock.addressTypeIdEntry = 1 addressBlock.nextRecord() addressBlock.addressTypeIdEntry = 2 addressBlock.nextRecord() addressBlock.addressTypeIdEntry = 3 addressBlock.nextRecord() addressBlock.addressTypeIdEntry = 4 postChangeAdvance = 1 $entity_tableBlock.postChanges() # modified database commitConnection() except DBError, err: rollbackConnection() message = "Hay problemas para grabar " if postChangeAdvance == 0: message += "los datos del $entity_name" elif postChangeAdvance == 1: message += "las direcciones" genericBox(message+"\n"+str(err),['Aceptar']) else: try: $entity_tableBlock.postChanges() commitConnection() except DBError, err: rollbackConnection() genericBox("Hay problemas para grabar los datos del $entity_name\n"+str(err),['Aceptar']) else: form.genericBox (message+'Los datos no han sido grabados', ['Aceptar']) try: $entity_tableBlock.deleteRecord() $entity_tableBlock.postChanges() commitConnection() except DBError, err: rollbackConnection() genericBox("Hay problemas para borrar los datos del $entity_name\n"+str(err),['Aceptar']) for block in [ $entity_tableBlock, $entity_tableCodeBlock, $entity_tableTaxProfileBlock, creditLimit1Block ]: block.clear() reset() callTrigger('$entity_tablePageFocusInTrigger') import hack # there are some places where the blocks are dirty # for field in clientBloc hack.confirmPageChanges(self, 'commitTrigger', $entity_tableBlock) try: addressBlock.deleteRecord() $entity_tableBlock.postChanges() commitConnection() except DBError, err: rollbackConnection() genericBox("Hay problemas para borrar las direcciones del $entity_name\n"+str(err),['Aceptar']) for block in [ $entity_tableBlock, $entity_tableCodeBlock, $entity_tableTaxProfileBlock, creditLimit1Block ]: block.clear() addressBlock.reset() callTrigger('addressTypeNameSearchTrigger') callTrigger('startWaitingModeTrigger') import gnue.common.GConditions as GConditions import string import os import tempfile import hack import printing \n" line += "" line += "" line += "" line += "\n" line += "" table.append(line) ]]> if str($entity_tableSearchBlock.searchCodeEntry) or str($entity_tableSearchBlock.searchNameEntry): $entity_tableCondition = GConditions.GConditions() tmpAnd = GConditions.GCand($entity_tableCondition) if str($entity_tableSearchBlock.searchCodeEntry): eq1 = GConditions.GClike(tmpAnd) GConditions.GCField(eq1,"_entity_uid_data.uid") GConditions.GCConst(eq1,str($entity_tableSearchBlock.searchCodeEntry)+'%') if str($entity_tableSearchBlock.searchNameEntry): eq2 = GConditions.GClike(tmpAnd) GConditions.GCField(eq2,"_entity_data.name") GConditions.GCConst(eq2,str($entity_tableSearchBlock.searchNameEntry)+'%') $entity_tableResulSet = print$entity_tableDataSource.createResultSet($entity_tableCondition) else: $entity_tableResulSet = print$entity_tableDataSource.createResultSet() more = $entity_tableResulSet.firstRecord(); while more: #agregar condicion de busquedq de direccion addressCondition = GConditions.GCondition() tmpAnd = GConditions.GCand(addressCondition) eq1 = GConditions.GCeq(tmpAnd) GConditions.GCField(eq1,"_address_data.entity") GConditions.GCConst(eq1,str($entity_tableResulSet.current.getField("_entity_data._table"))) eq2 = GConditions.GCeq(tmpAnd) GConditions.GCField(eq2,"_address_data.address_type") GConditions.GCConst(eq2,"1") addressResulSet = printAddressDataSource.createResultSet(addressCondition) anAddress = addressResulSet.firstRecord() addresses = [] while anAddress: addresses.append(addressResulSet.current.getField("address")) anAddress = addressResulSet.nextRecord() # ahora telefono es una direccion de address_type = '2' addressCondition = GConditions.GCondition() tmpAnd = GConditions.GCand(addressCondition) eq1 = GConditions.GCeq(tmpAnd) GConditions.GCField(eq1,"_address_data.entity") GConditions.GCConst(eq1,str($entity_tableResulSet.current.getField("_entity_data._table"))) eq2 = GConditions.GCeq(tmpAnd) GConditions.GCField(eq2,"_address_data.address_type") GConditions.GCConst(eq2,"2") telephoneResulSet = printAddressDataSource.createResultSet(addressCondition) anTelephone = telephoneResulSet.firstRecord() telephones = [] while anTelephone: telephones.append(telephoneResulSet.current.getField("address")) anTelephone = telephoneResulSet.nextRecord() " line += "" def fillHtmlCell(cellValue): if cellValue: preValue = cellValue.pop() if preValue: return "" else: return "" else: return "" line += fillHtmlCell(addresses) line += fillHtmlCell(telephones) line += "\n" table.append(line) while addresses or telephones: line = "" line += fillHtmlCell(addresses) line += fillHtmlCell(telephones) line += "\n" table.append(line) line = "" table.append(line) ]]> more = $entity_tableResulSet.nextRecord()
CódigoNombreDirecciónTeléfono
-------------------------------------------------------------------------------
" ]]> preValue = $entity_tableResulSet.current.getField("_entity_uid_data.uid") " else: line += "" ]]> preValue = $entity_tableResulSet.current.getField("_entity_data.name") " else: line += ""+preValue+"
 
\n") callTrigger('endWaitingModeTrigger') htmlFileName= tempfile.mktemp (".html") txtFileName= tempfile.mktemp (".txt") if not os.path.isfile(htmlFileName): file = os.open(htmlFileName,os.O_CREAT,0644) os.close(file) if not os.path.isfile(txtFileName): file = os.open(txtFileName,os.O_CREAT,0644) os.close(file) htmlFile = os.open(htmlFileName,os.O_WRONLY,0644) txtFile = os.open(txtFileName,os.O_WRONLY,0644) for line in table: os.write(htmlFile,line) os.write(txtFile,printing.printDate ()) # Agrega la Fecha ]]> os.write(txtFile,"\n\nListado de $entity_names\n\n\n") # Agrega titulo > "+txtFileName) os.remove(htmlFileName) os.close(txtFile) printing.previewPrintFromFile(txtFileName) os.remove(txtFileName) ]]>
0 try: from gnue.forms.GFEvent import GFEvent except ImportError: from gnue.common.events.Event import Event as GFEvent setStatusText('buscando...') self._object.dispatchEvent(GFEvent('beginWAIT')) $entity_tableResultBlock.clear() $entity_tableResultBlock.initQuery() if str($entity_tableSearchBlock.searchCodeEntry): $entity_tableResultBlock.codeListEntry = str($entity_tableSearchBlock.searchCodeEntry)+'%' if str($entity_tableSearchBlock.searchNameEntry): $entity_tableResultBlock.nameListEntry = '%s%%' % $entity_tableSearchBlock.searchNameEntry $entity_tableResultBlock.processQuery() setStatusText('Aceptar') self._object.dispatchEvent(GFEvent('endWAIT')) if $entity_tableResultBlock.isEmpty(): $entity_tableSearchBlock.notificationEntry = ' no se encontraron registros' else: $entity_tableSearchBlock.notificationEntry ='%6d registros encontrados' % $entity_tableResultBlock.getRecordCount() import hack if hack.emptyEntry($entity_tableBlock.$entity_tableIdEntry): callTrigger ('account_planForId') if ($entity_table eq "client") { callTrigger ('price_typeForId') } if ($entity_table eq "client") { # this is needed for updating some fields, like price_type there below if str($entity_tableBlock.priceTypeEntry)!='': # look for the name... searchingPriceTypeBlock.clear() searchingPriceTypeBlock.initQuery () searchingPriceTypeBlock.idEntry= str($entity_tableBlock.priceTypeEntry) searchingPriceTypeBlock.processQuery () # ... and show it $entity_tableBlock.priceTypeNameEntry= str(searchingPriceTypeBlock.nameEntry) } setStatusText("Procesando ...") try: # gnue version lt 0.4 from gnue.forms.GFEvent import GFEvent except ImportError: # gnue version gt 0.5 from gnue.common.events.Event import Event as GFEvent # busy clock self._object.dispatchEvent(GFEvent('beginWAIT')) try: # gnue version lt 0.4 from gnue.forms.GFEvent import GFEvent except ImportError: # gnue version gt 0.5 from gnue.common.events.Event import Event as GFEvent self._object.dispatchEvent(GFEvent('endWAIT')) setStatusText("Listo") print "trigger de busqueda de nombres" addressBlock.firstRecord() for index in range(addressBlock.getRecordCount()): if str(addressBlock.addressTypeIdEntry) != "": addressTypeResultBlock.clear() addressTypeResultBlock.initQuery() addressTypeResultBlock.addressTypeResultIdEntry= str(addressBlock.addressTypeIdEntry) addressTypeResultBlock.processQuery() addressBlock.addressTypeNameEntry= str(addressTypeResultBlock.addressTypeResultNameEntry) addressBlock.nextRecord() try: # gnue version lt 0.4 from gnue.forms.GFEvent import GFEvent except ImportError: # gnue version gt 0.5 from gnue.common.events.Event import Event as GFEvent # busy clock form._object.dispatchEvent(GFEvent('beginWAIT')) setStatusText('buscando...') def setAddressType (recNo): if recNo>=0: addressTypeResultBlock.jumpRecord (recNo) addressBlock.addressTypeIdEntry= str(addressTypeResultBlock.addressTypeResultIdEntry) addressBlock.addressTypeNameEntry= str(addressTypeResultBlock.addressTypeResultNameEntry) # look for the name... addressTypeResultBlock.clear() addressTypeResultBlock.initQuery () addressTypeResultBlock.addressTypeResultNameEntry= str(addressBlock.addressTypeNameEntry)+'%' addressTypeResultBlock.processQuery () # are there too much results? resultCount= addressTypeResultBlock.getRecordCount () if resultCount>1: # do the select-man runForm ('addressTypeSelect.gfd', { 'data':addressTypeResultBlock, 'callback': setAddressType }) elif resultCount==1: setAddressType (0) setStatusText('Aceptar') form._object.dispatchEvent(GFEvent('endWAIT')) print "pre focusin trigger" $entity_tableBlock.clear() if $entity_tableResultBlock.getRecordCount() > 0 and not $entity_tableResultBlock.getCurrentRecord().isEmpty(): $entity_tableBlock.initQuery() $entity_tableBlock.$entity_tableIdEntry = ("%s" % $entity_tableResultBlock.$entity_tableIdREntry) $entity_tableBlock.processQuery()