118 lines
2.9 KiB
PHP
118 lines
2.9 KiB
PHP
<?php
|
|
|
|
|
|
namespace App\Helpers;
|
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
function isDuplicate($pID)
|
|
{
|
|
$duplicate_check = DB::table('vat_warehouse.mapping as m')
|
|
->join('vat_warehouse.old_mapping2property as m2p', 'm.id', '=', 'm2p.old_mapping_id')
|
|
->where('m2p.physical_item_property_id', 1)
|
|
->where('m.id', $pID)
|
|
->exists();
|
|
|
|
return $duplicate_check;
|
|
}
|
|
|
|
|
|
function isKaravan($pID)
|
|
{
|
|
$query_check = DB::table('vat_warehouse.mapping as m')
|
|
->join('vat_warehouse.old_mapping2property as m2p', 'm.id', '=', 'm2p.old_mapping_id')
|
|
->where('m2p.physical_item_property_id', 62)
|
|
->where('m.id', $pID)
|
|
->exists();
|
|
|
|
return $query_check;
|
|
}
|
|
|
|
function isProgrammable($pID)
|
|
{
|
|
$query_check = DB::table('vat_warehouse.mapping as m')
|
|
->join('vat_warehouse.old_mapping2property as m2p', 'm.id', '=', 'm2p.old_mapping_id')
|
|
->where('m2p.physical_item_property_id', 58)
|
|
->where('m.id', $pID)
|
|
->exists();
|
|
|
|
return $query_check;
|
|
}
|
|
|
|
function isEmptyGeneral($pID)
|
|
{
|
|
$query_check = DB::table('vat_warehouse.mapping as m')
|
|
->join('vat_warehouse.old_mapping2property as m2p', 'm.id', '=', 'm2p.old_mapping_id')
|
|
->where('m2p.physical_item_property_id', 3)
|
|
->where('m.id', $pID)
|
|
->exists();
|
|
|
|
return $query_check;
|
|
}
|
|
|
|
function isGate($pID)
|
|
{
|
|
$query_check = DB::table('vat_warehouse.mapping as m')
|
|
->join('vat_warehouse.old_mapping2property as m2p', 'm.id', '=', 'm2p.old_mapping_id')
|
|
->where('m2p.physical_item_property_id', 20)
|
|
->where('m.id', $pID)
|
|
->exists();
|
|
|
|
return $query_check;
|
|
}
|
|
|
|
function isGateProgramming($pID)
|
|
{
|
|
$query_check = DB::table('vat_warehouse.mapping as m')
|
|
->join('vat_warehouse.old_mapping2property as m2p', 'm.id', '=', 'm2p.old_mapping_id')
|
|
->where('m2p.physical_item_property_id', 32)
|
|
->where('m.id', $pID)
|
|
->exists();
|
|
|
|
return $query_check;
|
|
}
|
|
|
|
function isRolo($pID)
|
|
{
|
|
$query_check = DB::table('vat_warehouse.mapping as m')
|
|
->where('m.physical_item_type_id', 25)
|
|
->where('m.id', $pID)
|
|
->exists();
|
|
|
|
return $query_check;
|
|
}
|
|
|
|
function isProductRepair($pID)
|
|
{
|
|
$query_check = DB::table('vat_warehouse.mapping as m')
|
|
->where('m.physical_item_type_id', 48)
|
|
->where('m.id', $pID)
|
|
->exists();
|
|
|
|
return $query_check;
|
|
}
|
|
function getProductID($mID)
|
|
{
|
|
$externalID = DB::table('vat_warehouse.external_id as ei')
|
|
->where('ei.mapping_id', $mID)
|
|
->where('ei.eshop_id', 2)
|
|
->value('external_id');
|
|
|
|
return $externalID ?? null;
|
|
}
|
|
|
|
|
|
|
|
function isGeneralBrand($pID)
|
|
{
|
|
$query_check = DB::table('vat_warehouse.mapping as m')
|
|
->whereIn('m.physical_item_type_id', [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 24, 25, 64, 65, 66, 67, 69, 72, 76, 77, 78, 79])
|
|
->where('m.id', $pID)
|
|
->exists();
|
|
|
|
return $query_check;
|
|
}
|
|
|
|
|