Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. con <- dbConnect(MySQL(),user="root",password="891208",host="localhost",dbname="openPos")
  2. shinyServer(function(input, output) {
  3. query1 <- reactive({ "SELECT sale_time,sum(quantity_purchased * item_unit_price)
  4. AS revenue, sum(quantity_purchased * item_cost_price) AS cost,
  5. sum(quantity_purchased * item_unit_price)-sum(quantity_purchased * item_cost_price) as profit
  6. FROM ospos_sales, ospos_sales_items
  7. WHERE ospos_sales.sale_id = ospos_sales_items.sale_id
  8. GROUP BY sale_time"})
  9. result1 <- reactive({dbGetQuery(con,query1())})
  10. z <- reactive({ts(result1())})
  11. output$ts <- renderPlot({p<-ts.plot(z())
  12. print(p)})
  13. output$table <-renderTable({z()})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement