get_results(sql_ordenes_por_cargar()); foreach ($result2 as $row) { $concobro=0; if(strtoupper($row->MetodoPago)=="'COD'") $concobro=1; for($i=1;$i<=$row->cantidad;$i++) { $valinsert="(".$row->IdOrder.",".$row->idProducto.",".$i.",".$row->NumberOrder.",".$row->PesoTotal .",".$row->ValorDeclaradoTotal.",".$row->DesCiudadDestino.",".$row->Direccion.",".$row->Contacto .",".$row->DiceContener.",".$row->Alto.",".$row->Ancho.",".$row->Largo .",".$row->DesDptoDestino.",".$row->Correo_Electronico.",".$row->Telefono.",".$row->MetodoPago .",".$row->FechaCreacion.",".$row->FechaActualizacion.",".$concobro.",'1','',NOW())"; $sqlinsert="INSERT INTO wp_PedidoEnvio (IdOrder, idProducto, nroItem, NumberOrder, PesoTotal, ValorDeclaradoTotal, DesCiudadDestino, Direccion, Contacto, DiceContener, Alto, Ancho, Largo, DesDptoDestino, Correo_Electronico, Telefono, TipoPago, FechaCreacion, FechaActualizacion,concobro,nombreTienda,Num_Factura,FechaActualizacionEstado) values ".$valinsert; $wpdb->query($sqlinsert); } } /************************************************************************************************************/ ?>
11";} if($filtropedido["enProceso"]=="0") {$where .=" and idEstado=11";} if(!empty($filtropedido["nombreArchivo"])) $where .=" AND nombreArchivo='".$filtropedido["nombreArchivo"]."' "; if(!empty($filtropedido["DesCiudadDestino"])) $where .=" AND DesCiudadDestino = '".$filtropedido["DesCiudadDestino"]."' "; if(!empty($filtropedido["DesDptoDestino"])) $where .=" AND DesDptoDestino = '".$filtropedido["DesDptoDestino"]."' "; if(!empty($filtropedido["TipoPago"])) $where .=" AND TipoPago = '".$filtropedido["TipoPago"]."' "; if(is_numeric($filtropedido["ConCobro"])) $where .=" AND ConCobro =".$filtropedido["ConCobro"]; if(!empty($filtropedido["idEstado"]) && $filtropedido["enProceso"]=="1" ) $where .=" AND wp_PedidoEnvio.idEstado=".$filtropedido["idEstado"]; if(!empty($filtropedido["NumberOrder"])) $where .=" AND NumberOrder in (".$filtropedido["NumberOrder"].") "; if(!empty($filtropedido["NroGuia"])) $where .=" AND NroGuia in (".$filtropedido["NroGuia"].")"; if(!empty($filtropedido["fromFC"]) && !empty($filtropedido["toFC"])) $where .=" AND date(FechaCreacion) BETWEEN '".$filtropedido["fromFC"]."' AND '".$filtropedido["toFC"]."'"; if(!empty($filtropedido["fromFM"]) && !empty($filtropedido["toFM"])) $where .=" AND date(FechaCreacion) BETWEEN '".$filtropedido["fromFM"]."' AND '".$filtropedido["toFM"]."'"; if(empty($where)){ echo "Seleccione los criterios para consultar los envíos"; echo die();} /*Ciudad de destino Dpto de destino Nombre destintario Teléfono*/ $sql="SELECT nombreArchivo,IdOrder, NumberOrder, NroGuia, case TieneRecoleccionEsp when 0 then 'No' when 1 THEN 'Si' end TieneRecoleccionEsp, case ConCobro when 0 then 'Normal' when 1 then 'Con cobro' end MercanciaPremier, idEstado DescEstado, DATE_FORMAT(FechaCreacion,'%d/%m/%Y') FechaCreacion, DATE_FORMAT(FechaActualizacion,'%d/%m/%Y') FechaActualizacion, PesoTotal, Contacto,DiceContener, Alto, Ancho, Largo, case when DesDptoDestino='DC' then 'CUN' else DesDptoDestino END DesDptoDestino, Num_Factura, Correo_Electronico, Telefono, TipoPago, TieneRecoleccionEsp recEsporadica, ConCobro,DescripcionError,idPedidoEnvio,DesCiudadDestino,PickupRequestNumber, IdEstadoEnvio, Estado_Envio, Fecha_Entrega, Novedad, FechaActualizacionEstado,idProducto,nroItem, ValorDeclaradoTotal,Direccion FROM wp_PedidoEnvio /*inner join ps_EstadoEnvio on ps_PedidoEnvio.idEstado=ps_EstadoEnvio.IdEstado*/ WHERE 1 ".$where; $result=$wpdb->get_results($sql); ?>