BEGIN;

INSERT INTO config.upgrade_log (version) VALUES ('0314'); --atz

-- We won't necessarily use all of these, but they are here for completeness.
-- Source is the EDI spec 1229 codelist, eg: http://www.stylusstudio.com/edifact/D04B/1229.htm
-- Values are the EDI code value + 1000

INSERT INTO acq.cancel_reason (keep_debits, id, org_unit, label, description) VALUES 
('t',(  1+1000), 1, 'Added',     'The information is to be or has been added.'),
('f',(  2+1000), 1, 'Deleted',   'The information is to be or has been deleted.'),
('t',(  3+1000), 1, 'Changed',   'The information is to be or has been changed.'),
('t',(  4+1000), 1, 'No action',                  'This line item is not affected by the actual message.'),
('t',(  5+1000), 1, 'Accepted without amendment', 'This line item is entirely accepted by the seller.'),
('t',(  6+1000), 1, 'Accepted with amendment',    'This line item is accepted but amended by the seller.'),
('f',(  7+1000), 1, 'Not accepted',               'This line item is not accepted by the seller.'),
('t',(  8+1000), 1, 'Schedule only', 'Code specifying that the message is a schedule only.'),
('t',(  9+1000), 1, 'Amendments',    'Code specifying that amendments are requested/notified.'),
('f',( 10+1000), 1, 'Not found',   'This line item is not found in the referenced message.'),
('t',( 11+1000), 1, 'Not amended', 'This line is not amended by the buyer.'),
('t',( 12+1000), 1, 'Line item numbers changed', 'Code specifying that the line item numbers have changed.'),
('t',( 13+1000), 1, 'Buyer has deducted amount', 'Buyer has deducted amount from payment.'),
('t',( 14+1000), 1, 'Buyer claims against invoice', 'Buyer has a claim against an outstanding invoice.'),
('t',( 15+1000), 1, 'Charge back by seller', 'Factor has been requested to charge back the outstanding item.'),
('t',( 16+1000), 1, 'Seller will issue credit note', 'Seller agrees to issue a credit note.'),
('t',( 17+1000), 1, 'Terms changed for new terms', 'New settlement terms have been agreed.'),
('t',( 18+1000), 1, 'Abide outcome of negotiations', 'Factor agrees to abide by the outcome of negotiations between seller and buyer.'),
('t',( 19+1000), 1, 'Seller rejects dispute', 'Seller does not accept validity of dispute.'),
('t',( 20+1000), 1, 'Settlement', 'The reported situation is settled.'),
('t',( 21+1000), 1, 'No delivery', 'Code indicating that no delivery will be required.'),
('t',( 22+1000), 1, 'Call-off delivery', 'A request for delivery of a particular quantity of goods to be delivered on a particular date (or within a particular period).'),
('t',( 23+1000), 1, 'Proposed amendment', 'A code used to indicate an amendment suggested by the sender.'),
('t',( 24+1000), 1, 'Accepted with amendment, no confirmation required', 'Accepted with changes which require no confirmation.'),
('t',( 25+1000), 1, 'Equipment provisionally repaired', 'The equipment or component has been provisionally repaired.'),
('t',( 26+1000), 1, 'Included', 'Code indicating that the entity is included.'),
('t',( 27+1000), 1, 'Verified documents for coverage', 'Upon receipt and verification of documents we shall cover you when due as per your instructions.'),
('t',( 28+1000), 1, 'Verified documents for debit',    'Upon receipt and verification of documents we shall authorize you to debit our account with you when due.'),
('t',( 29+1000), 1, 'Authenticated advice for coverage',      'On receipt of your authenticated advice we shall cover you when due as per your instructions.'),
('t',( 30+1000), 1, 'Authenticated advice for authorization', 'On receipt of your authenticated advice we shall authorize you to debit our account with you when due.'),
('t',( 31+1000), 1, 'Authenticated advice for credit',        'On receipt of your authenticated advice we shall credit your account with us when due.'),
('t',( 32+1000), 1, 'Credit advice requested for direct debit',           'A credit advice is requested for the direct debit.'),
('t',( 33+1000), 1, 'Credit advice and acknowledgement for direct debit', 'A credit advice and acknowledgement are requested for the direct debit.'),
('t',( 34+1000), 1, 'Inquiry',     'Request for information.'),
('t',( 35+1000), 1, 'Checked',     'Checked.'),
('t',( 36+1000), 1, 'Not checked', 'Not checked.'),
('f',( 37+1000), 1, 'Cancelled',   'Discontinued.'),
('t',( 38+1000), 1, 'Replaced',    'Provide a replacement.'),
('t',( 39+1000), 1, 'New',         'Not existing before.'),
('t',( 40+1000), 1, 'Agreed',      'Consent.'),
('t',( 41+1000), 1, 'Proposed',    'Put forward for consideration.'),
('t',( 42+1000), 1, 'Already delivered', 'Delivery has taken place.'),
('t',( 43+1000), 1, 'Additional subordinate structures will follow', 'Additional subordinate structures will follow the current hierarchy level.'),
('t',( 44+1000), 1, 'Additional subordinate structures will not follow', 'No additional subordinate structures will follow the current hierarchy level.'),
('t',( 45+1000), 1, 'Result opposed',         'A notification that the result is opposed.'),
('t',( 46+1000), 1, 'Auction held',           'A notification that an auction was held.'),
('t',( 47+1000), 1, 'Legal action pursued',   'A notification that legal action has been pursued.'),
('t',( 48+1000), 1, 'Meeting held',           'A notification that a meeting was held.'),
('t',( 49+1000), 1, 'Result set aside',       'A notification that the result has been set aside.'),
('t',( 50+1000), 1, 'Result disputed',        'A notification that the result has been disputed.'),
('t',( 51+1000), 1, 'Countersued',            'A notification that a countersuit has been filed.'),
('t',( 52+1000), 1, 'Pending',                'A notification that an action is awaiting settlement.'),
('f',( 53+1000), 1, 'Court action dismissed', 'A notification that a court action will no longer be heard.'),
('t',( 54+1000), 1, 'Referred item, accepted', 'The item being referred to has been accepted.'),
('f',( 55+1000), 1, 'Referred item, rejected', 'The item being referred to has been rejected.'),
('t',( 56+1000), 1, 'Debit advice statement line',  'Notification that the statement line is a debit advice.'),
('t',( 57+1000), 1, 'Credit advice statement line', 'Notification that the statement line is a credit advice.'),
('t',( 58+1000), 1, 'Grouped credit advices',       'Notification that the credit advices are grouped.'),
('t',( 59+1000), 1, 'Grouped debit advices',        'Notification that the debit advices are grouped.'),
('t',( 60+1000), 1, 'Registered', 'The name is registered.'),
('f',( 61+1000), 1, 'Payment denied', 'The payment has been denied.'),
('t',( 62+1000), 1, 'Approved as amended', 'Approved with modifications.'),
('t',( 63+1000), 1, 'Approved as submitted', 'The request has been approved as submitted.'),
('f',( 64+1000), 1, 'Cancelled, no activity', 'Cancelled due to the lack of activity.'),
('t',( 65+1000), 1, 'Under investigation', 'Investigation is being done.'),
('t',( 66+1000), 1, 'Initial claim received', 'Notification that the initial claim was received.'),
('f',( 67+1000), 1, 'Not in process', 'Not in process.'),
('f',( 68+1000), 1, 'Rejected, duplicate', 'Rejected because it is a duplicate.'),
('f',( 69+1000), 1, 'Rejected, resubmit with corrections', 'Rejected but may be resubmitted when corrected.'),
('t',( 70+1000), 1, 'Pending, incomplete', 'Pending because of incomplete information.'),
('t',( 71+1000), 1, 'Under field office investigation', 'Investigation by the field is being done.'),
('t',( 72+1000), 1, 'Pending, awaiting additional material', 'Pending awaiting receipt of additional material.'),
('t',( 73+1000), 1, 'Pending, awaiting review', 'Pending while awaiting review.'),
('t',( 74+1000), 1, 'Reopened', 'Opened again.'),
('t',( 75+1000), 1, 'Processed by primary, forwarded to additional payer(s)',   'This request has been processed by the primary payer and sent to additional payer(s).'),
('t',( 76+1000), 1, 'Processed by secondary, forwarded to additional payer(s)', 'This request has been processed by the secondary payer and sent to additional payer(s).'),
('t',( 77+1000), 1, 'Processed by tertiary, forwarded to additional payer(s)',  'This request has been processed by the tertiary payer and sent to additional payer(s).'),
('t',( 78+1000), 1, 'Previous payment decision reversed', 'A previous payment decision has been reversed.'),
('t',( 79+1000), 1, 'Not our claim, forwarded to another payer(s)', 'A request does not belong to this payer but has been forwarded to another payer(s).'),
('t',( 80+1000), 1, 'Transferred to correct insurance carrier', 'The request has been transferred to the correct insurance carrier for processing.'),
('t',( 81+1000), 1, 'Not paid, predetermination pricing only', 'Payment has not been made and the enclosed response is predetermination pricing only.'),
('t',( 82+1000), 1, 'Documentation claim', 'The claim is for documentation purposes only, no payment required.'),
('t',( 83+1000), 1, 'Reviewed', 'Assessed.'),
('f',( 84+1000), 1, 'Repriced', 'This price was changed.'),
('t',( 85+1000), 1, 'Audited', 'An official examination has occurred.'),
('t',( 86+1000), 1, 'Conditionally paid', 'Payment has been conditionally made.'),
('t',( 87+1000), 1, 'On appeal', 'Reconsideration of the decision has been applied for.'),
('t',( 88+1000), 1, 'Closed', 'Shut.'),
('t',( 89+1000), 1, 'Reaudited', 'A subsequent official examination has occurred.'),
('t',( 90+1000), 1, 'Reissued', 'Issued again.'),
('t',( 91+1000), 1, 'Closed after reopening', 'Reopened and then closed.'),
('t',( 92+1000), 1, 'Redetermined', 'Determined again or differently.'),
('t',( 93+1000), 1, 'Processed as primary',   'Processed as the first.'),
('t',( 94+1000), 1, 'Processed as secondary', 'Processed as the second.'),
('t',( 95+1000), 1, 'Processed as tertiary',  'Processed as the third.'),
('t',( 96+1000), 1, 'Correction of error', 'A correction to information previously communicated which contained an error.'),
('t',( 97+1000), 1, 'Single credit item of a group', 'Notification that the credit item is a single credit item of a group of credit items.'),
('t',( 98+1000), 1, 'Single debit item of a group',  'Notification that the debit item is a single debit item of a group of debit items.'),
('t',( 99+1000), 1, 'Interim response', 'The response is an interim one.'),
('t',(100+1000), 1, 'Final response',   'The response is an final one.'),
('t',(101+1000), 1, 'Debit advice requested', 'A debit advice is requested for the transaction.'),
('t',(102+1000), 1, 'Transaction not impacted', 'Advice that the transaction is not impacted.'),
('t',(103+1000), 1, 'Patient to be notified',                    'The action to take is to notify the patient.'),
('t',(104+1000), 1, 'Healthcare provider to be notified',        'The action to take is to notify the healthcare provider.'),
('t',(105+1000), 1, 'Usual general practitioner to be notified', 'The action to take is to notify the usual general practitioner.'),
('t',(106+1000), 1, 'Advice without details', 'An advice without details is requested or notified.'),
('t',(107+1000), 1, 'Advice with details', 'An advice with details is requested or notified.'),
('t',(108+1000), 1, 'Amendment requested', 'An amendment is requested.'),
('t',(109+1000), 1, 'For information', 'Included for information only.'),
('f',(110+1000), 1, 'Withdraw', 'A code indicating discontinuance or retraction.'),
('t',(111+1000), 1, 'Delivery date change', 'The action / notiification is a change of the delivery date.'),
('f',(112+1000), 1, 'Quantity change',      'The action / notification is a change of quantity.'),
('t',(113+1000), 1, 'Resale and claim', 'The identified items have been sold by the distributor to the end customer, and compensation for the loss of inventory value is claimed.'),
('t',(114+1000), 1, 'Resale',           'The identified items have been sold by the distributor to the end customer.'),
('t',(115+1000), 1, 'Prior addition', 'This existing line item becomes available at an earlier date.');

COMMIT;

