diff --git a/PROYECTO/PRDIR/prprmt006.4gl b/PROYECTO/PRDIR/prprmt006.4gl index 47f16d6..fd2f45b 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, @@ -41,10 +51,11 @@ END MAIN FORM LINE 9, ERROR LINE 23, COMMENT LINE 21 - CALL pantalla() + # (pantalla() es el encabezado de la pantalla de texto antigua; no aplica en GUI) OPEN FORM ctfmmt006 FROM "prfmmt006" DISPLAY FORM ctfmmt006 - CALL pantalla() + CALL ui.Window.getCurrent().setText("Ordenes de Produccion") + # (pantalla() es el encabezado de la pantalla de texto antigua; no aplica en GUI) DISPLAY "prprmt006" AT 4,3 DISPLAY "Ordenes De Produccion" AT 6,32 @@ -280,13 +291,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 +306,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 +320,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 +358,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 +545,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 +576,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/addir/adfmwd008.per b/PROYECTO/addir/adfmwd008.per index a91fe7e..6363567 100644 --- a/PROYECTO/addir/adfmwd008.per +++ b/PROYECTO/addir/adfmwd008.per @@ -7,7 +7,7 @@ FECHA REALIZACION : Junio 24, 1993 ------------------------------------------------------------------------ } -DATABASE rayovac +DATABASE smarmotech SCREEN SIZE 24 by 80 { Busqueda de los Niveles de Empleados diff --git a/PROYECTO/addir/adprmt001.4gl b/PROYECTO/addir/adprmt001.4gl index be593d8..b1adf9f 100644 --- a/PROYECTO/addir/adprmt001.4gl +++ b/PROYECTO/addir/adprmt001.4gl @@ -55,7 +55,8 @@ FUNCTION adpcad001() {WHENEVER ERROR CONTINUE} ## CAPTURA LOS DATOS QUE VA A CONTENER EL REGISTRO - INPUT BY NAME depto.* #,m_estado_a,m_estado_m + INPUT BY NAME depto.departamento, depto.nom_dpto, depto.status_t, depto.us_crea, + depto.fech_crea, depto.us_mod, depto.fech_mod #,m_estado_a,m_estado_m ## VERIFICA QUE EL CODIGO NO EXISTA EN EL CATALOGO DE DEPARTAMENTO. SI EXISTE, ## ENTONCES DESPLEGA LOS DATOS DEL REGISTRO EXISTENTE. @@ -77,7 +78,8 @@ FUNCTION adpcad001() NEXT FIELD departamento END IF - DISPLAY BY NAME depto.* + DISPLAY BY NAME depto.departamento, depto.nom_dpto, depto.status_t, depto.us_crea, + depto.fech_crea, depto.us_mod, depto.fech_mod LET numero_msg = 12 CALL msg(numero_msg) LET depto.nom_dpto = NULL @@ -113,10 +115,12 @@ FUNCTION adpcad001() CALL msg(numero_msg) NEXT FIELD nom_dpto ELSE - INSERT INTO adtb00001 VALUES (depto.departamento,depto.nom_dpto, + INSERT INTO adtb00001 (departamento,nom_dpto,status_t,us_crea,fech_crea,us_mod,fech_mod) + VALUES (depto.departamento,depto.nom_dpto, null, SUSER_SNAME (), GETDATE (), null, null) - INSERT INTO adtb00029 VALUES (depto.departamento,m_estado_a,m_estado_m, + INSERT INTO adtb00029 (departamento,estado_a,estado_m,depto_ant,estatus_t,us_crea,fech_crea,us_mod,fech_mod) + VALUES (depto.departamento,m_estado_a,m_estado_m, depto.departamento,null,SUSER_SNAME(), GETDATE (),null,null) LET m_depto = depto.departamento @@ -159,7 +163,7 @@ FUNCTION adpcmf001() RETURN END IF - LET SELEC = " SELECT UNIQUE * FROM adtb00001 where ", + LET SELEC = " SELECT DISTINCT * FROM adtb00001 where ", " status_t is null and ", criterio clipped, " ORDER BY 1" @@ -246,9 +250,7 @@ FUNCTION adpcmf001() END IF ## SE SELECCIONAN LOS CAMPOS QUE SON MODIFICABLES - INPUT BY NAME depto.nom_dpto, - m_estado_a, - m_estado_m WITHOUT DEFAULTS + INPUT BY NAME depto.nom_dpto WITHOUT DEFAULTS AFTER FIELD nom_dpto IF depto.nom_dpto IS NULL THEN @@ -283,9 +285,7 @@ FUNCTION adpcmf001() UPDATE chequeo SET nom_dpto = depto.nom_dpto WHERE departamento = depto.departamento - UPDATE adtb00029 SET estado_a = m_estado_a, - estado_m = m_estado_m, - us_mod = SUSER_NAME(), + UPDATE adtb00029 SET us_mod = SUSER_NAME(), fech_mod = GETDATE() WHERE departamento = depto.departamento diff --git a/PROYECTO/addir/adprmt017.4gl b/PROYECTO/addir/adprmt017.4gl index 30dab79..cb65839 100644 --- a/PROYECTO/addir/adprmt017.4gl +++ b/PROYECTO/addir/adprmt017.4gl @@ -289,7 +289,7 @@ FUNCTION adpcad017() ## SELECCIONA LA FECHA DE INGRESO Y EL SUELDO DE LA TABLA DE CONTRATACION ## Y SELECCION DE EMPLEADOS - SELECT UNIQUE convert(char(10),a.fech_efec,101),a.sueldo,b.cod_sol + SELECT UNIQUE a.fech_efec,a.sueldo,b.cod_sol INTO contra.fech_efec,contra.sueldo,parece.cod_sol FROM adtb00019 a,adtb00018 b WHERE a.cod_sol = b.cod_sol and b.cod_sol = acc_per.cod_sol and @@ -301,7 +301,7 @@ FUNCTION adpcad017() END IF - IF xtipo <> 'INGRESO' THEN + IF xtipo IS NULL OR xtipo <> 'INGRESO' THEN LET acc_per.cod_sol = NULL NEXT FIELD fecha END IF @@ -309,9 +309,9 @@ FUNCTION adpcad017() ## VERIFICA QUE EL SOLICITANTE EXISTE EN LA TABLA DE SOLICITANTES. SI EXISTE ## LO PRESENTA EN PANTALLA. - SELECT cod_sol,convert(char(10),fecha,101),nom1_sol,nom2_sol,apell1_sol, + SELECT cod_sol,fecha,nom1_sol,nom2_sol,apell1_sol, apell2_sol,calle,casa_num,barrio,urbanizacion,telefono, - cod_provincia,convert(char(10),fech_nac,101),cod_nac,estado_civil,estatura, + cod_provincia,fech_nac,cod_nac,estado_civil,estatura, peso,cedula,licencia,tipo_sangre,cod_puesto, cod_prof,sexo,status_t,us_crea,fech_crea,us_mod,fech_mod, serie @@ -372,12 +372,12 @@ FUNCTION adpcad017() ## CHEQUEA QUE EL EMPLEADO EXISTA EN LA TABLA DE EMPLEADOS. SI EXISTE ## DESPLEGA TODA LA INFORMACION REFERENTE AL EMPLEADO. - IF xtipo <> 'INGRESO' THEN + IF xtipo IS NULL OR xtipo <> 'INGRESO' THEN SELECT b.departamento,b.nivel_emp,b.cod_puesto,b.nom1_emp, b.nom2_emp,b.apell1_emp,b.apell2_emp,b.sueldo_ac, b.nomina,b.estado_civil,b.tipo_sangre, - b.cedula,b.cuenta_no,CONVERT(char(10),b.fech_efec,103),b.tipo_sueldo + b.cedula,b.cuenta_no,b.fech_efec,b.tipo_sueldo INTO acc_per.departamento,acc_per.nivel_emp,acc_per.cod_puesto, nombre9,nombre10,apellido9,apellido10,acc_per.sueldo_ac, acc_per.nomina,acc_per.estado_civil,acc_per.tipo_sangre, @@ -402,8 +402,8 @@ FUNCTION adpcad017() WHERE k.cod_puesto = acc_per.cod_puesto and k.status_t is null SELECT UNIQUE a.sexo INTO acc_per.sexo FROM adtb00021 a - WHERE a.num_emp = acc_per.num_emp AND a.cod_par = 0 AND - a.sec_par = 0 + WHERE a.num_emp = acc_per.num_emp AND ISNULL(a.cod_par,0) = 0 AND + ISNULL(a.sec_par,0) = 0 SELECT a.nis INTO pnis FROM adtb00030 a WHERE a.num_emp = acc_per.num_emp @@ -905,7 +905,7 @@ FUNCTION adpcad017() personal.serie USING "<<<" SELECT UNIQUE num_emp FROM adtb00021 - WHERE num_emp = acc_per.num_emp AND cod_par = 0 AND sec_par = 0 + WHERE num_emp = acc_per.num_emp AND ISNULL(cod_par,0) = 0 AND ISNULL(sec_par,0) = 0 IF STATUS = NOTFOUND THEN @@ -1001,14 +1001,14 @@ FUNCTION adpcmf017() END IF LET selec = - "SELECT UNIQUE a.num_trx,a.cod_mto,a.cod_sol,convert(char(10),a.fecha,103), ", - " CONVERT(CHAR(10),a.fech_efec,103),a.num_emp,a.departamento,a.nivel_emp,a.cod_puesto, ", + "SELECT UNIQUE a.num_trx,a.cod_mto,a.cod_sol,a.fecha, ", + " a.fech_efec,a.num_emp,a.departamento,a.nivel_emp,a.cod_puesto, ", " a.sueldo_ac,a.nomina,a.estado_civil,b.sexo,a.tipo_sangre, ", " a.sueldo_lq,a.observacion,a.num1_emp,a.departamento1, ", " a.nivel1_emp,a.cod1_puesto,a.num2_emp,a.departamento2, ", " a.nivel2_emp,a.cod2_puesto,a.num3_emp,a.departamento3, ", " a.nivel3_emp,a.cod3_puesto,c.cedula,a.us_crea,a.fech_crea,a.us_mod, ", - " a.fech_mod,CASE a.status_t WHEN 'E' THEN 'ANULADO' ELSE 'ACTIVO' END, CONVERT(CHAR(10),c.fech_nac,103) ", + " a.fech_mod,CASE a.status_t WHEN 'E' THEN 'ANULADO' ELSE 'ACTIVO' END, c.fech_nac ", "FROM adtb00020 a,adtb00003 c LEFT OUTER JOIN adtb00021 b ON b.num_emp = c.num_emp ", "WHERE a.num_emp = c.num_emp AND ",criterio clipped, " ORDER BY a.num_emp" @@ -1580,7 +1580,7 @@ FUNCTION adpcmf017() END IF UPDATE adtb00021 SET sexo = acc_per.sexo WHERE num_emp = acc_per.num_emp - AND cod_par = 0 AND sec_par=0 + AND ISNULL(cod_par,0) = 0 AND ISNULL(sec_par,0) = 0 UPDATE adtb00017 SET departamento = acc_per.departamento, nivel_emp = acc_per.nivel_emp, cod_puesto = acc_per.cod_puesto, @@ -1668,7 +1668,7 @@ FUNCTION desplegar() SELECT b.departamento,b.nivel_emp,b.cod_puesto,b.nom1_emp, b.nom2_emp,b.apell1_emp,b.apell2_emp,b.sueldo_ac, b.nomina,b.estado_civil,b.tipo_sangre, - b.cedula,b.cuenta_no,CONVERT(char(10),b.fech_efec,103), + b.cedula,b.cuenta_no,b.fech_efec, b.sueldo_ac INTO acc_per.departamento,acc_per.nivel_emp,acc_per.cod_puesto, nombre9,nombre10,apellido9,apellido10,acc_per.sueldo_ac, @@ -1764,7 +1764,7 @@ nombre5 clipped," ",nombre6 clipped," ",apellido5 clipped," ",apellido6 clipped ## DATOS VACACIONES IF xtipo = 'VACACIONES' THEN INITIALIZE vacacion.* TO NULL - SELECT a.cod_mov,a.cod_mov2,a.num_dias_disfrute,CONVERT(CHAR(10),a.fecha_sal,103),CONVERT(CHAR(10),a.fecha_ent,103), + SELECT a.cod_mov,a.cod_mov2,a.num_dias_disfrute,a.fecha_sal,a.fecha_ent, a.num_nomi, a.num_dias_disfrute,a.periodo,a.valor_vacaciones,a.num_dias_pagados,a.proporcion_vacaciones INTO vacacion.cod_mov1,vacacion.cod_mov2,vacacion.dias_vac,vacacion.fecha_sal,vacacion.fecha_ent, @@ -1930,7 +1930,7 @@ FUNCTION vacaciones(operacion) LET salario_acumulado = 0 IF vacacion.cod_mov1 = 36 THEN LET salario = 0 - SELECT CONVERT(CHAR(10),a.fech_efec,103),a.sueldo_ac INTO fecha_entrada_emp,salario + SELECT a.fech_efec,a.sueldo_ac INTO fecha_entrada_emp,salario FROM adtb00003 a WHERE a.num_emp = acc_per.num_emp @@ -2011,7 +2011,7 @@ FUNCTION vacaciones(operacion) END INPUT ELSE LET salario = 0 - SELECT CONVERT(CHAR(10),a.fech_efec,103),a.sueldo_ac INTO fecha_entrada_emp,salario + SELECT a.fech_efec,a.sueldo_ac INTO fecha_entrada_emp,salario FROM adtb00003 a WHERE a.num_emp = acc_per.num_emp LET salario_quincenal = salario /2 @@ -2733,7 +2733,7 @@ ON EVERY ROW SELECT COUNT(*) INTO depende FROM adtb00013 WHERE cod_sol = codigo_s AND cod_par = 4 - SELECT a.cod_provincia,CONVERT(CHAR(10),a.fech_nac,103),a.cod_nac + SELECT a.cod_provincia,a.fech_nac,a.cod_nac INTO cod_provincia,fecha_nac,codigo_n FROM adtb00012 a WHERE a.cod_sol = codigo_s diff --git a/PROYECTO/ipdir/ipautorizareq.4gl b/PROYECTO/ipdir/ipautorizareq.4gl index e427a77..c664e54 100644 --- a/PROYECTO/ipdir/ipautorizareq.4gl +++ b/PROYECTO/ipdir/ipautorizareq.4gl @@ -4,6 +4,7 @@ FECHA : Mayo 9, 2022 } +IMPORT FGL greruntime GLOBALS "ipprgb000.4gl" DEFINE r INT, arr_busqueda1 DYNAMIC ARRAY OF RECORD diff --git a/PROYECTO/lqdir/lqprrp009.4gl b/PROYECTO/lqdir/lqprrp009.4gl index eabe3a8..e627d00 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 diff --git a/PROYECTO/mbsERP.4pw b/PROYECTO/mbsERP.4pw index d5de849..89e0308 100644 --- a/PROYECTO/mbsERP.4pw +++ b/PROYECTO/mbsERP.4pw @@ -551,7 +551,7 @@ - + @@ -716,6 +716,8 @@ + + @@ -951,8 +953,29 @@ + + + + + + + - + + + + + + + + + + + + + + + @@ -1043,10 +1066,9 @@ - + - diff --git a/PROYECTO/otrodir/fotos.4gl b/PROYECTO/otrodir/fotos.4gl new file mode 100644 index 0000000..3fc4bff --- /dev/null +++ b/PROYECTO/otrodir/fotos.4gl @@ -0,0 +1,514 @@ +{ + +============================================================== +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 + +FUNCTION cseccion(almacen) + DEFINE kcod_seccion,almacen SMALLINT, + kdescripcion CHAR(30), + pseccion ui.ComboBox + + LET pseccion = ui.combobox.forname("formonly.seccion") + + DECLARE busca_sec CURSOR FOR + SELECT a.cod_seccion,a.descripcion FROM Intb00010 a + WHERE a.cod_bodega = almacen + + CALL pseccion.clear() + FOREACH busca_sec INTO kcod_seccion,kdescripcion + CALL pseccion.additem(kcod_seccion,kdescripcion) + END FOREACH + CALL pseccion.additem(99,"TODAS") +END FUNCTION + +FUNCTION ctramo(almacen,seccion) + DEFINE kcod_tramo,almacen,seccion SMALLINT,kdescripcion CHAR(30), + ptramo ui.ComboBox + + LET ptramo = ui.combobox.forname("formonly.tramo") + + DECLARE busca_tramo CURSOR FOR + SELECT a.cod_tramo,a.descripcion FROM Intb00043 a + WHERE a.cod_bodega = almacen and a.cod_Seccion = seccion + + CALL ptramo.clear() + FOREACH busca_tramo INTO kcod_tramo,kdescripcion + DISPLAY "tramos ",kcod_tramo,kdescripcion," ",almacen," ",seccion + CALL ptramo.additem(kcod_tramo,kdescripcion) + END FOREACH + CALL ptramo.additem(99,"TODOS") +END FUNCTION