<?php

use_helper('I18N', 'Date');
?>

<h1>Product Invoice Search</h1>

<?php 
echo link_to("Purchase Search", "product/purchasesearch?searchstring=" . $searchstring . "&product_id=" . $product_id);
echo "<br>" . link_to("Stock Search", "product/stocksearch?searchstring=" . $searchstring . "&product_id=" . $product_id);
echo form_tag("product/invoicesearch");
$invoicedetail = new Invoicedetail();
$invoicedetail->setProductId($product_id);
$form = new InvoicedetailForm($invoicedetail);
echo $form["product_id"];
?>
<br>Search: <input name=searchstring value=<?php 
echo $searchstring;
?>
>
<br><input type=submit name=submit value=Submit>
</form>



    <table border=1>
      <tr>
        <td>Product</td>
        <td>Invoice</td>
        <td>Date</td>
        <td>Description</td>
 public function executeView(sfWebRequest $request)
 {
     $this->invoice = Doctrine_Query::create()->from('Invoice i, i.Employee e, i.Terms t, i.Customer c')->where('i.id = ' . $request->getParameter('id'))->fetchOne();
     $this->form = $this->configuration->getForm($this->invoice);
     //allow set product id by url
     $detail = new Invoicedetail();
     $detail->setQty(1);
     if ($request->getParameter("product_id")) {
         $detail->setProductId($request->getParameter("product_id"));
     }
     $this->detailform = new InvoicedetailForm($detail);
     $this->detail = $detail;
 }
 /**
  * Remove the specified resource from storage.
  * DELETE /accountreceivables/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Invoicedetail::find($id)->delete();
     return Redirect::route('invoicedetail');
 }