Hello, I need to implement a report with cc5 in witch filter the results setting two date (start and end) and a field plant that must be populated by reading the data from another table and creating a dropdown element.
For the first request I have implemented the following code:
model title reperibilita
conditions:
<?php
$datainizio = JRequest::getString('datainizio', '', 'post');
$datafine = JRequest::getString('datafine', '', 'post');
return array(":reperibilita.data_uscita between '$datainizio' and '$datafine'");
?>
datainizio and datafine are the name of box.
In front list -> column list i've:
reperibilita.DATA_USCITA:DATA USCITA
reperibilita.ORA_USCITA:ORA USCITA
reperibilita.DATA_INGRESSO:DATA INGRESSO
reperibilita.ORA_INGRESSO:ORA INGRESSO
reperibilita.NOMINATIVO:NOMINATIVO
reperibilita.IMPIANTO:IMPIANTO
reperibilita.DESCRIZIONE:DESCRIZIONE
reperibilita.STRAORDINARIO:STRAORDINARIO
reperibilita.RIPCOMP:RIPOSOCOMPENSATIVO
reperibilita.RICEVUTA:RICEVUTA
reperibilita.TICKET:TICKET
that are the name of columns.
In Filters reperibilita.data_uscita and Serchable reperibilita.impianto
In List Display - table i've add this code:
<div>Impianto <input type="dropdown" name="srch" placeholder="search...." class="form-control A" />
<br> Data inizio <input type="text" name="datainizio" class="form-control A" />
<br> Data Fine <input type="text" name="datafine" class="form-control A" />
<br>
<input type="submit" name="Ricerca" value="Ricerca" /></div>
So this code works but i've two request:
1) replace the textbox srch with a dropdown that retrieves data from the system table consists of two columns value and text (already used to populate a dropdown in CF5)
2) replace the two textbox datainizio and datafine with two datetimekeeper if it's possibile.
Thank's for the reply.
For the first request I have implemented the following code:
model title reperibilita
conditions:
<?php
$datainizio = JRequest::getString('datainizio', '', 'post');
$datafine = JRequest::getString('datafine', '', 'post');
return array(":reperibilita.data_uscita between '$datainizio' and '$datafine'");
?>
datainizio and datafine are the name of box.
In front list -> column list i've:
reperibilita.DATA_USCITA:DATA USCITA
reperibilita.ORA_USCITA:ORA USCITA
reperibilita.DATA_INGRESSO:DATA INGRESSO
reperibilita.ORA_INGRESSO:ORA INGRESSO
reperibilita.NOMINATIVO:NOMINATIVO
reperibilita.IMPIANTO:IMPIANTO
reperibilita.DESCRIZIONE:DESCRIZIONE
reperibilita.STRAORDINARIO:STRAORDINARIO
reperibilita.RIPCOMP:RIPOSOCOMPENSATIVO
reperibilita.RICEVUTA:RICEVUTA
reperibilita.TICKET:TICKET
that are the name of columns.
In Filters reperibilita.data_uscita and Serchable reperibilita.impianto
In List Display - table i've add this code:
<div>Impianto <input type="dropdown" name="srch" placeholder="search...." class="form-control A" />
<br> Data inizio <input type="text" name="datainizio" class="form-control A" />
<br> Data Fine <input type="text" name="datafine" class="form-control A" />
<br>
<input type="submit" name="Ricerca" value="Ricerca" /></div>
So this code works but i've two request:
1) replace the textbox srch with a dropdown that retrieves data from the system table consists of two columns value and text (already used to populate a dropdown in CF5)
2) replace the two textbox datainizio and datafine with two datetimekeeper if it's possibile.
Thank's for the reply.
I've noticed another problem: how i can transform the previous query in an OR and not ANd query? the field srch is the name of a plant, the other two field is the start date and finishd date. So i what this condition where impianto LIKE value OR date is beetweeb datainizio and data fine but now the query is
FROM `#_rappsettimanale` AS `reperibilita` WHERE ((`reperibilita`.`impianto` LIKE '%uff.piove%')) AND reperibilita.data_uscita between '2014-07-02' and '2014-07-10' LIMIT 30.
How i can modify this AND?
FROM `#_rappsettimanale` AS `reperibilita` WHERE ((`reperibilita`.`impianto` LIKE '%uff.piove%')) AND reperibilita.data_uscita between '2014-07-02' and '2014-07-10' LIMIT 30.
How i can modify this AND?
This topic is locked and no more replies can be posted.