Projects:Madv/Technical Documentation
Contents |
Artifact List
The development of this module involves the creation of the following items:
New module
A module must be created with the following parameters:
- Name: Mass Advanced Payments
- Version: 1.0.0.
- Java package: org.openbravo.massadvancedpayments
- Description: This module support mass advance payment creation for multiple business partners in one step based on an advanced payment template. It provides inter-company payments ability.
- Language: En_US
- License: Openbravo Public License
- License Text: The Openbravo Public License Version 1.1 ("OBPL") consists of the Mozilla Public License Version 1.1, modified to be specific to Openbravo, with the Additional Terms in Exhibit B. The original Mozilla Public License 1.1 can be found at: http://www.mozilla.org/MPL/MPL-1.1.html
- Author: Openbravo S.L.U.
In the dependency tab:
- Dependant on core
- Dependant on multiple business partner selector module
In the prefix tab: Prefix=MADV
In the datapackage tab: org.openbravo.massadvancedpayments
New Table - Columns - Elements
To maintain and store advanced payment templates a new table is created. This table must be created in the database and also registered in the application via Application Dictionary -> Tables and Columns.
- Table Name: madv_payment_template
- Fields:
- standard columns: madv_payment_template_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby
- name (required): the name of the payment template, is displayed to the user generating payments VARCHAR(32)
- description: is used to create the settlement and payment description VARCHAR(2000)
- isreceipt (required): Y or N - Check constraint for Y/N CHAR(1)
- paymentrule (required) - VARCHAR(60) - Linked to all_payment_rule reference list in AD.
- c_bank_account_id (not required)- VARCHAR(32) - a foreign key to c_bank_account
- status (required): a free format string to store the initial payment status VARCHAR(60) - Linked to all_payment_status reference list (?)
- create_matching_interco (required): Y or N - Check constraint for Y/N CHAR(1)
- Contraints
- MADV_unique_name -> client and name
- Above mentioned foreign keys
The necessary elements will be created by clicking on synchronize terminology button.
New Window - Tab - Fields
A window named Payment Template must be created for the previous table. A tab and the corresponding fields must be created. The field sequence can be seen in the image below:
New Process - Form
This development involves the creation of a manual process called: Advanced Payment Wizard. It is composed of:
- 3 html files - one for each manual window
- massAdvancedPayment_W1.html
- massAdvancedPayment_W2.html
- massAdvancedPayment_W3.html
- 3 xml files - one for each html
- massAdvancedPayment_W1.xml
- massAdvancedPayment_W2.xml
- massAdvancedPayment_W3.xml
- 1 html file for the confirmation pop-up
- massAdvancedPayment_P1.html
- 1 xml file for the above html
- massAdvancedPayment_P1.xml
- 3 java files
- MassAdvancedPayments.java - Created the payments - Calls Settlementpropertysetter.java
- Settlementpropertysetter.java - Computes the non-set properties of the settlement (payment?)
- IntercompanyPayment.java - For templates with inter-company checked the corresponding payment is created
The following tasks must be performed:
- Create the html and xml files - The design of the documents can be seen in the functional specifications
- Create the java files - See details below
- Register the form in the application dictionary (entries in ad_form). This will create entries in ad_model_object and ad_model_object _mapping.
- Compile the translations so new records are created in Ad_text_interfaces.
New Menu Entries
A new menu entry must be created for the above described...
- ...window, named Payment template, situated in: Financial Management > Receivables & Payables > Setup.
- ...process, named Mass Advanced Payment Wizard, situated in: Financial Management > Receivables & Payables > Transactions
New Messages
The following messages will be created in the table AD_Message.
Message | ||||
---|---|---|---|---|
Name | Message Type | Message Text | Explanation | Importance |
MADV_PROCESS_RESULT | Success | "The system has generated @number@ payment(s). Click on of the link(s) below for the payment details." | Must have | |
MADV_MIN_ONE_BP | Error | "At least one business partner must be selected" | Must have | |
MADV_WRONG_DATE_FORMAT | Error | "The invoice date has a wrong format, the expected format is this: @format@ | Must have | |
MADV_WRONG_FORMAT | Error | The value @value@ is in an invalid format. | Must have | |
MADV_unique_name | Error | There is already another template with the same name for this client. | Error for unique contraint | Must have |
MADV_ | Error | Must have | ||
MADV_ | Error | Must have |
Mass Advanced Payments Process
MassAdvancedPayments.java
Description: For each payment to be created, a settlement with two payments is created. The back statement has to be created manually (Direct Debit form of payment will automate this).
Extends: HttpSecureAppServlet
Validations:
In step 1:
- The business partners should belong to the accessible organizations for the selected organization in the window.
- If Template is inter-company -> (call IntercompanyPayment.validate())
- Bp is associated to an org
- Bp is associated to only one org
- The corresponding organization is accessible in the current role
- The corresponding organization has at least one bank account defined
Action: This servlet implements the following logic in DoPost function.
In default command -> Print Window 1()
In window2 command (step 1 to step 2) ->
- validateWindow1()
- If validation !OK -> throw error in window1
- If validation OK ->
- print window2()
- If template is inter-company -> Paint2ºtable()
- print window2()
In pop1 command (generate button pressed) ->
- print Window 3
In window3 command (step 2 to step 3)->
- validateWindow2()
- If validation !OK -> throw error in window step 2
- If validation OK ->
- For each proposed payments
- Create a settlement and 2 payments (call settlementPropertySetter)
- If there is no error -> post the settlements (call stored procedure c_settlement_post)
- If template is 'inter-company' -> Create matching payments (call IntercompanyPayments.createPayments())
- Display window 3
- If template is 'inter-company' - paint 2º table
- For each proposed payments
Results:
For each proposed payment:
- A settlement
- Two payments
See in the tables below the values this new records must have.
Settlement
A settlement is created with the following data. Some of this data is set in the SettlementPropertySetter. Any other nullable column not explicitly mentioned should be set to null.
Column | Attribute Name | Value |
---|---|---|
c_settlement_id | id | created by DAL |
AD_client_ID | client | retrieved from user |
AD_org_ID | organization | the organization selected in step 1 |
isactive | Active | Y |
created, createdby, updated, updatedby | current user, current date | |
documentno | will be computed | |
datetrx | current date | |
c_doctype_id | documenttype | the ID corresponding to document type "Debt/Payment Settlement" |
processing | N | |
processed | N | |
posted | N | |
c_campaign_id, c_project_id, c_activity_id | null | |
user1_id, user2_id | null | |
createfrom | null | |
c_currency_id | currency | set to the value specified in step 1 of the wizard |
description | set from the order template
| |
cancelednotchargedamt | 0 | |
generatedamt | 0 | |
chargedamt | 0 | |
createfile | N | |
settlementtype | C | |
copyfrom | N | |
isgenerated | N | |
istemplate | N |
Payments
Two payments will be created in the table c_debtpayment instead of the (view) c_debt_payment_generate, as DAL does not support insertion on views at the moment. The following data will be inserted:
Column | Attribute Name | Value |
---|---|---|
c_debt_payment_id | id | created by DAL |
AD_client_ID | client | retrieved from user |
AD_org_ID | organization | the organization selected in step 1 |
isactive | Active | Y |
created, createdby, updated, updatedby | current user, current date | |
c_settlement_id | id of the settlement | |
description | description | from template |
isreceipt | from template | |
c_invoice_id | null | |
c_bpartner_id | the business partner for which the payment is generated | |
c_currency_id | set to the value specified in step 1 of the wizard | |
c_cashline_id, c_bankstatementline_id | null | |
c_bank_account_id | set to the value specified in step 1 of the wizard; if no value is specified there, then set to the value specified in the payment template | |
c_cashbook_id | null | |
paymentrule | from the payment template | |
ispaid | N | |
amount | value specified in step 2 of the wizard | |
writeoffamt | 0 | |
dateplanned | the due date specified in step 1 of the wizard | |
ismanual | N | |
isvalid | Y | |
generate_processed | N | |
c_glitem_id | null | |
isdirectposting | N | |
status | from the payment template | |
c_project_id | null | |
c_withholding_id | null | |
withholdingamount | null |
Settlementpropertysetter.java
Description: Sets the properties of a settlement and payment
Methods:
- public void setSettlementProperties (Settlement settlement): sets several values to the settelment. See above table
- public void setPaymentProperties (Payment payment): sets several values to the payment. See above table
IntercompanyPayment.java
Description: Creates the corresponding payment in the organization of the business partner.
Triggered: When the advanced payment template has the field create matching inter-company payment checked.
Method createPayments
Input Settlement - Original settlement , matching will be created.
Action:
- A collection payment in organization A from organization B triggers a disbursement in organization B
- A disbursement payment in organization A to organization B triggers a collection in organization B.
Checks:
- The business partner is associated to an organization
- The business partner is only associated to one organization
- The organization is associated to a business partner
If any of this validations fails the corresponding error will be thrown. See message section. The error will be displayed in the wizards window and the process will stop till the validation does not fail.
Result:
The corresponding payment is created in table: c_debtpayment
Parameters:
- Standard columns = same as matching payment
- isreceipt = ! matching payment
- description = same
- ...
- c_currency....
massAdvancedPayment_W1.html
Description: Window correponding to Wizard Step 1
Interface: See image in Functional Specs.
Default values:
- Organization: User session
- Bank account: null
- Currency: Clients default.
Validations on drop downs
- Template: Only active
Reload
- If there is bank account selected -> currency of bank account.
Checks on client-side
- At least one business partner
- Payment date has correct format and is not null
- Amount has the correct format and is not null
If any validation fails a message is displayed in this window.
Actions on buttons
- Next button -> submitCommandForm(Window3, massAdvancedPayments.html
- Cancel button -> close window
massAdvancedPayment_W2.html
Description: Window corresponding to Wizard Step 2
Interface: See image in Functional Specs.
- Read only organization
- Read only Due date
- Table 1
- Inter-company table - Only rendered if template has 'inter-company' checked and it is not null.
Default
- All records checked
Check:
- Amount is not null and valid.
Actions on buttons
- On Next button -> "openServletNewWindow('POPUP1','massInvoicing.html'...)
- On Previous button -> "submitCommandForm('DEFAULT','massInvoicing.html'...)
massAdvancedPayment_P1.html
Description: Window corresponding to pop up window
Interface: See image in Functional Specs.
- Message
- Cancel button
- Ok button
Actions on buttons
- Cancel button -> close pop up
- Ok -> submitCommandForm('WINDOW3', 'massInvoicing.html', ...)
massAdvancedPayment_W3.html
Description: Window corresponding to Wizard Step 3
Interface: See image in Functional Specs.
- Successful message
- Table with payment information
- Table with intercompany paymnets - Only visible if not null
Bold text