Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 109.94 KB | None | 0 0
  1.  
  2. DROP TABLE payment_order_tbl;
  3. DROP TABLE balance_tbl;
  4. DROP TABLE expenses_tbl;
  5. DROP TABLE bank_tbl;
  6. DROP TABLE loan_tbl;
  7. DROP TABLE pn_tbl;
  8. DROP TABLE registry_of_deeds_tbl;
  9. DROP TABLE collateral_tbl;
  10. DROP TABLE end_user_borrower_tbl;
  11. DROP TABLE role_tbl;
  12. DROP TABLE user_tbl;
  13. DROP TABLE chart_of_accts_tbl;
  14. DROP TABLE rediscounting_interest_rates_tbl;
  15. DROP TABLE transaction_tbl;
  16. DROP TABLE payment_tbl;
  17. DROP TABLE payable_tbl;
  18. DROP TABLE sap_tbl;
  19. DROP TABLE foreclosure_tbl;
  20. DROP TABLE foreclosure_status_tbl;
  21. DROP TABLE approval_status_tbl;
  22. DROP TABLE lawyer_contact_tbl;
  23. DROP TABLE lawyer_tbl;
  24. DROP TABLE petition_tbl;
  25. DROP TABLE winning_bidder_tbl;
  26. DROP TABLE bidder_details_tbl;
  27. DROP TABLE auction_tbl;
  28. DROP TABLE bid_tbl;
  29. DROP TABLE bid_remarks_tbl;
  30. DROP TABLE payment_pending_tbl;
  31. DROP TABLE transaction_remarks_tbl;
  32. DROP TABLE remarks_tbl;
  33. DROP TABLE collateral_documents_tbl;
  34. DROP TABLE demand_letter;
  35. DROP TABLE pre_foreclosure;
  36. DROP TABLE batch_tbl;
  37. DROP TABLE pn_collateral;
  38. DROP TABLE expense_tbl;
  39. DROP TABLE appraisal_report;
  40. DROP TABLE dacion_tbl;
  41. DROP TABLE dacion_transaction_tbl;
  42. DROP TABLE tax_declaration_tbl;
  43. DROP TABLE insurance_details_tbl;
  44. DROP TABLE rem_tbl;
  45. DROP TABLE rem_dacion_tbl;
  46. DROP SEQUENCE DACION_TRANSACTION_SEQ;
  47.  
  48. CREATE TABLE lawyer_tbl(
  49. lawyer_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  50. lawyer_name VARCHAR(100) NOT NULL,
  51. lawyer_address VARCHAR(200),
  52. vat_registered INT, -- true/false 0/1
  53. remarks VARCHAR(100),
  54. PRIMARY KEY (lawyer_id)
  55. );
  56.  
  57. CREATE TABLE balance_tbl(
  58. balance_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  59. ref_id INT,
  60. balance_type VARCHAR(5),
  61. others DECIMAL(20,2) WITH DEFAULT 0,
  62. accrued_interest_receivable DECIMAL(20,2) WITH DEFAULT 0,
  63. liquidated_damages DECIMAL(20,2) WITH DEFAULT 0,
  64. interest_income DECIMAL(20,2) WITH DEFAULT 0,
  65. outstanding_principal DECIMAL(20,2) WITH DEFAULT 0,
  66. total_outstanding_balance DECIMAL(20,2) WITH DEFAULT 0,
  67. cwt DECIMAL(20,2) WITH DEFAULT 0,
  68. miscellaneous_income_others DECIMAL(20,2) WITH DEFAULT 0,
  69. miscellaneous_income_liquidating_dividends DECIMAL(20,2) WITH DEFAULT 0,
  70. delete_flag INT WITH DEFAULT 0,
  71. created_date TIMESTAMP WITH DEFAULT,
  72. PRIMARY KEY(balance_id)
  73. );
  74.  
  75. CREATE TABLE expenses_tbl(
  76. expense_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  77. ref_id INT,
  78. expense_type VARCHAR(25), -- PN, LOAN OR BANK
  79. miscellaneous_assets DECIMAL(20,2) WITH DEFAULT 0, -- MA from Foreclosure Expenses
  80. accounts_payable DECIMAL(20,2) WITH DEFAULT 0, -- AP from Foreclosure Expenses
  81. total_actual_foreclosure_expenses DECIMAL(20,2) WITH DEFAULT 0,
  82. delete_flag INT WITH DEFAULT 0,
  83. created_date TIMESTAMP WITH DEFAULT,
  84. PRIMARY KEY(expense_id)
  85. );
  86.  
  87. CREATE TABLE bank_tbl(
  88. bank_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  89. bank_code VARCHAR(50),
  90. banK_entity VARCHAR(50),
  91. bank_name VARCHAR(100),
  92. bank_type VARCHAR(50),
  93. bank_status VARCHAR(50),
  94. date_joined DATE,
  95. bank_address VARCHAR(150),
  96. date_close DATE,
  97. ref_balance_id INT,
  98. cwt_flag INT WITH DEFAULT 0,
  99. delete_flag INT WITH DEFAULT 0,
  100. PRIMARY KEY(bank_id),
  101. FOREIGN KEY(ref_balance_id) REFERENCES balance_tbl(balance_id)
  102. );
  103.  
  104. CREATE TABLE loan_tbl(
  105. loan_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  106. loan_application_number INT,
  107. ref_bank_id INT,
  108. loan_type VARCHAR(50),
  109. loan_status VARCHAR(50),
  110. loan_interest_rate DECIMAL(9,6) WITH DEFAULT 0,
  111. liquidated_damages_rate DECIMAL(6,6) WITH DEFAULT 0,
  112. date_granted DATE,
  113. maturity_date DATE,
  114. loan_term INT,
  115. amount_granted DECIMAL(20,2) WITH DEFAULT 0,
  116. reprice_rate_flag INT WITH DEFAULT 0,
  117. delete_flag INT WITH DEFAULT 0,
  118. ref_balance_id INT,
  119. PRIMARY KEY(loan_id),
  120. FOREIGN KEY(ref_bank_id) REFERENCES bank_tbl(bank_id),
  121. FOREIGN KEY(ref_balance_id) REFERENCES balance_tbl(balance_id)
  122. );
  123.  
  124. CREATE TABLE end_user_borrower_tbl(
  125. borrower_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  126. entity_name VARCHAR(50),
  127. full_name VARCHAR(100),
  128. date_of_birth DATE,
  129. ref_pn_id INT,
  130. address VARCHAR(200),
  131. tin VARCHAR(50),
  132. PRIMARY KEY(borrower_id)
  133. );
  134.  
  135. CREATE TABLE pn_tbl(
  136. pn_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  137. pn_number VARCHAR(50),
  138. ref_loan_id INT,
  139. pn_status VARCHAR(50),
  140. pn_interest_rate DECIMAL(9,6) WITH DEFAULT 0,
  141. penalty_rate DECIMAL(9,6) WITH DEFAULT 0,
  142. date_granted DATE,
  143. maturity_date DATE,
  144. amount_granted DECIMAL(20,2) WITH DEFAULT 0,
  145. delete_flag INT WITH DEFAULT 0,
  146. ref_balance_id INT,
  147. ref_borrower_id INT,
  148. ref_expense_id INT,
  149. ref_lawyer_id INT,
  150. ref_bank_id INT,
  151. rem_amount DECIMAL(20,2) WITH DEFAULT 0,
  152. tax_receipt VARCHAR(50),
  153. PRIMARY KEY(pn_id),
  154. FOREIGN KEY(ref_loan_id) REFERENCES loan_tbl(loan_id),
  155. FOREIGN KEY(ref_balance_id) REFERENCES balance_tbl(balance_id),
  156. FOREIGN KEY(ref_borrower_id) REFERENCES end_user_borrower_tbl(borrower_id),
  157. FOREIGN KEY(ref_lawyer_id) REFERENCES lawyer_tbl(lawyer_id),
  158. FOREIGN KEY(ref_bank_id) REFERENCES bank_tbl(bank_id),
  159. FOREIGN KEY(ref_expense_id) REFERENCES expenses_tbl(expense_id)
  160. );
  161.  
  162. CREATE TABLE registry_of_deeds_tbl(
  163. rd_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  164. registry_of_deeds VARCHAR(100),
  165. PRIMARY KEY(rd_id)
  166. );
  167.  
  168.  
  169. CREATE TABLE rem_tbl(
  170. rem_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  171. rem_name VARCHAR(50),
  172. rem_amount DECIMAL(20,2) WITH DEFAULT 0,
  173. PRIMARY KEY(rem_id)
  174. );
  175.  
  176. CREATE TABLE collateral_tbl(
  177. collateral_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  178. collateral_number VARCHAR(50),
  179. collateral_status VARCHAR(50),
  180. collateral_value DECIMAL(20,2) WITH DEFAULT 0,
  181. collateral_type VARCHAR(50),
  182. collateral_classification VARCHAR(50),
  183. appraisal_date DATE,
  184. fmv DECIMAL(20,2) WITH DEFAULT 0,
  185. entry_date DATE,
  186. ref_rd_id INT,
  187. address VARCHAR(150),
  188. rem_amount DECIMAL(20,2) WITH DEFAULT 0,
  189. registered_owner VARCHAR(150),
  190. area INT,
  191. unit_measurement VARCHAR(50),
  192. ref_rem_id INT,
  193. PRIMARY KEY(collateral_id),
  194. FOREIGN KEY(ref_rd_id) REFERENCES registry_of_deeds_tbl(rd_id),
  195. FOREIGN KEY(ref_rem_id) REFERENCES rem_tbl(rem_id)
  196.  
  197. );
  198.  
  199. CREATE TABLE dacion_transaction_tbl(
  200. transaction_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  201. transaction_number VARCHAR(50) UNIQUE NOT NULL,
  202. dts_number VARCHAR(50),
  203. transaction_date TIMESTAMP WITH DEFAULT,
  204. active_flag INT WITH DEFAULT 1,
  205. PRIMARY KEY(transaction_id)
  206. );
  207.  
  208. CREATE TABLE dacion_tbl(
  209. dacion_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  210. dacion_type VARCHAR(50),
  211. udoa_number VARCHAR(50),
  212. dacion_value DECIMAL(20,2) WITH DEFAULT 0,
  213. ref_pn_id INT,
  214. ref_loan_id INT,
  215. ref_balance_id INT,
  216. ref_borrower_id INT,
  217. ref_bank_id INT,
  218. ref_collateral_id INT,
  219. ref_dacion_transaction_id INT,
  220. delete_flag INT WITH DEFAULT 0,
  221. PRIMARY KEY(dacion_id),
  222. FOREIGN KEY(ref_pn_id) REFERENCES pn_tbl(pn_id),
  223. FOREIGN KEY(ref_loan_id) REFERENCES loan_tbl(loan_id),
  224. FOREIGN KEY(ref_balance_id) REFERENCES balance_tbl(balance_id),
  225. FOREIGN KEY(ref_borrower_id) REFERENCES end_user_borrower_tbl(borrower_id),
  226. FOREIGN KEY(ref_bank_id) REFERENCES bank_tbl(bank_id),
  227. FOREIGN KEY(ref_collateral_id) REFERENCES collateral_tbl(collateral_id),
  228. FOREIGN KEY(ref_dacion_transaction_id) REFERENCES dacion_transaction_tbl(transaction_id)
  229. );
  230.  
  231.  
  232.  
  233. CREATE TABLE rem_dacion_tbl(
  234. rem_dacion_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  235. ref_rem_id INT,
  236. ref_dacion_id INT,
  237. PRIMARY KEY(rem_dacion_id),
  238. FOREIGN KEY(ref_rem_id) REFERENCES rem_tbl(rem_id),
  239. FOREIGN KEY(ref_dacion_id) REFERENCES dacion_tbl(dacion_id)
  240. );
  241.  
  242.  
  243.  
  244. CREATE TABLE role_tbl(
  245. role_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  246. role VARCHAR(50),
  247. PRIMARY KEY(role_id)
  248. );
  249.  
  250. CREATE TABLE user_tbl (
  251. user_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  252. user_name VARCHAR(50) UNIQUE NOT NULL,
  253. user_role_id INT,
  254. PRIMARY KEY (user_id),
  255. FOREIGN KEY (user_role_id) REFERENCES role_tbl(role_id)
  256. );
  257.  
  258. CREATE TABLE chart_of_accts_tbl(
  259. chart_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  260. chart_account_ref_code VARCHAR(200),
  261. chart_account_description VARCHAR(200),
  262. chart_account_title VARCHAR(200) UNIQUE NOT NULL,
  263. chart_account_code VARCHAR(100) UNIQUE NOT NULL,
  264. chart_default_entry_type VARCHAR(200),
  265. chart_document_source VARCHAR(200),
  266. PRIMARY KEY (chart_id)
  267. );
  268.  
  269. CREATE TABLE payment_order_tbl (
  270. payment_order_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  271. payment_order_number VARCHAR(50) UNIQUE NOT NULL,
  272. payment_order_date DATE,
  273. payment_order_type VARCHAR(50),
  274. payment_date DATE,
  275. payment_order_status VARCHAR(50),
  276. payment_level VARCHAR(10),
  277. bank_payment_level INT,
  278. payment_type VARCHAR(50),
  279. end_user_borrower VARCHAR(50),
  280. bank_name VARCHAR(50),
  281. loan_number INT,
  282. loan_type VARCHAR(50),
  283. pn_number VARCHAR(50),
  284. amount DECIMAL(20,2) WITH DEFAULT 0,
  285. or_number VARCHAR(50),
  286. or_date DATE,
  287. receiving_office VARCHAR(50),
  288. particulars VARCHAR(300),
  289. dts_number VARCHAR(30),
  290. payor VARCHAR(100),
  291. total_cash_amount DECIMAL(20,2) WITH DEFAULT 0,
  292. total_check_amount DECIMAL(20,2) WITH DEFAULT 0,
  293. total_pmo_amount DECIMAL(20,2) WITH DEFAULT 0,
  294. total_amount DECIMAL(20,2) WITH DEFAULT 0,
  295. total_payment_amount DECIMAL(20,2) WITH DEFAULT 0,
  296. payee VARCHAR(50),
  297. drawee_bank VARCHAR(50),
  298. check_number INT,
  299. check_date DATE,
  300. postal_office VARCHAR(100),
  301. pmo_amount DECIMAL(20,2) WITH DEFAULT 0,
  302. pmo_date DATE,
  303. pmo_number INT,
  304. maker VARCHAR(50),
  305. chart_account_title VARCHAR(200),
  306. chart_account_code VARCHAR(100),
  307. last_updated_date TIMESTAMP,
  308. user_name VARCHAR(50),
  309. ref_user_id INT,
  310. delete_flag INT WITH DEFAULT 0,
  311. year_created INT,
  312. bank_level_payment_type VARCHAR(50),
  313. currency VARCHAR(50),
  314. approved_by VARCHAR(50),
  315. approved_date DATE,
  316. PRIMARY KEY(payment_order_id),
  317. FOREIGN KEY(user_name) REFERENCES user_tbl(user_name),
  318. FOREIGN KEY(chart_account_title) REFERENCES chart_of_accts_tbl(chart_account_title),
  319. FOREIGN KEY(chart_account_code) REFERENCES chart_of_accts_tbl(chart_account_code)
  320. );
  321.  
  322. CREATE TABLE transaction_tbl(
  323. transaction_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  324. sap_number VARCHAR(50),
  325. transaction_date DATE,
  326. payment_date DATE,
  327. payment_order_number VARCHAR(50),
  328. payment_number VARCHAR(50),
  329. name_of_bank VARCHAR(100),
  330. term INT,
  331. application_number INT,
  332. oustanding_balance DECIMAL(20,2) WITH DEFAULT 0,
  333. rediscounting_rate DECIMAL(9,6) WITH DEFAULT 0,
  334. liquidated_damage_rate DECIMAL(9,6) WITH DEFAULT 0,
  335. date_granted DATE,
  336. date_due DATE,
  337. principal DECIMAL(20,2) WITH DEFAULT 0,
  338. status VARCHAR(100),
  339. interest_date DATE,
  340. accrual_date DATE,
  341. accrued_interest DECIMAL(20,2) WITH DEFAULT 0,
  342. unpaid_accrued_interest DECIMAL(20,2) WITH DEFAULT 0,
  343. accrued_interest_receivable_days INT,
  344. interest_days INT,
  345. liquidated_damage_days INT,
  346. interest_income DECIMAL(20,2) WITH DEFAULT 0,
  347. unpaid_interest_income DECIMAL(20,2) WITH DEFAULT 0,
  348. borrower_name VARCHAR(100),
  349. pn_number VARCHAR(100),
  350. liquidated_damages DECIMAL(20,2) WITH DEFAULT 0,
  351. unpaid_liquidated_damages DECIMAL(20,2) WITH DEFAULT 0,
  352. last_payment_date DATE,
  353. expenses DECIMAL(20,2) WITH DEFAULT 0,
  354. cwt DECIMAL(20,2) WITH DEFAULT 0,
  355. total_payment DECIMAL(20,2) WITH DEFAULT 0,
  356. delete_flag INT WITH DEFAULT 0,
  357. year_created INT NOT NULL,
  358. transaction_type VARCHAR(50),
  359. PRIMARY KEY(transaction_id),
  360. FOREIGN KEY(payment_order_number) REFERENCES payment_order_tbl(payment_order_number)
  361. );
  362.  
  363. CREATE TABLE rediscounting_interest_rates_tbl (
  364. red_interest_rates_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  365. effectivity_date DATE,
  366. effectivity_date_until DATE,
  367. red_interest_rate DECIMAL(9,6) WITH DEFAULT 0,
  368. window_type VARCHAR(50),
  369. rediscounting_type VARCHAR(50),
  370. loan_term INT,
  371. date_created DATE,
  372. created_by INT,
  373. date_updated DATE,
  374. updated_by INT,
  375. date_approved DATE,
  376. approved_by INT,
  377. record_status VARCHAR(50),
  378. delete_flag INT WITH DEFAULT 0,
  379. PRIMARY KEY (red_interest_rates_id),
  380. FOREIGN KEY(created_by) REFERENCES user_tbl(user_id),
  381. FOREIGN KEY(updated_by) REFERENCES user_tbl(user_id),
  382. FOREIGN KEY(approved_by) REFERENCES user_tbl(user_id)
  383. );
  384.  
  385. CREATE TABLE payment_tbl(
  386. payment_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  387. payment_type VARCHAR(50),
  388. check_number VARCHAR(50),
  389. check_date DATE,
  390. drawee_bank VARCHAR(100),
  391. pmo_number VARCHAR(50),
  392. pmo_date DATE,
  393. payment_amount DECIMAL(20,2) WITH DEFAULT 0,
  394. issuing_office VARCHAR(100),
  395. delete_flag INT WITH DEFAULT 0,
  396. ref_payment_order_id INT,
  397. FOREIGN KEY(ref_payment_order_id) REFERENCES payment_order_tbl(payment_order_id)
  398. );
  399.  
  400. CREATE TABLE payable_tbl(
  401. payable_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  402. ref_payment_order_id INT,
  403. promissory_note_number VARCHAR(50),
  404. loan_application_number VARCHAR(50),
  405. collateral_number VARCHAR(50),
  406. borrower_id INT,
  407. borrower_name VARCHAR(50),
  408. amount_granted DECIMAL(20,2) WITH DEFAULT 0,
  409. pn_outstanding_balance DECIMAL(20,2) WITH DEFAULT 0,
  410. outstanding_principal_balance DECIMAL(20,2) WITH DEFAULT 0,
  411. total_outstanding_balance DECIMAL(20,2) WITH DEFAULT 0,
  412. other_expenses DECIMAL(20,2) WITH DEFAULT 0,
  413. payment_amount DECIMAL(20,2) WITH DEFAULT 0,
  414. excess_amount DECIMAL(20,2) WITH DEFAULT 0,
  415. excess_payment_type VARCHAR(50),
  416. FOREIGN KEY(ref_payment_order_id) REFERENCES payment_order_tbl(payment_order_id)
  417. );
  418.  
  419. CREATE TABLE sap_tbl(
  420. sap_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  421. sap_number VARCHAR(50),
  422. payment_order_number VARCHAR(100),
  423. payment_date DATE,
  424. pn_number VARCHAR(50),
  425. rediscounting_rate DECIMAL(9,6) WITH DEFAULT 0,
  426. ld_rate DECIMAL(9,6) WITH DEFAULT 0,
  427. interest_date DATE,
  428. accrual_date DATE,
  429. principal_payment DECIMAL(20,2) WITH DEFAULT 0,
  430. accrued_interest_days INT,
  431. accrued_interest_payment DECIMAL(20,2) WITH DEFAULT 0,
  432. unpaid_accrued_interest DECIMAL(20,2) WITH DEFAULT 0,
  433. accrued_interest_payment_date DATE,
  434. interest_income_days INT,
  435. interest_income_payment DECIMAL(20,2) WITH DEFAULT 0,
  436. unpaid_interest_income DECIMAL(20,2) WITH DEFAULT 0,
  437. interest_income_payment_date DATE,
  438. liquidated_damages_days INT,
  439. liquidated_damages_payment DECIMAL(20,2) WITH DEFAULT 0,
  440. unpaid_liquidated_damages DECIMAL(20,2) WITH DEFAULT 0,
  441. liquidated_damages_payment_date DATE,
  442. expenses_payment DECIMAL(20,2) WITH DEFAULT 0,
  443. total_payment DECIMAL(20,2) WITH DEFAULT 0,
  444. last_payment_date DATE,
  445. ref_pn_id INT,
  446. delete_flag INT WITH DEFAULT 0,
  447. PRIMARY KEY (sap_id),
  448. FOREIGN KEY (ref_pn_id) REFERENCES pn_tbl(pn_id)
  449. );
  450.  
  451. CREATE TABLE payment_pending_tbl(
  452. payment_pending_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  453. payment_order_number VARCHAR(50),
  454. pn_number varchar(50),
  455. payment_rule_type VARCHAR(50),
  456. total_payment DECIMAL(20,2) WITH DEFAULT 0,
  457. others_payment DECIMAL(20,2) WITH DEFAULT 0,
  458. liquidated_damages_payment DECIMAL(20,2) WITH DEFAULT 0,
  459. accrued_interest_payment DECIMAL(20,2) WITH DEFAULT 0,
  460. interest_income_payment DECIMAL(20,2) WITH DEFAULT 0,
  461. principal_payment DECIMAL(20,2) WITH DEFAULT 0,
  462. unpaid_liquidated_damages DECIMAL(20,2) WITH DEFAULT 0,
  463. unpaid_accrued_interest DECIMAL(20,2) WITH DEFAULT 0,
  464. unpaid_interest_income DECIMAL(20,2) WITH DEFAULT 0,
  465. miscellaneous_income DECIMAL(20,2) WITH DEFAULT 0,
  466. payment_date DATE
  467.  
  468. );
  469.  
  470. CREATE TABLE lawyer_contact_tbl(
  471. contact_type VARCHAR(20) NOT NULL, -- EMAIL, FAX, PHONE etc.
  472. contact VARCHAR(50) NOT NULL, -- Actual contact value 000-000-000
  473. ref_lawyer_id INT NOT NULL, -- lawyer id
  474. FOREIGN KEY (ref_lawyer_id) REFERENCES lawyer_tbl(lawyer_id)
  475. );
  476.  
  477. CREATE TABLE foreclosure_status_tbl(
  478. status_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  479. status_name VARCHAR(100),
  480. status_description VARCHAR(100),
  481. PRIMARY KEY (status_id)
  482. );
  483.  
  484. CREATE TABLE approval_status_tbl (
  485. approval_status_id INT UNIQUE NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  486. approval_status VARCHAR(50)
  487. );
  488.  
  489. CREATE TABLE foreclosure_tbl(
  490. foreclosure_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  491. transaction_date DATE,
  492. foreclosure_ref_number VARCHAR(50) UNIQUE NOT NULL,
  493. registered_owner VARCHAR(50),
  494. ref_foreclosure_status_id INT,
  495. ref_approval_status_id INT,
  496. ref_lawyer_id INT,
  497. ref_original_lawyer_id INT,
  498. dts_number VARCHAR(50),
  499. status_filter VARCHAR(50),
  500. remarks VARCHAR(150),
  501. delete_flag INT WITH DEFAULT 0,
  502. last_updated_by VARCHAR(50),
  503. last_updated_date DATE,
  504. date_booked_to_ip DATE,
  505. publication_name VARCHAR(150),
  506. volume VARCHAR(50),
  507. issue_numbers VARCHAR(50),
  508. FOREIGN KEY (ref_lawyer_id) REFERENCES lawyer_tbl(lawyer_id),
  509. FOREIGN KEY (ref_original_lawyer_id) REFERENCES lawyer_tbl(lawyer_id),
  510. FOREIGN KEY (ref_foreclosure_status_id) REFERENCES foreclosure_status_tbl(status_id),
  511. FOREIGN KEY (ref_approval_status_id) REFERENCES approval_status_tbl(approval_status_id),
  512. PRIMARY KEY (foreclosure_id)
  513. );
  514.  
  515. CREATE TABLE petition_tbl(
  516. petition_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  517. ref_foreclosure_id INT,
  518. promissory_note_number VARCHAR(50),
  519. promissory_note_face_amount DECIMAL(20,2),
  520. ref_pn_id INT,
  521. collateral_number VARCHAR(50),
  522. ref_collateral_id INT,
  523. loan_type VARCHAR(50),
  524. approval_status VARCHAR(50),
  525. bank_name VARCHAR(50),
  526. ref_bank_id INT,
  527. full_name VARCHAR(50),
  528. entity_name VARCHAR(50),
  529. ref_borrower_id INT,
  530. loan_application_number VARCHAR(50),
  531. delete_flag INT WITH DEFAULT 0,
  532. outstanding_balance DECIMAL(20,2) WITH DEFAULT 0,
  533. last_interest_payment_date DATE,
  534. interest_rate DECIMAL(9,6) WITH DEFAULT 0,
  535. penalty_rate DECIMAL(9,6) WITH DEFAULT 0,
  536. service_charge_rate DECIMAL(9,6) WITH DEFAULT 0,
  537. other_charges DECIMAL(20,2) WITH DEFAULT 0,
  538. FOREIGN KEY (ref_foreclosure_id) REFERENCES foreclosure_tbl(foreclosure_id),
  539. FOREIGN KEY (ref_bank_id) REFERENCES bank_tbl(bank_id),
  540. FOREIGN KEY (ref_borrower_id) REFERENCES end_user_borrower_tbl(borrower_id),
  541. FOREIGN KEY (ref_collateral_id) REFERENCES collateral_tbl(collateral_id),
  542. FOREIGN KEY (ref_pn_id) REFERENCES pn_tbl(pn_id),
  543. PRIMARY KEY (petition_id)
  544. );
  545.  
  546. CREATE TABLE auction_tbl (
  547. auction_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  548. ref_foreclosure_id INT,
  549. foreclosure_ref_number INT,
  550. auction_status VARCHAR(50),
  551. file_claim_amount DECIMAL(20,2) WITH DEFAULT 0,
  552. date_forwarded DATE,
  553. date_forwarded_remarks VARCHAR(150),
  554. date_filed DATE,
  555. date_filed_remarks VARCHAR(150),
  556. ejf_number VARCHAR(50),
  557. rtc VARCHAR(150),
  558. auction_date DATE,
  559. registered_owner VARCHAR(50),
  560. tct_number VARCHAR(50),
  561. area INT,
  562. fmv DECIMAL(20,2) WITH DEFAULT 0,
  563. pwd DECIMAL(9,6) WITH DEFAULT 0,
  564. hbu_property VARCHAR(50),
  565. delete_flag INT WITH DEFAULT 0,
  566. notice_auction_date DATE,
  567. time_auction VARCHAR(50),
  568. place_auction VARCHAR(150),
  569. sheriff_clerk_name VARCHAR(150),
  570. rtc_auction_sale VARCHAR(150),
  571. rtc_remarks_auction_sale VARCHAR(150),
  572. pdic_bank_soa VARCHAR(100),
  573. recommended_bid_price DECIMAL(20,2) WITH DEFAULT 0,
  574. total_bsp_claims DECIMAL(20,2) WITH DEFAULT 0,
  575. total_bank_claims DECIMAL(20,2) WITH DEFAULT 0,
  576. fair_market_value DECIMAL(20,2) WITH DEFAULT 0,
  577. approved_bid_price DECIMAL(20,2) WITH DEFAULT 0,
  578. manual_outstanding_principal DECIMAL(20,2) WITH DEFAULT 0,
  579. manual_interest_amount DECIMAL(20,2) WITH DEFAULT 0,
  580. manual_penalty DECIMAL(20,2) WITH DEFAULT 0,
  581. manual_service_charge DECIMAL(20,2) WITH DEFAULT 0,
  582. manual_others DECIMAL(20,2) WITH DEFAULT 0,
  583. approved_bid_price_remarks VARCHAR(150),
  584. bid_price_approval_date DATE,
  585. ref_bidder_id INT,
  586. dv_date DATE,
  587. cos_date DATE,
  588. submitted_to_rd_date DATE,
  589. cos_annotation_date DATE,
  590. memo_signed_by_md_date DATE,
  591. transferred_to_amd_date DATE,
  592. awarded_to_next_bidder_flag INT WITH DEFAULT 0,
  593. PRIMARY KEY(auction_id),
  594. FOREIGN KEY(ref_foreclosure_id) REFERENCES FORECLOSURE_TBL(foreclosure_id)
  595. );
  596.  
  597. CREATE TABLE bid_tbl(
  598. bid_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  599. bank_principal DECIMAL(20,2) WITH DEFAULT 0,
  600. bank_interest DECIMAL(20,2) WITH DEFAULT 0,
  601. bank_penalties DECIMAL(20,2) WITH DEFAULT 0,
  602. bsp_principal DECIMAL(20,2) WITH DEFAULT 0,
  603. bsp_booked_interest DECIMAL(20,2) WITH DEFAULT 0,
  604. bsp_unbooked_interest_income DECIMAL(20,2) WITH DEFAULT 0,
  605. bsp_unbooked_liquidated_damages DECIMAL(20,2) WITH DEFAULT 0,
  606. filing_fee DECIMAL(20,2) WITH DEFAULT 0,
  607. appraisal_cost DECIMAL(20,2) WITH DEFAULT 0,
  608. publication_fee DECIMAL(20,2) WITH DEFAULT 0,
  609. sheriffs_fee DECIMAL(20,2) WITH DEFAULT 0,
  610. courts_commission DECIMAL(20,2) WITH DEFAULT 0,
  611. entry_fee DECIMAL(20,2) WITH DEFAULT 0,
  612. attorneys_fee DECIMAL(20,2) WITH DEFAULT 0,
  613. real_estate_tax DECIMAL(20,2) WITH DEFAULT 0,
  614. appraised_value DECIMAL(20,2) WITH DEFAULT 0,
  615. applicable_adjustment_rate DECIMAL(9,6) WITH DEFAULT 0,
  616. total_bsp_claim DECIMAL(20,2) WITH DEFAULT 0,
  617. total_bank_claim DECIMAL(20,2) WITH DEFAULT 0,
  618. ref_auction_id INT,
  619. FOREIGN KEY (ref_auction_id) REFERENCES auction_tbl (auction_id),
  620. PRIMARY KEY (bid_id)
  621. );
  622.  
  623. CREATE TABLE bid_remarks_tbl(
  624. remarks_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  625. ref_bid_id INT,
  626. remarks_content VARCHAR(1000),
  627. remarks_type VARCHAR(50),
  628. date_created DATE,
  629. PRIMARY KEY(remarks_id),
  630. FOREIGN KEY(ref_bid_id) REFERENCES BID_TBL(bid_id)
  631. );
  632.  
  633. CREATE TABLE bidder_details_tbl(
  634. bidder_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  635. bidder_name VARCHAR(100),
  636. amount DECIMAL(20,2) WITH DEFAULT 0,
  637. ref_auction_id INT,
  638. default_flag INT,
  639. delete_flag INT WITH DEFAULT 0,
  640. PRIMARY KEY(bidder_id),
  641. FOREIGN KEY(ref_auction_id) REFERENCES AUCTION_TBL(auction_id)
  642. );
  643.  
  644. CREATE TABLE winning_bidder_tbl (
  645. winning_bidder_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  646. ref_bidder_id INT,
  647. reason VARCHAR(100),
  648. created_date TIMESTAMP WITH DEFAULT,
  649. delete_flag INT WITH DEFAULT 0,
  650. PRIMARY KEY(winning_bidder_id),
  651. FOREIGN KEY(ref_bidder_id) REFERENCES BIDDER_DETAILS_TBL(bidder_id)
  652. );
  653.  
  654. CREATE TABLE transaction_remarks_tbl (
  655. remarks_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  656. ref_transaction_id INT,
  657. remarks_content VARCHAR(500),
  658. remarks_type VARCHAR (50),
  659. date_created TIMESTAMP WITH DEFAULT,
  660. PRIMARY KEY (remarks_id),
  661. FOREIGN KEY(ref_transaction_id) REFERENCES transaction_tbl (transaction_id)
  662. );
  663.  
  664. CREATE TABLE collateral_documents_tbl (
  665. document_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  666. foreclosure_ref_number VARCHAR(50),
  667. document_name VARCHAR(50),
  668. document_contents VARCHAR(300),
  669. updated_by VARCHAR(50),
  670. updated_on TIMESTAMP WITH DEFAULT,
  671. save_flag INT WITH DEFAULT 0,
  672. print_flag INT WITH DEFAULT 0,
  673. PRIMARY KEY (document_id),
  674. FOREIGN KEY (updated_by) REFERENCES user_tbl(user_name),
  675. FOREIGN KEY (foreclosure_ref_number) REFERENCES FORECLOSURE_TBL(foreclosure_ref_number)
  676. );
  677.  
  678. CREATE TABLE pre_foreclosure(
  679. pre_foreclosure_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  680. ref_pn_id INT,
  681. pre_foreclosure_status VARCHAR (50),
  682. transaction_date DATE,
  683. active_flag INT WITH DEFAULT 1,
  684. excluded_false INT WITH DEFAULT 0,
  685. excluded_date DATE,
  686. FOREIGN KEY (ref_pn_id) REFERENCES pn_tbl(pn_id),
  687. PRIMARY KEY(pre_foreclosure_id)
  688. );
  689.  
  690. CREATE TABLE demand_letter(
  691. demand_letter_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  692. date_on_demand_letter DATE,
  693. demand_letter_date DATE,
  694. ref_pn_id INT,
  695. FOREIGN KEY (ref_pn_id) REFERENCES pn_tbl(pn_id),
  696. PRIMARY KEY(demand_letter_id)
  697. );
  698.  
  699. CREATE TABLE remarks_tbl (
  700. remarks_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  701. remarks_group VARCHAR(100),
  702. remarks_group_ref_id INT,
  703. remarks_content VARCHAR(500),
  704. created_date TIMESTAMP WITH DEFAULT,
  705. created_by VARCHAR(50),
  706. PRIMARY KEY (remarks_id)
  707. );
  708.  
  709. CREATE TABLE batch_tbl(
  710. batch_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  711. job_name varchar(100),
  712. cron_trigger_name varchar(100),
  713. cron_expression varchar(100),
  714. active_flag INT WITH DEFAULT 1
  715. );
  716.  
  717. CREATE TABLE pn_collateral (
  718. pn_collateral_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  719. ref_pn_id INT,
  720. ref_collateral_id INT,
  721. PRIMARY KEY (pn_collateral_id),
  722. FOREIGN KEY (ref_pn_id) REFERENCES pn_tbl (pn_id),
  723. FOREIGN KEY (ref_collateral_id) REFERENCES collateral_tbl (collateral_id)
  724. );
  725.  
  726. CREATE TABLE expense_tbl(
  727. expense_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  728. expense_type VARCHAR(100) NOT NULL,
  729. amount DECIMAL(20,2) WITH DEFAULT 0,
  730. or_number VARCHAR(50),
  731. or_date DATE,
  732. ref_pn_id INT,
  733. FOREIGN KEY (ref_pn_id) REFERENCES pn_tbl (pn_id),
  734. PRIMARY KEY (expense_id)
  735. );
  736.  
  737. CREATE TABLE appraisal_report(
  738. appraisal_report_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  739. report_type VARCHAR(100) NOT NULL,
  740. report_date DATE,
  741. appraiser_name VARCHAR(50),
  742. ref_collateral_id INT,
  743. FOREIGN KEY (ref_collateral_id) REFERENCES collateral_tbl (collateral_id),
  744. PRIMARY KEY (appraisal_report_id)
  745. );
  746.  
  747.  
  748. CREATE TABLE tax_declaration_tbl(
  749. tax_declaration_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  750. tax_declaration_number VARCHAR(50),
  751. tax_declaration_type VARCHAR(50),
  752. classification_type VARCHAR(50),
  753. amount DECIMAL(20,2) WITH DEFAULT 0,
  754. ref_collateral_id INT,
  755. ref_appraisal_id INT,
  756. PRIMARY KEY(tax_declaration_id),
  757. FOREIGN KEY(ref_collateral_id) REFERENCES collateral_tbl (collateral_id),
  758. FOREIGN KEY(ref_appraisal_id) REFERENCES appraisal_report(appraisal_report_id)
  759. );
  760.  
  761. CREATE TABLE insurance_details_tbl(
  762. insurance_details_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1),
  763. policy_number VARCHAR(50),
  764. insurance_company_name VARCHAR(50),
  765. insurance_or_number VARCHAR(50),
  766. expiry_date TIMESTAMP WITH DEFAULT,
  767. insured_amount DECIMAL(20,2) WITH DEFAULT 0,
  768. ref_collateral_id INT,
  769. ref_appraisal_id INT,
  770. PRIMARY KEY(insurance_details_id),
  771. FOREIGN KEY(ref_collateral_id) REFERENCES collateral_tbl (collateral_id)
  772. );
  773.  
  774. CREATE SEQUENCE DACION_TRANSACTION_SEQ
  775. START WITH 3
  776. INCREMENT BY 1
  777. NO MAXVALUE
  778. NO CYCLE
  779. CACHE 100;
  780.  
  781.  
  782.  
  783. INSERT INTO balance_tbl (cwt, others, liquidated_damages, accrued_interest_receivable, interest_income, outstanding_principal, total_outstanding_balance) VALUES
  784. ( 0.00, 0.00, 540000.00, 1130000.00, 206000.00, 6800000.00, 8676000.00), --Bank of the Philippine Islands
  785. ( 0.00, 0.00, 1030000.00, 1510000.00, 229700.00, 6800000.00, 9569700.00), --Banco De Oro
  786. ( 0.00, 0.00, 890000.00, 1100000.00, 191700.00, 5600000.00, 7781700.00), --Metro Bank
  787. ( 0.00, 0.00, 540000.00, 1130000.00, 206000.00, 6800000.00, 8676000.00), --CRB of SDMD
  788. ( 0.00, 0.00, 1030000.00, 1510000.00, 229700.00, 6800000.00, 9569700.00), --Cooperative Bank of SDMD
  789. ( 0.00, 0.00, 890000.00, 1100000.00, 191700.00, 5600000.00, 7781700.00), --RB of SDMD
  790. ( 0.00, 0.00, 340000.00, 770000.00, 122000.00, 4000000.00, 5232000.00), --Loan 123456 (Bank of the Philippine Islands)
  791. ( 0.00, 0.00, 200000.00, 360000.00, 84000.00, 2800000.00, 3444000.00), --Loan 234567 (Bank of the Philippine Islands)
  792. ( 0.00, 0.00, 690000.00, 740000.00, 107700.00, 2800000.00, 4337700.00), --Loan 345678 (Banco De Oro)
  793. ( 0.00, 0.00, 340000.00, 770000.00, 122000.00, 4000000.00, 5232000.00), --Loan 456789 (Banco De Oro)
  794. ( 0.00, 0.00, 200000.00, 360000.00, 84000.00, 2800000.00, 3444000.00), --Loan 567891 (Metro Bank)
  795. ( 0.00, 0.00, 690000.00, 740000.00, 107700.00, 2800000.00, 4337700.00), --Loan 678912 (Metro Bank)
  796. ( 0.00, 0.00, 340000.00, 770000.00, 122000.00, 4000000.00, 5232000.00), --Loan 789123 (CRB of SDMD)
  797. ( 0.00, 0.00, 200000.00, 360000.00, 84000.00, 2800000.00, 3444000.00), --Loan 891234 (CRB of SDMD)
  798. ( 0.00, 0.00, 690000.00, 740000.00, 107700.00, 2800000.00, 4337700.00), --Loan 912345 (Cooperative Bank of SDMD)
  799. ( 0.00, 0.00, 340000.00, 770000.00, 122000.00, 4000000.00, 5232000.00), --Loan 565541 (Cooperative Bank of SDMD)
  800. ( 0.00, 0.00, 200000.00, 360000.00, 84000.00, 2800000.00, 3444000.00), --Loan 878999 (RB of SDMD)
  801. ( 0.00, 0.00, 690000.00, 740000.00, 107700.00, 2800000.00, 4337700.00), --Loan 741335 (RB of SDMD)
  802. ( 0.00, 20000.00, 140000.00, 450000.00, 58000.00, 1200000.00, 1848000.00), --PN 201712 [Loan 123456 (Bank of the Philippine Islands)]
  803. ( 0.00, 0.00, 200000.00, 320000.00, 64000.00, 2800000.00, 3384000.00), --PN 201723 [Loan 123456 (Bank of the Philippine Islands)]
  804. ( 0.00, 18000.00, 80000.00, 110000.00, 34000.00, 1700000.00, 1924000.00), --PN 201734 [Loan 234567 (Bank of the Philippine Islands)]
  805. ( 0.00, 21000.00, 120000.00, 250000.00, 50000.00, 1100000.00, 1520000.00), --PN 201745 [Loan 234567 (Bank of the Philippine Islands)]
  806. ( 0.00, 45000.00, 390000.00, 550000.00, 53300.00, 1300000.00, 2293300.00), --PN 201756 [Loan 345678 (Banco De Oro)]
  807. ( 0.00, 67000.00, 300000.00, 190000.00, 54400.00, 1500000.00, 2044400.00), --PN 201767 [Loan 345678 (Banco De Oro)]
  808. ( 0.00, 20000.00, 140000.00, 450000.00, 58000.00, 1200000.00, 1848000.00), --PN 201778 [Loan 456789 (Banco De Oro)]
  809. ( 0.00, 0.00, 200000.00, 320000.00, 64000.00, 2800000.00, 3384000.00), --PN 201789 [Loan 456789 (Banco De Oro)]
  810. ( 0.00, 18000.00, 80000.00, 110000.00, 34000.00, 1700000.00, 1924000.00), --PN 201791 [Loan 567891 (Metro Bank)]
  811. ( 0.00, 21000.00, 120000.00, 250000.00, 50000.00, 1100000.00, 1520000.00), --PN 201713 [Loan 567891 (Metro Bank)]
  812. ( 0.00, 45000.00, 390000.00, 550000.00, 53300.00, 1300000.00, 2293300.00), --PN 201724 [Loan 678912 (Metro Bank)]
  813. ( 0.00, 67000.00, 300000.00, 190000.00, 54400.00, 1500000.00, 2044400.00), --PN 201729 [Loan 678912 (Metro Bank)]
  814. ( 0.00, 20000.00, 140000.00, 450000.00, 58000.00, 1200000.00, 1848000.00), --PN 201735 [Loan 789123 (CRB of SDMD)]
  815. ( 0.00, 0.00, 200000.00, 320000.00, 64000.00, 2800000.00, 3384000.00), --PN 201746 [Loan 789123 (CRB of SDMD)]
  816. ( 0.00, 18000.00, 80000.00, 110000.00, 34000.00, 1700000.00, 1924000.00), --PN 201757 [Loan 891234 (CRB of SDMD)]
  817. ( 0.00, 21000.00, 120000.00, 250000.00, 50000.00, 1100000.00, 1520000.00), --PN 201768 [Loan 891234 (CRB of SDMD)]
  818. ( 0.00, 45000.00, 390000.00, 550000.00, 53300.00, 1300000.00, 2293300.00), --PN 201779 [Loan 912345 (Cooperative Bank of SDMD)]
  819. ( 0.00, 67000.00, 300000.00, 190000.00, 54400.00, 1500000.00, 2044400.00), --PN 201744 [Loan 912345 (Cooperative Bank of SDMD)]
  820. ( 0.00, 20000.00, 140000.00, 450000.00, 58000.00, 1200000.00, 1848000.00), --PN 201792 [Loan 565541 (Cooperative Bank of SDMD)]
  821. ( 0.00, 0.00, 200000.00, 320000.00, 64000.00, 2800000.00, 3384000.00), --PN 201722 [Loan 565541 (Cooperative Bank of SDMD)]
  822. ( 0.00, 18000.00, 80000.00, 110000.00, 34000.00, 1700000.00, 1924000.00), --PN 201797 [Loan 878999 (RB of SDMD)]
  823. ( 0.00, 21000.00, 120000.00, 250000.00, 50000.00, 1100000.00, 1520000.00), --PN 201787 [Loan 878999 (RB of SDMD)]
  824. ( 0.00, 45000.00, 390000.00, 550000.00, 53300.00, 1300000.00, 2293300.00), --PN 201782 [Loan 741335 (RB of SDMD)]
  825. ( 0.00, 67000.00, 300000.00, 190000.00, 54400.00, 1500000.00, 2044400.00), --PN 201733 [Loan 741335 (RB of SDMD)]
  826. ( 0.00, 50000.00, 60000.00, 80000.00, 100000.00, 500000.00, 740000.00), --Bangkong Luma
  827. ( 0.00, 50000.00, 60000.00, 80000.00, 100000.00, 500000.00, 740000.00), --Bangkong Medyo Luma
  828. ( 0.00, 50000.00, 60000.00, 80000.00, 100000.00, 500000.00, 740000.00), --Bangkong Medyo Bago
  829. ( 0.00, 50000.00, 60000.00, 80000.00, 100000.00, 500000.00, 740000.00), --Loan 999990 (Bangkong Luma)
  830. ( 0.00, 50000.00, 60000.00, 80000.00, 100000.00, 500000.00, 740000.00), --Loan 999991 (Bangkong Medyo Luma)
  831. ( 0.00, 50000.00, 60000.00, 80000.00, 100000.00, 500000.00, 740000.00), --Loan 999992 (Bangkong Medyo Bago)
  832. ( 0.00, 50000.00, 60000.00, 80000.00, 100000.00, 500000.00, 740000.00), --PN 201751 [Loan 999990 (Bangkong Luma)]
  833. ( 0.00, 50000.00, 60000.00, 80000.00, 100000.00, 500000.00, 740000.00), --PN 201752 [Loan 999991 (Bangkong Medyo Luma)]
  834. ( 0.00, 50000.00, 60000.00, 80000.00, 100000.00, 500000.00, 740000.00), --PN 201753 [Loan 999992 (Bangkong Medyo Bago)]
  835. ( 0.00, 36000.00, 66000.00, 96000.00, 156000.00, 900000.00, 12180000.00), --Bangko Mo
  836. ( 0.00, 36000.00, 66000.00, 96000.00, 156000.00, 900000.00, 1218000.00), --Loan 999993 (Bangko Mo)
  837. ( 0.00, 14000.00, 24000.00, 34000.00, 54000.00, 200000.00, 312000.00), --PN 201771 [Loan 999993 (Bangko Mo)]
  838. ( 0.00, 12000.00, 22000.00, 32000.00, 52000.00, 250000.00, 356000.00), --PN 201772 [Loan 999993 (Bangko Mo)]
  839. ( 0.00, 10000.00, 20000.00, 30000.00, 50000.00, 450000.00, 550000.00), --PN 201773 [Loan 999993 (Bangko Mo)]
  840. ( 0.00, 10000.00, 20000.00, 30000.00, 70000.00, 1000000.00, 1120000.00), --Bangko Ko
  841. ( 0.00, 10000.00, 20000.00, 30000.00, 70000.00, 1000000.00, 1120000.00), --Loan 999994 (Bangko Ko)
  842. ( 0.00, 10000.00, 20000.00, 30000.00, 70000.00, 1000000.00, 1120000.00); --PN 201774 [Loan 999994 (Bangko Ko)]
  843.  
  844.  
  845. INSERT INTO balance_tbl (ref_id, balance_type, cwt, others, liquidated_damages, accrued_interest_receivable, interest_income, outstanding_principal, total_outstanding_balance) VALUES
  846. (32, 'PN', 0.00, 0.00, 50000.00, 150000.00, 75000.00, 225000.00, 500000.00),
  847. (33, 'PN', 0.00, 0.00, 60000.00, 160000.00, 80000.00, 200000.00, 500000.00),
  848. (34, 'PN', 0.00, 0.00, 50000.00, 150000.00, 75000.00, 225000.00, 500000.00),
  849. (35, 'PN', 0.00, 0.00, 10000.00, 20000.00, 15000.00, 55000.00, 100000.00),
  850. (36, 'PN', 0.00, 0.00, 20000.00, 40000.00, 30000.00, 110000.00, 200000.00),
  851. (37, 'PN', 0.00, 0.00, 30000.00, 60000.00, 45000.00, 165000.00, 300000.00),
  852. (18, 'LOAN', 0.00, 0.00, 160000.00, 460000.00, 230000.00, 650000.00, 1500000.00),
  853. (19, 'LOAN', 0.00, 0.00, 60000.00, 120000.00, 90000.00, 330000.00, 600000.00),
  854. (38, 'PN', 0.00, 0.00, 125000.00, 100000.00, 125000.00, 350000.00, 700000.00),
  855. (39, 'PN', 0.00, 0.00, 250000.00, 75000.00, 100000.00, 325000.00, 750000.00),
  856. (20, 'LOAN', 0.00, 0.00, 300000.00, 225000.00, 275000.00, 650000.00, 1450000.00),
  857. (12, 'BANK', 0.00, 0.00, 220000.00, 580000.00, 320000.00, 980000.00, 2100000.00),
  858. (40, 'PN', 0.00, 0.00, 40000.00, 55000.00, 30000.00, 125000.00, 250000.00),
  859. (21, 'LOAN', 0.00, 0.00, 40000.00, 55000.00, 30000.00, 125000.00, 250000.00),
  860. (13, 'BANK', 0.00, 0.00, 340000.00, 280000.00, 305000.00, 775000.00, 1700000.00);
  861.  
  862. INSERT INTO balance_tbl (cwt, others, liquidated_damages, accrued_interest_receivable, interest_income, outstanding_principal, total_outstanding_balance) VALUES
  863. ( 0.00, 0.00, 540000.00, 1130000.00, 206000.00, 1200000.00, 3076000.00), --PN 75
  864. ( 0.00, 0.00, 1030000.00, 1510000.00, 229700.00, 2800000.00, 5569700.00), --PN 76
  865. ( 0.00, 0.00, 890000.00, 1100000.00, 191700.00, 2000000.00, 4181700.00), --PN 77
  866. ( 0.00, 0.00, 2460000.00, 3740000.00, 627400.00, 6000000.00, 12827400.00); --LOAN 78
  867.  
  868. INSERT INTO balance_tbl (cwt, others, liquidated_damages, accrued_interest_receivable, interest_income, outstanding_principal, total_outstanding_balance) VALUES
  869. ( 0.00, 0.00, 540000.00, 1130000.00, 206000.00, 1200000.00, 3076000.00), --PN 79
  870. ( 0.00, 0.00, 1030000.00, 1510000.00, 229700.00, 2800000.00, 5569700.00), --PN 80
  871. ( 0.00, 0.00, 890000.00, 1100000.00, 191700.00, 2000000.00, 4181700.00), --PN 81
  872. ( 0.00, 0.00, 2460000.00, 3740000.00, 627400.00, 6000000.00, 12827400.00); --LOAN 82
  873.  
  874. INSERT INTO balance_tbl (ref_id, balance_type, cwt, others, liquidated_damages, accrued_interest_receivable, interest_income, outstanding_principal, total_outstanding_balance) VALUES
  875. (47, 'PN', 0.00, 0.00, 50000.00, 150000.00, 75000.00, 225000.00, 500000.00), -- PBB -- 83
  876. (48, 'PN', 0.00, 0.00, 60000.00, 160000.00, 80000.00, 200000.00, 500000.00), -- PBB -- 84
  877. (49, 'PN', 0.00, 0.00, 50000.00, 150000.00, 75000.00, 225000.00, 500000.00), -- PBB -- 85
  878. (50, 'PN', 0.00, 0.00, 10000.00, 20000.00, 15000.00, 55000.00, 100000.00), -- PBB -- 86
  879. (51, 'PN', 0.00, 0.00, 20000.00, 40000.00, 30000.00, 110000.00, 200000.00), -- PBB -- 87
  880. (52, 'PN', 0.00, 0.00, 30000.00, 60000.00, 45000.00, 165000.00, 300000.00), -- PBB -- 88
  881. (24, 'LOAN', 0.00, 0.00, 420000.00, 460000.00, 230000.00, 650000.00, 1500000.00), -- PBB -- 89
  882. (25, 'LOAN', 0.00, 0.00, 260000.00, 690000.00, 325000.00, 975000.00, 2250000.00), -- PBB -- 90
  883. (14, 'BANK', 0.00, 0.00, 680000.00, 1150000.00, 555000.00, 1625000.00, 3750000.00); -- PBB -- 91
  884.  
  885. INSERT INTO balance_tbl (ref_id, balance_type, cwt, others, liquidated_damages, accrued_interest_receivable, interest_income, outstanding_principal, total_outstanding_balance) VALUES
  886. (53, 'PN', 0.00, 0.00, 70000.00, 190000.00, 80000.00, 230000.00, 570000.00),
  887. (54, 'PN', 0.00, 0.00, 50000.00, 210000.00, 90000.00, 210000.00, 560000.00),
  888. (55, 'PN', 0.00, 0.00, 80000.00, 170000.00, 65000.00, 205000.00, 520000.00);
  889.  
  890. INSERT INTO bank_tbl ( bank_code, bank_name, bank_type, bank_status, date_joined, bank_address, date_close, ref_balance_id) VALUES
  891. ( 'BPI', 'Bank of the Philippine Islands', 'Rural', 'Operating', '1999-05-21', 'Gapan Nueva Ecija', NULL, 1),
  892. ( 'BDO', 'Banco De Oro', 'Rural', 'Operating', '1999-10-22', 'San Mateo Rizal', NULL, 2),
  893. ( 'MB', 'Metro Bank', 'Coop', 'Operating', '2000-05-21', 'Blumentritt', NULL, 3),
  894. ( 'CRBSDMD', 'CRB of SDMD', 'Coop', 'Operating', '1995-05-21', 'Quezon City', NULL, 4),
  895. ( 'CBSDMD', 'Cooperative Bank of SDMD', 'Coop', 'Operating', '2000-05-21', 'Makati City', NULL, 5),
  896. ( 'RBSDMD', 'RB of SDMD', 'Rural', 'Operating', '2000-05-21', 'Pampanga', NULL, 6),
  897. ( 'BL', 'Bangkong Luma', 'Rural', 'Closed', '1970-05-21', 'Cabiao Nueva Ecija', '1980-07-09', 43),
  898. ( 'BML', 'Bangkong Medyo Luma', 'Rural', 'Closed', '1975-06-30', 'Cabanatuan Nueva Ecija', '1980-07-09', 44),
  899. ( 'BMB', 'Bangkong Medyo Bago', 'Rural', 'Closed', '2005-11-01', 'Arayat Pampanga', '2015-07-09', 45),
  900. ( 'BM', 'Bangko Mo', 'Rural', 'Closed', '2000-10-08', 'Jaro Iloilo', '2012-10-08', 52),
  901. ( 'BK', 'Bangko Ko', 'Rural', 'Closed', '1980-10-08', 'Tagbak Iloilo', '1990-10-08', 57),
  902. ( 'RCBC', 'Rizal Commercial Banking Corporation', 'Rural', 'Operating', '1999-05-21', 'Marikina City', NULL, 71),
  903. ( 'UPCB', 'United Coconut Planters Bank', 'Rural', 'Operating', '1999-10-22', 'Quezon City', NULL, 74);
  904.  
  905. INSERT INTO bank_tbl ( bank_code, bank_name, bank_type, bank_status, date_joined, bank_address, date_close, ref_balance_id) VALUES
  906. ( 'PBB', 'Philippine Business Bank', 'Rural', 'Operating', '1999-10-22', 'Quezon City', NULL, 91); -- 14
  907.  
  908. INSERT INTO loan_tbl ( loan_application_number, ref_bank_id, loan_type, loan_status, loan_interest_rate, date_granted, maturity_date, loan_term, amount_granted, ref_balance_id) VALUES
  909. (123456, 1, 'Rediscounting', 'Current Accounts', 0.0313, '2016-05-16', '2016-11-12', 180, 4000000.00, 7),
  910. (234567, 1, 'Rediscounting', 'Current Accounts', 0.0313, '2016-07-08', '2017-01-04', 180, 2800000.00, 8),
  911. (345678, 2, 'Rediscounting', 'Current Accounts', 0.0313, '2016-07-21', '2017-01-17', 180, 4000000.00,9),
  912. (456789, 2, 'Rediscounting', 'Current Accounts', 0.03, '2017-02-22', '2017-08-21', 180, 2800000.00,10),
  913. (567891, 3, 'Rediscounting', 'Current Accounts', 0.03, '2016-05-21', '2016-11-17', 180, 4000000.00,11),
  914. (678912, 3, 'Rediscounting', 'Current Accounts', 0.0313, '2017-01-22', '2017-07-21', 180, 2800000.00,12),
  915. (789123, 4, 'Rediscounting', 'Current Accounts', 0.0313, '2016-05-21', '2017-05-16', 360, 4000000.00,13),
  916. (891234, 4, 'Rediscounting', 'Current Accounts', 0.03, '2017-02-18', '2018-02-13', 360, 2800000.00, 14),
  917. (912345, 5, 'Rediscounting', 'Current Accounts', 0.03, '2016-01-11', '2017-01-05', 360,4000000.00,15),
  918. (565541, 5, 'Rediscounting', 'Current Accounts', 0.03, '2016-01-03', '2016-12-28', 360, 2800000.00,16),
  919. (878999, 6, 'Rediscounting', 'Current Accounts', 0.03, '2016-07-11', '2017-07-06', 360, 4000000.00,17),
  920. (741335, 6, 'Rediscounting', 'Current Accounts', 0.03, '2016-09-26', '2017-09-21', 360, 2800000.00,18),
  921. (999990, 7, 'Rediscounting', 'Past Due', 0.12, '1975-12-01', '1976-05-29', 180, 500000.00, 46),
  922. (999991, 8, 'Rediscounting', 'Past Due', 0.12, '1977-12-01', '1978-05-30', 180, 500000.00, 47),
  923. (999992, 9, 'Rediscounting', 'Past Due', 0.12, '2000-12-01', '2001-05-30', 180, 500000.00, 48),
  924. (999993, 10, 'Rediscounting', 'Past Due', 0.10, '2010-06-01', '2010-11-28', 180, 900000.00, 53);
  925.  
  926. INSERT INTO loan_tbl ( loan_application_number, ref_bank_id, loan_type, loan_status, loan_interest_rate, date_granted, maturity_date, amount_granted, ref_balance_id, reprice_rate_flag) VALUES
  927. (999994, 11, 'Rediscounting', 'Past Due', 0.10, '1988-06-01', '1988-11-28', 1000000.00, 58, 1);
  928.  
  929. INSERT INTO loan_tbl ( loan_application_number, ref_bank_id, loan_type, loan_status, loan_interest_rate, date_granted, maturity_date, loan_term, amount_granted, ref_balance_id) VALUES
  930. (999901, 12, 'Rediscounting', 'Past Due', 0.12, '2016-05-16', '2016-11-12', 180, 1500000.00, 66),
  931. (999902, 12, 'Rediscounting', 'Current Accounts', 0.12, '2016-05-16', '2016-11-12', 180, 600000.00, 67),
  932. (999903, 13, 'Rediscounting', 'Current Accounts', 0.18, '2016-05-16', '2016-11-12', 180, 1450000.00, 70),
  933. (999904, 13, 'Rediscounting', 'Current Accounts', 0.07, '2016-05-16', '2016-11-12', 180, 250000.00, 73);
  934.  
  935. INSERT INTO loan_tbl ( loan_application_number, ref_bank_id, loan_type, loan_status, loan_interest_rate, date_granted, maturity_date, loan_term, amount_granted, ref_balance_id) VALUES
  936. (999995, 1, 'Emergency Loan', 'Current Accounts', 0.0313, '2016-05-16', '2016-11-12', 180, 6000000.00, 78);
  937.  
  938. INSERT INTO loan_tbl ( loan_application_number, ref_bank_id, loan_type, loan_status, loan_interest_rate, date_granted, maturity_date, loan_term, amount_granted, ref_balance_id) VALUES
  939. (999996, 2, 'Emergency Loan', 'Current Accounts', 0.0313, '2016-05-16', '2016-11-12', 180, 6000000.00, 82);
  940.  
  941. INSERT INTO loan_tbl ( loan_application_number, ref_bank_id, loan_type, loan_status, loan_interest_rate, date_granted, maturity_date, loan_term, amount_granted, ref_balance_id) VALUES
  942. (999997, 14, 'Rediscounting', 'Past Due', 0.12, '2016-05-16', '2016-11-12', 180, 1500000.00, 89), -- 24
  943. (999998, 14, 'Rediscounting', 'Current Accounts', 0.12, '2016-05-16', '2016-11-12', 180, 2250000.00, 90); -- 25
  944.  
  945. INSERT INTO END_USER_BORROWER_TBL(entity_name, full_name) VALUES
  946. ('Mcdonalds' , 'Ray Kroc'),
  947. ('Jollibee' , 'Tony Tan Caktiong'),
  948. ('KFC' , 'Colonel Sanders'),
  949. ('Mang Inasal' , 'Edgar Sia'),
  950. ('Wendys' , 'Dave Thomas'),
  951. ('Coca-cola' , 'John Smith Pemberton'),
  952. ('Starbucks' , 'Gordon Bowker'),
  953. ('Reddit' , 'Steve Huffman, Alexis Ohanian'),
  954. ('Pizza Hut' , 'Dan Carney, Frank Carney'),
  955. ('Pepsi' , 'Thomas Karlton'),
  956. ('Bandai' , 'Juan Ted'),
  957. ('Nike' , 'Yeri Youngston'),
  958. ('Adidas' , 'Sherley Maedar'),
  959. ('Zesto' , 'Steve Jobs'),
  960. ('Microsoft' , 'Bill Gates'),
  961. ('Facebook' , 'Mark Zuckerberg'),
  962. ('KKK' , 'Jensen Huang'),
  963. ('Wendys' , 'Henry Sy'),
  964. ('JDC' , 'Juan Dela Cruz'),
  965. ('JOHNDC' , 'John Dela Cruz'),
  966. ('JODC' , 'Jo Dela Cruz'),
  967. ('CA Corp' , 'Corazon Aquino'),
  968. ('MQ' , 'Manuel Quezon'),
  969. ('SA Inc.' , 'Sergio Osmena'),
  970. ('ATon' , 'Antonio Luna'),
  971. ('GSM' , 'Gil More'),
  972. ('Empi' , 'Empoy Incheon'),
  973. ('Matador' , 'Mara Doria'),
  974. ('Tequila' , 'Teddy Quila'),
  975. ('Margarita' , 'Marga Rita'),
  976. ('Guiness' , 'Guiness Record'),
  977. ('Murphys' , 'Eddie Murphy'),
  978. ('Stout' , 'Stand Out'),
  979. ('Baileys' , 'Bailey Ann');
  980.  
  981. INSERT INTO END_USER_BORROWER_TBL(entity_name, full_name) VALUES
  982. ('Dell' , 'Mundo'),
  983. ('Gold' , 'Smart'),
  984. ('Silver' , 'Brite');
  985.  
  986. INSERT INTO pn_tbl ( pn_number, ref_loan_id, pn_status, pn_interest_rate, date_granted, maturity_date, amount_granted, ref_balance_id, ref_borrower_id) VALUES
  987. ( 201712, 1, 'Current Accounts', 10, '2016-01-01', '2017-01-05', 1200000.00,19,1),
  988. ( 201723, 1, 'Current Accounts', 10, '2016-05-11', '2017-02-20', 2800000.00, 20,2),
  989. ( 201734, 2, 'Current Accounts', 10, '2016-05-12', '2017-03-19', 1700000.00, 21,3),
  990. ( 201745, 2, 'Current Accounts', 10, '2016-05-13', '2017-04-16', 1100000.00, 22,4),
  991. ( 201756, 3, 'Current Accounts', 10, '2016-05-14', '2017-02-23', 1300000.00, 23,5),
  992. ( 201767, 3, 'Current Accounts', 10, '2016-03-14', '2017-02-05', 1500000.00, 24,6),
  993. ( 201778, 4, 'Current Accounts', 10, '2016-05-15', '2017-02-05', 1200000.00, 25,7),
  994. ( 201789, 4, 'Current Accounts', 9, '2016-07-21', '2017-02-05', 2800000.00, 26,8),
  995. ( 201791, 5, 'Current Accounts', 9, '2017-01-28', '2017-02-15', 1700000.00, 27,9),
  996. ( 201713, 5, 'Current Accounts', 9, '2017-01-29', '2018-10-25', 1100000.00, 28,10),
  997. ( 201724, 6, 'Current Accounts', 9, '2016-05-10', '2018-08-22', 1300000.00, 29,11),
  998. ( 201729, 6, 'Current Accounts', 9, '2016-03-15', '2018-04-24', 1500000.00, 30,12),
  999. ( 201735, 7, 'Current Accounts', 9, '2017-02-22', '2018-09-22', 1200000.00, 31,13),
  1000. ( 201746, 7, 'Current Accounts', 12, '2015-12-16', '2018-11-03', 2800000.00,32,14),
  1001. ( 201757, 8, 'Current Accounts', 12, '2017-12-22', '2018-11-05', 1700000.00, 33,15),
  1002. ( 201768, 8, 'Current Accounts', 12, '2014-05-18', '2018-12-05', 1100000.00, 34,16),
  1003. ( 201779, 9, 'Current Accounts', 12, '2015-01-22', '2018-02-15', 1300000.00, 35,17),
  1004. ( 201744, 9, 'Current Accounts', 12, '2013-05-16', '2018-01-05', 1500000.00,36,18),
  1005. ( 201792, 10, 'Current Accounts', 12, '2013-05-16', '2018-01-05', 1200000.00,37,null),
  1006. ( 201722, 10, 'Current Accounts', 12, '2013-05-16', '2018-01-05', 2800000.00,38,null),
  1007. ( 201797, 11, 'Current Accounts', 12, '2013-05-16', '2018-01-05', 1700000.00,39,null),
  1008. ( 201787, 11, 'Current Accounts', 12, '2013-05-16', '2018-01-05', 1100000.00,40,null),
  1009. ( 201782, 12, 'Current Accounts', 12, '2013-05-16', '2018-01-05', 1300000.00,41,null),
  1010. ( 201733, 12, 'Current Accounts', 12, '2013-05-16', '2018-01-05', 1500000.00,42,null),
  1011. ( 201751, 13, 'Past Due', 0.12, '1975-12-01', '1976-05-29', 500000.00, 49,19),
  1012. ( 201752, 14, 'Past Due', 0.12, '1977-12-01', '1978-05-30', 500000.00, 50,20),
  1013. ( 201753, 15, 'Past Due', 0.12, '2000-12-01', '2001-05-30', 500000.00, 51,21),
  1014. ( 201771, 16, 'Past Due', 0.18, '2009-12-03', '2010-11-28', 200000.00, 54,22),
  1015. ( 201772, 16, 'Past Due', 0.18, '2009-12-03', '2010-11-28', 250000.00, 55,23),
  1016. ( 201773, 16, 'Past Due', 0.20, '2009-12-02', '2010-11-27', 450000.00, 56,24),
  1017. ( 201774, 17, 'Past Due', 0.18, '1988-06-03', '1988-11-28', 1000000.00, 59,25),
  1018. ( 202000, 18, 'Past Due', 0.15, '2016-01-01', '2017-01-05', 500000.00, 60,26),
  1019. ( 202001, 18, 'Past Due', 0.15, '2016-01-01', '2017-01-05', 500000.00, 61,27),
  1020. ( 202002, 18, 'Past Due', 0.15, '2016-01-01', '2017-01-05', 500000.00, 62,28),
  1021. ( 202003, 19, 'Current Accounts', 0.12, '2016-01-01', '2017-01-05', 100000.00, 63,29),
  1022. ( 202004, 19, 'Current Accounts', 0.12, '2016-01-01', '2017-01-05', 200000.00, 64,30),
  1023. ( 202005, 19, 'Current Accounts', 0.12, '2016-01-01', '2017-01-05', 300000.00, 65,31),
  1024. ( 202006, 20, 'Current Accounts', 0.12, '2016-01-01', '2017-01-05', 700000.00, 68,32),
  1025. ( 202007, 20, 'Current Accounts', 0.12, '2016-01-01', '2017-01-05', 750000.00, 69,33),
  1026. ( 202008, 21, 'Current Accounts', 0.12, '2016-01-01', '2017-01-05', 250000.00, 72,34);
  1027.  
  1028. INSERT INTO pn_tbl ( pn_number, ref_loan_id, pn_status, pn_interest_rate, date_granted, maturity_date, amount_granted, ref_balance_id, ref_borrower_id) VALUES
  1029. ( 202009, 22, 'Current Accounts', 10, '2016-01-01', '2017-01-05', 1200000.00,75,35),
  1030. ( 202010, 22, 'Current Accounts', 10, '2016-05-11', '2017-02-20', 2800000.00, 76,36),
  1031. ( 202011, 22, 'Current Accounts', 10, '2016-05-12', '2017-03-19', 2000000.00, 77,37);
  1032.  
  1033. INSERT INTO pn_tbl ( pn_number, ref_loan_id, pn_status, pn_interest_rate, date_granted, maturity_date, amount_granted, ref_balance_id, ref_borrower_id) VALUES
  1034. ( 202012, 23, 'Current Accounts', 10, '2016-01-01', '2017-01-05', 1200000.00,79, 33),
  1035. ( 202013, 23, 'Current Accounts', 10, '2016-05-11', '2017-02-20', 2800000.00, 80, 33),
  1036. ( 202014, 23, 'Current Accounts', 10, '2016-05-12', '2017-03-19', 2000000.00, 81, 33);
  1037.  
  1038. INSERT INTO pn_tbl ( pn_number, ref_loan_id, pn_status, pn_interest_rate, date_granted, maturity_date, amount_granted, ref_balance_id, ref_borrower_id) VALUES
  1039. ( 202015, 24, 'Past Due', 0.16, '2016-01-01', '2017-01-05', 500000.00, 83,26),
  1040. ( 202016, 24, 'Past Due', 0.15, '2016-01-01', '2017-01-05', 500000.00, 84,27),
  1041. ( 202017, 24, 'Past Due', 0.14, '2016-01-01', '2017-01-05', 500000.00, 85,28),
  1042. ( 202018, 25, 'Current Accounts', 0.12, '2016-01-01', '2017-01-05', 100000.00, 86,29),
  1043. ( 202019, 25, 'Current Accounts', 0.12, '2016-01-01', '2017-01-05', 200000.00, 87,30),
  1044. ( 202020, 25, 'Current Accounts', 0.12, '2016-01-01', '2017-01-05', 300000.00, 88,31);
  1045.  
  1046. INSERT INTO pn_tbl ( pn_number, ref_loan_id, pn_status, pn_interest_rate, date_granted, maturity_date, amount_granted, ref_balance_id, ref_borrower_id) VALUES
  1047. ( 202021, 25, 'For Foreclosure', 10, '2016-01-01', '2017-01-05', 570000.00, 92,34),
  1048. ( 202022, 25, 'For Foreclosure', 10, '2016-01-01', '2017-01-05', 560000.00, 93,34),
  1049. ( 202023, 25, 'For Foreclosure', 10, '2016-01-01', '2017-01-05', 520000.00, 94,34);
  1050.  
  1051. INSERT INTO registry_of_deeds_tbl(registry_of_deeds) VALUES
  1052. ('RD - Manila'),
  1053. ('RD - Quezon City'),
  1054. ('RD - Makati City'),
  1055. ('RD - Pasay City'),
  1056. ('RD - Malabon / Navotas'),
  1057. ('RD - Valenzuela'),
  1058. ('RD - San Juan'),
  1059. ('RD - Mandaluyong'),
  1060. ('RD - Pasig City'),
  1061. ('RD - Parañaque'),
  1062. ('RD - Antipolo City'),
  1063. ('RD - Caloocan City'),
  1064. ('RD - Las Piñas'),
  1065. ('RD - Marikina City'),
  1066. ('RD - Muntinlupa City'),
  1067. ('RD - Province Of Rizal (Binangonan)'),
  1068. ('RD - Morong, Rizal'),
  1069. ('RD - Taguig City');
  1070.  
  1071. INSERT INTO collateral_tbl(collateral_number, ref_rd_id, address, appraisal_date, fmv) VALUES
  1072. ('TCT-101', 1, '6153 South Super Highway Makati, Philippines', '2017-09-12', 0),
  1073. ('TCT-102', 2, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', '2017-09-13', 0),
  1074. ('TCT-103', 3, '6153 South Super Highway Makati, Philippines', '2014-09-14', 0),
  1075. ('TCT-104', 4, '14 Zaragoza St. San Lorenzo Village, Makati', '2016-10-17', 0),
  1076. ('TCT-105', 5, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', '2015-08-07', 0),
  1077. ('TCT-106', 6, '6153 South Super Highway Makati, Philippines', '2016-01-29', 0),
  1078. ('TCT-107', 7, 'Kennedy Drive Pleasant View Subd. Tandang Sora, Queson City', '2011-12-26', 0),
  1079. ('TCT-108', 8, '14 Zaragoza St. San Lorenzo Village, Makati', '2012-11-08', 0),
  1080. ('TCT-109', 9, '6153 South Super Highway Makati, Philippines', '2013-11-02', 0),
  1081. ('TCT-110',10, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', '2017-07-14', 6000000.00),
  1082. ('TCT-111',11, '6153 South Super Highway Makati, Philippines', '2017-07-14', 75000.00),
  1083. ('TCT-112',12, 'Kennedy Drive Pleasant View Subd. Tandang Sora, Queson City', '2017-07-14', 150000.00),
  1084. ('TCT-113',13, '14 Zaragoza St. San Lorenzo Village, Makati', '2016-06-16', 0),
  1085. ('TCT-114',14, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', '2015-05-18', 200000.00),
  1086. ('TCT-115',15, '14 Zaragoza St. San Lorenzo Village, Makati', '2014-02-05', 4750000.00),
  1087. ('TCT-116',16, '6153 South Super Highway Makati, Philippines', '2014-02-05', 9500000.00),
  1088. ('TCT-117',17, 'Kennedy Drive Pleasant View Subd. Tandang Sora, Queson City', NULL, 0),
  1089. ('TCT-118',18, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', NULL, 0),
  1090. ('TCT-119',1, '14 Zaragoza St. San Lorenzo Village, Makati', NULL, 0),
  1091. ('TCT-120', 2, '6153 South Super Highway Makati, Philippines', NULL, 0),
  1092. ('TCT-121', 3, 'Kennedy Drive Pleasant View Subd. Tandang Sora, Queson City', NULL, 0),
  1093. ('TCT-122', 4, '14 Zaragoza St. San Lorenzo Village, Makati', NULL, 0),
  1094. ('TCT-123', 5, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', NULL, 0),
  1095. ('TCT-124', 6, '6153 South Super Highway Makati, Philippines', NULL, 0),
  1096. ('TCT-125', 7, 'Kennedy Drive Pleasant View Subd. Tandang Sora, Queson City', NULL, 0),
  1097. ('TCT-126', 8, '14 Zaragoza St. San Lorenzo Village, Makati', NULL, 0),
  1098. ('TCT-127', 9, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', NULL, 0),
  1099. ('TCT-128',10, '6153 South Super Highway Makati, Philippines', NULL, 0),
  1100. ('TCT-129',11, 'Kennedy Drive Pleasant View Subd. Tandang Sora, Queson City', NULL, 0),
  1101. ('TCT-130',12, '14 Zaragoza St. San Lorenzo Village, Makati', NULL, 0),
  1102. ('TCT-131',13, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', NULL, 0),
  1103. ('TCT-132',14, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', NULL, 0),
  1104. ('TCT-133',15, '6153 South Super Highway Makati, Philippines', NULL, 0),
  1105. ('TCT-134',16, '14 Zaragoza St. San Lorenzo Village, Makati', NULL, 0),
  1106. ('TCT-135',17, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', NULL, 0),
  1107. ('TCT-136',18, 'Kennedy Drive Pleasant View Subd. Tandang Sora, Queson City', NULL, 0),
  1108. ('TCT-137', 1, '14 Zaragoza St. San Lorenzo Village, Makati', NULL, 0),
  1109. ('TCT-138', 2, '6153 South Super Highway Makati, Philippines', NULL, 0),
  1110. ('TCT-139', 3, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', NULL, 0),
  1111. ('TCT-140', 4, 'Kennedy Drive Pleasant View Subd. Tandang Sora, Queson City', NULL, 0),
  1112. ('TCT-141', 5, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', NULL, 0),
  1113. ('TCT-142', 6, 'Kennedy Drive Pleasant View Subd. Tandang Sora, Queson City', NULL, 0),
  1114. ('TCT-143', 7, '6153 South Super Highway Makati, Philippines', NULL, 0),
  1115. ('TCT-144', 8, 'Block 5H Lot 27A Jade Heights Victoria Homes, Tunasan Muntinlupa City, Metro Manila', NULL, 0),
  1116. ('TCT-145', 9, '14 Zaragoza St. San Lorenzo Village, Makati', NULL, 0),
  1117. ('TCT-146',10, '6153 South Super Highway Makati, Philippines', NULL, 0),
  1118. ('TCT-147', 3, '6154 South Super Highway Makati, Philippines', NULL, 0);
  1119.  
  1120. INSERT INTO role_tbl(role) VALUES ('Maker'),('Reviewer'),('Approver');
  1121.  
  1122. INSERT INTO user_tbl(user_name, user_role_id) VALUES
  1123. ('Jane_Maker', 1),
  1124. ('John_Reviewer', 2),
  1125. ('Josh_Approver', 3),
  1126. ('fsm.maker', 1),
  1127. ('fsm.reviewer', 2),
  1128. ('fsm.approver', 3),
  1129. ('lmm.maker', 1),
  1130. ('lmm.reviewer', 2),
  1131. ('lmm.approver', 3);
  1132.  
  1133. INSERT INTO chart_of_accts_tbl(chart_account_ref_code,chart_account_title,chart_account_code,chart_default_entry_type) VALUES
  1134. ('PO-DLC-CASHCHK','DEPARTMENT OF LOANS AND CREDIT','172500000061000000','CREDIT');
  1135.  
  1136. INSERT INTO PAYMENT_ORDER_TBL(
  1137. payment_order_number, payment_order_date, bank_name, end_user_borrower, payment_order_status, or_number, or_date, user_name, receiving_office, bank_level_payment_type, total_payment_amount, payment_type, loan_type, payment_level)
  1138. VALUES('1113', '2017-07-06', 'Banco De Oro', 'Kevin Grosskreutz', 'SUBMITTED TO REVIEWER', '1', '2017-07-06', 'Jane_Maker', 'Cash Dept', 'MOST ONEROUS', 1000000.00, 'CASH/CHECK', 'Rediscounting', ''),
  1139. ('1121', '2017-05-21', 'Bank of the Philippine Islands', 'Bastian Schweinsteiger', 'COMPLETED', '3', '2017-05-21', 'Jane_Maker', 'Cash Dept', 'DLC CLAIMS', 2000000.00, 'CASH/CHECK', 'Rediscounting', ''),
  1140. ('1042', '2017-11-30', 'Metro Bank', 'Florian Grillitsch', 'SUBMITTED TO APPROVER', '2', '2017-11-30', 'Jane_Maker', 'Cash Dept', 'DLC CLAIMS', 3000000.00, 'CASH/CHECK', 'Rediscounting', ''),
  1141. ('1873', '2017-02-14', 'Bank of the Philippine Islands', 'Marcel Sabitzer', 'SUBMITTED TO REVIEWER', '4', '2017-02-14', 'Jane_Maker', 'Cash Dept', 'DLC CLAIMS', 100000.00, 'CASH/CHECK', 'Rediscounting', ''),
  1142. ('2334', '2017-03-06', 'Banco De Oro', 'Lionel Messi', 'SUBMITTED TO APPROVER', '5', '2017-03-06', 'Jane_Maker', 'Cash Dept', 'MOST ONEROUS', 100000.00, 'CASH/CHECK', 'Rediscounting', ''),
  1143. ('2001', '2017-05-21', 'Bank of the Philippine Islands', 'Luis Suarez', 'RETURNED TO MAKER', '6', '2017-05-21', 'Jane_Maker', 'Cash Dept', 'MOST ONEROUS', 10000000.00, 'CASH/CHECK', 'Rediscounting', 'BANK'),
  1144. ('1423', '2017-12-30', 'Metro Bank', 'Marcel Schmelzer', 'REJECTED', '7', '2017-12-30', 'Jane_Maker', 'Cash Dept', 'MOST ONEROUS', 100000.00, 'CASH/CHECK', 'Rediscounting', ''),
  1145. ('1356', '2017-01-14', 'Bank of the Philippine Islands', 'Arturo Vidal', 'DRAFT', '8', '2017-01-14', 'Jane_Maker', 'Cash Dept', 'DLC CLAIMS', 100000.00, 'CASH/CHECK', 'Rediscounting', ''),
  1146. ('5003', '2017-02-06', 'Banco De Oro', 'Gareth Bale', 'POSTED', '5', '2017-02-06', 'Jane_Maker', 'Cash Dept', 'DLC CLAIMS', 100000.00, 'CASH/CHECK', 'Rediscounting', ''),
  1147. ('1010', '2017-07-21', 'Metro Bank', 'Wayne Rooney', 'APPROVED', '6', '2017-07-21', 'Jane_Maker', 'Cash Dept', 'DLC CLAIMS', 100000.00, 'CASH/CHECK', 'Rediscounting', ''),
  1148. ('1169', '2017-08-30', 'Bank of the Philippine Islands', 'Manuel Neuer', 'COMPLETED', '7', '2017-08-30', 'Jane_Maker', 'Cash Dept', 'DLC CLAIMS', 100000.00, 'CASH/CHECK', 'Rediscounting', ''),
  1149. ('6934', '2017-06-14', 'Bank of the Philippine Islands', 'Keylor Navas', 'RETURNED TO MAKER', '8', '2017-06-14', 'Jane_Maker', 'Cash Dept', 'MOST ONEROUS', 10000000.00, 'CASH/CHECK', 'Rediscounting', 'BANK');
  1150.  
  1151. INSERT INTO PAYMENT_ORDER_TBL(
  1152. payment_order_number, payment_order_date, bank_name, end_user_borrower, payment_order_status, payment_level, or_number, or_date, user_name, receiving_office, bank_level_payment_type, total_payment_amount, payment_type, loan_type)
  1153. VALUES('0001', '2017-07-06', 'Rizal Commercial Banking Corporation', 'Kevin Grosskreutz', 'Approved', 'PN', '0001', '2017-07-06', 'Jane_Maker', 'Cash Dept', '', 1000000.00, 'CASH/CHECK', 'Rediscounting'),
  1154. ('0002', '2017-05-21', 'Rizal Commercial Banking Corporation', 'Bastian Schweinsteiger', 'Approved', 'PN', '0003', '2017-05-21', 'Jane_Maker', 'Cash Dept', '', 1000000.00, 'CASH/CHECK', 'Rediscounting'),
  1155. ('0003', '2017-02-14', 'Rizal Commercial Banking Corporation', 'Marcel Sabitzer', 'Approved', 'PN', '0004', '2017-02-14', 'Jane_Maker', 'Cash Dept', '', 1000000.00, 'CASH/CHECK', 'Rediscounting'),
  1156. ('0004', '2017-03-06', 'United Coconut Planters Bank', 'Lionel Messi', 'Approved', 'PN', '0005', '2017-03-06', 'Jane_Maker', 'Cash Dept', '', 3000000.00, 'CASH/CHECK', 'Rediscounting'),
  1157. ('0005', '2017-05-21', 'Rizal Commercial Banking Corporation', 'Luis Suarez', 'Approved', 'PN', '0007', '2017-05-21', 'Jane_Maker', 'Cash Dept', '', 3000000.00, 'CASH/CHECK', 'Rediscounting'),
  1158. ('0006', '2017-01-14', 'Rizal Commercial Banking Corporation', 'Arturo Vidal', 'Approved', 'PN', '0008', '2017-01-14', 'Jane_Maker', 'Cash Dept', '', 1000000.00, 'CASH/CHECK', 'Rediscounting'),
  1159. ('0007', '2017-02-06', 'United Coconut Planters Bank', 'Gareth Bale', 'Rejected', 'PN', '0009', '2017-02-06', 'Jane_Maker', 'Cash Dept', '', 1000000.00, 'CASH/CHECK', 'Rediscounting'),
  1160. ('0008', '2017-08-30', 'Rizal Commercial Banking Corporation', 'Manuel Neuer', 'Completed', 'PN', '0010', '2017-08-30', 'Jane_Maker', 'Cash Dept', '', 1000000.00, 'CASH/CHECK', 'Rediscounting'),
  1161. ('0009', '2017-06-14', 'Rizal Commercial Banking Corporation', 'Keylor Navas', 'Returned', 'PN', '0011', '2017-06-14', 'Jane_Maker', 'Cash Dept', '', 1000000.00, 'CASH/CHECK', 'Rediscounting'),
  1162. ('0010', '2017-07-14', 'Bank of the Philippine Islands', 'Nyeamm Gaza', 'Approved','LOAN', '0011', '2017-07-14', 'Jane_Maker', 'Cash Dept', '', 1000000.00, 'CASH/CHECK', 'Rediscounting' ),
  1163. ('0011', '2017-07-14', 'Banco De Oro', 'Bill Gates', 'Approved', 'BANK', '0012', '2017-07-14', 'Jane_Maker', 'Cash Dept', 'MOST ONEROUS', 1000000.00, 'CASH/CHECK', 'Rediscounting');
  1164.  
  1165. INSERT INTO TRANSACTION_TBL(payment_number, payment_order_number, transaction_date, total_payment, year_created, payment_date, transaction_type, status) VALUES
  1166. ('2017001234', '1113','2017-07-03', 1000000.00, 2017, '2017-03-22', 'PO', 'POSTED');
  1167.  
  1168. INSERT INTO TRANSACTION_TBL(payment_number, payment_order_number, transaction_date, total_payment, year_created, payment_date, transaction_type) VALUES
  1169. ('2017002345', '1121','2017-07-03', 2000000.00, 2017, '2017-04-20', 'PO'),
  1170. ('2017004567', '1042','2017-07-03', 3000000.00, 2017, '2017-06-20', 'PO'),
  1171. ('2017001002', '1873', '2017-07-17', 100000.00, 2017, '2017-07-17', 'PO'),
  1172. ('2017001003', '2334', '2017-07-17', 100000.00, 2017, '2017-07-17', 'PO'),
  1173. ('2017001004', '2001', '2017-07-17', 10000000.00, 2017, '2017-07-17', 'PO'),
  1174. ('2017001005', '1423', '2017-07-17', 100000.00, 2017, '2017-07-17', 'PO'),
  1175. ('2017002001', '1356', '2017-07-17', 100000.00, 2017, '2017-07-17', 'PO'),
  1176. ('2017002002', '5003', '2017-07-16', 100000.00, 2017, '2017-07-16', 'PO'),
  1177. ('2017002003', '1010', '2017-07-16', 100000.00, 2017, '2017-07-16', 'PO'),
  1178. ('2017002004', '1169', '2017-07-16', 100000.00, 2017, '2017-07-16', 'PO'),
  1179. ('2017002005', '6934', '2017-07-16', 10000000.00, 2017, '2017-07-16', 'PO');
  1180.  
  1181. INSERT INTO TRANSACTION_TBL(pn_number, payment_number, year_created, status) VALUES
  1182. (201771, '9991', 2010, 'POSTED'),
  1183. (201772, '9992', 2011, 'POSTED'),
  1184. (201773, '9993', 2014, 'POSTED');
  1185.  
  1186. INSERT INTO rediscounting_interest_rates_tbl (effectivity_date, red_interest_rate) VALUES
  1187. ('2017-06-01', 0.045);
  1188.  
  1189.  
  1190. UPDATE BALANCE_TBL BAL
  1191. SET (BAL.REF_ID, BAL.BALANCE_TYPE) = (
  1192. SELECT PN.PN_ID, 'PN'
  1193. FROM PN_TBL PN
  1194. WHERE PN.REF_BALANCE_ID = BAL.BALANCE_ID
  1195. )
  1196. WHERE BAL.BALANCE_ID IN (
  1197. SELECT PN.REF_BALANCE_ID FROM PN_TBL PN
  1198. );
  1199.  
  1200. UPDATE BALANCE_TBL BAL
  1201. SET (BAL.REF_ID, BAL.BALANCE_TYPE) = (
  1202. SELECT LOAN.LOAN_ID, 'LOAN'
  1203. FROM LOAN_TBL LOAN
  1204. WHERE LOAN.REF_BALANCE_ID = BAL.BALANCE_ID
  1205. )
  1206. WHERE BAL.BALANCE_ID IN (
  1207. SELECT LOAN.REF_BALANCE_ID FROM LOAN_TBL LOAN
  1208. );
  1209.  
  1210. UPDATE BALANCE_TBL BAL
  1211. SET (BAL.REF_ID, BAL.BALANCE_TYPE) = (
  1212. SELECT BANK.BANK_ID, 'BANK'
  1213. FROM BANK_TBL BANK
  1214. WHERE BANK.REF_BALANCE_ID = BAL.BALANCE_ID
  1215. )
  1216. WHERE BAL.BALANCE_ID IN (
  1217. SELECT BANK.REF_BALANCE_ID FROM BANK_TBL BANK
  1218. );
  1219.  
  1220. INSERT INTO SAP_TBL(sap_number, accrued_interest_payment_date, accrued_interest_payment, unpaid_accrued_interest, pn_number)
  1221. VALUES ('9991', '2010-10-08', 15000.00, 1722.22, 201771);
  1222.  
  1223. INSERT INTO SAP_TBL(sap_number, liquidated_damages_payment_date, liquidated_damages_payment, accrued_interest_payment_date, accrued_interest_payment, interest_income_payment_date, interest_income_payment, unpaid_interest_income, pn_number)
  1224. VALUES ('9992', '2011-03-06', 3402.78, '2011-03-06', 25000.00, '2011-03-06', 1000.00, 5805.56, 201772);
  1225.  
  1226. INSERT INTO SAP_TBL(sap_number, liquidated_damages_payment_date, liquidated_damages_payment, unpaid_liquidated_damages, pn_number)
  1227. VALUES ('9993', '2014-10-01', 70000.00, 17500.00, 201773);
  1228.  
  1229. INSERT INTO SAP_TBL(sap_number, pn_number, liquidated_damages_payment_date)
  1230. VALUES ('2017001234', 201712, '2016-05-16');
  1231.  
  1232.  
  1233. INSERT INTO payable_tbl (ref_payment_order_id,promissory_note_number,loan_application_number,
  1234. collateral_number,borrower_id,borrower_name,amount_granted,outstanding_principal_balance,
  1235. total_outstanding_balance,other_expenses,payment_amount,excess_amount,excess_payment_type, pn_outstanding_balance) VALUES
  1236. (8,201744,999992,'TCT-118',18,'Henry Sy',1500000.00,1500000.00,2044400.00,67000.00,4000000.00,1888600.00,'Most Onerous', 0),
  1237. (6,NULL,NULL,NULL,NULL,NULL,10000000.00,4000000.00,5232000.00,20000.00,2000000.00,1500000.00,'DLC Claims', 4000000.00),
  1238. (12,NULL,NULL,NULL,NULL,NULL,10000000.00,4000000.00,5232000.00,20000.00,3000000.00,2000000.00,'Most Onerous', 4000000.00),
  1239. (13,202000,999901,'TCT-126',26,'Gil More',500000.00,225000.00,500000.00,0,2000000.00,1500000.00,'DLC Claims', 0),
  1240. (14,202001,999901,'TCT-127',27,'Empoy Incheon',500000.00,200000.00,500000.00,0,1100000.00,600000.00,'Most Onerous', 0),
  1241. (15,202002,999901,'TCT-128',28,'Mara Doria',500000.00,225000.00,500000.00,0,1200000.00,700000.00,'DLC Claims', 0),
  1242. (16, 202006, 999903, 'TCT-132', 32, 'Eddie Murphy', 700000.00, 350000.00, 700000.00, 0, 2000000.00, 1300000.00, 'Most Onerous', 0),
  1243. (16, 202008, 999904, 'TCT-134', 34, 'Bailey Ann', 250000.00, 125000.00, 250000.00, 0, 1000000.00, 750000.00, 'Most Onerous', 0),
  1244. (17, 202002, 999901, 'TCT-128', 28, 'Mara Doria', 500000.00, 225000.00, 500000.00, 0, 2000000.00, 1500000.00, 'DLC Claims', 0),
  1245. (17, 202003, 999902, 'TCT-129', 29, 'Teddy Quila', 100000.00, 55000.00, 100000.00, 0, 1000000.00, 900000.00, 'DLC Claims', 0),
  1246. (22, NULL, 999902, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10000000, NULL, 'Most Onerous', 0),
  1247. (23, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10000000, NULL, 'Most Onerous', 0);
  1248.  
  1249. INSERT INTO foreclosure_status_tbl (status_name, status_description)
  1250. VALUES
  1251. ('New', 'New'),
  1252. ('Referred to Lawyer', 'Referred to Lawyer'),
  1253. ('Draft Petition for Foreclosure under review', 'Draft Petition for Foreclosure under review'),
  1254. ('Draft Petition for Foreclosure forwarded to Lawyer', 'Draft Petition for Foreclosure forwarded to Lawyer'),
  1255. ('Petition Filed', 'Petition Filed'),
  1256. ('With Notice of Auction', 'With Notice of Auction'),
  1257. ('Bid Price Approved', 'Bid Price Approved'),
  1258. ('Bid Price Forwarded to Lawyer', 'Bid Price Forwarded to Lawyer'),
  1259. ('For Payment of Court''s Commission', 'For Payment of Court''s Commission'),
  1260. ('Submitted to RD for COS Annotation', 'Submitted to RD for COS Annotation'),
  1261. ('Foreclosure Booked', 'Foreclosure Booked'),
  1262. ('Turned Over to Asset Management Department', 'Turned Over to Asset Management Department'),
  1263. ('Awaiting Receipt of Winning Bid', 'Awaiting Receipt of Winning Bid'),
  1264. ('Winning Bid Received', 'Winning Bid Received'),
  1265. ('Released to Winning Bidder', 'Released to Winning Bidder');
  1266.  
  1267. INSERT INTO LAWYER_TBL (lawyer_name, lawyer_address, vat_registered, remarks)
  1268. VALUES ('ABELARDO P. DE JESUS '||chr(38)||' SIEGFRIED A. YBANEZ LAW FIRM', 'Unit 431 Park Avenue Mansion Park Avenue, Pasay City', 1, NULL) ,
  1269. ('ATTY. FE BECINA-MACALINO '||chr(38)||' ASSOCIATES', 'Unit 7-L Westgate Tower Condominium Madrigal Business Center Ayala Alabang Muntinlupa City', 1, NULL) ,
  1270. ('BERNALDO DIRECTO '||chr(38)||' PO LAW OFFICES', 'Unit 1807 Cityland Condominium 10-Tower 1 6815 Ayala Ave. corner H. V. dela Costa St., Makati City', 1, NULL) ,
  1271. ('CRUZ MARCELO '||chr(38)||' TENEFRANCIA', '9th, 10th, 11th '||chr(38)||' 12th Floors, One Orion 11th Avenue corner University Parkway Bonifacio Global City 1634', 1, NULL) ,
  1272. ('GONZAGA LAW OFFICE', 'Unit 405 Jade Center Building 105 Shaw Boulevard, 1600 Pasig City', 0, NULL) ,
  1273. ('AGBAYANI '||chr(38)||' MENDOZA ATTORNEYS-AT-LAW', 'Unit 602 West Insula, 135 West Avenue 1105 Quezon City', 0, NULL) ,
  1274. ('CUSTODIO ACORDA SICAM DE CASTRO '||chr(38)||' PANGANIBAN LAW OFFICES', '15th Floor, Citibank Tower Condominium Villar corner Valero Streets, Salcedo Village, 1227 Makati City', 1, 'formerly Ongkiko Manhit Custodio '||chr(38)||' Acorda Law Offices (OCMALAW)') ,
  1275. ('R.S. REYES LAW OFFICES', 'Unit 406-407 Cornell St., South Point Town Homes Village, Brgy. Merville Leviste Avenue, Paranaque City', 1, NULL) ,
  1276. ('TAGAYUNA PANOPIO ESCOBER LAW FIRM', '2nd Floor, AZPHI Bldg., 2709 Ma. Aurora St. corner E. Zobel St., Poblacion, Makati City', 1, NULL) ;
  1277.  
  1278. INSERT INTO LAWYER_CONTACT_TBL (contact_type, contact, ref_lawyer_id) VALUES
  1279. ('EMAIL', 'abeldj_13@yahoo.com', 1),('PHONE', '832-8027', 1),('FAX', '831-9154', 1),
  1280. ('EMAIL', 'macalinofe@yahoo.com', 2),('PHONE', '846-9188', 2),('EMAIL', 'legal@bdplaw.com.ph', 3),
  1281. ('EMAIL', 'cherry.bernaldo@rsbernaldo.com', 3),('PHONE', '840-0535 to 38', 3),('FAX', '893-3383', 3),
  1282. ('EMAIL', 'info@cruzmarcelo.com', 4),('PHONE', '810-5858', 4),('FAX', '810-3838', 4),
  1283. ('EMAIL', 'gonzagalawoffice2000@yahoo.com', 5),('PHONE', '667-3479', 5),
  1284. ('EMAIL', 'agbayanimendoza@yahoo.com', 6),('PHONE', '664-4778', 6),('PHONE', '783-8354', 6),
  1285. ('EMAIL', 'ocmalaw@eastern.com.ph', 7),('PHONE', '819-1624', 7),('PHONE', '5051 to 53', 7),('FAX', '819-2978', 7),
  1286. ('EMAIL', 'rsreyes.lawoffices@yahoo.com', 8),('PHONE', '631-3013', 8),('FAX', '631-3013', 8),
  1287. ('EMAIL', 'panopio_escober@yahoo.com', 9),('FAX', '846-2014', 9);
  1288.  
  1289. INSERT INTO approval_status_tbl(approval_status)
  1290. VALUES
  1291. ('Draft'),
  1292. ('Return to Maker'),
  1293. ('Submitted to Reviewer'),
  1294. ('Submitted to Approver'),
  1295. ('Approved');
  1296.  
  1297. INSERT INTO foreclosure_tbl (dts_number, ref_lawyer_id, ref_original_lawyer_id, ref_approval_status_id, registered_owner, foreclosure_ref_number, transaction_date, ref_foreclosure_status_id, status_filter) values
  1298. ('1234567', 1, 1, 1, 'James C. Yap', '2017000234', '2017-07-25', 2, 'ONGOING'),
  1299. ('3697451', 2, 1, 3, 'Paul Manahan', '2017000235', '2017-07-24', 12, 'ONGOING'),
  1300. ('1321546', 3, 3, 4, 'Bryanne Marco', '2017000236', '2017-07-23', 4, 'ONGOING'),
  1301. ('1234654', 4, 4, 2, 'Meri Lee', '2017000237', '2017-07-22', 4,'ONGOING'),
  1302. ('7897974', NULL, NULL, 1, 'Edward Catala', '2017000238', '2017-07-21', 5,'ONGOING'),
  1303. ('1354862', NULL, 5, 3, 'Anjeli Bunoan', '2017000239', '2017-07-20', 9,'ONGOING'),
  1304. ('7897975', NULL, NULL, 1, 'Bryanne Catala', '2017000240', '2017-07-21', 1,'ONGOING'),
  1305. ('7897977', NULL, 5, 4, 'James Bunoan', '2017000242', '2017-07-20', 7,'ONGOING'),
  1306. ('7897978', 5, 5, 4, 'James Marco', '2017000243', '2017-07-21', 10,'ONGOING'), -- TEST DATA FOR LMM-FOR-RC-006. DO NOT CHANGE STATUS
  1307. ('7897979', 5, 5, 4, 'James Marco jr', '2017000244', '2017-07-21', 10,'ONGOING'), -- TEST DATA FOR LMM-FOR-RC-006. DO NOT CHANGE STATUS
  1308. ('99991987', 1, 1, 1, 'Tiffa Lockheart', '201719998', '2017-07-25', 14, 'ONGOING'), -- TEST DATA FOR LMM-FOR-WB-016. DO NOT CHANGE STATUS
  1309. ('99991988', 2, 1, 1, 'Thomas Gilmorety', '201719890', '2017-07-17', 14, 'ONGOING'), -- TEST DATA FOR LMM-FOR-WB-016. DO NOT CHANGE STATUS
  1310. ('99991989', 3, 1, 1, 'Yuan Passer', '201716998', '2017-06-25', 14, 'ONGOING'), -- TEST DATA FOR LMM-FOR-WB-016. DO NOT CHANGE STATUS
  1311. ('99991911', 1, 1, 3, 'Roberto Sembrano', '201716911', '2017-06-25', 1, 'ONGOING'), -- TEST DATA FOR LMM-FOR-BOF-019.
  1312. ('999919122', 2, 2, 3, 'Fhil Man', '2017169122', '2017-06-25', 1, 'ONGOING'), -- TEST DATA FOR LMM-FOR-BOF-019.
  1313. ('999919111', 3, 1, 3, 'Langka Sing', '2017169111', '2017-06-25', 1, 'ONGOING'); -- TEST DATA FOR LMM-FOR-BOF-019.
  1314.  
  1315. INSERT INTO foreclosure_tbl (dts_number, ref_lawyer_id, ref_original_lawyer_id, ref_approval_status_id, registered_owner, foreclosure_ref_number, transaction_date, ref_foreclosure_status_id, status_filter, date_booked_to_ip, publication_name, volume, issue_numbers) values
  1316. ('7897976', NULL, 3, 1, 'Bryanne Catala jr', '2017000341', '2017-07-21', 11,'ONGOING', '2017-08-24', 'Balita Pampanga', 'XIV', '2,3,4'),
  1317. ('1234567', NULL, 4, 2, 'Anjeli Bunoan jr', '2017000342', '2017-07-20', 11, 'ONGOING', '2017-08-25', 'Balita Manila', 'XII', '5,6,7');
  1318.  
  1319. INSERT INTO PETITION_TBL (ref_foreclosure_id, ref_bank_id, bank_name, loan_type, loan_application_number, ref_pn_id, promissory_note_number, promissory_note_face_amount, ref_collateral_id, collateral_number, ref_borrower_id, entity_name, full_name, outstanding_balance, last_interest_payment_date, interest_rate, penalty_rate, service_charge_rate, other_charges)
  1320. VALUES
  1321. (1, 1, 'Bank of the Philippine Islands', 'Rediscounting', 123456, 1, 201712, 1200000.00, 1, 'TCT-101', 1, 'Mcdonalds', 'Ray Kroc', 900000.00, '1999-05-21', 0.10, 0.20, 0.30, 900001.00),
  1322. (2, 1, 'Bank of the Philippine Islands', 'Rediscounting', 123456, 2, 201723, 2800000.00, 2, 'TCT-102', 2, 'Jollibee', 'Tony Tan Caktiong', 800000.00, '1999-05-21', 0.10, 0.20, 0.30, 800001.00),
  1323. (2, 1, 'Bank of the Philippine Islands', 'Rediscounting', 123456, 2, 201723, 2800000.00, 3, 'TCT-103', 2, 'Jollibee', 'Tony Tan Caktiong', 800000.00, '1999-05-21', 0.10, 0.20, 0.30, 800001.00),
  1324. (3, 1, 'Bank of the Philippine Islands', 'Rediscounting', 234567, 3, 201734, 1700000.00, 3, 'TCT-103', 3, 'KFC', 'Colonel Sanders', 700000.00, '1999-05-21', 0.10, 0.20, 0.30, 700001.00),
  1325. (4, 1, 'Bank of the Philippine Islands', 'Rediscounting', 234567, 4, 201745, 1100000.00, 4, 'TCT-104', 4, 'Mang Inasal', 'Edgar Sia', 600000.00, '1999-05-21', 0.10, 0.20, 0.30, 600001.00),
  1326. (5, 2, 'Banco De Oro', 'Rediscounting', 345678, 5, 201756, 1300000.00, 5, 'TCT-105', 5, 'Wendys', 'Dave Thomas', 500000.00, '1999-05-21', 0.10, 0.20, 0.30, 500001.00),
  1327. (6, 2, 'Banco De Oro', 'Rediscounting', 345678, 6, 201767, 1500000.00, 6, 'TCT-106', 6, 'Coca-Cola', 'John Smith Pemberton', 400000.00, '1999-05-21', 0.10, 0.20, 0.30, 400001.00),
  1328. (7, 2, 'Banco De Oro', 'Rediscounting', 345678, 6, 201767, 1500000.00, 6, 'TCT-107', 6, 'Coca-Cola', 'John Smith Pemberton', 300000.00, '1999-05-21', 0.10, 0.20, 0.30, 300001.00),
  1329. (8, 2, 'Banco De Oro', 'Rediscounting', 345678, 6, 201767, 1500000.00, 6, 'TCT-108', 6, 'Coca-Cola', 'John Smith Pemberton', 200000.00, '1999-05-21', 0.10, 0.20, 0.30, 200001.00),
  1330. (9, 2, 'Banco De Oro', 'Rediscounting', 345678, 6, 201767, 1500000.00, 6, 'TCT-109', 6, 'Coca-Cola', 'John Smith Pemberton', 100000.00, '1999-05-21', 0.10, 0.20, 0.30, 100001.00),
  1331. (10, 2, 'Banco De Oro', 'Rediscounting', 345678, 6, 201767, 1500000.00, 6, 'TCT-110', 6, 'Coca-Cola', 'John Smith Pemberton', 100000.00, '1999-05-21', 0.10, 0.20, 0.30, 100001.00),
  1332. (11, 2, 'Banco De Oro', 'Rediscounting', 345678, 6, 201767, 1500000.00, 6, 'TCT-111', 6, 'Coca-Cola', 'John Smith Pemberton', 100000.00, '1999-05-21', 0.10, 0.20, 0.30, 100001.00),
  1333. (12, 13, 'United Coconut Planters Bank', 'Rediscounting', 999904, 39, 202007, 1990000.00, 40, 'TCT-140', 28, 'Matador', 'Mara Doria', 950000.00, '2009-05-21', 0.10, 0.20, 0.30, 900001.00), -- TEST DATA FOR LMM-FOR-WB-016.
  1334. (13, 13, 'United Coconut Planters Bank', 'Rediscounting', 999904, 39, 202007, 2000000.00, 40, 'TCT-140', 28, 'Matador', 'Mara Doria', 950000.00, '2009-05-21', 0.10, 0.20, 0.30, 900001.00), -- TEST DATA FOR LMM-FOR-WB-016.
  1335. (14, 13, 'United Coconut Planters Bank', 'Rediscounting', 999904, 39, 202007, 5000000.00, 40, 'TCT-140', 28, 'Matador', 'Mara Doria', 950000.00, '2009-05-21', 0.10, 0.20, 0.30, 900001.00), -- TEST DATA FOR LMM-FOR-WB-016.
  1336. (15, 13, 'United Coconut Planters Bank', 'Rediscounting', 999904, 39, 202007, 1990000.00, 40, 'TCT-140', 28, 'Dairy Queen', 'Krystal Del Torre', 950000.00, '2009-05-21', 0.10, 0.20, 0.30, 900001.00), -- TEST DATA FOR LMM-FOR-BOF-019.
  1337. (16, 13, 'United Coconut Planters Bank', 'Rediscounting', 999904, 39, 202007, 2000000.00, 40, 'TCT-140', 28, 'Dairy Queen', 'Krystal Del Torre', 950000.00, '2009-05-21', 0.10, 0.20, 0.30, 900001.00), -- TEST DATA FOR LMM-FOR-BOF-019.
  1338. (17, 13, 'United Coconut Planters Bank', 'Rediscounting', 999904, 39, 202007, 5000000.00, 40, 'TCT-140', 28, 'Dairy Queen', 'Krystal Del Torre', 950000.00, '2009-05-21', 0.10, 0.20, 0.30, 900001.00), -- TEST DATA FOR LMM-FOR-BOF-019.
  1339. (18, 1, 'Bank of the Philippine Islands', 'Rediscounting', 234567, 4, 201745, 1100000.00, 40, 'TCT-140', 4, 'Mang Inasal', 'Edgar Sia', 600000.00, '1999-05-21', 0.10, 0.20, 0.30, 600001.00); -- TEST DATA FOR TRC.
  1340.  
  1341. INSERT INTO AUCTION_TBL (ref_foreclosure_id, foreclosure_ref_number, rtc, ejf_number, hbu_property, pwd, fmv, area, tct_number, registered_owner)
  1342. VALUES
  1343. (1,2017000234,'RTC234','EJF234','Agricultural',1,2000000,10000,'TCT-101','James C. Yap'),
  1344. (2,2017000235,'RTC235','EJF235','Residential',1,2800000,2000,'TCT-102','Paul Manahan'),
  1345. (3,2017000236,'RTC236','EJF236','Commercial',1,3700000,3000,'TCT-103','Bryanne Marco'),
  1346. (4,2017000237,'RTC237','EJF237','Industrial',1,4500000,6000,'TCT-104','Meri Lee'),
  1347. (5,2017000238,'RTC238','EJF238','Seaport',1,4100000,5000,'TCT-105','Edward Catala'),
  1348. (6,2017000239,'RTC239','EJF239','Airport',1,6200000,12000,'TCT-106','Anjeli Bunoan'),
  1349. (7,2017000240,'RTC240','EJF240','Civic',1,1900000,4000,'TCT-107','Bryanne Catala'),
  1350. (17,2017000341,'RTC241','EJF241','Military',1,1400000,7000,'TCT-108','Bryanne Catala jr'),
  1351. (18,2017000342,'RTC242','EJF242','Landfill',1,1300000,8000,'TCT-109','Anjeli Bunoan jr'),
  1352. (8,2017000242,'RTC242','EJF242','Landfill',1,1300000,8000,'TCT-109','James Bunoan'),
  1353. (9,2017000243,'RTC242','EJF242','Landfill',1,1300000,8000,'TCT-110','James Bunoan'),
  1354. (10,2017000244,'RTC242','EJF242','Landfill',1,1300000,8000,'TCT-111','James Bunoan'),
  1355. (11,201719998,'RTC9981','EJF9981','Military',1,2990000,10000,'TCT-141','Tiffa Lockheart'), -- TEST DATA FOR LMM-FOR-WB-016.
  1356. (12,201719890,'RTC9934','EJF9934','Agricultural',1,2990000,10000,'TCT-141','Thomas Gilmorety'), -- TEST DATA FOR LMM-FOR-WB-016.
  1357. (13,201716998,'RTC9980','EJF9980','Landfill',1,2990000,10000,'TCT-141','Yuan Passer'), -- TEST DATA FOR LMM-FOR-WB-016.
  1358. (14,201716911,'RTC998221','EJF998221','Military',1,2990000,10000,'TCT-141','Roberto Sembrano'), -- TEST DATA FOR LMM-FOR-BOF-019.
  1359. (15,2017169122,'RTC993422','EJF993422','Agricultural',1,2990000,10000,'TCT-141','Fhil Man'), -- TEST DATA FOR LMM-FOR-BOF-019.
  1360. (16,2017169111,'RTC9980222','EJF9980222','Landfill',1,2990000,10000,'TCT-141','Langka Sing'); -- TEST DATA FOR LMM-FOR-BOF-019.
  1361.  
  1362. INSERT INTO BID_TBL (ref_auction_id, applicable_adjustment_rate, appraised_value, appraisal_cost, filing_fee, bank_principal, bank_interest, bank_penalties, bsp_principal, bsp_booked_interest, bsp_unbooked_interest_income, bsp_unbooked_liquidated_damages)
  1363. VALUES
  1364. ('1',1,2200000,788,19790,250000,2500,2000,330000,1500,1000,3000),
  1365. ('2',1,3100000,788,19790,260000,2500,2000,320000,1500,1000,3000),
  1366. ('3',1,3800000,788,19790,270000,2500,2000,310000,1500,1000,3000),
  1367. ('4',1,4900000,788,19790,280000,2500,2000,300000,1500,1000,3000),
  1368. ('5',1,4500000,788,19790,290000,2500,2000,290000,1500,1000,3000),
  1369. ('6',1,6700000,788,19790,300000,2500,2000,280000,1500,1000,3000),
  1370. ('7',1,2400000,788,19790,310000,2500,2000,270000,1500,1000,3000),
  1371. ('8',1,1600000,788,19790,320000,2500,2000,260000,1500,1000,3000),
  1372. ('9',1,1500000,788,19790,330000,2500,2000,250000,1500,1000,3000),
  1373. ('10',1,1500000,788,19790,330000,2500,2000,250000,1500,1000,3000),
  1374. ('11',1,1500000,788,19790,330000,2500,2000,250000,1500,1000,3000),
  1375. ('12',1,2330000,788,19790,250000,2500,20090,330000,1500,10900,3067800), -- TEST DATA FOR LMM-FOR-WB-016.
  1376. ('13',1,3109900,788,19790,260000,25900,20090,3200900,15900,1000,39000), -- TEST DATA FOR LMM-FOR-WB-016.
  1377. ('14',1,3809980,788,19790,2700800,2500,20900,310000,1500,1000,30900); -- TEST DATA FOR LMM-FOR-WB-016.
  1378.  
  1379. INSERT INTO bidder_details_tbl (bidder_name, amount, ref_auction_id, default_flag, delete_flag)
  1380. VALUES
  1381. ('BSP', 5000000, 1, 1, 0),
  1382. ('PTC', 100, 1, 0, 0),
  1383. ('BPI', 7000000, 1, 0, 0),
  1384. ('BDO', 4000000, 1, 0, 0),
  1385. ('BSP', 45000000, 2, 1, 0),
  1386. ('BSP', 5000000, 12, 1, 0),('PSBANK', 10000, 12, 0, 0), -- TEST DATA FOR LMM-FOR-WB-016.
  1387. ('BSP', 2000000, 13, 1, 0),('BPI', 3110000, 13, 0, 0), -- TEST DATA FOR LMM-FOR-WB-016.
  1388. ('BSP', 9000000, 14, 1, 0),('BDO', 1000000, 14, 0, 0); -- TEST DATA FOR LMM-FOR-WB-016.
  1389.  
  1390. INSERT INTO winning_bidder_tbl (ref_bidder_id, reason)
  1391. VALUES
  1392. (1, 'bid not paid');
  1393.  
  1394. UPDATE AUCTION_TBL
  1395. SET ref_bidder_id = 3
  1396. WHERE auction_id = 1;
  1397.  
  1398. /*Testdata for FSM-PO-SAP-016*/
  1399. INSERT INTO PAYMENT_ORDER_TBL(
  1400. payment_order_number, payment_order_date, bank_name, end_user_borrower, payment_order_status, or_number, or_date, user_name, receiving_office, bank_level_payment_type, total_payment_amount, payment_type, loan_type, payment_level)
  1401. VALUES('2017123456', '2017-07-06', 'United Coconut Planters Bank', 'Dell Mundo', 'DRAFT', '01234', '2017-08-05', 'Jane_Maker', 'Cash Dept', 'MOST ONEROUS', 80000000.00, 'CASH/CHECK', 'Rediscounting', 'PN');
  1402.  
  1403. INSERT INTO PAYABLE_TBL (ref_payment_order_id,promissory_note_number,loan_application_number,
  1404. collateral_number,borrower_id,borrower_name,amount_granted,outstanding_principal_balance,
  1405. total_outstanding_balance,other_expenses,payment_amount,excess_amount,excess_payment_type) VALUES
  1406. ((SELECT MAX(payment_order_id) FROM PAYMENT_ORDER_TBL),202003,999903,'TCT-129',35,'Dell Mundo',100000.00,55000.00,100000.00,0,40000000.00,39900000.00,'Most Onerous'),
  1407. ((SELECT MAX(payment_order_id) FROM PAYMENT_ORDER_TBL),202004,999903,'TCT-130',35,'Dell Mundo',200000.00,110000.00,200000.00,0,40000000.00,39800000.00,'Most Onerous');
  1408.  
  1409. INSERT INTO TRANSACTION_TBL(payment_number, payment_order_number, transaction_date, total_payment, year_created, payment_date, transaction_type) VALUES
  1410. ('2017123456', '2017123456','2017-07-03', 80000000.00, 2017, '2017-03-22', 'PO');
  1411.  
  1412. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1413. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1414. VALUES(2017123456, 202003, 'PN', 40000000.00, 0.00, 10000.00, 20000.00, 15000.00, 0.00, 0.00, 0.00, '2017-08-10', 0.00);
  1415.  
  1416. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1417. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1418. VALUES(2017123456, 202004, 'PN', 40000000.00, 0.00, 40000.00, 20000.00, 30000.00, 0.00, 0.00, 0.00, '2017-08-10', 0.00);
  1419.  
  1420. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1421. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1422. VALUES(2017123456, 202005, 'Excess Most Onerous', 0.00, 0.00, 30000.00, 60000.00, 45000.00, 0.00, 0.00, 0.00, '2017-08-10', 0.00);
  1423.  
  1424. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1425. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1426. VALUES(2017123456, 202006, 'Excess Most Onerous', 0.00, 0.00, 125000.00, 100000.00, 125000.00, 0.00, 0.00, 0.00, '2017-08-10', 0.00);
  1427.  
  1428. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1429. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1430. VALUES(2017123456, 202007, 'Excess Most Onerous', 0.00, 0.00, 250000.00, 75000.00, 100000.00, 0.00, 0.00, 0.00, '2017-08-10', 0.00);
  1431.  
  1432. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1433. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, miscellaneous_income)
  1434. VALUES(2017123456, '', 'Excess on Excess', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 77950000.00);
  1435.  
  1436. /*Testdata for FSM-PO-SAP-010*/
  1437. INSERT INTO PAYMENT_ORDER_TBL(
  1438. payment_order_number, payment_order_date, bank_name, end_user_borrower, payment_order_status, or_number, or_date, user_name, receiving_office, bank_level_payment_type, total_payment_amount, payment_type, loan_type, payment_level)
  1439. VALUES('2017123457', '2017-08-11', 'Metro Bank', 'Pepsi', 'DRAFT', '01235', '2017-08-11', 'Jane_Maker', 'Cash Dept', 'MOST ONEROUS', 80000000.00, 'CASH/CHECK', 'Rediscounting', 'PN');
  1440.  
  1441. INSERT INTO PAYABLE_TBL (ref_payment_order_id,promissory_note_number,loan_application_number,
  1442. collateral_number,borrower_id,borrower_name,amount_granted,outstanding_principal_balance,
  1443. total_outstanding_balance,other_expenses,payment_amount,excess_amount,excess_payment_type) VALUES
  1444. ((SELECT MAX(payment_order_id) FROM PAYMENT_ORDER_TBL),201713,567891,'TCT-110',10,'Pepsi',1100000.00,1100000.00,1520000.00,21000.00,40000000.00,39900000.00,'Most Onerous');
  1445.  
  1446. INSERT INTO TRANSACTION_TBL(payment_number, payment_order_number, transaction_date, total_payment, year_created, payment_date, transaction_type) VALUES
  1447. ('2017123457', '2017123457','2017-08-11', 40000000.00, 2017, '2017-08-11', 'PO');
  1448.  
  1449. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1450. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1451. VALUES(2017123457, 201713, 'PN', 40000000.00, 20000.00, 25000.00, 30000.00, 25000.00, 0.00, 0.00, 0.00, '2017-08-11', 0.00);
  1452.  
  1453. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1454. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1455. VALUES(2017123457, 201724, 'Excess Most Onerous', 39800000.00, 25000.00, 30000.00, 30000.00, 15000.00, 0.00, 0.00, 0.00, '2017-08-11', 0.00);
  1456.  
  1457. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1458. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1459. VALUES(2017123457, 201729, 'Excess Most Onerous', 39900000.00, 15000.00, 45000.00, 10000.00, 30000.00, 0.00, 0.00, 0.00, '2017-08-11', 0.00);
  1460.  
  1461. /*Testdata for FSM-PO-SAP-012*/
  1462. INSERT INTO PAYMENT_ORDER_TBL(
  1463. payment_order_number, payment_order_date, bank_name, end_user_borrower, payment_order_status, or_number, or_date, user_name, receiving_office, bank_level_payment_type, total_payment_amount, payment_type, loan_type, payment_level)
  1464. VALUES('2017080217', '2017-08-11', 'Banco De Oro', 'Coca-cola, John Stith Pemberton', 'DRAFT', '03210', '2017-08-11', 'Jane_Maker', 'Cash Dept', 'MOST ONEROUS', 2338300.00, 'CASH/CHECK', 'Rediscounting', 'PN');
  1465.  
  1466. INSERT INTO PAYABLE_TBL (ref_payment_order_id,promissory_note_number,loan_application_number,
  1467. collateral_number,borrower_id,borrower_name,amount_granted,outstanding_principal_balance,
  1468. total_outstanding_balance,other_expenses,payment_amount,excess_amount,excess_payment_type) VALUES
  1469. ((SELECT MAX(payment_order_id) FROM PAYMENT_ORDER_TBL),201767,345678,'TCT-106',6,'Coca-cola, John Stith Pemberton',1500000.00,1500000.00,2044400.00,67000.00,50000000.00,47888600.00,'Most Onerous');
  1470.  
  1471. INSERT INTO TRANSACTION_TBL(payment_number, payment_order_number, transaction_date, total_payment, year_created, payment_date, transaction_type) VALUES
  1472. ('2017876543', '2017080217','2017-08-11', 1000000.00, 2017, '2017-08-11', 'PO');
  1473.  
  1474. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1475. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1476. VALUES(2017080217, 201767, 'PN', 2111400.00, 67000.00, 300000.00, 0.00, 244400.00, 0.00, 0.00, 0.00, '2017-08-11', 0.00);
  1477.  
  1478. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1479. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1480. VALUES(2017080217, 201756, 'Excess Most Onerous', 2338300.00, 45000.00, 390000.00, 0.00, 603300.00, 0.00, 0.00, 0.00, '2017-08-11', 0.00);
  1481.  
  1482. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1483. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1484. VALUES(2017080217, 201778, 'Excess Most Onerous', 1868000.00, 20000.00, 140000.00, 0.00, 508000.00, 0.00, 0.00, 0.00, '2017-08-11', 0.00);
  1485.  
  1486. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1487. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1488. VALUES(2017080217, 201789, 'Excess Most Onerous', 3384000.00, 0.00, 200000.00, 0.00, 384000.00, 0.00, 0.00, 0.00, '2017-08-11', 0.00);
  1489.  
  1490. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1491. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1492. VALUES(2017080217, 202012, 'Excess Most Onerous', 3076000.00, 0.00, 540000.00, 0.00, 1336000.00, 0.00, 0.00, 0.00, '2017-08-11', 0.00);
  1493.  
  1494. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1495. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1496. VALUES(2017080217, 202014, 'Excess Most Onerous', 4181700.00, 0.00, 890000.00, 0.00, 1291700.00, 0.00, 0.00, 0.00, '2017-08-11', 0.00);
  1497.  
  1498. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1499. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1500. VALUES(2017080217, 202013, 'Excess Most Onerous', 5569700.00, 0.00, 1030000.00, 0.00, 1739700.00, 0.00, 0.00, 0.00, '2017-08-11', 0.00);
  1501.  
  1502. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1503. interest_income_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1504. VALUES(2017080217, '', 'Excess on Excess', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, '2017-08-11', 27470900.00);
  1505.  
  1506. /*Testdata for FSM-PO-SAP-020*/
  1507. INSERT INTO PAYMENT_ORDER_TBL(
  1508. payment_order_number, payment_order_date, bank_name, end_user_borrower, payment_order_status, or_number, or_date, user_name, receiving_office, bank_level_payment_type, total_payment_amount, payment_type, loan_type, payment_level)
  1509. VALUES('2017696969', '2017-08-11', 'Bangkong Luma', 'Juan Dela Cruz', 'DRAFT', '', '2017-08-11', 'Jane_Maker', 'Cash Dept', 'MOST ONEROUS', 5000000.00, 'CASH/CHECK', 'Rediscounting', 'LOAN');
  1510.  
  1511. INSERT INTO PAYABLE_TBL(ref_payment_order_id, promissory_note_number, loan_application_number, collateral_number,borrower_id,borrower_name,amount_granted,outstanding_principal_balance,
  1512. total_outstanding_balance,other_expenses,payment_amount,excess_amount,excess_payment_type) VALUES
  1513. ((SELECT MAX(payment_order_id) FROM PAYMENT_ORDER_TBL),202103,999990,'TCT-119',19,'Juan Dela Cruz',5000000.00,500000.00,50000.00,0,5000000.00,4210000.00,'Most Onerous');
  1514.  
  1515. INSERT INTO TRANSACTION_TBL(payment_number, payment_order_number, transaction_date, total_payment, year_created, payment_date, transaction_type) VALUES
  1516. ('2017123436', '2017696969','2017-08-11', 5000000.00, 2017, '2017-08-10', 'PO');
  1517.  
  1518. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1519. interest_income_payment, principal_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1520. VALUES(2017696969, '', 'LOAN', 5000000.00, 50000.00, 60000.00, 80000.00, 100000.00, 500000.00, 0.00, 0.00, 0.00, '2017-08-10', 0.00);
  1521.  
  1522. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1523. interest_income_payment, principal_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, payment_date, miscellaneous_income)
  1524. VALUES(2017696969, '201797', 'BANKMO', 4210000.00, 50000.00, 60000.00, 80000.00, 100000.00, 500000.00, 0.00, 0.00, 0.00, '2017-08-10', 0.00);
  1525.  
  1526. INSERT INTO PAYMENT_PENDING_TBL (payment_order_number, pn_number, payment_rule_type, total_payment, others_payment, liquidated_damages_payment, accrued_interest_payment,
  1527. interest_income_payment, principal_payment, unpaid_liquidated_damages, unpaid_accrued_interest, unpaid_interest_income, miscellaneous_income)
  1528. VALUES (2017696969, '', 'MID', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 4210000.00);
  1529.  
  1530. INSERT INTO transaction_remarks_tbl(ref_transaction_id, remarks_content) VALUES
  1531. (1, 'remarks'),
  1532. (2, 'remarks again'),
  1533. (3, 'NEWEST REMARKS AGAIN'),
  1534. (4, 'remarks'),
  1535. (5, 'remarks again'),
  1536. (6, 'NEWEST REMARKS AGAIN'),
  1537. (7, 'remarks'),
  1538. (8, 'remarks again'),
  1539. (9, 'NEWEST REMARKS AGAIN'),
  1540. (10, 'remarks again'),
  1541. (11, 'NEWEST REMARKS AGAIN'),
  1542. (12, 'remarks'),
  1543. (13, 'remarks'),
  1544. (14, 'remarks'),
  1545. (15, 'remarks'),
  1546. (16, 'remarks'),
  1547. (17, 'remarks'),
  1548. (18, 'remarks'),
  1549. (19, 'remarks');
  1550.  
  1551. INSERT INTO expenses_tbl(ref_id, expense_type, miscellaneous_assets, accounts_payable)
  1552. VALUES (1, 'LOAN', 25000.00, 35000.00),
  1553. (1, 'PN', 55000.00, 85000.00),
  1554. (2, 'PN', 15000.00, 38000.00),
  1555. (3, 'PN', 25000.00, 65000.00),
  1556. (4, 'PN', 35000.00, 55000.00),
  1557. (5, 'PN', 45000.00, 25000.00),
  1558. (1, 'BANK', 55000.00, 45000.00),
  1559. (6, 'PN', 65000.00, 38000.00),
  1560. (7, 'PN', 75000.00, 32000.00),
  1561. (8, 'PN', 85000.00, 30000.00),
  1562. (9, 'PN', 35000.00, 10000.00),
  1563. (10, 'PN', 85000.00, 30000.00),
  1564. (11, 'PN', 87000.00, 30000.00),
  1565. (12, 'PN', 85000.00, 30000.00),
  1566. (13, 'PN', 82000.00, 30000.00),
  1567. (14, 'PN', 83000.00, 30000.00),
  1568. (15, 'PN', 85000.00, 30000.00),
  1569. (16, 'PN', 84000.00, 30000.00),
  1570. (17, 'PN', 81000.00, 30000.00),
  1571. (18, 'PN', 20000.00, 30000.00),
  1572. (19, 'PN', 83000.00, 10000.00),
  1573. (20, 'PN', 15000.00, 40000.00),
  1574. (21, 'PN', 25000.00, 40000.00),
  1575. (22, 'PN', 83000.00, 40000.00),
  1576. (23, 'PN', 84000.00, 40000.00),
  1577. (24, 'PN', 85000.00, 40000.00),
  1578. (25, 'PN', 86000.00, 20000.00),
  1579. (26, 'PN', 65000.00, 30000.00),
  1580. (27, 'PN', 15000.00, 55000.00),
  1581. (28, 'PN', 25000.00, 45000.00),
  1582. (29, 'PN', 35000.00, 47000.00),
  1583. (30, 'PN', 45000.00, 48000.00),
  1584. (31, 'PN', 55000.00, 49000.00),
  1585. (32, 'PN', 85000.00, 30000.00),
  1586. (33, 'PN', 85000.00, 20000.00),
  1587. (34, 'PN', 85000.00, 10000.00),
  1588. (35, 'PN', 85000.00, 90000.00),
  1589. (36, 'PN', 85000.00, 80000.00),
  1590. (37, 'PN', 85000.00, 70000.00),
  1591. (38, 'PN', 85000.00, 60000.00),
  1592. (39, 'PN', 85000.00, 40000.00),
  1593. (40, 'PN', 22700.00, 12000.00),
  1594. (41, 'PN', 23700.00, 22000.00),
  1595. (42, 'PN', 25100.00, 32000.00),
  1596. (43, 'PN', 25200.00, 42000.00),
  1597. (44, 'PN', 25400.00, 52000.00),
  1598. (45, 'PN', 25600.00, 62000.00),
  1599. (46, 'PN', 25900.00, 72000.00),
  1600. (47, 'PN', 85700.00, 82000.00),
  1601. (48, 'PN', 75700.00, 92000.00),
  1602. (49, 'PN', 55700.00, 61000.00),
  1603. (50, 'PN', 45700.00, 63000.00),
  1604. (51, 'PN', 15700.00, 64000.00),
  1605. (52, 'PN', 22700.00, 65000.00);
  1606.  
  1607. UPDATE pn_tbl
  1608. SET ref_expense_id = 2
  1609. WHERE pn_id = 1;
  1610.  
  1611. UPDATE pn_tbl
  1612. SET ref_expense_id = 3
  1613. WHERE pn_id = 2;
  1614.  
  1615. UPDATE pn_tbl
  1616. SET ref_expense_id = 4
  1617. WHERE pn_id = 3;
  1618.  
  1619. UPDATE pn_tbl
  1620. SET ref_expense_id = 5
  1621. WHERE pn_id = 4;
  1622.  
  1623. UPDATE pn_tbl
  1624. SET ref_expense_id = 6
  1625. WHERE pn_id = 5;
  1626.  
  1627. UPDATE pn_tbl
  1628. SET ref_expense_id = 8
  1629. WHERE pn_id = 6;
  1630.  
  1631. UPDATE pn_tbl
  1632. SET ref_expense_id = 9
  1633. WHERE pn_id = 7;
  1634.  
  1635. UPDATE pn_tbl
  1636. SET ref_expense_id = 10
  1637. WHERE pn_id = 8;
  1638.  
  1639. UPDATE pn_tbl
  1640. SET ref_expense_id = 11
  1641. WHERE pn_id = 9;
  1642.  
  1643. UPDATE pn_tbl
  1644. SET ref_expense_id = 12
  1645. WHERE pn_id = 10;
  1646.  
  1647. UPDATE pn_tbl
  1648. SET ref_expense_id = 13
  1649. WHERE pn_id = 11;
  1650.  
  1651. UPDATE pn_tbl
  1652. SET ref_expense_id = 14
  1653. WHERE pn_id = 12;
  1654.  
  1655. UPDATE pn_tbl
  1656. SET ref_expense_id = 15
  1657. WHERE pn_id = 13;
  1658.  
  1659. UPDATE pn_tbl
  1660. SET ref_expense_id = 16
  1661. WHERE pn_id = 14;
  1662.  
  1663. UPDATE pn_tbl
  1664. SET ref_expense_id = 17
  1665. WHERE pn_id = 15;
  1666.  
  1667. UPDATE pn_tbl
  1668. SET ref_expense_id = 18
  1669. WHERE pn_id = 16;
  1670.  
  1671. UPDATE pn_tbl
  1672. SET ref_expense_id = 19
  1673. WHERE pn_id = 17;
  1674.  
  1675. UPDATE pn_tbl
  1676. SET ref_expense_id = 20
  1677. WHERE pn_id = 18;
  1678.  
  1679. UPDATE pn_tbl
  1680. SET ref_expense_id = 21
  1681. WHERE pn_id = 19;
  1682.  
  1683. UPDATE pn_tbl
  1684. SET ref_expense_id = 22
  1685. WHERE pn_id = 20;
  1686.  
  1687. UPDATE pn_tbl
  1688. SET ref_expense_id = 23
  1689. WHERE pn_id = 21;
  1690.  
  1691. UPDATE pn_tbl
  1692. SET ref_expense_id = 24
  1693. WHERE pn_id = 22;
  1694.  
  1695. UPDATE pn_tbl
  1696. SET ref_expense_id = 25
  1697. WHERE pn_id = 23;
  1698.  
  1699. UPDATE pn_tbl
  1700. SET ref_expense_id = 26
  1701. WHERE pn_id = 24;
  1702.  
  1703. UPDATE pn_tbl
  1704. SET ref_expense_id = 27
  1705. WHERE pn_id = 25;
  1706.  
  1707. UPDATE pn_tbl
  1708. SET ref_expense_id = 28
  1709. WHERE pn_id = 26;
  1710.  
  1711. UPDATE pn_tbl
  1712. SET ref_expense_id = 29
  1713. WHERE pn_id = 27;
  1714.  
  1715. UPDATE pn_tbl
  1716. SET ref_expense_id = 30
  1717. WHERE pn_id = 28;
  1718.  
  1719. UPDATE pn_tbl
  1720. SET ref_expense_id = 31
  1721. WHERE pn_id = 29;
  1722.  
  1723. UPDATE pn_tbl
  1724. SET ref_expense_id = 32
  1725. WHERE pn_id = 30;
  1726.  
  1727. UPDATE pn_tbl
  1728. SET ref_expense_id = 33
  1729. WHERE pn_id = 31;
  1730.  
  1731. UPDATE pn_tbl
  1732. SET ref_expense_id = 34
  1733. WHERE pn_id = 32;
  1734.  
  1735. UPDATE pn_tbl
  1736. SET ref_expense_id = 35
  1737. WHERE pn_id = 33;
  1738.  
  1739. UPDATE pn_tbl
  1740. SET ref_expense_id = 36
  1741. WHERE pn_id = 34;
  1742.  
  1743. UPDATE pn_tbl
  1744. SET ref_expense_id = 37
  1745. WHERE pn_id = 35;
  1746.  
  1747. UPDATE pn_tbl
  1748. SET ref_expense_id = 38
  1749. WHERE pn_id = 36;
  1750.  
  1751. UPDATE pn_tbl
  1752. SET ref_expense_id = 39
  1753. WHERE pn_id = 37;
  1754.  
  1755. UPDATE pn_tbl
  1756. SET ref_expense_id = 40
  1757. WHERE pn_id = 38;
  1758.  
  1759. UPDATE pn_tbl
  1760. SET ref_expense_id = 41
  1761. WHERE pn_id = 39;
  1762.  
  1763. UPDATE pn_tbl
  1764. SET ref_expense_id = 42
  1765. WHERE pn_id = 40;
  1766.  
  1767. UPDATE pn_tbl
  1768. SET ref_expense_id = 43
  1769. WHERE pn_id = 41;
  1770.  
  1771. UPDATE pn_tbl
  1772. SET ref_expense_id = 44
  1773. WHERE pn_id = 42;
  1774.  
  1775. UPDATE pn_tbl
  1776. SET ref_expense_id = 45
  1777. WHERE pn_id = 43;
  1778.  
  1779. UPDATE pn_tbl
  1780. SET ref_expense_id = 46
  1781. WHERE pn_id = 44;
  1782.  
  1783. UPDATE pn_tbl
  1784. SET ref_expense_id = 47
  1785. WHERE pn_id = 45;
  1786.  
  1787. UPDATE pn_tbl
  1788. SET ref_expense_id = 48
  1789. WHERE pn_id = 46;
  1790.  
  1791. UPDATE pn_tbl
  1792. SET ref_expense_id = 49
  1793. WHERE pn_id = 47;
  1794.  
  1795. UPDATE pn_tbl
  1796. SET ref_expense_id = 50
  1797. WHERE pn_id = 48;
  1798.  
  1799. UPDATE pn_tbl
  1800. SET ref_expense_id = 51
  1801. WHERE pn_id = 49;
  1802.  
  1803. UPDATE pn_tbl
  1804. SET ref_expense_id = 52
  1805. WHERE pn_id = 50;
  1806.  
  1807. UPDATE pn_tbl
  1808. SET ref_expense_id = 53
  1809. WHERE pn_id = 51;
  1810.  
  1811. UPDATE pn_tbl
  1812. SET ref_expense_id = 54
  1813. WHERE pn_id = 52;
  1814.  
  1815. INSERT INTO collateral_documents_tbl(foreclosure_ref_number, document_name, document_contents, updated_by, updated_on, save_flag, print_flag)
  1816. VALUES
  1817. ('2017000239','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 1, 1),
  1818. ('2017000234','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 1, 1),
  1819. ('2017000235','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 0, 1),
  1820. ('2017000236','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 0, 1),
  1821.  
  1822. ('2017000237','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 1, 1),
  1823. ('2017000238','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 1, 1),
  1824. ('2017169111','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 0, 1),
  1825. ('2017000240','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 1, 1),
  1826.  
  1827. ('2017000242','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 1, 1),
  1828. ('2017000243','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 1, 0),
  1829. ('2017000244','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 1, 0),
  1830. ('201719998','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 1, 1),
  1831.  
  1832. ('201719890','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 1, 1),
  1833. ('201716998','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 1, 0),
  1834. ('201716911','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 0, 1),
  1835. ('2017169122','Birth Certificate','Birth Certificate','Jane_Maker','2017-08-08 13:58:34', 0, 0);
  1836.  
  1837.  
  1838. --added lawyer in some PNs
  1839. UPDATE pn_tbl
  1840. SET ref_lawyer_id = 8
  1841. WHERE pn_number = 201722;
  1842.  
  1843. UPDATE pn_tbl
  1844. SET ref_lawyer_id = 1
  1845. WHERE pn_number = 202016;
  1846.  
  1847. UPDATE pn_tbl
  1848. SET ref_lawyer_id = 4
  1849. WHERE pn_number = 202006;
  1850.  
  1851. UPDATE pn_tbl
  1852. SET ref_lawyer_id = 2
  1853. WHERE pn_number = 201735;
  1854.  
  1855. UPDATE pn_tbl
  1856. SET ref_lawyer_id = 5
  1857. WHERE pn_number = 201751;
  1858.  
  1859. UPDATE pn_tbl
  1860. SET ref_lawyer_id = 7
  1861. WHERE pn_number = 201772;
  1862.  
  1863. UPDATE pn_tbl
  1864. SET ref_lawyer_id = 3
  1865. WHERE pn_number = 202002;
  1866.  
  1867. UPDATE pn_tbl
  1868. SET ref_lawyer_id = 6
  1869. WHERE pn_number = 201791;
  1870.  
  1871. UPDATE pn_tbl
  1872. SET ref_lawyer_id = 6
  1873. WHERE pn_number = 201773;
  1874.  
  1875. INSERT INTO demand_letter(date_on_demand_letter, demand_letter_date, ref_pn_id) VALUES
  1876. ('2017-01-22', '2016-12-30', 25),
  1877. ('2017-02-22', '2017-01-01', 25),
  1878. ('2017-08-30', '2017-03-14', 25),
  1879. ('2017-10-22', '2017-01-14', 29),
  1880. ('2017-02-22', '2017-01-14', 31),
  1881. ('2017-02-22', '2017-02-14', 34),
  1882. ('2017-03-22', '2017-04-14', 48),
  1883. ('2017-04-22', '2017-05-14', 30),
  1884. ('2017-05-22', '2017-06-14', 53),
  1885. ('2017-06-22', '2017-07-14', 54),
  1886. ('2017-07-22', '2017-08-14', 55);
  1887.  
  1888. INSERT INTO PRE_FORECLOSURE(ref_pn_id, pre_foreclosure_status, transaction_date, active_flag, excluded_false, excluded_date) values
  1889. (7, 'New', '2017-07-25', 1, 0, '2017-07-25'),
  1890. (8, 'New', '2017-07-31', 1, 0, '2017-07-31'),
  1891. (9, 'Referred to Lawyer', '2017-07-28', 1, 0, '2017-07-28'),
  1892. (10, 'New', '2017-08-10', 1, 0, '2017-08-10'),
  1893. (11, 'New', '2017-08-01', 1, 0, '2017-08-01'),
  1894. (12, 'New', '2017-08-05', 1, 0, '2017-08-05'),
  1895. (13, 'Referred to Lawyer', '2017-07-05', 0, 1, '2017-07-05'),
  1896. (14, 'New', '2017-08-22', 0, 1, '2017-08-22'),
  1897. (15, 'New', '2017-08-29', 0, 1, '2017-08-29'),
  1898. (16, 'New', '2017-07-15', 0, 1, '2017-07-15');
  1899.  
  1900. INSERT INTO remarks_tbl(remarks_group, remarks_group_ref_id, remarks_content, created_date) values
  1901. ('preforeclosure', 7, 'Current', '2017-08-29'),
  1902. ('preforeclosure', 9, 'Current', '2017-08-29'),
  1903. ('preforeclosure', 10, 'Current', '2017-08-29');
  1904.  
  1905. INSERT INTO batch_tbl(job_name,cron_trigger_name, cron_expression) VALUES
  1906. ('movePnsToPreForeclosureJob', 'movePnsToPreForeclosureCronTrigger', '0 0 9,16 ? * *'),
  1907. ('moveCurrentPnsToPreForeclosureJob', 'moveCurrentPnsToPreForeclosureCronTrigger', '0 0 9,16 ? * *');
  1908.  
  1909. INSERT INTO pn_collateral(ref_pn_id, ref_collateral_id) VALUES
  1910. (1,1),
  1911. (2,2),
  1912. (3,3),
  1913. (4,4),
  1914. (5,5),
  1915. (6,6),
  1916. (7,7),
  1917. (8,8),
  1918. (9,9),
  1919. (10,10),
  1920. (11,11),
  1921. (12,12),
  1922. (13,13),
  1923. (14,14),
  1924. (15,15),
  1925. (16,16),
  1926. (17,17),
  1927. (18,18),
  1928. (25,19),
  1929. (26,20),
  1930. (27,21),
  1931. (28,22),
  1932. (29,23),
  1933. (30,24),
  1934. (31,25),
  1935. (32,26),
  1936. (33,27),
  1937. (34,28),
  1938. (35,29),
  1939. (36,30),
  1940. (37,31),
  1941. (38,32),
  1942. (39,33),
  1943. (40,34),
  1944. (41,35),
  1945. (42,36),
  1946. (43,37),
  1947. (44,38),
  1948. (45,39),
  1949. (46,40),
  1950. (47,41),
  1951. (48,42),
  1952. (49,43),
  1953. (50,44),
  1954. (51,45),
  1955. (52,46),
  1956. (53,47),
  1957. (54,47),
  1958. (55,47);
  1959.  
  1960. INSERT INTO expense_tbl (expense_type, or_number, or_date, ref_pn_id) VALUES
  1961. ('Filing Fee', '2098932 C', '2017-07-15', 39),
  1962. ('Courts Commission', '5788532', '2018-02-12', 39),
  1963. ('COS Annotation', '1011382990', '2019-03-21', 39),
  1964. ('Sheriffs Fee', '2324567 C', '2016-12-20', 39),
  1965. ('Filing Fee', '2098932 A', '2017-07-15', 4),
  1966. ('Courts Commission', '3288531', '2018-02-12', 4),
  1967. ('COS Annotation', '3011382910', '2019-03-21', 4),
  1968. ('Sheriffs Fee', '2324567 A', '2016-12-20', 4);
  1969.  
  1970. INSERT INTO appraisal_report (report_type, report_date, appraiser_name, ref_collateral_id) VALUES
  1971. ('DLC Appraisal Report', '2016-08-10', 'Nico Robin', 40),
  1972. ('MO Appraisal Report', '2016-08-11', 'Roronoa Zoro', 4);
  1973.  
  1974. UPDATE pn_tbl
  1975. SET ref_lawyer_id = 4,
  1976. rem_amount = 100000,
  1977. tax_receipt = '221321'
  1978. WHERE pn_id = 39;
  1979.  
  1980. UPDATE pn_tbl
  1981. SET ref_lawyer_id = 3,
  1982. rem_amount = 300000,
  1983. tax_receipt = '321321'
  1984. WHERE pn_id = 4;
  1985.  
  1986. UPDATE auction_tbl
  1987. SET date_filed = '2016-12-25',
  1988. sheriff_clerk_name = 'Boa Hancock'
  1989. WHERE auction_id = 8;
  1990.  
  1991. UPDATE auction_tbl
  1992. SET date_filed = '2016-12-26',
  1993. sheriff_clerk_name = 'Charlotte Pudding'
  1994. WHERE auction_id = 9;
  1995.  
  1996. /*FOR SINGLE PN, MULTIPLE COLLATERAL LMM-DAC-MC-003*/
  1997. UPDATE collateral_tbl
  1998. SET collateral_value = 2500000,
  1999. collateral_classification = 'MC',
  2000. rem_amount = 500000,
  2001. registered_owner = 'Archie Andrews',
  2002. area = 28,
  2003. unit_measurement = 'hectares'
  2004. WHERE collateral_id = 19;
  2005.  
  2006. INSERT INTO collateral_tbl(collateral_number, collateral_classification, ref_rd_id, address, collateral_value, rem_amount, registered_owner, area, unit_measurement , appraisal_date) VALUES
  2007. ('TCT-148', 'MC', 9, 'Ayala Triangle Walkways, Makati, Metro Manila', 1000000, 500000, 'Betty Cooper', 1000, 'sqm', NULL),
  2008. ('TCT-149', 'MC', 10, '1101 Commonwealth Ave, Diliman, Quezon City, Philippines', 1500000, 300000, 'Jughead Jones', 25, 'hectares', NULL),
  2009. ('TCT-150', 'MC', 3, 'Microtel U.P Ayala Land Technohub, Commonwealth Ave, Diliman, Quezon City', 1800000, 200000, 'Veronica Lodge', 3000, 'sqm', NULL);
  2010.  
  2011. INSERT INTO pn_collateral(ref_pn_id, ref_collateral_id) VALUES
  2012. (25,48),
  2013. (25,49),
  2014. (25,50);
  2015.  
  2016. INSERT INTO appraisal_report (report_type, report_date, appraiser_name, ref_collateral_id) VALUES
  2017. ('EMC Appraisal Report', '2016-02-10', 'Harry James Potter', 48),
  2018. ('EMC Appraisal Report', '2016-02-11', 'Hermione Granger', 49),
  2019. ('EMC Appraisal Report', '2016-02-12', 'Ron Bilius Weasley', 50),
  2020. ('EMC Appraisal Report', '2016-02-13', 'Luna Lovegood', 19);
  2021.  
  2022. INSERT INTO tax_declaration_tbl (tax_declaration_number, tax_declaration_type, classification_type, amount, ref_collateral_id, ref_appraisal_id) VALUES
  2023. ('TAX-0501', 'Land', 'Residential', 10000, 48, 3),
  2024. ('TAX-0502', 'Improvement', 'Residential', 5000, 48, 3),
  2025. ('TAX-0722', 'Land', 'Residential', 15000, 49, 4),
  2026. ('TAX-0723', 'Land', 'Residential', 12000, 50, 5),
  2027. ('TAX-0719', 'Land', 'Residential', 28000, 19, 6);
  2028.  
  2029. INSERT INTO insurance_details_tbl (policy_number, insurance_company_name, insurance_or_number, expiry_date, insured_amount, ref_collateral_id, ref_appraisal_id) VALUES
  2030. ('POL-1106', 'Sun Life Financial', '123', '2030-01-01', 20000000, 48, 3),
  2031. ('POL-1107', 'Philam Life Insurance', '234', '2035-12-31', 10000000, 49, 4),
  2032. ('POL-1108', 'Stronghold Insurance Company', '567', '2050-02-28', 500000000, 50, 5),
  2033. ('POL-1109', 'Life and Health Insurance', '890', '2028-01-30', 50000000, 19, 6);
  2034.  
  2035. UPDATE pn_tbl
  2036. SET penalty_rate = 0.3,
  2037. rem_amount = 1500000,
  2038. tax_receipt = '123456'
  2039. WHERE pn_id = 25;
  2040.  
  2041. /*NEW*/
  2042. UPDATE collateral_tbl
  2043. SET collateral_value = 1100000,
  2044. collateral_classification = 'MC',
  2045. rem_amount = 100000,
  2046. registered_owner = 'Kou Mabuchi',
  2047. area = 11,
  2048. unit_measurement = 'hectares'
  2049. WHERE collateral_id = 20;
  2050.  
  2051. UPDATE collateral_tbl
  2052. SET collateral_value = 1200000,
  2053. collateral_classification = 'MC',
  2054. rem_amount = 200000,
  2055. registered_owner = 'Alphonse Elric',
  2056. area = 12,
  2057. unit_measurement = 'hectares'
  2058. WHERE collateral_id = 21;
  2059.  
  2060. UPDATE pn_tbl
  2061. SET penalty_rate = 0.1,
  2062. rem_amount = 100000,
  2063. tax_receipt = '111111'
  2064. WHERE pn_id = 26;
  2065.  
  2066. UPDATE pn_tbl
  2067. SET penalty_rate = 0.2,
  2068. rem_amount = 200000,
  2069. tax_receipt = '222222'
  2070. WHERE pn_id = 27;
  2071.  
  2072. INSERT INTO appraisal_report (report_type, report_date, appraiser_name, ref_collateral_id) VALUES
  2073. ('EMC Appraisal Report', '2011-01-01', 'Yoshioka Futaba', 20),
  2074. ('EMC Appraisal Report', '2012-02-02', 'Edward Elric', 21);
  2075.  
  2076. INSERT INTO tax_declaration_tbl (tax_declaration_number, tax_declaration_type, classification_type, amount, ref_collateral_id, ref_appraisal_id) VALUES
  2077. ('TAX-0511', 'Land', 'Residential', 11000, 20, 7),
  2078. ('TAX-0522', 'Land', 'Residential', 22000, 21, 8);
  2079.  
  2080. INSERT INTO insurance_details_tbl (policy_number, insurance_company_name, insurance_or_number, expiry_date, insured_amount, ref_collateral_id, ref_appraisal_id) VALUES
  2081. ('POL-1111', 'Sun Life Financial', '111', '2021-11-11', 11000000, 20, 7),
  2082. ('POL-1122', 'Philam Life Insurance', '222', '2022-12-12', 22000000, 21, 8);
  2083.  
  2084. INSERT INTO dacion_transaction_tbl (transaction_number, dts_number, transaction_date) VALUES
  2085. ('2017000001', '1111111', '2017-09-08');
  2086.  
  2087. INSERT INTO dacion_tbl (dacion_id, dacion_type, udoa_number, dacion_value, ref_pn_id, ref_loan_id, ref_balance_id, ref_borrower_id, ref_bank_id, ref_collateral_id, ref_dacion_transaction_id) VALUES
  2088. (1, 'Encumbered MC', 'UDOA-LOAN-B-1111', 500000, 1, 14, 50, 20, 8, 20, 1),
  2089. (2, '', 'UDOA-LOAN-B-2222', 500000, 25, 15, 51, 21, 7, 19, null),
  2090. (3, '', 'UDOA-LOAN-B-3333', 2500000, 27, 16, 48, 21, 9, 21, null),
  2091. (4, '', 'UDOA-LOAN-B-4444', 2600000, 4, 17, 49, 21, 6, 23, null),
  2092. (5, 'ENROPA', 'UDOA-LOAN-B-1453', 600000, 31, 17, 59, 25, 8, 25, 1),
  2093. (6, '', 'UDOA-LOAN-B-1116', 500000, 25, 15, 51, 21, 7, 48, null);
  2094.  
  2095. UPDATE end_user_borrower_tbl
  2096. SET address = '7114 Kundiman Street, Sampaloc 1008 Manila',
  2097. tin = '999-999-999-9999',
  2098. ref_pn_id = 25
  2099. WHERE borrower_id = 19;
  2100.  
  2101. UPDATE end_user_borrower_tbl
  2102. SET address = '95 JayLee Street, Sofia Subdivision Del Pilar, San Fernando City',
  2103. tin = '888-888-888-8888',
  2104. ref_pn_id = 26
  2105. WHERE borrower_id = 20;
  2106.  
  2107. UPDATE end_user_borrower_tbl
  2108. SET address = '75 P. Domingo Street Carmona, Makati City',
  2109. tin = '777-777-777-7777',
  2110. ref_pn_id = 27
  2111. WHERE borrower_id = 21;
  2112.  
  2113. INSERT INTO rem_tbl (rem_name, rem_amount) VALUES
  2114. ('REM 1', 100000),
  2115. ('REM 2', 200000);
  2116.  
  2117. INSERT INTO rem_dacion_tbl (ref_rem_id, ref_dacion_id) VALUES
  2118. (1, 1),
  2119. (2, 2);
  2120.  
  2121. /*ENCUMBERED ROPA*/
  2122. UPDATE collateral_tbl
  2123. SET collateral_value = 2500000,
  2124. collateral_classification = 'ROPA',
  2125. rem_amount = 500000,
  2126. registered_owner = 'Bastian Schweinsteiger',
  2127. area = 28,
  2128. unit_measurement = 'hectares'
  2129. WHERE collateral_id = 25;
  2130.  
  2131. UPDATE end_user_borrower_tbl
  2132. SET tin = '999-999-969-6969', address = 'Manuel L. Quezon Corner Carigma Street, Antipolo City, Rizal 1870'
  2133. WHERE borrower_id = '25';
  2134.  
  2135. INSERT INTO appraisal_report (report_type, report_date, appraiser_name, ref_collateral_id) VALUES
  2136. ('ERO Appraisal Report', '2016-02-10', 'Kevin Grosskreutz', 25);
  2137.  
  2138. INSERT INTO tax_declaration_tbl (tax_declaration_number, tax_declaration_type, classification_type, amount, ref_collateral_id, ref_appraisal_id) VALUES
  2139. ('TAX-0514', 'Land', 'Residential', 10000, 25, 9),
  2140. ('TAX-0515', 'Improvement', 'Residential', 5000, 25, 9);
  2141.  
  2142. INSERT INTO insurance_details_tbl (policy_number, insurance_company_name, insurance_or_number, expiry_date, insured_amount, ref_collateral_id, ref_appraisal_id) VALUES
  2143. ('POL-1106', 'Sun Life Financial', '123', '2030-01-01', 20000000, 25, 9);
  2144.  
  2145. UPDATE pn_tbl
  2146. SET penalty_rate = 0.3,
  2147. rem_amount = 1500000,
  2148. tax_receipt = '123456'
  2149. WHERE pn_id = 31;
  2150.  
  2151. INSERT INTO rem_tbl (rem_name, rem_amount) VALUES
  2152. ('REM 9', 400000);
  2153.  
  2154. INSERT INTO rem_dacion_tbl (ref_rem_id, ref_dacion_id) VALUES
  2155. (3, 5);
  2156.  
  2157. INSERT INTO remarks_tbl(remarks_group_ref_id, remarks_group, remarks_content) VALUES
  2158. ('5','dacion', 'this is remark for encumbered ropa');
  2159.  
  2160. UPDATE collateral_tbl
  2161. SET collateral_value = 2500000,
  2162. collateral_classification = 'ROPA',
  2163. rem_amount = 500000,
  2164. registered_owner = 'Adriel Ortiz',
  2165. area = 28,
  2166. unit_measurement = 'hectares'
  2167. WHERE collateral_id = 21;
  2168.  
  2169. INSERT INTO tax_declaration_tbl (tax_declaration_number, tax_declaration_type, classification_type, amount, ref_collateral_id, ref_appraisal_id) VALUES
  2170. ('TAX-0805', 'Land', 'Residential', 10000, 21, 9),
  2171. ('TAX-0806', 'Improvement', 'Residential', 5000, 21, 9);
  2172.  
  2173. INSERT INTO insurance_details_tbl (policy_number, insurance_company_name, insurance_or_number, expiry_date, insured_amount, ref_collateral_id, ref_appraisal_id) VALUES
  2174. ('POL-0805', 'Sun Life Financial', '123', '2030-01-01', 20000000, 21, 9);
  2175.  
  2176. INSERT INTO appraisal_report (report_type, report_date, appraiser_name, ref_collateral_id) VALUES
  2177. ('ERO Appraisal Report', '2016-02-10', 'Kevin Grosskreutz', 21);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement