Implement master-Slave block Amount Summary

Source: Internet
Author: User

1,the form uses app_calculate.running_total remit the total amount, the line has the code repetition verification.

situation One: When input multiple code repeated lines and save, error, clear a duplicate row and save (the amount of the first line is consistent), error "Code repeat", and then clear duplicate lines, the amount of the head does not decrease.
Case two: Failure to clear the button, when the input of multiple code repeats the row and save, error, delete a duplicate row and save (the same amount of the first line), error "Code repeat", and then delete duplicate lines (the amount of the first line is consistent), save, the head amount is added to the deleted line amount, error "code repeat"

Summary Header Line Amount code:
Header Summary item: Amount,amount_dis, amount_dis_rtot_db
Bast_amount, Base_amount_dis, base_amount_dis_rtot_db

Line item: Amount, Amount_dis, amount_dis_rtot_db, Amount_dis_rtot_old
Bast_amount, Base_amount_dis, base_amount_dis_rtot_db, Base_ amount_dis_rtot_old

Trigger:
From level:
Post-forms-commit:
Lines.running_total (' Post-forms-commit ');

LINES. Check_lines_date;

Pre-commit:
Lines.running_total (' Pre-commit ');

Update Cux_doc_ysjh_headers
Set amount= NVL (: Header.amount_dis,:header.amount),
Base_amount = NVL (: header.base_amount_dis,:header.base_amount)
where header_id=:header.header_id;

Head BLOCK:
Post-query:
SELECT NVL (SUM (AMOUNT), 0), SUM (BASE_amount)
Into:header. Amount_dis,:header. Base_amount_dis
From Cux_doc_ysjh_lines t
WHERE t.header_id =: header.header_id;

: HEADER. Amount_dis_rtot_db:=:header. Amount_dis;
: HEADER. Base_amount_dis_rtot_db:=:header. Base_amount_dis;


IF NVL (:P arameter. Cux_query_only, ' NO ') = ' YES ' Then
Set_block_property (' header ', query_allowed, property_false);
END IF;

Line BLOCK:
Key-delrec:
Lines.running_total (' Key-delrec ');
Delete_record;

Key-durrec:
Duplicate_record;
Lines.running_total (' Key-duprec ');
: Lines. Seq_no: =: lines. Seq_no + 1;

When-clear-block:
Lines.running_total (' When-clear-block ');

Post-query:
App_folder.event (' post-query ');
App_globe.event (' post-query ');
: Lines.amount_dis: =: lines.amount;
: lines.amount_dis_rtot_db: =: lines.amount;

: Lines.base_amount_dis: =: lines.base_amount;
: lines.base_amount_dis_rtot_db: =: lines.base_amount;

Lines.running_total (' post-query ');

Lines.control_dis (' post-query ');

Key-clrrec:
Lines.running_total (' Key-clrrec ');
App_folder.event (' Key-clrrec ');

Post-insert:
Lines.running_total (' Post-insert ');

Pre-record:
Lines.running_total (' Pre-record ');

Post-update:
Lines.running_total (' post-update ');


Pre-insert:
: lines.amount: =: Lines.amount_dis;
: lines.base_amount: =: Lines.base_amount_dis;
LINES. Check_lines_date;

Pre-update:
: lines.amount: =: Lines.amount_dis;
: lines.base_amount: =: Lines.base_amount_dis;
LINES. Check_lines_date;

Program Unit:
PROCEDURE running_total (Event VARCHAR2) is
BEGIN
App_calculate.running_total (event, ' Lines.amount_dis ', ' Header.amount_dis ');
App_calculate.running_total (event, ' Lines.base_amount_dis ', ' Header.base_amount_dis ');
END Running_total;


PROCEDURE Check_lines_date is
L_CNT number;
L_cnt_f number; --statistics on whether there is a corresponding invoice for <0
l_type_id VARCHAR2 (50);
BEGIN
SELECT COUNT (1)
Into l_cnt
From (SELECT cdl.type_id, COUNT (*) CNT
--into l_type_id, l_cnt
From Cux_doc_ysjh_lines CDL, Cux_doc_ysjh_headers CDH
WHERE cdh.header_id = cdl.header_id
and NVL (Cdl.attribute2, ' Y ') = ' N '--whether to allow new identities
and cdh.header_id =: header.header_id
GROUP by cdl.type_id
Having COUNT (*) >1);

IF l_cnt >= 1 Then
: HEADER. Status_desc: = ' new ';
: HEADER. STATUS: = ' incomplete ';

Fnd_message. CLEAR;
Fnd_message. Set_string (' Payment code does not allow duplicate line entry. ');
Fnd_message. ERROR;
RAISE form_trigger_failure;
END IF;

END check_lines_date;

2. Reference website:http://www.tuicool.com/articles/vI3URn

3. Related development form:cuxfgtinfo

Implement master-Slave block Amount Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.