{ ------------------------------------------------------------------ PROGRAMA : IPPRMT014 OBJETIVO : REALIZAR INGRESOS Y EGRESOS DE LA CAJA. PROGRAMADOR : Ing. Brahian A. Pena Nunez FECHA REALIZACION : JUNIO 16, 2008. OBSERVACIONES : Los KE son entrada por cambio y los KS son salida por cambio (de efectivo) esto es K(cambio) E(entrada),S(salida). salida(s) y entrada(s) de dinero de la caja, por k(cambio). los TS son transacciones este se incrementara independiente siempre. cada vez que realicemos una transaccion. ------------------------------------------------------------------ } GLOBALS "veprgb000.4gl" define formdoc char(12) #forma de la factura ejemplo reimpresion, original para darme cuenta fisicamente cuando se imprime define descripcion_cliente,descripcion_cia,descripcion_banco,descripcion_doc char(50) define num_oc,status_mov,arr,scr,idx,arr2,scr2,num_trans,num_dev integer define valor_total,total_desglozado,total_dev_desg,monto_pagado,total_devolver decimal(8,2) define desglozar,desglozar_Dev,insertar char(2) define opc2 char(3),cxc char(1) define selec_coti char(300) define lj int define nombre_cajera char(50) define nombre_cobrador char(50) define telefono_cli char(13) define num_rnc char(14) DEFINE fecha_doc DATE #record para la informacion general DEFINE COTIZA record TIPO_DOC char (2), ORDEN INT, cond_pago SMALLINT, NOMBRE CHAR(50), TIPO_CLIENTE SMALLINT, SEC_CLIENTE INT, NETO DEC(12,2), MONTO_ADICIONAL DEC(12,2), MONTO_INICIAL DEC(12,2), FECHA_ORDEN DEC(12,2) END RECORD DEFINE ing_egre record cod_cia SMALLINT, tipo_doc CHAR(2), tipo_cliente SMALLINT, sec_cliente INT, cajera like cctb00020.cajera, cobrador like cctb00020.cobrador, tipo_tarjeta like cctb00020.tipo_tarjeta, referencia like cctb00020.referencia, banco like cctb00020.banco, otro_valor like cctb00020.otro_valor, valor_efectivo like cctb00020.valor_efectivo, observacion like cctb00020.observacion END RECORD #record para el desgloce cuando hay pago en efectivo DEFINE Desgloce array[100] of record cod_moneda like cctb00023.cod_moneda, descripcion_m like cctb00022.descripcion, simbolo like cotb00031.simbolo, tasa like cotb00031.tasa_cambio, valor decimal(8,2), cantidad like cctb00023.cantidad, total decimal(8,2) END RECORD #record para el desgloce cuando hay devoluciones de dinero DEFINE Desgloce_dev array[100] of record cod_moneda1 like cctb00023.cod_moneda, descripcion_m1 like cctb00022.descripcion, simbolo1 like cotb00031.simbolo, tasa1 like cotb00031.tasa_cambio, valor1 like cctb00023.valor, cantidad1 like cctb00023.cantidad, total1 decimal(8,2) END RECORD MAIN DEFER INTERRUPT CALL ARG_VAL(1) RETURNING usuarios CALL ARG_VAL(2) RETURNING clave CALL ARG_VAL(4) RETURNING impresor CONNECT TO "smarmotech" USER usuarios USING clave CALL veprmt014() END MAIN FUNCTION veprmt014() CLEAR SCREEN OPTIONS FORM LINE 9, ERROR LINE 27, COMMENT LINE 28 OPEN FORM vefmmt021 FROM "vefmmt021" DISPLAY FORM vefmmt021 # CALL pantalla() DISPLAY "veprmt014" AT 2,3 DISPLAY "Ingresos Y Egresos" AT 6,32 call fgl_init4js() CALL fgl_setsize(30,80) MENU "OPCIONES" COMMAND "Adicionar" " Adiciona Registro Cancela Operacion" let int_flag = false CLEAR FORM let int_flag = false let cotiza.tipo_doc = null let cotiza.orden = null let ing_egre.tipo_doc = null let ing_egre.tipo_cliente = null let ing_egre.sec_cliente = null let ing_egre.tipo_tarjeta = null let ing_egre.referencia = null let ing_egre.banco = null let ing_egre.otro_valor = 0.00 let ing_egre.valor_efectivo = 0.00 let ing_egre.observacion = null let insertar = "NO" let descripcion_cliente = null let descripcion_cia = null let descripcion_banco = null let descripcion_doc = null let num_oc = 0 let status_mov = 0 let arr = 0 let scr = 0 let idx = 0 let arr2 = 0 let scr2 = 0 let num_trans = 0 let num_dev = 0 let valor_total = 0 let total_desglozado = 0 let total_dev_desg = 0 let monto_pagado = 0 let total_devolver = 0 let desglozar = "NO" let desglozar_Dev = "NO" let insertar = "NO" DISPLAY BY NAME DESCRIPCION_CLIENTE, DESCRIPCION_CIA,DESCRIPCION_BANCO, descripcion_doc,VALOR_TOTAL call adicionar2() COMMAND "Reimprimir" "Reimprime recibos realizados" let int_flag = false CLEAR FORM let int_flag = false let cotiza.tipo_doc = null let cotiza.orden = null let ing_egre.tipo_doc = null let ing_egre.tipo_cliente = null let ing_egre.sec_cliente = null let ing_egre.tipo_tarjeta = null let ing_egre.referencia = null let ing_egre.banco = null let ing_egre.otro_valor = 0.00 let ing_egre.valor_efectivo = 0.00 let ing_egre.observacion = null let insertar = "NO" let descripcion_cliente = null let descripcion_cia = null let descripcion_banco = null let descripcion_doc = null let num_oc = 0 let status_mov = 0 let arr = 0 let scr = 0 let idx = 0 let arr2 = 0 let scr2 = 0 let num_trans = 0 let num_dev = 0 let valor_total = 0 let total_desglozado = 0 let total_dev_desg = 0 let monto_pagado = 0 let total_devolver = 0 let desglozar = "NO" let desglozar_Dev = "NO" let insertar = "NO" call reimprime_caja() COMMAND "Anular" "Anular Movimiento de caja" let int_flag = false CLEAR FORM let int_flag = false let cotiza.tipo_doc = null let cotiza.orden = null let ing_egre.tipo_doc = null let ing_egre.tipo_cliente = null let ing_egre.sec_cliente = null let ing_egre.tipo_tarjeta = null let ing_egre.referencia = null let ing_egre.banco = null let ing_egre.otro_valor = 0.00 let ing_egre.valor_efectivo = 0.00 let ing_egre.observacion = null let insertar = "NO" let descripcion_cliente = null let descripcion_cia = null let descripcion_banco = null let descripcion_doc = null let num_oc = 0 let status_mov = 0 let arr = 0 let scr = 0 let idx = 0 let arr2 = 0 let scr2 = 0 let num_trans = 0 let num_dev = 0 let valor_total = 0 let total_desglozado = 0 let total_dev_desg = 0 let monto_pagado = 0 let total_devolver = 0 let desglozar = "NO" let desglozar_Dev = "NO" let insertar = "NO" call anular_caja() COMMAND "Recuperar" "Recuperar Movimiento de caja" let int_flag = false CLEAR FORM let int_flag = false let cotiza.tipo_doc = null let cotiza.orden = null let ing_egre.tipo_doc = null let ing_egre.tipo_cliente = null let ing_egre.sec_cliente = null let ing_egre.tipo_tarjeta = null let ing_egre.referencia = null let ing_egre.banco = null let ing_egre.otro_valor = 0.00 let ing_egre.valor_efectivo = 0.00 let ing_egre.observacion = null let insertar = "NO" let descripcion_cliente = null let descripcion_cia = null let descripcion_banco = null let descripcion_doc = null let num_oc = 0 let status_mov = 0 let arr = 0 let scr = 0 let idx = 0 let arr2 = 0 let scr2 = 0 let num_trans = 0 let num_dev = 0 let valor_total = 0 let total_desglozado = 0 let total_dev_desg = 0 let monto_pagado = 0 let total_devolver = 0 let desglozar = "NO" let desglozar_Dev = "NO" let insertar = "NO" call recuperar_caja() COMMAND "Salir" "Retorna Menu Anterior" EXIT MENU END MENU END FUNCTION function anular_caja() input by name ing_egre.cod_cia,ing_egre.tipo_doc,num_oc after field cod_cia select unique nombre into descripcion_cia from companias where cod_comp=ing_egre.cod_cia IF STATUS = NOTFOUND THEN CALL fgl_winmessage("Error","No valido","stop") next field cod_cia END IF display by name descripcion_cia after field tipo_doc if (ing_egre.tipo_doc is not null) or (ing_egre.tipo_doc <> 0 ) then select unique a.descripcion,a.status_mov,a.cxc into descripcion_doc,status_mov,cxc from cctb00021 a where a.tipo_doc= ing_egre.tipo_doc and a.status_t is null and a.cod_cia=ing_egre.cod_cia IF STATUS = NOTFOUND THEN CALL fgl_winmessage("Error","No valido","stop") next field tipo_doc END IF else CALL fgl_winmessage("Error","No valido","stop") next field tipo_doc end if display by name descripcion_doc after field num_oc if (num_oc is not null) and (num_oc <> 0) and (num_oc > 0) then select a.fecha,a.tipo_cliente,a.sec_cliente,a.factura,a.tipo_tarjeta, a.referencia,a.valor_efectivo,a.otro_valor,a.observacion,a.devuelta, a.num_trans,a.tipo_aplica,banco into fecha_doc,ing_egre.tipo_cliente,ing_egre.sec_cliente,cotiza.orden, ing_egre.tipo_tarjeta,ing_egre.referencia,ing_egre.valor_efectivo, ing_egre.otro_valor,ing_egre.observacion,total_devolver,num_trans, cotiza.tipo_doc,ing_egre.banco from cctb00020 a where a.tipo_doc=ing_egre.tipo_doc and a.cod_cia=ing_egre.cod_cia and a.num_oc=num_oc and a.status_t is null IF STATUS = NOTFOUND THEN CALL fgl_winmessage("No existe","No se encontro el registro","stop") return END IF if (ing_egre.tipo_cliente > 0) and (ing_egre.sec_cliente > 0) then select a.nombre,a.telefono,a.num_rnc into descripcion_cliente,telefono_cli,num_rnc from vetb00004 a where a.tipo_cliente=ing_egre.tipo_cliente and a.sec_cliente=ing_egre.sec_cliente end if if ing_egre.valor_efectivo is null then let ing_egre.valor_efectivo=0 end if if ing_egre.otro_valor is null then let ing_egre.otro_valor=0 end if let valor_total=ing_egre.valor_efectivo+ing_egre.otro_valor let monto_pagado=valor_total+total_devolver if ing_egre.banco is not null then select nombre_bc into descripcion_banco from bancos where cod_banco=ing_egre.banco display by name descripcion_banco end if display by name valor_total,descripcion_cliente display by name ing_egre.* end if LET opc2 = fgl_winquestion("Confirmacion","Desea anular el documento","Yes","Yes|No","question",1) IF opc2="Yes" then update cctb00020 set cctb00020.status_t="E",cctb00020.us_mod=suser_sname(),cctb00020.fech_mod=getdate() where cctb00020.cod_cia=ing_egre.cod_cia and cctb00020.tipo_doc=ing_egre.tipo_doc and cctb00020.num_oc=num_oc and status_t is null call fgl_winmessage("Exito","Se ha anulado correctamente el documento","confirmation") end if end input end function function recuperar_caja() input by name ing_egre.cod_cia,ing_egre.tipo_doc,num_oc after field cod_cia select unique nombre into descripcion_cia from companias where cod_comp=ing_egre.cod_cia IF STATUS = NOTFOUND THEN CALL fgl_winmessage("Error","No valido","stop") next field cod_cia END IF display by name descripcion_cia after field tipo_doc if (ing_egre.tipo_doc is not null) or (ing_egre.tipo_doc <> 0 ) then select unique a.descripcion,a.status_mov,a.cxc into descripcion_doc,status_mov,cxc from cctb00021 a where a.tipo_doc= ing_egre.tipo_doc and a.status_t is null and a.cod_cia=ing_egre.cod_cia IF STATUS = NOTFOUND THEN CALL fgl_winmessage("Error","No valido","stop") next field tipo_doc END IF else CALL fgl_winmessage("Error","No valido","stop") next field tipo_doc end if display by name descripcion_doc after field num_oc if (num_oc is not null) and (num_oc <> 0) and (num_oc > 0) then select a.fecha,a.tipo_cliente,a.sec_cliente,a.factura,a.tipo_tarjeta, a.referencia,a.valor_efectivo,a.otro_valor,a.observacion,a.devuelta, a.num_trans,a.tipo_aplica,banco into fecha_doc,ing_egre.tipo_cliente,ing_egre.sec_cliente,cotiza.orden, ing_egre.tipo_tarjeta,ing_egre.referencia,ing_egre.valor_efectivo, ing_egre.otro_valor,ing_egre.observacion,total_devolver,num_trans, cotiza.tipo_doc,ing_egre.banco from cctb00020 a where a.tipo_doc=ing_egre.tipo_doc and a.cod_cia=ing_egre.cod_cia and a.num_oc=num_oc and a.status_t is not null IF STATUS = NOTFOUND THEN CALL fgl_winmessage("No existe","No se encontro el registro","stop") return END IF if (ing_egre.tipo_cliente > 0) and (ing_egre.sec_cliente > 0) then select a.nombre,a.telefono,a.num_rnc into descripcion_cliente,telefono_cli,num_rnc from vetb00004 a where a.tipo_cliente=ing_egre.tipo_cliente and a.sec_cliente=ing_egre.sec_cliente end if if ing_egre.valor_efectivo is null then let ing_egre.valor_efectivo=0 end if if ing_egre.otro_valor is null then let ing_egre.otro_valor=0 end if let valor_total=ing_egre.valor_efectivo+ing_egre.otro_valor let monto_pagado=valor_total+total_devolver if ing_egre.banco is not null then select nombre_bc into descripcion_banco from bancos where cod_banco=ing_egre.banco display by name descripcion_banco end if display by name valor_total,descripcion_cliente display by name ing_egre.* end if LET opc2 = fgl_winquestion("Confirmacion","Desea recuperar el documento","Yes","Yes|No","question",1) IF opc2="Yes" then update cctb00020 set cctb00020.status_t=null,cctb00020.us_mod=suser_sname(),cctb00020.fech_mod=getdate() where cctb00020.cod_cia=ing_egre.cod_cia and cctb00020.tipo_doc=ing_egre.tipo_doc and cctb00020.num_oc=num_oc and status_t is not null call fgl_winmessage("Exito","Se ha recuperado correctamente el documento","confirmation") end if end input end function function reimprime_caja() input by name ing_egre.cod_cia,ing_egre.tipo_doc,num_oc after field cod_cia select unique nombre into descripcion_cia from companias where cod_comp=ing_egre.cod_cia IF STATUS = NOTFOUND THEN CALL fgl_winmessage("Error","No valido","stop") next field cod_cia END IF display by name descripcion_cia after field tipo_doc if (ing_egre.tipo_doc is not null) or (ing_egre.tipo_doc <> 0 ) then select unique a.descripcion,a.status_mov,a.cxc into descripcion_doc,status_mov,cxc from cctb00021 a where a.tipo_doc= ing_egre.tipo_doc and a.status_t is null and a.cod_cia=ing_egre.cod_cia IF STATUS = NOTFOUND THEN CALL fgl_winmessage("Error","No valido","stop") next field tipo_doc END IF else CALL fgl_winmessage("Error","No valido","stop") next field tipo_doc end if display by name descripcion_doc after field num_oc if (num_oc is not null) and (num_oc <> 0) and (num_oc > 0) then select a.fecha,a.tipo_cliente,a.sec_cliente,a.factura,a.tipo_tarjeta, a.referencia,a.valor_efectivo,a.otro_valor,a.observacion,a.devuelta, a.num_trans,a.tipo_aplica,banco into fecha_doc,ing_egre.tipo_cliente,ing_egre.sec_cliente,cotiza.orden, ing_egre.tipo_tarjeta,ing_egre.referencia,ing_egre.valor_efectivo, ing_egre.otro_valor,ing_egre.observacion,total_devolver,num_trans, cotiza.tipo_doc,ing_egre.banco from cctb00020 a where a.tipo_doc=ing_egre.tipo_doc and a.cod_cia=ing_egre.cod_cia and a.num_oc=num_oc and a.status_t is null IF STATUS = NOTFOUND THEN CALL fgl_winmessage("No existe","No se encontro el registro","stop") return END IF if (ing_egre.tipo_cliente > 0) and (ing_egre.sec_cliente > 0) then select a.nombre,a.telefono,a.num_rnc into descripcion_cliente,telefono_cli,num_rnc from vetb00004 a where a.tipo_cliente=ing_egre.tipo_cliente and a.sec_cliente=ing_egre.sec_cliente end if let formdoc="Reimpresion" if ing_egre.valor_efectivo is null then let ing_egre.valor_efectivo=0 end if if ing_egre.otro_valor is null then let ing_egre.otro_valor=0 end if let valor_total=ing_egre.valor_efectivo+ing_egre.otro_valor let monto_pagado=valor_total+total_devolver if ing_egre.banco is not null then select nombre_bc into descripcion_banco from bancos where cod_banco=ing_egre.banco display by name descripcion_banco end if display by name valor_total,descripcion_cliente display by name ing_egre.* end if LET opc2 = fgl_winquestion("Confirmacion","Desea procesar la factura?","Yes","Yes|No","question",1) IF opc2="Yes" then call procesar_impresion() return end if end input end function FUNCTION adicionar2() let formdoc="ORIGINAL" INPUT BY NAME ing_egre.* WITHOUT DEFAULTS before input select sucursal into ing_egre.cod_cia from seg0000 where usuario=suser_sname() select nombre into descripcion_cia from companias where cod_comp=ing_egre.cod_cia display by name ing_egre.cod_cia,descripcion_cia let ing_egre.valor_efectivo=0.00 let ing_egre.otro_valor=0.00 display by name ing_egre.valor_efectivo,ing_egre.otro_valor after field cajera if (ing_egre.cajera is null) or (ing_egre.cajera=0 ) or (ing_egre.cajera < 0 )then CALL fgl_winmessage("Error","No valido","stop") next field cajera end if select unique c.nom1_emp +' '+ c.apell1_emp into nombre_cajera from adtb00003 c where c.num_emp=ing_egre.cajera IF STATUS = NOTFOUND THEN CALL fgl_winmessage("Error","No valido","stop") let nombre_cajera="" display by name nombre_cajera next field cajera END IF display by name nombre_cajera after field cobrador if (ing_egre.cobrador is not null) and (ing_egre.cobrador <> 0 ) or (ing_egre.cobrador > 0 )then select unique c.nom1_emp +' '+ c.apell1_emp into nombre_cobrador from adtb00003 c where c.num_emp=ing_egre.cobrador IF STATUS = NOTFOUND THEN CALL fgl_winmessage("Error","No valido","stop") let nombre_cobrador="" display by name nombre_cobrador next field cobrador END IF display by name nombre_cobrador end if after field sec_cliente if (ing_egre.sec_cliente is not null) and (ing_egre.tipo_cliente is not null) and (ing_egre.sec_cliente <> 0) and (ing_egre.tipo_cliente <> 0) then select a.nombre,a.telefono,a.num_rnc into descripcion_cliente,telefono_cli,num_rnc from vetb00004 a where a.tipo_cliente=ing_egre.tipo_cliente and a.sec_cliente=ing_egre.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 descripcion_cliente end if after field tipo_doc if (ing_egre.tipo_doc is not null) or (ing_egre.tipo_doc <> 0 ) then select unique a.descripcion,a.status_mov,a.cxc into descripcion_doc,status_mov,cxc from cctb00021 a where a.tipo_doc= ing_egre.tipo_doc and a.status_t is null and a.cod_cia=ing_egre.cod_cia IF STATUS = NOTFOUND THEN CALL fgl_winmessage("Error","No valido","stop") next field tipo_doc END IF else CALL fgl_winmessage("Error","No valido","stop") next field tipo_doc end if display by name descripcion_doc if cxc="S" then OPEN window vefmwd018 AT 4,10 with form "vefmwd018" ATTRIBUTE (BORDER, form line first + 1) input by name COTIZA.TIPO_DOC,COTIZA.ORDEN ON KEY (F10) if (cotiza.monto_inicial is null) or (cotiza.monto_inicial =0) then CALL fgl_winmessage("Error","Monto aplicar en Cero","stop") return end if if cotiza.monto_inicial < 0 then let cotiza.monto_inicial=cotiza.monto_inicial*-1 end if if cotiza.cond_pago=1 then CALL fgl_winmessage("Error","Esta cotizacion es a contado debe ser a credito","stop") return end if LET ING_EGRE.TIPO_CLIENTE=COTIZA.TIPO_CLIENTE LET ING_EGRE.SEC_CLIENTE=COTIZA.SEC_CLIENTE EXIT INPUT CLOSE WINDOW VEFMWD018 DISPLAY BY NAME ING_EGRE.TIPO_CLIENTE,ING_EGRE.SEC_CLIENTE ON KEY (F5) INITIALIZE COTIZA.* TO NULL CALL fgl_winmessage("Cancelacion","Operacion Cancelada","stop") RETURN BEFORE INPUT DISPLAY "ACEPTAR" TO ACEPTAR DISPLAY "CANCELAR" TO CANCELAR LET COTIZA.TIPO_DOC="CT" DISPLAY COTIZA.TIPO_DOC IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = false RETURN END IF AFTER FIELD TIPO_DOC IF COTIZA.TIPO_DOC=ING_EGRE.TIPO_DOC THEN NEXT FIELD TIPO_DOC END IF after input IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = false RETURN END IF if cotiza.orden is not null then IF COTIZA.TIPO_DOC="CT" THEN LET SELEC_coti = "select a.cond_pago,a.nombre,a.tipo_cliente,a.sec_cliente,", " a.neto,a.monto_adicional,a.monto_inicial,a.fecha_orden", " from vetb00050 a ", " where a.status_t is null and a.orden=",cotiza.orden, " and a.cod_cia=",ing_egre.cod_cia ELSE LET SELEC_coti = "select 2,'',a.tipo_cliente,a.sec_cliente,", " a.valor,0,a.valor,a.fecha_orig", " from cctb00001 a ", " where a.status_t is null and a.num_doc=",cotiza.orden, " and a.cod_cia=",ing_egre.cod_cia, " and a.tipo_doc='",cotiza.tipo_doc clipped,"'" END IF PREPARE busca2 FROM selec_coti # CALL integridad() #IF bandera = 1 THEN # LET bandera = 0 # RETURN #END IF DECLARE datos2 SCROLL CURSOR FOR busca2 OPEN datos2 FETCH FIRST datos2 INTO cotiza.cond_pago,cotiza.nombre,cotiza.tipo_cliente,cotiza.sec_cliente, cotiza.neto,cotiza.monto_adicional,cotiza.monto_inicial,cotiza.fecha_orden # IF status >= 0 THEN IF STATUS = NOTFOUND THEN LET numero_msg = 3 CALL msg(numero_msg) RETURN END IF # ELSE # CALL integridad() # IF bandera = 1 THEN # LET bandera = 0 # RETURN # END IF # END IF select unique a.nombre into cotiza.nombre from vetb00004 a where a.tipo_cliente=cotiza.tipo_cliente and a.sec_cliente=cotiza.sec_cliente display by name cotiza.nombre,cotiza.tipo_cliente,cotiza.sec_cliente, cotiza.neto,cotiza.monto_adicional,cotiza.monto_inicial,cotiza.fecha_orden NEXT FIELD ORDEN end if end input close window vefmwd018 if cotiza.orden is null then next field tipo_doc else next field sec_cliente end if end if after field referencia if ing_egre.tipo_tarjeta <> "Efectivo" then if ing_egre.referencia is null then CALL fgl_winmessage("Error","No valido","stop") next field referencia end if end if after field banco if (ing_egre.banco is not null) and (ing_egre.tipo_tarjeta <> "Efectivo") and (ing_egre.banco <> 0)then select nombre_bc into descripcion_banco from bancos where cod_banco=ing_egre.banco display by name descripcion_banco next field otro_valor else let descripcion_banco=null display by name descripcion_banco next field tipo_tarjeta end if after field tipo_tarjeta IF CXC="S" THEN if ING_EGRE.TIPO_TARJETA="Efectivo" then let ing_egre.valor_efectivo=cotiza.monto_inicial let ing_egre.otro_valor=0 display by name ing_egre.valor_efectivo else let ing_egre.otro_valor=cotiza.monto_inicial let ing_egre.valor_efectivo=0 display by name ing_egre.otro_valor end if END IF if ing_egre.tipo_tarjeta="Efectivo" then let ing_egre.banco=null display by name ing_egre.banco next field valor_efectivo else next field referencia end if after field valor_efectivo IF (CXC="S") and (ING_EGRE.TIPO_TARJETA="Efectivo" )THEN if ing_egre.valor_efectivo <> cotiza.monto_inicial then let ing_egre.valor_efectivo=cotiza.monto_inicial display by name ing_egre.valor_efectivo end if END IF if ing_egre.valor_efectivo is null then let ing_egre.valor_efectivo=0.00 let desglozar="NO" let desglozar_dev="NO" end if if ing_egre.otro_valor is null then let ing_egre.otro_valor=0.00 let desglozar="NO" let desglozar_dev="NO" end if if ing_egre.valor_efectivo is not null then let valor_total=ing_egre.valor_efectivo + ing_egre.otro_valor display by name valor_total end if if ing_egre.tipo_tarjeta="Efectivo" then let ing_egre.otro_valor=0.00 let valor_total=ing_egre.valor_efectivo + ing_egre.otro_valor let desglozar="SI" display by name ing_egre.otro_valor, valor_total else if ing_egre.valor_Efectivo > 0 then let valor_total=ing_egre.valor_efectivo + ing_egre.otro_valor let desglozar="SI" display by name ing_egre.otro_valor, ing_egre.valor_efectivo,valor_total else let valor_total=ing_egre.valor_efectivo + ing_egre.otro_valor let desglozar="NO" display by name ing_egre.otro_valor, ing_egre.valor_efectivo,valor_total end if end if if ing_egre.tipo_tarjeta="Efectivo" and (ing_egre.valor_efectivo <=0) then let ing_egre.otro_valor=0.00 CALL fgl_winmessage("Error","No valido","stop") next field valor_efectivo end if after field otro_valor IF (CXC="S") and (ING_EGRE.TIPO_TARJETA <> "Efectivo" )THEN if ing_egre.otro_valor <> cotiza.monto_inicial then let ing_egre.otro_valor=cotiza.monto_inicial display by name ing_egre.otro_valor end if END IF if ing_egre.valor_efectivo is null then let ing_egre.valor_efectivo=0.00 let valor_total=ing_egre.valor_efectivo + ing_egre.otro_valor let desglozar="NO" display by name ing_egre.otro_valor, ing_egre.valor_efectivo,valor_total end if if ing_egre.otro_valor is null then let ing_egre.otro_valor=0.00 end if if (ing_egre.otro_valor is not null) and (ing_egre.otro_valor > 0)then let valor_total=ing_egre.valor_efectivo + ing_egre.otro_valor display by name valor_total,ing_egre.otro_valor end if after field observacion if ((ing_egre.sec_cliente is null) or (ing_egre.tipo_cliente is null) or (ing_egre.sec_cliente=0) or (ing_egre.tipo_cliente=0)) and (ing_egre.observacion is null )then CALL fgl_winmessage("Error","Debe especificar una observacion","stop") next field observacion end if if ((ing_egre.sec_cliente is not null) or (ing_egre.tipo_cliente is not null) or (ing_egre.sec_cliente <> 0) or (ing_egre.tipo_cliente <> 0)) and (ing_egre.observacion is null )then Let ing_egre.observacion=ing_egre.tipo_doc," aplicado a ",ing_egre.tipo_cliente using "#","-",ing_egre.sec_cliente using "####"," ",descripcion_cliente display by name ing_egre.observacion end if if ing_egre.valor_efectivo > 0 then let desglozar="SI" else if ing_egre.otro_valor > 0 then let desglozar="NO" let insertar="SI" end if let desglozar="NO" end if LET opc2 = fgl_winquestion("Confirmacion","Toda la informacion es correcta?","Yes","Yes|No","question",1) IF opc2="Yes" then if desglozar="SI" then Call desglozar() end if if insertar="SI" then LET opc2 = fgl_winquestion("Confirmacion","Seguro que desea realizar la transaccion?","Yes","Yes|No","question",1) IF opc2="Yes" then call inserta_veprmt014() call procesar_impresion() else next field tipo_doc end if end if # else # if insertar="SI" then # LET opc2 = fgl_winquestion("Confirmacion","Seguro que desea realizar la transaccion?","Yes","Yes|No","question",1) # IF opc2="Yes" then # call inserta_veprmt014() # else # next field tipo_doc # end if # end if # end if # else # if insertar="SI" then # LET opc2 = fgl_winquestion("Confirmacion","Seguro que desea realizar la transaccion?","Yes","Yes|No","question",1) # IF opc2="Yes" then # call inserta_veprmt014() # else # next field tipo_doc # end if # end if #End if else next field tipo_doc end if END INPUT end function Function inserta_veprmt014() let fecha_doc=today #buscar secuencia de la tabla de tipos de documentos select unique secuencia into num_oc from cctb00021 a where a.cod_cia= ing_egre.cod_cia and a.tipo_doc=ing_egre.tipo_doc and a.status_t is null IF STATUS = NOTFOUND THEN return END IF if num_oc is null then let num_oc =0 end if let num_oc=num_oc+1 #busco el numero de transaccion. select unique secuencia into num_trans from cctb00021 a where a.tipo_doc="TS" and a.status_t is null and a.cod_cia=ing_egre.cod_cia #SI NO EXISTE INSERTO EL REGISTRO DE LA SECUENCIA DE TRANSACCION IF STATUS = NOTFOUND THEN insert into cctb00021(cod_cia,tipo_doc,descripcion,status_mov,status_t,us_crea,fech_crea,secuencia) values(ing_egre.cod_cia,"TS","TRANSACCIONES",0,NULL,SUSER_SNAME(),GETDATE(),0) LET NUM_TRANS=0 END IF if NUM_TRANS is null then let num_trans =0 end if let NUM_TRANS=num_TRANS+1 update cctb00021 set cctb00021 .secuencia=NUM_TRANS where cctb00021.tipo_doc="TS" and cctb00021.status_t is null and cctb00021.cod_cia=ing_egre.cod_cia #insertar datos en la tabla de cuadre if status_mov=1 then if cxc="S" then insert into cctb00020(cod_cia,tipo_doc,num_oc,fecha,tipo_cliente,sec_cliente,tipo_tarjeta,banco,referencia, valor_efectivo,otro_valor,observacion,factura,status_t,us_crea,fech_crea,devuelta,NUM_TRANS, tipo_aplica,cajera,cobrador) values(ing_egre.cod_cia,ing_egre.tipo_doc,num_oc,today,ing_egre.tipo_cliente,ing_egre.sec_cliente, ing_egre.tipo_tarjeta,ing_egre.banco,ing_egre.referencia,ing_egre.valor_efectivo,ing_egre.otro_valor, ing_egre.observacion,cotiza.orden,null,suser_sname(),getdate(),total_devolver,NUM_TRANS,cotiza.tipo_doc, ing_egre.cajera,ing_egre.cobrador) INSERT INTO cctb00001(cod_cia,tipo_doc,num_doc,tipo_cliente,sec_cliente,fecha_orig, fecha_ven,aplica_a,valor,valor_efectivo,valor_cheque,costo,status_t,fech_crea,us_crea) VALUES (ing_egre.cod_cia,ing_egre.tipo_doc,num_oc, ing_egre.tipo_cliente,ing_egre.sec_cliente,getdate(),getdate(), COTIZA.ORDEN,((ing_egre.valor_efectivo + ing_egre.otro_valor)*-1),0,0,0,null,getdate(),suser_sname()) else insert into cctb00020(cod_cia,tipo_doc,num_oc,fecha,tipo_cliente,sec_cliente,tipo_tarjeta,banco,referencia, valor_efectivo,otro_valor,observacion,factura,status_t,us_crea,fech_crea,devuelta,NUM_TRANS, cajera,cobrador) values(ing_egre.cod_cia,ing_egre.tipo_doc,num_oc,today,ing_egre.tipo_cliente,ing_egre.sec_cliente, ing_egre.tipo_tarjeta,ing_egre.banco,ing_egre.referencia,ing_egre.valor_efectivo,ing_egre.otro_valor, ing_egre.observacion,null,null,suser_sname(),getdate(),total_devolver,NUM_TRANS,ing_egre.cajera,ing_egre.cobrador) end if else IF cxc="S" then insert into cctb00020(cod_cia,tipo_doc,num_oc,fecha,tipo_cliente,sec_cliente,tipo_tarjeta,banco,referencia, valor_efectivo,otro_valor,observacion,factura,status_t,us_crea,fech_crea,devuelta,NUM_TRANS,tipo_aplica,cajera,cobrador) values(ing_egre.cod_cia,ing_egre.tipo_doc,num_oc,TODAY,ing_egre.tipo_cliente,ing_egre.sec_cliente, ing_egre.tipo_tarjeta,ing_egre.banco,ing_egre.referencia,(ing_egre.valor_efectivo*(-1)),(ing_egre.otro_valor*(-1)), ing_egre.observacion,cotiza.orden,null,suser_sname(),getdate(),total_devolver,NUM_TRANS,cotiza.tipo_doc,ing_egre.cajera,ing_egre.cobrador) INSERT INTO cctb00001(cod_cia,tipo_doc,num_doc,tipo_cliente,sec_cliente,fecha_orig, fecha_ven,aplica_a,valor,valor_efectivo,valor_cheque,costo,status_t,fech_crea,us_crea) VALUES (ing_egre.cod_cia,ing_egre.tipo_doc,num_oc, ing_egre.tipo_cliente,ing_egre.sec_cliente,getdate(),getdate(), COTIZA.ORDEN,(ing_egre.valor_efectivo + ing_egre.otro_valor),0,0,0,null,getdate(),suser_sname()) else insert into cctb00020(cod_cia,tipo_doc,num_oc,fecha,tipo_cliente,sec_cliente,tipo_tarjeta,banco,referencia, valor_efectivo,otro_valor,observacion,factura,status_t,us_crea,fech_crea,devuelta,NUM_TRANS,cajera,cobrador) values(ing_egre.cod_cia,ing_egre.tipo_doc,num_oc,TODAY,ing_egre.tipo_cliente,ing_egre.sec_cliente, ing_egre.tipo_tarjeta,ing_egre.banco,ing_egre.referencia,(ing_egre.valor_efectivo*(-1)),(ing_egre.otro_valor*(-1)), ing_egre.observacion,null,null,suser_sname(),getdate(),total_devolver,NUM_TRANS,ing_egre.cajera,ing_egre.cobrador) end if end if #actualizar tabla de tipos de documentos update cctb00021 set cctb00021.secuencia=num_oc where cctb00021.tipo_doc=ing_egre.tipo_doc and cctb00021.cod_cia=ing_egre.cod_cia and cctb00021.status_t is null let idx=0 { #inserta desgloce if desglozar="SI" then if status_mov=1 then for idx=1 to arr if desgloce[idx].cantidad > 0 then insert into cctb00023(cod_cia,num_doc,fecha,cod_moneda,cantidad,valor,tipo_doc,tasa,status_t,us_crea,fech_crea,NUM_TRANS) values(ing_egre.cod_cia,num_oc,getdate(),Desgloce[idx].cod_moneda,Desgloce[idx].cantidad,Desgloce[idx].valor, ing_egre.tipo_doc,desgloce[idx].tasa, null,suser_sname(),getdate(),NUM_TRANS) end if end for else for idx=1 to arr_count() if desgloce[idx].cantidad > 0 then insert into cctb00023(cod_cia,num_doc,fecha,cod_moneda,cantidad,valor,tipo_doc,tasa,status_t,us_crea,fech_crea,NUM_TRANS) values(ing_egre.cod_cia,num_oc,getdate(),Desgloce[idx].cod_moneda,(Desgloce[idx].cantidad*(-1)),Desgloce[idx].valor, ing_egre.tipo_doc,desgloce[idx].tasa,null,suser_sname(),getdate(),NUM_TRANS) end if end for end if end if } #idetifico si hay un devoluciones , por lo tanto genero un ks(salida por cambio) { if desglozar_dev="SI" then #buscar secuencia de salida por cambio (ks) select unique secuencia into num_dev from cctb00021 a where a.tipo_doc="KS" and a.status_t is null and a.cod_cia=ing_egre.cod_cia #SI NO EXISTE ENTONCES INSERTO ESTE TIPO DE DOCUMENTO YA QUE ES CASI OBLIGATORIO IF STATUS = NOTFOUND THEN insert into cctb00021(cod_cia,tipo_doc,descripcion,status_mov,status_t,us_crea,fech_crea,secuencia) values(ing_egre.cod_cia,"KS","SALIDA POR CAMBIO",2,NULL,SUSER_SNAME(),GETDATE(),0) LET NUM_DEV=0 END IF if num_dev is null then let num_dev =0 end if let num_dev=num_dev+1 update cctb00021 set cctb00021 .secuencia=num_dev where cctb00021.tipo_doc="KS" and cctb00021.status_t is null and cctb00021.cod_cia=ing_egre.cod_cia for idx=1 to arr2 if desgloce_dev[idx].cantidad1 > 0 then insert into cctb00023(cod_cia,num_doc,fecha,cod_moneda,cantidad,valor,tipo_doc,tasa,status_t,us_crea,fech_crea,NUM_TRANS) values(ing_egre.cod_cia,num_dev,getdate(),Desgloce_dev[idx].cod_moneda1, (Desgloce_dev[idx].cantidad1*(-1)),Desgloce_dev[idx].valor1, "KS",desgloce_dev[idx].tasa1,null,suser_sname(),getdate(),NUM_TRANS) end if end for end if } CALL FGL_WINMESSAGE("Gravado","Se ha gravado exitosamente,prepare la impresora para su impresion ","information") End Function function desglozar() OPEN window vefmmt024 AT 4,10 with form "vefmmt024" ATTRIBUTE (BORDER, form line first + 1) display ing_egre.valor_efectivo to total_a input by name monto_pagado before input after input IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE Let insertar ="NO" Let desglozar ="NO" Let desglozar_Dev="NO" return END IF let total_devolver=0 if monto_pagado > ing_egre.valor_efectivo then let total_devolver=monto_pagado-ing_egre.valor_efectivo display by name total_devolver let insertar="SI" end if if monto_pagado < ing_egre.valor_efectivo then CALL fgl_winmessage("Error","El monto a pagar no puede ser menor en efectivo a pagar","stop") continue input end if let insertar="SI" end input close window vefmmt024 end function ######################################################## { function desglozar() OPEN window vefmmt024 AT 4,10 with form "vefmmt024" ATTRIBUTE (BORDER, form line first + 1) display ing_egre.valor_efectivo to total_a input by name monto_pagado before input if ing_egre.tipo_doc="ke" then let monto_pagado=ing_egre.valor_efectivo display by name monto_pagado end if after input IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE Let insertar ="NO" Let desglozar ="NO" Let desglozar_Dev="NO" return END IF if monto_pagado > ing_egre.valor_efectivo then let total_devolver=monto_pagado-ing_egre.valor_efectivo display by name total_devolver end if if ing_egre.tipo_doc="ke" then let total_devolver=ing_egre.valor_efectivo display by name total_devolver end if if monto_pagado < ing_egre.valor_efectivo then CALL fgl_winmessage("Error","El monto a pagar no puede ser menor en efectivo a pagar","stop") continue input end if DECLARE busca_moneda CURSOR FOR select a.cod_moneda,a.descripcion,b.simbolo,b.tasa_cambio,a.valor,0,0.00 from cctb00022 a,cotb00031 b where a.status_t is null and b.status_t is null and b.cod_mon=a.tipo_moneda order by a.valor let idx=1 FOREACH busca_moneda INTO desgloce[idx].* LET idx = idx + 1 END FOREACH CALL set_count(idx-1) let idx=1 FOREACH busca_moneda INTO desgloce_dev[idx].* LET idx = idx + 1 END FOREACH CALL set_count(idx-1) end input input array Desgloce WITHOUT DEFAULTS from desgloce_scr.* before row if (monto_pagado is null) or (monto_pagado=0) or (monto_pagado< ing_egre.valor_efectivo) then exit input close window vefmmt024 end if let arr=arr_curr() LET scr = scr_line() after field cod_moneda if desgloce[arr].cod_moneda is not null then select a.descripcion,a.valor,b.simbolo,b.tasa_cambio into desgloce[arr].descripcion_m,desgloce[arr].valor, desgloce[arr].simbolo,desgloce[arr].tasa from cctb00022 a,cotb00031 b where a.cod_moneda=desgloce[arr].cod_moneda and a.status_t is null and b.cod_mon=a.tipo_moneda and b.status_t is null IF STATUS = NOTFOUND THEN CALL fgl_winmessage("Error","No valido","stop") next field cod_moneda END IF let idx=0 for idx=1 to arr_count() if (desgloce[arr_curr()].cod_moneda= desgloce[idx].cod_moneda)and (idx<>arr_curr()) then CALL fgl_winmessage("Error","Codigo Repetido","stop") next field cod_moneda end if end for end if display desgloce[arr].descripcion_m to desgloce_scr[scr].descripcion_m display desgloce[arr].valor to desgloce_scr[scr].valor display desgloce[arr].tasa to desgloce_scr[scr].tasa display desgloce[arr].simbolo to desgloce_scr[scr].simbolo after field cantidad if (desgloce[arr].cantidad is not null) and (desgloce[arr].cantidad >= 0 )then let desgloce[arr].total=desgloce[arr].tasa*desgloce[arr].valor*desgloce[arr].cantidad call after_desg() if total_desglozado > monto_pagado then CALL fgl_winmessage("Error","monto desglozado mayor que monto pagado","stop") display by name total_desglozado next field cod_moneda end if display desgloce[arr].total to desgloce_scr[scr].total else CALL fgl_winmessage("Error","No valido","stop") next field cantidad end if after row IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE Let insertar ="NO" Let desglozar ="NO" Let desglozar_Dev="NO" return END IF call after_desg() if (total_desglozado=monto_pagado) then if ing_egre.tipo_doc="ke" then let total_devolver=ing_egre.valor_efectivo display by name total_devolver else let total_devolver=monto_pagado - ing_egre.valor_efectivo display by name total_devolver end if if (total_devolver is not null) and (total_devolver > 0)then let desglozar_Dev="SI" let arr2=arr_count() call desglozar_dev() exit input end if let insertar="SI" end if display by name total_desglozado if total_desglozado > monto_pagado then CALL fgl_winmessage("Error","monto desglozado mayor que monto pagado","stop") next field cod_moneda end if end input close window vefmmt024 end function function desglozar_dev() input array Desgloce_dev WITHOUT DEFAULTS from desgloce_dev_scr.* before row let arr2=arr_curr() LET scr2 = scr_line() after field cod_moneda1 if desgloce_dev[arr2].cod_moneda1 is not null then select a.descripcion,a.valor,b.simbolo,b.tasa_cambio into desgloce_dev[arr2].descripcion_m1,desgloce_dev[arr2].valor1, desgloce_dev[arr].simbolo1,desgloce_dev[arr2].tasa1 from cctb00022 a,cotb00031 b where a.cod_moneda=desgloce_dev[arr2].cod_moneda1 and a.status_t is null and b.cod_mon=a.tipo_moneda and b.status_t is null IF STATUS = NOTFOUND THEN CALL fgl_winmessage("Error","No valido","stop") next field cod_moneda1 END IF let idx=0 for idx=1 to arr_count() if (desgloce_dev[arr_curr()].cod_moneda1= desgloce_dev[idx].cod_moneda1)and (idx<>arr_curr()) then CALL fgl_winmessage("Error","Codigo Repetido","stop") next field cod_moneda1 end if end for end if display desgloce_dev[arr2].descripcion_m1 to desgloce_dev_scr[scr2].descripcion_m1 display desgloce_dev[arr2].valor1 to desgloce_dev_scr[scr2].valor1 display desgloce_dev[arr2].tasa1 to desgloce_dev_scr[scr2].tasa1 display desgloce_dev[arr2].simbolo1 to desgloce_dev_scr[scr2].simbolo1 after field cantidad1 if (desgloce_dev[arr2].cantidad1 is not null) and (desgloce_dev[arr2].cantidad1 >= 0 )then let desgloce_dev[arr2].total1=desgloce_dev[arr2].tasa1*desgloce_dev[arr2].valor1*desgloce_dev[arr2].cantidad1 call after_desg_dev() if total_dev_desg > total_devolver then CALL fgl_winmessage("Error","monto a devolver mayor que total a devolver","stop") display by name total_dev_desg next field cod_moneda1 end if display desgloce_dev[arr2].total1 to desgloce_dev_scr[scr2].total1 else CALL fgl_winmessage("Error","No valido","stop") next field cantidad1 end if after row IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE Let insertar ="NO" Let desglozar ="NO" Let desglozar_Dev="NO" return END IF call after_desg_dev() if total_dev_desg=total_devolver then let insertar="SI" let arr2=arr_count() return end if display by name total_dev_desg end input end function function after_desg_dev() let idx=0 let total_dev_desg=0 for idx=1 to arr_count() if desgloce_Dev[idx].cod_moneda1 is not null then let total_dev_desg=total_dev_desg + desgloce_dev[idx].total1 end if end for display by name total_dev_desg end function function after_desg() let idx=0 let total_desglozado=0 for idx=1 to arr_count() if desgloce[idx].cod_moneda is not null then let total_desglozado=total_desglozado + desgloce[idx].total end if end for display by name total_desglozado end function } ######################################################## function procesar_impresion() LET impresor = FGL_GETENV("IMP") CALL defecto(impresor) RETURNING negrilla_on,negrillas_of, doble_on,doble_off,comp_on,comp_off, doce,normal,archivo,copia START REPORT rpt_ing_egre TO archivo OUTPUT TO REPORT rpt_ing_egre(ING_EGRE.*) FINISH REPORT rpt_ing_egre Run imprime END FUNCTION REPORT rpt_ing_egre(x) DEFINE x RECORD cod_cia like cctb00020.cod_cia, tipo_doc like cctb00021.tipo_doc, tipo_cliente like cctb00020.tipo_cliente, sec_cliente like cctb00020.sec_cliente, cajera like cctb00020.cajera, cobrador like cctb00020.cobrador, tipo_tarjeta like cctb00020.tipo_tarjeta, referencia like cctb00020.referencia, banco like cctb00020.banco, otro_valor like cctb00020.otro_valor, valor_efectivo like cctb00020.valor_efectivo, observacion like cctb00020.observacion END RECORD define l integer DEFINE hora CHAR(5), pfecha DATE, imprime CHAR(1), telefono CHAR(30) OUTPUT TOP MARGIN 0 PAGE LENGTH 66 LEFT MARGIN 0 FORMAT PAGE HEADER { LET hora = time LET l = (80 - LENGTH (descripcion_cia)) / 2 PRINT COLUMN 1, letras.doce PRINT COLUMN 1, "veprmt014", COLUMN l, descripcion_cia clipped, COLUMN 90, "Trans: ",num_trans using "#########" LET l = (80 - LENGTH (descripcion_doc)) / 2 PRINT COLUMN l, descripcion_doc, COLUMN 90, today using "dd/mm/yyyy"," ",hora } LET lj = (80 - LENGTH(FORMDOC CLIPPED))/2 PRINT COLUMN 1, "veprmt014", COLUMN LJ,formdoc CLIPPED SELECT a.* INTO p_companias.* FROM companias a WHERE a.cod_comp = ing_egre.cod_cia LET lj = (80 - LENGTH(p_companias.nombre CLIPPED))/2 LET hora = time PRINT COLUMN 3, doce PRINT COLUMN 10,doble_on, COLUMN 14,negrilla_on, COLUMN 19, p_companias.nombre, negrillas_of, COLUMN 40, "Pag. ", COLUMN 45, pageno using "<<<<<" LET lj = (80 - LENGTH(p_companias.direccion CLIPPED))/2 PRINT COLUMN lj,p_companias.direccion LET telefono = "TELEFONO: ",p_companias.telefono," FAX:",p_companias.fax LET lj = (80 - LENGTH(telefono CLIPPED))/2 PRINT COLUMN lj, telefono LET telefono = "RNC: ",p_companias.rnc LET lj = (80 - LENGTH(telefono CLIPPED))/2 PRINT COLUMN lj, telefono LET l = (80 - LENGTH (descripcion_doc)) / 2 skip 1 lines PRINT COLUMN l, descripcion_doc, COLUMN 80, "Impreso:",today using "dd/mm/yyyy"," ",hora if (cxc="S") or (cotiza.tipo_doc is not null) then PRINT COLUMN 1,"Documento : ",x.tipo_doc clipped," ",num_oc using "#########", " Aplicado a ",cotiza.tipo_doc clipped," .No: ",cotiza.orden PRINT COLUMN 1,"Fecha : ",fecha_doc using "dd/mm/yyyy" else PRINT COLUMN 1,"Documento: ",x.tipo_doc clipped," ",num_oc using "#########" PRINT COLUMN 1,"Fecha: ",fecha_doc using "dd/mm/yyyy" end if PRINT COLUMN 1,"Cliente : ",x.tipo_cliente using "#","-",x.sec_cliente using "#####"," ",descripcion_cliente clipped PRINT COLUMN 1,"Cedula : " ,num_rnc clipped, COLUMN 26,"Telefono: ",telefono_cli clipped PRINT COLUMN 1,"Observacion: ",x.observacion skip 1 lines PRINT COLUMN 1, "------", "--------------------------------------------------" , "--------------------------------------------------" {PRINT COLUMN 1,"Billete", COLUMN 36,"Cantidad", COLUMN 56,"Tasa", COLUMN 66,"Valor", COLUMN 76,"Total" } PRINT COLUMN 1, "------", "--------------------------------------------------" , "--------------------------------------------------" skip 1 lines on every row { if desglozar="SI" then for idx=1 to arr if desgloce[idx].cantidad > 0 then PRINT COLUMN 1, desgloce[idx].descripcion_m clipped, COLUMN 33,desgloce[idx].cantidad using "###,###.##", COLUMN 53,desgloce[idx].tasa using "###.##", COLUMN 63,desgloce[idx].valor using "###,###", COLUMN 73,desgloce[idx].total using "###,###,###.##" end if END FOR end if if desglozar_dev="SI" then PRINT COLUMN 1,"-------------------------- DESGLOCE DE DEVUELTA (KS) SALIDA POR CAMBIO No.", num_dev using "#####","--------------------------" for idx=1 to arr2 if desgloce_dev[idx].cantidad1 > 0 then PRINT COLUMN 1, desgloce_dev[idx].descripcion_m1 clipped, COLUMN 33,desgloce_dev[idx].cantidad1 using "###,###.##", COLUMN 53,desgloce_dev[idx].tasa1 using "###.##", COLUMN 63,desgloce_dev[idx].valor1 using "###,###", COLUMN 73,desgloce_dev[idx].total1 using "###,###,###.##" end if END FOR end if } PAGE TRAILER # SKIP 1 LINES PRINT COLUMN 1, "------------------", COLUMN 22, "------------------", COLUMN 45, "------------------", COLUMN 65, "------------------" PRINT COLUMN 5, "Entregado Por", COLUMN 24, "Recibido Por", COLUMN 48, "Verificado Por", COLUMN 68, "Aprobado Por" # PRINT COLUMN 2, #"Original: Cliente Copia: ",descripcion_cia clipped PRINT letras.normal ON LAST ROW skip 1 lines print column 75,"Valor Efectivo : ",x.valor_efectivo using "###,###,###.##" print column 75,"Otro Valor : ",x.otro_valor using "###,###,###.##" print column 75,"Monto A Pagar : ",valor_total using "###,###,###.##" print column 75,"Monto Pagado : ",monto_pagado using "###,###,###.##" print column 75,"A devolver : ",total_devolver using "###,###,###.##" PRINT letras.comp_off END REPORT