82 lines
3.9 KiB
PHP
82 lines
3.9 KiB
PHP
<?php
|
|
|
|
class Stockform
|
|
{
|
|
// manufacturing details
|
|
public static function getStockManufacturingDetails($rawMaterial,$goods){
|
|
$getRawMaterial=array();
|
|
$getGoods=array();
|
|
//print_r($rawMaterial);die();
|
|
// raw material
|
|
if(count($rawMaterial)>0){
|
|
$getRawMaterial = array_map(function($tag) {
|
|
$getUom= $tag['raw_uom']==1 ? $tag['other_uom'] : $tag['raw_uom'];
|
|
|
|
|
|
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' ? 'Rs.'.$tag['raw_value'] : '',
|
|
|
|
);
|
|
}, $rawMaterial);
|
|
}
|
|
// goods
|
|
if(count($goods)>0){
|
|
$getGoods = array_map(function($tag) {
|
|
$getGUom= $tag['goods_uom']==1 ? $tag['goods_other_uom'] : $tag['goods_uom'];
|
|
|
|
return array(
|
|
'type' => 'Finished Goods',
|
|
'name' => $tag['goods_name'],
|
|
'quantity' => strtoupper($tag['goods_observed'])=='YES' ? $tag['goods_quantity'] : '',
|
|
'uom' => strtoupper($tag['goods_observed'])=='YES' ? $getGUom : '',
|
|
'value' => strtoupper($tag['goods_observed'])=='YES' ? 'Rs.'.$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'] : $tag['traded_goods_uom'];
|
|
$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'],
|
|
'quantity' => strtoupper($tag['traded_goods_observed'])=='YES' ? $tag['traded_goods_quantity'] : '',
|
|
'uom' => strtoupper($tag['traded_goods_observed'])=='YES' ? $getUom : '',
|
|
'value' => strtoupper($tag['traded_goods_observed'])=='YES' ? 'Rs.'.$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'] : $tag['traded_goods_uom'];
|
|
$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'],
|
|
'quantity' => strtoupper($tag['traded_goods_observed'])=='YES' ? $tag['traded_goods_quantity'] : '',
|
|
'uom' => strtoupper($tag['traded_goods_observed'])=='YES' ? $getUom : '',
|
|
'value' => strtoupper($tag['traded_goods_observed'])=='YES' ? 'Rs.'.$tag['estimated_traded_goods_value'] : '',
|
|
'is_sufficiant' => (strtoupper($tag['traded_goods_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['traded_goods_observed'])=='NO') ? $getSufficient : ''),
|
|
);
|
|
}, $goods);
|
|
}
|
|
return $goods;
|
|
}
|
|
}
|
|
?>
|