Browse Source

Global currency selection

master
Tobias Herre 3 years ago
parent
commit
bf07702a0b
6 changed files with 100 additions and 69 deletions
  1. +1
    -1
      delete.php
  2. +21
    -16
      ka.php
  3. +13
    -8
      kaform.js
  4. BIN
      messages.mo
  5. +33
    -0
      messages.po
  6. +32
    -44
      submit.php

+ 1
- 1
delete.php View File

@ -6,6 +6,6 @@ if (!isset($_POST['id']))
unset( $_SESSION['files'][$_POST['id']] );
error_log("Delete Document $_POST[id]");
#error_log("Delete Document $_POST[id]");

+ 21
- 16
ka.php View File

@ -1,4 +1,10 @@
<!doctype html>
<?php
$lang=$_GET['lang'];
if ( !in_array ($lang, array('en'))){
$lang="";
}
?>
<html >
<head>
<title>Kostenerstattungsforumlar</title>
@ -19,20 +25,20 @@
<img alt="wikimedia logo" src="Wikimedia_Deutschland-Logo.svg"/>
</div>
<div class="main-content">
<?php echo _( "
<h1>Antrag auf Kostenerstattung</h1>
<p>Du möchtest dir Kosten erstatten lassen, welche im Rahmen deines
Projektes entstanden sind?<BR>
Bitte fülle dieses Formular aus.
Pflichtfelder sind mit einem * gekennzeichnet.
</p>
</p>") ?>
<form data-kube="kaform" name="theform" id="theform" action="submit.php" method="POST">
<div class="is-row">
<div class="is-col is-70">
<fieldset>
<legend>1. Erfasse deine Stammdaten</legend>
<legend><?php echo _("1. Erfasse deine Stammdaten</legend>")?>
<div class="is-row">
<div class="is-col">
<input required type="input"
@ -40,19 +46,7 @@
placeholder="Projekt/Zweck der Reise*" />
</div>
</div>
<!-- <div class="is-row">
<div class="is-col">
<input required type="input"
size="32" id="nickname" name="nickname"
placeholder="Nickname*" />
</div>
<div class="is-col">
<input required type="input"
size="32" id="projectid" name="project"
placeholder="Projekt-ID*" />
</div>
</div>
--> <br>
<br>
<div class="is-row">
<div class="is-col">
<input required type="input" size="32"
@ -200,6 +194,17 @@ Grund für abweichende kontoinhabende Person">
<div class="is-col is-70">
<fieldset id="fieldset2">
<legend>2. Erfasse deine Ausgaben</legend>
<div class="is-col is-70">
Währung:
</div>
<div class="is-col is-20">
<select onchange="renumberTableRows()" id="currency" >
<option value="EUR">EUR</option>
<option value="USD">USD</option>
<option value="CHF">CHF</option>
<option value="XBT">XBT</option>
</select>`
</div>
<table id="tabtab" class="is-bordered is-striped">
<thead>

+ 13
- 8
kaform.js View File

@ -3,10 +3,12 @@ var currentRowId=1;
var banktype = "bank-eu";
function renumberTableRows(){
var cur = document.getElementById("currency").value;
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++;
row.cells[4].innerHTML=cur;
}
return i;
}
@ -157,6 +159,7 @@ function getUploadField(rid)
function getRow(rid,num) {
var cur = document.getElementById("currency").value;
return ""
+ "<td>"
+ `${num}`
@ -170,14 +173,16 @@ function getRow(rid,num) {
+ "<td>"
+ `<input name="amount[${rid}] type="text" placeholder="0.00"/>`
+ "</td>"
+ "<td>"
+
`<select name="currency[${rid}]" >
<option value="EUR">EUR</option>
<option value="USD">USD</option>
<option value="CHF">CHF</option>
<option value="XBT">XBT</option>
</select>`
+ "<td style=\"vertical-align: middle\">"
+ cur
// +
// `<select name="currency[${rid}]" >
// <option value="EUR">EUR</option>
// <option value="USD">USD</option>
// <option value="CHF">CHF</option>
// <option value="XBT">XBT</option>
// </select>`
+ "</td>"
+ "<td>"

BIN
messages.mo View File


+ 33
- 0
messages.po View File

@ -0,0 +1,33 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-22 10:09+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ka.php:28
msgid ""
"\n"
"\t\t<h1>Antrag auf Kostenerstattung</h1>\n"
"\t\t<p>Du möchtest dir Kosten erstatten lassen, welche im Rahmen deines\n"
"\t\tProjektes entstanden sind?<BR>\n"
"\t\tBitte fülle dieses Formular aus.\n"
"\t\tPflichtfelder sind mit einem * gekennzeichnet.\n"
"\t\t</p>"
msgstr ""
#: ka.php:41
msgid "1. Erfasse deine Stammdaten</legend>"
msgstr ""

+ 32
- 44
submit.php View File

@ -194,12 +194,6 @@ function mkFrontPDF(){
EOD;
#var_dump($thtml);
#die;
// <p>WMDE Ansprechpartner: $_POST[wmdecontact]</p>
// Telefon: $_POST[phone]
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
@ -365,6 +359,8 @@ function mkTable(){
$pdfs = array();
//
// Applicatoin starts here
//
$p = mkFrontPDF();
@ -374,17 +370,8 @@ $file = $p;
#header('Content-Length: ' . filesize($file));
#readfile($file);
#var_dump($p);
#die();
#echo "Making Fromt PDF<BR>";
#echo "Did Making Fromt PDF<BR>";
array_push($pdfs,$p);
//var_dump($pdfs);
foreach ($_POST['desc'] as $key => $val) {
// echo "DREESK KEY VAL $key --> $val<br>";
@ -415,35 +402,36 @@ if ($_POST['sendmail']=='yes'){
$subj = "Kostenerstattungsantrag ueber".calcSum()." EUR";
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->IsSMTP();
$mail->setFrom($mailFrom);
$mail->Subject = $subj;
$mail->Body = "Kostenerstattungsantrag ...";
$mail->AddAddress($mailDest);
$mail->AddAttachment( $file , 'antrag.pdf' );
$mail->Host = $mailHost; // Specify main and backup server
$mail->Port = $mailPort; // Set the SMTP port
$mail->SMTPAuth = $mailSMTPAuth;
$mail->Username = $mailUsername;
$mail->Password = $mailPassword;
$mail->SMTPSecure = $mailSMTPSecure; // Enable encryption, 'ssl' also accepted
$rc = $mail->send();
if (!$rc) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
echo "Dein Antrag wurde versendet.<BR>";
echo '<a href="ka.php">
Weiteren Antrag auf Kostenerstattung stellen</a><BR>';
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->IsSMTP();
$mail->setFrom($mailFrom);
$mail->Subject = $subj;
$mail->Body = "Kostenerstattungsantrag ...";
$mail->AddAddress($mailDest);
$mail->AddAttachment( $file , 'antrag.pdf' );
$mail->Host = $mailHost; // Specify main and backup server
$mail->Port = $mailPort; // Set the SMTP port
$mail->SMTPAuth = $mailSMTPAuth;
$mail->Username = $mailUsername;
$mail->Password = $mailPassword;
$mail->SMTPSecure = $mailSMTPSecure; // Enable encryption, 'ssl' also accepted
$rc = $mail->send();
if (!$rc) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
die;
}
echo "Dein Antrag wurde versendet.<BR>";
echo '<a href="ka.php">
Weiteren Antrag auf Kostenerstattung stellen</a><BR>';
die;

Loading…
Cancel
Save