File: /www/exchange2/sql/custom/TK24890-Restore-Merged-Payments.sql
/* TK24890 - restore merged payments */
/* Backup Existing merged payment */
INSERT INTO `manual_transactions` (`manual_transaction_id`, `transaction_type`, `debtor_id`, `originator_id`, `currency_id`, `amount`, `reference_to`, `specific_allocation`, `notes`, `credit_note_no`, `transaction_file`, `specific_deductible`, `deductible_amount`, `trailing_balance`, `trailing_balance_amt`, `transref_list`, `reconcile_payment`, `reconcile_ref`, `payment_return`, `false_payment`, `amendment_id`, `status`, `reconcile_status`, `reconcile_credit`, `multiple_payments`, `multiple_status`, `interface`, `paid_status`, `transaction_date`, `notification_title`, `transaction_name`, `issue_date`, `created_at`, `created_by`, `modified_at`, `modified_by`, `authorised_at`, `authorised_by`, `reserve_on`, `rerouted`, `spooled`, `orpa_id`, `fees_commissions`, `is_synced`, `synced_date`, `is_aetr`, `a_etr_id`, `asset_id`) VALUES
(197893, 1, 7321, 1790, 1, '2488938.54', '', 0, '{"type":"merge","transactions":[{"id":"197647","amount":"1222436.25","date":"2021-01-15"},{"id":"197890","amount":"1266502.29","date":"2021-01-18"}]}', NULL, '', 0, '0.00', 0, '0.00', '', 0, 0, 0, 0, 0, 1, 0, 0, '', 0, 1, 0, '2021-01-18', 0, '', '0000-00-00', '2021-01-22 09:18:23', 22, '0000-00-00 00:00:00', 0, '2021-01-22 09:18:31', 22, 0, 0, 1, NULL, 0, '0', NULL, 0, NULL, NULL);
/* Remove the merged transaction */
DELETE FROM manual_transactions WHERE manual_transaction_id=197893;
/* Add merged transaction */
INSERT INTO `manual_transactions` (`manual_transaction_id`, `transaction_type`, `debtor_id`, `originator_id`, `currency_id`, `amount`, `reference_to`, `specific_allocation`, `notes`, `credit_note_no`, `transaction_file`, `specific_deductible`, `deductible_amount`, `trailing_balance`, `trailing_balance_amt`, `transref_list`, `reconcile_payment`, `reconcile_ref`, `payment_return`, `false_payment`, `amendment_id`, `status`, `reconcile_status`, `reconcile_credit`, `multiple_payments`, `multiple_status`, `interface`, `paid_status`, `transaction_date`, `notification_title`, `transaction_name`, `issue_date`, `created_at`, `created_by`, `modified_at`, `modified_by`, `authorised_at`, `authorised_by`, `reserve_on`, `rerouted`, `spooled`, `orpa_id`, `fees_commissions`, `is_synced`, `synced_date`, `is_aetr`, `a_etr_id`, `asset_id`) VALUES
(197647, 1, 7321, 1790, 1, '1222436.25', '', 0, '{\"type\":\"merge\",\"transactions\":[{\"id\":\"195709\",\"amount\":\"400503.88\",\"date\":\"2020-12-17\"},{\"id\":\"197595\",\"amount\":\"821932.37\",\"date\":\"2021-01-15\"}]}', NULL, '', 0, '0.00', 0, '0.00', '', 0, 0, 0, 0, 0, 1, 0, 0, '', 0, 1, 0, '2021-01-15', 0, '', '0000-00-00', '2021-01-18 14:37:50', 56, '0000-00-00 00:00:00', 0, '2021-01-18 14:38:18', 56, 0, 0, 1, NULL, 0, '0', NULL, 0, NULL, NULL);
/* Backup the existing rejected transaction */
INSERT INTO `manual_transactions_rejected` (`trans_reject_id`, `manual_transaction_id`, `transaction_type`, `debtor_id`, `originator_id`, `currency_id`, `amount`, `debtors`, `reference_to`, `specific_allocation`, `notes`, `credit_note_no`, `transaction_file`, `specific_deductible`, `deductible_amount`, `trailing_balance`, `trailing_balance_amt`, `transref_list`, `reconcile_payment`, `reconcile_ref`, `payment_return`, `false_payment`, `amendment_id`, `status`, `reconcile_status`, `reconcile_credit`, `multiple_payments`, `multiple_status`, `interface`, `paid_status`, `transaction_date`, `notification_title`, `transaction_name`, `issue_date`, `delete_notes`, `reject_status`, `created_at`, `created_by`, `reject_created_at`, `reject_created_by`, `modified_at`, `modified_by`, `authorised_at`, `authorised_by`, `reserve_on`, `rerouted`, `spooled`, `orpa_id`, `fees_commissions`, `is_synced`, `synced_date`, `is_aetr`, `a_etr_id`, `asset_id`) VALUES
(38469, 197647, 1, 7321, 1790, 1, '1222436.25', '', '', 0, '{"type":"merge","transactions":[{"id":"195709","amount":"400503.88","date":"2020-12-17"},{"id":"197595","amount":"821932.37","date":"2021-01-15"}]}', NULL, '', 0, '0.00', 0, '0.00', '', 0, 0, 0, 0, 0, 1, 0, 0, '', 0, 1, 0, '2021-01-15', 0, '', '0000-00-00', 'Merged into:197893 with amount 2488938.5400000000373', '0', '2021-01-18 14:37:50', 56, '2021-01-22 09:18:31', 22, '0000-00-00 00:00:00', 0, '2021-01-18 14:38:18', 56, 0, 0, 1, NULL, 0, '0', NULL, 0, NULL, NULL);
/* Delete the existing rejected transaction */
DELETE FROM manual_transactions_rejected WHERE manual_transaction_id=197647;
/* Add merged transaction */
INSERT INTO `manual_transactions` (`manual_transaction_id`, `transaction_type`, `debtor_id`, `originator_id`, `currency_id`, `amount`, `reference_to`, `specific_allocation`, `notes`, `credit_note_no`, `transaction_file`, `specific_deductible`, `deductible_amount`, `trailing_balance`, `trailing_balance_amt`, `transref_list`, `reconcile_payment`, `reconcile_ref`, `payment_return`, `false_payment`, `amendment_id`, `status`, `reconcile_status`, `reconcile_credit`, `multiple_payments`, `multiple_status`, `interface`, `paid_status`, `transaction_date`, `notification_title`, `transaction_name`, `issue_date`, `created_at`, `created_by`, `modified_at`, `modified_by`, `authorised_at`, `authorised_by`, `reserve_on`, `rerouted`, `spooled`, `orpa_id`, `fees_commissions`, `is_synced`, `synced_date`, `is_aetr`, `a_etr_id`, `asset_id`) VALUES
(197890, 1, 7321, 1790, 1, '1266502.29', '', 0, '{"type":"merge","transactions":[{"id":"197675","amount":"1231334.35","date":"2021-01-18"},{"id":"197820","amount":"35167.94","date":"2021-01-18"}]}', NULL, '', 0, '0.00', 0, '0.00', '', 0, 0, 0, 0, 0, 1, 0, 0, '', 0, 1, 0, '2021-01-18', 0, '', '0000-00-00', '2021-01-22 09:14:13', 22, '0000-00-00 00:00:00', 0, '2021-01-22 09:14:47', 22, 0, 0, 1, NULL, 0, '0', NULL, 0, NULL, NULL);
/* Backup the existing rejected transaction */
INSERT INTO `manual_transactions_rejected` (`trans_reject_id`, `manual_transaction_id`, `transaction_type`, `debtor_id`, `originator_id`, `currency_id`, `amount`, `debtors`, `reference_to`, `specific_allocation`, `notes`, `credit_note_no`, `transaction_file`, `specific_deductible`, `deductible_amount`, `trailing_balance`, `trailing_balance_amt`, `transref_list`, `reconcile_payment`, `reconcile_ref`, `payment_return`, `false_payment`, `amendment_id`, `status`, `reconcile_status`, `reconcile_credit`, `multiple_payments`, `multiple_status`, `interface`, `paid_status`, `transaction_date`, `notification_title`, `transaction_name`, `issue_date`, `delete_notes`, `reject_status`, `created_at`, `created_by`, `reject_created_at`, `reject_created_by`, `modified_at`, `modified_by`, `authorised_at`, `authorised_by`, `reserve_on`, `rerouted`, `spooled`, `orpa_id`, `fees_commissions`, `is_synced`, `synced_date`, `is_aetr`, `a_etr_id`, `asset_id`) VALUES
(38470, 197890, 1, 7321, 1790, 1, '1266502.29', '', '', 0, '{"type":"merge","transactions":[{"id":"197675","amount":"1231334.35","date":"2021-01-18"},{"id":"197820","amount":"35167.94","date":"2021-01-18"}]}', NULL, '', 0, '0.00', 0, '0.00', '', 0, 0, 0, 0, 0, 1, 0, 0, '', 0, 1, 0, '2021-01-18', 0, '', '0000-00-00', 'Merged into:197893 with amount 2488938.5400000000373', '0', '2021-01-22 09:14:13', 22, '2021-01-22 09:18:31', 22, '0000-00-00 00:00:00', 0, '2021-01-22 09:14:47', 22, 0, 0, 1, NULL, 0, '0', NULL, 0, NULL, NULL);
/* Delete the existing rejected transaction */
DELETE FROM manual_transactions_rejected WHERE manual_transaction_id=197890;