Dear All,
I have three tables:
sales
id
invoiceDate
invoiceNo
customerFk
sales_detail
id
salesFk FK to sales(invoiceNo)
productFk FK to Product(id)
qty
unitPrice
product
id
name
Based on sales_detail I create a CGridView and I modified the advanced search to create a date range filter (startDate and startEnd)
Below is my model->search()
public function search()
{
$criteria = new CDbCriteria;
$criteria->with = array('sales');
if($this->startDate === null || $this->startDate == "") {
$criteria->compare('sales.invoiceDate', '>=' . $this->startDate,true);
} else {
$criteria->compare('sales.invoiceDate', '>=' . $this->formatToMySqlDate($this->startDate),true);
}
if($this->endDate === null || $this->endDate == "") {
$criteria->compare('sales.invoiceDate', '<=' . $this->endDate,true);
} else {
$criteria->compare('sales.invoiceDate', '<=' . $this->formatToMySqlDate($this->endDate),true);
}
Why everytime I clicked on "Search" button nothing is happened. I tried to print out $startDate and $endDate, they are empty.
I already add public $startDate and public $endDate on the SalesDetail model. Anf from Firebug, the variables are already send correctly since I got
SalesDetail[‘startDate’], and
SalesDetail[‘endDate’]
Cheers,
Daniel
Can anyone help?