initial commit
This commit is contained in:
commit
134137e3a4
20
backend.php
Normal file
20
backend.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] != "POST") {
|
||||||
|
echo "Sorry, ich spreche kein GET.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (empty($_POST) && empty(file_get_contents('php://input'))) {
|
||||||
|
echo "Ich brauche INPUT";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_GET['controller'] == "Article"){
|
||||||
|
if ($_GET['action'] == "store") {
|
||||||
|
$json = file_get_contents('php://input');
|
||||||
|
$file = fopen(__DIR__.'/data/test_articles.json','w');
|
||||||
|
fwrite($file, $json);
|
||||||
|
fclose($file);
|
||||||
|
echo "Artikel wurden gespeichert.";
|
||||||
|
}
|
||||||
|
}
|
||||||
38
data/articles.json
Normal file
38
data/articles.json
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name" : "Edelpils",
|
||||||
|
"dimension" : "l",
|
||||||
|
"content": {
|
||||||
|
"size" : 0.33
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.33,
|
||||||
|
"price": 3.50,
|
||||||
|
"type": "Fl."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "Secco",
|
||||||
|
"dimension" : "l",
|
||||||
|
"content": {
|
||||||
|
"size" : 0.75
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.1,
|
||||||
|
"price": 6,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "Amareno Cuvee",
|
||||||
|
"dimension" : "l",
|
||||||
|
"content": {
|
||||||
|
"size" : 0.75
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.2,
|
||||||
|
"price": 6.50,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
313
data/test_articles.json
Normal file
313
data/test_articles.json
Normal file
@ -0,0 +1,313 @@
|
|||||||
|
[{
|
||||||
|
"name": "Edelpils",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.33,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.33,
|
||||||
|
"price": 3.5,
|
||||||
|
"type": "Fl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Schwarzbier",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.33,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.33,
|
||||||
|
"price": 3.5,
|
||||||
|
"type": "Fl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Schöfferhofer",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.33,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.33,
|
||||||
|
"price": 3.5,
|
||||||
|
"type": "Fl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Bitburger af.",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.33,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.33,
|
||||||
|
"price": 3.5,
|
||||||
|
"type": "Fl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Riesling",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.2,
|
||||||
|
"price": 6,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Amareno",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.75,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.2,
|
||||||
|
"price": 6.5,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Secco",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.75,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.1,
|
||||||
|
"price": 6,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "B-Saft",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.2,
|
||||||
|
"price": 3.5,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "K-Saft",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.2,
|
||||||
|
"price": 3.5,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "O-Saft",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.2,
|
||||||
|
"price": 3.5,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "G-Saft",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.2,
|
||||||
|
"price": 3.5,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Vita Cola",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.2,
|
||||||
|
"price": 2.5,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Vita Orange",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.2,
|
||||||
|
"price": 2.5,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Vita Zitrone",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.2,
|
||||||
|
"price": 2.5,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Tonic",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 3,
|
||||||
|
"type": "Fl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Bitter Lemon",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 3,
|
||||||
|
"type": "Fl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Ginger Ale",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 3,
|
||||||
|
"type": "Fl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Apfelschorle",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 3,
|
||||||
|
"type": "Fl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "TWQ naturell",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 2.5,
|
||||||
|
"type": "Fl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "TWQ medium",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 2.5,
|
||||||
|
"type": "Fl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "TWQ classic",
|
||||||
|
"dimension": "l",
|
||||||
|
"content": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 0.25,
|
||||||
|
"price": 2.5,
|
||||||
|
"type": "Fl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Kaffee",
|
||||||
|
"dimension": "Tasse",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 2.5,
|
||||||
|
"type": "T"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Latte Macchiato",
|
||||||
|
"dimension": "Glas",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 3.5,
|
||||||
|
"type": "Gl."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "dopp. Esp.",
|
||||||
|
"dimension": "Tasse",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 3.5,
|
||||||
|
"type": "T"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Brezel",
|
||||||
|
"dimension": "Stück",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 2.5,
|
||||||
|
"type": "Stk."
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"name": "Schokoriegel",
|
||||||
|
"dimension": "Stück",
|
||||||
|
"content": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 0
|
||||||
|
},
|
||||||
|
"portion": {
|
||||||
|
"size": 1,
|
||||||
|
"price": 2,
|
||||||
|
"type": "Stk."
|
||||||
|
}
|
||||||
|
}]
|
||||||
139
index.html
Normal file
139
index.html
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta lang="de">
|
||||||
|
<title>Inventur</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
<!--Import Google Icon Font-->
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<!--Import materialize.css-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css" media="screen,projection"/>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="app" style="max-width:100%; max-height:100%;">
|
||||||
|
<nav class="nav-extended teal">
|
||||||
|
<div class="nav-wrapper container">
|
||||||
|
<a href="#" class="brand-logo">Inventur</a>
|
||||||
|
<a href="#" data-activates="mobile" class="button-collapse"><i class="material-icons">menu</i></a>
|
||||||
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
|
<li><a href="#"></a></li>
|
||||||
|
</ul>
|
||||||
|
<ul id="mobile" class="side-nav">
|
||||||
|
<li><a href="#"></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="nav-content container">
|
||||||
|
<ul class="tabs tabs-transparent">
|
||||||
|
<li class="tab"><a href="#article">Artikelliste</a></li>
|
||||||
|
<li class="tab"><a href="#inventory" class="active">Inventur</a></li>
|
||||||
|
<li class="tab"><a href="#calc">Rechner</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<div class="container" id="article">
|
||||||
|
<table class="">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Artikelname</th>
|
||||||
|
<th>Gesamtmenge</th>
|
||||||
|
<th>Portionsmenge</th>
|
||||||
|
<th>Gesamtpreis</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="a in articles" class="row item">
|
||||||
|
<td>
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<input v-model="a.name" placeholder="Artikelname" class="validate">
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="input-field col s10">
|
||||||
|
<input v-model.number="a.content.size" placeholder="Gesamtinhalt" type="number" class="validate" step="0.01">
|
||||||
|
</div>
|
||||||
|
<div class="input-field col s2">
|
||||||
|
<input v-model="a.dimension" placeholder="Dimension" class="validate">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="input-field col s7">
|
||||||
|
<input v-model.number="a.portion.size" placeholder="Gesamtinhalt" type="number" class="validate" step="0.01">
|
||||||
|
</div>
|
||||||
|
<div class="input-field col s2">
|
||||||
|
<input v-model="a.portion.type" placeholder="Art" class="validate">
|
||||||
|
</div>
|
||||||
|
<div class="input-field col s3">
|
||||||
|
<input v-model.number="a.portion.price" placeholder="Preis" type="number" step="0.01" class="validate">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<th class="">
|
||||||
|
<div class="col s12 right">
|
||||||
|
<span class="right">{{ a.ContentPrice.toFixed(2) }} €</span>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr slot="footer"><td colspan="4">
|
||||||
|
<button class="btn waves-effect waves-light" @click="addArticle">Artikel hinzufügen</button>
|
||||||
|
</td></tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container" id="inventory">
|
||||||
|
<div v-for="(a, index) in inventory.ug" class="row hoverable">
|
||||||
|
<div class="col m2">{{ a.article.name }} <br/> {{a.article.portion.price.toFixed(2)}} €</div>
|
||||||
|
<div class="col s12 m8">
|
||||||
|
<div class="input-field inline">
|
||||||
|
<input v-model.number="a.start" placeholder="Anfang" title="Anfang" >
|
||||||
|
</div>
|
||||||
|
<div class="input-field inline">
|
||||||
|
<input v-model.number="a.fetched" placeholder="Zugang" title="Zugang" >
|
||||||
|
</div>
|
||||||
|
<div class="input-field inline">
|
||||||
|
<input v-model.number="a.end" placeholder="Ende" title="Ende" >
|
||||||
|
</div>
|
||||||
|
<div class="input-field inline">
|
||||||
|
<input v-model.number="a.lost" placeholder="Verlust" title="Verlust" >
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col m2 right">{{ a.Sold }} {{ a.article.PortionType }} <br/> {{ a.Sale.toFixed(2) }} €</div>
|
||||||
|
</div>
|
||||||
|
<div class="row teal lighten-2">
|
||||||
|
<div class="col right">
|
||||||
|
{{ sales_ug.toFixed(2) }} €
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container" id="calc"></div>
|
||||||
|
<div class="fixed-action-btn">
|
||||||
|
<a href="#" class="btn-floating btn-large teal">
|
||||||
|
<i class="large material-icons">more</i>
|
||||||
|
</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#" class="btn-floating" @click="storeArticles"><i class="material-icons">save</i></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
|
||||||
|
<script src="js/moment-with-locales.min.js"></script>
|
||||||
|
<script src="js/accounting.min.js"></script>
|
||||||
|
<script src="https://unpkg.com/vue/dist/vue.js"></script>
|
||||||
|
<script src="//cdn.jsdelivr.net/npm/vue-resource"></script>
|
||||||
|
<script src="js/app.js"></script>
|
||||||
|
<script src="js/vue.js"></script>
|
||||||
|
<script src="js/model/article.js"></script>
|
||||||
|
<script src="js/model/inventory_article.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
4
js/accounting.min.js
vendored
Normal file
4
js/accounting.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/*!
|
||||||
|
* accounting.js v0.4.2, copyright 2014 Open Exchange Rates, MIT license, http://openexchangerates.github.io/accounting.js
|
||||||
|
*/
|
||||||
|
(function(p,z){function q(a){return!!(""===a||a&&a.charCodeAt&&a.substr)}function m(a){return u?u(a):"[object Array]"===v.call(a)}function r(a){return"[object Object]"===v.call(a)}function s(a,b){var d,a=a||{},b=b||{};for(d in b)b.hasOwnProperty(d)&&null==a[d]&&(a[d]=b[d]);return a}function j(a,b,d){var c=[],e,h;if(!a)return c;if(w&&a.map===w)return a.map(b,d);for(e=0,h=a.length;e<h;e++)c[e]=b.call(d,a[e],e,a);return c}function n(a,b){a=Math.round(Math.abs(a));return isNaN(a)?b:a}function x(a){var b=c.settings.currency.format;"function"===typeof a&&(a=a());return q(a)&&a.match("%v")?{pos:a,neg:a.replace("-","").replace("%v","-%v"),zero:a}:!a||!a.pos||!a.pos.match("%v")?!q(b)?b:c.settings.currency.format={pos:b,neg:b.replace("%v","-%v"),zero:b}:a}var c={version:"0.4.1",settings:{currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}}},w=Array.prototype.map,u=Array.isArray,v=Object.prototype.toString,o=c.unformat=c.parse=function(a,b){if(m(a))return j(a,function(a){return o(a,b)});a=a||0;if("number"===typeof a)return a;var b=b||".",c=RegExp("[^0-9-"+b+"]",["g"]),c=parseFloat((""+a).replace(/\((.*)\)/,"-$1").replace(c,"").replace(b,"."));return!isNaN(c)?c:0},y=c.toFixed=function(a,b){var b=n(b,c.settings.number.precision),d=Math.pow(10,b);return(Math.round(c.unformat(a)*d)/d).toFixed(b)},t=c.formatNumber=c.format=function(a,b,d,i){if(m(a))return j(a,function(a){return t(a,b,d,i)});var a=o(a),e=s(r(b)?b:{precision:b,thousand:d,decimal:i},c.settings.number),h=n(e.precision),f=0>a?"-":"",g=parseInt(y(Math.abs(a||0),h),10)+"",l=3<g.length?g.length%3:0;return f+(l?g.substr(0,l)+e.thousand:"")+g.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+e.thousand)+(h?e.decimal+y(Math.abs(a),h).split(".")[1]:"")},A=c.formatMoney=function(a,b,d,i,e,h){if(m(a))return j(a,function(a){return A(a,b,d,i,e,h)});var a=o(a),f=s(r(b)?b:{symbol:b,precision:d,thousand:i,decimal:e,format:h},c.settings.currency),g=x(f.format);return(0<a?g.pos:0>a?g.neg:g.zero).replace("%s",f.symbol).replace("%v",t(Math.abs(a),n(f.precision),f.thousand,f.decimal))};c.formatColumn=function(a,b,d,i,e,h){if(!a)return[];var f=s(r(b)?b:{symbol:b,precision:d,thousand:i,decimal:e,format:h},c.settings.currency),g=x(f.format),l=g.pos.indexOf("%s")<g.pos.indexOf("%v")?!0:!1,k=0,a=j(a,function(a){if(m(a))return c.formatColumn(a,f);a=o(a);a=(0<a?g.pos:0>a?g.neg:g.zero).replace("%s",f.symbol).replace("%v",t(Math.abs(a),n(f.precision),f.thousand,f.decimal));if(a.length>k)k=a.length;return a});return j(a,function(a){return q(a)&&a.length<k?l?a.replace(f.symbol,f.symbol+Array(k-a.length+1).join(" ")):Array(k-a.length+1).join(" ")+a:a})};if("undefined"!==typeof exports){if("undefined"!==typeof module&&module.exports)exports=module.exports=c;exports.accounting=c}else"function"===typeof define&&define.amd?define([],function(){return c}):(c.noConflict=function(a){return function(){p.accounting=a;c.noConflict=z;return c}}(p.accounting),p.accounting=c)})(this);
|
||||||
11
js/app.js
Normal file
11
js/app.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
accounting.settings = {
|
||||||
|
currency: {
|
||||||
|
symbol: "€",
|
||||||
|
format: "%v%s",
|
||||||
|
decimal: ",",
|
||||||
|
thousand: ".",
|
||||||
|
precision: 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
71
js/model/article.js
Normal file
71
js/model/article.js
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
function Article() {
|
||||||
|
this.name = "";
|
||||||
|
this.dimension = "";
|
||||||
|
this.content = {
|
||||||
|
size : 0,
|
||||||
|
price: 0
|
||||||
|
};
|
||||||
|
this.portion = {
|
||||||
|
size : 0,
|
||||||
|
price : 0,
|
||||||
|
type : ""
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Article.prototype = {
|
||||||
|
get Name() {
|
||||||
|
return this.name;
|
||||||
|
},
|
||||||
|
set Name(value) {
|
||||||
|
this.name = value;
|
||||||
|
},
|
||||||
|
get ContentSize() {
|
||||||
|
return this.content.size;
|
||||||
|
},
|
||||||
|
set ContentSize(value) {
|
||||||
|
this.content.size = value;
|
||||||
|
},
|
||||||
|
get Dimension() {
|
||||||
|
return this.dimension;
|
||||||
|
},
|
||||||
|
set Dimension(value) {
|
||||||
|
this.dimension = value;
|
||||||
|
},
|
||||||
|
get PortionSize() {
|
||||||
|
return this.portion.size;
|
||||||
|
},
|
||||||
|
set PortionSize(value) {
|
||||||
|
this.portion.size = value;
|
||||||
|
},
|
||||||
|
get PortionType() {
|
||||||
|
return this.portion.type;
|
||||||
|
},
|
||||||
|
set PortionType(value) {
|
||||||
|
this.portion.type = value;
|
||||||
|
},
|
||||||
|
get PortionPrice() {
|
||||||
|
return this.portion.price;
|
||||||
|
},
|
||||||
|
set PortionPrice(value) {
|
||||||
|
this.portion.price = value;
|
||||||
|
},
|
||||||
|
get ContentPrice() {
|
||||||
|
return this.Portions * this.portion.price;
|
||||||
|
},
|
||||||
|
get Portions() {
|
||||||
|
return this.content.size / (this.portion.size || 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Article.thaw = function (json) {
|
||||||
|
var article = new Article();
|
||||||
|
article.id = json.id;
|
||||||
|
article.Name = json.name;
|
||||||
|
article.Dimension = json.dimension;
|
||||||
|
article.ContentSize = json.content.size;
|
||||||
|
article.PortionPrice = json.portion.price;
|
||||||
|
article.PortionSize = json.portion.size;
|
||||||
|
article.PortionType = json.portion.type;
|
||||||
|
|
||||||
|
return article;
|
||||||
|
};
|
||||||
58
js/model/inventory_article.js
Normal file
58
js/model/inventory_article.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
function InventoryArticle(){
|
||||||
|
this.article = new Article();
|
||||||
|
this.end = 0,
|
||||||
|
this.start = 0;
|
||||||
|
this.fetched = 0;
|
||||||
|
this.lost = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
InventoryArticle.prototype = {
|
||||||
|
get StartPortions() {
|
||||||
|
countFull = Math.floor(this.start);
|
||||||
|
fullPortions = countFull * this.article.Portions;
|
||||||
|
rest = this.start - countFull;
|
||||||
|
restPortions = rest / this.article.PortionSize;
|
||||||
|
|
||||||
|
return fullPortions + restPortions;
|
||||||
|
},
|
||||||
|
get FetchedPortions() {
|
||||||
|
countFull = Math.floor(this.fetched);
|
||||||
|
fullPortions = countFull * this.article.Portions;
|
||||||
|
rest = this.fetched - countFull;
|
||||||
|
restPortions = rest / this.article.PortionSize;
|
||||||
|
|
||||||
|
return fullPortions + restPortions;
|
||||||
|
},
|
||||||
|
get EndPortions() {
|
||||||
|
countFull = Math.floor(this.end);
|
||||||
|
fullPortions = countFull * this.article.Portions;
|
||||||
|
rest = this.end - countFull;
|
||||||
|
restPortions = rest / this.article.PortionSize;
|
||||||
|
|
||||||
|
return fullPortions + restPortions;
|
||||||
|
},
|
||||||
|
get LostPortions() {
|
||||||
|
countFull = Math.floor(this.lost);
|
||||||
|
fullPortions = countFull * this.article.Portions;
|
||||||
|
rest = this.lost - countFull;
|
||||||
|
restPortions = rest / this.article.PortionSize;
|
||||||
|
|
||||||
|
return fullPortions + restPortions;
|
||||||
|
},
|
||||||
|
get Sold() {
|
||||||
|
adds = this.StartPortions + this.FetchedPortions;
|
||||||
|
subs = this.EndPortions + this.LostPortions;
|
||||||
|
return adds - subs;
|
||||||
|
},
|
||||||
|
get Sale() {
|
||||||
|
return this.Sold * this.article.PortionPrice;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
InventoryArticle.thaw = function(json){
|
||||||
|
this.name = json.name;
|
||||||
|
this.start = json.start;
|
||||||
|
this.fetched = json.fetched;
|
||||||
|
this.end = json.end;
|
||||||
|
this.lost = json.lost;
|
||||||
|
};
|
||||||
1216
js/moment-with-locales.min.js
vendored
Normal file
1216
js/moment-with-locales.min.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
60
js/vue.js
Normal file
60
js/vue.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
var app = new Vue({
|
||||||
|
el: "#app",
|
||||||
|
data : {
|
||||||
|
dimensions: [
|
||||||
|
'l',
|
||||||
|
'Stk.',
|
||||||
|
'Gl.',
|
||||||
|
'Fl.',
|
||||||
|
'T.',
|
||||||
|
],
|
||||||
|
articles : [],
|
||||||
|
inventory : {
|
||||||
|
ug : [],
|
||||||
|
mob : [],
|
||||||
|
stud : []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
sales_ug: function (){
|
||||||
|
var total_sales = this.inventory.ug.reduce(function(total, item ) {
|
||||||
|
return total + item.Sale;
|
||||||
|
}, 0);
|
||||||
|
return total_sales;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
addArticle: function() {
|
||||||
|
this.articles.push(new Article());
|
||||||
|
},
|
||||||
|
storeArticles: function() {
|
||||||
|
this.$http.post('./backend?controller=Article&action=store', JSON.stringify(this.articles))
|
||||||
|
.then(response => {
|
||||||
|
Materialize.toast(response.body, 2000);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
loadArticles: function() {
|
||||||
|
this.$http.get('./data/test_articles.json')
|
||||||
|
.then(response => { return response.json();})
|
||||||
|
.then(json => {
|
||||||
|
json.forEach(element => {
|
||||||
|
this.articles.push(Article.thaw(element));
|
||||||
|
});
|
||||||
|
}).then( x => {
|
||||||
|
Materialize.toast('Artikel wurden geladen.', 2000);
|
||||||
|
}).then( x => {
|
||||||
|
this.articles.forEach(a => {
|
||||||
|
ia = new InventoryArticle();
|
||||||
|
ia.article = a;
|
||||||
|
this.inventory.ug.push(ia);
|
||||||
|
});
|
||||||
|
}).then( x => {
|
||||||
|
Materialize.updateTextFields();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created: function(){
|
||||||
|
this.loadArticles();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
9
jsconfig.json
Normal file
9
jsconfig.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es6"
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"**/node_modules/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
11
package.json
Normal file
11
package.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "inventur",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.html",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 0"
|
||||||
|
},
|
||||||
|
"author": "chrosey",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user