-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaScript.html
More file actions
94 lines (80 loc) · 3.15 KB
/
JavaScript.html
File metadata and controls
94 lines (80 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<script>
function loadMovimientos(){
google.script.run.withSuccessHandler(showData).getData11();
}
//THIS FUNCTION GENERATE THE DATA TABLE FROM THE DATA ARRAY
function showData(dataArray){
$(document).ready(function(){
$('#data-table').DataTable({
language: {
search: "Buscar",
},
paging: false,
data: dataArray,
columns: [
{"title":"Fecha"},
{"title":"Categoria"},
{"title":"Importe"},
// {"title":"Pagador"},
// {"title":"Notas"},
]
});
});
}
function uploadExpense(){
var expMoneyTag = document.getElementById("moneyTag");
var expDate = document.getElementById("date");
var expCategory = document.getElementById("inputGroupSelect01Value");
var expAmount = document.getElementById("amount");
var expPayee = document.getElementById("payee");
var expNotes = document.getElementById("notes");
var rowData = {expDate: date.value, expCategory: inputGroupSelect01Value.value, expAmount: amount.value, expPayee: payee.value, expNotes: notes.value };
google.script.run.withSuccessHandler(afterSubmitInOut).addNewRow(rowData);
}
function afterSubmitInOut(e){
var expDate = document.getElementById("date");
var expCategory = document.getElementById("inputGroupSelect01Value");
var expAmount = document.getElementById("amount");
var expPayee = document.getElementById("payee");
var expNotes = document.getElementById("notes");
expDate.value = "";
expCategory.value = "";
expAmount.value= "";
expPayee.value = "";
expNotes.value = "";
}
function resetValues(){
var expDate = document.getElementById("date");
var expCategory = document.getElementById("inputGroupSelect01Value");
var expAmount = document.getElementById("amount");
var expPayee = document.getElementById("payee");
var expNotes = document.getElementById("notes");
// expDate.value = "";
expCategory.value = "";
expAmount.value= "";
expPayee.value = "";
expNotes.value = "";
autoDate();
}
function loadCategories(){
google.script.run.withSuccessHandler(afterlistCategoriesloaded).listCategories();
}
function afterlistCategoriesloaded(arrayOfArrays){
var movimientos = document.getElementById("inputGroupSelect01");
arrayOfArrays.forEach(function(r){
var option = document.createElement("option");
option.textContent = r[0];
movimientos.appendChild(option);
});
};
function autoDate(){
var today = new Date();
var newSetDate = document.getElementById("date");
var today = today.getFullYear()+'-'+(("0" + (today.getMonth() + 1)).slice(-2))+'-'+today.getDate();
newSetDate.value = today
}
function setMinus(){
var addMinus = document.getElementById("amount");
addMinus.value = "-"+ addMinus.value
}
</script>