<?php
namespace App\Http\Controllers\API\Reports;

use App\Models\User;
use PDF;
use Illuminate\Http\Request;
use App\Http\Controllers\AppBaseController;
use InfyOm\Generator\Criteria\LimitOffsetCriteria;
use App\Http\Controllers\API\Criteria\OrderbyPositionCriteria;
use Prettus\Repository\Criteria\RequestCriteria;
use Response;
use App\Http\Resources\User\UserResource;
use App\Http\Resources\ApiResourceCollection;
use Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use Log;
use Carbon\Carbon;
use Storage;

/**
 * Class DemoController
 * @package App\Http\Controllers\API
 */

class BaseReportController extends AppBaseController
{
    
    public function getPrinterTemplate($type, $data=null){
        if($type == 'Invoice'){
            $data = \App\Models\Invoice::find($data);    
            if(!empty($data)){
                if($data->net_gst>0){
                    $template = \App\Models\PrinterTemplate::where('name','=','Invoice1')->first();
                    return  response()->json(($template));            
                }else{
                    $template = \App\Models\PrinterTemplate::where('name','=','Invoice2')->first();
                    return  response()->json(($template)); 
                }
            }
        }
        response()->json(['message' =>'No Data Found']);    
    }
    
}

