You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

202 lines
6.1 KiB

#
# This is the server logic of a Shiny web application. You can run the
# application by clicking 'Run App' above.
# :::::::Asitav Sen:::::::
# :::LaNubia Consulting:::
# Find out more about LaNubia:
#
# http://lanubia.com/
#
library(shiny)
# Define server logic
shinyServer(function(input, output) {
res_auth <- secure_server(
check_credentials = check_credentials(
"credentials.sqlite",
#passphrase = key_get("R-shinymanager-key", "obiwankenobi")
passphrase = "KjnsduYgrajidi(87368()*7726Gdjicjs"
)
)
country <- reactive({
req(res_auth$country)
# print(res_auth$country)
c<-res_auth$country
if(c=="All"){
c<-c("DE","AT","CZ","CN","ES","FI","IT","NL","PL","SE","NO")
}
c
#ifelse(res_auth$country=="All",c("DE","AT","CZ","CN","ES","FI","IT","NL","PL","SE"), res_auth$country)
})
observeEvent(country(),{
# print(country())
colServer(id="inputs",
dat= input.summary[input.summary$Country %in% country(),],
name= "Inputs",
ytitle="Number of Entries",
maintitle="Input count",
caption="",
filename="Inputs")
errServer("contacterrors",filepath="./contacts/summary", filename="Error_Contact", country=country())
tableServer("contactmand", filepath="./contacts/errors/mandatory", country=country())
tableServer("contactcode", filepath="./contacts/errors/codelist", country=country())
tableServer("contactlength", filepath="./contacts/errors/length", country=country())
errServer("accountserrors",filepath="./accounts/summary", filename="accounts_Contact", country=country())
tableServer("accountsmand", filepath="./accounts/errors/mandatory", country=country())
tableServer("accountscode", filepath="./accounts/errors/codelist", country=country())
tableServer("accountslength", filepath="./accounts/errors/length", country=country())
errServer("projectserrors",filepath="./projects/summary", filename="projects_Contact", country=country())
tableServer("projectsmand", filepath="./projects/errors/mandatory", country=country())
tableServer("projectscode", filepath="./projects/errors/codelist", country=country())
tableServer("projectslength", filepath="./projects/errors/length", country=country())
})
output$accdup<-renderDataTable({
datatable(
accdup[accdup$CountryRegion %in% country(),],
#extensions = "Buttons",
filter = 'top',
options = list(
paging = TRUE,
scrollX = TRUE,
searching = TRUE,
ordering = TRUE,
#dom = 'Bfrtip',
#buttons = c('copy', 'csv', 'excel', 'pdf'),
pageLength = 5,
# lengthMenu = c(3, 5, 10),
filter = TRUE
)
)
})
output$accdupdownload<-downloadHandler(
filename = function() {
paste("acc_dup_all", ".csv", sep="")
},
content = function(file) {
write.csv(accdup[accdup$CountryRegion %in% country(),], file, row.names = FALSE)
}
)
output$accduplegacydownload<-downloadHandler(
filename = function() {
paste("acc_dup_legacy", ".csv", sep="")
},
content = function(file) {
write.csv(accdup[accdup$CountryRegion %in% country() & accdup$errorsource=="Legacy CRM",], file, row.names = FALSE)
}
)
output$accdupsapdownload<-downloadHandler(
filename = function() {
paste("acc_dup_sap", ".csv", sep="")
},
content = function(file) {
write.csv(accdup[accdup$CountryRegion %in% country() & accdup$errorsource=="S4-CAA200",], file, row.names = FALSE)
}
)
output$accdupbothdownload<-downloadHandler(
filename = function() {
paste("acc_dup_both", ".csv", sep="")
},
content = function(file) {
write.csv(accdup[accdup$CountryRegion %in% country() & accdup$errorsource=="Both",], file, row.names = FALSE)
}
)
output$condup<-renderDataTable({
datatable(
contdup[contdup$CountryRegion %in% country(),],
#extensions = "Buttons",
filter = 'top',
options = list(
paging = TRUE,
scrollX = TRUE,
searching = TRUE,
ordering = TRUE,
#dom = 'Bfrtip',
#buttons = c('copy', 'csv', 'excel', 'pdf'),
pageLength = 5,
# lengthMenu = c(3, 5, 10),
filter = TRUE
)
)
})
output$condupdownload<-downloadHandler(
filename = function() {
paste("con_dup", ".csv", sep="")
},
content = function(file) {
write.csv(contdup[contdup$CountryRegion %in% country(),], file, row.names = FALSE)
}
)
output$conduplegacydownload<-downloadHandler(
filename = function() {
paste("con_dup_legacy", ".csv", sep="")
},
content = function(file) {
write.csv(contdup[contdup$CountryRegion %in% country() & contdup$errorsource=="Legacy CRM",], file, row.names = FALSE)
}
)
output$condupsapdownload<-downloadHandler(
filename = function() {
paste("con_dup_sap", ".csv", sep="")
},
content = function(file) {
write.csv(contdup[contdup$CountryRegion %in% country() & contdup$errorsource=="S4-CAA200",], file, row.names = FALSE)
}
)
output$condupbothdownload<-downloadHandler(
filename = function() {
paste("con_dup_both", ".csv", sep="")
},
content = function(file) {
write.csv(contdup[contdup$CountryRegion %in% country() & contdup$errorsource=="Both",], file, row.names = FALSE)
}
)
output$missemp<-renderDataTable({
datatable(
empmissing[empmissing$CountryRegion %in% country(),],
#extensions = "Buttons",
filter = 'top',
options = list(
paging = TRUE,
scrollX = TRUE,
searching = TRUE,
ordering = TRUE,
#dom = 'Bfrtip',
#buttons = c('copy', 'csv', 'excel', 'pdf'),
pageLength = 5,
# lengthMenu = c(3, 5, 10),
filter = TRUE
)
)
})
output$missempdownload<-downloadHandler(
filename = function() {
paste("miss_emp", ".csv", sep="")
},
content = function(file) {
write.csv(empmissing[empmissing$CountryRegion %in% country(),], file, row.names = FALSE)
}
)
})