{"action":"opened","issue":{"url":"https://api.github.com/repos/tgilvear/SQL-Code/issues/1","labels_url":"https://api.github.com/repos/tgilvear/SQL-Code/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/tgilvear/SQL-Code/issues/1/comments","events_url":"https://api.github.com/repos/tgilvear/SQL-Code/issues/1/events","html_url":"https://github.com/tgilvear/SQL-Code/issues/1","id":58105917,"number":1,"title":"Zuora Touch Scripts","user":{"login":"tgilvear","id":11064004,"avatar_url":"https://avatars.githubusercontent.com/u/11064004?v=3","gravatar_id":"","url":"https://api.github.com/users/tgilvear","html_url":"https://github.com/tgilvear","followers_url":"https://api.github.com/users/tgilvear/followers","following_url":"https://api.github.com/users/tgilvear/following{/other_user}","gists_url":"https://api.github.com/users/tgilvear/gists{/gist_id}","starred_url":"https://api.github.com/users/tgilvear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgilvear/subscriptions","organizations_url":"https://api.github.com/users/tgilvear/orgs","repos_url":"https://api.github.com/users/tgilvear/repos","events_url":"https://api.github.com/users/tgilvear/events{/privacy}","received_events_url":"https://api.github.com/users/tgilvear/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-18T18:16:24Z","updated_at":"2015-02-18T18:16:24Z","closed_at":null,"body":"select a.Id\r\n  from ZuoraProd..zAccount a\r\n  left join SFDCProd..Zuora__CustomerAccount__c s\r\n    on a.Id = s.Zuora__Zuora_Id__c\r\n where a.Status = 'Active'\r\n   and (s.Zuora__Zuora_Id__c is null\r\n    or  a.Balance <> s.Zuora__Balance__c\r\n       )\r\n\r\nselect p.Id\r\n  from ZuoraProd..zPayment p\r\n  left join SFDCProd..Zuora__Payment__c z\r\n    on p.PaymentNumber = z.Name\r\n where p.Status = 'Processed'\r\n   and (z.Name is null\r\n    or  z.Zuora__Status__c <> p.Status\r\n       )\r\n\r\nselect r.Id\r\n  from ZuoraProd..zRefund r\r\n  left join SFDCProd..Zuora__Refund__c z\r\n    on r.RefundNumber = z.Name\r\n where r.Status = 'Processed'\r\n   and (z.Name is null\r\n    or  z.Zuora__Status__c <> r.Status\r\n       )\r\n\r\nselect i.Id\r\n  from ZuoraProd..zInvoice i\r\n  join ZuoraProd..zAccount a\r\n    on i.Account_ID = a.Id\r\n  left join SFDCProd..Zuora__ZInvoice__c z\r\n    on i.Id = z.Zuora__Zuora_Id__c\r\n where i.Status = 'Posted'\r\n   and a.Batch <> 'Batch2'\r\n   and (z.Zuora__Zuora_Id__c is null\r\n    or  z.Zuora__Status__c <>  i.Status\r\n    or  z.Zuora__Balance2__c <> cast(i.Balance as money)\r\n       ) \r\n\r\nselect rpc.Id\r\n  from ZuoraProd..zRatePlanCharge rpc\r\n  join ZuoraProd..zRatePlan rp\r\n    on rp.Id = rpc.RatePlan_Id\r\n   and rpc.IsLastSegment = 'True'\r\n   and rp.AmendmentType <> 'RemoveProduct'\r\n  join ZuoraProd..zSubscription s\r\n    on rpc.Subscription_Id = s.Id\r\n  left join SFDCProd..Zuora__SubscriptionProductCharge__c spc\r\n    on rpc.Id = spc.Zuora__Zuora_Id__c\r\n where s.Status = 'Active'\r\n   and spc.Zuora__Zuora_Id__c is null\r\n     \r\n"}}