<?php

namespace App\Http\Resources;

use App\Danoral\Entidades\SyncEntidades;
use App\Danoral\U;
use Illuminate\Http\Resources\Json\JsonResource;

class DanoralFacturasJSys extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'idE'           => strval( SyncEntidades::cambioID_edif($this->id_Entidad)),
            'codE'          => trim($this->cod_Entidad),
            'nameE'         => trim($this->nombre_Entidad),
            'anoF'          => strval($this->ano_Cond),
            'mesF'          => U::getMesTxt($this->mes_Cond),
            'nroFactura'    => '',
            'nroControl'    => '',
            'gtosAdmin'     => number_format($this->gtosAdmin, 2, ',', '.'),
            'gtosCobranza'  => number_format($this->gtosCobr, 2, ',', '.'),
            'baseImponible' => number_format($this->base, 2, ',', '.'),
            'porcIVA'       => number_format($this->porcIVA, 2, ',', '.'),
            'IVA'           => number_format($this->IVA, 2, ',', '.'),
            'montoTotal'    => number_format($this->montoTotal, 2, ',', '.'),
            'errNro'        => 0, //$this->errNro,
        ];
    }
}
