CatalogController.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Support\Carbon;
  5. use Illuminate\Support\Facades\DB;
  6. use Illuminate\Support\Facades\Validator;
  7. class CatalogController extends Controller
  8. {
  9. private $responseController;
  10. private $encController;
  11. private $resourcesController;
  12. public function __construct() {
  13. $this->responseController = new ResponseController();
  14. $this->encController = new EncryptionController();
  15. $this->resourcesController = new ResourcesController();
  16. }
  17. public function getTaxRegimeActive($line) {
  18. try {
  19. $getTaxRegime = DB::table('S002V01TREFI')
  20. ->where('REFI_ESTA', '=', 'Activo')
  21. ->where('REFI_NULI', '=', $line)
  22. ->get([
  23. 'REFI_CRFI',
  24. 'REFI_NULI',
  25. 'REFI_DRFI',
  26. 'REFI_APFI',
  27. 'REFI_APMO',
  28. ]);
  29. } catch (\Throwable $th) {
  30. return $this->responseController->makeResponse(true, "ERR_CATALOG_TAXREGIME_GET000: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
  31. }
  32. $arrTaxRegime = json_decode(json_encode($getTaxRegime), true);
  33. return $this->responseController->makeResponse(false, "ÉXITO: Consulta Exitosa.", $arrTaxRegime);
  34. }
  35. public function getPaymentMethodActive($line) {
  36. try {
  37. $getPayment = DB::table('S002V01TMEPA')
  38. ->where('MEPA_ESTA', '=', 'Activo')
  39. ->where('MEPA_NULI', '=', $line)
  40. ->get([
  41. 'MEPA_IDME',
  42. 'MEPA_NOMB',
  43. ]);
  44. } catch (\Throwable $th) {
  45. return $this->responseController->makeResponse(true, "ERR_PAYMENT_METHOD_GET000: Ocurrió un error al momento de obtener los registros.", [], 500);
  46. }
  47. return $this->responseController->makeResponse(false, "ÉXITO: Consulta Exitosa", $getPayment);
  48. }
  49. public function getCatalogCoinsActive($line) {
  50. try {
  51. $getCatalogCoins = DB::table('S002V01TCAMO')
  52. ->where('CAMO_ESTA', '=', 'Activo')
  53. ->where('CAMO_NULI', '=', $line)
  54. ->get([
  55. 'CAMO_COMO',
  56. 'CAMO_NULI',
  57. 'CAMO_DESC',
  58. // 'CAMO_DECI',
  59. // 'CAMO_POVA',
  60. // 'CAMO_FEIN',
  61. // 'CAMO_FEFI',
  62. ]);
  63. } catch (\Throwable $th) {
  64. return $this->responseController->makeResponse(true, "ERR_CATALOG_COINS_GET000: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
  65. }
  66. $arrCatalogCoins = json_decode(json_encode($getCatalogCoins), true);
  67. return $this->responseController->makeResponse(false, "ÉXITO: Consulta Exitosa.", $arrCatalogCoins);
  68. }
  69. }