Beispiel #1
0
function agregarNotaCreditoReclamo($reclamo_id, $tipo, $numero, $fecha, $monto, $concepto, $rma, $pedido, $url)
{
    LogController::logWebServiceIn('Llamada a web service: ' . __FILE__ . ' - ' . __FUNCTION__, compact('reclamo_id', 'tipo', 'numero', 'fecha', 'monto', 'concepto', 'rma', 'pedido', 'url'));
    try {
        $reclamo = Reclamo::find($reclamo_id);
        $nc = NotaCredito::create(['reclamo_id' => $reclamo_id, 'tipo' => $tipo, 'numero' => $numero, 'fecha' => $fecha, 'monto' => $monto, 'concepto' => $concepto, 'rma' => $rma, 'pedido' => $pedido]);
        if ($url) {
            $urlArray = explode('.', $url);
            $filename = APP_TMPPATH . "tmpdoc." . end($urlArray);
            $url_file = fopen($url, 'r');
            if ($url_file) {
                file_put_contents($filename, $url_file);
                $descripcion = $tipo == 'nc' ? 'Nota de Crédito - ' . $numero : 'Nota de Débito - ' . $numero;
                (new \AttachmentCore())->addAttachmentToRequest($reclamo->ef_id, \FlowSettingsCore::get(FLOW_RECLAMOS, 'REC_ATT_ARCHIVO_NC'), $filename, APP_ENVPATH, 'admin', 'Nota de crédito / débito subida desde el módulo externo');
            }
        }
    } catch (Exception $e) {
        LogController::logWebServiceIn('Error de webservice: ' . $e->getMessage());
        return 'Error: ' . $e->getMessage();
    }
    return '';
}
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $record = NotaCredito::find($id)->delete();
     return new AjaxResponse('success', '');
 }