Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design: Deleting Invoices #2160

Closed
jniles opened this issue Sep 27, 2017 · 3 comments
Closed

Design: Deleting Invoices #2160

jniles opened this issue Sep 27, 2017 · 3 comments
Assignees
Labels

Comments

@jniles
Copy link
Collaborator

jniles commented Sep 27, 2017

This issue covers the design for deleting Invoices using the proposal described in #2044.

Design
Deleting invoices will be performed from the Invoice Registry and the Posting Journal (via the transaction edit modal). It is not allowed on posted records. A deleted invoice will remove the lines from the posting_journal, invoice, invoice_item, invoice_billing_service, and invoice_subsidy. It will also remove the record_uuid from the document_map.

There are some conditional rules on this operation:

  1. If the invoice has been posted, it cannot be deleted. The only way to reverse a posted record is by using a reversing voucher.
  2. If the invoice has a referencing transaction, it cannot be deleted. This is most likely a voucher that is reversing the invoice or a cash payment against the invoice.

The steps to implement this are:

  1. Create a routing function from HTTP DELETE /transactions/:uuid that will determine if the transaction is a cash payment, voucher, or invoice.
  2. Create the safelyDeleteInvoice(uuid) in the finance/patientInvoice.js. module.
  3. Write the SQL logic to determine if the invoice should be deleted as described in the above rules.
@DedrickEnc
Copy link
Contributor

DedrickEnc commented Oct 3, 2017

@jniles
Why not HTTP DELETE /invoices/:uuid as route?

@jniles
Copy link
Collaborator Author

jniles commented Oct 3, 2017

It makes it much easier to write a single controller on the client.

@jniles jniles mentioned this issue Oct 9, 2017
3 tasks
@jniles jniles self-assigned this Oct 9, 2017
jniles added a commit that referenced this issue Oct 10, 2017
This commit polishes the client side code for deleting records from the
registries.  It also ensure the delete integration tests for invoices
reference the correct invoice.

Closes #2160.
jniles added a commit that referenced this issue Oct 11, 2017
This commit polishes the client side code for deleting records from the
registries.  It also ensure the delete integration tests for invoices
reference the correct invoice.

Closes #2160.
jniles added a commit that referenced this issue Oct 13, 2017
This commit polishes the client side code for deleting records from the
registries.  It also ensure the delete integration tests for invoices
reference the correct invoice.

Closes #2160.
bors bot added a commit that referenced this issue Oct 16, 2017
2188: feature: delete records r=DedrickEnc a=jniles

This PR implements  deleting cash payments following the proposal in #2044 and the design discussed in #2159.  It does much of the heavy lifting for the other two delete issues - vouchers (#2161) and invoices (#2160).

TODO:
 - [x] End to End Tests
 - [x] Delete Invoices #2160.
 - [x] Delete Vouchers #2161.
@jniles
Copy link
Collaborator Author

jniles commented Oct 16, 2017

Closed in #2188.

@jniles jniles closed this as completed Oct 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants