107 lines
5.7 KiB
PHP
107 lines
5.7 KiB
PHP
<?php
|
|
|
|
class Stockform
|
|
{
|
|
// manufacturing details
|
|
public static function getStockManufacturingDetails($rawMaterial,$goods){
|
|
$getRawMaterial=array();
|
|
$getGoods=array();
|
|
//print_r($goods);die();
|
|
// raw material
|
|
if(count($rawMaterial)>0){
|
|
$getRawMaterial = array_map(function($tag) {
|
|
$getUom= $tag['raw_uom']==1 ? $tag['other_uom'] : (isset($tag['uom_master']) ? $tag['uom_master'] : '');
|
|
|
|
|
|
return array(
|
|
'type' => 'Raw Material',
|
|
'name' => $tag['raw_name'],
|
|
'quantity' => strtoupper($tag['stock_observed'])=='YES' ? $tag['raw_quantity'] : '',
|
|
'uom' => strtoupper($tag['stock_observed'])=='YES' ? $getUom : '',
|
|
'value' => strtoupper($tag['stock_observed'])=='YES' ? $tag['raw_value'] : '',
|
|
|
|
);
|
|
}, $rawMaterial);
|
|
}
|
|
// goods
|
|
if(count($goods)>0){
|
|
$getGoods = array_map(function($tag) {
|
|
$getGUom= $tag['goods_uom']==1 ? $tag['goods_other_uom'] : (isset($tag['uom_master']) ? $tag['uom_master'] : '');
|
|
|
|
return array(
|
|
'type' => 'Finished Goods',
|
|
'name' => $tag['goods_name'],
|
|
'quantity' => strtoupper($tag['goods_observed'])=='YES' ? ($tag['goods_quantity'] != "" ? $tag['goods_quantity'] : 'Could Not Verify') : '',
|
|
'uom' => strtoupper($tag['goods_observed'])=='YES' ? $getGUom : '',
|
|
'value' => strtoupper($tag['goods_observed'])=='YES' ? $tag['goods_value'] : '',
|
|
|
|
);
|
|
}, $goods);
|
|
}
|
|
return array_merge($getRawMaterial,$getGoods);
|
|
}
|
|
|
|
//get retail
|
|
public static function getStockRetailDetails($goods){
|
|
// goods
|
|
if(count($goods)>0){
|
|
$goods = array_map(function($tag) {
|
|
$getUom= $tag['traded_goods_uom']==1 ? $tag['traded_goods_other_uom'] : (isset($tag['uom_master']) ? $tag['uom_master'] : '');
|
|
$getSufficient= (strtoupper($tag['traded_goods_observed']) =='NO') ? 'No Stock Observed' : (isset($tag['is_sufficiant_traded_goods']) && (strtoupper($tag['is_sufficiant_traded_goods']) =='YES') ? 'Yes, the stock of traded goods observed' : 'No, the stock of traded goods observed because of '.$tag['traded_goods_remarks']);
|
|
return array(
|
|
'type' => 'Trading Goods',
|
|
'name' => $tag['traded_goods_name'],
|
|
'quantity' => strtoupper($tag['traded_goods_observed'])=='YES' ? ($tag['traded_goods_quantity'] != "" ? $tag['traded_goods_quantity'] : 'Could Not Verify') : '',
|
|
'uom' => strtoupper($tag['traded_goods_observed'])=='YES' ? $getUom : '',
|
|
'value' => strtoupper($tag['traded_goods_observed'])=='YES' ? $tag['estimated_traded_goods_value'] : '',
|
|
'is_sufficiant' => (strtoupper($tag['traded_goods_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['traded_goods_observed'])=='NO') ? $getSufficient : ''),
|
|
);
|
|
}, $goods);
|
|
}
|
|
return $goods;
|
|
}
|
|
|
|
// get wholesale
|
|
public static function getStockWholesaleDetails($goods){
|
|
// goods
|
|
if(count($goods)>0){
|
|
$goods = array_map(function($tag) {
|
|
$getUom= $tag['traded_goods_uom']==1 ? $tag['traded_goods_other_uom'] : (isset($tag['uom_master']) ? $tag['uom_master'] : '');
|
|
$getSufficient= (strtoupper($tag['traded_goods_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_traded_goods']) =='YES') ? 'Yes, the stock of traded goods observed' : 'No, the stock of traded goods observed because of '.$tag['traded_goods_remarks']);
|
|
return array(
|
|
'name' => $tag['traded_goods_name'],
|
|
'type' => 'Trading Goods',
|
|
'quantity' => strtoupper($tag['traded_goods_observed'])=='YES' ? ($tag['traded_goods_quantity'] != "" ? $tag['traded_goods_quantity'] : 'Could Not Verify') : '',
|
|
'uom' => strtoupper($tag['traded_goods_observed'])=='YES' ? $getUom : '',
|
|
'value' => strtoupper($tag['traded_goods_observed'])=='YES' ? $tag['estimated_traded_goods_value'] : '',
|
|
'is_sufficiant' => (strtoupper($tag['traded_goods_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['traded_goods_observed'])=='NO') ? $getSufficient : ''),
|
|
);
|
|
}, $goods);
|
|
}
|
|
// print_r($goods);
|
|
return $goods;
|
|
}
|
|
|
|
// get wholesale
|
|
public static function getStockServiceDetails($services){
|
|
// print_r($services);die();
|
|
if(count($services)>0){
|
|
$services = array_map(function($tag) {
|
|
$getUom= $tag['service_provider_uom']==1 ? $tag['service_provider_other_uom'] : (isset($tag['uom_master']) ? $tag['uom_master'] : '');
|
|
$getSufficient = (strtoupper($tag['service_provider_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_service_goods']) =='YES') ? 'Yes, the stock of service providing observed' : 'No, the stock of service providing observed because of '.$tag['service_goods_remarks']);
|
|
return array(
|
|
'name' => $tag['service_provider_name'],
|
|
'type' => 'Service Providing',
|
|
'quantity' => strtoupper($tag['service_provider_observed'])=='YES' ? ($tag['service_provider_quantity'] != "" ? $tag['service_provider_quantity'] : 'Could Not Verify') : '',
|
|
'uom' => strtoupper($tag['service_provider_observed'])=='YES' ? $getUom : '',
|
|
'value' => strtoupper($tag['service_provider_observed'])=='YES' ? $tag['estimated_service_provider_value'] : '',
|
|
'is_sufficiant' => (strtoupper($tag['service_provider_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['service_provider_observed'])=='NO') ? $getSufficient : ''),
|
|
);
|
|
}, $services);
|
|
}
|
|
//print_r($services);die();
|
|
return $services;
|
|
}
|
|
|
|
}
|
|
?>
|