admin_autocomplete_model.php 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. class admin_autocomplete_model extends Model {
  3. public function get_partner_list($term='') {
  4. $term = $this->escapeArray($term);
  5. $result = $this->query("SELECT partner_id as id, partner_name as label, partner_name as value FROM sc_partners WHERE partner_name LIKE '%".$term."%' AND partner_status='1' ORDER BY partner_name ASC;");
  6. return $result;
  7. }
  8. public function get_client_list($term='') {
  9. $term = $this->escapeArray($term);
  10. $result = $this->query("SELECT client_id as id, client_name as label, client_name as value FROM sc_clients WHERE client_name LIKE '%".$term."%' AND client_status='1' ORDER BY client_name ASC;");
  11. return $result;
  12. }
  13. public function get_bill_list($term='') {
  14. $term = $this->escapeArray($term);
  15. $result = $this->query("SELECT bill_id as id, bill_number as label, bill_number as value FROM sc_bills WHERE bill_number LIKE '%".$term."%' AND bill_status<>'0' ORDER BY bill_number ASC;");
  16. return $result;
  17. }
  18. public function get_cikkszam_list($term='') {
  19. $term = $this->escapeArray($term);
  20. $result = $this->query("SELECT rajz_id as id, rajz_cikkszam as label, rajz_cikkszam as value FROM sc_rajzok WHERE rajz_cikkszam LIKE '%".$term."%' AND rajz_status<>'0' ORDER BY rajz_cikkszam ASC;");
  21. return $result;
  22. }
  23. public function get_cikknev_list($term='') {
  24. $term = $this->escapeArray($term);
  25. $result = $this->query("SELECT rajz_id as id, rajz_megnevezes as label, rajz_megnevezes as value FROM sc_rajzok WHERE rajz_megnevezes LIKE '%".$term."%' AND rajz_status<>'0' ORDER BY rajz_megnevezes ASC;");
  26. return $result;
  27. }
  28. public function get_comment_list($term='') {
  29. $term = $this->escapeArray($term);
  30. $result = $this->query("SELECT partner_id as id, partner_comment as label, partner_comment as value FROM sc_partners WHERE partner_comment LIKE '%".$term."%' AND partner_status='1' ORDER BY partner_comment ASC;");
  31. return $result;
  32. }
  33. public function get_termek_list($term='') {
  34. $term = $this->escapeArray($term);
  35. $result = $this->query("SELECT beszer_id as id, beszer_termek as label, beszer_termek as value FROM sc_beszerzes WHERE beszer_termek LIKE '%".$term."%' AND beszer_status<>'0' ORDER BY beszer_termek ASC;");
  36. return $result;
  37. }
  38. public function get_minoseg_list($term='') {
  39. $term = $this->escapeArray($term);
  40. $result = $this->query("SELECT beszer_id as id, beszer_anyagminoseg as label, beszer_anyagminoseg as value FROM sc_beszerzes WHERE beszer_anyagminoseg LIKE '%".$term."%' AND beszer_status<>'0' GROUP BY beszer_anyagminoseg ORDER BY beszer_anyagminoseg ASC;");
  41. return $result;
  42. }
  43. public function get_kategoria_list($term='') {
  44. $term = $this->escapeArray($term);
  45. $result = $this->query("SELECT beszer_id as id, beszer_kategoria as label, beszer_kategoria as value FROM sc_beszerzes WHERE beszer_kategoria LIKE '%".$term."%' AND beszer_status<>'0' GROUP BY beszer_kategoria ORDER BY beszer_kategoria ASC;");
  46. return $result;
  47. }
  48. public function get_egyseg_list($term='') {
  49. $term = $this->escapeArray($term);
  50. $result = $this->query("SELECT variant_id as id, variant_name as label, variant_name as value FROM sc_variants WHERE variant_group='egyseg' AND variant_name LIKE '%".$term."%' AND variant_status<>'0' GROUP BY variant_name ORDER BY variant_name ASC;");
  51. return $result;
  52. }
  53. public function get_cikknev($val='') {
  54. $val = $this->escapeString($val);
  55. $res = $this->query("SELECT * FROM sc_rajzok WHERE rajz_cikkszam='".$val."' AND rajz_status='1';");
  56. return $res[0]->rajz_megnevezes;
  57. }
  58. public function get_cikkszam($val='') {
  59. $val = $this->escapeString($val);
  60. $res = $this->query("SELECT * FROM sc_rajzok WHERE rajz_megnevezes='".$val."' AND rajz_status='1';");
  61. return $res[0]->rajz_cikkszam;
  62. }
  63. }