bitacorasDeMantenimiento_FR.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <?php
  2. $strModulo = 'PRUEBA';
  3. $boolError = true;
  4. $arrOrdenes = [
  5. "0100" => [
  6. "cTrab" => "#315",
  7. "maq" => "Rechazadora ZENN",
  8. "fol" => "0100",
  9. "fIni" => "22/10/21",
  10. "fFin" => "22/10/21",
  11. "desc" => "Cambio de rulina de trabajo",
  12. "prio" => "Muy alta",
  13. "tMan" => "Preventivo",
  14. "nEmp" => "88516",
  15. "obse" => "Se hizo el cambio de la rulina de trabajo al observarse un desgaste importante en la pieza.",
  16. "eva" => "Excelente",
  17. "cau" => "Mecánica",
  18. "mat" => [
  19. "conc" => "Rulina de trabajo",
  20. "uni" => "Pieza",
  21. "cant" => "1",
  22. "imp" => "795.00",
  23. "cTot" => "795.00"
  24. ],
  25. "rTiem" => [
  26. "fech" => "22/10/21",
  27. "hIni" => "10:00:00",
  28. "hFin" => "10:30:00",
  29. "tUti" => "00:30:00",
  30. "cosH" => "1,500.00",
  31. "impT" => "1,500.00"
  32. ]
  33. ],
  34. "0098" => [
  35. "cTrab" => "#613",
  36. "maq" => "Paneladora Salvagnini",
  37. "fol" => "0098",
  38. "fIni" => "19/10/21",
  39. "fFin" => "22/10/21",
  40. "desc" => "Cambio de el láser",
  41. "prio" => "Muy alta",
  42. "tMan" => "Preventivo",
  43. "nEmp" => "88550",
  44. "obse" => "Se hizo el cambio de el láser ya que se rompio.",
  45. "eva" => "Excelente",
  46. "cau" => "Mecánica",
  47. "mat" => [
  48. "conc" => "Láser",
  49. "uni" => "Pieza",
  50. "cant" => "1",
  51. "imp" => "1000.00",
  52. "cTot" => "1000.00"
  53. ],
  54. "rTiem" => [
  55. "fech" => "22/10/21",
  56. "hIni" => "10:00:00",
  57. "hFin" => "10:30:00",
  58. "tUti" => "00:30:00",
  59. "cosH" => "1,500.00",
  60. "impT" => "1,500.00"
  61. ]
  62. ],
  63. "0095" => [
  64. "cTrab" => "#613",
  65. "maq" => "Paneladora Salvagnini",
  66. "fol" => "0095",
  67. "fIni" => "22/10/21",
  68. "fFin" => "22/10/21",
  69. "desc" => "Cambio de rulina de trabajo",
  70. "prio" => "Muy alto",
  71. "tMan" => "Preventivo",
  72. "nEmp" => "88516",
  73. "obse" => "Cambio en la Bastidora Punzonadora",
  74. "eva" => "Excelente",
  75. "cau" => "Mecánica",
  76. "mat" => [
  77. "conc" => "Bastidora Punzonadora",
  78. "uni" => "Pieza",
  79. "cant" => "1",
  80. "imp" => "1200.00",
  81. "cTot" => "1200.00"
  82. ],
  83. "rTiem" => [
  84. "fech" => "28/10/21",
  85. "hIni" => "11:00:00",
  86. "hFin" => "12:30:00",
  87. "tUti" => "00:40:00",
  88. "cosH" => "1,800.00",
  89. "impT" => "1,800.00"
  90. ]
  91. ],
  92. "0080" => [
  93. "cTrab" => "#315",
  94. "maq" => "Rechazadora ZENN",
  95. "fol" => "0080",
  96. "fIni" => "22/10/21",
  97. "fFin" => "22/10/21",
  98. "desc" => "Cambio de rulina de trabajo",
  99. "prio" => "Muy alta",
  100. "tMan" => "Preventivo",
  101. "nEmp" => "88516",
  102. "obse" => "Se hizo el cambio de la rulina de trabajo al observarse un desgaste importante en la pieza.",
  103. "eva" => "Excelente",
  104. "cau" => "Mecánica",
  105. "mat" => [
  106. "conc" => "Rulina de trabajo",
  107. "uni" => "Pieza",
  108. "cant" => "1",
  109. "imp" => "795.00",
  110. "cTot" => "795.00"
  111. ],
  112. "rTiem" => [
  113. "fech" => "22/10/21",
  114. "hIni" => "10:00:00",
  115. "hFin" => "10:30:00",
  116. "tUti" => "00:30:00",
  117. "cosH" => "1,500.00",
  118. "impT" => "1,500.00"
  119. ]
  120. ],
  121. "0075" => [
  122. "cTrab" => "#613",
  123. "maq" => "Paneladora Salvagnini",
  124. "fol" => "0075",
  125. "fIni" => "22/10/21",
  126. "fFin" => "22/10/21",
  127. "desc" => "Cambio de rulina de trabajo",
  128. "prio" => "Muy alta",
  129. "tMan" => "Preventivo",
  130. "nEmp" => "88516",
  131. "obse" => "Se hizo el cambio de la rulina de trabajo al observarse un desgaste importante en la pieza.",
  132. "eva" => "Excelente",
  133. "cau" => "Mecánica",
  134. "mat" => [
  135. "conc" => "Rulina de trabajo",
  136. "uni" => "Pieza",
  137. "cant" => "1",
  138. "imp" => "795.00",
  139. "cTot" => "795.00"
  140. ],
  141. "rTiem" => [
  142. "fech" => "22/10/21",
  143. "hIni" => "10:00:00",
  144. "hFin" => "10:30:00",
  145. "tUti" => "00:30:00",
  146. "cosH" => "1,500.00",
  147. "impT" => "1,500.00"
  148. ]
  149. ],
  150. "0065" => [
  151. "cTrab" => "#023",
  152. "maq" => "Punzonadora",
  153. "fol" => "0065",
  154. "fIni" => "22/10/21",
  155. "fFin" => "22/10/21",
  156. "desc" => "Cambio de rulina de trabajo",
  157. "prio" => "Muy alta",
  158. "tMan" => "Preventivo",
  159. "nEmp" => "88516",
  160. "obse" => "Se hizo el cambio de la rulina de trabajo al observarse un desgaste importante en la pieza.",
  161. "eva" => "Excelente",
  162. "cau" => "Mecánica",
  163. "mat" => [
  164. "conc" => "Rulina de trabajo",
  165. "uni" => "Pieza",
  166. "cant" => "1",
  167. "imp" => "795.00",
  168. "cTot" => "795.00"
  169. ],
  170. "rTiem" => [
  171. "fech" => "22/10/21",
  172. "hIni" => "10:00:00",
  173. "hFin" => "10:30:00",
  174. "tUti" => "00:30:00",
  175. "cosH" => "1,500.00",
  176. "impT" => "1,500.00"
  177. ]
  178. ],
  179. ];
  180. $arrCampos = [
  181. "cTrab" => "Centro de Trabajo",
  182. "maq" => "Máquina",
  183. "fol" => "Folio",
  184. "fIni" => "Fecha de Inicio",
  185. "fFin" => "Fecha de Termino",
  186. "desc" => "Descripción del Servicio de Mantenimiento",
  187. "prio" => "Prioridad",
  188. "tMan" => "Tipo de Mantenimiento",
  189. "nEmp" => "ID del Técnico",
  190. "obse" => "Observaciones",
  191. "eva" => "Evaluación del servicio",
  192. "cau" => "Causa de la falla",
  193. "mat" => [
  194. "conc" => "Concepto",
  195. "uni" => "Unidad",
  196. "cant" => "Cantidad",
  197. "imp" => "Importe",
  198. "cTot" => "Costo total"
  199. ],
  200. "rTiem" => [
  201. "fech" => "Fecha",
  202. "hIni" => "Hora Inicio",
  203. "hFin" => "Hora Termino",
  204. "tUti" => "Tiempo utilizado",
  205. "cosH" => "Costo HH",
  206. "impT" => "Importe"
  207. ],
  208. ];
  209. if($_SERVER['REQUEST_METHOD'] == "POST"){
  210. $numOrden = $_POST["numOrden"];
  211. $boolError = empty($numOrden);
  212. $detallesOrden = [];
  213. if(array_key_exists("pdf", $_POST)){
  214. $datos = json_encode($arrOrdenes[$_POST["pdf"]]);
  215. $fields = array("infoPDF" => base64_encode($datos));
  216. $fieldsStr = http_build_query($fields);
  217. $ch = curl_init();
  218. curl_setopt($ch, CURLOPT_URL, "https://smart.solerpalau.mx/QA/api/pdfIOS/crearPdfTmp.php");
  219. curl_setopt($ch, CURLOPT_POST, 1);
  220. curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsStr);
  221. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  222. $data = curl_exec($ch);
  223. curl_close($ch);
  224. $strInfo = base64_decode($data);
  225. $arrInfo = json_decode($strInfo, true);
  226. $filename = $arrInfo["name"];
  227. $fileinfo = $arrInfo["content"];
  228. // Header content type
  229. header('Content-type: application/pdf');
  230. header('Content-Disposition: inline; filename="' . $filename . '"');
  231. header('Content-Transfer-Encoding: binary');
  232. header('Accept-Ranges: bytes');
  233. // Read the file
  234. echo base64_decode($fileinfo);
  235. exit;
  236. }
  237. if(!$boolError){
  238. $detallesOrden = $arrOrdenes[$numOrden];
  239. $link = $_POST["from"];
  240. $cont = 0;
  241. $strOut = "";
  242. foreach($detallesOrden as $key=>$val){
  243. if($cont == 0 && !is_array($val)){
  244. $strOut .= "<tr> \n";
  245. $strOut .= "<td width=\"15%\" colspan=\"3\" class=\"etiquetaFormulario\"> \n";
  246. $strOut .= "<label class=\"noTopPadding\" for='". $key ."'>". $arrCampos[$key] ."</label> \n";
  247. $strOut .= "</td> \n";
  248. $strOut .= "<td width=\"30%\" colspan=\"6\" class=\"etiquetaFormulario\"> \n";
  249. $strOut .= "<input id='". $key ."' name='" . $key . "' value='" . $detallesOrden[$key] . "' data-dojo-type=\"dijit/form/ValidationTextBox\" style=\"width:100%\" required=\"false\" data-dojo-props=\"placeHolder:'Automático.'\"/> \n";
  250. $strOut .= "</td> \n";
  251. $cont++;
  252. }else if(!is_array($val)){
  253. $strOut .= "<td width=\"20%\" colspan=\"4\" class=\"etiquetaFormulario\"> \n";
  254. $strOut .= "<label class=\"noTopPadding\" for='". $key ."'>". $arrCampos[$key] ."</label> \n";
  255. $strOut .= "</td> \n";
  256. $strOut .= "<td width=\"35%\" colspan=\"7\" class=\"etiquetaFormulario\"> \n";
  257. $strOut .= "<input id='". $key ."' name='" . $key . "' value='" . $detallesOrden[$key] . "' data-dojo-type=\"dijit/form/ValidationTextBox\" style=\"width:100%\" required=\"false\" data-dojo-props=\"placeHolder:'Automático.'\"/> \n";
  258. $strOut .= "</td> \n";
  259. $strOut .= "</tr> \n";
  260. $cont = 0;
  261. }else{
  262. $bandName = $key == "mat" ? "Materiales y/o refacciones" : "Registro de tiempo";
  263. $strOut .= "<tr> \n";
  264. $strOut .= "<td>&nbsp;</td> \n";
  265. $strOut .= "</tr> \n";
  266. $strOut .= "<tr> \n";
  267. $strOut .= "<td width=\"100%\" colspan=\"20\" bgcolor=\"#FF0000\" style=\"height:23px;color:#FFFFFF;padding-left:5px;\">$bandName</td> \n";
  268. $strOut .= "</tr> \n";
  269. $strOut .= "<tr> \n";
  270. $strOut .= "<td>&nbsp;</td> \n";
  271. $strOut .= "</tr> \n";
  272. $cont1 = 0;
  273. foreach($val as $key0=>$val0){
  274. if($cont1 == 0){
  275. $strOut .= "<tr> \n";
  276. $strOut .= "<td width=\"15%\" colspan=\"3\" class=\"etiquetaFormulario\"> \n";
  277. $strOut .= "<label class=\"noTopPadding\" for='". $key0 ."'>". $arrCampos[$key][$key0] ."</label> \n";
  278. $strOut .= "</td> \n";
  279. $strOut .= "<td width=\"30%\" colspan=\"6\" class=\"etiquetaFormulario\"> \n";
  280. $strOut .= "<input id='". $key0 ."' name='" . $key0 . "' value='" . $detallesOrden[$key][$key0] . "' data-dojo-type=\"dijit/form/ValidationTextBox\" style=\"width:100%\" required=\"false\" data-dojo-props=\"placeHolder:'Automático.'\"/> \n";
  281. $strOut .= "</td> \n";
  282. $cont1++;
  283. }else{
  284. $strOut .= "<td width=\"20%\" colspan=\"4\" class=\"etiquetaFormulario\"> \n";
  285. $strOut .= "<label class=\"noTopPadding\" for='". $key0 ."'>". $arrCampos[$key][$key0] ."</label> \n";
  286. $strOut .= "</td> \n";
  287. $strOut .= "<td width=\"35%\" colspan=\"7\" class=\"etiquetaFormulario\"> \n";
  288. $strOut .= "<input id='". $key0 ."' name='" . $key0 . "' value='" . $detallesOrden[$key][$key0] . "' data-dojo-type=\"dijit/form/ValidationTextBox\" style=\"width:100%\" required=\"false\" data-dojo-props=\"placeHolder:'Automático.'\"/> \n";
  289. $strOut .= "</td> \n";
  290. $strOut .= "</tr> \n";
  291. $cont1 = 0;
  292. }
  293. }
  294. $cont = 0;
  295. }
  296. }
  297. }
  298. }
  299. ?>
  300. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  301. <html xmlns="http://www.w3.org/1999/xhtml">
  302. <head>
  303. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  304. <meta http-equiv="imagetoolbar" content="no" />
  305. <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Poppins:400,500,700,300,600">
  306. <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans">
  307. <link media="screen" rel="stylesheet" type="text/css" href="css/principal.css" />
  308. <!--<link media="screen" rel="stylesheet" type="text/css" href="css/pagination.css" />--> <!--Paginador-->
  309. <link rel="shortcut icon" type="image/x-icon" href="css/layout/global/sp.ico" />
  310. <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/dojo/1.14.1/dijit/themes/claro/claro.css">
  311. <script src="//ajax.googleapis.com/ajax/libs/dojo/1.14.1/dojo/dojo.js" data-dojo-config="async: true, parseOnLoad:true"></script>
  312. <script type="application/javascript">
  313. // Cargamos los complementos de dojo
  314. require(["dojo/dom", "dojo/_base/fx", "dojo/_base/array", "dojo/query", "dojo/dom-construct", "dijit/registry", "dojo/dom-style", "dojo/ready", "dojo/on", "dojo/window",
  315. "dojo/store/Memory", "dijit/form/FilteringSelect", "dijit/form/Button", "dojo/dom-class", "dijit/Dialog",
  316. "dojo/_base/lang", "dojox/grid/DataGrid", "dojo/data/ItemFileWriteStore", "dojox/grid/enhanced/plugins/DnD", "dojox/grid/EnhancedGrid", "dojox/grid/enhanced/plugins/Selector", "dojox/grid/enhanced/plugins/IndirectSelection", "dojox/grid/enhanced/plugins/NestedSorting",
  317. "dijit/ProgressBar", "dijit/ConfirmDialog", "dojo/dom-style", "dijit/form/ComboButton", "dijit/Menu", "dijit/MenuItem", "dijit/MenuSeparator", "dijit/Tooltip", "dijit/form/Form", "dijit/form/TextBox",
  318. "dojox/grid/enhanced/plugins/Filter", "dijit/form/ValidationTextBox", "dijit/form/NumberSpinner", "dojo/request", "dojo/parser"],
  319. function(dom, fx, array, query, domConstruct, dijit, style, ready, on, win,
  320. Memory, FilteringSelect, Button, domClass, Dialog,
  321. lang, DataGrid, ItemFileWriteStore, DnDConfig, EnhancedGrid, Selector, indirectSelection, nestedSorting,
  322. ProgressBar, ConfirmDialog, style, ComboButton, Menu, MenuItem, MenuSeparator, Tooltip, Form, TextBox, filter, ValidationTextBox, NumberSpinner, request) {
  323. const urlPeticiones = "plantillaEjemplo_DO.php";
  324. const idModulo = "<?php echo($strModulo);?>";
  325. // Para Mostrar de Mensajes de "error o éxito"
  326. var dgEjecuta = new Dialog({title: 'Procesando...', style: 'width:300px'});
  327. var pbMarcar = new ProgressBar({value: Number.POSITIVE_INFINITY, layoutAlign: 'left'});
  328. dgEjecuta.setContent(pbMarcar);
  329. dgResultadoError = new ConfirmDialog({ title:"<b>Error</b>", style: "min-width:300px; heigth; auto" });
  330. style.set(dgResultadoError.cancelButton.domNode, 'display', 'none');
  331. dgResultadoExito = new ConfirmDialog({ title:"<b>Éxito</b>", style: "min-width:300px; heigth; auto" });
  332. style.set(dgResultadoExito.cancelButton.domNode, 'display', 'none');
  333. /****************************************************************** Botones ******************************************************************/
  334. // Limpiar
  335. new Button({
  336. label: "Regresar",
  337. iconClass: "dijitEditorIcon dijitEditorIconUndo",
  338. showLabel: true,
  339. onClick: function() {
  340. window.parent.frames.app_modulo.location.href = '<?php echo $link; ?>';
  341. }
  342. }, "BTNCERRAR").startup();
  343. /****************************************************************** Acciones ******************************************************************/
  344. realizaAccion = function (accion){
  345. dgEjecuta.set("title", "Consultando...");
  346. dgEjecuta.show();
  347. request.post(urlPeticiones, {
  348. data: {
  349. accion: accion,
  350. idModulo: idModulo,
  351. dato1: "prueba"
  352. }
  353. }).then(
  354. function (response) {
  355. var objResponse = JSON.parse(response);
  356. if (objResponse['estatus'] == "ERROR") {
  357. dgEjecuta.hide();
  358. dgResultadoError.setContent(objResponse['errorDescripcion']);
  359. dgResultadoError.show();
  360. } else {
  361. let datosRecibidos = objResponse["datosRecibidos"];
  362. console.log(datosRecibidos);
  363. dgEjecuta.hide();
  364. }
  365. }
  366. );
  367. };
  368. ready(function() {
  369. // Actualizar el tamaño del TabContainer en función del tamaño de página
  370. var ventana = win.getBox();
  371. var strVentana = (ventana.h-75-100)+"px";
  372. style.set(dijit.byId("djTab").id, { height:strVentana });
  373. dijit.byId("djTab").resize();
  374. // Actualizar el tamaño del TabContainer en función del tamaño de página
  375. on(window, "resize", function() {
  376. var ventana = win.getBox();
  377. var strVentana = (ventana.h-75-100)+"px";
  378. style.set(dijit.byId("djTab").id, { height:strVentana });
  379. dijit.byId("djTab").resize();
  380. });
  381. // Eliminar la cortina de entrada
  382. fx.fadeOut({node: dom.byId("loadingOverlay"), duration: 1}).play();
  383. setTimeout(function () {
  384. domConstruct.destroy("loadingOverlay");
  385. }, 1);
  386. });
  387. });
  388. </script>
  389. </head>
  390. <body class="claro">
  391. <div id="loadingOverlay" class="loadingOverlay pageOverlay">
  392. <div class="loadingMessage">Espere...</div>
  393. </div>
  394. <div id="wrapper_container_module">
  395. <div id="wrapper_table" style="position:relative;">
  396. <div data-dojo-type="dijit/form/Form" id="frm" data-dojo-id="frm" encType="multipart/form-data"
  397. action="<?php echo($_SERVER['PHP_SELF']); ?>" method="post" style="position:relative;">
  398. <script type="dojo/on" data-dojo-event="submit">return true;</script>
  399. <div id="wrapper_table_head">Órden de Mantenimiento</div>
  400. <div id="wrapper_table_body_mod_app">
  401. <table width="100%" height="auto">
  402. <tr>
  403. <td width="100%" colspan="20" align="center">
  404. </tr>
  405. <tr>
  406. <td width="100%" colspan="20" align="center">
  407. <button id="BTNCERRAR" type="button"></button>
  408. </td>
  409. </tr>
  410. </table>
  411. <div id="djTab" data-dojo-type="dijit/layout/TabContainer" data-dojo-props="tabPosition:'top'" style="width:100%;">
  412. <div data-dojo-type="dijit/layout/ContentPane" title="Detalles" data-dojo-props="selected:true">
  413. <table width="100%" heifght="auto">
  414. <?php echo $strOut; ?>
  415. </table>
  416. </div>
  417. </div>
  418. </div>
  419. </div>
  420. </div>
  421. </div>
  422. </body>