diff --git a/ka.php b/ka.php index 9770119..dc05ce5 100644 --- a/ka.php +++ b/ka.php @@ -201,64 +201,26 @@ Grund für abweichende kontoinhabende Person">
2. Erfasse deine Ausgaben - -
-
-
-
- - - -
-
-
-
-
- -
- -
-
- -
-
- - -
-
- -
-
- -
-
-
-
-
-
-
- + -
Pos. Datum Beschreibung BetragWährung Belege Löschen
+
+ +
+

diff --git a/kaform.js b/kaform.js index 89c7b33..de56311 100644 --- a/kaform.js +++ b/kaform.js @@ -11,6 +11,49 @@ function renumberTableRows(){ return i; } +function checkAllRows(){ + var row_no=1; + var table = document.getElementById("tabbody"); + for (var i = 0, row; row = table.rows[i]; i++) { + // row.cells[0].innerHTML=row_no++; + // + var f=1 + var v =row.cells[f].firstElementChild.value; + if ( !v ){ // Datum + row.cells[f].firstElementChild.focus(); + showAlert("Bitte gib ein gültiges Datum an!"); + return false; + + } + + f=2; + v =row.cells[f].firstElementChild.value; + if ( !v ){ // Datum + row.cells[f].firstElementChild.focus(); + showAlert("Bitte gib ein Beschreibung ein!"); + return false; + + } + + f=3; + v =row.cells[f].firstElementChild.value; + if ( !v ){ // Datum + row.cells[f].firstElementChild.focus(); + showAlert("Bitte gib einen gültigen Betrag ein!"); + return false; + } + + + + + + } + return true; +} + + + + function isMailable(){ var row_no=1; var table = document.getElementById("tabbody"); @@ -23,6 +66,7 @@ function isMailable(){ } + function isFloat(val) { var floatRegex = /^-?\d+(?:[.,]\d*?)?$/; if (!floatRegex.test(val)) @@ -35,6 +79,7 @@ function isFloat(val) { } + /** * grey-out currency iselection if there is at least one document is atatched. */ @@ -51,7 +96,6 @@ function disableCurrency() function deleteTableRow(rowId){ - var target = document.getElementById("upload-target"+rowId); // this.message = app.message; // var children = target.children; @@ -75,7 +119,6 @@ function deleteTableRow(rowId){ var element = document.getElementById("trow"+rowId); element.parentNode.removeChild(element); - disableCurrency(); renumberTableRows(); // alert(rowId); @@ -85,13 +128,7 @@ function deleteTableRow(rowId){ function countRows(){ - var ctr=0; - for (i=0; i${a_date} + `; + + $node.append(element); + element.innerHTML=(e); + +} + + + +function getUploadField(rid) +{ + var e = $K.dom('#uploadfield'); + var uf =`
+
+
+ + `; + return uf; +} + + + +function getRow(rid,num) { + return "" + + "" + + `${num}` + +"" + + "" + + `` + + "" + + "" + + `` + + "" + + "" + + '' + + "" + + "" + + + `` + + + "" + + "" + + getUploadField(rid) + + "" + + + ` + `; + + +} + + +var nextRid = 1 + +function addRow() { + var $node = $K.dom('#tabbody'); + var e = getRow(nextRid,1); + var element = document.createElement('tr'); + element.setAttribute("id", "trow"+nextRid); + $node.append(element); + element.innerHTML=(e); + renumberTableRows(); + nextRid++; +} + +function xaddTableRow(){ var $node = $K.dom('#tabbody'); // create a new table row with id @@ -230,11 +356,11 @@ function addTableRow(){ renumberTableRows(); currentRowId++; reset2(); - disableCurrency(); } + function setUploadField() { var e = $K.dom('#uploadfield'); @@ -327,6 +453,12 @@ function downloadDocument1(){ function downloadDocument(mail) { + + + if (!checkAllRows()) + return; + + if (!check_field("projectid", "Bitte gib einen Projektnamen/Zweck der Reise an!")) return; @@ -363,7 +495,7 @@ function downloadDocument(mail) if (countRows()==0){ - document.getElementById("a_description").focus(); + document.getElementById("add_issue").focus(); showAlert("Bitte füge mind. eine Auslage hinzu!"); return; } diff --git a/submit.php b/submit.php index 7b5ca7a..f83b63c 100644 --- a/submit.php +++ b/submit.php @@ -6,6 +6,10 @@ require "PHPMailer/PHPMailer.php"; require "PHPMailer/SMTP.php"; require "PHPMailer/Exception.php"; + +var_dump($_POST); +die; + #$CONVERT_CMD = "/usr/bin/pdftk"; require_once('TCPDF/tcpdf.php'); diff --git a/upload.php b/upload.php index 1d11b8f..f9152a6 100644 --- a/upload.php +++ b/upload.php @@ -1,6 +1,10 @@ $files){ "id" => $tmpname, "size" => sprintf("%0.1fK",$files['size'][$i]/1024.0) ); + + file_put_contents("/tmp/log.txt", "file-$key-$i\n", FILE_APPEND | LOCK_EX); + file_put_contents("/tmp/log.txt", $files['name'][$i], FILE_APPEND | LOCK_EX); + } - $_SESSION['files'][$tmpname]['content']= - file_get_contents($tmpname); + $_SESSION['files'][$tmpname]['content']=file_get_contents($tmpname); $_SESSION['files'][$tmpname]['row']=$_GET['row']; @@ -48,6 +55,9 @@ foreach ($_SESSION['files'] as $key => $val) { $j = json_encode ($jo); echo $j; +file_put_contents("/tmp/log.txt", $j, FILE_APPEND | LOCK_EX); + + #error_log("\n\n ----- files ----- \n\n$files\n\n\n"); #$xp = xvar_dump($_FILES); #error_log("\n\n ----- FILES ----- \n\n$$xp\n\n\n");