// error_reporting(E_ALL & ~E_NOTICE); error_reporting(E_ALL); include('includes/configure.php'); // Funci�n necesaria para la conexi�n, debe estar definida en configure.php if (!function_exists('tep_db_query')) { echo "Error: La funci�n tep_db_query no est� definida. Aseg�rate de que 'includes/configure.php' est� completo."; exit; } //-------------------------------------------------------------------------------------- // 1. Manejo de variables de filtro: Ahora son dos fechas if (strlen($_POST['fechaInicio'])==0) { $_POST['fechaInicio'] = date('Y-m-d', strtotime('-7 days')); // Valor predeterminado: hace 7 d�as } if (strlen($_POST['fechaFin'])==0) { $_POST['fechaFin'] = date('Y-m-d'); // Valor predeterminado: hoy } $fechaInicio = $_POST['fechaInicio']; $fechaFin = $_POST['fechaFin']; $transportistaFiltro = $_POST['transportistaFiltro']; // 2. Obtener la lista de transportistas para el formulario (incluyendo 'Todos') $transportistas_query = "SELECT id_carrier, name FROM ps_carrier where deleted<>1 ORDER BY name"; $transportistas_result = tep_db_query($transportistas_query); $transportistas_array = array(); while ($row = tep_db_fetch_array($transportistas_result)) { $transportistas_array[$row['id_carrier']] = $row['name']; } $status_array = array(); $texto_query = "select o.id_order orders_id,postcode delivery_postcode,city delivery_city,CONCAT(ad.address1,' ',ad.address2) delivery_street_address,CONCAT(ifnull(message,''),' ',other) comentariosPedido,tramo_date shipdate,CONCAT(phone,' ',phone_mobile) customers_telephone,CONCAT(ad.firstname,' ',ad.lastname) delivery_name, tramo_from prefEntrega,payment payment_method,o.id_customer customers_id, round(total_paid_tax_incl,2) total, car.name transportista, efectivoCobrado ". "from ps_orders o " . "join ps_carrier car on (o.id_carrier=car.id_carrier)". "left join ps_orders1 o1 on (o.id_order=o1.id_order) ". "join ps_address ad on o.id_address_delivery=ad.id_address ". "join ps_cart dd on (dd.id_cart=o.id_cart) " . "left join ps_message mes on (o.id_order=mes.id_order) " . // ** CAMBIO CLAVE: Filtrar por rango de fechas (BETWEEN) ** "where tramo_date BETWEEN '".$fechaInicio."' AND '".$fechaFin."' ". "and payment like '%EFECTIVO%' ". "and o.current_state in (2,3,4,5,14,16) "; // 3. A�adir el filtro por transportista si se ha seleccionado uno if (!empty($transportistaFiltro) && $transportistaFiltro != 'TODOS') { // Filtrar por id_reference para capturar versiones duplicadas del carrier // (PrestaShop suele duplicar id_carrier al actualizar env�os/zonas). $texto_query .= "and car.id_reference = (select id_reference from ps_carrier where id_carrier = " . (int)$transportistaFiltro . ") "; } $texto_query .="order by shipdate,car.id_reference,prefEntrega,delivery_postcode"; //echo $texto_query; $status_query = tep_db_query($texto_query); ?>
// php require(DIR_WS_INCLUDES . 'header.php'); ?>
|
Cobros en Efectivo por Rango de Fechas para NoCocinoMas.es if ($_POST['procesar']=='S' and $mensajeAlerta == "") { ?>
|