terminando cosumos por impresora

This commit is contained in:
2019-06-18 17:08:29 -05:00
parent 7fce38d701
commit fd2b54bbbb
9 changed files with 279 additions and 52 deletions
+77 -33
View File
@@ -2,8 +2,12 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="3018e4b5-6a02-4817-909a-b6afcc057cc6" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/sitio/usuario/js/totales.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/conexion.php" beforeDir="false" afterPath="$PROJECT_DIR$/conexion.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/sitio/admin/admin.php" beforeDir="false" afterPath="$PROJECT_DIR$/sitio/admin/admin.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/sitio/admin/totales.php" beforeDir="false" afterPath="$PROJECT_DIR$/sitio/admin/totales.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/sitio/usuario/usuario.php" beforeDir="false" afterPath="$PROJECT_DIR$/sitio/usuario/usuario.php" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@@ -14,17 +18,14 @@
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/sitio/admin/totales.php">
<entry file="file://$PROJECT_DIR$/sitio/admin/gastos.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="785">
<caret line="50" column="10" selection-start-line="50" selection-start-column="10" selection-end-line="50" selection-end-column="10" />
<state relative-caret-position="463">
<caret line="61" column="22" lean-forward="true" selection-start-line="61" selection-start-column="22" selection-end-line="61" selection-end-column="22" />
<folding>
<element signature="n#style#0;n#td#0;n#tr#0;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#1;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#2;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#0;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#1;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#2;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#1;n#tr#0;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#2;n#tr#0;n#!!top" expanded="true" />
</folding>
</state>
</provider>
@@ -45,10 +46,13 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/conexion.php" />
<option value="$PROJECT_DIR$/sitio/admin/js/totales.js" />
<option value="$PROJECT_DIR$/sitio/usuario/usuario.php" />
<option value="$PROJECT_DIR$/sitio/admin/js/gastos.js" />
<option value="$PROJECT_DIR$/sitio/admin/admin.php" />
<option value="$PROJECT_DIR$/conexion.php" />
<option value="$PROJECT_DIR$/sitio/admin/totales.php" />
<option value="$PROJECT_DIR$/sitio/admin/gastos.php" />
</list>
</option>
</component>
@@ -64,6 +68,7 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
@@ -87,13 +92,6 @@
<item name="sitio" type="462c0819:PsiDirectoryNode" />
<item name="admin" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="public_html" type="b2602c69:ProjectViewProjectNode" />
<item name="public_html" type="462c0819:PsiDirectoryNode" />
<item name="sitio" type="462c0819:PsiDirectoryNode" />
<item name="admin" type="462c0819:PsiDirectoryNode" />
<item name="js" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="public_html" type="b2602c69:ProjectViewProjectNode" />
<item name="public_html" type="462c0819:PsiDirectoryNode" />
@@ -111,7 +109,6 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@@ -120,6 +117,12 @@
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\xampp\htdocs\inventario_material\public_html\sitio\usuario" />
<recent name="C:\xampp\htdocs\inventario_material\public_html\sitio\usuario\js" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
@@ -144,18 +147,19 @@
<updated>1560279679077</updated>
<workItem from="1560279697218" duration="2863000" />
<workItem from="1560458714758" duration="5615000" />
<workItem from="1560802307980" duration="1435000" />
<workItem from="1560802307980" duration="9840000" />
<workItem from="1560887587039" duration="4635000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="9913000" />
<option name="totallyTimeSpent" value="22953000" />
</component>
<component name="ToolWindowManager">
<frame x="1358" y="-8" width="1296" height="1010" extended-state="6" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.17152104" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.17394821" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
@@ -207,38 +211,78 @@
<entry file="file://$PROJECT_DIR$/sitio/admin/js/secciones.js">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/sitio/admin/admin.php">
<entry file="file://$PROJECT_DIR$/sitio/usuario/totales.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="118" column="24" selection-start-line="118" selection-start-column="24" selection-end-line="118" selection-end-column="24" />
<state relative-caret-position="411">
<caret line="56" column="25" lean-forward="true" selection-start-line="56" selection-start-column="25" selection-end-line="56" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sitio/usuario/js/totales.js">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/sitio/usuario/usuario.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="595">
<caret line="134" column="41" selection-start-line="134" selection-start-column="41" selection-end-line="134" selection-end-column="41" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sitio/admin/js/totales.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="88">
<caret line="4" column="21" selection-start-line="4" selection-start-column="21" selection-end-line="4" selection-end-column="21" />
<state relative-caret-position="22">
<caret line="1" lean-forward="true" selection-start-line="1" selection-end-line="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sitio/admin/js/gastos.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="308">
<caret line="14" column="33" lean-forward="true" selection-start-line="14" selection-start-column="33" selection-end-line="14" selection-end-column="33" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sitio/admin/admin.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3278">
<caret line="149" column="22" selection-start-line="149" selection-start-column="22" selection-end-line="149" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sitio/admin/phpChart_Lite/examples/images/background.jpg" />
<entry file="file://$PROJECT_DIR$/sitio/admin/phpChart_Lite/examples/images/basicline.png" />
<entry file="file://$PROJECT_DIR$/sitio/admin/phpChart_Lite/server/cls_util.php" />
<entry file="file://$PROJECT_DIR$/sitio/admin/phpChart_Lite/phpChart.php" />
<entry file="file://$PROJECT_DIR$/sitio/admin/phpChart_Lite/conf.php" />
<entry file="file://$PROJECT_DIR$/sitio/admin/phpChart_Lite/examples/bar_test.php" />
<entry file="file://$PROJECT_DIR$/sitio/admin/phpChart_Lite/examples/images/navhomeover.png" />
<entry file="file://$PROJECT_DIR$/sitio/admin/phpChart_Lite/examples/images/new.png" />
<entry file="file://$PROJECT_DIR$/sitio/admin/phpChart_Lite/examples/images/samplesm.png" />
<entry file="file://$PROJECT_DIR$/sitio/admin/phpChart_Lite/examples/images/dualaxis.png" />
<entry file="file://$PROJECT_DIR$/sitio/admin/phpChart_Lite/examples/images/basicoptions.png" />
<entry file="file://$PROJECT_DIR$/sitio/admin/phpChart_Lite/examples/images/basiclogaxis.png" />
<entry file="file://$PROJECT_DIR$/conexion.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="110">
<caret line="14" column="23" lean-forward="true" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="23" />
<caret line="14" column="13" lean-forward="true" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="23" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sitio/admin/totales.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="785">
<caret line="50" column="10" selection-start-line="50" selection-start-column="10" selection-end-line="50" selection-end-column="10" />
<state relative-caret-position="462">
<caret line="45" column="36" selection-start-line="43" selection-start-column="36" selection-end-line="45" selection-end-column="36" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sitio/admin/gastos.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="463">
<caret line="61" column="22" lean-forward="true" selection-start-line="61" selection-start-column="22" selection-end-line="61" selection-end-column="22" />
<folding>
<element signature="n#style#0;n#td#0;n#tr#0;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#1;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#2;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#0;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#1;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#2;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#1;n#tr#0;n#!!top" expanded="true" />
<element signature="n#style#0;n#td#2;n#tr#0;n#!!top" expanded="true" />
</folding>
</state>
</provider>
+1 -1
View File
@@ -13,7 +13,7 @@
$host = '132.248.80.194';
$user = 'usr_inv_material';
$pass = 'tint4sBond';
$dbname = 'P_orion_inventario_material';
$dbname = 'kalinga_inventario_material';
$dsn = 'mysql:host=' . $host . ';dbname=' .$dbname;
+3 -1
View File
@@ -113,7 +113,7 @@
<article id="tab4">
<h1>Reporte de consumo</h1>
<div id="gastos"></div>
</article>
<article id="tab5">
@@ -147,5 +147,7 @@
<script src="js/busqueda_p.js"></script>
<script src="js/busqueda_t.js"></script>
<script src="js/totales.js"></script>
<script src="js/gastos.js"></script>
</body>
</html>
+71
View File
@@ -0,0 +1,71 @@
<?php
session_start();
require "../../conexion.php";
$impresoras = [];
$relaciones=[];
$info = [];
$i=0;
$cantidad =0 ;
$salida = "";
$query = "SELECT id_impresora, impresora from cat_impresora";
$resultado = $conexion->query($query);
if($resultado->rowCount() > 0){
while($row = $resultado->fetch(PDO::FETCH_ASSOC)){
$impresoras[$i] =$row;
$i++;
}
}
$query = "select b.id_impresora, a.cantidad, a.periodo from toner_salida a
inner join impresora_inventario b on(a.id_impresora_inventario=b.id_impresora_inventario) order by b.id_impresora;";
$resultado = $conexion->query($query);
$i=0;
if($resultado->rowCount() > 0){
while($row = $resultado->fetch(PDO::FETCH_ASSOC)){
$relaciones[$i] =$row;
$i++;
}
}
$i=0;
/*print_r($impresoras);
echo '<br>';
echo '<br>';
print_r($relaciones);
echo '<br>';
echo '<br>';
*/
$periodo = $relaciones[0]['periodo'];
$salida.="<table class='tabla_datos table' >
<thead class='table-primary'>
<tr>
<td style=\"text-align:center;\">Impresora</td>
<td style=\"text-align:center;\">Consumo</td>
<td style=\"text-align:center;\">Periodo</td>
</tr>
</thead>
</tbody>";
foreach ($impresoras as $impresora){
foreach ($relaciones as $relacion){
if($impresora['id_impresora'] == $relacion['id_impresora'] ){
$cantidad += $relacion['cantidad'];
}
}
$info[$i]['cantidad']=$cantidad;
$info[$i]['impresora'] = $impresora['impresora'];
$info[$i]['periodo']= $periodo;
//echo $impresora['impresora'].' |';
//echo $cantidad.'<br>';
$cantidad=0;
$i++;
}
array_multisort($inf);
foreach ($info as $inf){
$salida.="<tr>
<td style=\"text-align:center;\">".$inf['impresora']."</td>
<td style=\"text-align:center;\">".$inf['cantidad']."</td>
<td style=\"text-align:center;\">".$inf['periodo']."</td>
<tr>";
}
print_r($info);
echo $salida;
+18
View File
@@ -0,0 +1,18 @@
$(muestra_total());
function muestra_total(consulta){
$.ajax({
url: 'gastos.php',
dataType: 'html',
data: {consulta: consulta},
})
.done(function (respuesta) {
$('#gastos').html(respuesta);
})
.fail(function () {
console.log("error");
})
}
+10 -9
View File
@@ -39,16 +39,17 @@ if($resultado->rowCount() > 0){
$info[$i] =$fila;
if($i == 0){
$salida.="
<td style=\"text-align:center;\">".$info[$i]['color']."</td>
<td style=\"text-align:center;\">".$info[$i]['existencia']."</td>
<tr>";
$salida.="
<td style=\"text-align:center;\">".$info[$i]['color']."</td>
<td style=\"text-align:center;\">".$info[$i]['existencia']."</td>
<tr>";
}else{
$salida.="
<td style=\"text-align:center;\"><br></td>
<td style=\"text-align:center;\">".$info[$i]['color']."</td>
<td style=\"text-align:center;\">".$info[$i]['existencia']."</td>
<tr>";
$salida.="
<td style=\"text-align:center;\"><br></td>
<td style=\"text-align:center;\">".$info[$i]['color']."</td>
<td style=\"text-align:center;\">".$info[$i]['existencia']."</td>
<tr>";
}
$i++;
}
+18
View File
@@ -0,0 +1,18 @@
$(muestra_total());
function muestra_total(consulta){
$.ajax({
url: 'totales.php',
dataType: 'html',
data: {consulta: consulta},
})
.done(function (respuesta) {
$('#totales').html(respuesta);
})
.fail(function () {
console.log("error");
})
}
+69
View File
@@ -0,0 +1,69 @@
<?php
session_start();
require "../../conexion.php";
$impresoras = [];
$info = [];
$i=0;
$salida = "";
$query = "SELECT impresora from cat_impresora";
$resultado = $conexion->query($query);
if($resultado->rowCount() > 0){
$salida.="<table class='tabla_datos table' >
<thead class='table-primary'>
<tr>
<td style=\"text-align:center;\">Impresora</td>
<td style=\"text-align:center;\">Color</td>
<td style=\"text-align:center;\">Existencia</td>
</tr>
</thead>
</tbody>";
while($row = $resultado->fetch(PDO::FETCH_ASSOC)){
$impresoras[$i] =$row;
$i++;
}
$j=0;
//print_r($impresoras[0]['impresora']);
foreach ($impresoras as $impresora) {
$salida.="<tr>
<td style=\"text-align:center;\">".$impresora['impresora']."</td>";
$i=0;
$busq=$impresora['impresora'];
$query = "CALL st_totales('$busq');";
$resultado = $conexion->query($query);
while($fila = $resultado->fetch(PDO::FETCH_ASSOC)){
$info[$i] =$fila;
if($i == 0){
$salida.="
<td style=\"text-align:center;\">".$info[$i]['color']."</td>
<td style=\"text-align:center;\">".$info[$i]['existencia']."</td>
<tr>";
}else{
$salida.="
<td style=\"text-align:center;\"><br></td>
<td style=\"text-align:center;\">".$info[$i]['color']."</td>
<td style=\"text-align:center;\">".$info[$i]['existencia']."</td>
<tr>";
}
$i++;
}
//print_r($info);
//print_r($info);
$j++;
}
$salida.="</tbody></table>";
}
echo $salida;
$conexion = null;
?>
+12 -8
View File
@@ -63,8 +63,9 @@
<ul class="tabs">
<li><a href="#tab1"><span class=""></span><span class="tab-text">Papel</span></a></li>
<li><a href="#tab2"><span class=""></span><span class="tab-text">Toner</span></a></li>
<li><a href="#tab3"><span class=""></span><span class="tab-text">Papeleria</span></a></li>
<li><a href="#tab4"><span class=""></span><span class="tab-text">Otros</span></a></li>
<li><a href="#tab3"><span class=""></span><span class="tab-text">Totales</span></a></li>
<li><a href="#tab4"><span class=""></span><span class="tab-text">Reporte de consumo</span></a></li>
<li><a href="#tab5"><span class=""></span><span class="tab-text">Alta de material</span></a></li>
</ul>
<div class="secciones">
@@ -94,22 +95,24 @@
<article id="tab3">
<h1>En construccion</h1>
<div id="totales">
</div>
</article>
<article id="tab4">
<h1>En construccion</h1>
<h1>Reporte de consumo</h1>
</article>
<article id="tab5">
<h1>Alta de material</h1>
</article>
</div>
</div>
<footer>
<div class="container" style="background-color: #1B3D70;">
<div class="row">
@@ -129,6 +132,7 @@
<script src="js/secciones.js"></script>
<script src="js/busqueda_p.js"></script>
<script src="js/busqueda_t.js"></script>
<script src="js/totales.js"></script>
</body>
</html>