Code: Select all | Expand
//----------------------
static function manifiesto(aAlias)
local seguir:=.F.
local oDlg,oDlg1,oGet,oSay,oBrw1,oBrw2,oBrw3
local cini:=Date()
local titulo:= "Preparacion del Manifiesto"
local titulopanta
local tboton,ruta,nuconduc,noconduc
local calias1:=aAlias[26]
local calias2,cAlias3
local xnuconduc
local aData2:={}
local aData3:={}
DEFINE DIALOG oDlg1 FROM 10, 10 TO 20, 50
oDlg1:cTitle:="fecha para el manifiesto"
@ 15, 10 Say oSay Prompt "Fecha del Manifiesto" OF oDlg1 PIXEL SIZE 50,10
@ 15, 70 Get oGet VAR cini OF oDlg1 PIXEL SIZE 35,10
@ 50,20 BTNBMP RESOURCE "grabasql" SIZE 30,20 OF oDlg1 PROMPT " Seguir " TOP ACTION (seguir:=.T.,oDlg1:End())
@ 50,100 BTNBMP RESOURCE "salirsql" SIZE 30,20 OF oDlg1 PROMPT " Cancelar" TOP ACTION (oDlg1:End())
ACTIVATE DIALOG oDlg1 CENTERED
if seguir
(aAlias[26])->(Dbgotop())
if file (Publicas:cUnidad+Publicas:cSubd+"\Manifiesto.dbf")
tboton:=alert("HAY UN MANIFIESTO CREADO QUE QUIERES HACER ?",{"Modificarlo","Crear uno nuevo","Abandonar"},"ATENCION, PREGUNTA")
if tboton = 3
return nil
endif
if tboton = 2
ferase(Publicas:cUnidad+Publicas:cSubd+"\Manifiesto.dbf")
ferase(Publicas:cUnidad+Publicas:cSubd+"\Manifiesto.cdx")
DbCreate(Publicas:cunidad+Publicas:cSubd+"\Manifiesto", ;
{ { "Albaran" ,"C", 7, 0 },;
{ "Fecha" ,"D", 8, 0 },;
{ "Consigna" ,"C", 35, 0 },;
{ "Domicilio" ,"C", 40, 0 },;
{ "Poblacion" ,"C", 24, 0 },;
{ "Remite" ,"C", 35, 0 },;
{ "Poblar" ,"C", 24, 0 },;
{ "Bultos" ,"N", 6, 0 },;
{ "Peso" ,"N", 6, 0 },;
{ "Nconduc" ,"C", 5, 0 },;
{ "Cconduc" ,"C", 35, 0 },;
{ "Ruta" ,"C", 2, 0 } } )
dbUseArea(.T.,,Publicas:cUnidad+Publicas:cSubd+"\Manifiesto",,.T.)
(aAlias[24])->(Ordscope(0,dtos(cIni)))
(aAlias[24])->(Ordscope(1,dtos(cIni)))
(aAlias[24])->(Dbgotop())
Do While !(aAlias[24])->(Eof())
ruta:=(aAlias[24])->Rutac
nuconduc:=space(5)
noconduc:=space(35)
if (aAlias[29])->(Dbseek(ruta))
nuconduc:=(aAlias[29])->conductor
noconduc:=(aAlias[29])->nombre
endif
While .not. Manifiesto->(Rlock()); end
Manifiesto->(dbAppend())
Manifiesto->Albaran := (aAlias[24])->Albaran
Manifiesto->Fecha := (aAlias[24])->Fecha
Manifiesto->Consigna := iif((aAlias[24])->CR = "C",(aAlias[24])->Pro,(aAlias[24])->Prou)
Manifiesto->Domicilio:= iif((aAlias[24])->CR = "C",(aAlias[24])->DomiPro,(aAlias[24])->Domicilio)
Manifiesto->Poblacion:= iif((aAlias[24])->CR = "C",(aAlias[24])->Pobla,(aAlias[24])->Pobla1)
Manifiesto->Remite := iif((aAlias[24])->CR = "C",(aAlias[24])->Prou,(aAlias[24])->Pro)
Manifiesto->Poblar := iif((aAlias[24])->CR = "C",(aAlias[24])->Pobla1,(aAlias[24])->Pobla)
Manifiesto->Bultos := iif((aAlias[24])->BK = "K",(aAlias[24])->kilos,(aAlias[24])->kkilos)
Manifiesto->Peso := iif((aAlias[24])->bk = "K",(aAlias[24])->kkilos,(aAlias[24])->kilos)
Manifiesto->nconduc := nuconduc
Manifiesto->Cconduc := noconduc
Manifiesto->Ruta := (aAlias[24])->Rutac
Manifiesto->( dbUnlock() )
(aAlias[24])->(Dbskip())
enddo
Manifiesto->(Dbclosearea())
(aAlias[24])->(Ordscope(0,nil))
(aAlias[24])->(Ordscope(1,nil))
endif
endif
xnuconduc:=(aAlias[26])->Codigo
dbUseArea(.T.,,Publicas:cUnidad+Publicas:cSubd+"\Manifiesto","Manifiesto",.T.)
aData2:=creaelarray2(xnuconduc)
aData3:=creaelarray3(xnuconduc)
titulopanta:=" ENVIOS DEL DIA : " + dtoc(cini)
DEFINE DIALOG oDlg FROM 1, 1 TO 50, 200
oDlg:cTitle:=titulo
@ 10, 10 Say oSay PROMPT titulopanta OF oDlg PIXEL SIZE 600,15 COLOR nRGb( 251, 151, 71 ) Font Publicas:frosa
oSay:lTransparent := .t.
//-----------Primer browse
@ 30, 0 xbrowse oBrw1 OF oDlg ;
ALIAS cAlias1;
COLUMNS "Codigo","Nombre";
AUTOSORT LINES CELL FOOTERS NOBORDER SIZE -645,-30 PIXEL
WITH OBJECT oBrw1
:SetGroupHeader( "Conductores", 1, 2)
:nColDividerStyle := LINESTYLE_BLACK
:lColDividerComplete := .T.
:l2007 := .T.
:lRecordSelector := .F.
:lAllowColHiding := .F.
:lAllowColSwapping := .F.
:nStretchCol := 2
:bChange := {|| xnuconduc:=oBrw1:aCols[1]:value,aData2:=creaelarray2(xnuconduc),aData3:=creaelarray3(xnuconduc),oBrw2:Refresh(),oBrw3:Refresh(),sysrefresh(),oDlg:Refresh()}
:bClrStd:= { || { CLR_BLACK, If( oBrw1:KeyNo % 2 == 0, nRGB(242,247,252),nRGB(226,226,208) ) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS //6
:MakeTotals()
:CreateFromCode()
END WITH
//----------Segundo browse
@ 30, 145 xbrowse oBrw2 OF oDlg ;
Datasource aData2;
AUTOCOLS LINES CELL FOOTERS NOBORDER SIZE -325,-30 PIXEL
WITH OBJECT oBrw2:aCols[ 3 ]
:cHeader := "Consignatario"
:nWidth := 190
END WITH
WITH OBJECT oBrw2:aCols[ 2 ]
:cHeader := "Domicilio"
:nWidth := 180
END WITH
WITH OBJECT oBrw2:aCols[ 1 ]
:cHeader := "Poblacion"
:nWidth := 150
END WITH
WITH OBJECT oBrw2:aCols[ 4 ]
:cHeader := "Bultos"
:nWidth := 40
END WITH
WITH OBJECT oBrw2:aCols[ 5 ]
:cHeader := "Kilos"
:nWidth := 40
END WITH
WITH OBJECT oBrw2
:SetGroupHeader( "Entregas del Conductor Seleccionado", 1, 5)
:nColDividerStyle := LINESTYLE_BLACK
:lColDividerComplete := .T.
:l2007 := .T.
:lRecordSelector := .F.
:lAllowColHiding := .F.
:lAllowColSwapping := .F.
:nStretchCol := 2
:bClrStd:= { || { CLR_BLACK, If( oBrw2:KeyNo % 2 == 0, nRGB(242,247,252),nRGB(226,226,208) ) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS //6
:MakeTotals()
:CreateFromCode()
END WITH
//----------Tercer browse
@ 30, 465 xbrowse oBrw3 OF oDlg ;
Datasource aData3;
AUTOCOLS LINES CELL FOOTERS NOBORDER SIZE -5,-30 PIXEL
WITH OBJECT oBrw3:aCols[ 3 ]
:cHeader := "Consignatario"
:nWidth := 190
END WITH
WITH OBJECT oBrw3:aCols[ 2 ]
:cHeader := "Domicilio"
:nWidth := 180
END WITH
WITH OBJECT oBrw3:aCols[ 1 ]
:cHeader := "Poblacion"
:nWidth := 150
END WITH
WITH OBJECT oBrw3:aCols[ 4 ]
:cHeader := "Bultos"
:nWidth := 40
END WITH
WITH OBJECT oBrw3:aCols[ 5 ]
:cHeader := "Kilos"
:nWidth := 40
END WITH
WITH OBJECT oBrw3
:SetGroupHeader( "Entregas de otros conductores", 1, 5)
:nColDividerStyle := LINESTYLE_BLACK
:lColDividerComplete := .T.
:l2007 := .T.
:lRecordSelector := .F.
:lAllowColHiding := .F.
:lAllowColSwapping := .F.
:nStretchCol := 2
:bClrStd:= { || { CLR_BLACK, If( oBrw3:KeyNo % 2 == 0, nRGB(242,247,252),nRGB(226,226,208) ) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS //6
:MakeTotals()
:CreateFromCode()
END WITH
@ 343,350 BTNBMP RESOURCE "gExcel" SIZE 50,25 OF oDlg PROMPT " Excel" TOP ACTION (oDlg:End())
@ 343,450 BTNBMP RESOURCE "salirsql" SIZE 50,25 OF oDlg PROMPT " Salir" TOP ACTION (oDlg:End())
@ 343,550 BTNBMP RESOURCE "gExcel" SIZE 50,25 OF oDlg PROMPT " CSV" TOP ACTION (oDlg:End())
ACTIVATE DIALOG oDlg CENTERED
endif
return nil
//----------------
static function creaelarray2(xnuconduc)
local aData2:={}
Manifiesto->( FW_DbfToArray("Poblacion,Domicilio,Consigna,Bultos,Peso" , {|| field->nconduc = xnuconduc .and. !Deleted() }, , , , , aData2 ) )
if len(aData2) = 0
AAdd( aData2,{" " ," ", " "," "," "})
endif
return aData2
//----------------
static function creaelarray3(xnuconduc)
local aData3:={}
Manifiesto->( FW_DbfToArray("Poblacion,Domicilio,Consigna,Bultos,Peso" , {|| field->nconduc <> xnuconduc .and. !Deleted() }, , , , , aData3 ) )
if len(aData3) = 0
AAdd( aData3,{" " ," ", " "," "," "})
endif
return aData3
la base de datos con la que se trabaja, una vez construida por este fuente se llama "Manifiesto.dbf"
Tambien se utiliza la base de datos Conduc.dbf,(aAlias[26]) cuya estructura es:
Code: Select all | Expand
local aFields := { { "CODIGO", "C", 5, 0 },;
{ "FILTRO", "C", 1, 0 },;
{ "SS", "C", 14, 0 },;
{ "DNI", "C", 9, 0 },;
{ "TELEFONO", "C", 9, 0 },;
{ "TELEFONO1", "C", 9, 0 },;
{ "NOMBRE", "C", 30, 0 },;
{ "CO01", "N", 12, 2 },;
{ "CO02", "N", 12, 2 },;
{ "CO03", "N", 12, 2 },;
{ "CO04", "N", 12, 2 },;
{ "CO05", "N", 12, 2 },;
{ "CO06", "N", 12, 2 },;
{ "CO07", "N", 12, 2 },;
{ "CO08", "N", 12, 2 },;
{ "CO09", "N", 12, 2 },;
{ "CO10", "N", 12, 2 },;
{ "CO11", "N", 12, 2 },;
{ "CO12", "N", 12, 2 },;
{ "CR01", "N", 12, 2 },;
{ "CR02", "N", 12, 2 },;
{ "CR03", "N", 12, 2 },;
{ "CR04", "N", 12, 2 },;
{ "CR05", "N", 12, 2 },;
{ "CR06", "N", 12, 2 },;
{ "CR07", "N", 12, 2 },;
{ "CR08", "N", 12, 2 },;
{ "CR09", "N", 12, 2 },;
{ "CR10", "N", 12, 2 },;
{ "CR11", "N", 12, 2 },;
{ "CR12", "N", 12, 2 },;
{ "TOT", "N", 12, 2 },;
{ "NOMINA", "N", 12, 2 },;
{ "METALICO", "N", 12, 2 },;
{ "NO01", "N", 12, 2 },;
{ "NO02", "N", 12, 2 },;
{ "NO03", "N", 12, 2 },;
{ "NO04", "N", 12, 2 },;
{ "NO05", "N", 12, 2 },;
{ "NO06", "N", 12, 2 },;
{ "NO07", "N", 12, 2 },;
{ "NO08", "N", 12, 2 },;
{ "NO09", "N", 12, 2 },;
{ "NO10", "N", 12, 2 },;
{ "NO11", "N", 12, 2 },;
{ "NO12", "N", 12, 2 },;
{ "ME01", "N", 12, 2 },;
{ "ME02", "N", 12, 2 },;
{ "ME03", "N", 12, 2 },;
{ "ME04", "N", 12, 2 },;
{ "ME05", "N", 12, 2 },;
{ "ME06", "N", 12, 2 },;
{ "ME07", "N", 12, 2 },;
{ "ME08", "N", 12, 2 },;
{ "ME09", "N", 12, 2 },;
{ "ME10", "N", 12, 2 },;
{ "ME11", "N", 12, 2 },;
{ "ME12", "N", 12, 2 },;
{ "EX01", "N", 12, 2 },;
{ "EX02", "N", 12, 2 },;
{ "EX03", "N", 12, 2 },;
{ "EX04", "N", 12, 2 },;
{ "EX05", "N", 12, 2 },;
{ "EX06", "N", 12, 2 },;
{ "EX07", "N", 12, 2 },;
{ "EX08", "N", 12, 2 },;
{ "EX09", "N", 12, 2 },;
{ "EX10", "N", 12, 2 },;
{ "EX11", "N", 12, 2 },;
{ "EX12", "N", 12, 2 },;
{ "AN01", "N", 12, 2 },;
{ "AN02", "N", 12, 2 },;
{ "AN03", "N", 12, 2 },;
{ "AN04", "N", 12, 2 },;
{ "AN05", "N", 12, 2 },;
{ "AN06", "N", 12, 2 },;
{ "AN07", "N", 12, 2 },;
{ "AN08", "N", 12, 2 },;
{ "AN09", "N", 12, 2 },;
{ "AN10", "N", 12, 2 },;
{ "AN11", "N", 12, 2 },;
{ "AN12", "N", 12, 2 },;
{ "DPAGO", "N", 1, 0 },;
{ "CODPOBLA", "C", 5, 0 },;
{ "CALLE", "C", 40, 0 },;
{ "POBLA", "C", 24, 0 },;
{ "PROVIN", "C", 23, 0 },;
{ "CODPROVIN", "C", 2, 0 },;
{ "CP", "C", 5, 0 },;
{ "APE1", "C", 25, 0 },;
{ "APE2", "C", 25, 0 },;
{ "NOMB1", "C", 36, 0 },;
{ "FECHALTA", "D", 8, 0 },;
{ "FECHAFIN", "D", 8, 0 },;
{ "EMPRESA", "C", 1, 0 },;
{ "NEMPRESA", "C", 30, 0 },;
{ "TOTALC", "N", 12, 2 },;
{ "ENTIDAD", "C", 4, 0 },;
{ "AGENCIA", "C", 4, 0 },;
{ "DC", "C", 2, 0 },;
{ "CUENTA", "C", 10, 0 },;
{ "FNAC", "D", 8, 0 },;
{ "PCOMISION", "N", 5, 2 },;
{ "PR01", "N", 12, 2 },;
{ "PR02", "N", 12, 2 },;
{ "PR03", "N", 12, 2 },;
{ "PR04", "N", 12, 2 },;
{ "PR05", "N", 12, 2 },;
{ "PR06", "N", 12, 2 },;
{ "PR07", "N", 12, 2 },;
{ "PR08", "N", 12, 2 },;
{ "PR09", "N", 12, 2 },;
{ "PR10", "N", 12, 2 },;
{ "PR11", "N", 12, 2 },;
{ "PR12", "N", 12, 2 },;
{ "ACTIVO", "C", 1, 0 },;
{ "LISTAR", "C", 1, 0 } }
DbCreate( "myfile.dbf", aFields, "DBFCDX" )
USE myfile.dbf NEW VIA "DBFCDX"
INDEX ON Conduc->Codigo TAG CODIGO
INDEX ON Conduc->Nombre TAG NOMBRE
Que basicamente se utiliza en el primer xbrowse (solo codigo y nombre) para ir eligiendo el conductor en el segudo xbrowse y descartando este conductor en el tercer xbrowse.