mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-17 18:20:36 -05:00
Add a customer payments page
Payments on the customer page lists the customer's QuickBooks payments, newest first, with the invoices each was applied to, memo, amount, unapplied credit and totals; each links to the payment page and its PDF. A new View payments permission allows the list, payment page and PDF; Receive payments includes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
10 files changed
+133
-7
No files matched your search
@@ -9,13 +9,27 @@
|
||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# Receives customer payments in QuickBooks: payment type and amount, applied to open invoices oldest first, or
|
||||
# saved as a deposit. A saved payment can be printed (QuickBooks' payment PDF).
|
||||
# saved as a deposit. A saved payment can be printed (QuickBooks' payment PDF). A customer's payments are
|
||||
# listed on their payments page.
|
||||
class QboPaymentsController < ApplicationController
|
||||
|
||||
before_action :authorize_global
|
||||
|
||||
QBO_ERRORS = QboEstimatesController::QBO_ERRORS
|
||||
|
||||
# The customer's payments, newest first, read from QuickBooks
|
||||
def index
|
||||
@customer = Customer.find_by(id: params[:customer_id])
|
||||
return render_404 unless @customer
|
||||
|
||||
@payments = RedmineQboBilling::PaymentWriter.customer_payments(@customer)
|
||||
@totals = RedmineQboBilling::PaymentWriter.payment_totals(@payments)
|
||||
rescue *QBO_ERRORS => e
|
||||
@payments = []
|
||||
@totals = RedmineQboBilling::PaymentWriter.payment_totals([])
|
||||
flash.now[:error] = qbo_message(e)
|
||||
end
|
||||
|
||||
def new
|
||||
customer = Customer.find_by(id: params[:customer_id]) if params[:customer_id].present?
|
||||
@form = RedmineQboBilling::PaymentWriter.new_form(customer: customer, user: User.current)
|
||||
|
||||
Reference in new issue
Block a user