# Conflicts:
#	PROYECTO/cgdir/edprrp118b.4gl.bak-20261008
#	PROYECTO/irdir/desglose_conteo.4gl
#	PROYECTO/irdir/imprequisicion.4gl
#	PROYECTO/irdir/irautorizareq.4gl
#	PROYECTO/irdir/irbuscaprod.4gl
#	PROYECTO/irdir/irfmmt004.per
#	PROYECTO/irdir/irprcs006.4gl
#	PROYECTO/irdir/irprgb000.4gl
#	PROYECTO/irdir/irprmt002.4gl
#	PROYECTO/irdir/irprmt004.4gl
#	PROYECTO/irdir/irprmt006.4gl
#	PROYECTO/irdir/irprmt009.4gl
#	PROYECTO/irdir/irprmt020.4gl
#	PROYECTO/irdir/irprmt021.4gl
#	PROYECTO/irdir/irprmt036.4gl
#	PROYECTO/irdir/irprmt066.4gl
#	PROYECTO/irdir/irprrp002.4gl
#	PROYECTO/irdir/irprrp003.4gl
#	PROYECTO/irdir/irprrp005.4gl
#	PROYECTO/irdir/irprrp006.4gl
#	PROYECTO/irdir/irprrp009.4gl
#	PROYECTO/irdir/irprrp043.4gl
#	PROYECTO/irdir/irprrp045.4gl
#	PROYECTO/lqdir/lqprrp009.4gl.bak_20261012
#	PROYECTO/lqdir/lqprrp009.rdd.bak_20261012
#	PROYECTO/otrodir/apiclient.4gl.bak_20261014
#	PROYECTO/otrodir/cuentas.4gl
#	PROYECTO/otrodir/irdepartamento.4gl
#	PROYECTO/otrodir/maquinas.4gl
#	PROYECTO/otrodir/productos_incluye.4gl
#	PROYECTO/otrodir/secciones.4gl
#	PROYECTO/otrodir/tramos.4gl
#	WEBSERVICES/productosconteo.4gl.bak_20261012
This commit is contained in:
Luis
2026-10-19 10:17:14 -04:00
74 changed files with 2209 additions and 982 deletions
+38 -33
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ManagedForm fileVersion="31400" gstVersion="31408" name="ManagedForm" uid="{31f07807-66ff-4015-b438-54609b9d94d1}">
<ManagedForm fileVersion="31400" gstVersion="3140a" name="ManagedForm" uid="{31f07807-66ff-4015-b438-54609b9d94d1}">
<AGSettings>
<DynamicProperties version="2"/>
</AGSettings>
@@ -7,41 +7,46 @@
<RecordField colName="" fieldIdRef="1" name="ano" sqlTabName="" table_alias_name="" uid="{29b3c62f-3acc-4fe5-9519-691b62244513}"/>
<RecordField colName="" fieldIdRef="3" name="tasa" sqlTabName="" table_alias_name="" uid="{335a3faf-3971-46cf-8682-b2a0d26d0ce4}"/>
<RecordField colName="" fieldIdRef="4" name="ventas" sqlTabName="" table_alias_name="" uid="{0d44db9e-8bb3-4234-b3e1-a451631885b0}"/>
<RecordField colName="" fieldIdRef="5" name="tipo_cliente" sqlTabName="" table_alias_name="" uid="{cc62abbe-1941-48fd-8d4f-24abf68a16f5}"/>
<RecordField colName="" fieldIdRef="6" name="mes" sqlTabName="" table_alias_name="" uid="{5dd5469e-a72f-405c-8e6a-fcf39b9979ec}"/>
<RecordField colName="" defaultValue="1" fieldIdRef="6" name="mes" sqlTabName="" table_alias_name="" uid="{5dd5469e-a72f-405c-8e6a-fcf39b9979ec}"/>
<RecordField defaultValue="NO" fieldIdRef="5" length="2" name="replica" uid="{3c059da6-3a31-4a3c-862c-89bcdd2a39a9}"/>
</Record>
<Record name="record1" uid="{cabacd20-e0a8-493e-be77-0cba78915dc5}">
<RecordField fieldIdRef="2" name="edit1" uid="{bd6d1cf9-069e-4b14-a608-c0150c908861}"/>
<RecordField fieldIdRef="7" name="edit2" uid="{909aebc3-d3fe-4f9d-923d-2f68fd9cd476}"/>
<Record name="sclientes" uid="{18e4456d-6a83-49cb-89b4-6ddc390b0f50}">
<RecordField fieldIdRef="2" name="tipo_cliente1" uid="{a893fece-c46b-4a9a-b5c1-d9057eef321e}"/>
<RecordField fieldIdRef="7" name="tasa1" uid="{1cdfd2ef-c515-4ff7-8cb6-2d8b8b7ff397}"/>
</Record>
<Form gridHeight="25" gridWidth="97" name="Form" text="ADMINISTRACION TASA">
<Folder gridHeight="18" gridWidth="64" name="folder1" posX="2" posY="2">
<Page name="page1" text="page1">
<Grid gridHeight="12" gridWidth="60" name="grid2" posX="2" posY="3">
<Table gridHeight="6" gridWidth="19" name="table1" posX="6" posY="3" totalRows="5">
<Edit fieldId="2" gridHeight="1" gridWidth="8" name="edit1" posX="0" posY="0" tabIndex="-1" title="edit1" widget="Edit"/>
<Edit fieldId="7" gridHeight="1" gridWidth="8" name="edit2" posX="8" posY="0" tabIndex="-1" title="edit2" widget="Edit"/>
</Table>
</Grid>
</Page>
<Page name="page2" text="page2">
<Grid gridHeight="14" gridWidth="39" name="Grid1" posX="1" posY="1">
<Label gridHeight="1" gridWidth="26" name="Label6" posX="4" posY="1" text="ADMINISTRACION TASAS"/>
<Label gridHeight="1" gridWidth="10" name="Label1" posX="5" posY="3" text="Ano"/>
<Edit aggregateColName="" aggregateName="" aggregateTableAliasName="" aggregateTableName="" colName="" fieldId="1" gridHeight="1" gridWidth="10" name="ano" posX="17" posY="3" sqlTabName="" tabIndex="1" table_alias_name="" title="Edit1" widget="Edit"/>
<Label gridHeight="1" gridWidth="10" name="Label2" posX="5" posY="4" text="Mes"/>
<Edit aggregateColName="" aggregateName="" aggregateTableAliasName="" aggregateTableName="" colName="" fieldId="6" gridHeight="1" gridWidth="10" name="mes" posX="17" posY="4" sqlTabName="" tabIndex="5" table_alias_name="" title="Edit1" widget="Edit"/>
<Label gridHeight="1" gridWidth="10" name="Label3" posX="5" posY="5" text="Moneda"/>
<ComboBox aggregateColName="" aggregateName="" aggregateTableAliasName="" aggregateTableName="" colName="" comment="Digite 1- VENTAS LOCALIES" fieldId="4" gridHeight="1" gridWidth="18" items="" name="ventas" posX="17" posY="5" sqlTabName="" tabIndex="3" table_alias_name="" title="Edit1" widget="ComboBox"/>
<Label gridHeight="1" gridWidth="10" name="Label4" posX="5" posY="6" text="Tipo Cuenta"/>
<Edit aggregateColName="" aggregateName="" aggregateTableAliasName="" aggregateTableName="" colName="" fieldId="5" gridHeight="1" gridWidth="10" name="tipo_cliente" posX="17" posY="6" sqlTabName="" tabIndex="4" table_alias_name="" title="Edit1" widget="Edit"/>
<Label gridHeight="1" gridWidth="10" name="Label5" posX="5" posY="7" text="Tasa"/>
<Edit aggregateColName="" aggregateName="" aggregateTableAliasName="" aggregateTableName="" colName="" fieldId="3" gridHeight="1" gridWidth="10" name="tasa" posX="17" posY="7" sqlTabName="" tabIndex="2" table_alias_name="" title="Edit1" widget="Edit"/>
</Grid>
</Page>
</Folder>
<Form gridHeight="25" gridWidth="80" name="Form" text="ADMINISTRACION TASA">
<Grid gridHeight="18" gridWidth="39" name="Grid1" posX="8" posY="3">
<Label gridHeight="1" gridWidth="26" name="Label6" posX="4" posY="1" text="ADMINISTRACION TASAS"/>
<Label gridHeight="1" gridWidth="10" name="Label1" posX="5" posY="3" text="Ano"/>
<Edit aggregateColName="" aggregateName="" aggregateTableAliasName="" aggregateTableName="" colName="" fieldId="1" gridHeight="1" gridWidth="10" name="ano" posX="17" posY="3" sqlTabName="" tabIndex="1" table_alias_name="" title="Edit1" widget="Edit"/>
<Label gridHeight="1" gridWidth="10" name="Label2" posX="5" posY="4" text="Mes"/>
<ComboBox aggregateColName="" aggregateName="" aggregateTableAliasName="" aggregateTableName="" colName="" defaultValue="1" fieldId="6" gridHeight="1" gridWidth="18" items="ENERO, FEBRERO, MARZO, ABRIL, MAYO, JUNIO, JULIO, AGOSTO, SEPTIEMBRE, OCTUBRE, NOVIEMBRE, DICIEMBRE" name="mes" posX="17" posY="4" sqlTabName="" tabIndex="4" table_alias_name="" title="Edit1" widget="ComboBox">
<Item lstrtext="false" name="1" text="ENERO"/>
<Item lstrtext="false" name="2" text="FEBRERO"/>
<Item lstrtext="false" name="3" text="MARZO"/>
<Item lstrtext="false" name="4" text="ABRIL"/>
<Item lstrtext="false" name="5" text="MAYO"/>
<Item lstrtext="false" name="6" text="JUNIO"/>
<Item lstrtext="false" name="7" text="JULIO"/>
<Item lstrtext="false" name="8" text="AGOSTO"/>
<Item lstrtext="false" name="9" text="SEPTIEMBRE"/>
<Item lstrtext="false" name="10" text="OCTUBRE"/>
<Item lstrtext="false" name="11" text="NOVIEMBRE"/>
<Item lstrtext="false" name="12" text="DICIEMBRE"/>
</ComboBox>
<Label gridHeight="1" gridWidth="10" name="Label3" posX="5" posY="5" text="Moneda"/>
<ComboBox aggregateColName="" aggregateName="" aggregateTableAliasName="" aggregateTableName="" colName="" comment="Digite 1- VENTAS LOCALIES" fieldId="4" gridHeight="1" gridWidth="18" items="" name="ventas" posX="17" posY="5" sqlTabName="" tabIndex="3" table_alias_name="" title="Edit1" widget="ComboBox"/>
<Label gridHeight="1" gridWidth="10" name="Label5" posX="5" posY="6" text="Tasa"/>
<Edit aggregateColName="" aggregateName="" aggregateTableAliasName="" aggregateTableName="" colName="" fieldId="3" gridHeight="1" gridWidth="10" name="tasa" posX="17" posY="6" sqlTabName="" tabIndex="2" table_alias_name="" title="Edit1" widget="Edit"/>
<Label gridHeight="1" gridWidth="10" name="label4" posX="5" posY="7" text="Replicar"/>
<CheckBox defaultValue="NO" fieldId="5" gridHeight="1" gridWidth="9" include="SI|NO" length="2" name="replica" notNull="true" posX="17" posY="7" tabIndex="-1" title="checkbox1" valueChecked="SI" valueUnchecked="NO" widget="CheckBox"/>
<Table gridHeight="6" gridWidth="28" name="table1" posX="5" posY="8" totalRows="5">
<Edit fieldId="2" gridHeight="1" gridWidth="8" name="tipo_cliente1" posX="0" posY="0" tabIndex="-1" title="Tipo Cliente" widget="Edit"/>
<Edit fieldId="7" gridHeight="1" gridWidth="11" name="tasa1" posX="8" posY="0" tabIndex="-1" title="Tasa" widget="Edit"/>
</Table>
</Grid>
</Form>
<DiagramLayout>
<![CDATA[AAAAAgAAAEwAewBjAGEAYgBhAGMAZAAyADAALQBlADAAYQA4AC0ANAA5ADMAZQAtAGIAZQA3ADcALQAwAGMAYgBhADcAOAA5ADEANQBkAGMANQB9QCAAAAQAAABAIAAABAAAAAAAAAAAAAAAAQAAAEwAewAyADYANwBkAGQANwBiADcALQAzAGEAOQA1AC0ANAAwADIAMAAtAGEAYgAyAGEALQBhAGIAOAAyAGQAMgA0ADQANABlADkANwB9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ==]]>
<![CDATA[AAAAAgAAAEwAewAyADYANwBkAGQANwBiADcALQAzAGEAOQA1AC0ANAAwADIAMAAtAGEAYgAyAGEALQBhAGIAOAAyAGQAMgA0ADQANABlADkANwB9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAEwAewAxADgAZQA0ADQANQA2AGQALQA2AGEAOAAzAC0ANAA5AGMAYgAtADgAOQBiADQALQA2AGQAZABjADMAOQAwAGIAMABmADUAMAB9QCQAAAAAAABAJAAAAAAAAD9QYk3S8an8AQ==]]>
</DiagramLayout>
</ManagedForm>
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ManagedForm databaseName="sistemas" fileVersion="31400" gstVersion="31405" name="managedform" uid="{29ca7c1b-b292-45a4-9e5b-d22ba8587f8d}">
<ManagedForm databaseName="smarmotech" fileVersion="31400" gstVersion="31405" name="managedform" uid="{29ca7c1b-b292-45a4-9e5b-d22ba8587f8d}">
<AGSettings>
<DynamicProperties version="2"/>
</AGSettings>
+2 -2
View File
@@ -4,7 +4,7 @@
<Record additionalTables="" joinLeft="" joinOperator="" joinRight="" name="Undefined" order="" uid="{b4e41e18-a1ab-44ca-b0d2-21d63ec0b26b}" where="">
<RecordField colName="fecha_inicial" fieldIdRef="0" name="p_ano" sqlTabName="formonly" sqlType="CHAR" table_alias_name="" uid="{8833f641-6222-46a4-ba92-53eb1fdc87ba}"/>
<RecordField colName="fecha_final" defaultValue="01" fieldIdRef="1" name="p_mes" sqlTabName="formonly" sqlType="CHAR" table_alias_name="" uid="{a63991d6-4abf-4198-b711-b6a40886ffe1}"/>
<RecordField colName="" defaultValue="BALANCE GENERAL" fieldIdRef="2" name="estado" sqlTabName="" table_alias_name="" uid="{07465cbc-3322-43fb-ab48-4f22dde68501}"/>
<RecordField colName="" defaultValue="cgprrp012.4rp" fieldIdRef="2" name="estado" sqlTabName="" table_alias_name="" uid="{07465cbc-3322-43fb-ab48-4f22dde68501}"/>
<RecordField colName="" defaultValue="ACTIVOS" fieldIdRef="3" name="tipo_estado" sqlTabName="" table_alias_name="" uid="{1846db6d-746f-4998-9702-857110865eac}"/>
</Record>
<Form gridHeight="10" gridWidth="55" name="cgfmrp012">
@@ -27,7 +27,7 @@
<Item lstrtext="false" name="12" text="DICIEMBRE"/>
</ComboBox>
<Label gridHeight="1" gridWidth="10" name="Label1" posX="2" posY="3" text="Estado"/>
<ComboBox aggregateColName="" aggregateName="" aggregateTableAliasName="" aggregateTableName="" colName="" columnCount="" defaultValue="BALANCE GENERAL" fieldId="2" gridHeight="1" gridWidth="17" items="BALANCE GENERAL, INGRESOS Y EGRESOS" name="estado" posX="17" posY="3" rowCount="" sqlTabName="" stepX="" stepY="" tabIndex="3" table_alias_name="" title="ComboBox1" widget="ComboBox">
<ComboBox aggregateColName="" aggregateName="" aggregateTableAliasName="" aggregateTableName="" colName="" columnCount="" defaultValue="cgprrp012.4rp" fieldId="2" gridHeight="1" gridWidth="17" items="BALANCE GENERAL, INGRESOS Y EGRESOS" name="estado" posX="17" posY="3" rowCount="" sqlTabName="" stepX="" stepY="" tabIndex="3" table_alias_name="" title="ComboBox1" widget="ComboBox">
<Item lstrtext="false" name="cgprrp012.4rp" text="BALANCE GENERAL"/>
<Item lstrtext="false" name="cgprrp013.4rp" text="INGRESOS Y EGRESOS"/>
</ComboBox>
+1 -1
View File
@@ -7,7 +7,7 @@ FECHA REALIZADO : Septiembre 28, 1993.
MODULO UTILIZA : cgprmt001
--------------------------------------------------------------------------
}
database marmotech
database smarmotech
screen
{
Consulta departamentos
+1 -1
View File
@@ -126,7 +126,7 @@ FUNCTION cgprcs024()
FROM cgtb00004 a
WHERE (a.ref =a.ref AND a.tipo<>3) AND
(a.cuenta_no = gastos[idx].cuenta_no) AND
(a.fecha BETWEEN fecha_ini_act AND fecha.desde ) AND
(a.fecha >= fecha_ini_act AND a.fecha < fecha.desde) AND -- antes BETWEEN ... AND desde: el dia 'desde' se sumaba tambien en el rango (doble)
(a.departamento = cdepartamentos) AND
a.status_t is NULL
--227-1322-2108
+63 -84
View File
@@ -76,7 +76,7 @@ MAIN
CALL ARG_VAL(3) RETURNING impresor
# LET usuarios = "jsoto"
# LET clave = "1234"
CONNECT TO "marmotech" AS "IFMX" USER usuarios USING clave
# CONNECT TO "marmotech" AS "IFMX" USER usuarios USING clave -- G6: -6366; EXTERIOR se lee cross-DB (exterior.dbo.*)
CONNECT TO "smarmotech" AS "MSSQL" USER usuarios USING clave
SELECT a.* INTO p_compania.* FROM companias a
@@ -126,6 +126,7 @@ FUNCTION cgpcad004()
fecha1, fecha2 DATE,
pdescripcion CHAR(30)
DEFINE l_sql STRING, l_cnt INTEGER -- G6: SQL dinamico cross-DB a EXTERIOR
LET hoy = TODAY
LABEL vuelve:
@@ -199,17 +200,18 @@ FUNCTION cgpcad004()
CALL transac.clear()
END IF
IF cheques = "ED" THEN
SET CONNECTION "IFMX"
-- G6: antes SET CONNECTION "IFMX" (EXTERIOR); ahora cross-DB sobre la conexion unica
INPUT BY NAME xentrada
AFTER FIELD xentrada
IF xentrada IS NULL THEN
CALL msg(16)
NEXT FIELD xentrada
END IF
SELECT DISTINCT a.ref
FROM cgtb00004 a
WHERE a.ref = xentrada AND a.status_t IS NULL
IF STATUS = NOTFOUND THEN
LET l_sql = "SELECT COUNT(*) FROM exterior.dbo.cgtb00004 a",
" WHERE a.ref = ? AND a.status_t IS NULL"
PREPARE p_ex_ed FROM l_sql
EXECUTE p_ex_ed USING xentrada INTO l_cnt
IF l_cnt = 0 OR l_cnt IS NULL THEN
CALL msg(3)
NEXT FIELD xentrada
END IF
@@ -219,19 +221,14 @@ FUNCTION cgpcad004()
LET INT_FLAG = FALSE
EXIT INPUT
ELSE
DECLARE busca_entrada1 CURSOR FOR
SELECT A.CUENTA_NO,
c.DEPARTAMENTO,
SUM(c.DEBITO),
SUM(c.CREDITO)
FROM cgtb00001 a, cgtb00004 c
WHERE a.cuenta_no = c.cuenta_no
AND c.status_t IS NULL
AND c.ref = xentrada
GROUP BY A.CUENTA_NO, c.DEPARTAMENTO
LET l_sql = "SELECT a.cuenta_no, c.departamento, SUM(c.debito), SUM(c.credito)",
" FROM exterior.dbo.cgtb00001 a, exterior.dbo.cgtb00004 c",
" WHERE a.cuenta_no = c.cuenta_no AND c.status_t IS NULL AND c.ref = ?",
" GROUP BY a.cuenta_no, c.departamento"
DECLARE busca_entrada1 CURSOR FROM l_sql
LET idx = 1
FOREACH busca_entrada1
FOREACH busca_entrada1 USING xentrada
INTO transac[idx].cuenta,
transac[idx].departamento,
transac[idx].debito,
@@ -244,15 +241,16 @@ FUNCTION cgpcad004()
END IF
IF cheques = "CK" THEN
SET CONNECTION "IFMX"
-- G6: antes SET CONNECTION "IFMX" (EXTERIOR); ahora cross-DB sobre la conexion unica
INPUT BY NAME fecha1, fecha2, pcuenta_no
AFTER FIELD pcuenta_no
SELECT a.descripcion
INTO pdescripcion
FROM cgtb00001 a
WHERE a.cuenta_no = pcuenta_no AND a.status_t IS NULL
LET l_sql = "SELECT a.descripcion FROM exterior.dbo.cgtb00001 a",
" WHERE a.cuenta_no = ? AND a.status_t IS NULL"
PREPARE p_ex_ck FROM l_sql
LET pdescripcion = NULL
EXECUTE p_ex_ck USING pcuenta_no INTO pdescripcion
IF STATUS = NOTFOUND THEN
IF pdescripcion IS NULL THEN
CALL msg(3)
NEXT FIELD pcuenta_no
END IF
@@ -262,18 +260,15 @@ FUNCTION cgpcad004()
EXIT INPUT
END INPUT
DECLARE busca_cheques CURSOR FOR
SELECT A.CUENTA_NO, c.DEPARTAMENTO, SUM(c.DEBITO), SUM(c.CREDITO)
FROM cgtb00001 a, cgtb00004 c
WHERE a.cuenta_no = c.cuenta_no
AND c.status_t IS NULL
AND c.fecha BETWEEN fecha1 AND fecha2
AND detalles = pcuenta_no
GROUP BY A.CUENTA_NO, c.DEPARTAMENTO
ORDER BY a.cuenta_no
LET l_sql = "SELECT a.cuenta_no, c.departamento, SUM(c.debito), SUM(c.credito)",
" FROM exterior.dbo.cgtb00001 a, exterior.dbo.cgtb00004 c",
" WHERE a.cuenta_no = c.cuenta_no AND c.status_t IS NULL",
" AND c.fecha BETWEEN ? AND ? AND c.detalles = ?",
" GROUP BY a.cuenta_no, c.departamento ORDER BY a.cuenta_no"
DECLARE busca_cheques CURSOR FROM l_sql
LET idx = 1
FOREACH busca_cheques
FOREACH busca_cheques USING fecha1, fecha2, pcuenta_no
INTO transac[idx].cuenta,
transac[idx].departamento,
transac[idx].debito,
@@ -283,7 +278,7 @@ FUNCTION cgpcad004()
END IF
IF cheques = "CP" THEN
SET CONNECTION "IFMX"
-- G6: antes SET CONNECTION "IFMX" (EXTERIOR); ahora cross-DB sobre la conexion unica
INPUT BY NAME pcod_sp, fecha1, fecha2
AFTER FIELD pcod_sp
IF pcod_sp IS NULL THEN
@@ -291,12 +286,10 @@ FUNCTION cgpcad004()
NEXT FIELD pcod_sp
END IF
AFTER FIELD fecha2
SELECT COUNT(*)
INTO registros
FROM cptb00003 a
WHERE a.fecha BETWEEN fecha1 AND fecha2
AND a.cod_sp = pcod_sp
AND a.status_t IS NULL
LET l_sql = "SELECT COUNT(*) FROM exterior.dbo.cptb00003 a",
" WHERE a.fecha BETWEEN ? AND ? AND a.cod_sp = ? AND a.status_t IS NULL"
PREPARE p_ex_cxp FROM l_sql
EXECUTE p_ex_cxp USING fecha1, fecha2, pcod_sp INTO registros
IF registros < 0 OR registros IS NULL THEN
CALL msg(3)
@@ -306,27 +299,15 @@ FUNCTION cgpcad004()
EXIT INPUT
END INPUT
DECLARE busca_cxp CURSOR FOR
SELECT A.CUENTA_NO,
a.DEPARTAMENTO,
a.cod_aux,
a.cod_sec,
a.num_doc,
SUM(a.DEBITO),
SUM(a.CREDITO)
FROM cptb00003 a
WHERE a.status_t IS NULL
AND a.cod_sp = pcod_sp
AND a.fecha BETWEEN fecha1 AND fecha2
GROUP BY A.CUENTA_NO,
a.DEPARTAMENTO,
a.cod_aux,
a.cod_Sec,
a.num_doc
ORDER BY a.num_doc DESC, 6 DESC, 2
LET l_sql = "SELECT a.cuenta_no, a.departamento, a.cod_aux, a.cod_sec, a.num_doc,",
" SUM(a.debito), SUM(a.credito) FROM exterior.dbo.cptb00003 a",
" WHERE a.status_t IS NULL AND a.cod_sp = ? AND a.fecha BETWEEN ? AND ?",
" GROUP BY a.cuenta_no, a.departamento, a.cod_aux, a.cod_sec, a.num_doc",
" ORDER BY a.num_doc DESC, 6 DESC, 2"
DECLARE busca_cxp CURSOR FROM l_sql
LET idx = 1
FOREACH busca_cxp
FOREACH busca_cxp USING pcod_sp, fecha1, fecha2
INTO transac[idx].cuenta,
transac[idx].departamento,
transac[idx].cod_aux,
@@ -711,18 +692,22 @@ FUNCTION cgpcad004()
END IF
LET r_filename = "cgprmt004.4rp"
LET r_output = "SVG"
-- G6: el visor SVG (GRV) solo existe en GDC; en el navegador (GBC) se cuelga -> PDF
LET r_output = getPreviewDevice()
#LET preview = 1
-- configure report engine; the functions prefixed fgl that are called here are part of the GRW API
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
CALL fgl_report_selectDevice(r_output) -- changing default
IF preview = 0 THEN
IF r_output <> "SVG" THEN
CALL fgl_report_selectPreview(1)
ELSE IF preview = 0 THEN
CALL fgl_report_selectPreview(1) -- changing default
CALL fgl_report_configureSVGPreview("PrintOnDefaultPrinter")
ELSE
CALL fgl_report_selectPreview(preview)
END IF
END IF
LET handler = fgl_report_commitCurrentSettings() -- commit changes
ELSE
@@ -896,11 +881,12 @@ FUNCTION cgpcmf004()
END IF
LET selec =
"SELECT DISTINCT CONVERT(char(10),a.fecha,103),a.ref,a.tipo,a.detalle_1,a.detalle_2 ",
-- G6: sin CONVERT(char(10),fecha,103): el texto dd/mm/aaaa no entra en un DATE (-1205)
"SELECT DISTINCT a.fecha,a.ref,a.tipo,a.detalle_1,a.detalle_2 ",
"FROM cgtb00004 a ",
"WHERE ",
criterio CLIPPED,
" AND a.tipo IN(1,3) ORDER BY CONVERT(char(10),a.fecha,103),a.ref"
" AND a.tipo IN(1,3) ORDER BY a.fecha,a.ref"
DISPLAY "seleccion: ", selec
PREPARE busca FROM selec
DECLARE datos SCROLL CURSOR FOR busca
@@ -1684,21 +1670,21 @@ FUNCTION cheques1()
debito DEC(12, 2),
credito DEC(12, 2)
END RECORD
DEFINE l_sql STRING -- G6: SQL dinamico cross-DB a EXTERIOR
OPEN WINDOW cgfmwd011
AT 15, 10
WITH FORM "cgfmwd011"
ATTRIBUTE(BORDER, FORM LINE FIRST + 1, COMMENT LINE LAST)
SET CONNECTION "IFMX"
-- G6: antes SET CONNECTION "IFMX" (EXTERIOR); ahora cross-DB sobre la conexion unica
INPUT BY NAME kfecha1, kfecha2, kcuenta_no
AFTER FIELD kcuenta_no
IF kcuenta_no IS NOT NULL THEN
SELECT a.descripcion
INTO kdescripcion
FROM cgtb00001 a
WHERE a.cuenta_no = kcuenta_no
IF STATUS = NOTFOUND THEN
LET l_sql = "SELECT a.descripcion FROM exterior.dbo.cgtb00001 a WHERE a.cuenta_no = ?"
PREPARE p_ex_cta FROM l_sql
LET kdescripcion = NULL
EXECUTE p_ex_cta USING kcuenta_no INTO kdescripcion
IF kdescripcion IS NULL THEN
CALL msg(3)
NEXT FIELD kcuenta_no
END IF
@@ -1715,22 +1701,15 @@ FUNCTION cheques1()
END IF
END INPUT
DECLARE busca_ex CURSOR FOR
SELECT A.CUENTA_NO,
A.DESCRIPCION,
c.DEPARTAMENTO,
SUM(c.DEBITO),
SUM(c.CREDITO)
FROM cgtb00001 a, cgtb00004 c
WHERE a.cuenta_no = c.cuenta_no
AND c.status_t IS NULL
AND c.fecha BETWEEN kfecha1 AND kfecha2
AND detalles = kcuenta_no
GROUP BY A.CUENTA_NO, A.DESCRIPCION, c.DEPARTAMENTO
ORDER BY a.cuenta_no
LET l_sql = "SELECT a.cuenta_no, a.descripcion, c.departamento, SUM(c.debito), SUM(c.credito)",
" FROM exterior.dbo.cgtb00001 a, exterior.dbo.cgtb00004 c",
" WHERE a.cuenta_no = c.cuenta_no AND c.status_t IS NULL",
" AND c.fecha BETWEEN ? AND ? AND c.detalles = ?",
" GROUP BY a.cuenta_no, a.descripcion, c.departamento ORDER BY a.cuenta_no"
DECLARE busca_ex CURSOR FROM l_sql
LET idx = 1
FOREACH busca_ex INTO kdetalle[idx].*
FOREACH busca_ex USING kfecha1, kfecha2, kcuenta_no INTO kdetalle[idx].*
LET transac[idx].cuenta = kdetalle[idx].cuenta_no
LET transac[idx].departamento = kdetalle[idx].departamento
LET transac[idx].debito = kdetalle[idx].debito
+1
View File
@@ -52,6 +52,7 @@ FUNCTION cgprmt005()
END FUNCTION
FUNCTION cgprad005()
DEFINE referencia LIKE cgtb00004.ref -- G6: no estaba declarada (-8446)
LET hoy = TODAY
LABEL volver1:
INITIALIZE recibo.* TO NULL
+129 -37
View File
@@ -8,13 +8,18 @@
}
GLOBALS
"cgprgb000.4gl"
DEFINE pano,pmes,pventas INT,
ptasa DEC(8,2),
preplica VARCHAR(2)
MAIN
DEFER INTERRUPT
CALL STARTLOG("CGPRMT021.TXT")
CALL ARG_VAL(1) RETURNING usuarios
CALL ARG_VAL(2) RETURNING clave
-- G6: "marmotech" no existe en el fglprofile (-6366); el binario de produccion (E:\MARMOTECH\BIN320 = EXTERIOR) conecta a smarmotech
CONNECT to "smarmotech" AS "MSSQL" USER usuarios USING clave
CALL cgprmt022()
END MAIN
@@ -24,50 +29,103 @@ FUNCTION cgprmt022()
ano SMALLINT,
mes SMALLINT,
ventas SMALLINT,
tipo_cliente SMALLINT,
tasa DEC(8,2)
END RECORD
END RECORD,
actualiza,selec,inserta STRING,
i INT,
clientes DYNAMIC ARRAY OF RECORD
tipo_cliente1 INT,
tasa1 DEC(12,2)
END RECORD,
replica VARCHAR(2)
OPEN WINDOW w1 WITH FORM "cgfmmt022"
INPUT BY NAME mtasa.*
DIALOG ATTRIBUTE(UNBUFFERED)
INPUT BY NAME mtasa.*,replica
BEFORE INPUT
CALL cventas()
LET mtasa.ano = YEAR(TODAY)
LET mtasa.mes = MONTH(TODAY)-1
DISPLAY BY NAME mtasa.ano,mtasa.mes
LET selec = "SELECT DISTINCT a.ano FROM marmotech.dbo.cgtb00084 a WHERE a.ano = ? AND a.mes = ? AND a.ventas = ? AND a.tipo_cliente = ?"
PREPARE selecciona FROM selec
AFTER INPUT
IF INT_FLAG THEN
CALL msg(16)
LET INT_FLAG = FALSE
EXIT INPUT
END IF
SELECT DISTINCT a.tipo_cliente FROM vetb00061 a WHERE a.tipo_cliente = mtasa.tipo_cliente AND
a.ventas = mtasa.ventas
IF STATUS = NOTFOUND THEN
CALL fgl_winmessage("INFO","COMBINACION TIPO CLIENTE Y MONEDA ESTAN ERRADOS","INFO")
NEXT FIELD ventas
END IF
SELECT DISTINCT a.ano,a.mes,a.ventas,a.tipo_cliente,a.tasa
INTO mtasa.ano,mtasa.mes,mtasa.ventas,mtasa.tipo_cliente
FROM cgtb00084 a WHERE a.ano = mtasa.ano AND a.mes = mtasa.mes AND
a.ventas = mtasa.ventas AND a.tipo_cliente = mtasa.tipo_cliente
IF STATUS <> NOTFOUND THEN
DISPLAY BY NAME mtasa.*
UPDATE cgtb00084 SET cgtb00084.tasa = mtasa.tasa,
us_mod = usuarios,
fech_mod = getdate()
WHERE cgtb00084.ano = mtasa.ano AND cgtb00084.mes = mtasa.mes AND
cgtb00084.ventas = mtasa.ventas AND
cgtb00084.tipo_cliente = mtasa.tipo_cliente
ELSE
INSERT INTO cgtb00084 (ano,mes,ventas,tipo_cliente,tasa,us_crea,fech_crea) VALUES
(mtasa.ano,mtasa.mes,mtasa.ventas,mtasa.tipo_cliente,mtasa.tasa,usuarios,getdate())
END IF
CALL msg(13)
EXIT INPUT
END INPUT
LET actualiza = "UPDATE marmotech.dbo.cgtb00084 set tasa = ? WHERE ano = ? and mes = ? and ventas =? and tipo_cliente = ?"
PREPARE actual FROM actualiza
LET inserta = "INSERT INTO marmotech.dbo.cgtb00084 (ano,mes,tipo_cliente,ventas,tasa) values ",
" (?,?,?,?,?)"
PREPARE adicionar FROM inserta
ON CHANGE tasa
DECLARE busca_tipos CURSOR for
-- En marmotech vetb00060 = tipo_cliente x moneda (en EXTERIOR es al reves: vetb00061)
SELECT DISTINCT a.tipo_cliente FROM vetb00060 a WHERE a.ventas = mtasa.ventas AND a.tipo_cliente > 14
LET i =1
FOREACH busca_tipos INTO clientes[i].*
LET clientes[i].tasa1=mtasa.tasa
LET i = i + 1
END FOREACH
IF i=1 THEN
CALL fgl_winmessage("INFO","COMBINACION TIPO CLIENTE Y MONEDA ESTAN ERRADOS","INFO")
NEXT FIELD ventas
END IF
END INPUT
DISPLAY ARRAY clientes TO sclientes.*
ON ACTION actualizar ATTRIBUTE(TEXT="Actualiza")
IF fgl_winquestion("Actualiza","Estas seguro de Actualizar la tasa?","No","Yes|No","question",0) = "Yes" THEN
FOR i = 1 TO clientes.getLength()
IF clientes[i].tipo_cliente1 IS NOT NULL THEN
IF clientes[i].tasa1 IS NULL THEN
CALL msg(16)
NEXT FIELD tasa
END IF
SELECT DISTINCT a.ano,a.mes,a.ventas,a.tipo_cliente
INTO mtasa.ano,mtasa.mes,mtasa.ventas,clientes[i].tipo_cliente1
FROM cgtb00084 a WHERE a.ano = mtasa.ano AND a.mes = mtasa.mes AND
a.ventas = mtasa.ventas AND a.tipo_cliente = clientes[i].tipo_cliente1
IF STATUS <> NOTFOUND THEN
DISPLAY BY NAME mtasa.*
UPDATE cgtb00084 SET cgtb00084.tasa = mtasa.tasa,
us_mod = usuarios,
fech_mod = getdate()
WHERE cgtb00084.ano = mtasa.ano AND cgtb00084.mes = mtasa.mes AND
cgtb00084.ventas = mtasa.ventas AND
cgtb00084.tipo_cliente = clientes[i].tipo_cliente1
ELSE
INSERT INTO cgtb00084 (ano,mes,ventas,tipo_cliente,tasa,us_crea,fech_crea) VALUES
(mtasa.ano,mtasa.mes,mtasa.ventas,clientes[i].tipo_cliente1,mtasa.tasa,usuarios,getdate())
END IF
-- (la version EXTERIOR repetia aqui el INSERT/UPDATE en marmotech.dbo.cgtb00084;
-- conectado a marmotech es la misma tabla: se quito la doble escritura)
END IF
END FOR
LET pano = mtasa.ano
LET pmes = mtasa.mes
LET pventas = mtasa.ventas
LET ptasa = mtasa.tasa
LET preplica = replica
IF replica = "SI" THEN
CALL replicar()
END IF
CALL insertalog()
CALL fgl_winmessage("INFO","ACTUALIZACION EXITOSA","INFO")
END IF
END DISPLAY
ON ACTION CANCEL
CALL fgl_winmessage("INFO","OPERACION CANCELADA","INFO")
RETURN
END DIALOG
CLOSE WINDOW w1
END FUNCTION
@@ -79,7 +137,7 @@ FUNCTION cventas()
LET pventas = ui.combobox.forname("formonly.ventas")
DECLARE bventas CURSOR FOR
SELECT a.ventas,a.descripcion FROM vetb00061 a
SELECT a.ventas,a.descripcion FROM vetb00061 a -- monedas en marmotech
CALL pventas.clear()
FOREACH bventas INTO kventas,dventas
@@ -87,3 +145,37 @@ FUNCTION cventas()
END FOREACH
END FUNCTION
FUNCTION replicar()
DEFINE replica,selecta,actualizacion STRING,
mes_falta,k,mesinsert INT
LET actualizacion = "UPDATE marmotech.dbo.cgtb00084 set tasa = ? WHERE ano = ? AND mes = ? AND ventas = ?"
PREPARE actualizacionxe FROM actualizacion
LET selecta = "SELECT DISTINCT a.ano FROM marmotech.dbo.cgtb00084 a WHERE a.ano = ? AND a.mes = ? AND a.ventas = ?"
PREPARE selecciona FROM selecta
LET replica = "INSERT INTO marmotech.dbo.cgtb00084 (ano,mes,ventas,tipo_cliente,tasa)
SELECT a.ano,?,a.ventas,a.tipo_cliente,a.tasa FROM cgtb00084 a WHERE a.ano = ? AND a.mes = ? AND a.ventas = ? "
PREPARE duplica FROM replica
LET mes_falta = 12 - pmes
LET mesinsert = pmes + 1
FOR k = 1 TO mes_falta
EXECUTE selecciona USING pano,mesinsert,pventas
IF STATUS = NOTFOUND THEN
EXECUTE duplica USING mesinsert,pano,pmes,pventas
ELSE
EXECUTE actualizacionxe USING ptasa,pano,mesinsert,pventas
END IF
LET mesinsert = mesinsert + 1
END FOR
END FUNCTION
FUNCTION insertaLog()
INSERT INTO cgtb00084_log VALUES (getdate(),usuarios,preplica)
END FUNCTION
+3 -3
View File
@@ -471,7 +471,7 @@ DISPLAY solicitud.cuenta_no1
ELSE
COMMIT WORK
LET r_filename ="cgprmt037.4rp"
LET r_output = "SVG"
LET r_output = getPreviewDevice() -- G6: SVG (GRV) solo en GDC; en web cuelga -> PDF
#LET preview = 1
-- configure report engine; the functions prefixed fgl that are called here are part of the GRW API
@@ -880,7 +880,7 @@ DIALOG ATTRIBUTES (UNBUFFERED,FIELD ORDER FORM )
ON ACTION imprimir
LET r_filename ="cgprmt037.4rp"
LET r_output = "SVG"
LET r_output = getPreviewDevice() -- G6: SVG (GRV) solo en GDC; en web cuelga -> PDF
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
CALL fgl_report_selectDevice(r_output) -- changing default
CALL fgl_report_selectPreview(true)
@@ -940,7 +940,7 @@ DIALOG ATTRIBUTES (UNBUFFERED,FIELD ORDER FORM )
ELSE
COMMIT WORK
LET r_filename ="cgprmt037.4rp"
LET r_output = "SVG"
LET r_output = getPreviewDevice() -- G6: SVG (GRV) solo en GDC; en web cuelga -> PDF
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
CALL fgl_report_selectDevice(r_output) -- changing default
CALL fgl_report_selectPreview(true)
+27 -12
View File
@@ -48,6 +48,7 @@ GLOBALS
clave CHAR(16)
END RECORD
DEFINE fecha_inicial,fecha_final DATE
DEFINE regenera SMALLINT -- TRUE = corrida sin filtro: actualiza cgtb00016
MAIN
DEFER INTERRUPT
CALL ARG_VAL(1) RETURNING usuarios
@@ -112,9 +113,15 @@ FUNCTION cgprrp008()
END IF
EXIT CONSTRUCT
END CONSTRUCT
-- cgtb00016 (base de cgprrp012/013) solo se regenera cuando se corre el mes
-- COMPLETO; con filtro de cuenta se borraba el mes y se reinsertaban solo
-- las cuentas filtradas (balance incompleto).
LET regenera = (criterio.trim() = "1=1")
IF regenera THEN
DELETE FROM cgtb00016 WHERE ano = p_ano AND mes=p_mes AND programa='cgprrp012.4rp'
DELETE FROM cgtb00016 WHERE ano = p_ano AND mes=p_mes AND programa='cgprrp013.4rp' AND
estado_m='390'
END IF
LET p = 1
LET selec =
@@ -132,7 +139,7 @@ DISPLAY "cuenta ",cuenta_reg
LET selec =
"SELECT b.cuenta_no,b.descripcion,b.estado_a,b.estado_m, ",
" ISNULL(SUM(a.debito),0),ISNULL(SUM(a.credito),0),b.nivel,b.analitico,b.aplica_a ",
"FROM cgtb00001 b LEFT OUTER JOIN cgtb00004_tmp a ON (a.cuenta_no = b.cuenta_no) AND (a.fecha BETWEEN ? AND ?) ",
"FROM cgtb00001 b LEFT OUTER JOIN cgtb00004 a ON (a.cuenta_no = b.cuenta_no) AND (a.fecha BETWEEN ? AND ?) ",
" AND (a.status_t IS NULL) ",
"WHERE (a.status_t IS NULL) AND ",
@@ -290,7 +297,7 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
# Balance Anterior
LET x.cuenta_no = x.cuenta_no clipped
SELECT sum(debito-credito) INTO balan_ant FROM cgtb00004_tmp
SELECT sum(debito-credito) INTO balan_ant FROM cgtb00004
WHERE (fecha < fecha1) and (cuenta_no[1] = x.cuenta_no) and
status_t is null
@@ -300,7 +307,7 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
# Actividades del mes
SELECT SUM(a.debito),SUM(a.credito) INTO x.debito,x.credito
FROM cgtb00004_tmp a
FROM cgtb00004 a
WHERE (a.cuenta_no[1] = x.cuenta_no) and a.status_t IS NULL AND
(a.fecha between fecha1 and fecha2)
@@ -316,7 +323,7 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
# Para Las Sub-control
IF x.nivel > 1 THEN
LET x.cuenta_no = x.cuenta_no clipped
SELECT SUM(a.debito-a.credito) INTO balan_ant FROM cgtb00004_tmp a
SELECT SUM(a.debito-a.credito) INTO balan_ant FROM cgtb00004 a
WHERE (a.cuenta_no[1,2] = x.cuenta_no) and a.status_t IS NULL AND
(a.fecha < fecha1 )
IF balan_ant is null THEN
@@ -325,14 +332,14 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
# Actividades del mes
SELECT SUM(a.debito),SUM(a.credito) INTO x.debito,x.credito
FROM cgtb00004_tmp a
FROM cgtb00004 a
WHERE (a.cuenta_no[1,2] = x.cuenta_no) and a.status_t IS NULL AND
(a.fecha between fecha1 and fecha2)
# Otras cuentas sub-controles (Balance Anterior)
IF x.cuenta_no[3] != " " THEN
SELECT SUM(a.debito-a.credito) INTO balan_ant FROM cgtb00004_tmp a
SELECT SUM(a.debito-a.credito) INTO balan_ant FROM cgtb00004 a
WHERE (a.cuenta_no[1,3] = x.cuenta_no) and a.status_t IS NULL AND
(a.fecha < fecha1 )
IF balan_ant is null THEN
@@ -340,13 +347,13 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
END IF
# Actividades del mes
SELECT SUM(a.debito),SUM(a.credito) INTO x.debito,x.credito
FROM cgtb00004_tmp a
FROM cgtb00004 a
WHERE (a.cuenta_no[1,3] = x.cuenta_no) and a.status_t IS NULL AND
(a.fecha between fecha1 and fecha2)
END IF
# Otras cuentas sub-controles (Actividades del mes)
IF x.cuenta_no[4] != " " THEN
SELECT SUM(a.debito-a.credito) INTO balan_ant FROM cgtb00004_tmp a
SELECT SUM(a.debito-a.credito) INTO balan_ant FROM cgtb00004 a
WHERE (a.cuenta_no[1,4] = x.cuenta_no) and a.status_t IS NULL AND
(a.fecha < fecha1 )
IF balan_ant is null THEN
@@ -354,7 +361,7 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
END IF
SELECT SUM(a.debito),SUM(a.credito) INTO x.debito,x.credito
FROM cgtb00004_tmp a
FROM cgtb00004 a
WHERE (a.cuenta_no[1,4] = x.cuenta_no) and a.status_t IS NULL AND
(a.fecha between fecha1 and fecha2)
END IF
@@ -382,11 +389,13 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
#END IF
LET balan_act = balan_ant + actividad
IF regenera THEN
INSERT INTO cgtb00016(ano,mes,cuenta_no,estado_a,estado_m,balance_ant,actividad,balance_act,programa,descripcion,
primern,debito,credito)
VALUES (p_ano,p_mes,x.cuenta_no,x.estado_a,x.estado_m,
balan_ant,actividad,balan_act,'cgprrp012.4rp',x.descripcion,x.nivel,
x.debito,x.credito)
END IF
IF valor_88_act is null THEN
LET valor_88_act = 0
@@ -408,7 +417,7 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
IF x.nivel > 2 THEN
# Balance Inicial
SELECT SUM(b.debito - b.credito) INTO balance FROM cgtb00004_tmp b
SELECT SUM(b.debito - b.credito) INTO balance FROM cgtb00004 b
WHERE (b.cuenta_no=x.cuenta_no) AND b.status_t IS NULL AND (b.fecha < fecha1)
IF balance IS NULL THEN
@@ -435,11 +444,13 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
COLUMN 112, balance + actividad USING "((,(((,(((,(((.##)"
# END IF
LET balan_act = balance + actividad
IF regenera THEN
INSERT INTO cgtb00016 (ano,mes,cuenta_no,estado_a,estado_m,balance_ant,actividad,balance_act,programa,
descripcion,primern,debito,credito)
VALUES (p_ano,p_mes,x.cuenta_no,x.estado_a,x.estado_m,
balance,actividad,balan_act,'cgprrp012.4rp',x.descripcion,x.nivel,
x.debito,x.credito)
END IF
END IF
# Busca las cuentas que tienen que ver con el beneficio neto
@@ -482,7 +493,7 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
FOREACH busca INTO x.cuenta_no,x.descripcion,x.estado_a,x.estado_m
LET x.cuenta_no = x.cuenta_no clipped
SELECT sum(a.debito-a.credito) INTO balan_ant FROM cgtb00004_tmp a
SELECT sum(a.debito-a.credito) INTO balan_ant FROM cgtb00004 a
WHERE (a.cuenta_no[1] = x.cuenta_no) and (a.fecha < fecha1) and
a.status_t is null
@@ -492,7 +503,7 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
# Actividades del mes
SELECT SUM(a.debito),SUM(a.credito) INTO x.debito,x.credito
FROM cgtb00004_tmp a
FROM cgtb00004 a
WHERE (a.cuenta_no[1] = x.cuenta_no) and a.status_t IS NULL AND
(a.fecha between fecha1 and fecha2)
@@ -557,8 +568,10 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
PRINT COLUMN 1, "---------------------------------------------------",
"---------------------------------------------------",
"-------------------------------"
IF regenera THEN
INSERT INTO cgtb00016 (ano,mes,estado_a,balance_ant,actividad,balance_act,programa,debito,credito)
VALUES (p_ano,p_mes,'275',t_balan_ant,t_actividad,t_balan_act,'cgprrp012.4rp',t_debito,t_credito)
END IF
SKIP TO TOP OF PAGE
LET t_debito = 0
@@ -610,8 +623,10 @@ REPORT mayor_anal_gral(x,fecha1,fecha2)
END IF
IF regenera THEN
INSERT INTO cgtb00016 (ano,mes,estado_m,balance_ant,actividad,balance_act,programa,debito,credito)
VALUES (p_ano,p_mes,'390',t_balan_ant,t_actividad,t_balan_act,'cgprrp013.4rp',t_debito,t_credito)
END IF
PRINT COLUMN 1, "---------------------------------------------------",
+11 -12
View File
@@ -127,20 +127,21 @@ END MAIN
# (7) y tienen el departamento nulo.
# Este UPDATE se reversa al momento de acabar el reporte
UPDATE cgtb00004 set departamento = 0
WHERE departamento is null and cuenta_no[1] = "7"
-- G6: antes UPDATE cgtb00004 SET departamento = 0 (y al final lo revertia a NULL): modificaba
-- el mayor real, no se revertia si no habia datos y convertia en NULL los 0 legitimos.
-- Ahora el departamento nulo se trata como 0 en las consultas (ISNULL/NVL).
DELETE FROM cgtb00016 WHERE ano =p_ano AND mes = p_mes AND programa='cgprrp013.4rp' AND
estado_a <> '275'
LET selec =
"SELECT distinct a.cuenta_no,b.descripcion,d.dpto,a.departamento,c.nom_dpto ",
"SELECT distinct a.cuenta_no,b.descripcion,d.dpto,ISNULL(a.departamento,0),c.nom_dpto ",
"FROM cgtb00001 b, cgtb00004 a, chequeo d,adtb00001 c ",
"WHERE (a.cuenta_no = b.cuenta_no) AND (SUBSTRING(b.cuenta_no,1,1) = '7') AND ",
" (a.departamento = d.departamento) AND a.status_t IS NULL AND ",
" (a.departamento = c.departamento) AND ",
" (ISNULL(a.departamento,0) = d.departamento) AND a.status_t IS NULL AND ",
" (ISNULL(a.departamento,0) = c.departamento) AND ",
" (a.fecha <= ?) AND b.status_t is null AND ",criterio CLIPPED,
"ORDER BY d.dpto,a.departamento,a.cuenta_no"
"ORDER BY d.dpto,ISNULL(a.departamento,0),a.cuenta_no"
DISPLAY "<<<Buscando Informacion... Espere por Favor>>>" AT 19,14
ATTRIBUTE(blue)
@@ -189,12 +190,10 @@ END MAIN
END IF
OUTPUT TO REPORT gastos_gral(gastos.*,fecha_inicial,fecha_final,p_ano,
ano_ant)
LET idx1 = idx+1
LET idx1 = idx1+1 -- antes idx+1: idx1 no avanzaba y START REPORT se repetia por fila
END FOREACH
IF idx1 > 1 THEN
FINISH REPORT gastos_gral
UPDATE cgtb00004 set departamento = NULL
WHERE departamento = 0 and cuenta_no[1] = "7"
ELSE
CALL fgl_winmessage("INFO","NO EXISTEN REGISTROS","INFO")
END IF
@@ -314,18 +313,18 @@ REPORT gastos_gral(x,fecha1,fecha2,p_ano1,ano_ant1)
FROM cgtb00004 a
WHERE (a.ref NOT MATCHES "ED.99-999/12*") and
(a.cuenta_no = x.cuenta_no) and (a.fecha BETWEEN fecha4 AND fecha5) and
(a.departamento = x.departamento) and a.status_t is null
(a.departamento = x.departamento OR (a.departamento IS NULL AND x.departamento = 0)) and a.status_t is null
SELECT SUM(a.debito-a.credito) INTO x.valor
FROM cgtb00004 a
WHERE (a.cuenta_no = x.cuenta_no) and
(a.fecha BETWEEN fecha_inicial AND fecha_final) and
(a.departamento = x.departamento) and a.status_t is null
(a.departamento = x.departamento OR (a.departamento IS NULL AND x.departamento = 0)) and a.status_t is null
SELECT SUM(a.debito-a.credito) INTO x.valor_ant FROM cgtb00004 a
WHERE (a.ref != ent_diario) and
(a.cuenta_no = x.cuenta_no) and (a.fecha < fecha_inicial) and
(a.departamento = x.departamento) and a.status_t is null
(a.departamento = x.departamento OR (a.departamento IS NULL AND x.departamento = 0)) and a.status_t is null
IF x.ano_ante is null THEN
LET x.ano_ante = 0
+2 -2
View File
@@ -90,7 +90,7 @@ END MAIN
END IF
CONSTRUCT criterio ON a.cuenta_no,a.num_doc,a.cod_aux,a.cod_Sec
FROM cuenta_no,cod_sp,cod_sp_Sec,num_doc
FROM cuenta_no,num_doc,cod_sp,cod_sp_sc -- G6: el form tiene cod_sp_sc (no cod_sp_Sec, -1102) y el orden debe seguir a las columnas
IF int_flag THEN
LET numero_msg = 2
@@ -302,7 +302,7 @@ REPORT mayor_ref(x,fecha1,fecha2)
LET total1 = balance
LET total2 = 0
ELSE
LET total2 = balance
LET total2 = balance * -1 -- saldo acreedor va POSITIVO a la columna CR (antes negativo: restaba en los totales)
LET total1 = 0
END IF
IF balance != 0 OR balance_final != 0 THEN
+1 -1
View File
@@ -89,7 +89,7 @@ FUNCTION cgprrp022()
}
CALL configureoutput("SVG") RETURNING HANDLER
CALL configureoutput(getPreviewDevice()) RETURNING HANDLER -- G6: SVG (GRV) solo en GDC; en web cuelga -> PDF
START REPORT imp_entrada TO XML HANDLER handler
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ManagedForm databaseName="smarmotech" fileVersion="31400" gstVersion="31408" name="ManagedForm" uid="{49cf58f8-0836-404a-8a30-ef813c88a4b4}">
<ManagedForm databaseName="smarmotech" fileVersion="31400" gstVersion="3140a" name="ManagedForm" uid="{49cf58f8-0836-404a-8a30-ef813c88a4b4}">
<AGSettings>
<DynamicProperties version="2"/>
</AGSettings>
+3 -3
View File
@@ -191,7 +191,7 @@ FUNCTION edprrp029()
RETURN
END IF
IF idx = 1 THEN
CALL configureoutput("SVG") RETURNING handler
CALL configureoutput(getPreviewDevice()) RETURNING handler -- G6: SVG (GRV) solo en GDC; en web cuelga -> PDF
START REPORT prn_credito TO XML HANDLER HANDLER
END IF
@@ -226,7 +226,7 @@ FUNCTION edprrp029()
CALL fgl_winmessage("INFO","NO EXISTEN REGISTROS CON ESTAS CONDICIONES","INFO")
END IF
{ IF fgl_report_loadCurrentSettings("formato_entrada.4rp") THEN -- load the .4rp file
CALL fgl_report_selectDevice("SVG") -- changing default
CALL fgl_report_selectDevice(getPreviewDevice()) -- changing default
CALL fgl_report_selectPreview(1)
LET handler = fgl_report_commitCurrentSettings()
START REPORT prn_credito TO XML HANDLER HANDLER
@@ -250,7 +250,7 @@ FUNCTION edprrp029()
RETURN
END IF
IF idx = 1 THEN
CALL configureoutput("SVG") RETURNING HANDLER
CALL configureoutput(getPreviewDevice()) RETURNING HANDLER
START REPORT ed29 TO XML HANDLER HANDLER
END IF
+20 -7
View File
@@ -210,7 +210,9 @@ FUNCTION ipprrp004()
" AND c.cod_n = e.cod_n and c.cod_grupo =e.cod_grupo AND c.cod_tipo = e.cod_tipo AND ",
" c.cod_sec = e.cod_sec ",
" AND e.cod_cia = f.cod_cia and c.cod_mov = k.cod_mov ",
" AND c.status_t is NULL and c.cod_mov = ",
#-> Excluye los movimientos que YA generaron su asiento en linea
# (ipprmt044 sella iptb00006.referenciaentrada). Evita doble contabilizacion.
" AND c.status_t is NULL AND c.referenciaentrada IS NULL and c.cod_mov = ",
cod_mov, #" c.cod_mov = 44 ",
# " AND c.departamento = 2407 ",
"GROUP BY c.cod_mov,c.cod_n,c.cod_grupo,c.cod_tipo,c.cod_sec,e.descrip_esp,e.cod_cia,f.descripcion,c.departamento,x.nom_dpto, ",
@@ -236,9 +238,17 @@ FUNCTION ipprrp004()
LET idx = 1
LET acumulado.nombre_Cia = p_compania.nombre
CALL controlNumericoED(
numero_ent, fecha_final, usuarios)
RETURNING entrada_d
-- Solo se consume la secuencia en cgtb00011 si se AFECTA el mayor;
-- con afecta = "NO" se pide el numero en modo consulta (sin INSERT/UPDATE).
IF afecta = "SI" THEN
CALL controlNumericoED(
numero_ent, fecha_final, usuarios)
RETURNING entrada_d
ELSE
CALL controlNumericoED(
numero_ent, fecha_final, NULL)
RETURNING entrada_d
END IF
DISPLAY "entrada real: ", entrada_d
DISPLAY BY NAME entrada_d
@@ -306,7 +316,8 @@ FUNCTION ipprrp004()
LET acumulado.cuenta_gasto = acumulado_ac.cuenta_3
# LET acumulado.cuenta_imp_material = acumulado_ac.cuenta_imp_material
LET acumulado.entrada_d = entrada_d
IF acumulado.cod_cia = 3 OR acumulado.cod_cia = 2 THEN
IF (acumulado.cod_cia = 3 OR acumulado.cod_cia = 2)
AND acumulado_ac.cuenta_imp_material IS NOT NULL THEN
LET acumulado.cuenta_material = acumulado_ac.cuenta_imp_material
LET acumulado.cuenta_imp_material = NULL
END IF
@@ -399,9 +410,11 @@ FUNCTION ipprrp004()
LET acumulado.cuenta_imp_material = acumulado_ac.cuenta_imp_material
LET acumulado.entrada_d = entrada_d
IF acumulado.cod_cia = 3 THEN
#-> Solo sustituye si el movimiento tiene cuenta_imp_material; si viene
# NULL (p.ej. mov 46 solo tiene cuenta_1) se perdia la partida de material
IF acumulado.cod_cia = 3
AND acumulado.cuenta_imp_material IS NOT NULL THEN
LET acumulado.cuenta_material = acumulado.cuenta_imp_material
END IF
LET acumulado.cod_n = acumulado_ac.cod_n
LET acumulado.cod_grupo = acumulado_ac.cod_grupo
+7 -5
View File
@@ -33,8 +33,8 @@ FUNCTION irprrp009()
DEFINE select_ac CHAR(1000)
DEFINE c_ano CHAR(4)
DEFINE entra, nombre_mes CHAR(25)
DEFINE entra1 CHAR(5)
DEFINE nombre_mes CHAR(25)
DEFINE detalle CHAR(100)
DEFINE numero_ent CHAR(2)
DEFINE ano_act CHAR(4)
@@ -159,8 +159,8 @@ FUNCTION irprrp009()
CALL controlNumericoED(
numero_ent, datos_cons.fech_fi, NULL)
RETURNING entrada
DISPLAY BY NAME entrada
LET entra = entrada
DISPLAY BY NAME entra
AFTER INPUT
@@ -204,7 +204,9 @@ FUNCTION irprrp009()
"irtb00005 AS c ON b.cod_mov = c.cod_mov LEFT OUTER JOIN ",
"adtb00001 AS d ON b.sec_a = d.departamento ",
"WHERE ",
" b.fecha BETWEEN ? AND ? AND b.status_t IS NULL ",
#-> Excluye los movimientos que YA generaron su asiento en linea
# (irprmt036 sella irtb00006.referenciaentrada). Evita doble contabilizacion.
" b.fecha BETWEEN ? AND ? AND b.status_t IS NULL AND b.referenciaentrada IS NULL ",
" GROUP BY b.cod_n,b.cod_grupo,b.cod_tipo,b.cod_sec,a.descrip_esp,a.unidad_med,b.cod_mov,c.descrip_mov,b.sec_a,d.nom_dpto, a.cuenta,e.cuenta_no ",
" ORDER BY b.cod_mov,b.sec_a,b.cod_n,b.cod_grupo,b.cod_tipo,b.cod_sec"
+2 -2
View File
@@ -121,7 +121,7 @@ REPORT entrada14(
fecha1, fecha2 DATE, #### Almacena las fecha del rango de busqueda
hora CHAR(5),
entrada CHAR(14),
entrada VARCHAR(25), -- ref. completa ED.nn-nnnnn/mmaa (CHAR(14) cortaba el anio)
actual VARCHAR(20),
afecta CHAR(3),
p_companias, desc_cuenta CHAR(30)
@@ -274,7 +274,7 @@ REPORT entrada14(
entrada,
y.cuenta_inv,
detalle1,
invcredito,
invdebito,
0,
usuarios,
GETDATE())