426 lines
23 KiB
PHP
426 lines
23 KiB
PHP
<?php
|
|
|
|
class Businessform
|
|
{
|
|
//get partner details
|
|
public static function getPartnerDetails($values){
|
|
$getPartner=array();
|
|
foreach($values as $parRow){
|
|
$getPartner = array_map(function($tag) {
|
|
$con_business_run = $tag['current_business_experiance_year'] >0 ? $tag['current_business_experiance_year'] :"";
|
|
$con_business_run .= ($tag['current_business_experiance_year'] == 1) ? "Year" : (($tag['current_business_experiance_year'] > 1) ? "Years" : "");
|
|
$con_business_run.=' ';
|
|
$con_business_run .=$tag['current_business_experiance_month'] >0 ? $tag['current_business_experiance_month'] : "";
|
|
$con_business_run .=($tag['current_business_experiance_month'] == 1) ? "Month" : (($tag['current_business_experiance_month'] > 1) ? "Months" : "");
|
|
return array(
|
|
'name' => array_key_exists('partner_other_name',$tag) ? $tag['partner_other_name'] : $tag['partner_name_master'],
|
|
'share_holding' => $tag['shareholding'].'%',
|
|
'no_years_business' => $con_business_run,
|
|
'total_experience' => $tag['total_business_experiance'],
|
|
'previous_experience' => array_key_exists('total_business_previous_experience',$tag) ? $tag['total_business_previous_experience'] : '',
|
|
|
|
);
|
|
}, $values);
|
|
|
|
}
|
|
return $getPartner;
|
|
}
|
|
//get family members details
|
|
public static function getFamilyMemberDetails($values){
|
|
$getFamilyMembers=array();
|
|
foreach($values as $parRow){
|
|
$getFamilyMembers = array_map(function($tag) {
|
|
return array(
|
|
'name' => $tag['family_member_salutation_master'].' '.$tag['family_member_name'],
|
|
'relation' => $tag['other_family_relationship_id_master'] .' of '.$tag['relation_to_id_master'],
|
|
'designation' => $tag['relationship_with_company_id_master'],
|
|
'started_business' => $tag['started_business'],
|
|
|
|
);
|
|
}, $values);
|
|
}
|
|
return $getFamilyMembers;
|
|
}
|
|
// get business activity details
|
|
public static function getActivityDetails($values,$type){
|
|
$getRow=array();
|
|
if($type==1 || $type==2 || $type==3){
|
|
foreach($values as $busManuRowkey=>$busManuRow){
|
|
$getEachProducts=array();
|
|
$getEachProducts['products']=$busManuRow['main_products'];
|
|
$getEachProducts['area_of_sale']=$busManuRow['area_of_sale'];
|
|
|
|
// check area of sales
|
|
$mergeStatesCities='';
|
|
if(strtoupper($busManuRow['area_of_sale'])=='WITHIN INDIA' && strtoupper($busManuRow['pan_india_options'])=='NO'){
|
|
// states
|
|
foreach($busManuRow['india_where_sale_done'] as $chilKey=>$childRow){
|
|
$mergeStatesCities=$mergeStatesCities;
|
|
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['india_where_sale_done'])-1 ? ' and ' : ",");
|
|
foreach($childRow['city_name'] as $chilCityKey=>$childCityRow){
|
|
$mergeStatesCities = $mergeStatesCities;
|
|
$mergeStatesCities .= ($chilCityKey==0) ? "":($chilCityKey==count($childRow['city_name'])-1 ? ' and ' : ",");
|
|
$mergeStatesCities .=$childCityRow;
|
|
}
|
|
$mergeStatesCities .=' of ';
|
|
$mergeStatesCities .=$childRow['state_name'];
|
|
$mergeStatesCities .= ($chilKey==count($busManuRow['india_where_sale_done'])-1 ? "." : "");
|
|
}
|
|
$getEachProducts['sales_done']=$mergeStatesCities;
|
|
// max sales done
|
|
$mergeMaxStatesCities='';
|
|
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
|
|
$mergeMaxStatesCities=$mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? ' and ' : ",");
|
|
foreach($childMRow['city_name'] as $chilMCityKey=>$childMCityRow){
|
|
$mergeMaxStatesCities = $mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['city_name'])-1 ? ' and ' : ",");
|
|
$mergeMaxStatesCities .=$childMCityRow;
|
|
}
|
|
//$mergeMaxStatesCities .=' of ';
|
|
//$mergeMaxStatesCities .=$childMRow['state_name'];
|
|
//$mergeMaxStatesCities .= ($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? "." : "");
|
|
}
|
|
$mergeMaxStatesCities.='.';
|
|
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
|
|
}
|
|
// area of sales with yes options
|
|
else if(strtoupper($busManuRow['area_of_sale'])=='WITHIN INDIA' && strtoupper($busManuRow['pan_india_options'])=='YES'){
|
|
// pan india
|
|
$getEachProducts['sales_done']='Pan India.';
|
|
// max sales done
|
|
$mergeMaxStatesCities='';
|
|
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
|
|
if(!empty($childMRow['state_name'])){
|
|
$mergeMaxStatesCities=$mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
|
|
foreach($childMRow['state_name'] as $chilMCityKey=>$childMCityRow){
|
|
$mergeMaxStatesCities = $mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
|
|
$mergeMaxStatesCities .=$childMCityRow;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
$mergeMaxStatesCities.='.';
|
|
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
|
|
}
|
|
// check area of sale export
|
|
else if(strtoupper($busManuRow['area_of_sale'])=='EXPORT'){
|
|
$mergeMaxStatesCities='';
|
|
// countries_where_export_done
|
|
foreach($busManuRow['countries_where_export_done'] as $chilKey=>$childRow){
|
|
$mergeStatesCities=$mergeStatesCities;
|
|
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['countries_where_export_done'])-1 ? ' and ' : ",");
|
|
|
|
$mergeStatesCities .=' '.$childRow['approx_sale'];
|
|
$mergeStatesCities .='% sales done in ';
|
|
$mergeStatesCities .=$childRow['country_name'];
|
|
//$mergeStatesCities .= ($chilKey==count($busManuRow['countries_where_export_done'])-1 ? "." : "");
|
|
}
|
|
$mergeStatesCities.='.';
|
|
$getEachProducts['sales_done']=$mergeStatesCities;
|
|
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
|
|
}
|
|
// check area of sale both
|
|
else if(strtoupper($busManuRow['area_of_sale'])=='BOTH'){
|
|
//print_r($busManuRow);die();
|
|
if(strtoupper($busManuRow['pan_india_options'])=='NO'){
|
|
// states
|
|
foreach($busManuRow['india_where_sale_done'] as $chilKey=>$childRow){
|
|
$mergeStatesCities=$mergeStatesCities;
|
|
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['india_where_sale_done'])-1 ? ' and ' : ",");
|
|
foreach($childRow['city_name'] as $chilCityKey=>$childCityRow){
|
|
$mergeStatesCities = $mergeStatesCities;
|
|
$mergeStatesCities .= ($chilCityKey==0) ? "":($chilCityKey==count($childRow['city_name'])-1 ? ' and ' : ",");
|
|
$mergeStatesCities .=$childCityRow;
|
|
}
|
|
$mergeStatesCities .=' of ';
|
|
$mergeStatesCities .=$childRow['state_name'];
|
|
$mergeStatesCities .= ($chilKey==count($busManuRow['india_where_sale_done'])-1 ? "." : "");
|
|
}
|
|
$getEachProducts['sales_done']=$mergeStatesCities;
|
|
// max sales done
|
|
$mergeMaxStatesCities='';
|
|
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
|
|
$mergeMaxStatesCities=$mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? ' and ' : ",");
|
|
foreach($childMRow['city_name'] as $chilMCityKey=>$childMCityRow){
|
|
$mergeMaxStatesCities = $mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['city_name'])-1 ? ' and ' : ",");
|
|
$mergeMaxStatesCities .=$childMCityRow;
|
|
}
|
|
//$mergeMaxStatesCities .=' of ';
|
|
//$mergeMaxStatesCities .=$childMRow['state_name'];
|
|
//$mergeMaxStatesCities .= ($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? "." : "");
|
|
}
|
|
$mergeMaxStatesCities.='.';
|
|
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
|
|
}
|
|
else if(strtoupper($busManuRow['pan_india_options'])=='YES'){
|
|
// pan india
|
|
$getEachProducts['sales_done']='Pan India.';
|
|
// max sales done
|
|
$mergeMaxStatesCities='';
|
|
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
|
|
if(!empty($childMRow['state_name'])){
|
|
$mergeMaxStatesCities=$mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
|
|
foreach($childMRow['state_name'] as $chilMCityKey=>$childMCityRow){
|
|
$mergeMaxStatesCities = $mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
|
|
$mergeMaxStatesCities .=$childMCityRow;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
$mergeMaxStatesCities.='.';
|
|
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
|
|
}
|
|
else{
|
|
$getEachProducts['sales_done']="";
|
|
$getEachProducts['max_sales_done']="";
|
|
}
|
|
// countries_where_export_done
|
|
if(array_key_exists('countries_where_export_done',$busManuRow)){
|
|
$mergeBothStates='';
|
|
foreach($busManuRow['countries_where_export_done'] as $chilKey=>$childRow){
|
|
$mergeBothStates=$mergeBothStates;
|
|
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['countries_where_export_done'])-1 ? ' and ' : ",");
|
|
|
|
$mergeBothStates .=' '.$childRow['approx_sale'];
|
|
$mergeBothStates .='% sales done in ';
|
|
$mergeBothStates .=$childRow['country_name'];
|
|
}
|
|
$mergeBothStates.='.';
|
|
$getEachProducts['both_sales_done']=$mergeBothStates;
|
|
}
|
|
|
|
}
|
|
array_push($getRow,$getEachProducts);
|
|
|
|
}
|
|
}
|
|
else if($type==4) {
|
|
foreach($values as $busManuRowkey=>$busManuRow){
|
|
$getEachProducts=array();
|
|
$getEachProducts['products']=$busManuRow['main_products'];
|
|
$getEachProducts['area_of_sale']=$busManuRow['area_of_sale'];
|
|
|
|
// check area of sales
|
|
$mergeStatesCities='';
|
|
if(strtoupper($busManuRow['area_of_sale'])=='WITHIN INDIA' && strtoupper($busManuRow['pan_india_options'])=='NO'){
|
|
// states
|
|
foreach($busManuRow['india_where_sale_done'] as $chilKey=>$childRow){
|
|
$mergeStatesCities=$mergeStatesCities;
|
|
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['india_where_sale_done'])-1 ? ' and ' : ",");
|
|
foreach($childRow['city_name'] as $chilCityKey=>$childCityRow){
|
|
$mergeStatesCities = $mergeStatesCities;
|
|
$mergeStatesCities .= ($chilCityKey==0) ? "":($chilCityKey==count($childRow['city_name'])-1 ? ' and ' : ",");
|
|
$mergeStatesCities .=$childCityRow;
|
|
}
|
|
$mergeStatesCities .=' of ';
|
|
$mergeStatesCities .=$childRow['state_name'];
|
|
$mergeStatesCities .= ($chilKey==count($busManuRow['india_where_sale_done'])-1 ? "." : "");
|
|
}
|
|
$getEachProducts['sales_done']=$mergeStatesCities;
|
|
// max sales done
|
|
$mergeMaxStatesCities='';
|
|
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
|
|
$mergeMaxStatesCities=$mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? ' and ' : ",");
|
|
foreach($childMRow['city_name'] as $chilMCityKey=>$childMCityRow){
|
|
$mergeMaxStatesCities = $mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['city_name'])-1 ? ' and ' : ",");
|
|
$mergeMaxStatesCities .=$childMCityRow;
|
|
}
|
|
//$mergeMaxStatesCities .=' of ';
|
|
//$mergeMaxStatesCities .=$childMRow['state_name'];
|
|
//$mergeMaxStatesCities .= ($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? "." : "");
|
|
}
|
|
$mergeMaxStatesCities.='.';
|
|
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
|
|
}
|
|
// area of sales with yes options
|
|
else if(strtoupper($busManuRow['area_of_sale'])=='WITHIN INDIA' && strtoupper($busManuRow['pan_india_options'])=='YES'){
|
|
// pan india
|
|
$getEachProducts['sales_done']='Pan India.';
|
|
// max sales done
|
|
$mergeMaxStatesCities='';
|
|
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
|
|
if(!empty($childMRow['state_name'])){
|
|
$mergeMaxStatesCities=$mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
|
|
foreach($childMRow['state_name'] as $chilMCityKey=>$childMCityRow){
|
|
$mergeMaxStatesCities = $mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
|
|
$mergeMaxStatesCities .=$childMCityRow;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
$mergeMaxStatesCities.='.';
|
|
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
|
|
}
|
|
// check area of sale export
|
|
else if(strtoupper($busManuRow['area_of_sale'])=='EXPORT'){
|
|
$mergeMaxStatesCities='';
|
|
// countries_where_export_done
|
|
foreach($busManuRow['countries_where_export_done'] as $chilKey=>$childRow){
|
|
$mergeStatesCities=$mergeStatesCities;
|
|
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['countries_where_export_done'])-1 ? ' and ' : ",");
|
|
|
|
$mergeStatesCities .=' '.$childRow['approx_sale'];
|
|
$mergeStatesCities .='% revenue from ';
|
|
$mergeStatesCities .=$childRow['country_name'];
|
|
//$mergeStatesCities .= ($chilKey==count($busManuRow['countries_where_export_done'])-1 ? "." : "");
|
|
}
|
|
$mergeStatesCities.='.';
|
|
$getEachProducts['sales_done']=$mergeStatesCities;
|
|
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
|
|
}
|
|
// check area of sale both
|
|
else if(strtoupper($busManuRow['area_of_sale'])=='BOTH'){
|
|
//print_r($busManuRow);die();
|
|
if(strtoupper($busManuRow['pan_india_options'])=='NO'){
|
|
// states
|
|
foreach($busManuRow['india_where_sale_done'] as $chilKey=>$childRow){
|
|
$mergeStatesCities=$mergeStatesCities;
|
|
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['india_where_sale_done'])-1 ? ' and ' : ",");
|
|
foreach($childRow['city_name'] as $chilCityKey=>$childCityRow){
|
|
$mergeStatesCities = $mergeStatesCities;
|
|
$mergeStatesCities .= ($chilCityKey==0) ? "":($chilCityKey==count($childRow['city_name'])-1 ? ' and ' : ",");
|
|
$mergeStatesCities .=$childCityRow;
|
|
}
|
|
$mergeStatesCities .=' of ';
|
|
$mergeStatesCities .=$childRow['state_name'];
|
|
$mergeStatesCities .= ($chilKey==count($busManuRow['india_where_sale_done'])-1 ? "." : "");
|
|
}
|
|
$getEachProducts['sales_done']=$mergeStatesCities;
|
|
// max sales done
|
|
$mergeMaxStatesCities='';
|
|
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
|
|
$mergeMaxStatesCities=$mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? ' and ' : ",");
|
|
foreach($childMRow['city_name'] as $chilMCityKey=>$childMCityRow){
|
|
$mergeMaxStatesCities = $mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['city_name'])-1 ? ' and ' : ",");
|
|
$mergeMaxStatesCities .=$childMCityRow;
|
|
}
|
|
//$mergeMaxStatesCities .=' of ';
|
|
//$mergeMaxStatesCities .=$childMRow['state_name'];
|
|
//$mergeMaxStatesCities .= ($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? "." : "");
|
|
}
|
|
$mergeMaxStatesCities.='.';
|
|
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
|
|
}
|
|
else if(strtoupper($busManuRow['pan_india_options'])=='YES'){
|
|
// pan india
|
|
$getEachProducts['sales_done']='Pan India.';
|
|
// max sales done
|
|
$mergeMaxStatesCities='';
|
|
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
|
|
if(!empty($childMRow['state_name'])){
|
|
$mergeMaxStatesCities=$mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
|
|
foreach($childMRow['state_name'] as $chilMCityKey=>$childMCityRow){
|
|
$mergeMaxStatesCities = $mergeMaxStatesCities;
|
|
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
|
|
$mergeMaxStatesCities .=$childMCityRow;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
$mergeMaxStatesCities.='.';
|
|
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
|
|
}
|
|
else{
|
|
$getEachProducts['sales_done']="";
|
|
$getEachProducts['max_sales_done']="";
|
|
}
|
|
// countries_where_export_done
|
|
if(array_key_exists('countries_where_export_done',$busManuRow)){
|
|
$mergeBothStates='';
|
|
foreach($busManuRow['countries_where_export_done'] as $chilKey=>$childRow){
|
|
$mergeBothStates=$mergeBothStates;
|
|
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['countries_where_export_done'])-1 ? ' and ' : ",");
|
|
|
|
$mergeBothStates .=' '.$childRow['approx_sale'];
|
|
$mergeBothStates .='% revenue from ';
|
|
$mergeBothStates .=$childRow['country_name'];
|
|
}
|
|
$mergeBothStates.='.';
|
|
$getEachProducts['both_sales_done']=$mergeBothStates;
|
|
}
|
|
|
|
}
|
|
array_push($getRow,$getEachProducts);
|
|
|
|
}
|
|
}
|
|
else if($type==5){
|
|
foreach($values as $busManuRowkey=>$busManuRow){
|
|
$getEachProducts=array();
|
|
$getEachProducts['products']=$busManuRow['others_details'];
|
|
array_push($getRow,$getEachProducts);
|
|
|
|
}
|
|
}
|
|
return $getRow;
|
|
}
|
|
|
|
// get business peak period details
|
|
public static function getBusinessPeakDetails($details){
|
|
$getRow='The Business has major changes,';
|
|
$getRow.= count($details) >1 ?' the periods of ' :' the period of ';
|
|
foreach($details as $key=>$value){
|
|
$getRow=$getRow;
|
|
$getRow .= ($key==0) ? "":($key==count($details)-1 ? ' and ' : ",");
|
|
switch($value) {
|
|
case 1:
|
|
$getRow .='February';
|
|
break;
|
|
case 2:
|
|
$getRow .='January';
|
|
break;
|
|
case 3:
|
|
$getRow .='March';
|
|
break;
|
|
case 4:
|
|
$getRow .='April';
|
|
break;
|
|
case 5:
|
|
$getRow .='May';
|
|
break;
|
|
case 6:
|
|
$getRow .='June';
|
|
break;
|
|
case 7:
|
|
$getRow .='July';
|
|
break;
|
|
case 8:
|
|
$getRow .='August';
|
|
break;
|
|
case 9:
|
|
$getRow .='September';
|
|
break;
|
|
case 10:
|
|
$getRow .='October';
|
|
break;
|
|
case 11:
|
|
$getRow .='November';
|
|
break;
|
|
case 12:
|
|
$getRow .='December';
|
|
break;
|
|
}
|
|
}
|
|
$getRow .=' maximum sales/services done.';
|
|
return $getRow;
|
|
}
|
|
}
|
|
?>
|