Skip to content

Instantly share code, notes, and snippets.

@jaredhoyt
Created November 15, 2010 20:07
Show Gist options
  • Save jaredhoyt/700861 to your computer and use it in GitHub Desktop.
Save jaredhoyt/700861 to your computer and use it in GitHub Desktop.
<?php
$this->PaymentException->bindModel(array(
'hasOne' => array(
'Claim' => array(
'foreignKey' => false,
'conditions' => array('Claim.id = Procedure.claim_id')
),
'Payer' => array(
'foreignKey' => false,
'conditions' => array('Payer.id = Procedure.payer_id')
),
'User' => array(
'foreignKey' => false,
'conditions' => array('false')
)
)
));
$this->paginate = array(
'fields' => array(
'PaymentException.*', 'Procedure.id', 'Procedure.cpt',
'Procedure.expected_amount', 'Procedure.allowed_amount', 'Procedure.difference_amount',
'Claim.id', 'Claim.number', 'Payer.abbr'
),
'limit' => 50,
'conditions' => $conditions,
'contain' => array('Procedure', 'Claim', 'Payer', 'ExceptionWorkflowLog')
);
$this->set('exceptions', $this->paginate('PaymentException'));
SELECT "PaymentException"."id" AS "PaymentException__id", "PaymentException"."appeals" AS "PaymentException__appeals", "PaymentException"."appeal_form" AS "PaymentException__appeal_form", "PaymentException"."proof_of_delivery" AS "PaymentException__proof_of_delivery", "PaymentException"."appeal_amount" AS "PaymentException__appeal_amount", "PaymentException"."refund_amount" AS "PaymentException__refund_amount", "PaymentException"."refund_approved" AS "PaymentException__refund_approved", "PaymentException"."finalized" AS "PaymentException__finalized", "PaymentException"."writeoff_amount" AS "PaymentException__writeoff_amount", "PaymentException"."writeoff_code" AS "PaymentException__writeoff_code", "PaymentException"."procedure_id" AS "PaymentException__procedure_id", "PaymentException"."appeal_user_id" AS "PaymentException__appeal_user_id", "PaymentException"."refund_user_id" AS "PaymentException__refund_user_id", "PaymentException"."created" AS "PaymentException__created", "PaymentException"."updated" AS "PaymentException__updated", "PaymentException"."deleted" AS "PaymentException__deleted", "Procedure"."id" AS "Procedure__id", "Procedure"."cpt" AS "Procedure__cpt", "Procedure"."expected_amount" AS "Procedure__expected_amount", "Procedure"."allowed_amount" AS "Procedure__allowed_amount", "Procedure"."difference_amount" AS "Procedure__difference_amount", "Claim"."id" AS "Claim__id", "Claim"."number" AS "Claim__number", "Payer"."abbr" AS "Payer__abbr"
FROM "exceptions" AS "PaymentException"
LEFT JOIN "procedures" AS "Procedure" ON ("PaymentException"."procedure_id" = "Procedure"."id" AND "Procedure"."deleted" = FALSE)
LEFT JOIN "claims" AS "Claim" ON ("Claim"."id" = "Procedure"."claim_id")
LEFT JOIN "payers" AS "Payer" ON ("Payer"."id" = "Procedure"."payer_id")
WHERE "Procedure"."difference_amount" < 0
AND "PaymentException"."finalized" IS NULL
AND "PaymentException"."deleted" = FALSE
ORDER BY "Claim"."number" asc
LIMIT 50
SELECT "PaymentException"."id" AS "PaymentException__id", "PaymentException"."appeals" AS "PaymentException__appeals", "PaymentException"."appeal_form" AS "PaymentException__appeal_form", "PaymentException"."proof_of_delivery" AS "PaymentException__proof_of_delivery", "PaymentException"."appeal_amount" AS "PaymentException__appeal_amount", "PaymentException"."refund_amount" AS "PaymentException__refund_amount", "PaymentException"."refund_approved" AS "PaymentException__refund_approved", "PaymentException"."finalized" AS "PaymentException__finalized", "PaymentException"."writeoff_amount" AS "PaymentException__writeoff_amount", "PaymentException"."writeoff_code" AS "PaymentException__writeoff_code", "PaymentException"."procedure_id" AS "PaymentException__procedure_id", "PaymentException"."appeal_user_id" AS "PaymentException__appeal_user_id", "PaymentException"."refund_user_id" AS "PaymentException__refund_user_id", "PaymentException"."created" AS "PaymentException__created", "PaymentException"."updated" AS "PaymentException__updated", "PaymentException"."deleted" AS "PaymentException__deleted", "Procedure"."id" AS "Procedure__id", "Procedure"."cpt" AS "Procedure__cpt", "Procedure"."expected_amount" AS "Procedure__expected_amount", "Procedure"."allowed_amount" AS "Procedure__allowed_amount", "Procedure"."difference_amount" AS "Procedure__difference_amount", "Claim"."id" AS "Claim__id", "Claim"."number" AS "Claim__number", "Payer"."abbr" AS "Payer__abbr"
FROM "exceptions" AS "PaymentException"
LEFT JOIN "procedures" AS "Procedure" ON ("PaymentException"."procedure_id" = "Procedure"."id" AND "Procedure"."deleted" = FALSE)
WHERE "Procedure"."difference_amount" < 0
AND "PaymentException"."finalized" IS NULL
AND "PaymentException"."deleted" = FALSE
ORDER BY "Claim"."number" asc
LIMIT 50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment