Node.js - vue.js como puedo mandar pintar la tabla kardex con los valores que voy agregando en los input

 
Vista:

vue.js como puedo mandar pintar la tabla kardex con los valores que voy agregando en los input

Publicado por Aldemar (1 intervención) el 28/09/2018 04:11:17
el ejercicio debe permitirme ingresar entradas de productos con cantidades y precios de compra y salidades con cantidades y precios de venta, se debe llevar el registro de estos movimientos en una ficha de kardex donde me muestre la cantidad disponible y el costo en cada uno de los movimientos o registros del inventario, el metodo utilizado para calcular el costo será el de promedio ponderado.



HTTML

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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!DOCTYPE HTML>
 
<html>
	<head>
		<title>Kardex</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
 
 
		<style>
            table {
                width:100%;
            }
            table, th, td {
                border: 1px solid black;
                border-collapse: collapse;
            }
            th, td {
 
                text-align: left;
            }
            table#t01 tr:nth-child(even) {
                background-color: #eee;
            }
            table#t01 tr:nth-child(odd) {
               background-color: #fff;
            }
            table#t01 th {
                background-color: black;
                color: white;
            }
            </style>
 
	</head>
	<body>
 
		<div id="app">
			<div>
				<h4>Entrada Del Articulo</h4>
 
                <label>Nombre:</label><br>
                <input type="text" v-model="producto.nombrec"/><br>
 
                <label>Cantidad:</label><br>
                <input type="number" v-model="producto.cantidadc" min="0" step=".01"/><br>
 
                <label>Precio:</label><br>
                <input type="number" v-model="producto.precioc" min="0" step=".01"/><br>
 
                <a href="#" v-on:click="agregar">Agregar</a><br>
 
                <table>
                    <thead>
                        <tr style="width:100%">
                            <th>Codigo</th>
                            <th>Nombre</th>
                            <th>Cantidad</th>
                            <th>Precio</th>
                            <th>Total</th>
 
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="(item,key) in productos">
                            <td>{{key}}</td>
 
                            <td>{{item.nombrec}}</td>
                            <td>{{item.cantidadc}}</td>
                            <td>{{item.precioc}}</td>
                            <td>{{item.cantidadc*item.precioc}}</td>
 
                            <td><a href="#" @click="eliminar(key)">Eliminar</a></td>
                        </tr>
                </table>
 
			</div>
		</div>
 
 
		<div id="app2">
            <div>
                <h4>Salida Del Articulo</h4>
 
                <label>Nombre:</label><br>
                <input type="text" v-model="producto.nombrev"/><br>
 
                <label>Cantidad:</label><br>
                <input type="number" v-model="producto.cantidadv" min="0" step=".01" /><br>
 
                <label>Precio:</label><br>
                <input type="number" v-model="producto.preciov" min="0" step=".01" /><br>
 
                <a href="#" v-on:click="agregar">Agregar</a>
 
            </div>
 
                <table>
                    <thead>
                        <tr style="width:100%">
                            <th>Codigo</th>
                            <th>Nombre</th>
                            <th>Cantidad</th>
                            <th>Precio</th>
                            <th>Total</th>
 
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="(item,key) in productos">
                            <td>{{key}}</td>
 
                            <td>{{item.nombrev}}</td>
                            <td>{{item.cantidadv}}</td>
                            <td>{{item.preciov}}</td>
                            <td>{{item.cantidadv*item.preciov}}</td>
 
                            <td><a href="#" @click="eliminar(key)">Eliminar</a></td>
                        </tr>
                </table>
 
			</div>
		</div>
 
 
		<br>
		<br>
		<br>
		<br>
 
		<div id="app3">
            <h4>Kardex</h4>
			<table>
				<thead>
					<tr style="width:100%">
						<th>Codigo</th>
						<th>Nombre</th>
						<th>C.Compra</th>
						<th>C.Precio</th>
						<th>V.Compra</th>
						<th>V.Precio</th>
						<th>Disponible</th>
						<th>Total</th>
 
					</tr>
				</thead>
				<tbody>
                    <tr>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
			</table>
 
 
		</div>
 
        <script src="array.js"></script>
 
	</body>
</html>





JS

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
var app = new Vue({
    el: '#app',
    data: {
       producto: {
           nombrec:"",
           cantidadc:0,
           precioc:0,
       },
       productos:[]
 
    },
    methods:{
 
        eliminar(index){
            this.productos.splice(index,1)
 
        },
        agregar(){
            var p = Object.assign({}, this.producto)
            this.productos.push(p)
            this.producto={}
 
        },
 
 
    },
 
 
});
 
 
var app2 = new Vue({
    el: '#app2',
    data: {
       producto: {
           nombrev:"",
           cantidadv:0,
           preciov:0,
       },
       productos:[]
 
    },
    methods:{
 
        eliminar(index){
            this.productos.splice(index,1)
 
        },
        agregar(){
            var p = Object.assign({}, this.producto)
            this.productos.push(p)
            this.producto={}
 
        },
 
 
    },
 
 
});
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder