/[papo]/papo/sql/conv/hack.py
ViewVC logotype

Diff of /papo/sql/conv/hack.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by apronotti, Mon Apr 14 18:01:07 2003 UTC revision 1.2 by apronotti, Wed May 14 19:01:51 2003 UTC
# Line 31  def is_true(x): Line 31  def is_true(x):
31      if (s and s[0] != 'n' and s[0] != 'N'):      if (s and s[0] != 'n' and s[0] != 'N'):
32        r = 1        r = 1
33    return r    return r
34      
35    
36  #   hace que rollback funcione como uno en general quiere (por  #   hace que rollback funcione como uno en general quiere (por
37  #   ejemplo, que haga rollback)  #   ejemplo, que haga rollback)
38    
39  def rollback(block):  def rollback(block):
40      if block.getCurrentRecord().isInserted():    block.reset()
         block.processRollback()  
     else:  
         block.processRollback(1)  
41    
42  #   borra el registro actual. esto es corto hoy, pero si llegamos a  #   borra el registro actual. esto es corto hoy, pero si llegamos a
43  #   encontrar que hace falta agrandarlo, mejor tenerlo acá, no?  #   encontrar que hace falta agrandarlo, mejor tenerlo acá, no?
# Line 53  def deleteCurrentRecord(block): Line 50  def deleteCurrentRecord(block):
50  #   realiza la búsqueda especificada  #   realiza la búsqueda especificada
51    
52  def search(block, search_entry, result_entry):  def search(block, search_entry, result_entry):
53    block.processRollback()    block.clear()
54    block.initQuery()    block.initQuery()
55    result_entry = str(search_entry)+'%'    result_entry = str(search_entry)+'%'
56    block.processQuery()    block.processQuery()
# Line 62  def search(block, search_entry, result_e Line 59  def search(block, search_entry, result_e
59  #   prepara para ABM de dato buscado  #   prepara para ABM de dato buscado
60    
61  def constrain(search_block, result_block, search_entry, result_entry):  def constrain(search_block, result_block, search_entry, result_entry):
62    result_block.processRollback()    result_block.clear()
63    if (search_block.getRecordCount() > 0    if (search_block.getRecordCount() > 0
64        and not search_block.getCurrentRecord().isEmpty()):        and not search_block.getCurrentRecord().isEmpty()):
65      result_block.initQuery()      result_block.initQuery()
# Line 109  def confirmRollback (form, block, commit Line 106  def confirmRollback (form, block, commit
106      elif res == 2:      elif res == 2:
107        rollback(block)        rollback(block)
108    if res in (0, 1, 2):    if res in (0, 1, 2):
109      block.processRollback()      block.clear()
110      #block.newRecord()      #block.newRecord()
111      if entry:      if entry:
112        form.setFocus(entry)        form.setFocus(entry)
113    
114  #   'imprime' a travez de un report  #   'imprime' a travez de un report
115  def pleasePrint (form, printer, docType, report, args):  def pleasePrint (form, docType, clientreport, args, command="lpr"):
116    from os import system, remove    from os import system, remove
117    from tempfile import mktemp    from tempfile import mktemp
118    
# Line 123  def pleasePrint (form, printer, docType, Line 120  def pleasePrint (form, printer, docType,
120    # hmmm, I prefer haskell or perl here :)    # hmmm, I prefer haskell or perl here :)
121    # argStr= " ".join (map (lambda key: "%s=%s" % (key, args[key]), args.keys ()))    # argStr= " ".join (map (lambda key: "%s=%s" % (key, args[key]), args.keys ()))
122    argStr= " ".join (args)    argStr= " ".join (args)
123    system ("grcvs -D file --filter csv -d "+fileName+" ../report/"+report+".grd "+argStr)    print "grcvs -D file --filter csv -d "+fileName+" ../report/"+clientreport+".grd "+argStr
124    #system ("../print/print.py "+' '.join([printer, docType, fileName])+" | lpr")    system ("grcvs -D file --filter csv -d "+fileName+" ../report/"+clientreport+".grd "+argStr)
125    system ("../print/print.py "+' '.join([printer, docType, fileName])+" > /tmp/invoice.txt ")    system ("../print/print.py "+' '.join([docType, fileName])+" | " + command)
126    while form.genericBox ('Verifique que se haya impreso bien', ['Listo', 'Reintentar'])==2:    while form.genericBox ('Verifique que se haya impreso bien', ['Listo', 'Reintentar'])==2:
127      #system ("../print/print.py "+' '.join([printer, docType, fileName])+" | lpr")      system ("../print/print.py "+' '.join([docType, fileName])+" | " + command)
128      system ("../print/print.py "+' '.join([printer, docType, fileName])+" > /tmp/invoice.txt ")    # remove (fileName)
129    remove (fileName)    print "nombre del archivo: %s" % fileName
130    
131    
132  def previewPrint (table):  def previewPrint (table):
133    from os import system, remove    from os import system, remove
134    from tempfile import mktemp    from tempfile import mktemp
135    
136    file= mktemp (".txt")    file= mktemp (".txt")
   #filePS = mktemp (".ps")  
137    fileOut = open(file,'w')    fileOut = open(file,'w')
138    for line in table:    for line in table:
139      fileOut.write(line+"\n")      fileOut.write(line+"\n")
140    fileOut.close()    fileOut.close()
141    
142    system(gConfig('PrintCommand') % (file))    system(gConfig('PrintCommand') % (file))
   #system ("enscript --header='%W|Página $% de $='  -o "+filePS+" "+file)  
   
   #system ("gv "+filePS)  
143    
144    remove (file)    remove (file)
   #remove (filePS)  
145    
146  def runFormWCallback (formFile, args, callbackFunction):  def runFormWCallback (formFile, args, callbackFunction):
147    runForm (formFile, args.update ({ 'callback': callbackFunction }))    runForm (formFile, args.update ({ 'callback': callbackFunction }))
# Line 164  def calcInvoiceType(providerIvaTaxProfil Line 157  def calcInvoiceType(providerIvaTaxProfil
157    #4 = 'Monotributo'    #4 = 'Monotributo'
158    #5 = 'Consumidor Final'    #5 = 'Consumidor Final'
159    result = 'C'    result = 'C'
160        
161    if str(providerIvaTaxProfile).strip() == '1':    if str(providerIvaTaxProfile).strip() == '1':
162      if str(clientIvaTaxProfile) in ('1','2'):      if str(clientIvaTaxProfile) in ('1','2'):
163        result = 'A'        result = 'A'
164      elif str(clientIvaTaxProfile) in ('3','4','5'):      elif str(clientIvaTaxProfile) in ('3','4','5'):
165        result = 'B'        result = 'B'
166    return result    return result
       

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26