Files
MBS/PROYECTO/PRDIR/prprmt009.4gl
T

886 lines
31 KiB
Plaintext

{
------------------------------------------------------------------
PROGRAMA : PRPRMT008
OBJETIVO : Ordenes de Pedidos
PROGRAMADOR : Oscar Castillo
FECHA REALIZACION : Sábado 12 de Agosto de 2000
MODIFICADO POR : Victor Gomez C
FECHA MODIFICACION: Wednesday, 10 January, 2001
------------------------------------------------------------------
}
GLOBALS "prprgb000.4gl"
DEFINE nombre LIKE vetb00004.nombre,
descrip_esp_c,descrip_esp LIKE iptb00002.descrip_esp,
unidad LIKE iptb00002.unidad_med,
unidad_c LIKE intb00001.unidad_med,
descrip CHAR(20),
esta,opt4 CHAR(1),
nombre_vend,nombres,apellidos CHAR(40),
nombmp CHAR(120),
monto_desc,total1,total_i,total_mo DECIMAL(12,2),
ult_numero INTEGER
DEFINE numero_oc INTEGER,
f_itbis DEC(3,2)
DEFINE total_v,sub_total,sub_total1,sub_total2,balance DECIMAL(10,2),
descrip_p CHAR(30)
DEFINE prtb08 RECORD LIKE prtb00012.*
DEFINE p_totales RECORD
sub_total DEC(8,2), #-> Sub-Total de los Productos menos descuento
unidad_med CHAR(4), #-> Unidad de medida del producto
total_v DEC(10,2) #-> Total de la venta
END RECORD
DEFINE arr_prtb08 ARRAY[200] OF RECORD
cod_n LIKE prtb00013.cod_n,
cod_grupo LIKE prtb00013.cod_grupo,
cod_tipo LIKE prtb00013.cod_tipo,
cod_sec LIKE prtb00013.cod_sec,
descrip_esp LIKE iptb00002.descrip_esp,
bisel LIKE prtb00013.bisel,
cantidad LIKE prtb00013.cantidad,
precio LIKE prtb00013.precio,
descuento LIKE prtb00013.descuento,
total_p DECIMAL(10,2)
END RECORD
FUNCTION prprmt008()
# WHENEVER ERROR CONTINUE
CLEAR SCREEN
OPTIONS
FORM LINE 8,
ERROR LINE 23,
COMMENT LINE 22
CALL pantalla()
OPEN FORM ctfmmt008 FROM "prfmmt008"
DISPLAY FORM ctfmmt008
CALL pantalla()
DISPLAY "prprmt008" AT 4,3
DISPLAY "Ordene De Pedido" AT 6,32
MENU "OPCIONES"
COMMAND "Adicionar"
"<Esc> Adiciona Registro <Supr> Cancela Operacion"
LET INT_FLAG = FALSE
CLEAR FORM
CALL prpcad008()
COMMAND "Consultar"
LET INT_FLAG = FALSE
CALL prpcmf008()
COMMAND "Salir" "Retorna Menu Anterior"
EXIT MENU
END MENU
END FUNCTION
FUNCTION prpcad008()
## Captura los datos que va a contener el registro
LET INT_FLAG = false
SELECT MAX(num_oc) INTO ult_numero
FROM prtb00012
IF ult_numero IS NULL THEN
LET ult_numero = 0
END IF
LET ult_numero = ult_numero + 1
LET prtb08.num_oc = ult_numero
INPUT BY NAME prtb08.num_oc,prtb08.fecha_oc,prtb08.tipo_cliente,
prtb08.sec_cliente,prtb08.sec_vend,prtb08.direccion,
prtb08.telefono,prtb08.fax,prtb08.fecha_entrega,
prtb08.cond_pago WITHOUT DEFAULTS
ON KEY(CONTROL-W)
CASE
WHEN INFIELD(sec_vend)
CALL vendedor8es()
DISPLAY BY NAME prtb07.sec_vend,nombre_vend ATTRIBUTE(BLUE)
EXIT CASE
WHEN INFIELD (tipo_cliente)
CALL busca_cliente8()
DISPLAY BY NAME prtb08.tipo_cliente,prtb08.sec_cliente,
nombre ATTRIBUTE(BLUE)
EXIT CASE
WHEN INFIELD (sec_cliente)
CALL busca_cliente8()
DISPLAY BY NAME prtb08.tipo_cliente,prtb08.sec_cliente,
nombre ATTRIBUTE(BLUE)
EXIT CASE
END CASE
AFTER FIELD fecha_entrega
IF prtb08.fecha_entrega IS NULL THEN
LET numero_msg = 16
CALL msg(numero_msg)
NEXT FIELD fecha_entrega
END IF
IF prtb08.fecha_entrega < prtb08.fecha_oc THEN
LET numero_msg =51
CALL msg(numero_msg)
NEXT FIELD fecha_entrega
END IF
{
AFTER FIELD nombre_file
LET nombmp = FGL_GETENV("FGLBMP")
LET nombmp = nombmp CLIPPED,prtb08.nombre_file CLIPPED,".bmp"
DISPLAY nombmp TO bmpfld
}
AFTER FIELD sec_vend
IF prtb08.sec_vend IS NOT NULL THEN
SELECT a.nom1_emp,a.apell1_emp INTO nombres,apellidos
FROM adtb00003 a
WHERE a.num_emp = prtb08.sec_vend
IF STATUS = NOTFOUND THEN
LET numero_msg = 3
CALL msg(numero_msg)
NEXT FIELD sec_vend
END IF
LET nombre_vend = nombres CLIPPED," ",apellidos CLIPPED
DISPLAY BY NAME nombre_vend ATTRIBUTE(BLUE)
END IF
BEFORE FIELD fecha_oc
LET prtb08.fecha_oc = TODAY
DISPLAY BY NAME prtb08.fecha_oc ATTRIBUTE(BLUE)
AFTER FIELD fecha_oc
IF prtb08.fecha_oc > TODAY THEN
LET numero_msg = 189
CALL msg(numero_msg)
NEXT FIELD fecha_oc
END IF
AFTER FIELD cond_pago
IF prtb08.cond_pago IS NULL THEN
LET numero_msg = 12
CALL msg(numero_msg)
NEXT FIELD cond_pago
END IF
SELECT a.descrip INTO descrip_p
FROM vetb00012 a
WHERE a.cond_pago = prtb08.cond_pago AND
a.status_t IS NULL
IF STATUS = NOTFOUND THEN
LET numero_msg = 3
CALL msg(numero_msg)
NEXT FIELD cond_pago
END IF
DISPLAY BY NAME descrip_p ATTRIBUTE(BLUE)
AFTER FIELD sec_cliente
SELECT a.nombre INTO nombre
FROM vetb00004 a
WHERE a.tipo_cliente = prtb08.tipo_cliente AND
a.sec_cliente = prtb08.sec_cliente AND
a.status_t IS NULL
IF STATUS = NOTFOUND THEN
LET numero_msg = 3
CALL msg(numero_msg)
NEXT FIELD tipo_cliente
END IF
DISPLAY BY NAME nombre ATTRIBUTE(BLUE)
SELECT SUM(a.valor) INTO balance
FROM cctb00001 a
WHERE a.tipo_cliente = prtb08.tipo_cliente
AND a.sec_cliente = prtb08.sec_cliente
AND a.status_t IS NULL
DISPLAY BY NAME balance
AFTER INPUT
IF INT_FLAG THEN
LET numero_msg = 2
CALL msg(numero_msg)
LET INT_FLAG = FALSE
RETURN
END IF
END INPUT
LET p_totales.sub_total = 0
LET prtb08.cantidad_i = 0
LET prtb08.precio_i = 0
LET prtb08.cantidad_mo = 0
LET prtb08.precio_mo = 0
LET prtb08.transporte = 0
LET prtb08.itbis = 0
LET p_totales.total_v = 0
INPUT ARRAY arr_prtb08 FROM s_pedido.*
BEFORE ROW
LET curr = arr_curr()
LET scr_l = scr_line()
LET sub_total = 0
AFTER FIELD cod_sec
LET descrip_esp = NULL
LET p_totales.unidad_med = NULL
IF arr_prtb08[curr].cod_sec IS NOT NULL THEN
SELECT a.descrip_esp, a.unidad_med INTO descrip_esp,p_totales.unidad_med
FROM iptb00002 a
WHERE a.cod_n = arr_prtb08[curr].cod_n AND
a.cod_grupo = arr_prtb08[curr].cod_grupo AND
a.cod_tipo = arr_prtb08[curr].cod_tipo AND
a.cod_sec = arr_prtb08[curr].cod_sec AND
a.status_t IS NULL
IF STATUS = NOTFOUND THEN
LET numero_msg = 3
CALL msg(numero_msg)
NEXT FIELD cod_n
END IF
END IF
LET arr_prtb08[curr].descrip_esp = descrip_esp
DISPLAY arr_prtb08[curr].descrip_esp TO s_pedido[scr_l].descrip_esp ATTRIBUTE(BLUE)
DISPLAY BY NAME p_totales.unidad_med
AFTER FIELD cantidad
IF arr_prtb08[curr].cantidad IS NULL OR
arr_prtb08[curr].cantidad < 0 THEN
LET arr_prtb08[curr].descuento = 0
END IF
AFTER FIELD precio
IF arr_prtb08[curr].precio IS NULL OR
arr_prtb08[curr].precio < 0 THEN
LET arr_prtb08[curr].descuento = 0
END IF
BEFORE FIELD descuento
LET monto_desc = 0
LET total1 = 0
AFTER FIELD descuento
IF arr_prtb08[curr].descuento IS NULL THEN
LET arr_prtb08[curr].descuento = 0
END IF
LET monto_desc = (arr_prtb08[curr].precio * arr_prtb08[curr].cantidad) *
(arr_prtb08[curr].descuento /100)
LET total1 = (arr_prtb08[curr].precio * arr_prtb08[curr].cantidad) - monto_desc
LET arr_prtb08[curr].total_p = total1
LET p_totales.sub_total = p_totales.sub_total + arr_prtb08[curr].total_p
DISPLAY arr_prtb08[curr].total_p TO s_pedido[scr_l].total_p
DISPLAY BY NAME p_totales.sub_total
AFTER INPUT
IF INT_FLAG THEN
LET numero_msg = 2
CALL msg(numero_msg)
LET INT_FLAG = FALSE
RETURN
END IF
LET p_totales.sub_total = 0
FOR idx = 1 TO arr_count()
LET p_totales.sub_total = p_totales.sub_total + arr_prtb08[idx].total_p
END FOR
EXIT INPUT
END INPUT
DISPLAY BY NAME p_totales.sub_total
INPUT BY NAME prtb08.cantidad_i,prtb08.precio_i,prtb08.cantidad_mo,
prtb08.precio_mo,prtb08.transporte,prtb08.itbis WITHOUT DEFAULTS
AFTER FIELD cantidad_i
IF prtb08.cantidad_i IS NULL THEN
LET prtb08.cantidad_i = 0
END IF
AFTER FIELD precio_i
IF prtb08.precio_i IS NULL THEN
LET prtb08.precio_i = 0
END IF
LET total_i = (prtb08.cantidad_i * prtb08.precio_i)
AFTER FIELD cantidad_mo
IF prtb08.cantidad_mo IS NULL THEN
LET prtb08.cantidad_mo = 0
END IF
AFTER FIELD precio_mo
IF prtb08.precio_mo IS NULL THEN
LET prtb08.precio_mo = 0
END IF
LET total_mo = (prtb08.cantidad_mo * prtb08.precio_mo)
AFTER FIELD transporte
LET sub_total = (total_i + total_mo)+ p_totales.sub_total
LET sub_total1 = sub_total + prtb08.transporte
#-> Bsuca el itbis disponible para la fecha actual vg
SELECT i.itbi/100 INTO f_itbis FROM vetb00019 i
WHERE i.disponible = "S"
LET prtb08.itbis = (sub_total1 * f_itbis)
DISPLAY BY NAME prtb08.itbis
LET p_totales.total_v = sub_total1 + prtb08.itbis
DISPLAY BY NAME p_totales.total_v
AFTER INPUT
IF INT_FLAG THEN
LET numero_msg = 2
CALL msg(numero_msg)
LET INT_FLAG = FALSE
RETURN
END IF
EXIT INPUT
END INPUT
PROMPT "TODA LA INFORMACION ESTA CORRECTA? " FOR opt4
LET opt4 = upshift(opt4)
IF opt4 = "S" THEN
#START REPORT ordenes TO "c:\\archivo"
#-> LET prtb08.nombre_file = prtb08.nombre_file CLIPPED, ".BMP"
INSERT INTO prtb00012 VALUES (prtb08.*)
UPDATE prtb00012
SET us_crea = user,
fech_crea = current
WHERE @num_oc = prtb08.num_oc
# 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
FOR idx = 1 TO arr_count()
IF arr_prtb08[idx].cod_n IS NOT NULL THEN
INSERT INTO prtb00013 VALUES (prtb08.num_oc,
arr_prtb08[idx].cod_n,
arr_prtb08[idx].cod_grupo,
arr_prtb08[idx].cod_tipo,
arr_prtb08[idx].cod_sec,
arr_prtb08[idx].bisel,
arr_prtb08[idx].precio,
arr_prtb08[idx].cantidad,
arr_prtb08[idx].descuento,
null,user,current,null,null)
#OUTPUT TO REPORT ordenes(prtb08.num_oc,arr_prtb08[idx].*)
END IF
END FOR
#FINISH REPORT ordenes
#RUN "TYPE c:\\archivo > LPT3"
LET numero_msg = 1
CALL msg(numero_msg)
END IF
CLEAR FORM
END FUNCTION
FUNCTION prpcmf008()
## Aqui se prepara para la captura del criterio de seleccion
CONSTRUCT BY NAME criterio ON a.num_oc
IF INT_FLAG THEN
LET numero_msg = 2
CALL msg(numero_msg)
LET INT_FLAG = FALSE
RETURN
END IF
LET SELEC = " SELECT UNIQUE a.* FROM prtb00012 a ",
" WHERE ",criterio CLIPPED, " AND a.status_t IS NULL "
PREPARE busca FROM selec
DECLARE datos SCROLL CURSOR FOR busca
OPEN datos
FETCH FIRST datos INTO prtb08.*
IF STATUS = NOTFOUND THEN
LET numero_msg = 3
CALL msg(numero_msg)
RETURN
END IF
SELECT SUM(a.valor) INTO balance
FROM cctb00001 a
WHERE a.tipo_cliente = prtb08.tipo_cliente
AND a.sec_cliente = prtb08.sec_cliente
AND a.status_t IS NULL
IF balance IS NULL THEN
LET balance = 0
END IF
DISPLAY BY NAME prtb08.num_oc,prtb08.fecha_oc,prtb08.tipo_cliente,
prtb08.sec_cliente,prtb08.direccion,prtb08.telefono,
prtb08.fax,prtb08.fecha_entrega,prtb08.cond_pago,
balance,prtb08.cantidad_i,prtb08.precio_i,prtb08.cantidad_mo,
prtb08.precio_mo,prtb08.transporte,prtb08.itbis,prtb08.sec_vend ATTRIBUTE(BLUE)
CALL busca_cliente8m()
CALL busca_vendm8()
#CALL limpia8()
CALL busca_detalle8()
LET sub_total1 = sub_total + (prtb08.cantidad_i * prtb08.precio_i) + (prtb08.cantidad_mo * prtb08.precio_mo) +
prtb08.transporte
LET p_totales.total_v = sub_total1 + prtb08.itbis
DISPLAY BY NAME p_totales.total_v
MENU "OPCIONES "
COMMAND "Siguiente"
"Presenta en pantalla el proprtb08.mo registro encontrado"
FETCH NEXT datos INTO prtb08.*
IF STATUS = NOTFOUND THEN
LET numero_msg = 4
CALL msg(numero_msg)
NEXT OPTION "anterior"
END IF
SELECT SUM(a.valor) INTO balance
FROM cctb00001 a
WHERE a.tipo_cliente = prtb08.tipo_cliente
AND a.sec_cliente = prtb08.sec_cliente
AND a.status_t IS NULL
IF balance IS NULL THEN
LET balance = 0
END IF
DISPLAY BY NAME prtb08.num_oc,prtb08.fecha_oc,prtb08.tipo_cliente,
prtb08.sec_cliente,prtb08.direccion,prtb08.telefono,
prtb08.fax,prtb08.fecha_entrega,prtb08.cond_pago,
balance,prtb08.cantidad_i,prtb08.precio_i,prtb08.cantidad_mo,
prtb08.precio_mo,prtb08.transporte,prtb08.itbis,prtb08.sec_vend ATTRIBUTE(BLUE)
CALL busca_cliente8m()
CALL busca_vendm8()
#CALL limpia8()
CALL busca_detalle8()
LET sub_total1 = sub_total + (prtb08.cantidad_i * prtb08.precio_i) + (prtb08.cantidad_mo * prtb08.precio_mo) +
prtb08.transporte
LET p_totales.total_v = sub_total1 + prtb08.itbis
DISPLAY BY NAME p_totales.total_v
COMMAND "Anterior"
"Presenta en pantalla el registro anterior encontrado"
FETCH PREVIOUS datos INTO prtb08.*
IF STATUS = NOTFOUND THEN
LET numero_msg = 5
CALL msg(numero_msg)
NEXT OPTION "siguiente"
END IF
SELECT SUM(a.valor) INTO balance
FROM cctb00001 a
WHERE a.tipo_cliente = prtb08.tipo_cliente
AND a.sec_cliente = prtb08.sec_cliente
AND a.status_t IS NULL
IF balance IS NULL THEN
LET balance = 0
END IF
DISPLAY BY NAME prtb08.num_oc,prtb08.fecha_oc,prtb08.tipo_cliente,
prtb08.sec_cliente,prtb08.direccion,prtb08.telefono,
prtb08.fax,prtb08.fecha_entrega,prtb08.cond_pago,
balance,prtb08.cantidad_i,prtb08.precio_i,prtb08.cantidad_mo,
prtb08.precio_mo,prtb08.transporte,prtb08.itbis,prtb08.sec_vend ATTRIBUTE(BLUE)
CALL busca_cliente8m()
CALL busca_vendm8()
#CALL limpia8()
CALL busca_detalle8()
LET sub_total1 = sub_total + (prtb08.cantidad_i * prtb08.precio_i) + (prtb08.cantidad_mo * prtb08.precio_mo) +
prtb08.transporte
LET p_totales.total_v = sub_total1 + prtb08.itbis
DISPLAY BY NAME p_totales.total_v
COMMAND "Primero"
"Presenta en pantalla el primer registro encontrado"
FETCH FIRST datos INTO prtb08.*
SELECT SUM(a.valor) INTO balance
FROM cctb00001 a
WHERE a.tipo_cliente = prtb08.tipo_cliente
AND a.sec_cliente = prtb08.sec_cliente
AND a.status_t IS NULL
IF balance IS NULL THEN
LET balance = 0
END IF
DISPLAY BY NAME prtb08.num_oc,prtb08.fecha_oc,prtb08.tipo_cliente,
prtb08.sec_cliente,prtb08.direccion,prtb08.telefono,
prtb08.fax,prtb08.fecha_entrega,prtb08.cond_pago,
balance,prtb08.cantidad_i,prtb08.precio_i,prtb08.cantidad_mo,
prtb08.precio_mo,prtb08.transporte,prtb08.itbis,prtb08.sec_vend ATTRIBUTE(BLUE)
CALL busca_cliente8m()
CALL busca_vendm8()
#CALL limpia8()
CALL busca_detalle8()
LET sub_total1 = sub_total + (prtb08.cantidad_i * prtb08.precio_i) + (prtb08.cantidad_mo * prtb08.precio_mo) +
prtb08.transporte
LET p_totales.total_v = sub_total1 + prtb08.itbis
DISPLAY BY NAME p_totales.total_v
NEXT OPTION "primero"
COMMAND "Ultimo"
"Presenta en pantalla el ultimo registro encontrado"
FETCH LAST datos INTO prtb08.*
SELECT SUM(a.valor) INTO balance
FROM cctb00001 a
WHERE a.tipo_cliente = prtb08.tipo_cliente
AND a.sec_cliente = prtb08.sec_cliente
AND a.status_t IS NULL
IF balance IS NULL THEN
LET balance = 0
END IF
DISPLAY BY NAME prtb08.num_oc,prtb08.fecha_oc,prtb08.tipo_cliente,
prtb08.sec_cliente,prtb08.direccion,prtb08.telefono,
prtb08.fax,prtb08.fecha_entrega,prtb08.cond_pago,
balance,prtb08.cantidad_i,prtb08.precio_i,prtb08.cantidad_mo,
prtb08.precio_mo,prtb08.transporte,prtb08.itbis,prtb08.sec_vend ATTRIBUTE(BLUE)
CALL busca_cliente8m()
CALL busca_vendm8()
#CALL limpia8()
CALL busca_detalle8()
NEXT OPTION "anterior"
COMMAND KEY ("N") "aNular"
PROMPT "Esta seguro?" FOR esta
LET esta = UPSHIFT(esta)
IF esta = "S" THEN
UPDATE prtb00012 set status_t = "E",
us_mod = user,
fech_mod = current
WHERE num_oc = prtb08.num_oc
UPDATE prtb00012 set status_t = "E",
us_mod = user,
fech_mod = current
WHERE num_oc = prtb08.num_oc
LET numero_msg = 39
CALL msg(numero_msg)
END IF
COMMAND "Retornar"
"Retorna al menu anterior"
EXIT MENU
END MENU
END FUNCTION
FUNCTION limpia8()
FOR idx = 1 TO 10
LET arr_prtb08[idx].cod_n = NULL
LET arr_prtb08[idx].cod_grupo = NULL
LET arr_prtb08[idx].cod_tipo = NULL
LET arr_prtb08[idx].cod_sec = NULL
LET arr_prtb08[idx].descrip_esp = NULL
LET arr_prtb08[idx].bisel = NULL
LET arr_prtb08[idx].cantidad = NULL
LET arr_prtb08[idx].precio = NULL
LET arr_prtb08[idx].descuento = NULL
END FOR
FOR idx = 1 TO 5
DISPLAY arr_prtb08[idx].cod_n TO s_pedido[idx].cod_n
DISPLAY arr_prtb08[idx].cod_grupo TO s_pedido[idx].cod_grupo
DISPLAY arr_prtb08[idx].cod_tipo TO s_pedido[idx].cod_tipo
DISPLAY arr_prtb08[idx].cod_sec TO s_pedido[idx].cod_sec
DISPLAY arr_prtb08[idx].descrip_esp TO s_pedido[idx].descrip_esp
DISPLAY arr_prtb08[idx].bisel TO s_pedido[idx].bisel
DISPLAY arr_prtb08[idx].cantidad TO s_pedido[idx].cantidad
DISPLAY arr_prtb08[idx].precio TO s_pedido[idx].precio
DISPLAY arr_prtb08[idx].descuento TO s_pedido[idx].descuento
DISPLAY arr_prtb08[idx].total_p TO s_pedido[idx].total_p
END FOR
END FUNCTION
FUNCTION busca_detalle8()
DECLARE busca_d CURSOR FOR
SELECT a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec," ",a.bisel,a.cantidad,a.precio,a.descuento
FROM prtb00013 a
WHERE a.num_oc = prtb08.num_oc
LET idx = 1
FOREACH busca_d INTO arr_prtb08[idx].*
SELECT a.descrip_esp,a.unidad_med INTO arr_prtb08[idx].descrip_esp,p_totales.unidad_med
FROM iptb00002 a
WHERE a.cod_n = arr_prtb08[idx].cod_n AND
a.cod_grupo = arr_prtb08[idx].cod_grupo AND
a.cod_tipo = arr_prtb08[idx].cod_tipo AND
a.cod_sec = arr_prtb08[idx].cod_sec AND
a.status_t IS NULL
LET monto_desc = 0
LET total1 = 0
LET monto_desc = (arr_prtb08[idx].precio * arr_prtb08[idx].cantidad) * (arr_prtb08[idx].descuento /100)
LET total1 = (arr_prtb08[idx].precio * arr_prtb08[idx].cantidad) - monto_desc
LET arr_prtb08[idx].total_p = total1
DISPLAY arr_prtb08[idx].cod_n TO s_pedido[idx].cod_n
DISPLAY arr_prtb08[idx].cod_grupo TO s_pedido[idx].cod_grupo
DISPLAY arr_prtb08[idx].cod_tipo TO s_pedido[idx].cod_tipo
DISPLAY arr_prtb08[idx].cod_sec TO s_pedido[idx].cod_sec
DISPLAY arr_prtb08[idx].descrip_esp TO s_pedido[idx].descrip_esp ATTRIBUTE(BLUE)
DISPLAY arr_prtb08[idx].bisel TO s_pedido[idx].bisel ATTRIBUTE(BLUE)
DISPLAY arr_prtb08[idx].cantidad TO s_pedido[idx].cantidad
DISPLAY arr_prtb08[idx].precio TO s_pedido[idx].precio ATTRIBUTE(BLUE)
DISPLAY arr_prtb08[idx].descuento TO s_pedido[idx].descuento
DISPLAY arr_prtb08[idx].total_p TO s_pedido[idx].total_p
LET p_totales.sub_total = p_totales.sub_total + arr_prtb08[idx].total_p
LET idx = idx + 1
END FOREACH
DISPLAY BY NAME p_totales.sub_total,p_totales.unidad_med
LET total_i = (prtb08.cantidad_i * prtb08.precio_i)
LET total_mo = (prtb08.cantidad_mo * prtb08.precio_mo)
LET sub_total = (total_i + total_mo)+ p_totales.sub_total
LET sub_total1 = sub_total + prtb08.transporte
DISPLAY BY NAME prtb08.itbis
LET p_totales.total_v = sub_total1 + prtb08.itbis
DISPLAY BY NAME p_totales.total_v
END FUNCTION
{
REPORT pedido(xnumero,z)
DEFINE z 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,
i,xnumero INTEGER,
negrillas_on,negrillas_off,doble CHAR(2)
OUTPUT
LEFT MARGIN 0
ORDER BY xnumero
FORMAT
PAGE HEADER
LET negrillas_on = ASCII 27, ASCII 69
LET negrillas_off = ASCII 27, ASCII 70
LET doble = ASCII 14
LET l = (80 - LENGTH(p_compania.nombre CLIPPED))/2
PRINT COLUMN l, p_compania.nombre CLIPPED,
COLUMN 70, TODAY USING "DD/MM/YY"
LET l = (80 - LENGTH("ORDEN DE PRODUCCION"))/2
PRINT COLUMN l, "ORDEN DE PRODUCCION",
COLUMN 70, TIME
PRINT COLUMN 1, "NO. ORDEN: ",doble_on,xnumero USING "<<<<<<"
PRINT COLUMN 1, "FECHA : ",negrillas_on,prtb08.fecha
USING "DD/MM/YY",negrillas_off
PRINT COLUMN 1, "vendedor8 : ",negrillas_on,prtb08.sec_vend USING "<<<<",
" ",nombre_vend,negrillas_off
PRINT COLUMN 1, "CLIENTE : ",negrillas_on,prtb08.tipo_cliente USING "<<",
prtb08.sec_cliente
USING "<<<<"," "," ",
nombre,negrillas_off
PRINT COLUMN 1, "PRODUCTO : ",negrillas_on,prtb08.cod_n USING "&","-",
prtb08.cod_grupo USING "&","-",
prtb08.cod_tipo USING "&&","-",
prtb08.cod_sec
USING "&&&"," ",negrillas_off,descrip_esp," ",
unidad,negrillas_off
PRINT COLUMN 1, "CANTIDAD : ",negrillas_on, prtb08.cantidad USING "<<,<<<",
negrillas_off
FOR i = 1 TO 70
PRINT "-";
END FOR
PRINT "-"
PRINT "COMPOSICION PRODUCTO..."
FOR i = 1 TO 70
PRINT "-";
END FOR
PRINT "-"
ON EVERY ROW
PRINT COLUMN 1, z.cod_n_c USING "&","-",
z.cod_grupo_c USING "&","-",
z.cod_tipo_c USING "&&","-",
z.cod_sec_c USING "&&&","-",
" ",z.descrip_esp_c," ",z.unidad_c,
" ",z.cantidad_c USING "###,###.###"
PAGE TRAILER
PRINT COLUMN 10, "-------------------",
COLUMN 35, "-------------------"
PRINT COLUMN 13, "AUTORIZADO POR",
COLUMN 39, "REVISADO POR"
END REPORT
}
FUNCTION busca_cliente8()
OPEN WINDOW busqueda AT 7,12 WITH FORM "vefmwd002"
ATTRIBUTE (BORDER,FORM LINE FIRST + 2,COMMENT LINE LAST,MESSAGE LINE LAST)
LET INT_FLAG = false
CONSTRUCT criterio ON a.nombre FROM nombre
LET selec2 = "SELECT a.tipo_cliente, a.sec_cliente, a.nombre ",
" FROM vetb00004 a",
" WHERE ",
"a.status_t is NULL AND ",
criterio clipped,
"ORDER BY 1,2 "
IF INT_FLAG THEN
LET numero_msg = 2
CALL msg(numero_msg)
GO TO salir_consulta_c
END IF
PREPARE busca_cliente8s FROM selec2
IF status >= 0 THEN
IF status = notfound THEN
LET numero_msg = 3
CALL msg(numero_msg)
END IF
ELSE
CALL integridad()
IF bandera = 1 THEN
LET bandera = 0
END IF
END IF
DECLARE buscar_clientes CURSOR FOR busca_cliente8s
LET idx = 1
FOREACH buscar_clientes INTO arr_clientes[idx].*
IF status = NOTFOUND THEN
EXIT FOREACH
END IF
IF INT_FLAG THEN
LET numero_msg = 2
CALL msg(numero_msg)
EXIT FOREACH
END IF
LET idx = idx + 1
END FOREACH
CALL set_count(idx-1)
MESSAGE " <Esc> Selecciona Cliente donde esta el cursor"
DISPLAY ARRAY arr_clientes TO s_clientes.*
LET curr1 = arr_curr()
LET prtb08.tipo_cliente = arr_clientes[curr1].tipo_cliente
LET prtb08.sec_cliente = arr_clientes[curr1].sec_cliente
LET nombre = arr_clientes[curr1].nombre
LABEL salir_consulta_c:
CLOSE WINDOW busqueda
END FUNCTION
FUNCTION busca_cliente8m()
SELECT a.nombre INTO nombre
FROM vetb00004 a
WHERE a.tipo_cliente = prtb08.tipo_cliente AND
a.sec_cliente = prtb08.sec_cliente AND
a.status_t IS NULL
SELECT a.descrip INTO descrip_p
FROM vetb00012 a
WHERE a.cond_pago = prtb08.cond_pago AND
a.status_t IS NULL
DISPLAY BY NAME nombre,descrip_p ATTRIBUTE(BLUE)
END FUNCTION
FUNCTION busca_product8()
SELECT a.descrip_esp,a.unidad_med INTO descrip_esp,unidad
FROM iptb00002 a
WHERE a.cod_n = prtb08.cod_n AND
a.cod_grupo = prtb08.cod_grupo AND
a.cod_tipo = prtb08.cod_tipo AND
a.cod_sec = prtb08.cod_sec
DISPLAY BY NAME unidad,descrip_esp ATTRIBUTE(BLUE)
END FUNCTION
FUNCTION vendedor8es()
DEFINE descrip6 LIKE adtb00003.nom1_emp
OPEN WINDOW busqueda2 AT 7,12 WITH FORM "vefmwd001"
ATTRIBUTE (BORDER,FORM LINE FIRST + 2,COMMENT LINE LAST,MESSAGE LINE LAST)
LET INT_FLAG = false
CONSTRUCT criterio ON a.nom1_emp FROM descrip6
LET selec2 = "SELECT UNIQUE a.num_emp,a.nom1_emp,a.apell1_emp ",
" FROM adtb00003 a,vetb00028 b",
" WHERE a.num_emp = b.sec_vend AND ",
"a.status_t is NULL AND ",
criterio clipped,
"ORDER BY 1 "
IF INT_FLAG THEN
LET numero_msg = 2
CALL msg(numero_msg)
GO TO salir_consulta_e
END IF
PREPARE busca_empleados FROM selec2
IF status >= 0 THEN
IF status = notfound THEN
LET numero_msg = 3
CALL msg(numero_msg)
END IF
ELSE
CALL integridad()
IF bandera = 1 THEN
LET bandera = 0
END IF
END IF
DECLARE buscar_empleados CURSOR FOR busca_empleados
LET idx = 1
FOREACH buscar_empleados INTO arr_empleados[idx].*
IF status = NOTFOUND THEN
EXIT FOREACH
END IF
IF INT_FLAG THEN
LET numero_msg = 2
CALL msg(numero_msg)
EXIT FOREACH
END IF
LET empleados[idx].cod_emp_sec = arr_empleados[idx].num_emp
LET empleados[idx].descrip6 =
arr_empleados[idx].nom1_emp clipped," ",arr_empleados[idx].apell1_emp clipped
LET idx = idx + 1
END FOREACH
CALL set_count(idx-1)
MESSAGE " <Esc> Selecciona Empleado donde esta el cursor"
DISPLAY ARRAY empleados TO s_empleados.*
LET curr1 = scr_line()
LET prtb08.sec_vend = empleados[curr1].cod_emp_sec
LET nombre_vend = empleados[curr1].descrip6
LABEL salir_consulta_e:
CLOSE WINDOW busqueda2
END FUNCTION
FUNCTION busca_vendm8()
IF prtb08.sec_vend IS NOT NULL THEN
SELECT a.nom1_emp,a.apell1_emp INTO nombres,apellidos
FROM adtb00003 a
WHERE a.num_emp = prtb08.sec_vend
LET nombre_vend = nombres CLIPPED," ",apellidos CLIPPED
DISPLAY BY NAME nombre_vend ATTRIBUTE(BLUE)
END IF
END FUNCTION