Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- con <- dbConnect(MySQL(),user="root",password="891208",host="localhost",dbname="openPos")
- shinyServer(function(input, output) {
- query1 <- reactive({ "SELECT sale_time,sum(quantity_purchased * item_unit_price)
- AS revenue, sum(quantity_purchased * item_cost_price) AS cost,
- sum(quantity_purchased * item_unit_price)-sum(quantity_purchased * item_cost_price) as profit
- FROM ospos_sales, ospos_sales_items
- WHERE ospos_sales.sale_id = ospos_sales_items.sale_id
- GROUP BY sale_time"})
- result1 <- reactive({dbGetQuery(con,query1())})
- z <- reactive({ts(result1())})
- output$ts <- renderPlot({p<-ts.plot(z())
- print(p)})
- output$table <-renderTable({z()})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement