File: /www/exchange2/sql/archive/2016-11-16-TT1679.sql
ALTER TABLE `debtor_rva`
CHANGE COLUMN `status` `status` TINYINT NULL DEFAULT NULL AFTER `date_status_change`;
ALTER TABLE `debtor_rva`
CHANGE COLUMN `reminder` `reminder` TINYINT NULL DEFAULT '0' AFTER `status`;
ALTER TABLE `debtor_rva`
CHANGE COLUMN `debtor_id` `debtor_id` MEDIUMINT UNSIGNED NULL DEFAULT NULL AFTER `user_id`,
CHANGE COLUMN `status` `status` TINYINT(4) UNSIGNED NULL DEFAULT NULL AFTER `date_status_change`,
CHANGE COLUMN `reminder` `reminder` TINYINT(4) UNSIGNED NULL DEFAULT '0' AFTER `status`;
ALTER TABLE `debtor_rva`
CHANGE COLUMN `user_id` `user_id` SMALLINT UNSIGNED NULL DEFAULT NULL AFTER `id`;
ALTER TABLE `debtor_rva`
CHANGE COLUMN `id` `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST;
ALTER TABLE `debtor_rva`
ADD COLUMN `balance` DOUBLE NULL DEFAULT NULL AFTER `reminder`;
ALTER TABLE `rva_response`
DROP COLUMN `currency_id`;
ALTER TABLE `rva_response`
CHANGE COLUMN `id` `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
CHANGE COLUMN `rva_id` `rva_id` INT UNSIGNED NULL DEFAULT NULL AFTER `id`,
CHANGE COLUMN `amount` `amount` DOUBLE NULL DEFAULT NULL AFTER `date`;
/*2016-11-17*/
ALTER TABLE `debtors_detail`
ADD COLUMN `is_rva` TINYINT NULL DEFAULT '1' AFTER `trade_limit`;
UPDATE `transaction_types` SET `transaction_name`='Fail' WHERE `transaction_id`=4 AND `type_id`=4 AND `transaction_name`='Failed' AND `bogui_active`=1 LIMIT 1;
ALTER TABLE `transaction_types`
ADD COLUMN `is_subtype` TINYINT(3) UNSIGNED NULL DEFAULT '0' AFTER `bogui_active`;
DELETE FROM `transaction_types` WHERE `transaction_types`.type_id=4;
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (2, 4, 'Pass', 1, 0);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (3, 4, 'Follow Up', 1, 0);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (4, 4, 'Fail', 1, 0);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (5, 4, 'Paid to Originator', 1, 1);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (1, 4, 'Waiting', 1, 0);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (6, 4, 'No invoices on file', 1, 1);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (7, 4, 'Statement Request ', 1, 1);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (8, 4, 'Already Paid to CE', 1, 1);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (9, 4, 'Already Paid to Originator', 1, 1);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (10, 4, 'Queries on the Account', 1, 1);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (11, 4, 'Credit Notes Due', 1, 1);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (12, 4, 'Invoices not authorised yet', 1, 1);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (13, 4, 'No Purchase Order', 1, 1);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (14, 4, 'Not Correct contact', 1, 1);
INSERT INTO `transaction_types` (`transaction_id`, `type_id`, `transaction_name`, `bogui_active`, `is_subtype`) VALUES (15, 4, 'Other', 1, 1);
ALTER TABLE `rva_response`
ADD COLUMN `created_at` DATETIME NULL AFTER `note`,
ADD COLUMN `created_by` TINYINT UNSIGNED NULL AFTER `created_at`;
ALTER TABLE `debtor_rva`
ADD COLUMN `sub_status` TINYINT(4) UNSIGNED NULL DEFAULT NULL AFTER `status`;
UPDATE organisation_details
LEFT JOIN temp_registration ON temp_registration.user_id = organisation_details.user_id
SET organisation_details.rav_percent=80
WHERE temp_registration.user_type IN (3,4);
UPDATE debtors_detail
LEFT JOIN debtor_relation ON debtor_relation.debtor_id = debtors_detail.debtor_id
LEFT JOIN organisation_details ON organisation_details.user_id = debtor_relation.trader_id
SET debtors_detail.is_rva=0
WHERE organisation_details.organisation_reference_id IN (11307000040,11308000053,11310000070,11401000099,11409000165,11502000243,11504000272,11503000263,11503000262,11602000476,11607000690,11503000258);
/*2016-11-18*/
ALTER TABLE `debtor_rva`
ADD COLUMN `created_at` DATETIME NULL DEFAULT NULL AFTER `balance`,
ADD COLUMN `created_by` TINYINT UNSIGNED NULL DEFAULT NULL AFTER `created_at`;
ALTER TABLE `debtor_rva`
CHANGE COLUMN `date_sent` `date_sent` DATETIME NULL DEFAULT NULL AFTER `debtor_id`,
CHANGE COLUMN `date_status_change` `date_status_change` DATETIME NULL DEFAULT NULL AFTER `date_sent`;
UPDATE `mail_management` SET `mail_content`='<p>Hi there, </p>\r\n<p>Thank You for confirming your balance.</p>\r\n<p>We appreciate you are busy & we thank you for your time today.</p>\r\n<p>Thank you,</p>\r\n<p>Treasury<br/>\r\n <a href="mailto:treasury@credebtexchange.com">treasury@credebtexchange.com</a><br/>\r\n Switchboard : +353 1 685-3600<br/><br/>\r\n Please Note:- All calls to and from Credebt Exchange are recorded to confirm instructions given and for training and quality control purposes.<br/><br/>\r\n <a href="http://www.credebtexchange.com">http://www.credebtexchange.com</a><br/><br/>\r\n Bank on us<br/>\r\n -------------------------------0----------------------------<br/>\r\n For unsubscribe, legal & confidential disclaimer see email footer:<br/>\r\n <a href="http://www.credebtexchange.com/legal/email+footer">http://www.credebtexchange.com/legal/email+footer</a><br/>\r\n -------------------------------0----------------------------<br/>\r\n © 2016, Credebt Exchange. All rights reserved \r\n</p>' WHERE `mail_id`=56;
UPDATE `mail_management` SET `mail_content`='<p>Hi there, </p>\r\n<p>Account Balance on <date>: <b><currency> <balance></b></p>\r\n<p>As part of our Random Audit Verification procedures, can you please confirm the balance you show as due to Credebt Exchange® on foot of invoices received from <originator>.</p>\r\n<p>Cheques should be made payable to Credebt Exchange® Limited and sent to us here at 60 Lower Baggot Street, Dublin 2 - EFT should be sent to the following account:</p>\r\n\r\n<p>\r\nBarclays - <bank_currency><br>\r\nBank Address: <bank_address><br>\r\nAccount Number: <bank_account><br>\r\nSort Code: <bank_sort_code><br>\r\nIBAN: <bank_iban><br>\r\nBIC/SWIFT: <bank_swift><br>\r\n</p>\r\n\r\n<p>These invoices have been sold on Credebt Exchange®, the payment instructions may not be revoked or amended without the prior written consent of Credebt Exchange®. The instructions and authorisations shall remain in full force and effect until Credebt Exchange gives you notice in writing revoking them.</p>\r\n\r\n<p>We appreciate you are busy & we thank you for your time today.</p>\r\n\r\n<p>Thank you,</p>\r\n<p>Treasury<br/>\r\n <a href="mailto:treasury@credebtexchange.com">treasury@credebtexchange.com</a><br/>\r\n Switchboard : +353 1 685-3600<br/><br/>\r\n Please Note:- All calls to and from Credebt Exchange are recorded to confirm instructions given and for training and quality control purposes.<br/><br/>\r\n <a href="http://www.credebtexchange.com">http://www.credebtexchange.com</a><br/><br/>\r\n Bank on us<br/>\r\n -------------------------------0----------------------------<br/>\r\n For unsubscribe, legal & confidential disclaimer see email footer:<br/>\r\n <a href="http://www.credebtexchange.com/legal/email+footer">http://www.credebtexchange.com/legal/email+footer</a><br/>\r\n -------------------------------0----------------------------<br/>\r\n © 2016, Credebt Exchange. All rights reserved \r\n</p>' WHERE `mail_id`=55;
UPDATE `mail_management` SET `mail_subject`='<Originator Full Name> and <debtor> <debtor_id>' WHERE `mail_id`=58;
UPDATE `mail_management` SET `mail_content`='<p>Hi there,</p>\r\n<p>We would like to inform you that <debtor> has failed the Random Audit Verification. That is to say your debtor was unable to confirm the account balance we show as outstanding.</p>\r\n<p>The outstansing balance we show as of <date>: <currency> <balance></p>\r\n<p>Your Debtor confirmed that they made payment directly to <originator> to settle invoices that were Traded on the Exchange.</p>\r\n<p>This is a very serious issue for the Exchange, as we were not notified by <originator> of this receipt and the funds were not passed back to the Exchange.</p>\r\n<p>It is a strict Term of Trading on the Exchange that all funds received for Traded invoices must be passed back to the Exchange, in their entirety, on a same day basis.</p>\r\n<p>Please confirm payment to the Exchange for all funds received by <originator> for all invoices that were previously Traded on the Exchange.</p>\r\n\r\n<p>Yours Sincerely, </p>\r\n<p>Treasury<br/>\r\n <a href="mailto:treasury@credebtexchange.com">treasury@credebtexchange.com</a><br/>\r\n Switchboard : +353 1 685-3600<br/><br/>\r\n Please Note:- All calls to and from Credebt Exchange are recorded to confirm instructions given and for training and quality control purposes.<br/><br/>\r\n <a href="http://www.credebtexchange.com">http://www.credebtexchange.com</a><br/><br/>\r\n Bank on us<br/>\r\n -------------------------------0----------------------------<br/>\r\n For unsubscribe, legal & confidential disclaimer see email footer:<br/>\r\n <a href="http://www.credebtexchange.com/legal/email+footer">http://www.credebtexchange.com/legal/email+footer</a><br/>\r\n -------------------------------0----------------------------<br/>\r\n © 2016, Credebt Exchange. All rights reserved \r\n</p>' WHERE `mail_id`=59;
UPDATE `mail_management` SET `mail_subject`='<Originator Full Name> and <debtor> <debtor_id>' WHERE `mail_id`=59;
UPDATE `mail_management` SET `mail_content`='<p>Hi there,</p>\r\n<p>Your Debtor <debtor> has failed the Random Audit Verification. That is to say your debtor was unable to confirm the account balance we show as outstanding. </p>\r\n<p>The outstanding balance we show as at <date> : <currency> <balance></p>\r\n<p>The balance your Debtor Confirmed was: <currency> <balance_confirmed></p>\r\n<p>Can you please contact your Debtor in order to address any queries that they may have, please confirm to Treasury within 72 hours that all queries have been addressed to your Debtors satisfaction & that your debtor will be in a position to pass our next RAV which will be sent by Treasury shortly.</p>\r\n\r\n<p>Yours Sincerely, </p>\r\n<p>Treasury<br/>\r\n <a href="mailto:treasury@credebtexchange.com">treasury@credebtexchange.com</a><br/>\r\n Switchboard : +353 1 685-3600<br/><br/>\r\n Please Note:- All calls to and from Credebt Exchange are recorded to confirm instructions given and for training and quality control purposes.<br/><br/>\r\n <a href="http://www.credebtexchange.com">http://www.credebtexchange.com</a><br/><br/>\r\n Bank on us<br/>\r\n -------------------------------0----------------------------<br/>\r\n For unsubscribe, legal & confidential disclaimer see email footer:<br/>\r\n <a href="http://www.credebtexchange.com/legal/email+footer">http://www.credebtexchange.com/legal/email+footer</a><br/>\r\n -------------------------------0----------------------------<br/>\r\n © 2016, Credebt Exchange. All rights reserved \r\n</p>' WHERE `mail_id`=58;
UPDATE `mail_management` SET `mail_to`='treasury@credebtexchange.com', `mail_from`='treasury@credebtexchange.com' WHERE `mail_id` IN (59,58,56,55);
/*2016-11-21*/
ALTER TABLE `rva_mail`
DROP COLUMN `originator_id`;
ALTER TABLE `rva_mail`
CHANGE COLUMN `id` `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
CHANGE COLUMN `rva_id` `rva_id` INT UNSIGNED NULL DEFAULT NULL AFTER `id`,
CHANGE COLUMN `debtor_id` `debtor_id` MEDIUMINT UNSIGNED NULL DEFAULT NULL AFTER `rva_id`;
ALTER TABLE `debtor_rva`
DROP COLUMN `user_id`;
ALTER TABLE `rva_mail`
CHANGE COLUMN `date` `date` DATETIME NULL DEFAULT NULL AFTER `debtor_id`;