The cause of the problem: when filling out the reimbursement form, pop-up borrowing delinquencies, click on the borrowing number, the data source table of the pop-up window is saved in Tex_bill_content, but because the function of this table is not unique, in travel expenses or other places also used, so may cause data errors, It is therefore necessary to deal with the function of borrowing independently, consider using Tbill_loan_pay_temp to complete.
Precautions:
1, from the original tex_bill_content replaced Tbill_loan_pay_temp
2, need to modify the stored procedure P_checkloanpay, there are two to modify
2.1 Delete the original before each run
DELETE from Tbill_loan_pay_temp WHERE [email protected]_id
2.2 When the calculation is complete, write the result to this table
INSERT into Tbill_loan_pay_temp (Billlp_bill,billlp_seq,billlp_strike_user,billlp_curr_amount,billlp_amount) VALUES (@SRS_BILL_ID, 1, @USER_ID, @LOAN_AMOUNT1, @PAY_AMOUNT1)
3, need to fix the view Vex_loan_bill, note that billlp_curr_amount for the amount of borrowing, Billlp_amount for delinquencies amount
ALTER VIEW [dbo]. [Vex_loan_bill]
As
SELECT B.bill_id,b.bill_no,b.bill_remark,b.bill_submit_datetime
, EBC. Billlp_curr_amount as Loan_amount
, EBC. Billlp_amount as Pay_amount
, (EBC. Billlp_curr_amount-ebc. Billlp_amount) as Loan_no_pay_amount
, U.user_id,u.user_code,u.user_name from Tbill_loan_pay_temp EBC
INNER JOIN Tbill B on B.BILL_ID=EBC. Billlp_bill
INNER JOIN TUSER U on U.user_id=b.bill_user
4, need to correspond to modify the template borrowing delinquencies section of the field Billlp_srs_bill of the write-back company, mainly in the view of the corresponding borrowing amount, delinquencies Amount field name changed
Note on loan delinquencies business Change (as a result of data sheet changes)