beginer
20th July 2005, 08:34
Hi ,
Attached herewith a sample DAL.
#include <bic_dal>
table ttcmcs036 |* Tax Codes by Country
table ttfgld070 |* Financial Data for Multiple Tax Codes
|****************************** variables **************************************
extern domain tcdsca pur.tax.account
extern domain tcdsca sales.tax.account
extern domain tcdsca adv.receipts.acc
extern domain tcdsca adv.payments.acc
extern domain tcdsca tax.payments.acc
extern domain tcdsca tax.receipts.acc
extern domain tcdsca shift.tax.pur
extern domain tcdsca shift.tax.sales
extern domain tcdsca desc.dimension1
extern domain tcdsca desc.dimension2
extern domain tcdsca desc.dimension3
extern domain tcdsca desc.dimension4
extern domain tcdsca desc.dimension5
domain tctext error.message
domain tcncmp company
|***************************** property hooks **********************************
function extern long before.open.object.set()
{
company = get.compnr()
return(0)
}
function extern long tfgld070.cvat.check(long has_changed)
{
if not isspace(tfgld070.cvat) then
if not combination.exists(tfgld070.ccty, tfgld070.cvat) then
dal.set.error.message("tcmcst0361")
|* Tax code by country not found
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.vacp.check(long has_changed)
{
if not isspace(tfgld070.vacp) then
if not tfgld.dll1021.check.ledger.account.all.options(
company, tfgld070.vacp, 1, 5, 4, 1, 0, 1, 1, 0, 0,
error.message, pur.tax.account) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.vacs.check(long has_changed)
{
if not isspace(tfgld070.vacs) then
if not tfgld.dll1021.check.ledger.account.all.options(
company, tfgld070.vacs, 1, 1, 4, 1, 0, 1, 1, 0, 0,
error.message, sales.tax.account) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.vaap.check(long has_changed)
{
if not isspace(tfgld070.vaap) then
if not tfgld.dll1021.check.ledger.account.all.options(
company, tfgld070.vaap, 1, 1, 4, 1, 0, 1, 1, 0, 0,
error.message, adv.payments.acc) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.vaar.check(long has_changed)
{
if not isspace(tfgld070.vaar) then
if not tfgld.dll1021.check.ledger.account.all.options(
company, tfgld070.vaar, 1, 1, 4, 1, 0, 1, 1, 0, 0,
error.message, adv.receipts.acc) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.iavp.check(long has_changed)
{
if not isspace(tfgld070.iavp) then
if not tfgld.dll1021.check.ledger.account.all.options(
company, tfgld070.iavp, 1, 1, 4, 1, 0, 1, 1, 0, 0,
error.message, tax.payments.acc) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.iavr.check(long has_changed)
{
if not isspace(tfgld070.iavr) then
if not tfgld.dll1021.check.ledger.account.all.options(
company, tfgld070.iavr, 1, 1, 4, 1, 0, 1, 1, 0, 0,
error.message, tax.receipts.acc) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.casp.check(long has_changed)
{
if not isspace(tfgld070.casp) then
if not tfgld.dll1021.check.ledger.account.all.options(
company, tfgld070.casp, 1, 1, 4, 1, 0, 1, 1, 0, 0,
error.message, shift.tax.pur) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.cass.check(long has_changed)
{
if not isspace(tfgld070.cass) then
if not tfgld.dll1021.check.ledger.account.all.options(
company, tfgld070.cass, 1, 1, 4, 1, 0, 1, 1, 0, 0,
error.message, shift.tax.sales) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.dim1.check(long has_changed)
{
if not isspace(tfgld070.dim1) then
if not tfgld.dll1022.check.dimension.all.options(company,
"", 1, tfgld070.dim1, 1, 2, 0, error.message,
desc.dimension1) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.dim2.check(long has_changed)
{
if not isspace(tfgld070.dim2) then
if not tfgld.dll1022.check.dimension.all.options(company,
"", 2, tfgld070.dim2, 1, 2, 0, error.message,
desc.dimension2) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.dim3.check(long has_changed)
{
if not isspace(tfgld070.dim3) then
if not tfgld.dll1022.check.dimension.all.options(company,
"", 3, tfgld070.dim3, 1, 2, 0, error.message,
desc.dimension3) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.dim4.check(long has_changed)
{
if not isspace(tfgld070.dim4) then
if not tfgld.dll1022.check.dimension.all.options(company,
"", 4, tfgld070.dim4, 1, 2, 0, error.message,
desc.dimension4) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function extern long tfgld070.dim5.check(long has_changed)
{
if not isspace(tfgld070.dim5) then
if not tfgld.dll1022.check.dimension.all.options(company,
"", 5, tfgld070.dim5, 1, 2, 0, error.message,
desc.dimension5) then
dal.set.error.message("@" & error.message)
return(DALHOOKERROR)
endif
endif
return(0)
}
function domain tcbool combination.exists(
domain tcccty i.ccty,
domain tccvat i.cvat)
{
domain tcccty save.ccty
select tcmcs036.ccty:save.ccty
from tcmcs036
where tcmcs036._index1 = { :i.ccty, :i.cvat }
as set with 1 rows
selectdo
return(true)
endselect
return(false)
}
| |#103-15010.sn
function extern long tfgld070.read.fin.data.for.multiple.tax.code(
domain tcncmp i.fico,
domain tcccty i.ccty,
domain tccvat i.cvat,
domain tcsern i.sern,
ref domain tfgld.leac o.vacp,
ref domain tfgld.leac o.vacs,
ref domain tfgld.leac o.vaap,
ref domain tfgld.leac o.vaar,
ref domain tfgld.leac o.casp,
ref domain tfgld.leac o.cass,
ref domain tfgld.leac o.iavp,
ref domain tfgld.leac o.iavr,
ref domain tfgld.leac o.dim1,
ref domain tfgld.leac o.dim2,
ref domain tfgld.leac o.dim3,
ref domain tfgld.leac o.dim4,
ref domain tfgld.leac o.dim5)
{
DllUsage
Expl: This function reads Financial Tax data from BaanFinance for
a given Tax Country and Multiple Tax Code and from a specific
Financial Company. Ledger A/c's and Dimensions are returned.
Input: - i.fico, Financial Company
- i.ccty, Tax Country
- i.cvat, Tax Code
- i.sern, Serial Number, can be left empty
Output: - o.vacp, Interm Purchase Account
- o.vacs, Sales Tax Account
- o.vaap, Advance Payment Tax Account
- o.vaar, Advance Receipt Tax Account
- o.casp, Contra A/c Shifted Tax Purchase
- o.cass, Contra A/c Shifted Tax Sales
- o.iavp, Interim A/c
- o.iavr, Interim A/c
- o.dim1, Dimension 1
- o.dim2, Dimension 2
- o.dim3, Dimension 3
- o.dim4, Dimension 4
- o.dim5, Dimension 5
Return: - 0
- DALHOOKERROR
EndDllUsage
select tfgld070.*
from tfgld070
where tfgld070._index1 = { :i.ccty, :i.cvat ,:i.sern }
and tfgld070._compnr = :i.fico
as set with 1 rows
selectdo
o.vacp = tfgld070.vacp
o.vacs = tfgld070.vacs
o.vaap = tfgld070.vaap
o.vaar = tfgld070.vaar
o.casp = tfgld070.casp
o.cass = tfgld070.cass
o.iavp = tfgld070.iavp
o.iavr = tfgld070.iavr
o.dim1 = tfgld070.dim1
o.dim2 = tfgld070.dim2
o.dim3 = tfgld070.dim3
o.dim4 = tfgld070.dim4
o.dim5 = tfgld070.dim5
selectempty
dal.set.error.message("tfglds0707", i.ccty, i.cvat)
return(DALHOOKERROR)
endselect
return(0)
}