David пре 10 година
комит
0e7e172ac4
14 измењених фајлова са 794 додато и 0 уклоњено
  1. 13 0
      app.js
  2. 31 0
      back/db.py
  3. 34 0
      back/web.py
  4. 56 0
      controllers/facturaCtrl.js
  5. 5 0
      css/bootstrap.min.css
  6. 224 0
      css/style.css
  7. BIN
      images/logo-h.png
  8. 48 0
      index.html
  9. 1 0
      js/angular-notify
  10. 15 0
      js/angular-route.min.js
  11. 293 0
      js/angular.min.js
  12. 10 0
      js/ui-bootstrap-tpls-0.13.4.min.js
  13. 9 0
      js/ui-bootstrap.min.js
  14. 55 0
      views/main.html

+ 13 - 0
app.js

@@ -0,0 +1,13 @@
+var app = angular.module('app', ['ngRoute', 'ui.bootstrap', 'cgNotify']); 
+
+app.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
+	$locationProvider.html5Mode(true);
+	$routeProvider
+	.when('/', {
+		templateUrl: 'views/main.html',
+		controller: 'facturaCtrl'
+	})
+	.otherwise({
+		redirectTo: '/'
+	});
+}]);

+ 31 - 0
back/db.py

@@ -0,0 +1,31 @@
+import pymysql
+
+class db():
+	DB = "EBA_STOCK"
+	USER = "root"
+	PASSWORD = "howdoiturnthison"
+	def __init__(self):
+		self.conn = pymysql.connect(unix_socket='/var/run/mysqld/mysqld.sock', user=db.USER, passwd=db.PASSWORD, db=db.DB,cursorclass=pymysql.cursors.DictCursor)
+
+	def client(self, _hash):
+		cur = self.conn.cursor()
+		cur.execute("SELECT id,nombre,apellido,hash FROM clientes where hash=%s", (_hash,))
+		res = cur.fetchall()
+		if len(res) == 0:
+			return None
+		return res[0]
+
+	def products(self, _id=None):
+		ret=[]
+		if _id is None:
+			cur = self.conn.cursor()
+			cur.execute("SELECT id,nombre,precio FROM productos where id between 1000 and 2999")
+			for row in cur.fetchall():
+				row["cantidad"]=0
+				ret.append(row)
+		else:
+			pass
+
+		return ret
+	def pedido(self, pedido):
+		return 0

+ 34 - 0
back/web.py

@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+import json
+import urllib
+import datetime
+from db import db
+from flask import Flask, jsonify, request
+
+app = Flask(__name__)
+PORT = 8981
+BASE_PATH="/back" #changes based on webserver
+@app.route(BASE_PATH + '/cliente/<_hash>')
+def client(_hash):
+	out=db().client(_hash)
+	if out is None:
+		return "{}", 400
+	return json.dumps(out)
+
+@app.route(BASE_PATH + '/productos/<_hash>')
+def products(_hash):
+	c=db().client(_hash)
+	if c is None:
+		return "{}", 400
+
+	out=db().products()
+	return json.dumps(out)
+
+@app.route(BASE_PATH + '/pedido', methods=["POST"])
+def pedido():
+	t = datetime.date.now()
+	r = request.get_json()
+
+
+if __name__ == '__main__':
+	app.run(host="0.0.0.0",port=PORT, debug=True)

+ 56 - 0
controllers/facturaCtrl.js

@@ -0,0 +1,56 @@
+app.controller('facturaCtrl', function ($scope, $http, $window, notify,$location) {
+	$scope.cero=true;
+	$scope.total=0;
+	var user = $location.search().user;
+	if (user == undefined)
+		user="";
+	$scope.update = function() {
+		$http.get('back/cliente/' + user).success(function(data) {
+	   		$scope.userdata = data; 
+		});
+		$http.get('back/productos/' + user).success(function(data) {
+	   		$scope.listaproductos = data; 
+		});
+	};
+
+	$scope.fin = function () {
+		var factura = {};
+		if ($scope.productos.length==0){
+			notify({message:"No hay productos",classes:"alert alert-danger"});
+			return;
+		}
+		$http.post('back/pedido', { factura: factura } )
+	        .success(function(data, status, headers, config) {
+				notify("Guardada correctamente");
+	        })
+	        .error(function(data, status, headers, config) {
+				notify({classes:"alert alert-danger", message:"Error: "+ data.err});
+	        });
+	}
+	$scope.filterCero = function(criteria) {
+		return function(item) {
+			if ($scope.cero)
+				return true;
+			return item.cantidad > 0;
+		};
+		
+	};
+	$scope.updateTotal = function() {
+		var total=0;
+		total=$scope.listaproductos.reduce(
+			function(acc,cur) {
+				return acc+(cur.cantidad*cur.precio)
+			},0);
+		$scope.total=total;
+	};
+	$scope.reset = function() {
+		$scope.update();
+	};
+	$scope.ok = function () {
+
+	};
+
+	$scope.reset();
+
+});
+

Разлика између датотеке није приказан због своје велике величине
+ 5 - 0
css/bootstrap.min.css


+ 224 - 0
css/style.css

@@ -0,0 +1,224 @@
+body,html{
+	width: 100%;
+	min-height: 100%;
+	margin: 0px 0px;
+	font-family: Century Gothic, sans-serif;
+}
+
+.modal-content { position:fixed !important; left: 5%; right: 5%; width: 90%; top: 5%; height: 90%; }
+.modal-content > .ng-scope { background-color:white; }
+.column { width:50%; float:left;}
+div > .column::after{clear:both;}
+
+input[type="number"]::-webkit-outer-spin-button,
+input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
+input[type="number"] { -moz-appearance: textfield; } 
+.warn { background-color:#E7DFBB !important; color:black;}
+a:focus{ color:white !important; }
+.navbar{
+	width: 100%;
+/*	height: 60px;*/
+	background-color: #324875;
+	color: white;
+	font-family: Century Gothic, sans-serif;
+}
+
+.nav-wrap{
+	padding-top: 6px;
+	padding-left: 10px;
+}
+
+.menu{
+	float:right;
+	margin-top: 14px;
+	margin-right: 50px;
+	text-transform: capitalize;
+	font-size: 11pt;
+}
+
+.menu li{
+	display: inline;
+	list-style-type: none;
+	margin-left: 10px;
+}
+.menu a{
+	color: white;
+	text-decoration: none;
+
+}
+
+.menu a:hover{
+	color: #CCCCCC;
+}
+.clear{
+	clear: both;
+}
+
+.container{
+	width: 60%;
+	min-width:1300px;
+	height: 100%;
+	margin: 0px auto;
+	background-color: #F3F6F9;
+	padding: 20px;
+}
+
+.columnas{ width:100%;  }
+.columnLeft, .columnRight {
+	width:47%;
+	margin:1%;
+	margin-left: 0px;
+	float:left;
+}
+.labelblock label { 
+	display:inline-block; 
+	min-width: 90px; 
+	margin-bottom: 5px;
+	font-size:15px;
+}
+
+.labelblock{
+	margin-bottom: 10px;
+}
+
+#ex1, #ex2 {
+	width: 80%;
+	display:inline-block;
+}
+
+#ex1_value, #ex2_value{
+	color: #324875;
+	font-weight: bold;
+	font-size: 12pt;
+}
+#cantidad { width:60px; }
+
+.form-control{
+    height: 25px; 
+    width: 100%; 
+    background-color: transparent;  
+    border-style: solid;  
+    border-width: 0px 0px 1px 0px;  
+    border-color: #324875; 
+    outline:0; 
+} 
+
+h1{
+	color: #324875;
+	font-size: 20pt;
+	margin-top: 0px;
+}
+
+.best-table{
+	width: 100%;
+	font-size:15px;
+	border-spacing:0px;
+}
+.best-table th{
+	color: #324875;
+font-weight: bold;
+font-size: 11pt;
+padding: 10px 8px;
+text-transform: uppercase;
+}
+
+.best-table td{
+	border-bottom: 1px solid #CCC;
+color: #4D4D4D;
+padding: 6px 8px;
+text-align: center;
+}
+
+.best-table tr{
+	border-bottom: 2px solid #6678B1;
+}
+
+.product-cell{
+	width: 50%;
+}
+
+.delete{
+	border: none!important;
+	cursor:pointer;
+	color: #324875;
+
+}
+
+.total-table{
+	width: 60%!important;
+	margin: 0px 45%!important;
+	margin-top: 20px;
+}
+
+.css-button{
+	text-transform: uppercase;
+    text-decoration: inherit;
+    border-radius: 6px 6px 6px 6px;
+    border: 1px solid #3866A3;
+    padding: 6px 14px;
+    cursor: pointer;
+    color: #FFFFFF;
+    display: inline-block;
+    background-color: #324875;
+}
+
+.css-button:hover {
+    background-color: #56688C;
+}
+
+.css-button:active {
+    position:relative;
+    top: 1px;
+}
+
+.factura-datos{
+	color: #324875;
+	font-weight: bold;
+	font-size: 12pt;
+	padding: 10px 8px;
+}
+
+.preview{
+	border: 1px solid #D6DAE3;
+	padding: 20px;
+	margin: 20px 0px;
+}
+
+.best-table img{
+	width: 15px;
+	cursor: pointer;
+}
+
+.best-table .tleft td { text-align:left !important;}
+.left {float:left;}
+.right{float:right;}
+
+#camaras > img { max-width: 45%; }
+
+@media print {
+	.noimprimir { display: none; }
+	a:after{ content: "" !important; }
+	html, body {
+		width: 210mm;
+		height: 297mm;
+		font-size: 10px !important;
+	}
+
+	table { table-layout: fixed !important; width: 95%; }
+	td:first-child, th:first-child { width: 200px !important }
+	table td, table th {
+		margin:0px;
+		border-spacing:0px;
+		border: 0px;
+		width: 100px;
+		overflow: hidden;
+		display: inline-block;
+		white-space: nowrap;
+	}
+	@page {
+		size: A4 portrait;
+		margin: 6mm 6mm 6mm 6mm;
+		
+	}
+
+}

BIN
images/logo-h.png


+ 48 - 0
index.html

@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html ng-app="app">
+<head>
+	<title>ESPECIFICOS Buenos Aires</title>
+	<meta charset="utf-8">
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	
+	<link rel="styleSheet" href="/css/style.css"/>
+	<link rel="styleSheet" href="/css/bootstrap.min.css"/>
+	<link rel="styleSheet" href="/js/angular-notify/dist/angular-notify.css"/>
+	
+	<script type="text/javascript" src="/js/angular.min.js"></script>
+	<script type="text/javascript" src="/js/ui-bootstrap-tpls-0.13.4.min.js"></script>
+	<script type="text/javascript" src="/js/angular-route.min.js"></script>
+	<script type="text/javascript" src="/js/angular-notify/dist/angular-notify.js"></script>
+	<script type="text/javascript" src="/app.js"></script>
+	<script type="text/javascript" src="/controllers/facturaCtrl.js"></script>
+    <base href="/" />
+</head>
+<body>
+	<div class="navbar">
+		<div class="nav-wrap">
+				<img src="images/logo-h.png">
+				<!--
+				<ul class="menu" ng-hide="isHome">
+					<li><a ng-href="/lista_prod_fact/">prod fecha</a></li>
+					<li><a ng-href="/vencimientos/">vencimientos</a></li>
+					<li><a ng-href="/scan/">scan</a></li>
+					<li><a ng-href="/stock">faltantes</a></li>
+					<li><a ng-href="/camaras/">camaras</a></li>
+					<li><a ng-href="/resumen/">resumen</a></li>
+					<li><a ng-href="/mp/">mp</a></li>
+					<li><a ng-href="/cc/">cc</a></li>
+					<li><a ng-href="/clientes/">clientes</a></li>
+					<li><a ng-href="/insumos/">insumos</a></li>
+					<li><a ng-href="/productos/">stock</a></li>
+					<li><a ng-href="/">factura</a></li>
+					<li><a ng-href="/lista_facturas/">lista de facturas</a></li>
+				</ul>
+				-->
+		</div>
+	</div>
+	<div class="clear"></div>
+	<div class="container">
+		<div ng-view=""></div>
+	</div>
+</body>
+</html>

+ 1 - 0
js/angular-notify

@@ -0,0 +1 @@
+Subproject commit 4d159b6ebec256409341ba707a9838e93827f523

Разлика између датотеке није приказан због своје велике величине
+ 15 - 0
js/angular-route.min.js


Разлика између датотеке није приказан због своје велике величине
+ 293 - 0
js/angular.min.js


Разлика између датотеке није приказан због своје велике величине
+ 10 - 0
js/ui-bootstrap-tpls-0.13.4.min.js


Разлика између датотеке није приказан због своје велике величине
+ 9 - 0
js/ui-bootstrap.min.js


+ 55 - 0
views/main.html

@@ -0,0 +1,55 @@
+<div class="row">
+	<div class="col-md-12">
+		<label>
+			<h3>Pedido {{userdata.nombre}} {{userdata.apellido}}</h3>
+		</label>
+	</div>
+</div>
+<div class="row">
+	<div class="col-md-6">
+		<label class="col-md-12">
+			Filtro:
+			<input type="text" class="form-control form-control-small" ng-model="filtro" style="display:block">
+		</label>
+	</div>
+</div>
+
+<div class="col-md-6">
+	<table class="table table-striped">
+		<tr>
+			<th>Cantidad</th>
+			<th>ID</th>
+			<th>Nombre</th>
+			<th>Precio</th>
+			<th>Total</th>
+		</tr>
+		<tr ng-repeat="p in listaproductos | filter: filtro | filter:filterCero(criteria) track by p.id">
+			<td><input ng-change="updateTotal()" type=number class="form-control" ng-model="p.cantidad" value="0" min="0" max="100" style='width:70px;text-align:center;'></td>
+			<td>{{p.id}}</td>
+			<td>{{p.nombre}}</td>
+			<td>${{p.precio}}</td>
+			<td>${{p.cantidad*p.precio}}</td>
+		</tr>
+	</table>
+</div>
+<div class="col-md-6">
+	<div class="row">
+		<div class="col-md-12">
+		<label>
+			<input type="checkbox" ng-model="cero">
+			Ver productos en 0
+		</label>
+		</div>
+	</div>
+	<div class="row">
+		<div class="col-md-12">
+			<b>Total:</b>
+			${{total}}
+		</div>
+	</div>
+	<div class="row">
+		<div class="col-md-12">
+			<button class="btn css-button" ng-click="ok()">Enviar</button>
+		</div>
+	</div>
+</div>