/[papo]/papo/forms/providerMultiCurrency.neb
ViewVC logotype

Diff of /papo/forms/providerMultiCurrency.neb

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

revision 1.3 by charlie, Thu May 29 21:33:37 2003 UTC revision 1.4 by charlie, Fri May 30 21:32:44 2003 UTC
# Line 21  Line 21 
21  import hack  import hack
22    
23  payBlock = getParameter ('amount')  payBlock = getParameter ('amount')
24  if hack.a2f(payBlock.cashAmountEntry) > 0:  if hack.a2f(payBlock.cashAmountEntry,2) > 0:
25      currencyTypeBlock.clear()      currencyTypeBlock.clear()
26    
27      rs = currencyTypeDataSource.createResultSet()      rs = currencyTypeDataSource.createResultSet()
# Line 32  if hack.a2f(payBlock.cashAmountEntry) > Line 32  if hack.a2f(payBlock.cashAmountEntry) >
32              currencyTypeBlock.newRecord()              currencyTypeBlock.newRecord()
33          currencyTypeBlock.currencyBox.idEntry = rs.current.getField("_table")          currencyTypeBlock.currencyBox.idEntry = rs.current.getField("_table")
34          currencyTypeBlock.currencyBox.nameEntry = rs.current.getField("name")          currencyTypeBlock.currencyBox.nameEntry = rs.current.getField("name")
35          currencyTypeBlock.currencyBox.rateEntry = hack.a2f(rs.current.getField("rate"))          currencyTypeBlock.currencyBox.rateEntry = hack.a2f(rs.current.getField("rate"),2)
36          monto = hack.a2f(hack.a2f(payBlock.cashAmountEntry) / hack.a2f(rs.current.getField("rate")),2)          monto = round(hack.a2f(payBlock.cashAmountEntry,2) / hack.a2f(rs.current.getField("rate"),2),2)
37          currencyTypeBlock.currencyBox.formatEntry = rs.current.getField("format")          currencyTypeBlock.currencyBox.formatEntry = rs.current.getField("format")
38          currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto          currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto
39          currencyTypeBlock.currencyBox.payEntry = 0.0          currencyTypeBlock.currencyBox.payEntry = 0.0
# Line 47  import hack Line 47  import hack
47            
48  payBlock = getParameter ('amount')  payBlock = getParameter ('amount')
49    
50  total = hack.a2f(payBlock.cashAmountEntry)  total = hack.a2f(payBlock.cashAmountEntry,2)
51  rc = currencyTypeBlock.getRecordCount()  rc = currencyTypeBlock.getRecordCount()
52  for recNum in range(rc):  for recNum in range(rc):
53      currencyTypeBlock.jumpRecord(recNum)      currencyTypeBlock.jumpRecord(recNum)
54      if hack.a2f(currencyTypeBlock.currencyBox.payEntry) > 0:      if hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) > 0:
55          total -= hack.a2f(hack.a2f(currencyTypeBlock.currencyBox.payEntry) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2)          total -= round(hack.a2f(currencyTypeBlock.currencyBox.payEntry) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2)
56    
57  rc = currencyTypeBlock.getRecordCount()  rc = currencyTypeBlock.getRecordCount()
58  for recNum in range(rc):  for recNum in range(rc):
59      currencyTypeBlock.jumpRecord(recNum)      currencyTypeBlock.jumpRecord(recNum)
60      if hack.a2f(currencyTypeBlock.currencyBox.rateEntry) > 0:      if hack.a2f(currencyTypeBlock.currencyBox.rateEntry) > 0:
61          monto = hack.a2f(total / hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2)          monto = round(total / hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2)
62          currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto          currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto
63            
64          ]]></trigger>          ]]></trigger>
# Line 72  callTrigger('currencyTypeTrigger') Line 72  callTrigger('currencyTypeTrigger')
72    
73  payBlock = getParameter ('amount')  payBlock = getParameter ('amount')
74    
75  total = hack.a2f(payBlock.cashAmountEntry)  total = hack.a2f(payBlock.cashAmountEntry,2)
76  rc = currencyTypeBlock.getRecordCount()  rc = currencyTypeBlock.getRecordCount()
77  for recNum in range(rc):  for recNum in range(rc):
78      currencyTypeBlock.jumpRecord(recNum)      currencyTypeBlock.jumpRecord(recNum)
79      if hack.a2f(currencyTypeBlock.currencyBox.rateEntry) > 0:      if hack.a2f(currencyTypeBlock.currencyBox.rateEntry) > 0:
80          total -= hack.a2f(hack.a2f(currencyTypeBlock.currencyBox.payEntry) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2)          total -= round(hack.a2f(currencyTypeBlock.currencyBox.payEntry) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2)
81    
82  if total != 0:  if total != 0:
83      genericBox("El los montos no completan el total del documento\n",['Aceptar'])      genericBox("El los montos no completan el total del documento\n",['Aceptar'])
# Line 90  else: Line 90  else:
90              if not currencyMovementBlock.getCurrentRecord().isEmpty():              if not currencyMovementBlock.getCurrentRecord().isEmpty():
91                  currencyMovementBlock.newRecord()                  currencyMovementBlock.newRecord()
92              currencyMovementBlock.currencyTypeEntry = str(currencyTypeBlock.currencyBox.idEntry)              currencyMovementBlock.currencyTypeEntry = str(currencyTypeBlock.currencyBox.idEntry)
93              currencyMovementBlock.amountEntry = str(hack.a2f(hack.a2f(currencyTypeBlock.currencyBox.payEntry) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2))              currencyMovementBlock.amountEntry = str(round(hack.a2f(currencyTypeBlock.currencyBox.payEntry) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2))
94      tmpBlock.returnEntity = str(1)      tmpBlock.returnEntity = str(1)
95      exit()      exit()
96        ]]>        ]]>

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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