<?
	if(isset($_GET['assignee_company_add']) && !empty($_GET['assignee_company_add']) && $_GET['assignee_company_add'] == '1'){
		$assigneeid = $_GET['id'];
		$companyid = $_GET['companyid'];


		// NEW NO FOR ASSIGNEE COMPANY
		$newNum = getnewCtrlNo("assignee_company");

		// SET FMS DB
		$fms_db = new DBConfig;
		$fms_db->setFleetDB();

		// SAVE NEW USER MENU
		$ins_assigneecompany = new Table;
		$ins_assigneecompany->setSQLType($fms_db->getSQLType());
		$ins_assigneecompany->setInstance($fms_db->getInstance());
		$ins_assigneecompany->setTable("assigneemapper");
		$ins_assigneecompany->setField("id,companyID,assigneeID,type,createdBy,createdDate");
		$ins_assigneecompany->setValues("'$newNum','$companyid','$assigneeid','assignee_company','$sys_UserID','$today'");
		$ins_assigneecompany->doQuery("save");
		
		// CLOSING FMS DB
		$fms_db->DBClose();

		// UPDATE CONTROL NO
		UpdateCtrlNo("assignee_company");

		$url = BASE_URL . V_ASSIGNEECOMPANY . "?id=" . $assigneeid;
		$msg = "Company was successfully tagged to Assignee.";
		$purchaseDate = $_POST['txtPurchaseDate'];
		$conductionSticker = $_POST['txtConductionSticker'];
		$year = $_POST['txtYear'];
		$plateNo = $_POST['txtPlateNo'];
		$engineNo = $_POST['txtEngineNo'];
		$chassisNo = $_POST['txtChassisNo'];
		$serialNo = $_POST['txtSerialNo'];
		$acquisitionCost = str_replace(",","",$_POST['txtAcquisitionCost']);
		$insuranceCost = str_replace(",","",$_POST['txtInsuranceCost']);
		$registrationCost = str_replace(",","",$_POST['txtRegistrationCost']);
		$depresitionValue = str_replace(",","",$_POST['txtDepresitionValue']);
		$status = $_POST['txtStatus'];

		$dir = EQUIPMENTPICS . $id;
		// NEW NO FOR ASSIGNEE EQUIPMENT
		$newNum = getnewCtrlNo("assignee_equipment");

		// SET FMS DB
		$fms_db = new DBConfig;
		$fms_db->setFleetDB();

		// SET EQUIPMENT
		$equipment = new Table;
		$equipment->setSQLType($fms_db->getSQLType());
		$equipment->setInstance($fms_db->getInstance());
		$equipment->setTable("equipmentmaster");
		$equipment->setValues("$ePhoto assigneeID = '$assignee',companyID = '$company',categoryID = '$category',makeID = '$make'
						,locationID = '$location',modelID = '$model',color = '$color'
						,mileageStart = '$mileageStart',mileageEnd = '$mileageEnd'
						,gasolineAllocationInLiters = '$gasolineAllocationInLiters',gasolineAllocationInCash = '$gasolineAllocationInCash'
						,insuranceAppliedDate = '$insuranceAppliedDate',insuranceExpirationDate = '$insuranceExpirationDate'