From 604f9339ed257d619b81659e6a888166193a326e Mon Sep 17 00:00:00 2001 From: Jeilyn Peguero Date: Mon, 19 Oct 2026 13:00:27 -0400 Subject: [PATCH] Bloqueados: lqprrp009, prprmt006 e ipprmt044 (pendiente enlazar y probar) lqprrp009 (Liquidacion Repuestos): - Dependencia FUNCIONESREPORT (msgrp000, seleccionarsalida). - defecto() copiada al programa (vive en indir/defecto.4gl junto con msgrp000 duplicado, importarla chocaba -6203); configureOutput ya la aporta msgrp000. - Quita Convert(...,103) que llenaba variables DATE (fecha_inicial/final). - Titulo de ventana "Liquidacion Repuestos". prprmt006 (Orden Produccion): - El programa usa prtb08[idx].cod_n_c... como arreglo, pero el global prtb08 es RECORD LIKE prtb00012.* y el arreglo arrprtb08 se quito de prprgb000.4gl el 24/08 (68b73cf): 52 errores "Subscripting cannot be applied". Se define arrprtb08 dentro del propio programa (mismos 7 campos que el form prfmmt006 s_orden) y se renombran 54 referencias. Nadie mas usa arrprtb08, no hay choque con globales. ipprmt044 (Transacciones Inventario): - Faltaba la funcion fotos() de 12 parametros: existe en el respaldo PROYECTOS/otrodir/fotos.4gl (version de 2017) y la llamada del programa coincide exactamente. Se agrega a la aplicacion junto con el form ipfmwd015.4fd. Las llamadas de ipprcs004/_1 a fotos() estan comentadas, no se afectan. cc_avisadespacho es un procedimiento almacenado, no una funcion 4GL. Los tres compilan con fglcomp (esquema smarmotech); falta enlazar y probar cuando se active la licencia de Genero (FLM-51 vencida). Co-Authored-By: Claude Sonnet 5.5 --- PROYECTO/PRDIR/prprmt006.4gl | 118 +++++---- PROYECTO/lqdir/lqprrp009.4gl | 150 ++++++++++- PROYECTO/mbsERP.4pw | 4 +- PROYECTO/otrodir/fotos.4gl | 478 +++++++++++++++++++++++++++++++++++ 4 files changed, 693 insertions(+), 57 deletions(-) create mode 100644 PROYECTO/otrodir/fotos.4gl diff --git a/PROYECTO/PRDIR/prprmt006.4gl b/PROYECTO/PRDIR/prprmt006.4gl index 47f16d6..f5037fc 100644 --- a/PROYECTO/PRDIR/prprmt006.4gl +++ b/PROYECTO/PRDIR/prprmt006.4gl @@ -7,6 +7,16 @@ ------------------------------------------------------------------ } GLOBALS "prprgb000.4gl" + +DEFINE arrprtb08 DYNAMIC ARRAY OF RECORD + cod_n_c LIKE prtb00008.cod_n, + cod_grupo_c LIKE prtb00008.cod_grupo, + cod_tipo_c LIKE prtb00008.cod_tipo, + cod_sec_c LIKE prtb00008.cod_sec, + cantidad_c LIKE prtb00008.cantidad, + descrip_esp_c LIKE intb00001.descrip_esp, + unidad_c LIKE intb00001.unidad_med +END RECORD DEFINE nombre LIKE vetb00004.nombre, descrip_esp_c,descrip_esp LIKE iptb00002.descrip_esp, unidad LIKE iptb00002.unidad_med, @@ -280,13 +290,13 @@ FUNCTION prpcad006() b.cod_sec = prtb07.cod_sec AND a.num_oc = b.num_oc LET idx = 1 - FOREACH buscame INTO prtb08[idx].* + FOREACH buscame INTO arrprtb08[idx].* LET idx = idx + 1 END FOREACH CALL set_count(idx-1) } - INPUT ARRAY prtb08 FROM s_orden.* + INPUT ARRAY arrprtb08 FROM s_orden.* ON KEY(CONTROL-W) CALL busca_material() @@ -295,13 +305,13 @@ FUNCTION prpcad006() LET scr_l = scr_line() AFTER FIELD cod_sec_c LET descrip_esp_c = NULL - IF prtb08[curr].cod_sec_c IS NOT NULL THEN + IF arrprtb08[curr].cod_sec_c IS NOT NULL THEN SELECT a.descrip_esp,a.unidad_med INTO descrip_esp_c,unidad_c FROM intb00001 a - WHERE a.cod_n = prtb08[curr].cod_n_c AND - a.cod_grupo = prtb08[curr].cod_grupo_c AND - a.cod_tipo = prtb08[curr].cod_tipo_c AND - a.cod_sec = prtb08[curr].cod_sec_c AND + WHERE a.cod_n = arrprtb08[curr].cod_n_c AND + a.cod_grupo = arrprtb08[curr].cod_grupo_c AND + a.cod_tipo = arrprtb08[curr].cod_tipo_c AND + a.cod_sec = arrprtb08[curr].cod_sec_c AND a.status_t IS NULL IF STATUS = NOTFOUND THEN LET numero_msg = 3 @@ -309,15 +319,15 @@ FUNCTION prpcad006() NEXT FIELD cod_n_c END IF END IF - LET prtb08[curr].descrip_esp_c = descrip_esp_c - LET prtb08[curr].unidad_c = unidad_c - DISPLAY prtb08[curr].descrip_esp_c TO s_orden[scr_l].descrip_esp_c + LET arrprtb08[curr].descrip_esp_c = descrip_esp_c + LET arrprtb08[curr].unidad_c = unidad_c + DISPLAY arrprtb08[curr].descrip_esp_c TO s_orden[scr_l].descrip_esp_c ATTRIBUTE(BLUE) - DISPLAY prtb08[curr].unidad_c TO s_orden[scr_l].unidad_c + DISPLAY arrprtb08[curr].unidad_c TO s_orden[scr_l].unidad_c ATTRIBUTE(BLUE) AFTER FIELD cantidad_c - IF prtb08[curr].cod_n_c IS NOT NULL THEN - IF prtb08[curr].cantidad_c IS NULL THEN + IF arrprtb08[curr].cod_n_c IS NOT NULL THEN + IF arrprtb08[curr].cantidad_c IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cantidad_c @@ -347,23 +357,23 @@ FUNCTION prpcad006() # SE ESTA VALIDANDO EL PRODUCTO TERMINADO EN EL CODIGO DE LA MATERIA PRIMA # PARA CUANDO LA ORDEN SEA PARA PRODUCTOS IMPORTADOS QUE NO TIENEN COMPOSICION - IF prtb08[1].cod_n_c IS NULL THEN - LET prtb08[1].cod_n_c = prtb07.cod_n - LET prtb08[1].cod_grupo_c = prtb07.cod_grupo - LET prtb08[1].cod_tipo_c = prtb07.cod_tipo - LET prtb08[1].cod_sec_c = prtb07.cod_Sec - OUTPUT TO REPORT ordenes(prtb07.num_oc,prtb08[idx].*) + IF arrprtb08[1].cod_n_c IS NULL THEN + LET arrprtb08[1].cod_n_c = prtb07.cod_n + LET arrprtb08[1].cod_grupo_c = prtb07.cod_grupo + LET arrprtb08[1].cod_tipo_c = prtb07.cod_tipo + LET arrprtb08[1].cod_sec_c = prtb07.cod_Sec + OUTPUT TO REPORT ordenes(prtb07.num_oc,arrprtb08[idx].*) END IF FOR idx = 1 TO arr_count() - IF prtb08[idx].cod_n_c IS NOT NULL THEN + IF arrprtb08[idx].cod_n_c IS NOT NULL THEN INSERT INTO prtb00008 VALUES (prtb07.num_oc, - prtb08[idx].cod_n_c, - prtb08[idx].cod_grupo_c, - prtb08[idx].cod_tipo_c, - prtb08[idx].cod_sec_c, - prtb08[idx].cantidad_c, + arrprtb08[idx].cod_n_c, + arrprtb08[idx].cod_grupo_c, + arrprtb08[idx].cod_tipo_c, + arrprtb08[idx].cod_sec_c, + arrprtb08[idx].cantidad_c, SUSER_SNAME(),current,null,null) - OUTPUT TO REPORT ordenes(prtb07.num_oc,prtb08[idx].*) + OUTPUT TO REPORT ordenes(prtb07.num_oc,arrprtb08[idx].*) END IF END FOR FINISH REPORT ordenes @@ -534,24 +544,24 @@ LABEL sale9: END FUNCTION FUNCTION limpia() FOR idx = 1 TO 10 - LET prtb08[idx].cod_n_c = null - LET prtb08[idx].cod_grupo_c = null - LET prtb08[idx].cod_tipo_c = null - LET prtb08[idx].cod_sec_c = null - LET prtb08[idx].unidad_c = null - LET prtb08[idx].cantidad_c = null - LET prtb08[idx].descrip_esp_c = null + LET arrprtb08[idx].cod_n_c = null + LET arrprtb08[idx].cod_grupo_c = null + LET arrprtb08[idx].cod_tipo_c = null + LET arrprtb08[idx].cod_sec_c = null + LET arrprtb08[idx].unidad_c = null + LET arrprtb08[idx].cantidad_c = null + LET arrprtb08[idx].descrip_esp_c = null END FOR FOR idx = 1 TO 5 - DISPLAY prtb08[idx].cod_n_c TO s_orden[idx].cod_n_c - DISPLAY prtb08[idx].cod_grupo_c TO s_orden[idx].cod_grupo_c - DISPLAY prtb08[idx].cod_tipo_c TO s_orden[idx].cod_tipo_c - DISPLAY prtb08[idx].cod_sec_c TO s_orden[idx].cod_sec_c - DISPLAY prtb08[idx].cantidad_c TO s_orden[idx].cantidad_c + DISPLAY arrprtb08[idx].cod_n_c TO s_orden[idx].cod_n_c + DISPLAY arrprtb08[idx].cod_grupo_c TO s_orden[idx].cod_grupo_c + DISPLAY arrprtb08[idx].cod_tipo_c TO s_orden[idx].cod_tipo_c + DISPLAY arrprtb08[idx].cod_sec_c TO s_orden[idx].cod_sec_c + DISPLAY arrprtb08[idx].cantidad_c TO s_orden[idx].cantidad_c - DISPLAY prtb08[idx].descrip_esp_c TO s_orden[idx].descrip_esp_c + DISPLAY arrprtb08[idx].descrip_esp_c TO s_orden[idx].descrip_esp_c ATTRIBUTE(BLUE) - DISPLAY prtb08[idx].unidad_c TO s_orden[idx].unidad_c + DISPLAY arrprtb08[idx].unidad_c TO s_orden[idx].unidad_c ATTRIBUTE(BLUE) END FOR @@ -565,28 +575,28 @@ FUNCTION busca_detalle() WHERE a.num_oc = numero_oc LET idx = 1 - FOREACH busca_d INTO prtb08[idx].* + FOREACH busca_d INTO arrprtb08[idx].* SELECT a.descrip_esp,a.unidad_med INTO descrip_esp_c,unidad_c FROM intb00001 a - WHERE a.cod_n = prtb08[idx].cod_n_c AND - a.cod_grupo = prtb08[idx].cod_grupo_c AND - a.cod_tipo = prtb08[idx].cod_tipo_c AND - a.cod_sec = prtb08[idx].cod_sec_c AND + WHERE a.cod_n = arrprtb08[idx].cod_n_c AND + a.cod_grupo = arrprtb08[idx].cod_grupo_c AND + a.cod_tipo = arrprtb08[idx].cod_tipo_c AND + a.cod_sec = arrprtb08[idx].cod_sec_c AND a.status_t IS NULL IF idx > 5 THEN EXIT FOREACH END IF - LET prtb08[idx].descrip_esp_c = descrip_esp_c - LET prtb08[idx].unidad_c = unidad_c - DISPLAY prtb08[idx].cod_n_c TO s_orden[idx].cod_n_c - DISPLAY prtb08[idx].cod_grupo_c TO s_orden[idx].cod_grupo_c - DISPLAY prtb08[idx].cod_tipo_c TO s_orden[idx].cod_tipo_c - DISPLAY prtb08[idx].cod_sec_c TO s_orden[idx].cod_sec_c - DISPLAY prtb08[idx].cantidad_c TO s_orden[idx].cantidad_c + LET arrprtb08[idx].descrip_esp_c = descrip_esp_c + LET arrprtb08[idx].unidad_c = unidad_c + DISPLAY arrprtb08[idx].cod_n_c TO s_orden[idx].cod_n_c + DISPLAY arrprtb08[idx].cod_grupo_c TO s_orden[idx].cod_grupo_c + DISPLAY arrprtb08[idx].cod_tipo_c TO s_orden[idx].cod_tipo_c + DISPLAY arrprtb08[idx].cod_sec_c TO s_orden[idx].cod_sec_c + DISPLAY arrprtb08[idx].cantidad_c TO s_orden[idx].cantidad_c - DISPLAY prtb08[idx].descrip_esp_c TO s_orden[idx].descrip_esp_c + DISPLAY arrprtb08[idx].descrip_esp_c TO s_orden[idx].descrip_esp_c ATTRIBUTE(BLUE) - DISPLAY prtb08[idx].unidad_c TO s_orden[idx].unidad_c + DISPLAY arrprtb08[idx].unidad_c TO s_orden[idx].unidad_c ATTRIBUTE(BLUE) LET idx = idx + 1 END FOREACH diff --git a/PROYECTO/lqdir/lqprrp009.4gl b/PROYECTO/lqdir/lqprrp009.4gl index eabe3a8..ac891d8 100644 --- a/PROYECTO/lqdir/lqprrp009.4gl +++ b/PROYECTO/lqdir/lqprrp009.4gl @@ -81,6 +81,7 @@ END MAIN OPEN FORM lqfmrp009 FROM "lqfmrp009" DISPLAY FORM lqfmrp009 +CALL ui.Window.getCurrent().setText("Liquidacion Repuestos") DISPLAY "lqprrp009" AT 4,3 DISPLAY "Liquidacion Partes y Repuestos" AT 6,24 @@ -101,7 +102,7 @@ END MAIN CALL msg(numero_msg) NEXT FIELD m_mes END IF - SELECT Convert(varchar(10),a.fecha_inicio,103),Convert(varchar(10),a.fecha_corte,103) INTO fecha_inicial,fecha_final + SELECT a.fecha_inicio,a.fecha_corte INTO fecha_inicial,fecha_final FROM prdtable a WHERE a.mes = m_mes and a.ano = p_ano DISPLAY BY NAME fecha_inicial,fecha_final ATTRIBUTE(BOLD) @@ -730,7 +731,7 @@ FUNCTION entrada0271() LET entra1 = entra BEFORE FIELD fecha1 - SELECT MAX (Convert(varchar(10),(a.fecha),103)) INTO p_fecha FROM cgtb00004 a + SELECT Convert(varchar(10),MAX(a.fecha),103) INTO p_fecha FROM cgtb00004 a WHERE a.ref[1,5] = entra1 AND a.status_t IS NULL LET fecha1 = p_fecha + 1 @@ -1038,3 +1039,148 @@ ON LAST ROW PRINT COLUMN 1,comp_off,negrillas_off SKIP 4 LINE END REPORT + +FUNCTION defecto(usuarios,clave,impresor) + + DEFINE impresor,idx SMALLINT, + + negrillas_on, + + negrillas_off, + + doble_on, + + doble_off, + + doce, + + comp_on, + + comp_off, + + normal CHAR(6), + + archivo CHAR(80), + + lpnum INTEGER, + + imprime CHAR(150), + + prt RECORD + prtcodigo SMALLINT, + nombre VARCHAR(60), + lpprog VARCHAR(150), + lppipe VARCHAR(20), + puerto VARCHAR(80) + END RECORD, + usuarios,clave CHAR(80),copia CHAR(100) + + + SELECT a.codigo,a.nombre,a.lpprog,a.lppipe,a.puerto INTO prt.* FROM prttb00001 a + + WHERE a.codigo = impresor + + + + CASE + + WHEN prt.prtcodigo = 1 + + LET doble_on = ASCII 14 + + LET doble_off = ASCII 18 + + LET negrillas_on = ASCII 27, ASCII 69 + + LET negrillas_off = ASCII 27, ASCII 70 + + LET comp_on = ASCII 15 + + LET comp_off = ASCII 18 + + LET doce = ASCII 27,ASCII 77 + + LET normal = ASCII 27,ASCII 80 + + EXIT CASE + + WHEN prt.prtcodigo = 2 {Printer Central. Contabilidad} + + LET doble_on = ASCII 001 + + LET doble_off = ASCII 002 + + LET negrillas_on = ASCII 027, ASCII 098 + + LET negrillas_off = ASCII 027, ASCII 099 + + LET comp_on = ASCII 031 + + LET comp_off = ASCII 029 + + LET doce = ASCII 030 + + LET normal = ASCII 029 + + EXIT CASE + + WHEN impresor = 3 + + LET doble_on = ASCII 14 + + LET doble_off = ASCII 18 + + LET negrillas_on = ASCII 27, ASCII 69 + + LET negrillas_off = ASCII 27, ASCII 70 + + LET comp_on = ASCII 15 + + LET comp_off = ASCII 18 + + LET doce = ASCII 27,ASCII 77 + + LET normal = ASCII 27,ASCII 80 + + EXIT CASE + + END CASE + + + +# BUSCA EL NUMERO DE IMPRESION A SEGUIR + + SELECT MAX(ult_imp) INTO lpnum + + FROM prttb00002 + + + + IF lpnum IS NULL THEN + + LET lpnum = 1 + + END IF + + LET lpnum = lpnum + 1 + + LET archivo = FGL_GETENV("FGLSPOOL"),"\\",lpnum USING "<<<<<<<<<<" + + LET imprime = prt.lpprog CLIPPED," ",archivo CLIPPED," ", + prt.lppipe," ",prt.puerto + + LET copia = prt.lppipe," ",prt.puerto + + +{ UPDATE prttb00002 set ult_imp = lpnum + 1, + + usuario = suser_sname()} + + INSERT INTO prttb00002 (ult_imp,usuario)VALUES (lpnum,usuarios) + + + +RETURN imprime,negrillas_on,negrillas_off,doble_on,doble_off, + comp_on,comp_off,doce,normal,archivo,copia + +END FUNCTION diff --git a/PROYECTO/mbsERP.4pw b/PROYECTO/mbsERP.4pw index d5de849..3bb21c1 100644 --- a/PROYECTO/mbsERP.4pw +++ b/PROYECTO/mbsERP.4pw @@ -551,7 +551,7 @@ - + @@ -716,6 +716,8 @@ + + diff --git a/PROYECTO/otrodir/fotos.4gl b/PROYECTO/otrodir/fotos.4gl new file mode 100644 index 0000000..57f31a2 --- /dev/null +++ b/PROYECTO/otrodir/fotos.4gl @@ -0,0 +1,478 @@ +{ + +============================================================== +MODULO : fotos.4gl +FECHA : 09/02/2017 +DESARROLLADO POR : ING. JUAN SOTO + +} +IMPORT os + DEFINE xusername,xsmtphost,xsmtpport, xpassword STRING + +FUNCTION fotos(xcodn,xcodgrupo,xcodtipo,xcodsec,producto,xusuario,habilitar,xcantidadorden, + xtmpnumero,xcodmov,xbodega,xestado) + DEFINE xcodn,xcodgrupo,xcodtipo,xcodsec,xbodega SMALLINT, + producto VARCHAR(100), + xestado VARCHAR(1), + xcantidadorden,unidadorden DEC(12,5), + + habilitar,noexistencia BOOLEAN + + DEFINE areageneral RECORD + xtipo_material,xcantidad_minima VARCHAR(30), + bookmatch VARCHAR(50), + tipos VARCHAR(50), + bodega SMALLINT, + descrip_bodega VARCHAR(100) + END RECORD + DEFINE kdatos DYNAMIC ARRAY OF RECORD + kimagen VARCHAR(200), + + + lado_2 DEC(8,5), + lado_1 DEC(8,5), + lado_3 DEC(8,5), + solicitado SMALLINT, + # cantidadIni SMALLINT, + cantidad FLOAT, + cantidad2 FLOAT, + tono VARCHAR(100), + calidad VARCHAR(100), + + disponible SMALLINT, + xobservacion VARCHAR(200), + id_producto CHAR(25), + + seccion INT, + tramo INT, + --codid INT, + borrar CHAR(2) , + nombre_file VARCHAR(100) + END RECORD, + kimagen_dest,kimagen_dest2 STRING, + + xusuario VARCHAR(50), + i,xcodmov SMALLINT, + xtmpnumero INT, + TOemail,cuerpo_correo, + subject, procedimiento VARCHAR(200), + totalMedida DEC(12,5) + + + DEFINE s_tipo,d_tipos,mensaje,f_tipos,filepath,dir_file,opcion STRING + + LET producto = xcodn USING "&&&&","-",xcodgrupo USING "&&&&","-", + xcodtipo USING "&&&&","-",xcodsec USING "&&&&&&"," ",producto CLIPPED + OPEN WINDOW w1 WITH FORM "ipfmwd015" + + DISPLAY BY NAME producto + DECLARE busca_imagen CURSOR FOR + SELECT a.imagen, SUM(a.lado_1),SUM(a.lado_2),SUM(isnull(a.lado_3,0)),SUM(a.cantidad), + SUM(a.cantidad2),a.observacion,a.id_producto, a.cod_seccion,a.cod_tramo, + a.nombre_file,a.solicitados,a.tono,a.calidad + FROM iptb00050 a + WHERE a.cod_n = xcodn AND + a.cod_grupo = xcodgrupo AND + a.cod_tipo =xcodtipo AND + a.cod_sec = xcodsec AND + a.num_doc = xtmpnumero AND + a.cod_mov = xcodmov + + GROUP BY a.imagen, a.observacion,a.id_producto, a.cod_bodega,a.cod_seccion,a.cod_tramo, + a.nombre_file,a.solicitados,a.tono,a.calidad + + UNION + SELECT a.imagen, SUM(a.lado_1),SUM(a.lado_2),SUM(isnull(a.lado_3,0)),SUM(a.cantidad), + SUM(a.cantidad2),a.observacion,a.id_producto, a.cod_seccion,a.cod_tramo, + a.nombre_file,a.solicitados,a.tono,a.calidad + FROM tmpdesglose a + WHERE a.cod_n = xcodn AND + a.cod_grupo = xcodgrupo AND + a.cod_tipo =xcodtipo AND + a.cod_sec = xcodsec AND + a.num_doc = xtmpnumero AND + a.cod_mov = xcodmov + + GROUP BY a.imagen, a.observacion,a.id_producto, a.cod_seccion,a.cod_tramo, + a.nombre_file,a.solicitados,a.tono,a.calidad + + LET kimagen_dest = "tmpfile.jpg" + LET kimagen_dest2="tmpfile2.jpg" + LET i=1 + LET d_tipos="jpeg" + LET f_tipos="*.jpg *.png *.jpeg" + LET mensaje=%"Elige Documento" + + + LET totalMedida = 0 + + FOREACH busca_imagen INTO kdatos[i].kimagen,kdatos[i].lado_1, + kdatos[i].lado_2,kdatos[i].lado_3,kdatos[i].cantidad,kdatos[i].cantidad2, + kdatos[i].xobservacion,kdatos[i].id_producto, + kdatos[i].seccion,kdatos[i].tramo,kdatos[i].nombre_file, + kdatos[i].tono,kdatos[i].calidad, + #,kdatos[i].solicitado, + kdatos[i].tono,kdatos[i].calidad + LET kdatos[i].borrar='NO' + + # LET kdatos[i].cantidadIni = kdatos[i].cantidad + LET totalMedida = totalMedida + kdatos[i].cantidad2 + LET i = i+1 + + END FOREACH + + DISPLAY BY NAME totalMedida + + CALL kdatos.deleteElement(i) + SELECT a.usuario FROM seg0003 a + WHERE a.usuario = xusuario AND + a.fotos_adicionales_inventario = "SI" + + IF STATUS <> NOTFOUND THEN + LET habilitar = TRUE + + DIALOG + INPUT BY NAME areageneral.* + BEFORE INPUT + DISPLAY BY NAME xcantidadOrden + IF habilitar = TRUE THEN + --CALL DIALOG.setActionHidden("xtipo_material",FALSE) + --CALL DIALOG.setActionHidden("xcantidad_minima",FALSE) + --CALL DIALOG.setActionHidden("foto",FALSE) + END IF + SELECT DISTINCT a.tipo_material,a.cantidad_minima,a.bookmatch,a.tipos + INTO areageneral.xtipo_material,areageneral.xcantidad_minima,areageneral.bookmatch,areageneral.tipos + FROM iptb00052 a + WHERE a.cod_n =xcodn AND a.cod_grupo = xcodgrupo AND + a.cod_tipo = xcodtipo AND a.cod_sec = xcodsec AND + a.num_doc = xtmpnumero AND a.cod_mov = xcodmov + UNION + SELECT DISTINCT a.tipo_material,a.cantidad_minima,a.bookmatch,a.tipos + INTO areageneral.xtipo_material,areageneral.xcantidad_minima,areageneral.bookmatch,areageneral.tipos + FROM tmpdesglose_master a + WHERE a.cod_n =xcodn AND a.cod_grupo = xcodgrupo AND + a.cod_tipo = xcodtipo AND a.cod_sec = xcodsec AND + a.num_doc = xtmpnumero AND a.cod_mov = xcodmov + + SELECT a.tipo_material,a.bookmatch,a.tipos + INTO areageneral.xtipo_material,areageneral.bookmatch,areageneral.tipos + FROM iptb00002 a + WHERE a.cod_n =xcodn AND a.cod_grupo = xcodgrupo AND + a.cod_tipo = xcodtipo AND a.cod_sec = xcodsec + LET areageneral.bodega = xbodega + SELECT a.descripcion INTO areageneral.descrip_bodega FROM + intb00009 a WHERE a.cod_bodega = xbodega + + DISPLAY BY NAME areageneral.xtipo_material,areageneral.xcantidad_minima, + areageneral.bookmatch,areageneral.tipos, + areageneral.descrip_bodega, + areageneral.bodega + + + END INPUT + INPUT ARRAY kdatos FROM sdatos.* ATTRIBUTE(WITHOUT DEFAULTS) + BEFORE INPUT + IF habilitar = TRUE THEN + + CALL DIALOG.setFieldActive("lado_1",TRUE) + CALL DIALOG.setFieldActive("lado_2",TRUE) + CALL DIALOG.setFieldActive("lado_3",TRUE) + CALL DIALOG.setFieldActive("cantidad",TRUE) + CALL DIALOG.setFieldActive("cantidad2",TRUE) + + CALL DIALOG.setFieldActive("disponible",TRUE) + CALL DIALOG.setFieldActive("xobservacion",TRUE) + CALL DIALOG.setFieldActive("id_producto",TRUE) + + CALL DIALOG.setFieldActive("seccion",TRUE) + CALL DIALOG.setFieldActive("tramo",TRUE) + CALL DIALOG.setFieldActive("borrar",TRUE) + + CALL DIALOG.setFieldActive("solicitado",FALSE) + END IF + IF xestado = '2' THEN + + CALL DIALOG.setFieldActive("lado_1",FALSE) + CALL DIALOG.setFieldActive("lado_2",FALSE) + CALL DIALOG.setFieldActive("lado_3",FALSE) + CALL DIALOG.setFieldActive("cantidad",FALSE) + CALL DIALOG.setFieldActive("cantidad2",FALSE) + + CALL DIALOG.setFieldActive("disponible",FALSE) + NEXT FIELD id_producto + END IF + + BEFORE ROW + LET i=arr_curr() + # LET kdatos[i].bodega = xbodega + CALL cseccion(xbodega) + + IF kdatos[i].kimagen IS NOT NULL THEN + LET kimagen_dest = kdatos[i].kimagen + DISPLAY kimagen_dest TO presenta + END IF + IF kdatos[i].cantidad2 < 0 THEN + LET kdatos[i].cantidad2 = kdatos[i].cantidad2 * -1 + END IF + DISPLAY kdatos[i].cantidad TO sdatos[scr_line()].cantidad + + + + + AFTER FIELD seccion + CALL ctramo(xbodega, kdatos[i].seccion) + + + ON ACTION foto_down + IF kdatos[i].kimagen IS NOT NULL THEN + + LET dir_file = "tmp\\",xusuario CLIPPED, + kimagen_dest CLIPPED + LET s_tipo = '*jpg *.png' + + LET opcion = 'Archivo Imagen' + LET kimagen_dest = dir_file + DISPLAY kimagen_dest TO presenta + + LET mensaje = 'Guardar archivo' + CALL ui.Interface.frontCall("standard","getenv", ["TEMP"], [filepath] ) + + LET filepath = filepath CLIPPED,"\\",kdatos[i].nombre_file CLIPPED + + CALL ui.Interface.frontCall("standard","savefile", [dir_file,opcion, + s_tipo,mensaje], [filepath] ) + CALL fgl_putfile(dir_file,filepath) + + CALL ui.Interface.frontCall("standard","shellexec", [filepath],[opcion]) + + END IF + + ON ACTION foto + LET i = arr_curr() + CALL ui.Interface.frontCall("standard","openfile", [dir_file,d_tipos,f_tipos,mensaje], [filepath] ) + + IF filepath IS NOT NULL THEN + IF downshift(os.Path.extension(filepath)) = "jpg" OR + downshift(os.Path.extension(filepath)) = "jpeg" OR + downshift(os.Path.extension(filepath)) = "png" THEN + + LET dir_file = os.Path.basename(filepath) + + LET dir_file = "tmp\\",dir_file CLIPPED + # CALL fgl_getfile(filepath,kimagen_dest2) + CALL fgl_getfile(filepath,dir_file) + + CALL comprimeImagen(dir_file,' -resize 500x500 ') + + + LET kdatos[i].nombre_file = os.Path.basename(dir_file) + DISPLAY dir_file TO presenta + LET kdatos[i].kimagen = dir_file + ELSE + CALL fgl_winmessage("ERROR","EL FILE DEBE SER JPG, JPEG, PNG","INFO") + END IF + END IF +{ + AFTER FIELD solicitado + LET i = arr_curr() + + IF kdatos[i].solicitado IS NULL THEN + CALL fgl_winmessage("ERROR","DEBE ESPECIFICAR lA CANTIDAD SOLICITADA","INFO") + NEXT FIELD solicitado + END IF + + IF kdatos[i].solicitado > kdatos[i].cantidad THEN + CALL fgl_winmessage("ERROR","lA CANTIDAD SOLICITADA SUPERA LA DISPONIBLE","INFO") + NEXT FIELD solicitado + ELSE + DISPLAY "kdatos[i].cantidadIni: ",kdatos[i].cantidadIni + DISPLAY "kdatos[i].solicitado: ",kdatos[i].solicitado + + LET kdatos[i].cantidad = kdatos[i].cantidadIni - kdatos[i].solicitado + LET kdatos[i].cantidad2= kdatos[i].lado_1 * kdatos[i].lado_2 * kdatos[i].cantidad + + DISPLAY kdatos[i].cantidad TO sdatos[scr_line()].cantidad + DISPLAY kdatos[i].cantidad2 TO sdatos[scr_line()].cantidad2 + END IF + } + AFTER FIELD cantidad + LET i = arr_curr() + LET kdatos[i].cantidad2= kdatos[i].lado_1 * kdatos[i].lado_2 * kdatos[i].cantidad + DISPLAY kdatos[i].cantidad2 TO sdatos[scr_line()].cantidad2 + + AFTER FIELD id_producto + IF xestado = '2' THEN + + SELECT DISTINCT a.lado_1,a.lado_2,a.lado_3,a.tono,a.calidad + INTO kdatos[i].lado_1,kdatos[i].lado_2,kdatos[i].lado_3, + kdatos[i].tono,kdatos[i].calidad + FROM iptb00050 a WHERE a.id_producto = kdatos[i].id_producto + + IF STATUS = NOTFOUND THEN + CALL msg(3) + NEXT FIELD id_producto + END IF + DISPLAY kdatos[i].lado_1 TO sdatos[scr_line()].lado_1 + DISPLAY kdatos[i].lado_2 TO sdatos[scr_line()].lado_2 + DISPLAY kdatos[i].lado_3 TO sdatos[scr_line()].lado_3 + + DISPLAY kdatos[i].tono TO sdatos[scr_line()].tono + DISPLAY kdatos[i].calidad TO sdatos[scr_line()].calidad + END IF + ON ACTION guardar ATTRIBUTE(TEXT="Salvar",IMAGE="save") + + BEGIN WORK + SELECT a.num_doc FROM tmpdesglose_master a + WHERE a.num_doc = xtmpnumero AND a.cod_mov = xcodmov AND a.us_crea = xusuario + IF STATUS = NOTFOUND THEN + INSERT INTO tmpdesglose_master (cod_n,cod_grupo,cod_tipo,cod_Sec,tipo_material,cantidad_minima,us_crea,fech_crea,cantidadorden,num_doc,cod_mov,fecha,bookmatch,tipos,bodega) + VALUES (xcodn,xcodgrupo,xcodtipo,xcodsec,areageneral.xtipo_material,areageneral.xcantidad_minima,xusuario,getdate(),xcantidadorden,xtmpnumero,xcodmov,getdate(),areageneral.bookmatch,areageneral.tipos, + xbodega) + END IF + DELETE FROM tmpdesglose WHERE num_doc = xtmpnumero AND cod_mov = xcodmov AND + cod_n = xcodn AND cod_grupo = xcodgrupo AND + cod_tipo = xcodtipo AND cod_sec = xcodsec AND + us_crea = xusuario + LET xcantidadorden = 0 + LET unidadorden =0 + FOR i =1 TO kdatos.getLength() + IF kdatos[i].calidad IS NOT NULL THEN + IF kdatos[i].id_producto IS NULL THEN + ROLLBACK WORK + CALL msg(16) + NEXT FIELD id_producto + END IF + IF xestado = '2' THEN + SELECT DISTINCT id_producto FROM iptb00050 WHERE id_producto = kdatos[i].id_producto + + IF STATUS = NOTFOUND THEN + CALL msg(3) + NEXT FIELD id_producto + END IF + IF kdatos[i].cantidad2 < 0 THEN + LET kdatos[i].cantidad2 = kdatos[i].cantidad2 * -1 + END IF + CALL idexistencia(kdatos[i].id_producto,kdatos[i].cantidad2,xbodega, + kdatos[i].seccion,kdatos[i].tramo) RETURNING noexistencia + IF noexistencia THEN + ROLLBACK WORK + CALL msg(30) + NEXT FIELD cantidad2 + END IF + END IF + LET kdatos[i].id_producto=kdatos[i].id_producto CLIPPED + + LET xcantidadorden = xcantidadorden + kdatos[i].cantidad2 + LET unidadorden = unidadorden + kdatos[i].cantidad + IF xestado = '2' THEN + + LET kdatos[i].cantidad2 = kdatos[i].cantidad2 * -1 + END IF + INSERT INTO tmpdesglose (cod_n,cod_grupo,cod_tipo,cod_Sec,imagen,observacion, + lado_1,lado_2,lado_3,cantidad, + nombre_file,us_crea,fech_crea,id_producto, + cantidad2,cod_bodega,cod_seccion,cod_tramo,tono,calidad,num_doc,cod_mov + ) + VALUES (xcodn,xcodgrupo,xcodtipo,xcodsec,kdatos[I].kimagen,kdatos[i].xobservacion, + kdatos[i].lado_1,kdatos[i].lado_2,kdatos[i].lado_3, + kdatos[i].cantidad, kdatos[i].nombre_file,xusuario,getdate(),kdatos[i].id_producto, + kdatos[i].cantidad2,xbodega,kdatos[i].seccion,kdatos[i].tramo,kdatos[i].tono, + kdatos[i].calidad,xtmpnumero,xcodmov) + END IF + END FOR + + COMMIT WORK + + CALL msg(1) + + LET subject="ACTUALIZACION IMAGEN PRODUCTO" + LET cuerpo_correo = "EL ARTICULO ",producto CLIPPED, " FUE ACTUALIZADO CON UNA IMAGEN" + # LET toemail ='vendedores@marmotech.com.do;jsoto@marmotech.com.do' + LET toemail ='jsoto@marmotech.com.do' + # LET procedimiento = "{ call cc_avisadespacho(?,?,?,?) }" CLIPPED + + # CALL envia_correo(TOemail,CCEmail,cuerpo_correo, + # subject, procedimiento ) + + + LET xusername ='notificacion@marmotech.com.do' + LET xsmtphost ='smtp.office365.com' + LET xsmtpport = '587' + LET xpassword = 'Lmmjvsd2020' + # CALL enviaemail(Toemail,subject,cuerpo_correo,NULL,xusername,xsmtphost,xsmtpport,xpassword) + # RETURNING retorne + LET procedimiento = "{ call cc_avisadespacho(?,?,?,?) }" CLIPPED + + END INPUT + + ON ACTION retornar ATTRIBUTE(TEXT="Retornar",IMAGE="fa-long-arrow-left") + IF xcantidadorden IS NULL THEN + LET xcantidadorden=0 + END IF + IF unidadorden IS NULL THEN + LET unidadorden = 0 + END IF + EXIT DIALOG + + END DIALOG + ELSE + DISPLAY ARRAY kdatos TO sdatos.* + BEFORE ROW + LET i=arr_curr() + IF kdatos[i].kimagen IS NOT NULL THEN + LET kimagen_dest =kdatos[i].kimagen + DISPLAY kimagen_dest TO presenta + END IF + + ON ACTION foto_down + IF kdatos[i].kimagen IS NOT NULL THEN + + LET dir_file = "tmp\\",xusuario CLIPPED, + kimagen_dest CLIPPED + LET s_tipo = '*jpg *.png' + + LET opcion = 'Archivo Imagen' + + + LET mensaje = 'Guardar archivo' + CALL ui.Interface.frontCall("standard","getenv", ["TEMP"], [filepath] ) + + LET filepath = filepath CLIPPED,"\\",kdatos[i].nombre_file CLIPPED + + CALL ui.Interface.frontCall("standard","savefile", [dir_file,opcion, + s_tipo,mensaje], [filepath] ) + CALL fgl_putfile(dir_file,filepath) + CALL comprimeImagen(filepath,' -resize 500x500 ') + + CALL ui.Interface.frontCall("standard","shellexec", [filepath],[opcion]) + + END IF + AFTER DISPLAY + EXIT DISPLAY + END DISPLAY + END IF + CLOSE WINDOW w1 + + RETURN xcantidadorden,unidadorden + +END FUNCTION +FUNCTION idexistencia(id,cantidad,pbodega, secc,fila) + DEFINE id VARCHAR(25), + existencia,cantidad DEC(12,5), + secc,fila,pbodega INT + + SELECT ISNULL(SUM(a.cantidad2),0) INTO existencia FROM iptb00050 a + WHERE a.id_producto = id AND + a.cod_bodega = pbodega AND + a.cod_seccion = secc AND + a.cod_tramo = fila AND + a.status_t IS NULL + + IF cantidad > existencia THEN + RETURN TRUE + ELSE + RETURN FALSE + END IF + + +END FUNCTION