|
|
@@ -146,6 +146,7 @@ class ProviderController extends Controller{
|
|
|
try {
|
|
|
$arrProvider = DB::table('S002V01TPROV')
|
|
|
->where('PROV_NULI', '=', $line)
|
|
|
+ ->join('S002V01TREFI', 'REFI_CRFI', '=', 'PROV_CORF')
|
|
|
->get([
|
|
|
'PROV_NUPR AS NUMERO_PROVEEDOR',
|
|
|
'PROV_NOCO AS RAZON_SOCIAL',
|
|
|
@@ -160,7 +161,9 @@ class ProviderController extends Controller{
|
|
|
'PROV_XRFC AS RFC',
|
|
|
'PROV_XTAX AS TAXID',
|
|
|
'PROV_CORF AS REGIMEN_FISCAL',
|
|
|
+ DB::raw('CONCAT(REFI_DRFI, " (", REFI_CRFI, ")") AS REGIMEN_FISCAL'),
|
|
|
'PROV_TIPO AS TIPO',
|
|
|
+ 'PROV_TICO AS TIPO_CONTRIBUYENTE',
|
|
|
'PROV_SIWE AS SITIOWEB',
|
|
|
'PROV_MEPA AS METODO_PAGO',
|
|
|
'PROV_ESTA AS ESTADO',
|
|
|
@@ -173,6 +176,7 @@ class ProviderController extends Controller{
|
|
|
'PROV_NUIN AS INTERIOR',
|
|
|
'PROV_COPO AS CODIGO_POSTAL',
|
|
|
'PROV_COLO AS COLONIA',
|
|
|
+ 'PROV_LOCA AS LOCALIDAD',
|
|
|
'PROV_MUNI AS MUNICIPIO',
|
|
|
'PROV_ENTI AS ENTIDAD',
|
|
|
'PROV_PAIS AS PAIS',
|
|
|
@@ -216,6 +220,7 @@ class ProviderController extends Controller{
|
|
|
'PRCO_NUIN AS NUMERO_INTERIOR',
|
|
|
'PRCO_COPO AS CODIGO_POSTAL',
|
|
|
'PRCO_COLO AS COLONIA',
|
|
|
+ 'PRCO_LOCA AS LOCALIDAD',
|
|
|
'PRCO_MUNI AS MUNICIPIO',
|
|
|
'PRCO_ENTI AS ENTIDAD',
|
|
|
'PRCO_PAIS AS PAIS',
|
|
|
@@ -308,6 +313,7 @@ class ProviderController extends Controller{
|
|
|
'PROV_TEL1 AS TELEFONO1',
|
|
|
'PROV_LAD2 AS LADA2',
|
|
|
'PROV_TEL2 AS TELEFONO2',
|
|
|
+ 'PROV_TICO AS TIPO_CONTRIBUYENTE',
|
|
|
'PROV_XRFC AS RFC',
|
|
|
'PROV_XTAX AS TAXID',
|
|
|
'PROV_CORF AS REGIMEN_FISCAL',
|
|
|
@@ -342,6 +348,7 @@ class ProviderController extends Controller{
|
|
|
'PROV_TEL1 AS TELEFONO1',
|
|
|
'PROV_LAD2 AS LADA2',
|
|
|
'PROV_TEL2 AS TELEFONO2',
|
|
|
+ 'PROV_TICO AS TIPO_CONTRIBUYENTE',
|
|
|
'PROV_XRFC AS RFC',
|
|
|
'PROV_XTAX AS TAXID',
|
|
|
'PROV_CORF AS REGIMEN_FISCAL',
|
|
|
@@ -364,7 +371,7 @@ class ProviderController extends Controller{
|
|
|
$validator = Validator::make($request->all(), [
|
|
|
'line' => 'required|string',
|
|
|
'user' => 'required|string',
|
|
|
- 'obj_response' => 'required|string',
|
|
|
+ 'obj_response' => 'required',
|
|
|
]);
|
|
|
|
|
|
if ($validator->fails()) {
|
|
|
@@ -386,26 +393,22 @@ class ProviderController extends Controller{
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD001: No se pudo obtener el usuario.", $th->getMessage(), 500);
|
|
|
}
|
|
|
- try {
|
|
|
- $obj_response = json_decode($requestData['obj_response']);
|
|
|
- } catch (\Throwable $th) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD002: Ocurrió un error al obtener los datos del proveedor.", $th->getMessage(), 500);
|
|
|
- }
|
|
|
|
|
|
- $arrInformationPersonal = (array) $obj_response->INFORMACION;
|
|
|
- $arrReferences = (array) $obj_response->REFERENCIAS;
|
|
|
- $arrContacts = (array) $obj_response->CONTACTOS;
|
|
|
- $arrConditions = (array) $obj_response->CONDICIONES;
|
|
|
- $arrPaymentMedia = (array) $obj_response->METODOS_PAGO;
|
|
|
- $arrCatalogs = (array) $obj_response->CATALAGOS;
|
|
|
+ $arrInformationPersonal = $requestData['obj_response']['INFORMACION'];
|
|
|
+ $arrReferences = $requestData['obj_response']['REFERENCIAS'];
|
|
|
+ $arrContacts = $requestData['obj_response']['CONTACTOS'];
|
|
|
+ $arrConditions = $requestData['obj_response']['CONDICIONES'];
|
|
|
+ $arrPaymentMedia = $requestData['obj_response']['METODOS_PAGO'];
|
|
|
+ $arrCatalogs = $requestData['obj_response']['CATALAGOS'];
|
|
|
|
|
|
$numeroProveedor = $arrInformationPersonal['NUMERO_PROVEEDOR'];
|
|
|
- $currentDate = Carbon::now()->timezone('America/Mazatlan')->toDateTimeString();
|
|
|
+
|
|
|
+ $now = $this->functionsController->now();
|
|
|
+ $currentDate = $now->toDateTimeString();
|
|
|
|
|
|
$arrPaymentTemp = array();
|
|
|
foreach ($arrPaymentMedia as $payment) {
|
|
|
- $arrPaymentTemp[$payment->MEPA_IDME] = $payment->MEPA_NOMB;
|
|
|
+ $arrPaymentTemp[$payment['MEPA_IDME']] = $payment['MEPA_NOMB'];
|
|
|
}
|
|
|
try {
|
|
|
$strPayment = json_encode($arrPaymentTemp);
|
|
|
@@ -414,264 +417,262 @@ class ProviderController extends Controller{
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD003: Ocurrió un error al obtener los datos del método de pago.", $th->getMessage(), 500);
|
|
|
}
|
|
|
|
|
|
- $updatePersonal = [
|
|
|
- 'PROV_NOCO' => $arrInformationPersonal['RAZON_SOCIAL'],
|
|
|
- 'PROV_NOMB' => $arrInformationPersonal['NOMBRE'],
|
|
|
- 'PROV_APPA' => $arrInformationPersonal['PRIMER_APELLIDO'],
|
|
|
- 'PROV_APMA' => $arrInformationPersonal['SEGUNDO_APELLIDO'] != '' ? $arrInformationPersonal['SEGUNDO_APELLIDO'] : null,
|
|
|
- 'PROV_CORR' => $arrInformationPersonal['CORREO'],
|
|
|
- 'PROV_LAD1' => $arrInformationPersonal['LADA1'],
|
|
|
- 'PROV_TEL1' => $arrInformationPersonal['TELEFONO1'],
|
|
|
- 'PROV_LAD2' => $arrInformationPersonal['LADA2'] != '' ? $arrInformationPersonal['LADA2'] : null,
|
|
|
- 'PROV_TEL2' => $arrInformationPersonal['TELEFONO2'] != '' ? $arrInformationPersonal['TELEFONO2'] : null,
|
|
|
- 'PROV_XRFC' => $arrInformationPersonal['RFC'],
|
|
|
- 'PROV_XTAX' => $arrInformationPersonal['TAXID'] != '' ? $arrInformationPersonal['TAXID'] : null,
|
|
|
- 'PROV_CORF' => $arrInformationPersonal['REGIMEN_FISCAL'],
|
|
|
- 'PROV_TIPO' => $arrInformationPersonal['TIPO'],
|
|
|
- 'PROV_SIWE' => $arrInformationPersonal['SITIOWEB'],
|
|
|
- 'PROV_MEPA' => $strPayment,
|
|
|
- 'PROV_CALL' => $arrInformationPersonal['CALLE'],
|
|
|
- 'PROV_NUEX' => $arrInformationPersonal['EXTERIOR'],
|
|
|
- 'PROV_NUIN' => $arrInformationPersonal['INTERIOR'],
|
|
|
- 'PROV_COPO' => $arrInformationPersonal['CODIGO_POSTAL'],
|
|
|
- 'PROV_COLO' => $arrInformationPersonal['COLONIA'],
|
|
|
- 'PROV_MUNI' => $arrInformationPersonal['MUNICIPIO'],
|
|
|
- 'PROV_ENTI' => $arrInformationPersonal['ENTIDAD'],
|
|
|
- 'PROV_PAIS' => $arrInformationPersonal['PAIS'],
|
|
|
- 'PROV_USMO' => $user,
|
|
|
- 'PROV_FEMO' => $currentDate,
|
|
|
- 'PROV_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
- ];
|
|
|
+
|
|
|
try {
|
|
|
- $resp = DB::table('S002V01TPROV')->where('PROV_NUPR', '=', $numeroProveedor)->where('PROV_NULI', '=', $line)->update($updatePersonal);
|
|
|
- if (!$resp) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD004: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
- }
|
|
|
+ $validateUpdateInformation = DB::table('S002V01TPROV')
|
|
|
+ ->where('PROV_NUPR', '=', $numeroProveedor)
|
|
|
+ ->where('PROV_NULI', '=', $line)
|
|
|
+ ->update([
|
|
|
+ 'PROV_NOCO' => $arrInformationPersonal['RAZON_SOCIAL'],
|
|
|
+ 'PROV_NOMB' => $arrInformationPersonal['NOMBRE'],
|
|
|
+ 'PROV_APPA' => $arrInformationPersonal['PRIMER_APELLIDO'],
|
|
|
+ 'PROV_APMA' => $arrInformationPersonal['SEGUNDO_APELLIDO'] != '' ? $arrInformationPersonal['SEGUNDO_APELLIDO'] : null,
|
|
|
+ 'PROV_CORR' => $arrInformationPersonal['CORREO'],
|
|
|
+ 'PROV_LAD1' => $arrInformationPersonal['LADA1'],
|
|
|
+ 'PROV_TEL1' => $arrInformationPersonal['TELEFONO1'],
|
|
|
+ 'PROV_LAD2' => $arrInformationPersonal['LADA2'] != '' ? $arrInformationPersonal['LADA2'] : null,
|
|
|
+ 'PROV_TEL2' => $arrInformationPersonal['TELEFONO2'] != '' ? $arrInformationPersonal['TELEFONO2'] : null,
|
|
|
+ 'PROV_TICO' => $arrInformationPersonal['TIPO_CONTRIBUYENTE'],
|
|
|
+ 'PROV_XRFC' => $arrInformationPersonal['RFC'],
|
|
|
+ 'PROV_XTAX' => $arrInformationPersonal['TAXID'] != '' ? $arrInformationPersonal['TAXID'] : null,
|
|
|
+ 'PROV_CORF' => $arrInformationPersonal['REGIMEN_FISCAL'],
|
|
|
+ 'PROV_TIPO' => $arrInformationPersonal['TIPO'],
|
|
|
+ 'PROV_SIWE' => $arrInformationPersonal['SITIOWEB'],
|
|
|
+ 'PROV_MEPA' => $strPayment,
|
|
|
+ 'PROV_CALL' => $arrInformationPersonal['CALLE'],
|
|
|
+ 'PROV_NUEX' => $arrInformationPersonal['EXTERIOR'],
|
|
|
+ 'PROV_NUIN' => $arrInformationPersonal['INTERIOR'],
|
|
|
+ 'PROV_COPO' => $arrInformationPersonal['CODIGO_POSTAL'],
|
|
|
+ 'PROV_COLO' => $arrInformationPersonal['COLONIA'],
|
|
|
+ 'PROV_LOCA' => $arrInformationPersonal['LOCALIDAD'],
|
|
|
+ 'PROV_MUNI' => $arrInformationPersonal['MUNICIPIO'],
|
|
|
+ 'PROV_ENTI' => $arrInformationPersonal['ENTIDAD'],
|
|
|
+ 'PROV_PAIS' => $arrInformationPersonal['PAIS'],
|
|
|
+ 'PROV_USMO' => $user,
|
|
|
+ 'PROV_FEMO' => $currentDate,
|
|
|
+ 'PROV_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
+ ]);
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD005: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
+ if (!$validateUpdateInformation) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD004: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
foreach ($arrReferences as $references) {
|
|
|
- if ($references->ESTADO == 'Activo' || $references->ESTADO == 'Modificado') {
|
|
|
- $updateReferences = [
|
|
|
- 'PRRE_EMPR' => $references->RAZON_SOCIAL,
|
|
|
- 'PRRE_CORR' => $references->CORREO,
|
|
|
- 'PRRE_LADA' => $references->LADA,
|
|
|
- 'PRRE_TELE' => $references->TELEFONO,
|
|
|
- 'PRRE_XRFC' => $references->RFC,
|
|
|
- 'PRRE_DIRE' => $references->DIRECCION,
|
|
|
- 'PRRE_USMO' => $user,
|
|
|
- 'PRRE_FEMO' => $currentDate,
|
|
|
- 'PRRE_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
- ];
|
|
|
+ if ($references['ESTADO'] == 'Activo' || $references['ESTADO'] == 'Modificado') {
|
|
|
try {
|
|
|
- $resp = DB::table('S002V01TPRRE')
|
|
|
- ->where('PRRE_IDRE', '=', $references->NUMERO_REFERENCIA)
|
|
|
+ $validateUpdateReference = DB::table('S002V01TPRRE')
|
|
|
+ ->where('PRRE_IDRE', '=', $references['NUMERO_REFERENCIA'])
|
|
|
->where('PRRE_NUPR', '=', $numeroProveedor)
|
|
|
->where('PRRE_NULI', '=', $line)
|
|
|
- ->update($updateReferences);
|
|
|
- if (!$resp) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD006: Ocurrió un error al obtener el contenido. ", [], 500);
|
|
|
- }
|
|
|
+ ->update([
|
|
|
+ 'PRRE_EMPR' => $references['RAZON_SOCIAL'],
|
|
|
+ 'PRRE_CORR' => $references['CORREO'],
|
|
|
+ 'PRRE_LADA' => $references['LADA'],
|
|
|
+ 'PRRE_TELE' => $references['TELEFONO'],
|
|
|
+ 'PRRE_XRFC' => $references['RFC'],
|
|
|
+ 'PRRE_DIRE' => $references['DIRECCION'],
|
|
|
+ 'PRRE_USMO' => $user,
|
|
|
+ 'PRRE_FEMO' => $currentDate,
|
|
|
+ 'PRRE_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
+ ]);
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD007: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
- }else if($references->ESTADO == 'Nuevo') {
|
|
|
- $insertReferences = [
|
|
|
- 'PRRE_NUPR' => $numeroProveedor,
|
|
|
- 'PRRE_EMPR' => $references->RAZON_SOCIAL,
|
|
|
- 'PRRE_CORR' => $references->CORREO,
|
|
|
- 'PRRE_LADA' => $references->LADA,
|
|
|
- 'PRRE_TELE' => $references->TELEFONO,
|
|
|
- 'PRRE_XRFC' => $references->RFC,
|
|
|
- 'PRRE_DIRE' => $references->DIRECCION,
|
|
|
- 'PRRE_NULI' => $line,
|
|
|
- 'PRRE_USRE' => $user,
|
|
|
- 'PRRE_FERE' => $currentDate,
|
|
|
- 'PRRE_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
- ];
|
|
|
+ if (!$validateUpdateReference) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD006: Ocurrió un error al obtener el contenido. ", [], 500);
|
|
|
+ }
|
|
|
+ } else if ($references['ESTADO'] == 'Nuevo') {
|
|
|
try {
|
|
|
- $resp = DB::table('S002V01TPRRE')->insert($insertReferences);
|
|
|
- if (!$resp) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD008: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
- }
|
|
|
+ $validateInsertReference = DB::table('S002V01TPRRE')->insert([
|
|
|
+ 'PRRE_NUPR' => $numeroProveedor,
|
|
|
+ 'PRRE_EMPR' => $references['RAZON_SOCIAL'],
|
|
|
+ 'PRRE_CORR' => $references['CORREO'],
|
|
|
+ 'PRRE_LADA' => $references['LADA'],
|
|
|
+ 'PRRE_TELE' => $references['TELEFONO'],
|
|
|
+ 'PRRE_XRFC' => $references['RFC'],
|
|
|
+ 'PRRE_DIRE' => $references['DIRECCION'],
|
|
|
+ 'PRRE_NULI' => $line,
|
|
|
+ 'PRRE_USRE' => $user,
|
|
|
+ 'PRRE_FERE' => $currentDate,
|
|
|
+ 'PRRE_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
+ ]);
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD009: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
- } else if($references->ESTADO == 'Eliminado'){
|
|
|
- $updateReferences = [
|
|
|
- 'PRRE_ESTA' => 'Eliminado',
|
|
|
- 'PRRE_USMO' => $user,
|
|
|
- 'PRRE_FEMO' => $currentDate,
|
|
|
- 'PRRE_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
- ];
|
|
|
+ if (!$validateInsertReference) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD008: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
+ }
|
|
|
+ } else if ($references['ESTADO'] == 'Eliminado'){
|
|
|
try {
|
|
|
- $resp = DB::table('S002V01TPRRE')
|
|
|
- ->where('PRRE_IDRE', '=', $references->NUMERO_REFERENCIA)
|
|
|
+ $validateUpdateReference = DB::table('S002V01TPRRE')
|
|
|
+ ->where('PRRE_IDRE', '=', $references['NUMERO_REFERENCIA'])
|
|
|
->where('PRRE_NUPR', '=', $numeroProveedor)
|
|
|
->where('PRRE_NULI', '=', $line)
|
|
|
- ->update($updateReferences);
|
|
|
- if (!$resp) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD010: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
- }
|
|
|
+ ->update([
|
|
|
+ 'PRRE_ESTA' => 'Eliminado',
|
|
|
+ 'PRRE_USMO' => $user,
|
|
|
+ 'PRRE_FEMO' => $currentDate,
|
|
|
+ 'PRRE_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
+ ]);
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD011: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
+ if (!$validateUpdateReference) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD010: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
foreach ($arrContacts as $contacts) {
|
|
|
- if ($contacts->ESTADO == 'Activo' && $contacts->ESTADO == 'Modificado') {
|
|
|
- $updateContacts = [
|
|
|
- 'PRCO_NOMB' => $contacts->NOMBRE_CONTACTO,
|
|
|
- 'PRCO_TIPO' => $contacts->TIPO_CONTACTO,
|
|
|
- 'PRCO_CALL' => $contacts->CALLE,
|
|
|
- 'PRCO_NUEX' => $contacts->NUMERO_EXTERIOR,
|
|
|
- 'PRCO_NUIN' => $contacts->NUMERO_INTERIOR != '' ? $contacts->NUMERO_INTERIOR : null,
|
|
|
- 'PRCO_COPO' => $contacts->CODIGO_POSTAL,
|
|
|
- 'PRCO_COLO' => $contacts->SUBURB,
|
|
|
- 'PRCO_MUNI' => $contacts->MUNICIPIO,
|
|
|
- 'PRCO_ENTI' => $contacts->ENTIDAD,
|
|
|
- 'PRCO_PAIS' => $contacts->PAIS,
|
|
|
- 'PRCO_TEL1' => $contacts->TELEFONO1,
|
|
|
- 'PRCO_TEL2' => $contacts->TELEFONO2 != '' ? $contacts->TELEFONO2 : null,
|
|
|
- 'PRCO_COR1' => $contacts->CORREO1,
|
|
|
- 'PRCO_COR2' => $contacts->CORREO2 != '' ? $contacts->CORREO2 : null,
|
|
|
- 'PRCO_OBSE' => $contacts->OBSERVACIONES,
|
|
|
- 'PRCO_USMO' => $user,
|
|
|
- 'PRCO_FEMO' => $currentDate,
|
|
|
- 'PRCO_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
- ];
|
|
|
+ if ($contacts['ESTADO'] == 'Activo' || $contacts['ESTADO'] == 'Modificado') {
|
|
|
try {
|
|
|
- $resp = DB::table('S002V01TPRCO')
|
|
|
- ->where('PRCO_IDCP', '=', $contacts->NUMERO_CONTACTO)
|
|
|
+ $validateUpdateContact = DB::table('S002V01TPRCO')
|
|
|
+ ->where('PRCO_IDCP', '=', $contacts['NUMERO_CONTACTO'])
|
|
|
->where('PRCO_NUPR', '=', $numeroProveedor)
|
|
|
->where('PRCO_NULI', '=', $line)
|
|
|
- ->update($updateContacts);
|
|
|
- if (!$resp) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD012: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
- }
|
|
|
+ ->update([
|
|
|
+ 'PRCO_NOMB' => $contacts['NOMBRE_CONTACTO'],
|
|
|
+ 'PRCO_TIPO' => $contacts['TIPO_CONTACTO'],
|
|
|
+ 'PRCO_CALL' => $contacts['CALLE'],
|
|
|
+ 'PRCO_NUEX' => $contacts['NUMERO_EXTERIOR'],
|
|
|
+ 'PRCO_NUIN' => $contacts['NUMERO_INTERIOR'] != '' ? $contacts['NUMERO_INTERIOR'] : null,
|
|
|
+ 'PRCO_COPO' => $contacts['CODIGO_POSTAL'],
|
|
|
+ 'PRCO_COLO' => $contacts['COLONIA'],
|
|
|
+ 'PRCO_LOCA' => $contacts['LOCALIDAD'],
|
|
|
+ 'PRCO_MUNI' => $contacts['MUNICIPIO'],
|
|
|
+ 'PRCO_ENTI' => $contacts['ENTIDAD'],
|
|
|
+ 'PRCO_PAIS' => $contacts['PAIS'],
|
|
|
+ 'PRCO_TEL1' => $contacts['TELEFONO1'],
|
|
|
+ 'PRCO_TEL2' => $contacts['TELEFONO2'] != '' ? $contacts['TELEFONO2'] : null,
|
|
|
+ 'PRCO_COR1' => $contacts['CORREO1'],
|
|
|
+ 'PRCO_COR2' => $contacts['CORREO2'] != '' ? $contacts['CORREO2'] : null,
|
|
|
+ 'PRCO_OBSE' => $contacts['OBSERVACIONES'],
|
|
|
+ 'PRCO_USMO' => $user,
|
|
|
+ 'PRCO_FEMO' => $currentDate,
|
|
|
+ 'PRCO_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
+ ]);
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD013: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
-
|
|
|
- }else if($contacts->ESTADO == 'Nuevo'){
|
|
|
- $insertContacts = [
|
|
|
- 'PRCO_NUPR' => $numeroProveedor,
|
|
|
- 'PRCO_NOMB' => $contacts->NOMBRE_CONTACTO,
|
|
|
- 'PRCO_TIPO' => $contacts->TIPO_CONTACTO,
|
|
|
- 'PRCO_CALL' => $contacts->CALLE,
|
|
|
- 'PRCO_NUEX' => $contacts->NUMERO_EXTERIOR,
|
|
|
- 'PRCO_NUIN' => $contacts->NUMERO_INTERIOR != '' ? $contacts->NUMERO_INTERIOR : null,
|
|
|
- 'PRCO_COPO' => $contacts->CODIGO_POSTAL,
|
|
|
- 'PRCO_COLO' => $contacts->COLONIA,
|
|
|
- 'PRCO_MUNI' => $contacts->MUNICIPIO,
|
|
|
- 'PRCO_ENTI' => $contacts->ENTIDAD,
|
|
|
- 'PRCO_PAIS' => $contacts->PAIS,
|
|
|
- 'PRCO_LAD1' => $contacts->LADA1,
|
|
|
- 'PRCO_TEL1' => $contacts->TELEFONO1,
|
|
|
- 'PRCO_LAD2' => $contacts->LADA2 != '' ? $contacts->LADA2 : null,
|
|
|
- 'PRCO_TEL2' => $contacts->TELEFONO2 != '' ? $contacts->TELEFONO2 : null,
|
|
|
- 'PRCO_COR1' => $contacts->CORREO1,
|
|
|
- 'PRCO_COR2' => $contacts->CORREO2 != '' ? $contacts->CORREO2 : null,
|
|
|
- 'PRCO_OBSE' => $contacts->OBSERVACIONES,
|
|
|
- 'PRCO_NULI' => $line,
|
|
|
- 'PRCO_USRE' => $user,
|
|
|
- 'PRCO_FERE' => $currentDate,
|
|
|
- 'PRCO_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
- ];
|
|
|
+ if (!$validateUpdateContact) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD012: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
+ }
|
|
|
+ } else if ($contacts['ESTADO'] == 'Nuevo') {
|
|
|
try {
|
|
|
- $resp = DB::table('S002V01TPRCO')->insert($insertContacts);
|
|
|
- if (!$resp) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD014: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
- }
|
|
|
+ $validateInsertContact = DB::table('S002V01TPRCO')->insert([
|
|
|
+ 'PRCO_NUPR' => $numeroProveedor,
|
|
|
+ 'PRCO_NOMB' => $contacts['NOMBRE_CONTACTO'],
|
|
|
+ 'PRCO_TIPO' => $contacts['TIPO_CONTACTO'],
|
|
|
+ 'PRCO_CALL' => $contacts['CALLE'],
|
|
|
+ 'PRCO_NUEX' => $contacts['NUMERO_EXTERIOR'],
|
|
|
+ 'PRCO_NUIN' => $contacts['NUMERO_INTERIOR'] != '' ? $contacts['NUMERO_INTERIOR'] : null,
|
|
|
+ 'PRCO_COPO' => $contacts['CODIGO_POSTAL'],
|
|
|
+ 'PRCO_COLO' => $contacts['COLONIA'],
|
|
|
+ 'PRCO_LOCA' => $contacts['LOCALIDAD'],
|
|
|
+ 'PRCO_MUNI' => $contacts['MUNICIPIO'],
|
|
|
+ 'PRCO_ENTI' => $contacts['ENTIDAD'],
|
|
|
+ 'PRCO_PAIS' => $contacts['PAIS'],
|
|
|
+ 'PRCO_LAD1' => $contacts['LADA1'],
|
|
|
+ 'PRCO_TEL1' => $contacts['TELEFONO1'],
|
|
|
+ 'PRCO_LAD2' => $contacts['LADA2'] != '' ? $contacts['LADA2'] : null,
|
|
|
+ 'PRCO_TEL2' => $contacts['TELEFONO2'] != '' ? $contacts['TELEFONO2'] : null,
|
|
|
+ 'PRCO_COR1' => $contacts['CORREO1'],
|
|
|
+ 'PRCO_COR2' => $contacts['CORREO2'] != '' ? $contacts['CORREO2'] : null,
|
|
|
+ 'PRCO_OBSE' => $contacts['OBSERVACIONES'],
|
|
|
+ 'PRCO_NULI' => $line,
|
|
|
+ 'PRCO_USRE' => $user,
|
|
|
+ 'PRCO_FERE' => $currentDate,
|
|
|
+ 'PRCO_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
+ ]);
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD015: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
- }else if($contacts->ESTADO == 'Eliminado'){
|
|
|
- $updateContacts = [
|
|
|
- 'PRCO_ESTA' => 'Eliminado',
|
|
|
- 'PRCO_USMO' => $user,
|
|
|
- 'PRCO_FEMO' => $currentDate,
|
|
|
- 'PRCO_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
- ];
|
|
|
+ if (!$validateInsertContact) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD014: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
+ }
|
|
|
+ } else if ($contacts['ESTADO'] == 'Eliminado'){
|
|
|
try {
|
|
|
- $resp = DB::table('S002V01TPRCO')
|
|
|
- ->where('PRCO_IDCP', '=', $contacts->NUMERO_CONTACTO)
|
|
|
+ $validateUpdateContact = DB::table('S002V01TPRCO')
|
|
|
+ ->where('PRCO_IDCP', '=', $contacts['NUMERO_CONTACTO'])
|
|
|
->where('PRCO_NUPR', '=', $numeroProveedor)
|
|
|
->where('PRCO_NULI', '=', $line)
|
|
|
- ->update($updateContacts);
|
|
|
- if (!$resp) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD016: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
- }
|
|
|
+ ->update([
|
|
|
+ 'PRCO_ESTA' => 'Eliminado',
|
|
|
+ 'PRCO_USMO' => $user,
|
|
|
+ 'PRCO_FEMO' => $currentDate,
|
|
|
+ 'PRCO_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
+ ]);
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD017: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
+ if (!$validateUpdateContact) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD016: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
foreach ($arrConditions as $conditions) {
|
|
|
- if ($conditions->ESTADO == 'Activo' && $conditions->ESTADO == 'Modificado') {
|
|
|
- $updateConditions = [
|
|
|
- 'PRCN_TIPO' => $conditions->TIPO_CONDICION,
|
|
|
- 'PRCN_INFO' => $conditions->INFORMACION,
|
|
|
- 'PRCN_USMO' => $user,
|
|
|
- 'PRCN_FEMO' => $currentDate,
|
|
|
- 'PRCN_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
- ];
|
|
|
+ if ($conditions['ESTADO'] == 'Activo' || $conditions['ESTADO'] == 'Modificado') {
|
|
|
try {
|
|
|
- $resp = DB::table('S002V01TPRCN')
|
|
|
- ->where('PRCN_IDCM', '=', $conditions->NUMERO_CONDICION)
|
|
|
+ $validateUpdateCondition = DB::table('S002V01TPRCN')
|
|
|
+ ->where('PRCN_IDCM', '=', $conditions['NUMERO_CONDICION'])
|
|
|
->where('PRCN_NUPR', '=', $numeroProveedor)
|
|
|
->where('PRCN_NULI', '=', $line)
|
|
|
- ->update($updateConditions);
|
|
|
- if (!$resp) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD018: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
- }
|
|
|
+ ->update([
|
|
|
+ 'PRCN_TIPO' => $conditions['TIPO_CONDICION'],
|
|
|
+ 'PRCN_INFO' => $conditions['INFORMACION'],
|
|
|
+ 'PRCN_USMO' => $user,
|
|
|
+ 'PRCN_FEMO' => $currentDate,
|
|
|
+ 'PRCN_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
+ ]);
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD019: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
- }else if($conditions->ESTADO == 'Nuevo'){
|
|
|
- $insertConditions = [
|
|
|
- 'PRCN_NUPR' => $numeroProveedor,
|
|
|
- 'PRCN_TIPO' => $conditions->TIPO_CONDICION,
|
|
|
- 'PRCN_INFO' => $conditions->INFORMACION,
|
|
|
- 'PRCN_NULI' => $line,
|
|
|
- 'PRCN_USRE' => $user,
|
|
|
- 'PRCN_FERE' => $currentDate,
|
|
|
- 'PRCN_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
- ];
|
|
|
+ if (!$validateUpdateCondition) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD018: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
+ }
|
|
|
+ } else if ($conditions['ESTADO'] == 'Nuevo'){
|
|
|
try {
|
|
|
- $resp = DB::table('S002V01TPRCN')->insert($insertConditions);
|
|
|
- if (!$resp) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD020: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
- }
|
|
|
+ $validateInsertCondition = DB::table('S002V01TPRCN')->insert([
|
|
|
+ 'PRCN_NUPR' => $numeroProveedor,
|
|
|
+ 'PRCN_TIPO' => $conditions['TIPO_CONDICION'],
|
|
|
+ 'PRCN_INFO' => $conditions['INFORMACION'],
|
|
|
+ 'PRCN_NULI' => $line,
|
|
|
+ 'PRCN_USRE' => $user,
|
|
|
+ 'PRCN_FERE' => $currentDate,
|
|
|
+ 'PRCN_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
+ ]);
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD021: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
- }else if ($conditions->ESTADO == 'Eliminado'){
|
|
|
-
|
|
|
+ if (!$validateInsertCondition) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD020: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
+ }
|
|
|
+ } else if ($conditions['ESTADO'] == 'Eliminado'){
|
|
|
try {
|
|
|
$validateRegister = DB::table('S002V01TPRCN')
|
|
|
- ->where('PRCN_IDCM', '=', $conditions->NUMERO_CONDICION)
|
|
|
+ ->where('PRCN_IDCM', '=', $conditions['NUMERO_CONDICION'])
|
|
|
->where('PRCN_NUPR', '=', $numeroProveedor)
|
|
|
->where('PRCN_NULI', '=', $line)
|
|
|
->exists();
|
|
|
@@ -682,8 +683,8 @@ class ProviderController extends Controller{
|
|
|
|
|
|
if ($validateRegister) {
|
|
|
try {
|
|
|
- $validateUpdate = DB::table('S002V01TPRCN')
|
|
|
- ->where('PRCN_IDCM', '=', $conditions->NUMERO_CONDICION)
|
|
|
+ $validateUpdateConditions = DB::table('S002V01TPRCN')
|
|
|
+ ->where('PRCN_IDCM', '=', $conditions['NUMERO_CONDICION'])
|
|
|
->where('PRCN_NUPR', '=', $numeroProveedor)
|
|
|
->where('PRCN_NULI', '=', $line)
|
|
|
->update([
|
|
|
@@ -697,8 +698,7 @@ class ProviderController extends Controller{
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD023: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
-
|
|
|
- if (!$validateUpdate) {
|
|
|
+ if (!$validateUpdateConditions) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD022: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
}
|
|
|
@@ -707,54 +707,52 @@ class ProviderController extends Controller{
|
|
|
}
|
|
|
|
|
|
foreach ($arrCatalogs as $catalogs) {
|
|
|
- if ($catalogs->ESTADO == 'Activo' || $catalogs->ESTADO == 'Modificado') {
|
|
|
- $updateCatalogs = [
|
|
|
- 'PRCE_CATA' => $catalogs->CATALAGO,
|
|
|
- 'PRCE_DESC' => $catalogs->DESCRIPCION,
|
|
|
- 'PRCE_XURL' => $catalogs->URL_CATALAGO,
|
|
|
- 'PRCE_USMO' => $user,
|
|
|
- 'PRCE_FEMO' => $currentDate,
|
|
|
- 'PRCE_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
- ];
|
|
|
+ if ($catalogs['ESTADO'] == 'Activo' || $catalogs['ESTADO'] == 'Modificado') {
|
|
|
try {
|
|
|
- $resp = DB::table('S002V01TPRCE')
|
|
|
- ->where('PRCE_IDCE', '=', $catalogs->NUMERO_CATALAGO)
|
|
|
+ $validateUpdateCatalog = DB::table('S002V01TPRCE')
|
|
|
+ ->where('PRCE_IDCE', '=', $catalogs['NUMERO_CATALAGO'])
|
|
|
->where('PRCE_NUPR', '=', $numeroProveedor)
|
|
|
->where('PRCE_NULI', '=', $line)
|
|
|
- ->update($updateCatalogs);
|
|
|
- if (!$resp) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD024: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
- }
|
|
|
+ ->update([
|
|
|
+ 'PRCE_CATA' => $catalogs['CATALAGO'],
|
|
|
+ 'PRCE_DESC' => $catalogs['DESCRIPCION'],
|
|
|
+ 'PRCE_XURL' => $catalogs['URL_CATALAGO'],
|
|
|
+ 'PRCE_USMO' => $user,
|
|
|
+ 'PRCE_FEMO' => $currentDate,
|
|
|
+ 'PRCE_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
+ ]);
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD025: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
- }else if($catalogs->ESTADO == 'Nuevo'){
|
|
|
- $insertCatalogs = [
|
|
|
- 'PRCE_NUPR' => $numeroProveedor,
|
|
|
- 'PRCE_CATA' => $catalogs->CATALAGO,
|
|
|
- 'PRCE_DESC' => $catalogs->DESCRIPCION,
|
|
|
- 'PRCE_XURL' => $catalogs->URL_CATALAGO,
|
|
|
- 'PRCE_NULI' => $line,
|
|
|
- 'PRCE_USRE' => $user,
|
|
|
- 'PRCE_FERE' => $currentDate,
|
|
|
- 'PRCE_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
- ];
|
|
|
+ if (!$validateUpdateCatalog) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD024: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
+ }
|
|
|
+ } else if ($catalogs['ESTADO'] == 'Nuevo'){
|
|
|
try {
|
|
|
- $resp = DB::table('S002V01TPRCE')->insert($insertCatalogs);
|
|
|
- if (!$resp) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD026: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
- }
|
|
|
+ $validateInsertCatalog = DB::table('S002V01TPRCE')->insert([
|
|
|
+ 'PRCE_NUPR' => $numeroProveedor,
|
|
|
+ 'PRCE_CATA' => $catalogs['CATALAGO'],
|
|
|
+ 'PRCE_DESC' => $catalogs['DESCRIPCION'],
|
|
|
+ 'PRCE_XURL' => $catalogs['URL_CATALAGO'],
|
|
|
+ 'PRCE_NULI' => $line,
|
|
|
+ 'PRCE_USRE' => $user,
|
|
|
+ 'PRCE_FERE' => $currentDate,
|
|
|
+ 'PRCE_FEAR' => DB::raw('CURRENT_TIMESTAMP')
|
|
|
+ ]);
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD027: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
- }else if($catalogs->ESTADO == 'Eliminado'){
|
|
|
+ if (!$validateInsertCatalog) {
|
|
|
+ DB::rollBack();
|
|
|
+ return $this->responseController->makeResponse(true, "ERR_PROVIDER_MOD026: Ocurrió un error al obtener el contenido.", [], 500);
|
|
|
+ }
|
|
|
+ } else if ($catalogs['ESTADO'] == 'Eliminado'){
|
|
|
try {
|
|
|
$validateExists = DB::table('S002V01TPRCE')
|
|
|
- ->where('PRCE_IDCE', '=', $catalogs->NUMERO_CATALAGO)
|
|
|
+ ->where('PRCE_IDCE', '=', $catalogs['NUMERO_CATALAGO'])
|
|
|
->where('PRCE_NUPR', '=', $numeroProveedor)
|
|
|
->where('PRCE_NULI', '=', $line)
|
|
|
->exists();
|
|
|
@@ -766,7 +764,7 @@ class ProviderController extends Controller{
|
|
|
if ($validateExists) {
|
|
|
try {
|
|
|
$validateDelete = DB::table('S002V01TPRCE')
|
|
|
- ->where('PRCE_IDCE', '=', $catalogs->NUMERO_CATALAGO)
|
|
|
+ ->where('PRCE_IDCE', '=', $catalogs['NUMERO_CATALAGO'])
|
|
|
->where('PRCE_NUPR', '=', $numeroProveedor)
|
|
|
->where('PRCE_NULI', '=', $line)
|
|
|
->update([
|
|
|
@@ -796,7 +794,7 @@ class ProviderController extends Controller{
|
|
|
$validator = Validator::make($request->all(), [
|
|
|
'line' => 'required|string',
|
|
|
'user' => 'required|string',
|
|
|
- 'obj_response' => 'required|string',
|
|
|
+ 'obj_response' => 'required',
|
|
|
]);
|
|
|
|
|
|
if ($validator->fails()) {
|
|
|
@@ -818,25 +816,19 @@ class ProviderController extends Controller{
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_REG001: Ocurrió un error al obtener el usuario.", $th->getMessage(), 500);
|
|
|
}
|
|
|
- try {
|
|
|
- $obj_response = json_decode($requestData['obj_response']);
|
|
|
- } catch (\Throwable $th) {
|
|
|
- DB::rollBack();
|
|
|
- return $this->responseController->makeResponse(true, "ERR_PROVIDER_REG002: Ocurrió un error al obtener los datos del proveedor.", $th->getMessage(), 500);
|
|
|
- }
|
|
|
|
|
|
- $arrInformationPersonal = (array) $obj_response->INFORMACION;
|
|
|
- $arrReferences = (array) $obj_response->REFERENCIAS;
|
|
|
- $arrContacts = (array) $obj_response->CONTACTOS;
|
|
|
- $arrConditions = (array) $obj_response->CONDICIONES;
|
|
|
- $arrPaymentMedia = (array) $obj_response->METODOS_PAGO;
|
|
|
- $arrCatalogs = (array) $obj_response->CATALAGOS;
|
|
|
+ $arrInformationPersonal = (array) $requestData['obj_response']['INFORMACION'];
|
|
|
+ $arrReferences = (array) $requestData['obj_response']['REFERENCIAS'];
|
|
|
+ $arrContacts = (array) $requestData['obj_response']['CONTACTOS'];
|
|
|
+ $arrConditions = (array) $requestData['obj_response']['CONDICIONES'];
|
|
|
+ $arrPaymentMedia = (array) $requestData['obj_response']['METODOS_PAGO'];
|
|
|
+ $arrCatalogs = (array) $requestData['obj_response']['CATALAGOS'];
|
|
|
|
|
|
$currentDate = Carbon::now()->timezone('America/Mazatlan')->toDateTimeString();
|
|
|
|
|
|
$arrPaymentTemp = array();
|
|
|
foreach ($arrPaymentMedia as $payment) {
|
|
|
- $arrPaymentTemp[$payment->MEPA_IDME] = $payment->MEPA_NOMB;
|
|
|
+ $arrPaymentTemp[$payment['MEPA_IDME']] = $payment['MEPA_NOMB'];
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
@@ -845,7 +837,7 @@ class ProviderController extends Controller{
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_REG003: Ocurrió un error al obtener los métodos de pago del proveedor.", $th->getMessage(), 500);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$insertPersonal = [
|
|
|
'PROV_NOCO' => $arrInformationPersonal['RAZON_SOCIAL'],
|
|
|
'PROV_NOMB' => $arrInformationPersonal['NOMBRE'],
|
|
|
@@ -854,24 +846,23 @@ class ProviderController extends Controller{
|
|
|
'PROV_CORR' => $arrInformationPersonal['CORREO'],
|
|
|
'PROV_LAD1' => $arrInformationPersonal['LADA1'],
|
|
|
'PROV_TEL1' => $arrInformationPersonal['TELEFONO1'],
|
|
|
- 'PROV_LAD2' => $arrInformationPersonal['LADA2'] != '' ? $arrInformationPersonal['LADA2'] : null,
|
|
|
+ 'PROV_LAD2' => $arrInformationPersonal['LADA2'],
|
|
|
'PROV_TEL2' => $arrInformationPersonal['TELEFONO2'] != '' ? $arrInformationPersonal['TELEFONO2'] : null,
|
|
|
+ 'PROV_TICO' => $arrInformationPersonal['TIPO_CONTRIBUYENTE'],
|
|
|
'PROV_XRFC' => $arrInformationPersonal['RFC'],
|
|
|
'PROV_XTAX' => $arrInformationPersonal['TAXID'] != '' ? $arrInformationPersonal['TAXID'] : null,
|
|
|
'PROV_CORF' => $arrInformationPersonal['REGIMEN_FISCAL'],
|
|
|
'PROV_TIPO' => $arrInformationPersonal['TIPO'],
|
|
|
'PROV_SIWE' => $arrInformationPersonal['SITIOWEB'],
|
|
|
-
|
|
|
- // 'PROV_SIWE' => $arrInformationPersonal['SITIO_WEB'],
|
|
|
'PROV_CALL' => $arrInformationPersonal['CALLE'],
|
|
|
'PROV_NUEX' => $arrInformationPersonal['EXTERIOR'],
|
|
|
- 'PROV_NUIN' => $arrInformationPersonal['INTERIOR'],
|
|
|
+ 'PROV_NUIN' => $arrInformationPersonal['INTERIOR'] != '' ? $arrInformationPersonal['INTERIOR'] : null,
|
|
|
'PROV_COPO' => $arrInformationPersonal['CODIGO_POSTAL'],
|
|
|
'PROV_COLO' => $arrInformationPersonal['COLONIA'],
|
|
|
+ 'PROV_LOCA' => $arrInformationPersonal['LOCALIDAD'],
|
|
|
'PROV_MUNI' => $arrInformationPersonal['MUNICIPIO'],
|
|
|
'PROV_ENTI' => $arrInformationPersonal['ENTIDAD'],
|
|
|
'PROV_PAIS' => $arrInformationPersonal['PAIS'],
|
|
|
-
|
|
|
'PROV_MEPA' => $strPayment,
|
|
|
'PROV_NULI' => $line,
|
|
|
'PROV_USRE' => $user,
|
|
|
@@ -885,15 +876,15 @@ class ProviderController extends Controller{
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_REG004: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
}
|
|
|
foreach ($arrReferences as $references) {
|
|
|
- if ($references->ESTADO == 'Activo' || $references->ESTADO == 'Nuevo') {
|
|
|
+ if ($references['ESTADO'] == 'Activo' || $references['ESTADO'] == 'Nuevo') {
|
|
|
$insertReferences = [
|
|
|
'PRRE_NUPR' => $idProdiver,
|
|
|
- 'PRRE_EMPR' => $references->RAZON_SOCIAL,
|
|
|
- 'PRRE_CORR' => $references->CORREO,
|
|
|
- 'PRRE_LADA' => $references->LADA,
|
|
|
- 'PRRE_TELE' => $references->TELEFONO,
|
|
|
- 'PRRE_XRFC' => $references->RFC,
|
|
|
- 'PRRE_DIRE' => $references->DIRECCION,
|
|
|
+ 'PRRE_EMPR' => $references['RAZON_SOCIAL'],
|
|
|
+ 'PRRE_CORR' => $references['CORREO'],
|
|
|
+ 'PRRE_LADA' => $references['LADA'],
|
|
|
+ 'PRRE_TELE' => $references['TELEFONO'],
|
|
|
+ 'PRRE_XRFC' => $references['RFC'],
|
|
|
+ 'PRRE_DIRE' => $references['DIRECCION'],
|
|
|
'PRRE_NULI' => $line,
|
|
|
'PRRE_USRE' => $user,
|
|
|
'PRRE_FERE' => $currentDate,
|
|
|
@@ -913,26 +904,27 @@ class ProviderController extends Controller{
|
|
|
}
|
|
|
|
|
|
foreach ($arrContacts as $contacts) {
|
|
|
- if ($contacts->ESTADO == 'Activo' || $contacts->ESTADO == 'Nuevo') {
|
|
|
+ if ($contacts['ESTADO'] == 'Activo' || $contacts['ESTADO'] == 'Nuevo') {
|
|
|
$insertContacts = [
|
|
|
'PRCO_NUPR' => $idProdiver,
|
|
|
- 'PRCO_NOMB' => $contacts->NOMBRE_CONTACTO,
|
|
|
- 'PRCO_TIPO' => $contacts->TIPO_CONTACTO,
|
|
|
- 'PRCO_CALL' => $contacts->CALLE,
|
|
|
- 'PRCO_NUEX' => $contacts->NUMERO_EXTERIOR,
|
|
|
- 'PRCO_NUIN' => $contacts->NUMERO_INTERIOR != '' ? $contacts->NUMERO_INTERIOR : null,
|
|
|
- 'PRCO_COPO' => $contacts->CODIGO_POSTAL,
|
|
|
- 'PRCO_COLO' => $contacts->COLONIA,
|
|
|
- 'PRCO_MUNI' => $contacts->MUNICIPIO,
|
|
|
- 'PRCO_ENTI' => $contacts->ENTIDAD,
|
|
|
- 'PRCO_PAIS' => $contacts->PAIS,
|
|
|
- 'PRCO_LAD1' => $contacts->LADA1,
|
|
|
- 'PRCO_TEL1' => $contacts->TELEFONO1,
|
|
|
- 'PRCO_LAD2' => $contacts->LADA2 != '' ? $contacts->LADA2 : null,
|
|
|
- 'PRCO_TEL2' => $contacts->TELEFONO2 != '' ? $contacts->TELEFONO2 : null,
|
|
|
- 'PRCO_COR1' => $contacts->CORREO1,
|
|
|
- 'PRCO_COR2' => $contacts->CORREO2 != '' ? $contacts->CORREO2 : null,
|
|
|
- 'PRCO_OBSE' => $contacts->OBSERVACIONES,
|
|
|
+ 'PRCO_NOMB' => $contacts['NOMBRE_CONTACTO'],
|
|
|
+ 'PRCO_TIPO' => $contacts['TIPO_CONTACTO'],
|
|
|
+ 'PRCO_CALL' => $contacts['CALLE'],
|
|
|
+ 'PRCO_NUEX' => $contacts['NUMERO_EXTERIOR'],
|
|
|
+ 'PRCO_NUIN' => $contacts['NUMERO_INTERIOR'] != '' ? $contacts['NUMERO_INTERIOR'] : null,
|
|
|
+ 'PRCO_COPO' => $contacts['CODIGO_POSTAL'],
|
|
|
+ 'PRCO_LOCA' => $contacts['LOCALIDAD'],
|
|
|
+ 'PRCO_COLO' => $contacts['COLONIA'],
|
|
|
+ 'PRCO_MUNI' => $contacts['MUNICIPIO'],
|
|
|
+ 'PRCO_ENTI' => $contacts['ENTIDAD'],
|
|
|
+ 'PRCO_PAIS' => $contacts['PAIS'],
|
|
|
+ 'PRCO_LAD1' => $contacts['LADA1'],
|
|
|
+ 'PRCO_TEL1' => $contacts['TELEFONO1'],
|
|
|
+ 'PRCO_LAD2' => $contacts['LADA2'] != '' ? $contacts['LADA2'] : null,
|
|
|
+ 'PRCO_TEL2' => $contacts['TELEFONO2'] != '' ? $contacts['TELEFONO2'] : null,
|
|
|
+ 'PRCO_COR1' => $contacts['CORREO1'],
|
|
|
+ 'PRCO_COR2' => $contacts['CORREO2'] != '' ? $contacts['CORREO2'] : null,
|
|
|
+ 'PRCO_OBSE' => $contacts['OBSERVACIONES'],
|
|
|
'PRCO_NULI' => $line,
|
|
|
'PRCO_USRE' => $user,
|
|
|
'PRCO_FERE' => $currentDate,
|
|
|
@@ -953,11 +945,11 @@ class ProviderController extends Controller{
|
|
|
}
|
|
|
|
|
|
foreach ($arrConditions as $conditions) {
|
|
|
- if ($conditions->ESTADO == 'Activo') {
|
|
|
+ if ($conditions['ESTADO'] == 'Activo') {
|
|
|
$insertConditions = [
|
|
|
'PRCN_NUPR' => $idProdiver,
|
|
|
- 'PRCN_TIPO' => $conditions->TIPO_CONDICION,
|
|
|
- 'PRCN_INFO' => $conditions->INFORMACION,
|
|
|
+ 'PRCN_TIPO' => $conditions['TIPO_CONDICION'],
|
|
|
+ 'PRCN_INFO' => $conditions['INFORMACION'],
|
|
|
'PRCN_NULI' => $line,
|
|
|
'PRCN_USRE' => $user,
|
|
|
'PRCN_FERE' => $currentDate,
|
|
|
@@ -977,12 +969,12 @@ class ProviderController extends Controller{
|
|
|
}
|
|
|
|
|
|
foreach ($arrCatalogs as $catalogs) {
|
|
|
- if ($catalogs->ESTADO == 'Activo' || $catalogs->ESTADO == 'Nuevo') {
|
|
|
+ if ($catalogs['ESTADO'] == 'Activo' || $catalogs['ESTADO'] == 'Nuevo') {
|
|
|
$insertCatalogs = [
|
|
|
'PRCE_NUPR' => $idProdiver,
|
|
|
- 'PRCE_CATA' => $catalogs->CATALAGO,
|
|
|
- 'PRCE_DESC' => $catalogs->DESCRIPCION,
|
|
|
- 'PRCE_XURL' => $catalogs->URL_CATALAGO,
|
|
|
+ 'PRCE_CATA' => $catalogs['CATALAGO'],
|
|
|
+ 'PRCE_DESC' => $catalogs['DESCRIPCION'],
|
|
|
+ 'PRCE_XURL' => $catalogs['URL_CATALAGO'],
|
|
|
'PRCE_NULI' => $line,
|
|
|
'PRCE_USRE' => $user,
|
|
|
'PRCE_FERE' => $currentDate,
|
|
|
@@ -1064,10 +1056,10 @@ class ProviderController extends Controller{
|
|
|
];
|
|
|
try {
|
|
|
$resp = DB::table('S002V01TPRRE')->where('PRRE_NUPR', '=', $numeroProveedor)->where('PRRE_NULI', '=', $line)->update($update);
|
|
|
- if (!$resp) {
|
|
|
+ /* if (!$resp) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_DEL005: Ocurrió un error al obtener el contenido. ", [], 500);
|
|
|
- }
|
|
|
+ } */
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_DEL006: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
@@ -1081,10 +1073,10 @@ class ProviderController extends Controller{
|
|
|
];
|
|
|
try {
|
|
|
$resp = DB::table('S002V01TPRCO')->where('PRCO_NUPR', '=', $numeroProveedor)->where('PRCO_NULI', '=', $line)->update($update);
|
|
|
- if (!$resp) {
|
|
|
+ /* if (!$resp) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_DEL007: Ocurrió un error al obtener el contenido. ", [], 500);
|
|
|
- }
|
|
|
+ } */
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_DEL008: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
@@ -1098,10 +1090,10 @@ class ProviderController extends Controller{
|
|
|
];
|
|
|
try {
|
|
|
$resp = DB::table('S002V01TPRCN')->where('PRCN_NUPR', '=', $numeroProveedor)->where('PRCN_NULI', '=', $line)->update($update);
|
|
|
- if (!$resp) {
|
|
|
+ /* if (!$resp) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_DEL009: Ocurrió un error al obtener el contenido. ", [], 500);
|
|
|
- }
|
|
|
+ } */
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_DEL010: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
@@ -1115,10 +1107,10 @@ class ProviderController extends Controller{
|
|
|
];
|
|
|
try {
|
|
|
$resp = DB::table('S002V01TPRCE')->where('PRCE_NUPR', '=', $numeroProveedor)->where('PRCE_NULI', '=', $line)->update($update);
|
|
|
- if (!$resp) {
|
|
|
+ /* if (!$resp) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_DEL011: Ocurrió un error al obtener el contenido. ", [], 500);
|
|
|
- }
|
|
|
+ } */
|
|
|
} catch (\Throwable $th) {
|
|
|
DB::rollBack();
|
|
|
return $this->responseController->makeResponse(true, "ERR_PROVIDER_DEL012: Ocurrió un error al obtener el contenido.", $th->getMessage(), 500);
|
|
|
@@ -1163,6 +1155,7 @@ class ProviderController extends Controller{
|
|
|
'PROV_TEL1 AS TELEFONO1',
|
|
|
'PROV_LAD2 AS LADA2',
|
|
|
'PROV_TEL2 AS TELEFONO2',
|
|
|
+ 'PROV_TICO AS TIPO_CONTRIBUYENTE',
|
|
|
'PROV_XRFC AS RFC',
|
|
|
'PROV_XTAX AS TAXID',
|
|
|
'PROV_CORF AS REGIMEN_FISCAL',
|
|
|
@@ -1208,6 +1201,7 @@ class ProviderController extends Controller{
|
|
|
'PROV_TEL1',
|
|
|
'PROV_LAD2',
|
|
|
'PROV_TEL2',
|
|
|
+ 'PROV_TICO',
|
|
|
'PROV_XRFC',
|
|
|
'PROV_XTAX',
|
|
|
'PROV_CORF',
|