Legacy platform

Implementation of generating a proposal

Sterling™ Field Sales provides the Generate Proposal related task to enable a user to generate a proposal for a quote.

Sometimes, a Field Sales Representative may want to print a proposal for a quote so that it can be sent to a customer. For example, a customer may request a Field Sales Representative to e-mail the quote so that the customer can view the prices of the items in the quote.

Solution

Sterling Field Sales provides the Generate Proposal related task to enable a user to generate a proposal for a quote. A user can print the proposal as a PDF by selecting the PDF format from the Choose a print format drop-down list, which is generated using the SAA_GeneratePrint service.

The getCompleteOrderDetails API is called to retrieve the details of the quote to be displayed in the Generate Proposal screen. The getTransformationData API is called to retrieve the values to be displayed in the Choose a formatting template drop-down list. The getCommonCodeList API is called to retrieve the values to be displayed in the Choose a print format drop-down list. The print formats are stored as common codes with code type SAA_QUOTE_PRNT_FRMT. Based on the print template selected, the locale specific formats configured for the selected template are displayed under the Choose a Locale drop-down list.

A user can select the attributes that should be printed in the proposal from the Include In Print panel. The attributes displayed under the Include In Print panel are defined in the XML format in Sterling Business Center, that is stored in the database and is retrieved when the getTransformationConfigList API is called.

Note: To view the attributes in the Include In Print panel in Sterling Field Sales, the name of the Print Template created in Sterling Business Center has to be PrintProposal.
Following is a sample metadata XML file:
<Resource>
<Group Name="ProposalHeader" DisplayName="Quote_Proposal_Header" Id="header">
		<Attribute Name="ProposalDate" DisplayName="Quote_Proposal_Date" Value="Y"/>
		<Attribute Name="Status" DisplayName="Quote_Proposal_Quote_Status" Value="Y"/>
		<Attribute Name="ExpirationDate" DisplayName="Quote_Proposal_Expiration_Date" Value="Y"/>
		<Attribute Name="ProposalTitle" DisplayName="Quote_Proposal_Title" Value="Y"/>
		<Attribute Name="ProposalID" DisplayName="Quote_Proposal_ID" Value="Y"/>
	</Group>			
	
	<Group Name="Address" DisplayName="Quote_Proposal_Address">
		<Attribute Name="BillTo" DisplayName="Quote_Proposal_Bill_Address" Value="Y"/>
		<Attribute Name="ShipTo" DisplayName="Quote_Proposal_Shipping_Address" Value="Y"/>
	</Group>
	
	<Group Name="OrderLines" DisplayName="Quote_Proposal_Lines">
		<Attribute Name="QuoteLines" DisplayName="Quote_Proposal_Quote_Lines" Value="Y"/>
		<Attribute Name="RecommendedLines" DisplayName="Quote_Proposal_Recommended_Lines" Value="Y"/>
	</Group>
	
	<Group Name="PricingInformation" DisplayName="Quote_Proposal_Quote_Totals">
		<Attribute Name="Additional" DisplayName="Quote_Proposal_Additional_Upfront_Charges" Value="Y"/>
		<Attribute Name="SubTotal" DisplayName="Quote_Proposal_Line_Sub_Total" Value="Y"/>
		<Attribute Name="Discounts" DisplayName="Quote_Proposal_Adjustments" Value="Y"/>
		<Attribute Name="ShippingCharges" DisplayName="Quote_Proposal_Shipping" Value="Y"/>
		<Attribute Name="Taxes" DisplayName="Quote_Proposal_Taxes" Value="Y"/>
		<Attribute Name="GrandTotal" DisplayName="Quote_Proposal_Total" Value="Y"/>				
	</Group>	
	
	<Group Name="Terms" DisplayName="Quote_Proposal_Terms">
		<Attribute Name="PaymentTerms" DisplayName="Quote_Proposal_Payment_Terms" Value="Y"/>
		<Attribute Name="ShippngTerms" DisplayName="Quote_Proposal_Carrier" Value="Y"/>
		<Attribute Name="LevelOfService" DisplayName="Quote_Proposal_Level_Service" Value="Y"/>
		<Attribute Name="DeliveryDate" DisplayName="Quote_Proposal_Devivery_Date" Value="Y"/>
		<Attribute Name="InstructionText" DisplayName="Quote_Proposal_Shipping_Instructions" Value="Y"/>
	</Group>	                                   
</Resource>
Note: The attribute value of the DisplayName is read from the server side bundle literals and is displayed in the UI. If a new attribute is added, the DisplayName attribute's value should be added to the server side bundle file.

The getOrganizationHierarchy API invokes the SAA_GeneratePrint service to get the address details of the organization. The getUserHierarchy API gets the name of the sales person to be displayed in the proposal.

When a user clicks Generate in the Generate Proposal screen, the SAA_GeneratePrint service is invoked to generate the proposal.

A sample implementation of the service that is used to generate a proposal is illustrated in the following figure:

Generate Quote Proposal Service figureBased on the selected template and locale, the processPrint API retrieves the configured format and along with the XML, generates the proposal in the selected format (PDF) using the Apache FOP (Formatting Objects Processor) component.

Implementation

This section explains the configurations for this functionality:

Sterling Field Sales ships a config file to the FOP component. By default, the config file shipped to the FOP component, searches for all the fonts installed on the system. The FOP component of the SAA_GeneratePrint service takes FOPConfigFile argument, which points to the location of the config file in the classpath.

You can customize the config file to add or remove the fonts based on the requirement . If the config file is customized, the FOPConfigFile argument should be changed to point to the customized config file. This config file is used by FOP processor to generate the PDF.

Note:
  • To generate the proposal in various languages, it is necessary that the required language fonts are installed on the system. Also, ensure that the font-family in the corresponding style sheet is changed appropriately to reflect these fonts.
  • Including all the system fonts may affect the performance of the FOP proposal generation. Hence it is recommended to customize the configuration file to include only the fonts which are required for the proposal generation.

For more information on the FOP configuration file and fonts configuration, refer to the Apache website.

Note:
  • To view the formatting templates in Sterling Field Sales, the name of the Print Template created in Sterling Business Center has to be PrintProposal.
  • You can configure the print template to generate a proposal.
  • You can configure the print format to be used to generate a proposal.

Install the FOP JAR files

To install the FOP JAR files, perform the following steps:
  1. Copy the following third-party JAR files to the extensions.jar:
    • avalon-framework-4.2.0.jar
    • fop.jar
    • xmlgraphics-commons-1.4.jar
  2. Import the latest version of the JAR file through the OMS-CUSTOM-OMS component.
  3. Run the Build Customized Runtime process in UCD by including the customized JAR file.
  4. Update Sterling Order Management System.