Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- temp.Campus,
- temp.shop_name,
- temp.shop_id,
- temp.state,
- temp.state_reason,
- -- c.class,
- -- temp2.Errors as Campus_errors,
- temp.Errors as "Local Errors",
- CONCAT(TRUNCATE(temp.Errors/(temp2.Errors)*100,2),'%%') as "Local Errors %%",
- temp2.Errors as "Campus Errors",
- CONCAT(TRUNCATE(temp2.Errors/(temp2.Errors+oo.orders)*100,2),'%%') as "Campus Errors %%"
- From (
- SELECT aa. name as "Campus",
- aa.id,
- aa.shop_name ,
- aa.shop_id,
- aa.state,
- aa.state_reason,
- count(aa.Error) as "Errors"
- FROM (
- SELECT bo.name,
- bo.id,
- oo.owner_id,
- ee.name as shop_name,
- oo.shop_id,
- state,
- state_reason,
- count(*) AS Error
- FROM orders_order oo
- INNER JOIN billi_organization bo ON bo.id = oo.organization_id
- INNER JOIN entities_entity ee ON ee.id = oo.shop_id
- WHERE bo.creation_time > '2012-6-1'
- AND state LIKE '%%ERROR%%'
- AND (oo.merchant_creation_time-interval '5' hour) between '%(from)s' and '%(to)s'
- GROUP BY oo.shop_id, state_reason, oo.owner_id) aa
- WHERE (aa.state_reason != "Exception occured (503, u'Service Unavailable')" OR
- aa.state_reason != "Card Suspended The card is suspended." OR
- aa.state_reason not like "%% not approved" OR
- aa.state_reason != "Could not print! Printer is offline. The cover is open. Paper has ended., Could not print! Printer is offline. The cover is open. Paper has ended." OR
- aa.state_reason != "Plan Expired All other abnormal error conditions." OR
- aa.state_reason != "INVALID CARD" OR
- aa.state_reason != "We are sorry, your NAU email address could not be found. Verify your email address or contact campus support during business hours 8a-5p mon-fri (928)523-0081" OR
- aa.state_reason != "Privilege Suspended" OR
- aa.state_reason != "CARD IS LOST" OR
- aa.state_reason != "Internal Error" OR
- aa.state_reason != "id: 98065L not approved" OR
- aa.state_reason != "Could not print! Printer is offline. The cover is open. Paper has ended., Could not print! Printer is offline. The cover is open." OR
- aa.state_reason != "Could not print! Printer is offline. Paper has ended., Could not print! Printer is offline. The cover is open. Paper has ended." OR
- aa.state_reason != "SERVICE_TYPE_NOT_SUPPORTED" OR
- aa.state_reason != "Card Invalid-L/S" OR
- aa.state_reason != "Invalid request parameter: amount must be greater than zero" OR
- aa.state_reason != "FAILED" OR
- aa.state_reason != "Account tilghmantuebner@gmail.com is restricted" OR
- aa.state_reason != "An error occurred during processing. Please try again." OR
- aa.state_reason != "id: 10672L not approved" OR
- aa.state_reason != "id: 107307L not approved" OR
- aa.state_reason != "id: 89650L not approved" OR
- aa.state_reason != "NO+MEAL+PLAN" OR
- aa.state_reason != "You do not have permission to use the preapproval key" OR
- aa.state_reason != "The email address mpowers831@aim.com is invalid. It may not be registered in PayPal's system yet" OR
- aa.state_reason != "Plan Expired" OR
- aa.state_reason != "MISSING_HANDLER" OR
- aa.state_reason != "Exception" OR
- aa.state_reason != "Unknown" OR
- aa.state_reason != "" OR
- aa.state_reason != "Account lilimartinez9348@yahoo.com is restricted" OR
- aa.state_reason != "Account tilghmantuebner@gmail.com is restricted" OR
- aa.state_reason != "Card Deleted" OR
- aa.state_reason != "Card Expired" OR
- aa.state_reason != "Card Expired The card is expired." OR
- aa.state_reason != "Card Invalid -L/S" OR
- aa.state_reason != "Card Invalid-L/S" OR aa.state_reason != "CARD IS LOST" OR aa.state_reason != "Card Not In System" OR aa.state_reason != "Card Not In System The card is not entered in the system." OR aa.state_reason != "Card On Hold" OR aa.state_reason != "Card On Hold Use of card denied until the hold expires." OR aa.state_reason != "Card Suspended" OR aa.state_reason != "Card Suspended The card is suspended." OR aa.state_reason != "CREDIT CARD EXPIRATION DATE IS INVALID." OR aa.state_reason != "Exception" OR aa.state_reason != "Exception occured (503, u'Service Unavailable')" OR aa.state_reason != "FAILED" OR aa.state_reason != "FRAUDULENT USER" OR aa.state_reason != "id: %% not approved" OR aa.state_reason != "id: 10672L not approved" OR aa.state_reason != "id: 107307L not approved" OR aa.state_reason != "id: 89650L not approved" OR aa.state_reason != "id: 98065L not approved" OR aa.state_reason != "INSUFFICIENT BALANCE" OR aa.state_reason != "Insufficient Funds The card account has an insufficient balance or credit to cover the purchase." OR aa.state_reason != "INSUFFICIENT_BALANCE" OR aa.state_reason != "INVALID CARD" OR aa.state_reason != "MISSING_HANDLER" OR aa.state_reason != "No credit card for tapingo delivery fee!" OR aa.state_reason != "PATRON+NOT+FOUND" OR aa.state_reason != "PAYMENT_SERVER_UNREACHABLE" OR aa.state_reason != "Period Excluded The privilege plan rules deny the use of the privilege during the time interval in effect." OR aa.state_reason != "Period Used The privilege used at a previous time period during the day." OR aa.state_reason != "Period Used The privilege used at a previous time period during the day. [charged meal plan points]" OR aa.state_reason != "Plan Expired" OR aa.state_reason != "Plan Expired All other abnormal error conditions." OR aa.state_reason != "Plan Expired The cardholder's privilege plan has expired." OR aa.state_reason != "SERVICE_TYPE_NOT_SUPPORTED" OR aa.state_reason != "SHOP_IS_COMING_SOON" OR aa.state_reason != "SHOP_IS_NOT_ACTIVE" OR aa.state_reason != "SHOP_IS_NOT_OPEN" OR aa.state_reason != "SHOP_IS_UNDER_MAINTENANCE" OR aa.state_reason != "THE CREDIT CARD HAS EXPIRED." OR aa.state_reason != "THE CREDIT CARD NUMBER IS INVALID." OR aa.state_reason != "The email address mpowers831@aim.com is invalid. It may not be registered in PayPal's system yet" OR aa.state_reason != "The payment can not be processed because no payment source is available" OR aa.state_reason != "The preapproval key can't be used before the start date or after the end date" OR aa.state_reason != "The preapproval key hasn't been authorized yet" OR aa.state_reason != "THE TRANSACTION HAS BEEN DECLINED BECAUSE OF AN AVS MISMATCH. THE ADDRESS PROVIDED DOES NOT MATCH BILLING ADDRESS OF CARDHOLDER." OR aa.state_reason != "THIS TRANSACTION HAS BEEN DECLINED." OR aa.state_reason != "USER NOT SUBSCRIBED" OR aa.state_reason != "USER WAS NOTIFIED" OR aa.state_reason != "We are sorry, your NAU email address could not be found. Verify your email address or contact campus" OR aa.state_reason != "We are sorry, your NAU email address could not be found. Verify your email address or contact campus support during business hours 8a-5p mon-fri (928)523-0081" OR
- aa.state_reason != "You do not have permission to use the preapproval key")
- GROUP BY aa.shop_id, aa.state_reason
- ) temp
- join (
- SELECT
- aa. name as "Campus",
- aa.id,
- count(aa.Error) as "Errors"
- FROM
- (
- SELECT
- bo.name,
- bo.id,
- oo.owner_id,
- ee.name as shop_name,
- oo.shop_id,
- state,
- state_reason,
- count(*) AS Error
- FROM
- orders_order oo
- INNER JOIN billi_organization bo ON bo.id = oo.organization_id
- INNER JOIN entities_entity ee ON ee.id = oo.shop_id
- WHERE
- bo.creation_time > '2012-6-1'
- AND state LIKE 'ERROR%%'
- AND (oo.merchant_creation_time-interval '5' hour) between '%(from)s' and '%(to)s'
- GROUP BY
- oo.shop_id,
- state_reason,
- oo.owner_id
- ) aa
- WHERE
- (aa.state_reason != "Exception occured (503, u'Service Unavailable')" OR aa.state_reason != "Card Suspended The card is suspended." OR aa.state_reason != "%% not approved" OR aa.state_reason != "Could not print! Printer is offline. The cover is open. Paper has ended., Could not print! Printer is offline. The cover is open. Paper has ended." OR aa.state_reason != "Plan Expired All other abnormal error conditions." OR aa.state_reason != "INVALID CARD" OR aa.state_reason != "We are sorry, your NAU email address could not be found. Verify your email address or contact campus support during business hours 8a-5p mon-fri (928)523-0081" OR aa.state_reason != "Privilege Suspended" OR aa.state_reason != "CARD IS LOST" OR aa.state_reason != "Internal Error" OR aa.state_reason != "id: 98065L not approved" OR aa.state_reason != "Could not print! Printer is offline. The cover is open. Paper has ended., Could not print! Printer is offline. The cover is open." OR aa.state_reason != "Could not print! Printer is offline. Paper has ended., Could not print! Printer is offline. The cover is open. Paper has ended." OR aa.state_reason != "SERVICE_TYPE_NOT_SUPPORTED" OR aa.state_reason != "Card Invalid-L/S" OR aa.state_reason != "Invalid request parameter: amount must be greater than zero" OR aa.state_reason != "FAILED" OR aa.state_reason != "Account tilghmantuebner@gmail.com is restricted" OR aa.state_reason != "An error occurred during processing. Please try again." OR aa.state_reason != "id: 10672L not approved" OR aa.state_reason != "id: 107307L not approved" OR aa.state_reason != "id: 89650L not approved" OR aa.state_reason != "NO+MEAL+PLAN" OR aa.state_reason != "You do not have permission to use the preapproval key" OR aa.state_reason != "The email address mpowers831@aim.com is invalid. It may not be registered in PayPal's system yet" OR aa.state_reason != "Plan Expired" OR aa.state_reason != "MISSING_HANDLER" OR aa.state_reason != "Exception" OR aa.state_reason != "Unknown" OR aa.state_reason != "" OR aa.state_reason != "Account lilimartinez9348@yahoo.com is restricted" OR aa.state_reason != "Account tilghmantuebner@gmail.com is restricted" OR aa.state_reason != "Card Deleted" OR aa.state_reason != "Card Expired" OR aa.state_reason != "Card Expired The card is expired." OR aa.state_reason != "Card Invalid -L/S" OR aa.state_reason != "Card Invalid-L/S" OR aa.state_reason != "CARD IS LOST" OR aa.state_reason != "Card Not In System" OR aa.state_reason != "Card Not In System The card is not entered in the system." OR aa.state_reason != "Card On Hold" OR aa.state_reason != "Card On Hold Use of card denied until the hold expires." OR aa.state_reason != "Card Suspended" OR aa.state_reason != "Card Suspended The card is suspended." OR aa.state_reason != "CREDIT CARD EXPIRATION DATE IS INVALID." OR aa.state_reason != "Exception" OR aa.state_reason != "Exception occured (503, u'Service Unavailable')" OR aa.state_reason != "FAILED" OR aa.state_reason != "FRAUDULENT USER" OR aa.state_reason != "%% not approved" OR aa.state_reason != "id: 10672L not approved" OR aa.state_reason != "id: 107307L not approved" OR aa.state_reason != "id: 89650L not approved" OR aa.state_reason != "id: 98065L not approved" OR aa.state_reason != "INSUFFICIENT BALANCE" OR aa.state_reason != "Insufficient Funds The card account has an insufficient balance or credit to cover the purchase." OR aa.state_reason != "INSUFFICIENT_BALANCE" OR aa.state_reason != "INVALID CARD" OR aa.state_reason != "MISSING_HANDLER" OR aa.state_reason != "No credit card for tapingo delivery fee!" OR aa.state_reason != "PATRON+NOT+FOUND" OR aa.state_reason != "PAYMENT_SERVER_UNREACHABLE" OR aa.state_reason != "Period Excluded The privilege plan rules deny the use of the privilege during the time interval in effect." OR aa.state_reason != "Period Used The privilege used at a previous time period during the day." OR aa.state_reason != "Period Used The privilege used at a previous time period during the day. [charged meal plan points]" OR aa.state_reason != "Plan Expired" OR aa.state_reason != "Plan Expired All other abnormal error conditions." OR aa.state_reason != "Plan Expired The cardholder's privilege plan has expired." OR aa.state_reason != "SERVICE_TYPE_NOT_SUPPORTED" OR aa.state_reason != "SHOP_IS_COMING_SOON" OR aa.state_reason != "SHOP_IS_NOT_ACTIVE" OR aa.state_reason != "SHOP_IS_NOT_OPEN" OR aa.state_reason != "SHOP_IS_UNDER_MAINTENANCE" OR aa.state_reason != "THE CREDIT CARD HAS EXPIRED." OR aa.state_reason != "THE CREDIT CARD NUMBER IS INVALID." OR aa.state_reason != "The email address mpowers831@aim.com is invalid. It may not be registered in PayPal's system yet" OR aa.state_reason != "The payment can not be processed because no payment source is available" OR aa.state_reason != "The preapproval key can't be used before the start date or after the end date" OR aa.state_reason != "The preapproval key hasn't been authorized yet" OR aa.state_reason != "THE TRANSACTION HAS BEEN DECLINED BECAUSE OF AN AVS MISMATCH. THE ADDRESS PROVIDED DOES NOT MATCH BILLING ADDRESS OF CARDHOLDER." OR aa.state_reason != "THIS TRANSACTION HAS BEEN DECLINED." OR aa.state_reason != "USER NOT SUBSCRIBED" OR aa.state_reason != "USER WAS NOTIFIED" OR aa.state_reason != "We are sorry, your NAU email address could not be found. Verify your email address or contact campus" OR aa.state_reason != "We are sorry, your NAU email address could not be found. Verify your email address or contact campus support during business hours 8a-5p mon-fri (928)523-0081" OR aa.state_reason != "You do not have permission to use the preapproval key")
- GROUP BY
- aa.id
- ) temp2 on temp2.id = temp.id
- left join
- (
- select
- count(oo.id) as orders,
- oo.organization_id
- From
- orders_order oo
- where
- oo.is_valid_for_billing = 1
- and oo.is_valid_for_reporting = 1
- and oo.state = "COMPLETED"
- and oo.amount_from_user >0
- AND (oo.merchant_creation_time-interval '5' hour) between '%(from)s' and '%(to)s'
- group by
- oo.organization_id
- ) oo on oo.organization_id = temp.id
- left join
- (
- select "INSUFFICIENT_BALANCE" as reason ,"User" as class union all select "Period Used The privilege used at a previous time period during the day." ,"Validation" union all select "SHOP_IS_UNDER_MAINTENANCE" ,"Validation" union all select "Card On Hold Use of card denied until the hold expires." ,"Payment Server" union all select "Insufficient Funds" ,"User" union all select "THIS TRANSACTION HAS BEEN DECLINED." ,"Payment Server" union all select "ORDER_DELIVERY_INVALID_ADDRESS_NOT_IN_ZONE" ,"Validation" union all select "Card Expired The card is expired." ,"User" union all select "Card Expired" ,"User" union all select "THE CREDIT CARD NUMBER IS INVALID." ,"User" union all select "Could not print! Printer is off! (timed out)" ,"POS" union all select "Privilege Unassigned" ,"Unknown" union all select "Could not print! Printer is off! (actively refused)" ,"POS" union all select "Card Not In System" ,"Payment Server" union all select "SHOP_IS_COMING_SOON" ,"Validation" union all select "SHOP_IS_NOT_OPEN" ,"Validation" union all select "Card Not In System The card is not entered in the system." ,"Payment Server" union all select "Card On Hold" ,"Validation" union all select "Invalid Location The Location is unavailable in privilege plan rules." ,"Validation" union all select "ORDER_DID_NOT_REACH_MINIMUM" ,"Validation" union all select "Could not print! Printer is offline. The cover is open. Paper has ended." ,"POS" union all select "Card Invalid -L/S" ,"Payment Server" union all select "Could not print! Printer is offline. Paper has ended." ,"POS" union all select "Privilege Unassigned The cardholder attempts a non-assigned privilege." ,"Payment Server" union all select "Insufficient Funds The card account has an insufficient balance or credit to cover the purchase." ,"User" union all select "Invalid value or type" ,"Gateway" union all select "THE CREDIT CARD HAS EXPIRED." ,"Validation" union all select "USER NOT SUBSCRIBED" ,"Payment Server" union all select "BlackBoard timeout!" ,"Payment Server" union all select "Card Deleted" ,"Payment Server" union all select "PAYMENT_SERVER_UNREACHABLE" ,"Payment Server" union all select "Meal Plan order with zero amount!" ,"Validation" union all select "Unknown error!" ,"Unknown" union all select "Plan Expired The cardholder's privilege plan has expired." ,"Validation" union all select "" ,"Unknown" union all select "SHOP_IS_NOT_ACTIVE" ,"Validation" union all select "TENDER NOT ALLOWED IN SHOP" ,"Validation" union all select "THE TRANSACTION HAS BEEN DECLINED BECAUSE OF AN AVS MISMATCH. THE ADDRESS PROVIDED DOES NOT MATCH BILLING ADDRESS OF CARDHOLDER." ,"Payment Server" union all select "Undefined Error All other abnormal error conditions." ,"Unknown" union all select "MISSING_HANDLER" ,"Other" union all select "Exception" ,"Unknown" union all select "The preapproval key can't be used before the start date or after the end date" ,"Unknown" union all select "CREDIT CARD EXPIRATION DATE IS INVALID." ,"User" union all select "Meal Plan order with amount > 1!" ,"Validation" union all select "Invalid Time The privilege plan rules deny the use of the privilege during the time interval in effect." ,"Validation" union all select "TOO_MANY_COUNT_TRANSACTIONS" ,"Unknown" union all select "We are sorry, your NAU email address could not be found. Verify your email address or contact campus" ,"Other" union all select "The preapproval key hasn't been authorized yet" ,"Unknown" union all select "Tender # Not Valid" ,"Validation" union all select "Unknown" ,"Unknown" union all select "Invalid value or type Encryption/error checking of '0' and a defined encryption key in the configu" ,"POS" union all select "USER WAS NOTIFIED" ,"Other" union all select "Period Used The privilege used at a previous time period during the day. [charged meal plan points]" ,"Validation" union all select "PATRON+NOT+FOUND" ,"Other" union all select "Could not print! No such host is known" ,"pos" union all select "Undefined Error" ,"Unknown" union all select "AUTO_SELECT_FAILED" ,"Validation" union all select "NON MEAL PLAN TENDER IN MEAL PLAN SHOP" ,"User" union all select "Could not reach spooler." ,"POS" union all select "Card Suspended" ,"Validation" union all select "Could not print! Printer is offline. The cover is open." ,"POS" union all select "Could not reach spooler server!" ,"POS" union all select "Could not print! Printer is offline. Paper has ended., Could not print! Printer is offline. Paper has ended." ,"POS" union all select "Virtual tender does not have two sub tenders!" ,"Validation" union all select "The payment can not be processed because no payment source is available" ,"User" union all select "Could not print! Printer is offline. A non recoverable error has occurred. An auto-cutter error has occurred." ,"POS" union all select "Invalid value or type ID number or Track 2 card data ID does not match the card definition encoding." ,"POS" union all select "Could not print! Printer is off! (timed out), Could not print! Printer is off! (timed out)" ,"POS" union all select "need more than 0 values to unpack" ,"Unknown" union all select "FRAUDULENT USER" ,"User" union all select "Invalid sub tenders for virtual tender!" ,"Validation" union all select "AN ERROR OCCURRED DURING PROCESSING. PLEASE TRY AGAIN." ,"Unknown" union all select "Invalid value or type Terminal Number '0' or > '99999999' or not numeric type." ,"POS" union all select "Period Excluded The privilege plan rules deny the use of the privilege during the time interval in effect." ,"Validation" union all select "Exception occured (503, u'Service Unavailable')" ,"Unknown" union all select "Card Suspended The card is suspended." ,"Validation" union all select "%% not approved" ,"Other" union all select "Could not print! Printer is offline. The cover is open. Paper has ended., Could not print! Printer is offline. The cover is open. Paper has ended." ,"POS" union all select "INSUFFICIENT BALANCE" ,"Validation" union all select "Plan Expired All other abnormal error conditions." ,"Other" union all select "TIMEOUT" ,"POS" union all select "INVALID CARD" ,"Validation" union all select "No credit card for tapingo delivery fee!" ,"User" union all select "We are sorry, your NAU email address could not be found. Verify your email address or contact campus support during business hours 8a-5p mon-fri (928)523-0081" ,"User" union all select "Privilege Suspended" ,"Other" union all select "CARD IS LOST" ,"Validation" union all select "Internal Error" ,"Other" union all select "id: 98065L not approved" ,"Other" union all select "Could not print! Printer is offline. The cover is open. Paper has ended., Could not print! Printer is offline. The cover is open." ,"POS" union all select "Could not print! Printer is offline. Paper has ended., Could not print! Printer is offline. The cover is open. Paper has ended." ,"POS" union all select "SERVICE_TYPE_NOT_SUPPORTED" ,"Other" union all select "Card Invalid-L/S" ,"Validation" union all select "Invalid request parameter: amount must be greater than zero" ,"User" union all select "Account lilimartinez9348@yahoo.com is restricted" ,"Other" union all select "FAILED" ,"Unknown" union all select "Account tilghmantuebner@gmail.com is restricted" ,"User" union all select "An error occurred during processing. Please try again." ,"Unknown" union all select "id: 10672L not approved" ,"Other" union all select "id: 107307L not approved" ,"Other" union all select "id: 89650L not approved" ,"Other" union all select "NO+MEAL+PLAN" ,"user" union all select "You do not have permission to use the preapproval key" ,"Other" union all select "The email address mpowers831@aim.com is invalid. It may not be registered in PayPal's system yet" ,"User" union all select "Plan Expired" ,"Validation" union all select "No meal equivalence for shop!" ,"User" union all select "NO PLAN WITH SUFFICIENT BALANCE FOUND" ,"Validation" union all select "Exception occured Server raised fault: 'Server was unable to process request. ---> Unable to cast ob" ,"Validation" union all select "INSUFICCIENT_BALANCE" ,"User" union all select "Exception occured Incorrect padding" ,"Validation" union all select "" ,"Other" union all select "SHOP IS NOT OPEN IN SLOT TIME" ,"Validation" union all select "ERR -43" ,"Unknown" union all select "contact venue to make sure order was received" ,"POS" union all select "" ,"Other" union all select "" ,"Other" union all select "INVALID PLAN" ,"Validation"
- ) c on c.reason = temp.state_reason
- ,
- (
- select
- count(oo.id) as orders
- From
- orders_order oo
- where
- oo.is_valid_for_billing = 1
- and oo.is_valid_for_reporting = 1
- and oo.state = "COMPLETED"
- and oo.amount_from_user >0
- AND (oo.merchant_creation_time-interval '5' hour) between '%(from)s' and '%(to)s'
- ) tapingo_orders
- where
- temp.id != 69
- group by
- temp.Campus,
- temp.shop_name,
- temp.shop_id,
- temp.state,
- temp.state_reason
- order by
- temp.Campus,
- temp.Errors desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement