Description
Only reads data from the database.
Parameters
ihCallerHandle | input | handle | Handle of the calling program. CB-programs should just pass {&TARGETPROCEDURE} as value for this parameters. This parameter will not be used here but we just define this here as we might need it later and we want to make sure we don't have to change the interface later on. |
icDomainCode | input | character | Code of the domain to be used for the operational updates, this will normally be the current domain. |
iiDomainID | input | integer | ID of the domain to be used for the operational updates, this will normally be the current domain |
icUserLogin | input | character | Login of a user |
icGlobalLanguage | input | character | Language to be used by the Operationals |
icPart | input | character | Code of the product whereof we want to know the price and discount |
idQuantity | input | decimal | quantity of the transaction |
icUnitOfMeasure | input | character | Unit of Measrue of the transaction |
icCurrencyCode | input | character | Currency Code of the transaction |
icPriceList | input | character | Price list of the transaction |
itDate | input | date | Date of the transaction |
bcAmountType | input-output | character | Some specific information used by the Operationals - values 'L' and unknow value are valid values but no further information is available |
odPrice | output | decimal | Price that is returned based upon the input parameters |
odDiscountPercentage | output | decimal | Discount percentage that is returned based upon the input parameters |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/pmfgprogetpricepricelist.p)
/* ======================= */
/* default when not filled */
/* ======================= */
if icDomainCode = ? then assign icDomainCode = vcDomainCode.
if iiDomainID = ? then assign iiDomainID = viDomainID.
if icUserLogin = ? then assign icUserLogin = vcUserLogin.
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
if ihCallerHandle = ? or
valid-handle(ihCallerHandle) = false
then do:
assign oiReturnStatus = -3
vcMessage = trim(#T-1'Internal error: caller handle is not available.':255(999890638)T-1#).
<M-2 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9159':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in PMfgProGetPricePriceList>
return.
end.
/* =========== */
/* validations */
/* =========== */
if icGlobalLanguage = ? or icGlobalLanguage = "":U
then do:
<Q-3 run System (all) (Read) (NoCache)
(input ?, (LanguageID)
output dataset tqSystem) in BSystem >
find first tqSystem no-error.
if not available tqSystem
then do:
assign oiReturnStatus = -3
vcMessage = trim(#T-4'There is missing system definition.':255(999890639)T-4#).
<M-5 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9160':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in PMfgProGetPricePriceList>
return.
end.
assign icGlobalLanguage = tqSystem.tcLngCode.
end.
if (icPart = ? or icPart = "":U) or
(icUnitOfMeasure = ? or icUnitOfMeasure = "":U) or
(icCurrencyCode = ? or icCurrencyCode = "":U) or
(icPriceList = ? or icPriceList = "":U)
then do:
assign oiReturnStatus = -3
vcMessage = if icPart = ? or icPart = "":U
then trim(#T-7'Code of the product is mandatory.':255(999890642)T-7#)
else if icUnitOfMeasure = ? or icUnitOfMeasure = "":U
then trim(#T-10'Unit of Measure is mandatory.':255(999890645)T-10#)
else if icCurrencyCode = ? or icCurrencyCode = "":U
then trim(#T-11'Currency Code is mandatory.':255(999890646)T-11#)
else trim(#T-12'Price List is mandatory.':255(999890647)T-12#).
<M-6 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9161':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in PMfgProGetPricePriceList>
return.
end.
if idQuantity = ? or idQuantity < 0
then do:
assign oiReturnStatus = -3
vcMessage = trim(#T-9'Quantity must be positive.':255(999890643)T-9#).
<M-8 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9162':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in PMfgProGetPricePriceList>
return.
end.
if itDate = ?
then do:
assign oiReturnStatus = -3
vcMessage = trim(#T-14'Date is mandatory.':255(999890648)T-14#).
<M-13 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9164':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in PMfgProGetPricePriceList>
return.
end.
CALLSERVICEBLOCK: DO:
/* ================================================================================== */
/* convert all input, input-output, output parameters to a locally defined handle and */
/* let it point to a dataset that holds all parameters */
/* ================================================================================== */
create tGetPriceFromPriceListInParam.
assign tGetPriceFromPriceListInParam.thCallerHandle = ihCallerHandle
tGetPriceFromPriceListInParam.tcDomainCode = icDomainCode
tGetPriceFromPriceListInParam.tiDomainID = iiDomainID
tGetPriceFromPriceListInParam.tcUserLogin = icUserLogin
tGetPriceFromPriceListInParam.tcGlobalLanguage = icGlobalLanguage
tGetPriceFromPriceListInParam.tcPart = icPart
tGetPriceFromPriceListInParam.tdQuantity = idQuantity
tGetPriceFromPriceListInParam.tcUnitOfMeasure = icUnitOfMeasure
tGetPriceFromPriceListInParam.tcCurrencyCode = icCurrencyCode
tGetPriceFromPriceListInParam.tcPriceList = icPriceList
tGetPriceFromPriceListInParam.ttDate = itDate.
create tGetPriceFromPriceListIOParam.
assign tGetPriceFromPriceListIOParam.tcAmountType = bcAmountType.
create tGetPriceFromPriceListOutParam.
assign tGetPriceFromPriceListOutParam.tdPrice = odPrice
tGetPriceFromPriceListOutParam.tdDiscountPercentage = odDiscountPercentage.
assign vhIn = dataset tGetPriceFromPriceListInParam:handle
vhInOut = dataset tGetPriceFromPriceListIOParam:handle
vhOut = dataset tGetPriceFromPriceListOutParam:handle.
<M-15 run CallService
(input '':U (icProgramName),
input 'GetPriceFromPriceList':U (icMethodName),
input vhIn (izInput),
input-output vhInOut (bzInputOutput),
input-output vhOut (bzOutput),
input ? (icAsyncHandler),
output viExternalReturnStatus (oiReturnStatus)) in PMfgProGetPricePriceList>
if viExternalReturnStatus <> 0 then assign viLocalReturnStatus = viExternalReturnStatus.
delete object vhIn.
if viExternalReturnStatus < 0 then leave CALLSERVICEBLOCK.
/* ============================================== */
/* convert the output and input-output parameters */
/* ============================================== */
find first tGetPriceFromPriceListIOParam no-error.
assign bcAmountType = if available tGetPriceFromPriceListIOParam
then tGetPriceFromPriceListIOParam.tcAmountType
else "":U.
find first tGetPriceFromPriceListOutParam no-error.
if available tGetPriceFromPriceListOutParam
then assign odPrice = tGetPriceFromPriceListOutParam.tdPrice
odDiscountPercentage = tGetPriceFromPriceListOutParam.tdDiscountPercentage.
else assign odPrice = 0
odDiscountPercentage = 0.
END. /* CALLSERVICEBLOCK*/
/* ===================== */
/* Set ReturnStatus = OK */
/* ===================== */
assign oiReturnStatus = viLocalReturnStatus.