Last active
August 31, 2016 07:21
-
-
Save kir-sf/a4cedfbe6d19bf94ab29f72222f7a8ef to your computer and use it in GitHub Desktop.
Волшебная кнопка
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<base target="_top"> | |
<script> | |
function putCash(newCash) { | |
var c = document.getElementById("Cash"); | |
c.innerHTML=newCash+" RUR"; | |
} | |
function putProfit(newProfit) { | |
var c = document.getElementById("Profit"); | |
c.innerHTML=newProfit+" RUR"; | |
} | |
function putLimit(newLimit) { | |
var c = document.getElementById("Limit"); | |
c.innerHTML=newLimit+" RUR"; | |
} | |
function ShowResults() { | |
google.script.run.withSuccessHandler(putCash).getCash(); | |
google.script.run.withSuccessHandler(putProfit).getProfit(); | |
google.script.run.withSuccessHandler(putLimit).getLimit(); | |
} | |
function Show() { | |
google.script.run.withSuccessHandler(ShowResults).setCurDate(); | |
} | |
</script> | |
</head> | |
<body> | |
<table width=50% border=1> | |
<caption align="center"><h1><b> БАЛАНС </b> </h1></caption> | |
<col width=70%> | |
<col width=30%> | |
<tr> | |
<th align="center"> Показатель </th> | |
<th align="center"> Значение </th> | |
</tr> | |
<tr> | |
<td><b> Остатки на счетах: </b></td> | |
<td align="right"><b> <span class="label" id="Cash"> </span></b></td> | |
</tr> | |
<tr> | |
<td><b> Финансовый результат: </b></td> | |
<td align="right"> <span class="label" id="Profit"> </span></td> | |
</tr> | |
<tr> | |
<td><b> Лимит снятия: </b></td> | |
<td align="right"> <span class="label" id="Limit"> </span></td> | |
</tr> | |
</table> | |
<script> | |
Show(); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doGet() { | |
return HtmlService.createHtmlOutputFromFile('Page') | |
.setSandboxMode(HtmlService.SandboxMode.IFRAME); | |
} | |
function setCurDate() { | |
var files=DriveApp.getFilesByName("BalanceSheet (блог)"); | |
if (!files.hasNext()) return 0; | |
var sh=SpreadsheetApp.open(files.next()).getSheetByName("Summary"); | |
var curDate=new Date(); | |
sh.getRange(2, 2).setValue(curDate.getDate()+"/"+(curDate.getMonth()+1)+"/"+curDate.getFullYear()); | |
return 1; | |
} | |
function getCash() { | |
var files=DriveApp.getFilesByName("BalanceSheet (блог)"); | |
if (!files.hasNext()) return 0; | |
var sh=SpreadsheetApp.open(files.next()).getSheetByName("Summary"); | |
return sh.getRange(4, 2).getValues(); | |
} | |
function getProfit() { | |
var files=DriveApp.getFilesByName("BalanceSheet (блог)"); | |
if (!files.hasNext()) return 0; | |
var sh=SpreadsheetApp.open(files.next()).getSheetByName("Summary"); | |
return sh.getRange(5, 2).getValues(); | |
} | |
function getLimit() { | |
var files=DriveApp.getFilesByName("BalanceSheet (блог)"); | |
if (!files.hasNext()) return 0; | |
var sh=SpreadsheetApp.open(files.next()).getSheetByName("Summary"); | |
return sh.getRange(8, 5).getValues(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment