Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 43b807cc63 | |||
| cb38ea347d | |||
| 6671939939 |
+15
-7
@@ -144,24 +144,28 @@ server <- function(input, output) {
|
||||
print(CCfile)
|
||||
if (input$dbtype == "UM"){
|
||||
dta<<-odbcConnectAccess2007(access.file = UMfile,
|
||||
pwd = .rs.askForPassword("Enter password:"))
|
||||
pwd = getPass::getPass("Enter password:"))
|
||||
}
|
||||
if (input$dbtype == "OV"){
|
||||
dta<<-odbcConnectAccess2007(access.file = OVfile,
|
||||
pwd = .rs.askForPassword("Enter password:"))
|
||||
pwd = getPass::getPass("Enter password:"))
|
||||
}
|
||||
if (input$dbtype == "CC"){
|
||||
dta<<-odbcConnectAccess2007(access.file = CCfile,
|
||||
pwd = .rs.askForPassword("Enter password:"))
|
||||
pwd = getPass::getPass("Enter password:"))
|
||||
}
|
||||
print(dta)
|
||||
if (input$backup == T){
|
||||
if (! input$dbtype %in% c("UM","OV")){
|
||||
sqlBackUp(bu.dir="CC_BU")
|
||||
}else{
|
||||
sqlBackUp()
|
||||
sqlBackUp(dbfile = CCfile, bu.dir="CC_BU")
|
||||
}
|
||||
|
||||
if (input$dbtype == "UM"){
|
||||
sqlBackUp(dbfile = UMfile)
|
||||
}
|
||||
if (input$dbtype == "OV"){
|
||||
sqlBackUp(dbfile = OVfile)
|
||||
}
|
||||
print("Back up realizado.")
|
||||
}
|
||||
})
|
||||
|
||||
@@ -754,6 +758,7 @@ server <- function(input, output) {
|
||||
sqlFetch(dta, "NITROGEN"),
|
||||
file=paste0(NitroRoute, format(Sys.time(), format="%Y%m%d"),"-","UM-Nitrogen.xlsx")
|
||||
)
|
||||
print("Backup Creado.")
|
||||
|
||||
table<-read.xlsx(paste0(gsub("/BU_NITRO/", "", NitroRoute),"/Nitrogen_ICO.xlsx"))
|
||||
|
||||
@@ -784,6 +789,7 @@ server <- function(input, output) {
|
||||
|
||||
sqlDrop(dta, "NITROGEN")
|
||||
sqlSave(dta, table.um %>% select(-FECHA) %>% filter(!is.na(CODIGO)), tablename="NITROGEN", rownames=F)
|
||||
print("Tabla Actualizada.")
|
||||
}
|
||||
if (input$dbtype == "OV"){
|
||||
## Copia de backup
|
||||
@@ -797,6 +803,7 @@ server <- function(input, output) {
|
||||
sqlFetch(dta, "NITROGEN"),
|
||||
file=paste0(NitroRoute, format(Sys.time(), format="%Y%m%d"),"-","OV-Nitrogen.xlsx")
|
||||
)
|
||||
print("Backup Creado.")
|
||||
|
||||
## Lectura del excel
|
||||
table<-read.xlsx(paste0(gsub("/BU_NITRO/", "", NitroRoute),"/Nitrogen_ICO.xlsx"))
|
||||
@@ -822,6 +829,7 @@ server <- function(input, output) {
|
||||
|
||||
sqlDrop(dta, "NITROGEN")
|
||||
sqlSave(dta, table.ov, tablename="NITROGEN", rownames=F)
|
||||
print("Tabla Actualizada.")
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user