View source | View content page | Page history | Printable version   

Projects:Business Partner Settlements/Technical Specification

Contents

Introduction

In this document is described in detail all the developments that need to be delivered to fulfill the Business Partner Settlement project.

The document is structured in the different main processes that are included in the project.

The code of the module is available in: https://code.openbravo.com/erp/pmods/org.openbravo.financial.bpsettlement

Module Definition

Module Name
Business Partner Settlements
Description
This module provides the ability to settle Available Credit or Pending Payments of a Business Partner that is both Customer and Provider.
License
OBPL
DB Prefix
OBFBPS
javapackage
org.openbravo.financial.bpsettlement
Translation Required
Yes
Dependant Modules
Openbravo 3.0 Framework PR14Q3.1 (2.1.24019)
datapackage
org.openbravo.financial.bpsettlement

BP Settlement window

Header Tab

Table Definition:


Fields and Columns
Name Column Name Mandatory SeqNo Reference Show in Grid (seq) Default Definition
Organization AD_Org_ID Yes 10 Table Dir only allow transactional Orgs Yes (10)
Settlement Type BP_Settlement_Type Yes 20 List new BP_Settlement Type:
  • Credit (CR), Invoice (INV)
Yes (20) Stored In session: Yes

Do not allow to change when there are lines. Using an Event Handler

Settlement Date SettlementDate Yes 30 Date Yes (30) SYSDATE / now()
Business Partner C_BPartner_ID Yes 40 Selector new Customer/Vendor Business Partner:
  • HQL Filter by customer = 'Y' and vendor = 'Y'
  • Grid fields: Name, Search Key, Category
Yes (40) Do not allow to change when there are lines. Using an Event Handler
GL Item C_GLItem_ID Yes 50 GL Item Selector Yes (50)
Settlement Payment In FIN_Payment_In_ID No 60 Payment selector Yes (60) Read Only Yes
Settlement Payment Out FIN_Payment_Out_ID No 70 Payment selector Yes (70) Read Only Yes
Description Description No 80 Text. Length: 2000 No
Status BP_Settlement_Status Yes 1010 List new BP Settlement Status:
  • Values: Draft (DR), Processed (CO), Canceled (VO)
Yes (80) DR Show In Status Bar Yes

Stored In Session: Yes

Incoming Amount Incoming_Amt

(Defined in the ad_column, but not physically in the DB)

No 1020 Computed field: Sum of incoming amounts (Credit In and Sales Invoice) Yes (90) Show In Status Bar: Yes
Outgoing Amount Outgoing_Amt

(Defined in the ad_column, but not physically in the DB)

No 1030 Computed field: Sum of outgoing amounts (Credit Out and Purchase Invoice) Yes (100) Show In Status Bar: Yes
Add Credit Payments Add_Credit_Payments_Process

(AD_Column.Name: Add Credit Payments Process)

No 2010 Button (Char 1) No Y Display Logic: type credit and status Draft
Add Not Paid Invoices Add_Invoices_Process

(AD_Column.Name: Add Invoices Process)

No 2020 Button (Char 1) No Y Display Logic: type invoice and status Draft
Process Settlement Process_Settlement No 2030 Button (Char 60) new BP Settlement Action List:
  • Values: CO Process, VO Cancel, RE Reactivate
No CO


OBFBPS_Settlement_trg trigger

Trigger to avoid modifying any field when the Settlement is in status Processed or Canceled.

When the status is changing from CO to any other it should allow to set FIN_Payment_In_ID and FIN_Payment_Out_ID to null.

Credit In Tab

Table Definition:


Fields and Columns
Name Column Name Mandatory SeqNo Reference Show in Grid (seq) Default Definition
Credit Payment FIN_Payment_ID Yes 10 Payment Selector Yes (10)
Settlement Amount Settlement_Amt Yes 20 Amount Yes (20)
Is Sales Transaction IsSOTrx Yes Yes/No No @IsSoTrxTab@ (Auxiliary Input value) Hidden Field

OBFBPS_Credit_Payment trigger

Trigger to avoid modifying any field when the Settlement is in status Processed or Canceled.

When the status is changing from CO to any other it should allow to set FIN_Payment_In_ID and FIN_Payment_Out_ID to null.

Credit Out Tab

Same as Credit In with these differences:

Sales Invoice Tab

Table Definition:


Fields and Columns
Name Column Name Mandatory SeqNo Reference Show in Grid (seq) Default Definition
Invoice C_Invoice_ID Yes 10 Invoice Selector Yes (10)
Settlement Amount Settlement_Amt Yes 20 Amount Yes (20)
Is Sales Transaction IsSOTrx Yes Yes/No No @IsSOTrxTab@ (Auxiliary Input value) Hidden Field

OBFBPS_Invoice_Trg trigger

Trigger to avoid modifying any field when the Settlement is in status Processed or Canceled.

Purchase Invoice Tab

Same as Sales Invoice with these differences:

Add Credit Payments Pick and Execute

Add Pending Invoices Pick and Execute

Process/Cancel/Reopen Report and Process

Report and Process to manage bp settlements.


BPSettlementProcess java class

Extends org.openbravo.service.db.DalBaseProcess.

Validations:

Process CO action

This action does an extra validation:

Invoice type

Create and process a Payment In with all the sales Payment Schedule Details included in the OBFBPS_Invoice table for the settlement. Create a similar Payment Out with the purchase Payment Schedule Details.

Add a Payment Detail on each payment using the GL Item defined in the settlement so the total amount of each payment is Zero.

Set the generated payment ids on FIN_Payment_In_ID and FIN_Payment_Out_ID columns.

Set the BP_Settlement_Status to CO and the Process_Settlement to VO

To build the Payments based on the selected Payment Schedule details use the following public method:

org.openbravo.advpaymentmngt.process.FIN_AddPayment.savePayment(FIN_Payment _payment, boolean isReceipt,
  DocumentType docType, String strPaymentDocumentNo, BusinessPartner businessPartner, FIN_PaymentMethod
  paymentMethod, FIN_FinancialAccount finAccount, String strPaymentAmount, Date paymentDate, Organization
  organization, String referenceNo, List<FIN_PaymentScheduleDetail> selectedPaymentScheduleDetails,
  HashMap<String, BigDecimal> selectedPaymentScheduleDetailsAmounts, boolean isWriteoff, boolean isRefund,
  Currency paymentCurrency, BigDecimal finTxnConvertRate, BigDecimal finTxnAmount)

To add the GL Item payment details use the following public method:

org.openbravo.advpaymentmngt.process.FIN_AddPayment.saveGLItem(FIN_Payment payment, BigDecimal glitemAmount,
  GLItem glitem)


To process the payment use the following public method (strAction: P):

org.openbravo.advpaymentmngt.process.FIN_AddPayment.processPayment(VariablesSecureApp vars,
  ConnectionProvider conn, String strAction, FIN_Payment payment)

Credit type

Create and process a Payment In with all the sales credit payments included in the OBFBPS_Credit_Payment table. A similar Payment Out is created with the purchase credit payments.

For each selected credit payment update its description with the new payment document number and increment the Used Credit amount by the settled amount. Link the credit payment to the new payment.

Add a Payment Detail on each payment using the GL Item defined in the settlement so the total amount of each payment is Zero.

See an example on how to add the selected credit payments to the new payments on the following method:

org.openbravo.advpaymentmngt.actionHandler.AddPaymentActionHandler.addCredit(FIN_Payment payment,
  JSONObject jsonparams)

Note that to link the credit payments with the new payment it is used the public method:

org.openbravo.advpaymentmngt.process.FIN_PaymentProcess.linkCreditPayment(FIN_Payment newPayment, 
  BigDecimal usedAmount, FIN_Payment creditPayment)

Cancel VO action

It cancels the Payments generated on this settlement and stored in FIN_Payment_In_ID and FIN_Payment_Out_ID columns.

To cancel the payment use the following public method (strAction: V):

org.openbravo.advpaymentmngt.process.FIN_AddPayment.processPayment(VariablesSecureApp vars,
  ConnectionProvider conn, String strAction, FIN_Payment payment)

Sets the BP_Settlement_Status to VO and the Process_Settlement to VO

Reactivate RE action

As in Cancel action cancels the payment generated on the settlement.

Sets the BP_Settlement_Status to DR and the Process_Settlement to CO

Sets to null the FIN_Payment_In_ID and FIN_Payment_Out_ID columns.

Retrieved from "http://wiki.openbravo.com/wiki/Projects:Business_Partner_Settlements/Technical_Specification"

This page has been accessed 2,632 times. This page was last modified on 9 March 2015, at 11:00. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.