function findAll($oInicio = 0, $oQtd = 1000000, $oFiltro = "", $oOrdem = "Product_Value_ID") { //atualiza o total de registros $this->regTotal($oFiltro); $arrResultado = array(); $r = new Recordset(); //localiza o registro if ($oFiltro == "") { $sql = "select * from {$this->tbnome} order by {$oOrdem} limit {$oInicio}, {$oQtd}"; } else { $sql = "select * from {$this->tbnome} where 1=1 {$oFiltro} order by {$oOrdem} limit {$oInicio}, {$oQtd}"; } if ($this->debugMode == 1) { echo "<br>Debug|Product_ValueClass|findAll|1: " . $sql; } $r->open($sql, $this->c); if ($r->record_count > 0) { while (!$r->EOF) { $arrResultado[] = array("Product_Value_ID" => $r->item("Product_Value_ID"), "Product_ID" => $r->item("Product_ID"), "Client_ID" => $r->item("Client_ID"), "Value" => $r->item("Value"), "Date" => $r->item("Date")); $r->move_next(); } } $r->close(); return $arrResultado; }
function findAllByProduct($oInicio = 0, $oQtd = 10, $oFiltro = "", $oOrdem = "Inventory_ID") { //atualiza o total de registros $this->regTotal($oFiltro); $arrResultado = array(); $r = new Recordset(); //localiza o registro $sql = "SELECT Product_ID, Codebar, SUM(Quantity) as Qtd FROM {$this->tbnome} where 1=1 {$oFiltro} Group By Codebar order by {$oOrdem} limit {$oInicio}, {$oQtd} "; if ($this->debugMode == 1) { echo "<br>Debug|InventoryClass|findAllByProduct|1: " . $sql; } $r->open($sql, $this->c); if ($r->record_count > 0) { while (!$r->EOF) { $arrResultado[] = array("Product_ID" => $r->item("Product_ID"), "Codebar" => $r->item("Codebar"), "Qtd" => $r->item("Qtd")); $r->move_next(); } } $r->close(); return $arrResultado; }