project QadFinancials > class BBox1099Report > method GetBusinessFields

Description

This method is used to get report result set structure according to the specific method name.


Parameters


icReferenceinputcharacter- <classname> for receiving business field information of a business class
- <classname>.<methodname> for receiving business field information of a browse or report
tBusinessFieldsoutputtemp-table
tCustomRelationoutputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program/bbox1099report.p)

<ANCESTOR-CODE>

if can-do("M1099MiscReport,M1099MiscPaperDeclaration":U, icReference)
then do:
    /*Payment year*/
    create tBusinessFields.
    assign tBusinessFields.tcSideLabel     = #T-1'Payment Year':20(64359)T-1#
           tBusinessFields.tcFcDescription = #T-2'Payment Year':20(64359)T-2#
           tBusinessFields.tcFcFieldName   = "PaymentYear":U
           tBusinessFields.tcDataType      = "i":U
           tBusinessFields.tcControlType   = "NumericInt":U
           tBusinessFields.tcDisplayFormat = "9999":U
           tBusinessFields.tcFcFieldType   = "F":U
           tBusinessFields.tcInitialValue  = STRING(YEAR(TODAY) - 1).

    /*Supplier code from-to*/           
    create tBusinessFields.
    assign tBusinessFields.tcSideLabel     = trim(#T-3'Supplier Code':30(1553)T-3#)
           tBusinessFields.tcFcDescription = trim(#T-4'From - To Supplier Code':100(1554)T-4#)
           tBusinessFields.tcFcFieldName   = "SupplierCode_RANGE":U
           tBusinessFields.tcDataType      = "c":U
           tBusinessFields.tcControlType   = "TextBox":U
           tBusinessFields.tcDisplayFormat = "x(20)":U
           tBusinessFields.tcFcFieldType   = "F":U
           tBusinessFields.tcLookupQuery       = "BCreditorSAO.SelectCreditor":U
           tBusinessFields.tcLookupReturnField = "tqSelectCreditor.tcCreditorCode":U
           tBusinessFields.tcLookupFilterField = "tCreditor.CreditorCode":U.
 
    /*Supplier type*/       
    <Q-17 run CreditorTypePrim (all) (Read) (NoCache)
       (input ?, (CreditorTypeID)
        input ?, (CreditorTypeCode)
        output dataset tqCreditorTypePrim) in BCreditorType >        

    assign vcSupplierTypeList = "":U.
    for each tqCreditorTypePrim:
        vcSupplierTypeList = vcSupplierTypeList + tqCreditorTypePrim.tcCreditorTypeCode + chr(2) + tqCreditorTypePrim.tcCreditorTypeCode + chr(2).
    end.
    trim(vcSupplierTypeList,chr(2)).
    
    create tBusinessFields.
    assign tBusinessFields.tcSideLabel     = trim(#T-5'Supplier Type':30(64388)T-5#)
           tBusinessFields.tcFcDescription = trim(#T-6'Supplier Type':30(64388)T-6#)
           tBusinessFields.tcFcFieldName   = "SupplierType_CANDO":U
           tBusinessFields.tcValueList     = vcSupplierTypeList
           tBusinessFields.tcDataType      = "c":U
           tBusinessFields.tcControlType   = "ComboBox":U
           tBusinessFields.tcDisplayFormat = "x(20)":U
           tBusinessFields.tcFcFieldType   = "F":U.                      
                      

           

    /*Entity*/
    <Q-61 run DomainsPrim (all) (Read) (NoCache)
            (input '', (DomainID)
             input vcDomainCode, (DomainCode)
             output dataset tqDomainsPrim) in BDomain>
             
    for each tqDomainsPrim:
        <Q-91 run CompanyByDomain (all) (Read) (NoCache)
           (input ?, (CompanyId)
            input tqDomainsPrim.tiDomain_ID, (DomainId)
            input ?, (Active)
            output dataset tqCompanyByDomain) in BCompany>        
    end.

    assign vcCompanyList = "".

    for each tqCompanyByDomain:
        assign vcCompanyList = vcCompanyList + tqCompanyByDomain.tcCompanyCode + chr(2) + tqCompanyByDomain.tcCompanyCode + chr(2).
    end.
    assign vcCompanyList = trim(vcCompanyList,chr(2)).
    create tBusinessFields.
    assign tBusinessFields.tcSideLabel      = trim(#T-59'Entity':30(62218)T-59#)
           tBusinessFields.tcFcDescription  = trim(#T-87'Entity':100(62219)T-87#)
           tBusinessFields.tcFcFieldName    = "Company_CANDO":U
           tBusinessFields.tcValidationMask = "IsEntityCode"
           tBusinessFields.tcValueList      = vcCompanyList
           tBusinessFields.tcDataType       = "c":U
           tBusinessFields.tcControlType    = "ComboBox":U
           tBusinessFields.tcDisplayFormat  = "x(20)":U
           tBusinessFields.tcFcFieldType    = "F":U.   
           
    /*Federal tax ID*/
       assign  vcFedTaxID   = "":U. 
    for each tqCompanyByDomain:
    <Q-25 run AddressForDomains (all) (Read) (NoCache)
       (input vcDomainCode, (DomainCode)
        input tqCompanyByDomain.tiCompany_ID, (CompanyId)
        input ?, (isTaxRepresentative)
        output dataset tqAddressForDomains) in BDomain>
      for each tqAddressForDomains:
        if tqAddressForDomains.tcAddressTaxIDFederal <> "" and tqAddressForDomains.tcAddressTaxIDFederal <> ? and index(vcFedTaxID, tqAddressForDomains.tcAddressTaxIDFederal) <= 0
        then vcFedTaxID = vcFedTaxID + tqAddressForDomains.tcAddressTaxIDFederal + chr(2) + tqAddressForDomains.tcAddressTaxIDFederal + chr(2).
      end.  
    end.
    


    assign vcFedTaxID = trim(vcFedTaxID,chr(2)).

    create tBusinessFields.
    assign tBusinessFields.tcSideLabel = #T-77'Federal Tax ID':255(57126)T-77#
           tBusinessFields.tcFcDescription = #T-43'Federal Tax ID':255(57126)T-43#
           tBusinessFields.tcFcFieldName   = "FederalTaxID_CANDO":U
           tBusinessFields.tcValueList     = vcFedTaxID
           tBusinessFields.tcDataType      = "c":U
           tBusinessFields.tcControlType   = "ComboBox":U
           tBusinessFields.tcDisplayFormat = "x(20)":U
           tBusinessFields.tcFcFieldType   = "F":U.
                              
end.           
        
if can-do("M1099MiscReport":U, icReference)
then do:          
    create tBusinessFields.
    assign tBusinessFields.tcSideLabel     = #T-11'Show Entity Details':50(64389)T-11#
           tBusinessFields.tcFcDescription = #T-12'Show Entity Details':50(64389)T-12#
           tBusinessFields.tcFcFieldName   = "ShowEntityDetails":U
           tBusinessFields.tcDataType      = "l":U
           tBusinessFields.tcControlType   = "Bool":U
           tBusinessFields.tcDisplayFormat = "yes/no":U
           tBusinessFields.tcFcFieldType   = "F":U.              
           
    create tBusinessFields.
    assign tBusinessFields.tcSideLabel     = #T-13'Show Transaction Details':50(64390)T-13#
           tBusinessFields.tcFcDescription = #T-14'Show Transaction Details':50(64390)T-14#
           tBusinessFields.tcFcFieldName   = "ShowTransactionDetails":U
           tBusinessFields.tcDataType      = "l":U
           tBusinessFields.tcControlType   = "Bool":U
           tBusinessFields.tcDisplayFormat = "yes/no":U
           tBusinessFields.tcFcFieldType   = "F":U.
           
    create tBusinessFields.
    assign tBusinessFields.tcSideLabel     = #T-33'Check For Unlinked Invoices':50(65015)T-33#
           tBusinessFields.tcFcDescription = #T-34'Check For Unlinked Invoices':50(65015)T-34#
           tBusinessFields.tcFcFieldName   = "CheckForUnlinkedInvoices":U
           tBusinessFields.tcDataType      = "l":U
           tBusinessFields.tcControlType   = "Bool":U
           tBusinessFields.tcDisplayFormat = "yes/no":U
           tBusinessFields.tcFcFieldType   = "F":U.                           
                    
    create tBusinessFields.
    assign tBusinessFields.tcSideLabel     = trim(#T-21'Report Description':30(49957)T-21#)
           tBusinessFields.tcFcDescription = trim(#T-22'Report Description':100(49958)T-22#)
           tBusinessFields.tcFcFieldName   = "ReportDescription":U
           tBusinessFields.tcDataType      = "c":U
           tBusinessFields.tcControlType   = "TextBox":U
           tBusinessFields.tcDisplayFormat = "x(20)":U
           tBusinessFields.tcFcFieldType   = "F":U.
           
end.

if can-do("M1099MiscPaperDeclaration":U, icReference)
then do:
    /* Mask Social Security Number */
    create tBusinessFields.
    assign tBusinessFields.tcSideLabel     = trim(#T-73'Mask Social Security Number':255(604434370)T-73#)
           tBusinessFields.tcFcDescription = trim(#T-53'Mask Social Security Number':255(604434370)T-53#)
           tBusinessFields.tcFcFieldName   = "MaskSSN":U
           tBusinessFields.tcDataType      = "l":U
           tBusinessFields.tcControlType   = "Bool":U
           tBusinessFields.tcDisplayFormat = "yes/no":U
           tBusinessFields.tcFcFieldType   = "F":U.
end.


Sample code: how to call this method through RPCRequestService (QXtend Inbound)

define temp-table ttContext no-undo
    field propertyQualifier as character
    field propertyName as character
    field propertyValue as character
    index entityContext is primary unique
        propertyQualifier
        propertyName
    index propertyQualifier
        propertyQualifier.

define dataset dsContext for ttContext.

define variable vhContextDS as handle no-undo.
define variable vhExceptionDS as handle no-undo.
define variable vhServer as handle no-undo.
define variable vhInputDS as handle no-undo.
define variable vhInputOutputDS as handle no-undo.
define variable vhOutputDS as handle no-undo.
define variable vhParameter as handle no-undo.

/* Create context */
create ttContext.
assign ttContext.propertyName = "programName"
       ttContext.propertyValue = "BBox1099Report".
create ttContext.
assign ttContext.propertyName = "methodName"
       ttContext.propertyValue = "GetBusinessFields".
create ttContext.
assign ttContext.propertyName = "applicationId"
       ttContext.propertyValue = "fin".
create ttContext.
assign ttContext.propertyName = "entity"
       ttContext.propertyValue = "1000".
create ttContext.
assign ttContext.propertyName = "userName"
       ttContext.propertyValue = "mfg".
create ttContext.
assign ttContext.propertyName = "password"
       ttContext.propertyValue = "".

/* Connect the AppServer */
create server vhServer.
vhServer:connect("-URL <appserver-url>").

if not vhServer:connected()
then do:
    message "Could not connect AppServer" view-as alert-box error title "Error".
    return.
end.

/* Run */
assign vhContextDS = dataset dsContext:handle.

run program/rpcrequestservice.p on vhServer
    (input-output dataset-handle vhContextDS by-reference,
           output dataset-handle vhExceptionDS,
     input        dataset-handle vhInputDS by-reference,
     input-output dataset-handle vhInputOutputDS by-reference,
           output dataset-handle vhOutputDS).

/* Handle output however you want, in this example, we dump it to xml */
if valid-handle(vhExceptionDS)
then vhExceptionDS:write-xml("file", "Exceptions.xml", true).

if valid-handle(vhOutputDS)
then vhOutputDS:write-xml("file", "Output.xml", true).

/* Cleanup */
vhServer:disconnect().
assign vhServer = ?.

if valid-handle(vhInputDS)
then delete object vhInputDS.

if valid-handle(vhOutputDS)
then delete object vhOutputDS.

if valid-handle(vhExceptionDS)
then delete object vhExceptionDS.