<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Where to find array for this function get_sql_for_po_search_completed]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=8021</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=8021&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Where to find array for this function get_sql_for_po_search_completed.]]></description>
		<lastBuildDate>Wed, 27 Feb 2019 06:49:28 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Where to find array for this function get_sql_for_po_search_completed]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=34359#p34359</link>
			<description><![CDATA[<p>im trying to find array for this function and added my own function.&nbsp; temp_pr is my other table i wanted to show database inside of this temp.pr_number, temp.requested_by, temp.cost_center, temp.remarks, but i don&#039;t know where the array for this to be displayed.</p><br /><p>function get_sql_for_po_search_sheet($from, $to, $supplier_id=ALL_TEXT, $location=ALL_TEXT,<br />&nbsp; &nbsp; $order_number = &#039;&#039;, $stock_id = &#039;&#039;, $also_closed=false)<br />{<br />&nbsp; &nbsp; $sql = &quot;SELECT<br />&nbsp; &nbsp; &nbsp; &nbsp; porder.order_no,<br />&nbsp; &nbsp; &nbsp; &nbsp; porder.reference,<br />&nbsp; &nbsp; &nbsp; &nbsp; temp.pr_number,<br />&nbsp; &nbsp; &nbsp; &nbsp; temp.requested_by,<br />&nbsp; &nbsp; &nbsp; &nbsp; temp.cost_center,<br />&nbsp; &nbsp; &nbsp; &nbsp; temp.remarks,<br />&nbsp; &nbsp; &nbsp; &nbsp; supplier.supp_name,<br />&nbsp; &nbsp; &nbsp; &nbsp; location.location_name,<br />&nbsp; &nbsp; &nbsp; &nbsp; porder.requisition_no,<br />&nbsp; &nbsp; &nbsp; &nbsp; porder.ord_date,</p><p>&nbsp; &nbsp; &nbsp; &nbsp; supplier.curr_code,<br />&nbsp; &nbsp; &nbsp; &nbsp; Sum(line.unit_price*line.quantity_ordered) AS OrderValue,<br />&nbsp; &nbsp; &nbsp; &nbsp; porder.into_stock_location,<br />&nbsp; &nbsp; &nbsp; &nbsp; chk.isopen<br />&nbsp; &nbsp; &nbsp; &nbsp; FROM &quot;.TB_PREF.&quot;purch_orders as porder<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LEFT JOIN (<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SELECT order_no, SUM(quantity_ordered-quantity_received + quantity_ordered-qty_invoiced) isopen<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM &quot;.TB_PREF.&quot;purch_order_details<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GROUP BY order_no<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) chk ON chk.order_no=porder.order_no,&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .TB_PREF.&quot;purch_order_details as line, &quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .TB_PREF.&quot;suppliers as supplier, &quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .TB_PREF.&quot;temp_pr as temp, &quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .TB_PREF.&quot;locations as location<br />&nbsp; &nbsp; &nbsp; &nbsp; WHERE porder.order_no = line.order_no<br />&nbsp; &nbsp; &nbsp; &nbsp; AND porder.supplier_id = supplier.supplier_id<br />&nbsp; &nbsp; &nbsp; &nbsp; AND location.loc_code = porder.into_stock_location &quot;;</p><p>&nbsp; &nbsp; if ($supplier_id != ALL_TEXT)<br />&nbsp; &nbsp; &nbsp; &nbsp; $sql .= &quot;AND supplier.supplier_id=&quot;.$supplier_id.&quot; &quot;;<br />&nbsp; &nbsp; if ($order_number != &quot;&quot;)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; $sql .= &quot;AND porder.reference LIKE &quot;.db_escape(&#039;%&#039;. $order_number . &#039;%&#039;);<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; else<br />&nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; $data_after = date2sql($from);<br />&nbsp; &nbsp; &nbsp; &nbsp; $date_before = date2sql($to);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; $sql .= &quot; AND porder.ord_date &gt;= &#039;$data_after&#039;&quot;;<br />&nbsp; &nbsp; &nbsp; &nbsp; $sql .= &quot; AND porder.ord_date &lt;= &#039;$date_before&#039;&quot;;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if ($location != ALL_TEXT)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $sql .= &quot; AND porder.into_stock_location = &quot;.db_escape($location);<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; if ($stock_id !== &#039;&#039;)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $sql .= &quot; AND line.item_code=&quot;.db_escape($stock_id);<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; if ($supplier_id != ALL_TEXT)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $sql .= &quot; AND supplier.supplier_id=&quot;.db_escape($supplier_id);</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; if (!$also_closed)<br />&nbsp; &nbsp; &nbsp; &nbsp; $sql .= &quot; AND isopen&quot;;<br />&nbsp; &nbsp; $sql .= &quot; GROUP BY porder.order_no&quot;;<br />&nbsp; &nbsp; return $sql;<br />}</p><p>I don&#039;t know where to find array for this to display my other table temp.pr_number, temp.requested_by, temp.cost_center, temp.remarks,</p><p>$sql = get_sql_for_po_search_sheet(get_post(&#039;OrdersAfterDate&#039;), get_post(&#039;OrdersToDate&#039;),<br />&nbsp; &nbsp; get_post(&#039;supplier_id&#039;), get_post(&#039;StockLocation&#039;), get_post(&#039;order_number&#039;),<br />&nbsp; &nbsp; get_post(&#039;SelectStockFromList&#039;), get_post(&#039;also_closed&#039;));</p><p>$cols = array(<br />&nbsp; &nbsp; &nbsp; &nbsp; _(&quot;#&quot;) =&gt; array(&#039;fun&#039;=&gt;&#039;trans_view&#039;, &#039;ord&#039;=&gt;&#039;&#039;, &#039;align&#039;=&gt;&#039;right&#039;), <br />&nbsp; &nbsp; &nbsp; &nbsp; _(&quot;Reference&quot;), <br />&nbsp; &nbsp; &nbsp; &nbsp; _(&quot;Supplier&quot;) =&gt; array(&#039;ord&#039;=&gt;&#039;&#039;),<br />&nbsp; &nbsp; &nbsp; &nbsp; _(&quot;Location&quot;),<br />&nbsp; &nbsp; &nbsp; &nbsp; _(&quot;Supplier&#039;s Reference&quot;), <br />&nbsp; &nbsp; &nbsp; &nbsp; _(&quot;Order Date&quot;) =&gt; array(&#039;name&#039;=&gt;&#039;ord_date&#039;, &#039;type&#039;=&gt;&#039;date&#039;, &#039;ord&#039;=&gt;&#039;desc&#039;),<br />&nbsp; &nbsp; &nbsp; &nbsp; _(&quot;Price&quot;) =&gt; array(&#039;align&#039;=&gt;&#039;center&#039;), <br />&nbsp; &nbsp; &nbsp; &nbsp; _(&quot;Total&quot;) =&gt; &#039;amount&#039;,<br />&nbsp; &nbsp; &nbsp; &nbsp; array(&#039;insert&#039;=&gt;true, &#039;fun&#039;=&gt;&#039;edit_link&#039;),<br />&nbsp; &nbsp; &nbsp; &nbsp; array(&#039;insert&#039;=&gt;true, &#039;fun&#039;=&gt;&#039;prt_link&#039;),<br />);</p><p>if (get_post(&#039;StockLocation&#039;) != ALL_TEXT) {<br />&nbsp; &nbsp; $cols[_(&quot;Location&quot;)] = &#039;skip&#039;;<br />}</p>]]></description>
			<author><![CDATA[null@example.com (borrowed)]]></author>
			<pubDate>Wed, 27 Feb 2019 06:49:28 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=34359#p34359</guid>
		</item>
	</channel>
</rss>
