logthis("Inside Sales Order EditView",'debug');
$focus = new SalesOrder();
if(isset($_REQUEST['record']) && $_REQUEST['record'] != '')
{
if(isset($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'quotetoso')
{
$quoteid = $_REQUEST['record'];
$quote_focus = new Quote();
$quote_focus->id = $quoteid;
$quote_focus->retrieve_entity_info($quoteid,"Quotes");
$focus = getConvertQuoteToSoObject($focus,$quote_focus,$quoteid);
}
elseif(isset($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'update_quote_val')
{
//Updating the Selected Quote Value in Edit Mode
foreach($focus->column_fields as $fieldname => $val)
{
if(isset($_REQUEST[$fieldname]))
{
$value = $_REQUEST[$fieldname];
//echo '
';
//echo $fieldname." ".$value;
//echo '
';
$focus->column_fields[$fieldname] = $value;
}
}
//Handling for dateformat in due_date field
if($focus->column_fields['duedate'] != '')
{
$curr_due_date = $focus->column_fields['duedate'];
$focus->column_fields['duedate'] = getDBInsertDateValue($curr_due_date);
}
$quoteid = $focus->column_fields['quote_id'];
$quote_focus = new Quote();
$quote_focus->id = $quoteid;
$quote_focus->retrieve_entity_info($quoteid,"Quotes");
$focus = getConvertQuoteToSoObject($focus,$quote_focus,$quoteid);
$focus->id = $_REQUEST['record'];
$focus->mode = 'edit';
$focus->name=$focus->column_fields['subject'];
}
else
{
$focus->id = $_REQUEST['record'];
$focus->mode = 'edit';
$focus->retrieve_entity_info($_REQUEST['record'],"SalesOrder");
$focus->name=$focus->column_fields['subject'];
}
}
else
{
if(isset($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'update_quote_val')
{
//Updating the Select Quote Value in Create Mode
foreach($focus->column_fields as $fieldname => $val)
{
if(isset($_REQUEST[$fieldname]))
{
$value = $_REQUEST[$fieldname];
//echo '
';
//echo $fieldname." ".$value;
//echo '
';
$focus->column_fields[$fieldname] = $value;
}
}
//Handling for dateformat in due_date field
if($focus->column_fields['duedate'] != '')
{
$curr_due_date = $focus->column_fields['duedate'];
$focus->column_fields['duedate'] = getDBInsertDateValue($curr_due_date);
}
$quoteid = $focus->column_fields['quote_id'];
$quote_focus = new Quote();
$quote_focus->id = $quoteid;
$quote_focus->retrieve_entity_info($quoteid,"Quotes");
$focus = getConvertQuoteToSoObject($focus,$quote_focus,$quoteid);
}
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$num_of_products = getNoOfAssocProducts("SalesOrder",$focus);
$associated_prod = getAssociatedProducts("SalesOrder",$focus);
$focus->id = "";
$focus->mode = '';
}
if(isset($_REQUEST['potential_id']) && $_REQUEST['potential_id'] !='')
{
$focus->column_fields['potential_id'] = $_REQUEST['potential_id'];
$vtlog->logthis("Sales Order EditView: Potential Id from the request is ".$_REQUEST['potential_id'],'debug');
$num_of_products = getNoOfAssocProducts("Potentials",$focus,$focus->column_fields['potential_id']);
$associated_prod = getAssociatedProducts("Potentials",$focus,$focus->column_fields['potential_id']);
}
if(isset($_REQUEST['product_id']) && $_REQUEST['product_id'] !='')
{
$focus->column_fields['product_id'] = $_REQUEST['product_id'];
$num_of_products = getNoOfAssocProducts("Products",$focus,$focus->column_fields['product_id']);
$associated_prod = getAssociatedProducts("Products",$focus,$focus->column_fields['product_id']);
}
// Get Account address if account is given
if(isset($_REQUEST['account_id']) && $_REQUEST['record']=='' && $_REQUEST['account_id'] != ''){
require_once('modules/Accounts/Account.php');
$acct_focus = new Account();
$acct_focus->retrieve_entity_info($_REQUEST['account_id'],"Accounts");
$focus->column_fields['bill_city']=$acct_focus->column_fields['bill_city'];
$focus->column_fields['ship_city']=$acct_focus->column_fields['ship_city'];
$focus->column_fields['bill_street']=$acct_focus->column_fields['bill_street'];
$focus->column_fields['ship_street']=$acct_focus->column_fields['ship_street'];
$focus->column_fields['bill_state']=$acct_focus->column_fields['bill_state'];
$focus->column_fields['ship_state']=$acct_focus->column_fields['ship_state'];
$focus->column_fields['bill_code']=$acct_focus->column_fields['bill_code'];
$focus->column_fields['ship_code']=$acct_focus->column_fields['ship_code'];
$focus->column_fields['bill_country']=$acct_focus->column_fields['bill_country'];
$focus->column_fields['ship_country']=$acct_focus->column_fields['ship_country'];
}
//get Block 1 Information
$block_1_header = getBlockTableHeader("LBL_SO_INFORMATION");
$block_1 = getBlockInformation("SalesOrder",1,$focus->mode,$focus->column_fields);
//get Address Information
$block_2_header = getBlockTableHeader("LBL_ADDRESS_INFORMATION");
$block_2 = getBlockInformation("SalesOrder",2,$focus->mode,$focus->column_fields);
//get Description Information
$block_3_header = getBlockTableHeader("LBL_DESCRIPTION_INFORMATION");
$block_3 = getBlockInformation("SalesOrder",3,$focus->mode,$focus->column_fields);
$block_4_header = getBlockTableHeader("LBL_RELATED_PRODUCTS");
$block_6_header = getBlockTableHeader("LBL_TERMS_INFORMATION");
$block_6 = getBlockInformation("Quotes",6,$focus->mode,$focus->column_fields);
//get Custom Field Information
$block_5 = getBlockInformation("SalesOrder",5,$focus->mode,$focus->column_fields);
if(trim($block_5) != '')
{
$cust_fld = '
';
$block_5_header = getBlockTableHeader("LBL_CUSTOM_INFORMATION");
$cust_fld .= $block_5_header;
$cust_fld .= ' |