baanfans
17th August 2005, 15:46
I have written a program using native baan tools. In this program you can converter one amount in the three company currencies, for a rate date and exchange type, (simulated normal Baan process, using standards dll's)

Enclosed source code...

It works good on UNIX, BaanERP5.0c.


|******************************************************************************
|* tccoro203 0 VRC B50P c prod
|* Conversor de importes en divisas propias
|* ID979130, Arístides José Romero Rivas.
|* 2005-08-16
|******************************************************************************
|* All Rights Reserved
|*
|* Permission to use, copy, modify, and distribute this software and its
|* documentation for any purpose and without fee is hereby granted,
|* provided that the above copyright notice appear in all copies and that
|* both that copyright notice and this permission notice appear in
|* supporting documentation.
|*
|* Josef N. and Baanboard.com DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|* AND FITNESS, IN NO EVENT SHALL Norbert Wimmer nor Baanboard.com BE LIABLE FOR ANY
|* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|* OR PERFORMANCE OF THIS SOFTWARE.
|******************************************************************************

|****************************** declaration section ***************************
declaration:

|************************************ tables **********************************

table ttcmcs040 |* Tipos de cambio

|********************************** variables *********************************

long i

domain tcmcs.long no.hcur
domain tcemm.depe curr.sys
domain tcccur ref.curr
domain tcyesno dummy.excb(3)

extern domain tcccur fico.hcur(3)
extern domain tcdate ratd.disp
extern domain tcrtyp rtyp.disp
extern domain tfgld.amnt amnt.disp
extern domain tfgld.amnt amnt.dp.disp(3)
extern domain tcratc rate.dp.disp(3)
extern domain tcratf ratf.dp.disp(3)
extern domain tccrnd crnd.f(3)
extern domain tcncmp b.cono

|**************************** program section *********************************

before.program:
b.cono = get.compnr()
if not tcemm.dll5000.get.home.currency.system(b.cono, fico.hcur,
no.hcur, curr.sys, ref.curr) then
mess("tfglds1100", 1,b.cono)
|* No se han definido divisas propias para la compañía %s
stop()
endif

|****************************** form section **********************************

form.1:
init.form:
get.screen.defaults()

|****************************** field section *********************************

field.rtyp.disp:
check.input:
select tcmcs040.*
from tcmcs040
where tcmcs040._index1 = {:rtyp.disp}
selectdo
|* No actions here
selectempty
set.input.error("ttstps0108", "Tipo de cambio")
|* No se permite Tipo de cambio
endselect

|***************************** choice section *********************************

choice.cont.process:
before.choice:
checK.all.input()

on.choice:
if not tcemm.dll5010.put.rates.in.an.array.utc(b.cono,
fico.hcur(1,1),
ratd.disp,
rtyp.disp,
rate.dp.disp,
ratf.dp.disp,
crnd.f,
dummy.excb) then
for i = 1 to no.hcur
rate.dp.disp(i) = 1
ratf.dp.disp(i) = 1
endfor
endif
tcemm.dll5010.calculate.amounts.in.hc.utc(fico.hcur(1,1),
amnt.disp,
b.cono,
rate.dp.disp,
ratf.dp.disp,
ratd.disp,
rtyp.disp,
amnt.dp.disp)
tccom.dll0001.round.amount(amnt.dp.disp, no.hcur, "tfgld.amnt", fico.hcur, crnd.f)
for i = 1 to no.hcur
attr.element = i
display.all()
endfor

|****************************** end of source *********************************