Ok, va completo, las unicas funciones que no me andan son las que tienen que devolver algo en algun parametro, son:
PeriodSalesByGrade(Type, Pid, "", @Message)
PeriodSalesByPaymentType(Type, Pid, @Message)
GetMPPaymentObject(vSaleNr, @c_PaymentObject)
ShiftClose(Type, @St, @Message, @ErrorCode, @Pid, @PeriodType)
Estas funciones estan en VerTareas()
De las 4 que no me funcionan estoy probando con las 2 primeras.
#include "FiveWin.ch"
#include "Tsbutton.ch"
#include "WinApi.ch"
#include "ADS.ch"
// DEFINICION DE COLORES
#Define Negro 0
#Define Azul 8388608
#Define AzulB 16711680
#Define Verde 32768
#Define VerdeB 65280
#Define Celeste 8421376
#Define CelesteB 16776960
#Define Rojo 128
#Define RojoB 255
#Define Magenta 8388736
#Define MagentaB 16711935
#Define Marron 32896
#Define Gris 8421504
#Define GrisB 12632256
#Define Amarillo 65535
#Define Blanco 16777215
//
#define GHW_HWNDFIRST 0
#define GHW_HWNDNEXT 2
Static oApp,oTray,oIcon,oFondo1,oTimer,Controlador,LaIP,SerRemoto,RutaDat,SalgoSN
Static MaxSurt,MaxIsla,MaxTanq,MaxProd,VecPico[128],VecEst[20]
Static Type,St,Message,ErrorCode,Pid,PeriodType,Pte,PeriodInfo
Static Status,SubStatus,ModCem
******************** VENTANA PRINCIPAL DEL SISTEMA ***************************
Function Main()
Local oDbf,Vec1,Q,Titulo,MsgFooter,IPCem
Private DBF1,CDX1
DBF1:=CurDrive()+":\"+Curdir()+"\CONFPIPE.DBF"
USE &DBF1 NEW
DATABASE oDbf
oDbf:bEoF=nil
oDbf:bBoF=nil
oDbf:GoTop()
RutaDat :=ALLTRIM(oDbf:RUTADATOS)
SerRemoto:=oDbf:REMOTO
DBCLOSEALL()
// PARA UTILIZAR INDICES CDX
REQUEST DBFCDX
RddSetDefault("DBFCDX")
//
RddRegister("ADS",1)
RddSetDefault("ADS")
IF !SerRemoto
SET SERVER LOCAL
ELSE
SET SERVER REMOTE
ENDIF
SET FILETYPE TO CDX
SET 3DLOOK ON
SET CENTURY ON
SET DATE FREN
SET EXCLUSIVE OFF
SET DELETED ON
SET AUTOPEN ON
SET FIXED ON
SET AUTORDER TO 1
SET DEFAULT TO &RutaDat
SetHandleCount(200)
CDX1:=RutaDat+"\VENTAS44.CDX"
FERASE("&CDX1")
IF !FILE("VTAFUS.DBF")
Vec1:={}
AADD(Vec1, {"FECHA ", "D", 8, 0})
AADD(Vec1, {"HORA ", "C", 8, 0})
AADD(Vec1, {"TURNO ", "N", 8, 0})
AADD(Vec1, {"PICO ", "N", 3, 0})
AADD(Vec1, {"PRODUC ", "N", 2, 0})
AADD(Vec1, {"PRECIO ", "N", 12, 3})
AADD(Vec1, {"AFOINI ", "N", 20, 3})
AADD(Vec1, {"AFOFIN ", "N", 20, 3})
AADD(Vec1, {"VTAVOL ", "N", 12, 3})
AADD(Vec1, {"VTAIMP ", "N", 12, 3})
DBCREATE("VTAFUS.DBF", Vec1)
DBCLOSEALL()
USE VTAFUS NEW
DATABASE oDbf
oDbf:bEoF=nil
oDbf:bBoF=nil
oDbf:GoTop()
FOR Q=1 TO 128
oDbf:Append()
oDbf:FECHA :=DATE()
oDbf:HORA :=TIME()
oDbf:TURNO :=0
oDbf:PICO :=Q
oDbf:PRODUC:=0
oDbf:PRECIO:=0
oDbf:AFOINI:=0
oDbf:AFOFIN:=0
oDbf:VTAVOL:=0
oDbf:VTAIMP:=0
oDbf:Save()
oDbf:Unlock()
NEXT
ENDIF
DBCLOSEALL()
USE CONFICEM NEW
DATABASE oDbf
oDbf:bEoF=nil
oDbf:bBoF=nil
oDbf:GoTop()
IPCem :=ALLTRIM(oDbf:IPCEM44)
ModCem:=ALLTRIM(oDbf:MODOCEM)
DBCLOSEALL()
Titulo :="WEST POINT Software - Comunicacion con Fusion Controller - V.240603"
MsgFooter:="Conectado en:"+IPCem+" "+ModCem
DEFINE ICON oIcon RESOURCE "A_ICON_1"
DEFINE BRUSH oFondo1 RESOURCE "FONDO_1"
DEFINE WINDOW oApp FROM 3,6 TO 40,160 TITLE Titulo ICON oIcon BRUSH oFondo1
SET MESSAGE OF oApp TO MsgFooter TIME DATE KEYBOARD 2007
ACTIVATE WINDOW oApp ON INIT HacerAlInicio(oApp)
Return nil
******************************************************************************
****************************** HACER AL INICIO *******************************
Function HacerAlInicio(oApp)
Local oDbf,Tiempo,Reg,Q,L,Ret,SiRet,oDlg,oLbx,oDbf1,oDbf2
Local oGetT[13],VarT[13],oGetD[10],VecDes[10],oGetI[10],VecProImp[10]
Local oGetV[10,10],NroVta[10],FecVta[10],HorVta[10],SurVta[10],PicVta[10],ProVta[10],ImpVta[10],DtoVta[10],VolVta[10],PPUVta[10],oBtn1,oBtn2,oBtn3
Private IPCem
IF !VerSiExe()
DBCLOSEALL()
QUIT
ENDIF
SalgoSN:=.f.
FOR Q=1 TO 10
NroVta[Q]:=0
FecVta[Q]:=CTOD(" / / ")
HorVta[Q]:=" : : "
SurVta[Q]:=" "
PicVta[Q]:=0
ProVta[Q]:=SPACE(35)
ImpVta[Q]:=0
DtoVta[Q]:=0
VolVta[Q]:=0
PPUVta[Q]:=0
NEXT
USE CONFICEM NEW
DATABASE oDbf
oDbf:bEoF=nil
oDbf:bBoF=nil
oDbf:GoBottom()
Reg:=oDbf:RecNo()
IF Reg>1
L:=(Reg+1)
ELSE
L:=1
ENDIF
IF Reg<128
FOR Q=L TO 128
oDbf:Append()
oDbf:Save()
oDbf:Unlock()
NEXT
ENDIF
DBCLOSEALL()
USE VENTACEM NEW
DATABASE oDbf
oDbf:bEoF=nil
oDbf:bBoF=nil
oDbf:GoBottom()
Reg:=oDbf:RecNo()
IF Reg>1
L:=(Reg+1)
ELSE
L:=1
ENDIF
IF Reg<128
FOR Q=L TO 128
oDbf:Append()
oDbf:Save()
oDbf:Unlock()
NEXT
ENDIF
DBCLOSEALL()
USE CONFICEM NEW
DATABASE oDbf
oDbf:bEoF=nil
oDbf:bBoF=nil
oDbf:GoTop()
Tiempo:=oDbf:TIEMPOPROM*1000
IF Tiempo<=0
Tiempo:=5000
ENDIF
IPCem :=ALLTRIM(oDbf:IPCEM44)
LaIP :=ALLTRIM(oDbf:IPCEM44)
DBCLOSEALL()
FOR Q=1 TO 20
Vecest[Q]:=" "
NEXT
Vecest[1 ]:="Disponible"
Vecest[2 ]:="En Solicitud"
Vecest[3 ]:="Despachando"
Vecest[4 ]:="Autorizado"
Vecest[8 ]:="Error"
Vecest[9 ]:="Anulado"
Vecest[10]:="No Instalado"
Vecest[11]:="Stop"
Ret:=ConecFusion("C")
IF !Ret
DBCLOSEALL()
QUIT
ENDIF
* Controlador:SetTimeout(3000)
MsgRun("Leyendo configuracion del Fusion Controller.","Un momento, por favor...",LeerConfi())
USE CONFICEM NEW
DATABASE oDbf
oDbf:bEoF=nil
oDbf:bBoF=nil
oDbf:GoTop()
VecDes[1] :=oDbf:PRODUCTO1
VecDes[2] :=oDbf:PRODUCTO2
VecDes[3] :=oDbf:PRODUCTO3
VecDes[4] :=oDbf:PRODUCTO4
VecDes[5] :=oDbf:PRODUCTO5
VecDes[6] :=oDbf:PRODUCTO6
VecDes[7] :=oDbf:PRODUCTO7
VecDes[8] :=oDbf:PRODUCTO8
VecDes[9] :=oDbf:PRODUCTO9
VecDes[10] :=oDbf:PRODUCTO0
VecProImp[1] :=oDbf:PRECIO11
VecProImp[2] :=oDbf:PRECIO12
VecProImp[3] :=oDbf:PRECIO13
VecProImp[4] :=oDbf:PRECIO14
VecProImp[5] :=oDbf:PRECIO15
VecProImp[6] :=oDbf:PRECIO16
VecProImp[7] :=oDbf:PRECIO17
VecProImp[8] :=oDbf:PRECIO18
VecProImp[9] :=oDbf:PRECIO19
VecProImp[10]:=oDbf:PRECIO10
DBCLOSEALL()
USE VENTACEM NEW
DATABASE oDbf1
oDbf1:bEoF=nil
oDbf1:bBoF=nil
oDbf1:GoTop()
USE VENTAS44 NEW
DATABASE oDbf2
oDbf2:bEoF=nil
oDbf2:bBoF=nil
oDbf2:GoBottom()
Q:=1
DO WHILE !oDbf2:Bof() .AND. Q<=10
IF oDbf2:PRODUCTO>0
NroVta[Q]:=oDbf2:NUMEROVTA
FecVta[Q]:=oDbf2:FECHA
HorVta[Q]:=oDbf2:HORA
SurVta[Q]:=TRAN(oDbf2:SURTIDOR,"##")+" "+oDbf2:MANGUERA
PicVta[Q]:=oDbf2:PICO
ProVta[Q]:=TRAN(oDbf2:PRODUCTO,"##")+" "+VecDes[oDbf2:PRODUCTO]
ImpVta[Q]:=oDbf2:IMPORTE
DtoVta[Q]:=oDbf2:IMPODTO
VolVta[Q]:=oDbf2:LITROS
PPUVta[Q]:=oDbf2:PRECIO
ENDIF
Q++
oDbf2:Skip(-1)
ENDDO
oDbf2:GoBottom()
VarT[1] :="PRODUCTO"
VarT[2] :="PPU"
VarT[3] :="ULTIMAS 10 VENTAS"
VarT[4] :="Nro. Venta"
VarT[5] :="Fecha"
VarT[6] :="Hora"
VarT[7] :="Surt."
VarT[8] :="Pico"
VarT[9] :="Producto"
VarT[10]:="Importe"
VarT[11]:="Dto."
VarT[12]:="Volumen"
VarT[13]:="PPU"
DEFINE DIALOG oDlg RESOURCE "BROWSE_GENERAL" OF oApp TITLE ""
REDEFINE GET oGetT[1] VAR VarT[1] ID 4001 OF oDlg READONLY
REDEFINE GET oGetT[2] VAR VarT[2] ID 4002 OF oDlg READONLY
REDEFINE GET oGetT[3] VAR VarT[3] ID 4033 OF oDlg READONLY
REDEFINE GET oGetT[4] VAR VarT[4] ID 4034 OF oDlg READONLY
REDEFINE GET oGetT[5] VAR VarT[5] ID 4035 OF oDlg READONLY
REDEFINE GET oGetT[6] VAR VarT[6] ID 4036 OF oDlg READONLY
REDEFINE GET oGetT[7] VAR VarT[7] ID 4037 OF oDlg READONLY
REDEFINE GET oGetT[8] VAR VarT[8] ID 4038 OF oDlg READONLY
REDEFINE GET oGetT[9] VAR VarT[9] ID 4039 OF oDlg READONLY
REDEFINE GET oGetT[10] VAR VarT[10] ID 4040 OF oDlg READONLY
REDEFINE GET oGetT[11] VAR VarT[11] ID 4136 OF oDlg READONLY
REDEFINE GET oGetT[12] VAR VarT[12] ID 4041 OF oDlg READONLY
REDEFINE GET oGetT[13] VAR VarT[13] ID 4042 OF oDlg READONLY
REDEFINE GET oGetD[1] VAR VecDes[1] ID 4003 OF oDlg READONLY
REDEFINE GET oGetI[1] VAR VecProImp[1] ID 4004 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetD[2] VAR VecDes[2] ID 4005 OF oDlg READONLY
REDEFINE GET oGetI[2] VAR VecProImp[2] ID 4006 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetD[3] VAR VecDes[3] ID 4007 OF oDlg READONLY
REDEFINE GET oGetI[3] VAR VecProImp[3] ID 4008 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetD[4] VAR VecDes[4] ID 4009 OF oDlg READONLY
REDEFINE GET oGetI[4] VAR VecProImp[4] ID 4010 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetD[5] VAR VecDes[5] ID 4011 OF oDlg READONLY
REDEFINE GET oGetI[5] VAR VecProImp[5] ID 4012 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetD[6] VAR VecDes[6] ID 4013 OF oDlg READONLY
REDEFINE GET oGetI[6] VAR VecProImp[6] ID 4014 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetD[7] VAR VecDes[7] ID 4015 OF oDlg READONLY
REDEFINE GET oGetI[7] VAR VecProImp[7] ID 4016 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetD[8] VAR VecDes[8] ID 4017 OF oDlg READONLY
REDEFINE GET oGetI[8] VAR VecProImp[8] ID 4018 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetD[9] VAR VecDes[9] ID 4019 OF oDlg READONLY
REDEFINE GET oGetI[9] VAR VecProImp[9] ID 4020 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetD[10] VAR VecDes[10] ID 4021 OF oDlg READONLY
REDEFINE GET oGetI[10] VAR VecProImp[10] ID 4022 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetV[1,1] VAR NroVta[1] ID 4043 OF oDlg READONLY
REDEFINE GET oGetV[1,2] VAR FecVta[1] ID 4044 OF oDlg READONLY
REDEFINE GET oGetV[1,3] VAR HorVta[1] ID 4045 OF oDlg READONLY
REDEFINE GET oGetV[1,4] VAR SurVta[1] ID 4046 OF oDlg READONLY
REDEFINE GET oGetV[1,5] VAR PicVta[1] ID 4047 OF oDlg READONLY
REDEFINE GET oGetV[1,6] VAR ProVta[1] ID 4048 OF oDlg READONLY
REDEFINE GET oGetV[1,7] VAR ImpVta[1] ID 4049 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[1,8] VAR DtoVta[1] ID 4137 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[1,9] VAR VolVta[1] ID 4050 OF oDlg READONLY PICTURE "######.###"
REDEFINE GET oGetV[1,10] VAR PPUVta[1] ID 4051 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetV[2,1] VAR NroVta[2] ID 4052 OF oDlg READONLY
REDEFINE GET oGetV[2,2] VAR FecVta[2] ID 4053 OF oDlg READONLY
REDEFINE GET oGetV[2,3] VAR HorVta[2] ID 4054 OF oDlg READONLY
REDEFINE GET oGetV[2,4] VAR SurVta[2] ID 4055 OF oDlg READONLY
REDEFINE GET oGetV[2,5] VAR PicVta[2] ID 4056 OF oDlg READONLY
REDEFINE GET oGetV[2,6] VAR ProVta[2] ID 4057 OF oDlg READONLY
REDEFINE GET oGetV[2,7] VAR ImpVta[2] ID 4058 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[2,8] VAR DtoVta[2] ID 4138 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[2,9] VAR VolVta[2] ID 4059 OF oDlg READONLY PICTURE "######.###"
REDEFINE GET oGetV[2,10] VAR PPUVta[2] ID 4060 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetV[3,1] VAR NroVta[3] ID 4061 OF oDlg READONLY
REDEFINE GET oGetV[3,2] VAR FecVta[3] ID 4062 OF oDlg READONLY
REDEFINE GET oGetV[3,3] VAR HorVta[3] ID 4063 OF oDlg READONLY
REDEFINE GET oGetV[3,4] VAR SurVta[3] ID 4064 OF oDlg READONLY
REDEFINE GET oGetV[3,5] VAR PicVta[3] ID 4065 OF oDlg READONLY
REDEFINE GET oGetV[3,6] VAR ProVta[3] ID 4066 OF oDlg READONLY
REDEFINE GET oGetV[3,7] VAR ImpVta[3] ID 4067 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[3,8] VAR DtoVta[3] ID 4139 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[3,9] VAR VolVta[3] ID 4068 OF oDlg READONLY PICTURE "######.###"
REDEFINE GET oGetV[3,10] VAR PPUVta[3] ID 4069 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetV[4,1] VAR NroVta[4] ID 4070 OF oDlg READONLY
REDEFINE GET oGetV[4,2] VAR FecVta[4] ID 4071 OF oDlg READONLY
REDEFINE GET oGetV[4,3] VAR HorVta[4] ID 4072 OF oDlg READONLY
REDEFINE GET oGetV[4,4] VAR SurVta[4] ID 4073 OF oDlg READONLY
REDEFINE GET oGetV[4,5] VAR PicVta[4] ID 4074 OF oDlg READONLY
REDEFINE GET oGetV[4,6] VAR ProVta[4] ID 4075 OF oDlg READONLY
REDEFINE GET oGetV[4,7] VAR ImpVta[4] ID 4076 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[4,8] VAR DtoVta[4] ID 4140 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[4,9] VAR VolVta[4] ID 4077 OF oDlg READONLY PICTURE "######.###"
REDEFINE GET oGetV[4,10] VAR PPUVta[4] ID 4078 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetV[5,1] VAR NroVta[5] ID 4079 OF oDlg READONLY
REDEFINE GET oGetV[5,2] VAR FecVta[5] ID 4080 OF oDlg READONLY
REDEFINE GET oGetV[5,3] VAR HorVta[5] ID 4081 OF oDlg READONLY
REDEFINE GET oGetV[5,4] VAR SurVta[5] ID 4082 OF oDlg READONLY
REDEFINE GET oGetV[5,5] VAR PicVta[5] ID 4083 OF oDlg READONLY
REDEFINE GET oGetV[5,6] VAR ProVta[5] ID 4084 OF oDlg READONLY
REDEFINE GET oGetV[5,7] VAR ImpVta[5] ID 4085 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[5,8] VAR DtoVta[5] ID 4141 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[5,9] VAR VolVta[5] ID 4086 OF oDlg READONLY PICTURE "######.###"
REDEFINE GET oGetV[5,10] VAR PPUVta[5] ID 4087 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetV[6,1] VAR NroVta[6] ID 4088 OF oDlg READONLY
REDEFINE GET oGetV[6,2] VAR FecVta[6] ID 4089 OF oDlg READONLY
REDEFINE GET oGetV[6,3] VAR HorVta[6] ID 4090 OF oDlg READONLY
REDEFINE GET oGetV[6,4] VAR SurVta[6] ID 4091 OF oDlg READONLY
REDEFINE GET oGetV[6,5] VAR PicVta[6] ID 4092 OF oDlg READONLY
REDEFINE GET oGetV[6,6] VAR ProVta[6] ID 4093 OF oDlg READONLY
REDEFINE GET oGetV[6,7] VAR ImpVta[6] ID 4094 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[6,8] VAR DtoVta[6] ID 4142 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[6,9] VAR VolVta[6] ID 4095 OF oDlg READONLY PICTURE "######.###"
REDEFINE GET oGetV[6,10] VAR PPUVta[6] ID 4096 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetV[7,1] VAR NroVta[7] ID 4097 OF oDlg READONLY
REDEFINE GET oGetV[7,2] VAR FecVta[7] ID 4098 OF oDlg READONLY
REDEFINE GET oGetV[7,3] VAR HorVta[7] ID 4099 OF oDlg READONLY
REDEFINE GET oGetV[7,4] VAR SurVta[7] ID 4100 OF oDlg READONLY
REDEFINE GET oGetV[7,5] VAR PicVta[7] ID 4101 OF oDlg READONLY
REDEFINE GET oGetV[7,6] VAR ProVta[7] ID 4102 OF oDlg READONLY
REDEFINE GET oGetV[7,7] VAR ImpVta[7] ID 4103 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[7,8] VAR DtoVta[7] ID 4143 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[7,9] VAR VolVta[7] ID 4104 OF oDlg READONLY PICTURE "######.###"
REDEFINE GET oGetV[7,10] VAR PPUVta[7] ID 4105 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetV[8,1] VAR NroVta[8] ID 4106 OF oDlg READONLY
REDEFINE GET oGetV[8,2] VAR FecVta[8] ID 4107 OF oDlg READONLY
REDEFINE GET oGetV[8,3] VAR HorVta[8] ID 4108 OF oDlg READONLY
REDEFINE GET oGetV[8,4] VAR SurVta[8] ID 4109 OF oDlg READONLY
REDEFINE GET oGetV[8,5] VAR PicVta[8] ID 4110 OF oDlg READONLY
REDEFINE GET oGetV[8,6] VAR ProVta[8] ID 4111 OF oDlg READONLY
REDEFINE GET oGetV[8,7] VAR ImpVta[8] ID 4112 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[8,8] VAR DtoVta[8] ID 4144 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[8,9] VAR VolVta[8] ID 4113 OF oDlg READONLY PICTURE "######.###"
REDEFINE GET oGetV[8,10] VAR PPUVta[8] ID 4114 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetV[9,1] VAR NroVta[9] ID 4115 OF oDlg READONLY
REDEFINE GET oGetV[9,2] VAR FecVta[9] ID 4116 OF oDlg READONLY
REDEFINE GET oGetV[9,3] VAR HorVta[9] ID 4117 OF oDlg READONLY
REDEFINE GET oGetV[9,4] VAR SurVta[9] ID 4118 OF oDlg READONLY
REDEFINE GET oGetV[9,5] VAR PicVta[9] ID 4119 OF oDlg READONLY
REDEFINE GET oGetV[9,6] VAR ProVta[9] ID 4120 OF oDlg READONLY
REDEFINE GET oGetV[9,7] VAR ImpVta[9] ID 4121 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[9,8] VAR DtoVta[9] ID 4145 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[9,9] VAR VolVta[9] ID 4122 OF oDlg READONLY PICTURE "######.###"
REDEFINE GET oGetV[9,10] VAR PPUVta[9] ID 4123 OF oDlg READONLY PICTURE "#####.##"
REDEFINE GET oGetV[10,1] VAR NroVta[10] ID 4124 OF oDlg READONLY
REDEFINE GET oGetV[10,2] VAR FecVta[10] ID 4125 OF oDlg READONLY
REDEFINE GET oGetV[10,3] VAR HorVta[10] ID 4126 OF oDlg READONLY
REDEFINE GET oGetV[10,4] VAR SurVta[10] ID 4127 OF oDlg READONLY
REDEFINE GET oGetV[10,5] VAR PicVta[10] ID 4128 OF oDlg READONLY
REDEFINE GET oGetV[10,6] VAR ProVta[10] ID 4129 OF oDlg READONLY
REDEFINE GET oGetV[10,7] VAR ImpVta[10] ID 4130 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[10,8] VAR DtoVta[10] ID 4146 OF oDlg READONLY PICTURE "#######.##"
REDEFINE GET oGetV[10,9] VAR VolVta[10] ID 4131 OF oDlg READONLY PICTURE "######.###"
REDEFINE GET oGetV[10,10] VAR PPUVta[10] ID 4132 OF oDlg READONLY PICTURE "#####.##"
REDEFINE SBUTTON oBtn1 ID 4133 OF oDlg PROMPT "LEER"+CHR(13)+"CONFIGURACION" TEXT 3 ACTION ""
REDEFINE SBUTTON oBtn2 ID 4134 OF oDlg PROMPT "MINIMIZAR" TEXT 3 ACTION oApp:Minimize()
REDEFINE SBUTTON oBtn3 ID 4135 OF oDlg PROMPT "SALIR" TEXT 3 ACTION oDlg:End()
ACTIVATE DIALOG oDlg ON INIT ActivoTimer(oDlg,Tiempo,oDbf1,oDbf2,oGetV,@NroVta,@FecVta,@HorVta,@SurVta,@PicVta,@ProVta,@ImpVta,@DtoVta,@VolVta,@PPUVta,VecDes) VALID VerSiSalgo()
IF SalgoSN
oTimer:DeActivate()
RELEASE TIMER oTimer
DBCLOSEALL()
oApp:End()
ENDIF
Return nil
// ACTIVAR EL TIMER
Function ActivoTimer(oDlg,Tiempo,oDbf1,oDbf2,oGetV,NroVta,FecVta,HorVta,SurVta,PicVta,ProVta,ImpVta,DtoVta,VolVta,PPUVta,VecDes)
DEFINE TIMER oTimer INTERVAL Tiempo ACTION VerTareas(oDbf1,oDbf2,oGetV,@NroVta,@FecVta,@HorVta,@SurVta,@PicVta,@ProVta,@ImpVta,@DtoVta,@VolVta,@PPUVta,VecDes) OF oDlg
ACTIVATE TIMER oTimer
Retur nil
//
// VERIFICO SI SALGO DEL SISTEMA
Function VerSiSalgo()
Local SiNo
IF SiNo:=MsgNoYes("Esta seguro que desea salir del sistema?","Por favor, seleccione")
SalgoSN:=.t.
Return .t.
ELSE
SalgoSN:=.f.
Return .f.
ENDIF
Return nil
//
******************************************************************************
**************************** LEER CONFIGURACION ******************************
Function LeerConfi()
Local oDbf,Q,L,N,cConfig,Surt,Pico,Grado,Desc,Li,Cont
Local Vec1[0],VecDes[10],VecSurt[32,6],VecTan[128], VecTanq[10],VecMan[128],VecPre[128]
MaxSurt:=0
MaxIsla:=0
MaxTanq:=0
MaxProd:=0
N:=1
FOR Q=1 TO 128
VecMan[Q] :=0
VecPre[Q] :=0
VecTan[Q] :=0
VecPico[Q]:=" "
NEXT
FOR Q=1 TO 10
VecDes[Q] :=SPACE(25)
VecTanq[Q]:=0
NEXT
FOR Q=1 TO 32
VecSurt[Q,1]:=" "
VecSurt[Q,2]:=" "
VecSurt[Q,3]:=" "
VecSurt[Q,4]:=" "
VecSurt[Q,5]:=" "
VecSurt[Q,6]:=" "
NEXT
cConfig:=CreateObject("FusionForecourt")
cConfig:=Controlador:GetConfig()
MaxSurt:=cConfig:m_iPumps
FOR Q=1 TO MaxSurt
Surt:=cConfig:GetPumpConfiguration(Q)
Li :="Surtidor:"+ALLTRIM(STR(Q))+";"+"Picos:"+ALLTRIM(STR(Surt:m_iHoses))+";"+"ID fisico:"+ALLTRIM(STR(Surt:m_iPhysicalID))+CHR(13)
AADD(Vec1,Li)
FOR L=1 TO Surt:m_iHoses
Pico:=Surt:GetHose(L)
Desc:=cConfig:GetGradeByID(Pico:m_iGradeNr)
IF Desc=nil
Desc:=" "
ENDIF
Li:="Pico:"+ALLTRIM(STR(N))+";"+"Grado:"+ALLTRIM(STR(Pico:m_iGradeNr))+";"+"Desc.:"+Desc+";"+"Precio:"+ALLTRIM(Pico:m_strPPU)+";"+"Tanque:"+ ALLTRIM(Pico:m_strTanks)+";"+;
"ID fisico:"+ALLTRIM(STR(Pico:m_iPhysicalID))+CHR(13)
AADD(Vec1,Li)
VecDes[Pico:m_iGradeNr]:=UPPER(Desc)
VecMan[N] :=Pico:m_iGradeNr
VecPre[N] :=VAL(Pico:m_strPPU)
VecTan[N] :=VAL(SUBSTR(Pico:m_strTanks,1,2))
VecTanq[VecTan[N]] :=1
IF L=1
VecSurt[Q,1]:="a"
ENDIF
IF L=2
VecSurt[Q,2]:="b"
ENDIF
IF L=3
VecSurt[Q,3]:="c"
ENDIF
IF L=4
VecSurt[Q,4]:="d"
ENDIF
IF L=5
VecSurt[Q,5]:="e"
ENDIF
IF L=6
VecSurt[Q,6]:="f"
ENDIF
N++
NEXT
NEXT
Li:=""
FOR Q=1 TO LEN(Vec1)
Li:=Li+Vec1[Q]
NEXT
MemoWrit( "ConfiFusion.TXT", cValToChar(Li) )
FOR Q=1 TO 10
IF !EMPTY(ALLTRIM(VecDes[Q]))
MaxProd++
ENDIF
NEXT
FOR Q=1 TO 10
IF VecTanq[Q]=1
MaxTanq++
ENDIF
NEXT
// GRABO LA CONFIGURACION
USE CONFICEM NEW
DATABASE oDbf
oDbf:bEoF=nil
oDbf:bBoF=nil
oDbf:GoTop()
oDbf:Load()
oDbf:MAXSURTI :=MaxSurt
oDbf:MAXISLAS :=MaxIsla
oDbf:MAXTANQUES:=MaxTanq
oDbf:MAXPRODU :=MaxProd
oDbf:MAXMANGUE :=128
oDbf:PRODUCTO1:=VecDes[1]
oDbf:PRODUCTO2:=VecDes[2]
oDbf:PRODUCTO3:=VecDes[3]
oDbf:PRODUCTO4:=VecDes[4]
oDbf:PRODUCTO5:=VecDes[5]
oDbf:PRODUCTO6:=VecDes[6]
oDbf:PRODUCTO7:=VecDes[7]
oDbf:PRODUCTO8:=VecDes[8]
oDbf:PRODUCTO9:=VecDes[9]
oDbf:PRODUCTO0:=VecDes[10]
oDbf:CODIGO1 :=1
oDbf:CODIGO2 :=2
oDbf:CODIGO3 :=3
oDbf:CODIGO4 :=4
oDbf:CODIGO5 :=5
oDbf:CODIGO6 :=6
oDbf:CODIGO7 :=7
oDbf:CODIGO8 :=8
oDbf:CODIGO9 :=9
oDbf:CODIGO0 :=10
oDbf:FECHACONF:=DATE()
oDbf:HORACONF :=TIME()
oDbf:RecLock()
oDbf:Save()
oDbf:Unlock()
oDbf:GoTop()
Cont:=1
DO WHILE !oDbf:Eof()
oDbf:Load()
oDbf:NUMEROSURT:=0
oDbf:TIPOSURTI :=0
oDbf:NIVELPRECI:=1
oDbf:NUMEROMANG:=Cont
oDbf:TIPOPRODU :=VecMan[Cont]
oDbf:PRECPICO :=VecPre[Cont]
oDbf:TIPOTANQUE:=VecTan[Cont]
oDbf:RecLock()
oDbf:Save()
oDbf:Unlock()
Cont++
oDbf:Skip()
ENDDO
oDbf:GoTop()
Cont:=1
DO WHILE Cont<=32
IF !EMPTY(VecSurt[Cont,1])
oDbf:Load()
oDbf:NUMEROSURT:=Cont
oDbf:PICO :=VecSurt[Cont,1]
oDbf:RecLock()
oDbf:Save()
oDbf:Unlock()
oDbf:Skip()
ENDIF
IF !EMPTY(VecSurt[Cont,2])
oDbf:Load()
oDbf:NUMEROSURT:=Cont
oDbf:PICO :=VecSurt[Cont,2]
oDbf:RecLock()
oDbf:Save()
oDbf:Unlock()
oDbf:Skip()
ENDIF
IF !EMPTY(VecSurt[Cont,3])
oDbf:Load()
oDbf:NUMEROSURT:=Cont
oDbf:PICO :=VecSurt[Cont,3]
oDbf:RecLock()
oDbf:Save()
oDbf:Unlock()
oDbf:Skip()
ENDIF
IF !EMPTY(VecSurt[Cont,4])
oDbf:Load()
oDbf:NUMEROSURT:=Cont
oDbf:PICO :=VecSurt[Cont,4]
oDbf:RecLock()
oDbf:Save()
oDbf:Unlock()
oDbf:Skip()
ENDIF
IF !EMPTY(VecSurt[Cont,5])
oDbf:Load()
oDbf:NUMEROSURT:=Cont
oDbf:PICO :=VecSurt[Cont,5]
oDbf:RecLock()
oDbf:Save()
oDbf:Unlock()
oDbf:Skip()
ENDIF
IF !EMPTY(VecSurt[Cont,6])
oDbf:Load()
oDbf:NUMEROSURT:=Cont
oDbf:PICO :=VecSurt[Cont,6]
oDbf:RecLock()
oDbf:Save()
oDbf:Unlock()
oDbf:Skip()
ENDIF
Cont++
ENDDO
FOR Q=1 TO 128
VecPre[Q]:=0
NEXT
oDbf:GoTop()
DO WHILE !oDbf:Eof()
IF oDbf:TIPOPRODU=1 .AND. VecPre[1]=0
VecPre[1]:=oDbf:PRECPICO
ENDIF
IF oDbf:TIPOPRODU=2 .AND. VecPre[2]=0
VecPre[2]:=oDbf:PRECPICO
ENDIF
IF oDbf:TIPOPRODU=3 .AND. VecPre[3]=0
VecPre[3]:=oDbf:PRECPICO
ENDIF
IF oDbf:TIPOPRODU=4 .AND. VecPre[4]=0
VecPre[4]:=oDbf:PRECPICO
ENDIF
IF oDbf:TIPOPRODU=5 .AND. VecPre[5]=0
VecPre[5]:=oDbf:PRECPICO
ENDIF
IF oDbf:TIPOPRODU=6 .AND. VecPre[6]=0
VecPre[6]:=oDbf:PRECPICO
ENDIF
IF oDbf:TIPOPRODU=7 .AND. VecPre[7]=0
VecPre[7]:=oDbf:PRECPICO
ENDIF
IF oDbf:TIPOPRODU=8 .AND. VecPre[8]=0
VecPre[8]:=oDbf:PRECPICO
ENDIF
IF oDbf:TIPOPRODU=9 .AND. VecPre[9]=0
VecPre[9]:=oDbf:PRECPICO
ENDIF
IF oDbf:TIPOPRODU=10 .AND. VecPre[10]=0
VecPre[10]:=oDbf:PRECPICO
ENDIF
oDbf:Skip()
ENDDO
oDbf:GoTop()
oDbf:Load()
oDbf:PRECIO11:=VecPre[1]
oDbf:PRECIO12:=VecPre[2]
oDbf:PRECIO13:=VecPre[3]
oDbf:PRECIO14:=VecPre[4]
oDbf:PRECIO15:=VecPre[5]
oDbf:PRECIO16:=VecPre[6]
oDbf:PRECIO17:=VecPre[7]
oDbf:PRECIO18:=VecPre[8]
oDbf:PRECIO19:=VecPre[9]
oDbf:PRECIO10:=VecPre[10]
oDbf:PRECIO21:=0
oDbf:PRECIO22:=0
oDbf:PRECIO23:=0
oDbf:PRECIO24:=0
oDbf:PRECIO25:=0
oDbf:PRECIO26:=0
oDbf:PRECIO27:=0
oDbf:PRECIO28:=0
oDbf:PRECIO29:=0
oDbf:PRECIO20:=0
oDbf:RecLock()
oDbf:Save()
oDbf:Unlock()
DBCLOSEALL()
//
// CARGO LA CONFIGURACION DE MANGUERAS
USE CONFICEM NEW
DATABASE oDbf
oDbf:bEoF=nil
oDbf:bBoF=nil
oDbf:GoTop()
DO WHILE !oDbf:Eof()
VecPico[oDbf:RecNo()]:=TRAN(oDbf:NUMEROSURT,"##")+oDbf:PICO
oDbf:Skip()
ENDDO
DBCLOSEALL()
//
cConfig:End()
Return nil
******************************************************************************
****************************** VERIFICAR TAREAS ******************************
Function VerTareas(oDbf1,oDbf2,oGetV,NroVta,FecVta,HorVta,SurVta,PicVta,ProVta,ImpVta,DtoVta,VolVta,PPUVta,VecDes)
Local Q,L,V,X,oDbf3,oDbf4,oDbf5,QueHora,Li,Ret,SiRet,RetInt,c_FusionSale,vAmount,vPPU,vPump,vSaleNr,vCierreNr,vVolume,vHose,vFin_Vol_Tot,vIni_Vol_Tot,vPay_Type,vPay_Info,vPay_InfoA,;
Vta,Mang,vProd,vPico,Fec,Hor,RetBol,ObjetoPago,RetMP,c_PaymentObject
Local pt,periodID,Di,Me,An,Fe,Ho
Local CieAfoF[128],CieAfoI[128],CieProd[128],CiePrec[128],VtaV[128],VtaI[128],VtaProV[10],VtaProI[10],VtaProP[10],TotV,TotI,NumCie,IniFOR,FinFOR,RetTxt,CieAct
Private NomArch,File1,File2,File3,File4
oTimer:DeActivate()
File1:=RutaDat+"\LEERCONF.MEM"
IF FILE("&File1")
FERASE("&File1")
LeerConfi()
ENDIF
File1:=RutaDat+"\CEMCLOSN.MEM"
File2:=RutaDat+"\CEMCLOSL.MEM"
File3:=RutaDat+"\LEEDESPA.TXT"
File4:=RutaDat+"\PRUEBAS.TXT"
IF (FILE("&File1") .AND. FILE("&File2")) .OR. FILE("&File3") && LECTURA DE DESPACHOS
IniFOR:=1
FinFOR:=MaxSurt
RetTxt:=" "
IF FILE("&File3")
RetTxt:=MemoRead("&File3")
RetTxt:=ALLTRIM(RetTxt)
IF VAL(RetTxt)>=1 .AND. VAL(RetTxt)<=32
IniFOR:=VAL(RetTxt)
FinFOR:=VAL(RetTxt)
ENDIF
ENDIF
/*
Pump NR 3
Hose 1
Shift ID 25
Payment Type SSF_TRANS_PAY_TYPE_AUTOMATIC
Amount 54.91
PPU 26.00000
Volume 2.11200
Sale NR 125243
Initial Volume 220757.18700
Final Volume 220759.29900
Payment Alarm
ATCVO 2.11200
AVGTM 0.00000
ATCIVO
ATCFVO
*/
c_FusionSale:=CreateObject("FusionSale")
FOR Q=IniFOR TO FinFOR
Inkey(1)
Status :=""
SubStatus:=""
*RetInt:=Controlador:PumpStatus(INT(Q), @Status, @SubStatus)
*IF RetInt=1 .AND. ALLTRIM(Status)="IDLE"
RetInt:=Controlador:GetLastSale(Q, c_FusionSale)
IF RetInt=1
vProd :=c_FusionSale:GetGradeNr() && Codigo de producto
vAmount :=c_FusionSale:GetAmount() && Monto total de la venta
vVolume :=c_FusionSale:GetVolume() && Volumen total de la venta
vPPU :=c_FusionSale:GetPPU() && Precio unitario de la venta
vPump :=c_FusionSale:GetPumpNr() && Numero de surtidor
vHose :=c_FusionSale:GetHoseNr() && Numero de pico
vSaleNr :=c_FusionSale:GetSaleID() && Numero de venta
vCierreNr :=c_FusionSale:GetShiftID() && Numero de cierre
vIni_Vol_Tot:=c_FusionSale:GetInitialVolume() && Aforador volumen inicial
vFin_Vol_Tot:=c_FusionSale:GetFinalVolume() && Aforador volumen final
vPay_Type :=c_FusionSale:GetPaymentType() && Tipo de pago
vPay_Info :=c_FusionSale:GetPaymentInfo() && Info del pago
vPay_InfoA :=c_FusionSale:GetPaymentInfoAttribute("1") && Info atrib del pago
Li :=ALLTRIM(STR(vSaleNr))+";"+vAmount+";"+vVolume+";"+vPPU+";"+ALLTRIM(STR(vProd))+";"+ALLTRIM(STR(vPump))+";"+ALLTRIM(STR(vHose))+";"+vIni_Vol_Tot+";"+vFin_Vol_Tot+";"+vPay_Type+";"+vPay_Info+";"+vPay_InfoA
NomArch:="UltVta_"+ALLTRIM(STR(Q))+".TXT"
MemoWrit( "&Nomarch", Li )
// PIDO DATOS DEL CIERRE RECIEN HECHO
IF FILE("&File4")
SiRet :=.f.
Type :="S"
Pid :="217"
Message:=SPACE(1024)
SiRet :=Controlador:PeriodSalesByGrade(Type, Pid, "", @Message)
IF SiRet
NomArch:="CierreProd_217"+".txt"
MemoWrit("&Nomarch", ALLTRIM(Message))
ENDIF
SiRet :=.f.
Type :="S"
Pid :="217"
Message:=SPACE(1024)
SiRet :=Controlador:PeriodSalesByPaymentType(Type, Pid, @Message)
IF SiRet
NomArch:="CierrePago_217"+".txt"
MemoWrit("&Nomarch", ALLTRIM(Message))
ENDIF
ENDIF
//
ELSE
Li :="No trajo ultima venta Surt. "+ALLTRIM(STR(Q))
NomArch:="NOUltVta_"+ALLTRIM(STR(Q))+".TXT"
MemoWrit( "&Nomarch", Li )
ENDIF
IF RetInt=1 .AND. VAL(vAmount)>0
vPico:=" "
IF vHose=1
vPico:="a"
ENDIF
IF vHose=2
vPico:="b"
ENDIF
IF vHose=3
vPico:="c"
ENDIF
IF vHose=4
vPico:="d"
ENDIF
IF vHose=5
vPico:="e"
ENDIF
IF vHose=6
vPico:="f"
ENDIF
Vta :=TRAN(vPump,"##")+vPico
Mang:=0
FOR L=1 TO 128
IF Vta=VecPico[L]
Mang:=L
ENDIF
NEXT
IF Mang>=1 .AND. Mang<=128
oDbf1:GoTo(Mang)
IF oDbf1:ULTIMANU<>vSaleNr
Fec:=DATE()
Hor:=TIME()
oDbf1:Load()
oDbf1:ANTERIORNU:=oDbf1:ULTIMANU
oDbf1:ANTERIORLI:=oDbf1:ULTIMALI
oDbf1:ANTERIORIM:=oDbf1:ULTIMAIM
oDbf1:ANTERIORFE:=oDbf1:ULTIMAFE
oDbf1:ANTERIORHO:=oDbf1:ULTIMAHO
oDbf1:ANTESURTI :=oDbf1:ULTISURTI
oDbf1:ANTERIORMA:=oDbf1:ULTIMAMA
oDbf1:ANTERIORPR:=oDbf1:ULTIMAPR
oDbf1:ANTEPPU :=oDbf1:ULTIPPU
oDbf1:ANTTOMADO :=.f.
oDbf1:ANTPAGTIP :=oDbf1:ULTPAGTIP
oDbf1:ANTPAGINF :=oDbf1:ULTPAGINF
oDbf1:ANTIMPDTO :=oDbf1:ULTIMPDTO
oDbf1:ULTIMANU :=vSaleNr
oDbf1:ULTIMALI :=VAL(vVolume)
oDbf1:ULTIMAIM :=VAL(vAmount)
oDbf1:ULTIMAFE :=Fec
oDbf1:ULTIMAHO :=Hor
oDbf1:ULTISURTI :=vPump
oDbf1:ULTIMAMA :=vPico
oDbf1:ULTIMAPR :=vProd
oDbf1:ULTIPPU :=VAL(vPPU)
oDbf1:ULTTOMADO :=.f.
oDbf1:ULTPAGTIP :=ALLTRIM(vPay_Type)
oDbf1:ULTPAGINF :=ALLTRIM(vPay_Info)
oDbf1:ULTIMPDTO :=0
oDbf1:RecLock()
oDbf1:Save()
oDbf1:Unlock()
oDbf2:Append()
oDbf2:FECHA :=Fec
oDbf2:HORA :=Hor
oDbf2:SURTIDOR :=vPump
oDbf2:MANGUERA :=vPico
oDbf2:PICO :=Mang
oDbf2:PRODUCTO :=vProd
oDbf2:LITROS :=VAL(vVolume)
oDbf2:IMPORTE :=VAL(vAmount)
oDbf2:PRECIO :=VAL(vPPU)
oDbf2:NUMEROVTA:=vSaleNr
oDbf2:AFORAINI :=VAL(vIni_Vol_Tot)
oDbf2:AFORAFIN :=VAL(vFin_Vol_Tot)
oDbf2:PAGOTIPO :=ALLTRIM(vPay_Type)
oDbf2:PAGOINFO :=ALLTRIM(vPay_Info)
oDbf2:IMPODTO :=0
oDbf2:NROCIERRE:=vCierreNr
oDbf2:Save()
oDbf2:Unlock()
FOR V=10 TO 2 STEP -1
NroVta[V]:=NroVta[V-1]
FecVta[V]:=FecVta[V-1]
HorVta[V]:=HorVta[V-1]
SurVta[V]:=SurVta[V-1]
PicVta[V]:=PicVta[V-1]
ProVta[V]:=ProVta[V-1]
ImpVta[V]:=ImpVta[V-1]
DtoVta[V]:=DtoVta[V-1]
VolVta[V]:=VolVta[V-1]
PPUVta[V]:=PPUVta[V-1]
NEXT
oDbf2:GoBottom()
NroVta[1]:=oDbf2:NUMEROVTA
FecVta[1]:=oDbf2:FECHA
HorVta[1]:=oDbf2:HORA
SurVta[1]:=TRAN(oDbf2:SURTIDOR,"##")+" "+oDbf2:MANGUERA
PicVta[1]:=oDbf2:PICO
ProVta[1]:=TRAN(oDbf2:PRODUCTO,"##")+" "+VecDes[oDbf2:PRODUCTO]
ImpVta[1]:=oDbf2:IMPORTE
DtoVta[1]:=oDbf2:IMPODTO
VolVta[1]:=oDbf2:LITROS
PPUVta[1]:=oDbf2:PRECIO
FOR V=1 TO 10
FOR X=1 TO 10
oGetV[V,X]:Refresh()
NEXT
NEXT
ELSE
IF oDbf1:ULTIMANU=vSaleNr .AND. !EMPTY(ALLTRIM(vPay_Type))
IF ModCem="PRIS" .AND. ALLTRIM(vPay_Type)="Puma App"
RetInt:=Controlador:GetSale(vSaleNr, c_FusionSale)
IF RetInt=1
RetBol :=.f.
*ObjetoPago:=" "
c_PaymentObject:=" "
RetBol :=Controlador:GetMPPaymentObject(vSaleNr, @c_PaymentObject)
IF RetBol
Li :=ALLTRIM(STR(vSaleNr))+";"+ALLTRIM(c_PaymentObject)
NomArch:="ObjPago_"+ALLTRIM(STR(vSaleNr))+".TXT"
MemoWrit( "&Nomarch", Li )
ENDIF
ENDIF
ENDIF
oDbf1:Load()
oDbf1:ULTPAGTIP :=ALLTRIM(vPay_Type)
oDbf1:ULTPAGINF :=ALLTRIM(vPay_Info)
oDbf1:RecLock()
oDbf1:Save()
oDbf1:Unlock()
V:=1
oDbf2:GoBottom()
DO WHILE !oDbf2:Eof() .AND. !oDbf2:Bof() .AND. V<=20
IF oDbf2:NUMEROVTA=vSaleNr
oDbf2:Load()
oDbf2:PAGOTIPO :=ALLTRIM(vPay_Type)
oDbf2:PAGOINFO :=ALLTRIM(vPay_Info)
oDbf2:RecLock()
oDbf2:Save()
oDbf2:Unlock()
V:=30
ENDIF
oDbf2:Skip(-1)
V++
ENDDO
ENDIF
ENDIF
ENDIF
ENDIF
*ENDIF
NEXT
c_FusionSale:End()
ENDIF
//
// CIERRE DE TURNO
IF FILE("&File1") .AND. FILE("&File2")
FERASE("&File1")
FERASE("&File2")
Type :="S"
St :=SPACE(100)
Message :=SPACE(100)
ErrorCode :=SPACE(100)
Pid :=SPACE(100)
PeriodType:=SPACE(100)
SiRet:=Controlador:ShiftClose(Type, @St, @Message, @ErrorCode, @Pid, @PeriodType)
IF !SiRet
NomArch:="NORecibioComandoCierre.txt"
MemoWrit( "&Nomarch", cValToChar("Error:"+ErrorCode) )
ENDIF
IF SiRet
// ACA HAGO EL CIERRE MANUAL TOMANDO LOS AFORADORES DE LOS DESPACHOS
USE CONFICEM NEW
DATABASE oDbf5
oDbf5:bEoF=nil
oDbf5:bBoF=nil
oDbf5:GoTop()
DO WHILE !oDbf5:Eof()
CieProd[oDbf5:RecNo()]:=oDbf5:TIPOPRODU
CiePrec[oDbf5:RecNo()]:=oDbf5:PRECPICO
oDbf5:Skip()
ENDDO
oDbf5:Close()
FOR Q=1 TO 128
CieAfoF[Q]:=0
CieAfoI[Q]:=0
VtaV[Q] :=0
VtaI[Q] :=0
NEXT
FOR Q=1 TO 10
VtaProV[Q]:=0
VtaProI[Q]:=0
VtaProP[Q]:=0
NEXT
TotV:=0
TotI:=0
USE VTAFUS NEW
DATABASE oDbf3
oDbf3:bEoF=nil
oDbf3:bBoF=nil
oDbf3:GoTop()
USE CEM44CIE NEW
DATABASE oDbf4
oDbf4:bEoF=nil
oDbf4:bBoF=nil
oDbf4:GoBottom()
NumCie:=oDbf4:NUMERO+1
oDbf4:GoTop()
SELECT VTAFUS
oDbf3:GoTop()
DO WHILE !oDbf3:Eof()
CieAfoI[oDbf3:PICO]:=oDbf3:AFOFIN
oDbf3:Skip()
ENDDO
SELECT VENTAS44
oDbf2:GoBottom()
CieAct:=oDbf2:NROCIERRE
DO WHILE !oDbf2:Bof() .AND. (oDbf2:FECHA=DATE() .OR. oDbf2:FECHA=(DATE()-1))
IF oDbf2:PICO>0
IF CieAfoF[oDbf2:PICO]=0
CieAfoF[oDbf2:PICO]:=oDbf2:AFORAFIN
IF CieAfoI[oDbf2:PICO]=0
CieAfoI[oDbf2:PICO]:=oDbf2:AFORAFIN
ENDIF
ENDIF
ENDIF
oDbf2:Skip(-1)
ENDDO
FOR Q=1 TO 128
IF CieAfoI[Q]>0 .AND. CieAfoF[Q]=0
CieAfoF[Q]:=CieAfoI[Q]
ENDIF
NEXT
SELECT VTAFUS
oDbf3:GoTop()
FOR Q=1 TO 128
VtaV[Q]:=ROUND((CieAfoF[Q]-CieAfoI[Q]),2)
VtaI[Q]:=ROUND((VtaV[Q]*CiePrec[Q]),2)
oDbf3:RecLock()
oDbf3:FECHA :=DATE()
oDbf3:HORA :=TIME()
oDbf3:TURNO :=NumCie
oDbf3:PICO :=Q
oDbf3:PRODUC:=CieProd[Q]
oDbf3:PRECIO:=CiePrec[Q]
oDbf3:AFOINI:=CieAfoI[Q]
oDbf3:AFOFIN:=CieAfoF[Q]
oDbf3:VTAVOL:=VtaV[Q]
oDbf3:VTAIMP:=VtaI[Q]
oDbf3:Save()
oDbf3:Unlock()
oDbf3:Skip()
NEXT
oDbf3:GoTop()
DO WHILE !oDbf3:Eof()
IF oDbf3:PRODUC>0 .AND. oDbf3:VTAVOL>0
VtaProV[oDbf3:PRODUC]:=VtaProV[oDbf3:PRODUC]+oDbf3:VTAVOL
VtaProI[oDbf3:PRODUC]:=VtaProI[oDbf3:PRODUC]+oDbf3:VTAIMP
ENDIF
oDbf3:Skip()
ENDDO
FOR Q=1 TO 10
TotV:=TotV+VtaProV[Q]
TotI:=TotI+VtaProI[Q]
NEXT
FOR Q=1 TO 10
IF VtaProV[Q]>0
VtaProP[Q]:=ROUND(((VtaProV[Q]*100)/TotV),2)
ENDIF
NEXT
SELECT CEM44CIE
FOR Q=1 TO 128
IF VtaV[Q]>0
oDbf4:Append()
oDbf4:NUMERO :=NumCie
oDbf4:FECHA :=DATE()
oDbf4:HORA :=TIME()
oDbf4:TOTPESOS :=TotI
oDbf4:TOTLITROS :=TotV
oDbf4:TOTSINIMP :=0
oDbf4:TOTSINLIT :=0
oDbf4:TOTPRUIMP :=0
oDbf4:TOTPRULIT :=0
oDbf4:TOTYERIMP :=0
oDbf4:TOTYERLIT :=0
oDbf4:PRODUCTO1I:=VtaProI[1]
oDbf4:PRODUCTO1L:=VtaProV[1]
oDbf4:PRODUCTO1P:=VtaProP[1]
oDbf4:PRODUCTO2I:=VtaProI[2]
oDbf4:PRODUCTO2L:=VtaProV[2]
oDbf4:PRODUCTO2P:=VtaProP[2]
oDbf4:PRODUCTO3I:=VtaProI[3]
oDbf4:PRODUCTO3L:=VtaProV[3]
oDbf4:PRODUCTO3P:=VtaProP[3]
oDbf4:PRODUCTO4I:=VtaProI[4]
oDbf4:PRODUCTO4L:=VtaProV[4]
oDbf4:PRODUCTO4P:=VtaProP[4]
oDbf4:PRODUCTO5I:=VtaProI[5]
oDbf4:PRODUCTO5L:=VtaProV[5]
oDbf4:PRODUCTO5P:=VtaProP[5]
oDbf4:PRODUCTO6I:=VtaProI[6]
oDbf4:PRODUCTO6L:=VtaProV[6]
oDbf4:PRODUCTO6P:=VtaProP[6]
oDbf4:PRODUCTO7I:=VtaProI[7]
oDbf4:PRODUCTO7L:=VtaProV[7]
oDbf4:PRODUCTO7P:=VtaProP[7]
oDbf4:PRODUCTO8I:=VtaProI[8]
oDbf4:PRODUCTO8L:=VtaProV[8]
oDbf4:PRODUCTO8P:=VtaProP[8]
oDbf4:PRODUCTO9I:=VtaProI[9]
oDbf4:PRODUCTO9L:=VtaProV[9]
oDbf4:PRODUCTO9P:=VtaProP[9]
oDbf4:PRODUCTO0I:=VtaProI[10]
oDbf4:PRODUCTO0L:=VtaProV[10]
oDbf4:PRODUCTO0P:=VtaProP[10]
oDbf4:SURTILIT :=VtaV[Q]
oDbf4:SURTIIMP :=VtaI[Q]
oDbf4:CERRADO :=" "
oDbf4:CERRADON :=" "
oDbf4:CERRADOL :=" "
oDbf4:Save()
oDbf4:Unlock()
ENDIF
NEXT
SELECT VENTACEM
oDbf1:GoTop()
DO WHILE !oDbf1:Eof()
oDbf1:Load()
oDbf1:ANTERIORNU:=0
oDbf1:ANTERIORLI:=0
oDbf1:ANTERIORIM:=0
oDbf1:ANTERIORFE:=CTOD(" / / ")
oDbf1:ANTERIORHO:=" "
oDbf1:ANTESURTI :=0
oDbf1:ANTERIORMA:=" "
oDbf1:ANTERIORPR:=0
oDbf1:ANTEPPU :=0
oDbf1:ANTTOMADO :=.f.
oDbf1:ULTIMANU :=0
oDbf1:ULTIMALI :=0
oDbf1:ULTIMAIM :=0
oDbf1:ULTIMAFE :=CTOD(" / / ")
oDbf1:ULTIMAHO :=" "
oDbf1:ULTISURTI :=0
oDbf1:ULTIMAMA :=" "
oDbf1:ULTIMAPR :=0
oDbf1:ULTIPPU :=0
oDbf1:ULTTOMADO :=.f.
oDbf1:RecLock()
oDbf1:Save()
oDbf1:Unlock()
oDbf1:Skip()
ENDDO
SELECT VENTAS44
oDbf2:GoTop()
oDbf2:Append()
oDbf2:FECHA :=DATE()
oDbf2:HORA :=TIME()
oDbf2:SURTIDOR :=0
oDbf2:MANGUERA :=" "
oDbf2:PICO :=0
oDbf2:PRODUCTO :=0
oDbf2:LITROS :=0
oDbf2:IMPORTE :=0
oDbf2:PRECIO :=0
oDbf2:NUMEROVTA:=0
oDbf2:AFORAINI :=0
oDbf2:AFORAFIN :=0
oDbf2:Save()
oDbf2:Unlock()
oDbf3:Close()
oDbf4:Close()
// RESULTADO DEL CIERRE
NomArch:="ResultadoCierre.txt"
MemoWrit( "&Nomarch", cValToChar("ST:"+St+CHR(13)+"MESSAGE:"+Message+CHR(13)+"ERRORCODE:"+ErrorCode+CHR(13)+"PID:"+Pid+CHR(13)+"PERIODTYPE:"+PeriodType) )
//
///////////////////////////////////////////////////////////////////
ENDIF
ENDIF
oTimer:Activate()
//
Return nil
******************************************************************************
********************** CONECTAR O DESCONECTAR DEL FUSION *********************
Function ConecFusion(Par)
Local SiRet,Q
Private _IPCem
_IPCem:=LaIP
IF Par="C"
Controlador:=CreateObject("Fusion")
Controlador:Connection("&_IPCem")
FOR Q=1 TO 10
SiRet:=Controlador:ConnectionStatus()
IF !SiRet
Inkey(2)
Controlador:Connection("&_IPCem")
ELSE
Q:=100
ENDIF
NEXT
IF !SiRet
MsgWait("NO PUDO CONECTAR CON EL FUSION.","ATENCION",3)
Return .f.
ENDIF
ENDIF
IF Par="D"
SiRet:=Controlador:ConnectionStatus()
IF SiRet
Controlador:Close()
Controlador:End()
ENDIF
ENDIF
Return .t.
******************************************************************************
***********************************************************************************************
***************************** FUNCIONES GENERALES *********************************************
***********************************************************************************************
// VERIFICO SI YA ESTA CORRIENDO
Function VerSiExe()
Local Q,aTask,Flag:=0
aTask:=GetTask()
FOR Q=1 TO LEN(aTask)
IF aTask[Q]="WEST POINT Software - Comunicacion con Fusion Controller"
Flag++
ENDIF
NEXT
IF Flag>1
MsgWait("El servicio ya se esta ejecutando.","ERROR",3)
Return .f.
ELSE
Return .t.
ENDIF
Return nil
//
//
Function CargaArch(Ruta,Objeto)
Ruta :=cGetFile32()
Objeto:Refresh()
Return Ruta
//
// CORRE EL EXE COMO UN SERVICIO
Function ServiceProcess( mode )
Local nProcessId := 0
Default mode := 0
nProcessId := GCP( )
If Abs( nProcessId ) > 0
RSProcess( nProcessId, mode )
Endif
Return nil
//
// VER APLICACIONES CORRIENDO
Function GetTask()
local hWnd := GetWindow( GetActiveWindow(), GHW_HWNDFIRST )
local aTasks := {}
local cTask
while hWnd != 0
#ifdef __CLIPPER__
cTask = GetModuleFileName( GetWindowWord( hWnd, GWW_HINSTANCE ) )
#else
cTask = GetWindowText( hWnd ) // The above does now work
#endif
AAdd( aTasks, cTask )
hWnd = GetWindow( hWnd, GHW_HWNDNEXT )
end
Return aTasks
//
DLL32 FUNCTION RSProcess(npID AS LONG, nMode AS LONG ) AS LONG FROM "RegisterServiceProcess" LIB "Kernel32.dll"
DLL32 FUNCTION GCP() AS LONG FROM "GetCurrentProcessId" LIB "Kernel32.dll"
DLL32 FUNCTION PeriodSalesByGrade( pt AS
LPSTR, periodID AS
LPSTR, pte AS
LPSTR, @periodInfo AS
LPSTR ) AS BOOL FROM "Fusion" LIB "FusionClass.dll"
DLL32 FUNCTION PeriodSalesByPaymentType( pt AS
LPSTR, periodID AS
LPSTR, @periodInfo AS
LPSTR ) AS BOOL FROM "Fusion" LIB "FusionClass.dll"
***********************************************************************************************
***********************************************************************************************
***********************************************************************************************