Retroceder   Foros del Web > Diseño de Sitios web > Flash y Actionscript > Flex

Respuesta
 
Herramientas Desplegado
Antiguo 12-mar-2008, 19:08   #1 (permalink)
Sergestux no se puede cailificar en este momento
 
Avatar de Sergestux
 
Fecha de Ingreso: agosto-2007
Ubicación: Tijuas
Mensajes: 357
Enviar un mensaje por Yahoo  a Sergestux
Pasar el valor de un DateField a un archivo PHP (Flex 3)

Hola a todos, veran estoy tratando de consultar una base de datos (postgres) por medio de una aplicacion flex, dicha consulta es en base a un rango de fechas que el usuario elija y es ahi donde no me sale, por que cuando yo defino los datos, como en mi ejemplo que puse no hay problema, pero al tratar de elegir las fechas de inicio y fin de la consulta no me sale nada, como pueden ver en la imagen.
Estos son mis codigos:

Flex
Código PHP:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="656">
    <mx:HTTPService id="userRequest" url="http://localhost/invtry/Ventas.php" method="POST" showBusyCursor="true"/>
    <mx:Panel id="Panel66" width="631" height="527" layout="absolute" title="Ventas del dia de Hoy" horizontalCenter="0" verticalCenter="-9">
        <mx:Form x="10" y="10" width="591" height="49">
                <mx:FormItem width="100%">
                        <mx:Grid width="100%">
                                <mx:GridRow width="100%">
                                        <mx:GridItem width="25%">
                                                <mx:Label text="Fecha Inicio:"/>
                                        </mx:GridItem>
                                        <mx:GridItem width="25%">
                                                <mx:DateField  id="fechaini"/>
                                        </mx:GridItem>
                                        <mx:GridItem width="25%">
                                                <mx:Label text="Fecha Fin:"/>
                                        </mx:GridItem>
                                        <mx:GridItem width="25%">
                                                <mx:DateField id="fechafin"/>
                                        </mx:GridItem>
                                </mx:GridRow>
                        </mx:Grid>
                </mx:FormItem>
                </mx:Form>
        <mx:DataGrid id="dgUserRequest" dataProvider="{userRequest.lastResult.Ventas.Sucursal}" width="591" height="357" y="91" x="10">
            <mx:columns>
                <mx:DataGridColumn headerText="Sucursal" dataField="SucDesc" />
                <mx:DataGridColumn headerText="Venta" dataField="Venta" />
                <mx:DataGridColumn headerText="Dato de Prueba" dataField="Prueba" />
            </mx:columns>
        </mx:DataGrid>
        <mx:FormItem y="456" x="27">
        <mx:Grid width="100%" horizontalAlign="center" id="buttonsGrid0">
            <mx:GridRow width="100%" height="100%" horizontalAlign="center" id="gridrow0">
                <mx:GridItem width="100%" height="100%" horizontalAlign="center">
                    <mx:Button label="Consultar" id="btnConsultar0" click="userRequest.send();"/>
                </mx:GridItem>
                <mx:GridItem width="100%" height="100%" horizontalAlign="center">
                    <mx:Button label="Insertar" id="btnInsertar0"/>
                </mx:GridItem>
                <mx:GridItem width="100%" height="100%" horizontalAlign="center">
                    <mx:Button label="Modificar" id="btnModificar0"/>
                </mx:GridItem>
                <mx:GridItem width="100%" height="100%" horizontalAlign="center">
                    <mx:Button label="Eliminar" id="btnEliminar0"/>
                </mx:GridItem>
            </mx:GridRow>
        </mx:Grid>
        </mx:FormItem>
    </mx:Panel>    
</mx:Application>
PHP

Código PHP:
<?
    
require('functions.php');
    require(
'config.php');
    
$cadcon "dbname=$database user=$username password=$password host=$host";    
    
    
$FechaIni=$_POST["fechaini"];
    
$FechaFin=$_POST["fechafin"];

    
$Ventas VentaFecha($cadcon"2008-01-01 04:00:00""2008-01-02 03:59:59"0,1);    
/************ ESTO NO ME FUNCIONA******************************
    $Ventas = VentaFecha($cadcon, "$FechaIni 04:00:00", "$FechaFin 03:59:59", 0,1);
*******************************************************************/    
    
$CantVentas pg_numrows($Ventas);        //Obtengo el total de las ventas
                            
        /*GUARDO TODOS LOS DATOS EN UNA MATRIZ DE DATOS*/
    //Almaceno las ventas de hoy
    
for($Cont=0$Cont<$CantVentas$Cont++)
    {
        
$SucActual=pg_result($Ventas$Cont0);    //El id de la sucursal
        
$Datos[$SucActual]["Hoy"]=pg_result($Ventas$Cont1);    //Almaceno la venta
    
}

    
$Sucursales=ObtieneSucursales($cadcon0true);    //Obtengo todas las sucursales incluyendo la de pruebas
    
$CantSuc=pg_numrows($Sucursales);        //La cantidad de sucursales

    
$Cadena "<Ventas>\n";
    for(
$Cont=0$Cont $CantSuc$Cont++)            //Recorro todas las sucursales
    

        
$Cadena .= "\t<Sucursal>\n";
        
$SucActual=pg_result($Sucursales$Cont0);    //El id de la sucursal
        
$SucDesc obten_desc_loc$cadcon$SucActual);
        
$Cadena .= "\t\t<SucDesc>$SucDesc</SucDesc>\n";    //Sucursal
        
$Cadena .= "\t\t<Venta>" number_format($Datos[$SucActual]["Hoy"], 2'.'',' ) . "</Venta>\n";    //Ventas de hoy
        
$Cadena .= "\t\t<Prueba>$FechaIni-$FechaFin</Prueba>\n";    //Datos de Prueba (ACA TAMPOCO ME MUESTRA LAS FECHAS)
        
$Cadena .= "\t</Sucursal>\n";    
    }
    
$Cadena .= "</Ventas>";
    print (
$Cadena);    
?>
__________________
You'll be free, hackers, you'll be free
Sergestux está desconectado   Responder Citando
Antiguo 14-mar-2008, 13:38   #2 (permalink)
Sergestux no se puede cailificar en este momento
 
Avatar de Sergestux
 
Fecha de Ingreso: agosto-2007
Ubicación: Tijuas
Mensajes: 357
Enviar un mensaje por Yahoo  a Sergestux
Re: Pasar el valor de un DateField a un archivo PHP (Flex 3)

Me autorespondo le agregue unas funciones a mi codigo;
Código PHP:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="656" creationComplete="Inicializar();">
<
mx:DateFormatter id="formateador" formatString="YYYY-MM-DD" />
<
mx:Script>
<![
CDATA[
   function 
Inicializar()
   {
      
fechaini.text=FormateaFecha(new Date());      
      
fechafin.text=FormateaFecha(new Date());      
   }

   function 
FormateaFecha(fecha:Date):String
    
{
       return 
formateador.format(fecha);
    }
 
  function 
Consultar(){
     var 
params:Object = {};
     
params.fechaini FormateaFecha(fechaini.selectedDate);
     
params.fechafinFormateaFecha(fechafin.selectedDate);
     
userRequest.send(params);
  }

]]>
</
mx:Script>

<
mx:Button label="Consultar" id="btnConsultar0" click="Consultar();"/> 
Por cierto la solución me la dieron en el foro de cristal lab
__________________
You'll be free, hackers, you'll be free

Última edición por Sergestux; 14-mar-2008 a las 13:38. Razón: Cristal lab
Sergestux está desconectado   Responder Citando
Respuesta
No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 22:26.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93