project QadFinancials > class BBillReport > method SetDataItemsBasesOnFilterTT
Description
Find all filter-parameters and assign them to the correct data-item.
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bbillreport.p)
/* =================================================================== */
/* Find all filter-parameters and assign them to the correct data-item */
/* =================================================================== */
/* ================================================================================ */
/* | Criteria for the From - To filters: */
/* | no values -> first - last (Query will take care of this) */
/* 0 From value + To blank -> Programmer will have to set To-value to From Value */
/* ================================================================================ */
/* ======================== */
/* Initialise all variables */
/* ======================== */
assign vtIssuedDate = ?
viBillNumber = ?
vcDebtorCodeFilter = ?
viEmployeeIDFilter = ?
viBillYearFilter = ?
viBillNumberFromFilter = ?
viBillNumberToFilter = ?
vtBillDateFromFilter = ?
vtBillDateToFilter = ?
vcPrintTypeFilter = ?
vcBankAccountCode = ?
vcBankAccountType = ?
vcBillCurrency = ?
vcBillScheduleCode = ?
vcPaymentType = ?
vcDInvoiceType = ?
vcPrintTypeFilter = ?
vdPaymentAmt = ?
vdPreviousBalance = ?
vdSalesAmt = ?
vtBillClosingDate = ?
vtDInvoiceDate = ?
vtPaymentDate = ?
vcDebtorAddress = ?
vdSalesTax = ?
vdSalesTotalAmt = ?
vcBusinessRelationName = ?
vcBusinessRelationID = ?
vdDInvoiceBalance = ?
vdDInvoiceOriginalBalance = ?
vdDInvoiceVatBalance = ?
vdDInvoiceVatExchangeRate = ?
vcBankNumber = ?
vcBankNumberBranch = ?
vcDebtorCodeFilter = ?
vcDDocumentReference = ?
viDDocument_ID = ?
vtPostingDate = ?
vcGLTransaction = ?
vcPaymentTarget = ?
vcPaymentInstrument = ?
vcDInvoiceReference = ?
vcBillStatusFilter = ?
vcCompanyName = ?
vcCompanyAddress = ?
vcContactInfo = ?.
for each tFilter:
case tFilter.tcBusinessFieldName:
/* ================== */
/* Customer Cando */
/* ================== */
when "Customer_CANDO":U
then assign vcDebtorCodeFilter = tFilter.tcParameterValue
tFilter.tcBusinessFieldName = 'tDebtor.DebtorCode':U no-error.
/* ================== */
/* Employee Code */
/* ================== */
when "EmployeeCode":U
then do:
<Q-14 run EmployeePrim (all) (Read) (NoCache)
(input ?, (EmployeeId)
input tFilter.tcParameterValue, (EmployeeCode)
input viCompanyId, (CompanyId)
output dataset tqEmployeePrim) in BEmployee>
find tqEmployeePrim where tqEmployeePrim.tcEmployeeCode = tFilter.tcParameterValue no-error.
if available tqEmployeePrim
then assign viEmployeeIDFilter = tqEmployeePrim.tiEmployee_ID
tFilter.tcBusinessFieldName = 'tBill.Employee_ID':U
tFilter.tcParameterValue = string(tqEmployeePrim.tiEmployee_ID)
tFilter.tcDataType = "i":U
tFilter.tcOperator = "=":U.
end.
/* ================== */
/* Bill Year */
/* ================== */
when "Year":U
then assign viBillYearFilter = int(tFilter.tcParameterValue)
tFilter.tcBusinessFieldName = 'tBill.BillYear':U no-error.
/* ================== */
/* Bill Number From-To*/
/* ================== */
when "Number_RANGE":U
then if tFilter.tcOperator = ">=":U
then assign viBillNumberFromFilter = int(tFilter.tcParameterValue)
tFilter.tcBusinessFieldName = 'tBill.BillCode':U no-error.
else if tFilter.tcOperator = "<=":U
then assign viBillNumberToFilter = int(tFilter.tcParameterValue)
tFilter.tcBusinessFieldName = 'tBill.BillCode':U no-error.
/* ================== */
/* Bill Date From-To */
/* ================== */
when "BillDate_RANGE":U
then if tFilter.tcOperator = ">=":U
then assign vtBillDateFromFilter = date(int(substring(tFilter.tcParameterValue, 5, 2,"CHARACTER":U)), int(substring(tFilter.tcParameterValue, 7, 2,"CHARACTER":U)), int(substring(tFilter.tcParameterValue, 1, 4,"CHARACTER":U)))
tFilter.tcBusinessFieldName = 'tBill.BillDate':U no-error.
else if tFilter.tcOperator = "<=":U
then assign vtBillDateToFilter = date(int(substring(tFilter.tcParameterValue, 5, 2,"CHARACTER":U)), int(substring(tFilter.tcParameterValue, 7, 2,"CHARACTER":U)), int(substring(tFilter.tcParameterValue, 1, 4,"CHARACTER":U)))
tFilter.tcBusinessFieldName = 'tBill.BillDate':U no-error.
/* ================== */
/* Print Type */
/* ================== */
when "PrintType":U
then do:
assign vcPrintTypeFilter = tFilter.tcParameterValue
tFilter.tcBusinessFieldName = 'tBill.BillStatus':U no-error.
if vcPrintTypeFilter = {&BILLREPORTTYPE-TESTPRINT} or
vcPrintTypeFilter = {&BILLREPORTTYPE-CONFIRMPRINT}
then assign tFilter.tcParameterValue = {&BILLSTATUS-INITIAL}
vcBillStatusFilter = {&BILLSTATUS-INITIAL}.
else if vcPrintTypeFilter = {&BILLREPORTTYPE-REPRINT}
then assign tFilter.tcParameterValue = {&BILLSTATUS-CONFIRM}
vcBillStatusFilter = {&BILLSTATUS-CONFIRM} + "," + {&BILLSTATUS-CLOSED}.
end.
/* ================== */
/* Print Type */
/* ================== */
When "PrintWithItemDetails":U then
assign vlPrintWithItemDetailsFilter = logical(tFilter.tcParameterValue).
end.
end.
/* Validate Print Type */
if vcPrintTypeFilter = ? or
vcPrintTypeFilter = '':U
then do:
<M-35 run SetMessage
(input #T-6'The Print Type field is mandatory.':255(115128269)T-6# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input ? (icRowid),
input 'qadfin-679272':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBillReport>
assign oiReturnStatus = -1.
return.
end.
if vcPrintTypeFilter = {&BILLREPORTTYPE-REPRINT} then
do:
if (viBillNumberFromFilter = 0 or
viBillNumberFromFilter = ?) and
(viBillNumberToFilter = 0 or
viBillNumberToFilter = ?) and
vtBillDateFromFilter = ? and
vtBillDateToFilter = ? then
do:
<M-73 run SetMessage
(input trim(#T-56'You must enter a bill number or bill date when reprinting bills.':255(904370345)T-56#) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input ? (icRowid),
input 'qadfin-818461':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBillReport>
assign oiReturnStatus = -2.
return.
end.
end.