<?PHP
/* Beginning of displaying customer */
//require_once $inc_dir.'workorder_function_general.inc.php';
echo('<form action="workorder.php" method="post" name="formNewTicket">');
if ( is_numeric($Ticket_ID) AND empty($View) == True AND $Update != 1 ) {
//Handle Business name
if ( $BBus_name ) {
$ShowCustomer .= '<small>Business Name:
</small><br><a href="workorder.php?Step=View&FormType=CustomerDetail&Customer_ID='.$Customer_ID.'&SSID='.$SSID.'">'.htmlentities($BBus_name).'</a><br>';
}
//Handle Business name contact
if ( $BBus_cont ) {
$ShowCustomer .= '<small>Business Contact: <br>
</small>'.$BBus_cont.'<br>';
}
//See What Needs to be Displayed
if ( $BName_last AND $BName_first ) {
$ShowCustomer .= '<small>Customer Name:
</small><br><a href="workorder.php?Step=View&FormType=CustomerDetail&Customer_ID='.$Customer_ID.'&SSID='.$SSID.'">'.htmlentities($BName_last).', '.htmlentities($BName_first).'</a><br>';
}
$Computer_string = "Make: $Item_make \nModel: $Item_model";
$ShowServiceType = GetServiceType($CONF, $Service_Type);
//$JobStatus = GetStatusAsString($CONF, $Status_id,"", "None", $Service_Type);
$JobStatus = GetStatusAsString2($inc_dir,$CONF, $Status_id);
$Address = $BStreet.$BAddress2."\n $BCity, $BState $BZip";
$GoogleSAddress = $CONF["GoogleAddress$Store_id"];
$BStreetTemp = urlencode($BStreet);
$GoogleSAddressTemp = urlencode($GoogleSAddress);
$GoogleDAddress = htmlentities(str_replace( " ", "+", $BStreetTemp )).",+".$BZip;
$GoogleSAddress = htmlentities(str_replace( " ", "+", $GoogleSAddressTemp ));
echo(' <table style="width: 100%; text-align: left;" border="0" cellpadding="2" cellspacing="2"><tbody>
<tr><td style="vertical-align: top;'); if ( $Print != "Ticket" ) { echo('background-color: rgb(51, 204, 255);'); }
echo('">');
if ( empty($Print) ) {
echo('<a href="workorder.php?Step=EditAddTicket&Ticket_ID='.$Ticket_ID.'&Customer_ID='.$Customer_ID.'&Print=TicketRepair&SSID='.$SSID.'">Print Ticket</a>
<a href="workorder.php?Step=EditAddTicket&Print=Ticket&Ticket_ID='.$Ticket_ID.'&Customer_ID='.$Customer_ID.'&SSID='.$SSID.'">Print Checkin Ticket</a>
<a href="workorder.php?Step=EditAddTicket&View=NewTicket&Ticket_ID='.$Ticket_ID.'&Customer_ID='.$Customer_ID.'&Update=1&SSID='.$SSID.'">Edit Description</a><br>'); }
echo('
<table style="text-align: left; width: 400px;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;"><small>');
if ( is_numeric($Ticket_ID) ) { echo('Ticket: <big>'.$Ticket_ID.'</big>'); } //Show Ticket ID
if( $CONF['EnableCustomTicketID'] == 1 && $CustomTicketID != "" ) {
echo('<br />Custom ID: '.htmlentities($CustomTicketID));
}//if( $CONF['EnableCustomTicketID'] == 1 && $CustomTicketIDChecked != "" )
echo('<br>Checked In:<br>'.$CheckedIn.'</small>');
if( $AppDate != "" ) { echo('<br>Appointment Date:<br><small>'.$AppDate.'</small>'); }
echo(' </td>
<td style="vertical-align: top;">'.$ShowCustomer.'</td>
</tr>
<tr>
<td style="vertical-align: top;"><small>Job Status:<br>
</small><font style="color: red; rgb(51, 255, 51);">'.$JobStatus.'</font><small><br>Service Type:</small><br>
'.$ShowServiceType.'
</td>
<td style="vertical-align: top;"><a href="http://'.$CONF['MappingService'].'/maps?daddr='.htmlentities($GoogleDAddress).'&saddr='.$GoogleSAddress.'" target="_blank">'.nl2br(htmlentities($Address)).'</a>
');
if ( strlen($BPhone1) > 1 ) { echo('<br>Phone: '.$BPhone1); }
if ( strlen($BPhone2) > 1 ) { echo('<br>Phone: '.$BPhone2); }
if ( strlen($BMobile1) > 1 ) { echo('<br>Mobile: '.$BMobile1); }
if ( strlen($BMobile2) > 1 ) { echo('<br>Mobile: '.$BMobile2); }
if ( strlen($BOffice1) > 1 ) { echo('<br>Office: '.$BOffice1); }
if ( strlen($BOffice2) > 1 ) { echo('<br>Office: '.$BOffice2); }
echo('
</td>
</tr>
<tr>
<td style="vertical-align: top;">'.nl2br(htmlentities($Computer_string)).'<br>
</td>
<td style="vertical-align: top;">Checked In By: '.$CheckedInBy.'<br />');
if( $assigned_tech != "" ) { echo('Assigned To: '.$assigned_tech.'<br />'); }
echo('in: ');
$GetThis = ("StoreName$TicketStore_id");
$ConfigArray = $CONF[$GetThis];
echo($ConfigArray.'</td>
</tr>
</tbody>
</table>
</td>
<td style="width: 320px; vertical-align: top;'); if ( $Print != "Ticket" ) { echo('background-color: rgb(51, 204, 255);'); }
echo('"><small><b>Service Description</b></small><br>'.nl2br(htmlentities($Service_Desc)));
if( strlen($Item_accessories) >= 1 ) { echo('
<div style="text-align: center;"><img alt="" src="./grfx/spacer.png" style="width: 200px; height: 2px;"></div>
<small><b>Additional Items Checked In</b></small><br>
'.nl2br(htmlentities($Item_accessories)).''); }
if( strlen($Item_required_parts) >= 1 ) { echo('
<div style="text-align: center;"><img alt="" src="./grfx/spacer.png" style="width: 200px; height: 2px;"></div>
<small><b>Items Required For Repair</b></small><br>
'.nl2br(htmlentities($Item_required_parts))); }
if( empty($GuestKey) == False && $CONF['EnableGuestKey'] == 1 ) {
echo('<small><br />Guest Key: '.htmlentities($GuestKey).'</small>');
} //if( empty($GuestKey) == False )
echo('
</td>
</tr>');
echo(' </tbody></table>');
} //is_numeric($Ticket_ID)
// echo($test);
if( $Print != "Ticket" ) {
echo(' <table style="width: 100%; text-align: left;" border="2" cellpadding="2" cellspacing="2"><tbody>
<input type="hidden" name="Store" value="'.$Store_id.'">
<input type="hidden" name="Ticket_ID" value="'.$Ticket_ID.'">
<input type="hidden" name="Customer_ID" value="'.$Customer_ID.'">
<input name="SSID" value="'.$SSID.'" type="hidden">');
}//if( $Print == "Ticket" )
if ( $View == "NewTicket" ) {
$BackStop = date('mjYHis').rand(0, 99999);
echo('
');
if ( is_numeric($Ticket_ID) ) {
$EditAllow = UpdateTicketDelay($Ticket_ID,$CONF); //Check if update is allowed, goes with UpdateTicketDelayMin
echo(' <tr>
<td style="vertical-align: top; width: 150px;">Ticket ID:<br></td>
<td style="vertical-align: top;">'.$Ticket_ID.'</td>
</tr>');
} // is_numeric($Ticket_ID) )
echo(' <tr>
<td style="vertical-align: top; width: 150px;">Name:<br></td>
<td style="vertical-align: top;">'.$BName.'</td>
</tr>
<tr>
<td style="vertical-align: top;">Street:</td>
<td style="vertical-align: top;">'.$BStreet.'</td>
</tr>
<tr>
<td style="vertical-align: top;">City:</td>
<td style="vertical-align: top;">'.$BCity.'</td>
</tr>
<tr>
<td style="vertical-align: top;">Phone<br></td>
<td style="vertical-align: top;">');
if ( strlen($BPhone1) > 1 ) { echo('<br>Phone: '.$BPhone1); }
if ( strlen($BPhone2) > 1 ) { echo('<br>Phone: '.$BPhone2); }
if ( strlen($BMobile1) > 1 ) { echo('<br>Mobile: '.$BMobile1); }
if ( strlen($BMobile2) > 1 ) { echo('<br>Mobile: '.$BMobile2); }
if ( strlen($BOffice1) > 1 ) { echo('<br>Office: '.$BOffice1); }
if ( strlen($BOffice2) > 1 ) { echo('<br>Office: '.$BOffice2); }
echo('
</tr>
<tr>
<td style="vertical-align: top;">Service Type:<br></td>
<td style="vertical-align: top;">'.ServiceTypeOptions($Service_Type, $CONF).'
</td>
</tr>');
//Don not Show Onsite Option if not Pro
if( file_exists("$inc_dir/pro/calendar.php") && $serv_cont != 1 ) { // Not Pro, Do Not Display Onsite Options
//Get the date for a ticket from the database, this is used if it's an edit
$sql = "select ".$CONF['TableNameTicket'].".ID,".$CONF['TableNameTicket'].".OnsiteScheduled,DATE_FORMAT(".$CONF['TableNameTicket'].".OnsiteScheduled, '%Y-%m-%d') AS FormatedDate,DATE_FORMAT(".$CONF['TableNameTicket'].".OnsiteScheduled, '%r') AS FormatedTime,DATE_FORMAT(".$CONF['TableNameTicket'].".OnsiteScheduled, '%T') AS FormatedTime24,".$CONF['TableNameTicket'].".Status_id,".$CONF['TableNameTicket'].".OnsiteTechID from ".$CONF['TableNameTicket']." where ".$CONF['TableNameTicket'].".ID = '$Ticket_ID'";
$res = mysql_query($sql, $conn);
$row = mysql_fetch_array($res);
if( isset($Date) == False ) { //If the date is not passed then this could be an edit, do another check for length
if( strlen($Date) < 5 ) { //String less then 4, no a usefull date
$Date = $row['FormatedDate']; //Try to get date from database
} //if( strlen($Date) < 5 )
} //if( isset($Date) == False )
$Time = $row['FormatedTime'];
$Time24 = $row['FormatedTime24'];
$OnsiteTechID = $row['OnsiteTechID'];
if( $Date == "0000-00-00" ) { $Date = Null; } //Do not display if no date is set
if( $Time != "" ) { //Ticket has a time, explode the return to make it compatibl with drop down boxes.
$aTime = explode(":", $Time); //Create Array from TimeFormat, DB returns format HH:MM:SS PM
$aTime2 = explode(" ", $aTime[2]); //Seperate seconds from am/pm
$aTime2[1] = strtolower($aTime2[1]); //make am/pm lower case
$aTime = array( '0' => $aTime[0],
'1' => $aTime[1],
'2' => $aTime2[1]); //This one if for display purpose
$aTime24 = explode(":" , $Time24); //The Database runs on 24 hour format, use this as variables
} //if( $Time != "" )
echo(' <tr>
<td style="vertical-align: top;">Onsite Appointment:
</td>
<td style="vertical-align: top;">Date: ');
//Show Date Selector
echo('
<input type="Text" name="Date" value="'.$Date.'" size="15">
<a href="#" onclick="cal.select(document.forms[\'formNewTicket\'].Date,\'anchor1\',\'yyyy-MM-dd\'); return false;" name="anchor1" id="anchor1"> Select or Change Date</a>');
//End Date Selector
echo('
<input type="hidden" value="'.$SSID.'" name="SSID"><br>
Tech: <select name="User_ID">');
if( isset($OnsiteTechID) == True ) {
//List tech currently assigned to the onsite ticket
$sql = "select User_ID,User_name from ".$CONF['TableNameUsers']." WHERE User_ID='$OnsiteTechID'";
$res = mysql_query($sql,$conn) or die("</select>unable to list Onsite Techs Error 4d53g45z<br>$sql");
$row = mysql_fetch_array($res);
$User_ID = $row['User_ID'];
$User_name = $row['User_name'];
echo('<option value="'.$User_ID.'">'.$User_name.'</option>'); //Display assigned tech before the others
} //if( isset($OnsiteTechID) == True )
//List all techs
$sql = "select User_ID,User_name from ".$CONF['TableNameUsers']." WHERE User_active=1 AND User_system=0";
$res = mysql_query($sql,$conn) or die("</select>unable to list Onsite Techs Error 4d53g45z<br>$sql");
while( $row = mysql_fetch_array($res) ) {
$User_ID = $row['User_ID'];
$User_name = $row['User_name'];
echo('<option value="'.$User_ID.'">'.$User_name.'</option>');
}
echo("</select>");
//Tech Listed
echo('
Hour: <select name="OnsiteHour">');
//Check if the ticket has a time set, this will be true for insite tickets
if( $Time != "" ) {
echo('<option value="'.$aTime24[0].'">'.$aTime[0].$aTime[2].'</option>');
} //if( $Time != "" )
//Show time for Onsite Schedule
for( $x=0 ; $x < 12 ; $x++ ) {
if( $x == 0 ) {
echo('<option value="00">12am</option>'); }
if( $x < 10 && $x != 0 ) {
echo('<option value="0'.$x.'">0'.$x.'am</option>'); }
elseif( $x > 9 ) {
echo('<option value="'.$x.'">'.$x.'am</option>'); }
}
for( $x=13 ; $x < 24 ; $x++ ) {
if( $x == 13 ) {
echo('<option value="12">12pm</option><br>'); }
//echo('<option value="'.$x.'">'.($x-12).'pm</option>');
if( $x < 21 && $x != 0 ) {
echo('<option value="0'.$x.'">0'.($x-12).'pm</option>'); }
elseif( $x > 21 ) {
echo('<option value="'.$x.'">'.($x-12).'pm</option>'); }
}
echo('</select>
Minute: <select name="OnsiteMinute">');
//Check if the ticket has a time set, this will be true for insite tickets
if( $Time != "" ) {
echo('<option value="'.$aTime24[1].'">'.$aTime[1].'</option>');
} //if( $Time != "" )
for( $x=0 ; $x <= 59 ; $x = $x + 5 ) {
if( $x < 10 ) {
echo('<option value="'.$x.'">0'.$x.'</option>'); }
elseif( $x > 9 ) {
echo('<option value="'.$x.'">'.$x.'</option>'); }
}
//Close Table Cell
echo('</select>
</td>
</tr>
<tr>');
}//if( file_exists("$inc_dir/pro/calendar.php") ) - Pro Check
if( file_exists("$inc_dir/pro/calendar.php") ) { // Not Pro, Do Not Display E-Mail tech options
if( $CONF['EnableCheckinEmail'] == 1 ) { //Check if the feature is enabled in the config table
echo(' <tr>
<td style="vertical-align: top;">E-Mail Technician:
</td>
<td style="vertical-align: top;">');
//Get all Tech assigned to current branch with email addresses
if( isset($User_display) == False ) { $User_display = Null; }
$sql = "Select * from ".$CONF['TableNameUsers']." WHERE User_email != '' AND User_shop='$Store_id'";
$res = mysql_query($sql, $conn);
$row_cnt = mysql_num_rows($res); //Get Rows found
for( $x = 0 ; $x < $row_cnt ; $x++ ) { //List all Users with email found in database
$row = mysql_fetch_array($res);
$Tech_name = $row['User_name'];
$User_skills = $row['User_skills'];
$User_email = $row['User_email'];
//Decide what to display. Either skills or if skills are empty use email address
if( strlen($User_skills) < 2 ) { $User_skills = $User_email; } //Use email since string from db is less then two characters. 2 has no meaning, could be 3 for all I care.
else { //Use User Display for this since it is set but chop it to x characters
$l = 40; //Defines String Length
if( strlen($User_skills) > $l ) { //String is too long to display here and needs trimming
$User_skills = substr($User_skills, 0, $l)."...."; //Get Character 0 til limit to preserve page layout.
} //if( strlen($User_skills) > $l )
} // else
if( isset($Tech_name) == True ) { $Tech_name .= " -> "; } //Add separator
else { $Tech_name = Null; }
$User_display .= '<input name="email_user'.$x.'" value="'.$User_email.'" type="checkbox" id="email_user'.$x.'">'.$Tech_name.$User_skills.'<br />';
} //for( $x = 0 ; $x < $row_cnt ; $x++ )
$User_display_cnt = $x; //Knows how many Users have been displayed, pass to next page
$User_display .= '<input type="hidden" name="User_display_cnt" value="'.$User_display_cnt.'">'; //Add User Count information last, pass it to next step
//<input name="User_activeTXT" '.$CheckedActiveUser.' type="checkbox">
echo($User_display); //Show Users
echo(' </td>
</tr>
<tr>');
} //if( $CONF['EnableCheckinEmail'] == 1 )
} //if( file_exists("$inc_dir/pro/calendar.php") ) - E-Mail Pro Check
if( $serv_cont != 1 ) {
echo('<td style="vertical-align: top;"><b>Make</b><br><small><small>Required if Instore</small></small></small></td>
<td style="vertical-align: top;"><input');
if($EditAllow == "NO") { echo(' disabled="disabled" '); }
echo(' tabindex="1" value="'. htmlentities($Item_make) .'"
name="Item_make" size="'. $fieldsize .'"></td>
</tr>
<tr>
<td style="vertical-align: top;">Model</td>
<td style="vertical-align: top;"><input');
if($EditAllow == "NO") { echo(' disabled="disabled" '); }
echo(' tabindex="2" value="'. htmlentities($Item_model) .'"
name="Item_model" size="'. $fieldsize .'"></td>
</tr>');
} //if( $serv_cont != 1 )
echo(' <tr>
<td style="vertical-align: top;"><b>Checked In By:</b><br><small><small>Required</small></small></small></td>
<td style="vertical-align: top;">');
//$sql = "select User_ID,User_name from ".$CONF['TableNameUsers']." where User_active=1 AND User_system=1";
echo('<select name="CheckedInBy"');
if($EditAllow == "NO") { echo(' disabled="disabled" '); }
echo('>');
if( $Update == 1 ) { //If this is an update, show user stored in the database first.
//This is an update, display checked in tech
$sql = 'SELECT `CheckedInBy` FROM '.$CONF['TableNameTicket'].' WHERE `ID` = "'.$Ticket_ID.'" ';
$res = mysql_query($sql,$conn) or die("</select>Unable to get `assigned_tech_id` Error: 43435j5<br>$sql");
$row = mysql_fetch_array($res);
//Now get the technician name to display at first position
$sql = 'SELECT User_ID,User_name FROM '.$CONF['TableNameUsers'].' WHERE `User_ID` = "'.$row['CheckedInBy'].'" ';
$res = mysql_query($sql,$conn) or die("</select>Unable to get User info Error: 43403j5<br>$sql");
$row = mysql_fetch_array($res);
echo('<option value="'.$row['User_ID'].'">'.$row['User_name'].'</option>');
} //if( $Update != 1 )
if( $SSID != "" ) { //Pro Edition
$sql = "select User_ID,User_name from ".$CONF['TableNameUsers'].",".$CONF['TableNameUsersLogin']." WHERE ".$CONF['TableNameUsers'].".User_ID = ".$CONF['TableNameUsersLogin'].".Login_USER_ID AND ".$CONF['TableNameUsersLogin'].".Login_ssid='$SSID'";
$res = mysql_query($sql,$conn) or die("</select>Unable to get Authenticated User Error: 43535<br>$sql");
$row = mysql_fetch_array($res);
echo('<option value="'.$row['User_ID'].'">'.$row['User_name'].'</option>');
}
//Free Edition
$exclude_tech = GetTechID( $inc_dir,$CONF, $SSID );
$sql = "select User_ID,User_name from ".$CONF['TableNameUsers']." WHERE User_active=1 AND User_system=0 AND User_shop='$Store_id' AND ".$CONF['TableNameUsers'].".User_ID != '$exclude_tech'";
$res = mysql_query($sql,$conn) or die("</select>Unable to get UserNames Error: 43537<br>$sql");
while($row = mysql_fetch_array($res)) {
echo('<option value="'.$row['User_ID'].'">'.$row['User_name'].'</option>');
}
echo('</select>');
echo('</td>
</tr>');
if( $serv_cont != 1 && file_exists("$inc_dir/pro/calendar.php") ) {
//Create List which contrains the possible techs to assign a ticket to.
echo(' <tr>
<td style="vertical-align: top;">Assign to Tech:<br></td>
<td style="vertical-align: top;">');
//$sql = "select User_ID,User_name from ".$CONF['TableNameUsers']." where User_active=1 AND User_system=1";
echo('<select name="assigned_tech_id"');
if($EditAllow == "NO") { echo(' disabled="disabled" '); }
echo('>');
if( $Update != 1 ) {
echo('<option value=""></option>'); //First on is empty to not force a selection when this is a new ticket
} else {
//This is an update, display assigned tech instead of an empty field
$sql = 'SELECT `assigned_tech_id` FROM '.$CONF['TableNameTicket'].' WHERE `ID` = "'.$Ticket_ID.'" ';
$res = mysql_query($sql,$conn) or die("</select>Unable to get `assigned_tech_id` Error: 43435j5<br>$sql");
$row = mysql_fetch_array($res);
$assigned_tech_id = $row['assigned_tech_id'];
//Now get the technician name to display at first position
$sql = 'SELECT User_ID,User_name FROM '.$CONF['TableNameUsers'].' WHERE `User_ID` = "'.$assigned_tech_id.'" ';
$res = mysql_query($sql,$conn) or die("</select>Unable to get User info Error: 43403j5<br>$sql");
$row = mysql_fetch_array($res);
echo('<option value="'.$row['User_ID'].'">'.$row['User_name'].'</option>');
echo('<option value=""></option>');
} //if( $Update != 1 )
if( $SSID != "" ) { //Pro Edition
$exclude_tech = GetTechID( $inc_dir,$CONF, $SSID );
$sql = "select User_ID,User_name from ".$CONF['TableNameUsers'].",".$CONF['TableNameUsersLogin']." WHERE ".$CONF['TableNameUsers'].".User_ID = ".$CONF['TableNameUsersLogin'].".Login_USER_ID AND ".$CONF['TableNameUsersLogin'].".Login_ssid='$SSID'";
$res = mysql_query($sql,$conn) or die("</select>Unable to get Authenticated User Error: 43535<br>$sql");
$row = mysql_fetch_array($res);
echo('<option value="'.$row['User_ID'].'">'.$row['User_name'].'</option>');
$sql = "select User_ID,User_name from ".$CONF['TableNameUsers']." WHERE `User_active`='1' AND `User_system` = '0' AND ".$CONF['TableNameUsers'].".User_ID != '$exclude_tech'";
$res = mysql_query($sql,$conn) or die("</select>Unable to get Authenticated User Error: 435367<br>$sql");
while( $row = mysql_fetch_array($res) ) {
echo('<option value="'.$row['User_ID'].'">'.$row['User_name'].'</option>');
}
}
echo('</select>');
echo('</td>
</tr>');
} //if( $serv_cont != 1 && file_exists("$inc_dir/pro/calendar.php") )
echo('<tr>
<td style="vertical-align: top;"><b>Branch:</b><br><small><small>Required</small></small></small></td>
<td style="vertical-align: top;"><select');
if($EditAllow == "NO") { echo(' disabled="disabled" '); }
echo(' name="Branch">');
//$sql = "select User_ID,User_name from ".$CONF['TableNameUsers']." where User_active=1 AND User_system=1";
$sql = "select config_name,config_value from $TableConfig WHERE config_name LIKE \"StoreName%\"";
$res = mysql_query($sql,$conn) or die("Unable to get UserNames Error: 435f35<br>$sql");
$x=0;
while($row = mysql_fetch_array($res)) {
echo('<option ');
//Check if this one should be selected. It goes by user configuration and write it into the option statement
$TestString = "StoreName".$aUserSettings[1];
if( $row['config_name'] == $TestString ) {
echo(" selected ");
}
//Continue with the option statement
//Change ID: 234jkhdsfg disabled below to fix problem when posting new ticket and changeing the branch from the users default branch. When posted the User's
//echo(' name="'.$row['config_name'].'">'.$row['config_value'].'</option>');
echo(' value="'.$x.'">'.$row['config_value'].'</option>');
$x++;
}
echo('</select></td>
</tr>
<tr>
<td style="vertical-align: top;"><b>Trouble Reported</b><br><small><small>Required</small></small></small></td>
<td style="vertical-align: top;">');
if($EditAllow == "NO") {
echo(ServiceAsTable("204, 255, 255","Service Performed",$UpService_Desc));
echo('<input name="AppendTo" value="TRUE" type="hidden">');
$UpService_Desc = ""; } //Only append when the time is over
echo('<textarea tabindex="4" rows="10" name="Service_Desc">'. $UpService_Desc .'</textarea></td>
</tr>');
} //$View == "New Ticket"
if ( $Print == "Ticket" ) {
echo('<hr>');
$ConfigArray = $CONF["Rate-Instore"];
echo($ConfigArray);
echo('<br>');
$ConfigArray = $CONF["Rate-Onsite"];
echo($ConfigArray);
$CompanyName = $CONF["Company Name"];
$DISCLAIMER = str_replace( "COMPANYNAME", "$CompanyName", $CONF["Disclaimer-Checkin"] );
if ( strlen($BPhone1) > 1 ) { $TBPhone1 = 'P:'.$BPhone1; }
if ( strlen($BPhone2) > 1 ) { $TBPhone2 = 'P2:'.$BPhone2; }
if ( strlen($BMobile1) > 1 ) { $TBMobile1 = 'M:'.$BMobile1; }
if ( strlen($BMobile2) > 1 ) { $TBMobile2 = 'M2:'.$BMobile2; }
if ( strlen($BOffice1) > 1 ) { $TBOffice1 = 'O:'.$BOffice1; }
if ( strlen($BOffice2) > 1 ) { $TBOffice2 = 'O2:'.$BOffice2; }
echo($DISCLAIMER);
//Display Store Tag on Tickets
$TicketAmmount = $CONF['TicketStubAmmount']; //Set ammount of Tickets to print at the bottom of the printout page
if( $TicketAmmount > 0 ) { //Check if Ticket Stubs are enabled
//Define Variables the User can use when customizing Ticket Stubs
$TSCompanyName = htmlspecialchars($CONF["Company Name"]);
$TSCompanyAddress = htmlspecialchars($CONF["Company Address".$Store_id]);
echo('<table style="width: 100%; background-color: white;text-align: center;" border="1" cellpadding="0" cellspacing="1"><tbody><tr>');
for( $xta = 0 ; $xta < $TicketAmmount ; $xta++ ) {
echo('<td style="vertical-align: top;">');
//echo('<b>'.$CONF["Company Name"].'</b><br>');
eval( $CONF['TicketStub1'] );
$CompAddress = stripslashes(eval($CONF['TicketStub2']));
$CompAddress = trim($CompAddress, "\n\t\r");
$CompAddress = str_replace( "\n", '<br />', $CompAddress);
echo($CompAddress.'</td>');
} //for( $xta = 0 ; $xta < $TicketAmmount ; $xta++ )
echo('</tr><tr>');
for( $xta = 0 ; $xta < $TicketAmmount ; $xta++ ) {
echo('<td style="vertical-align: top;">');
eval( $CONF['TicketStub3'] );
eval( $CONF['TicketStub4'] );
echo(' </td>');
} //for( $xta = 0 ; $xta < $TicketAmmount ; $xta++ )
echo('</tr><tbody></table>');
} //if( $TicketAmmount > 0 )
}
if ( empty($Print) && $Update != 1 && $Step == "EditAddTicket" && $View != "NewTicket") {
//Display Image Options
//Get Image information from Database, displayed below.
$TableTicketImages = $CONF['TableNameTicketImages']; //Table Name that holds image information
$sql = "SELECT * FROM $TableTicketImages WHERE TicketID = \"$Ticket_ID\" ORDER BY ID ASC";
$res = mysql_query($sql, $conn) or die("Unable to select Images from $TableTicketImages Error:4f3s5");
$row_cnt = mysql_num_rows($res); //Get Rows found
echo('<tr>
<td style="vertical-align: top;">
<SCRIPT TYPE="text/javascript" language="JavaScript1.2">
function uploadimage()
{
window.open("include/upload_img_ui.php?TicketID='.$Ticket_ID.'&SSID='.$SSID.'",
"mywindow","location=0,status=0,scrollbars=1,width=500,height=150");
}
</SCRIPT>
<SCRIPT TYPE="text/javascript" language="JavaScript1.2">
function deleteimages()
{
window.open("include/upload_img_ui_del.php?TicketID='.$Ticket_ID.'&SSID='.$SSID.'",
"mywindow","location=0,status=0,scrollbars=1,width=500,height=400");
}
</SCRIPT>
<a href="javascript: uploadimage()">Upload Image</a>
<a href="javascript: deleteimages()">Edit Images</a>
<a href="JavaScript:window.location.reload()">Refresh Images</a><br />');
if ( $row_cnt != 0 ) { //Display Images in Database if there are any, if not skip
echo('Ticket Images: <br />');
//Display Images in Database as Image Name Link
echo('<table style="width: 100%; text-align: left;" border="0" cellpadding="0" cellspacing="0"><tr>');
for( $x = 0 ; $row = mysql_fetch_array($res) ; $x++ ) {
$SubDir = $row['SubDir'];
$FileName = $row['FileName'];
$FileDesc = $row['FileDesc'];
$Path = $CONF['UploadTargetPath'];
echo("<td>");
//The Script Display is a bit ugle, need to learn how to pass values to a javascript
echo(' <SCRIPT TYPE="text/javascript" language="JavaScript1.2">
function showimage'.$x.'()
{
window.open("'.$Path.'/'.$SubDir.'/'.$FileName.'",
"mywindow","location=0,status=0,scrollbars=1,width=500,height=375");
}
</SCRIPT>');
if( empty($FileDesc) == True ) { $FileDesc = "$FileName"; }
echo('<a href="javascript: showimage'.$x.'()">'.$FileDesc.'</a><br /></td>');
if ( ($x + 1) % 2 == 0 ) { //Display 2 then line break, +1 to handle the first one which is 0
echo("</td></tr>");
} //if ( ($x + 1) % 2 == 0 )
} //while( $row = mysql_fetch_array($res) )
if ( $row_cnt == 0 ) { //if this is odd the second table piece if not complete - fix it, +1 to handle the first one which is 0
echo("<td><br /></td></tr>");
} //if ( $row_cnt == 0 )
echo('</table>'); //Close Table
} //if ( $row_cnt != 0 ) - Skips the whole block if there are not Images in the DB
} //if ( empty($Print) AND $Update != 1 )
if( is_numeric($Ticket_ID) AND $Print != "Ticket" AND $Update != 1 ) {
echo('<tr><td>');
//Display Tech field
echo(ServiceAsTable("204, 255, 255","Service Performed",$Service_Performed));
if( empty($Print) && file_exists("$inc_dir/pro/calendar.php") == True && $IsCustomerLogin != 1 ) {
echo(ServiceAsTable("255,255,224","Internal Tech Notes",$Tech_Notes)); } //Don't show internal notes when printing or if is not PRO
echo('</td></tr>');
if ( empty($Print) AND $Update != 1 ) {
echo('
<tr>
<td style="vertical-align: top;">
Service Performed:
<textarea rows="15" tabindex="1" name="Service_Performed" style="color: black; background-color: rgb(204,255,255)"></textarea>');
if( file_exists("$inc_dir/pro/calendar.php") == True && $IsCustomerLogin != 1 ) {
echo(' <br />Internal Tech Notes:
<textarea rows="5" tabindex="2" name="Tech_Notes" style="color: red; background-color: lightyellow"></textarea>');
} //if( file_exists("$inc_dir/pro/calendar.php") == True )
echo('<br />');
if( file_exists("$inc_dir/pro/calendar.php") == True ) {
require $inc_dir.'/pro/tech_time.php';
}
require $inc_dir.'/tech_select_status.php';
echo('</td>');
}
}
if ( empty($Ticket_ID) OR $Update == 1 ) {
if( $serv_cont != 1 ) {
echo(' <tr>
<td style="vertical-align: top;">Parts required<br>');
echo('</td>
<td style="vertical-align: top;">');
if($EditAllow == "NO") {
echo(ServiceAsTable("204, 255, 255","Service Performed",$Item_required_parts));
$Item_required_parts = ""; } //Only append when the time is over
echo('<textarea rows="3" tabindex="5" name="Item_required_parts">'.$Item_required_parts.'</textarea></td>
</tr>
<tr>
<td style="vertical-align: top;">Additional Items</td>
<td style="vertical-align: top;">');
if($EditAllow == "NO") {
echo(ServiceAsTable("204, 255, 255","Service Performed",$Item_accessories));
$Item_accessories = ""; } //Only append when the time is over
echo('<textarea rows="3"
tabindex="6" name="Item_accessories">'.$Item_accessories.'</textarea></td>
</tr>');
} //if( $serv_cont != 1 )
if( file_exists("$inc_dir/pro/calendar.php") == True ) { //Pro Only Option
if( ($CONF['EnableGuestKey'] == 1 || $CONF['EnableCustomTicketID'] == 1) && $serv_cont != 1 ) { //Check if It's enabled
echo('<tr>
<td style="vertical-align: top;">Additional Options</td>
<td style="vertical-align: top;">');
if( isset($TicketGuestKey) == False ) { $TicketGuestKey = Null; } //Set it if it's not created above
if( $CONF['EnableGuestKey'] == 1 && $TicketGuestKey == "" ) {
echo('Generate Guest Key <input name="chkGuestKey" value="1" type="checkbox"><br />');
}//if( $CONF['EnableGuestKey'] == 1 )
if( $CONF['EnableCustomTicketID'] == 1 ) {
if( isset($CustomTicketID) == False ) { $CustomTicketID = Null; }
echo('Custom Ticket ID <input type="text" name="Custom_ticket_id" id="Custom_ticket_id" value="'.htmlentities($CustomTicketID).'" size="25" maxlength="200"><br />');
}//if( $CONF['EnableGuestKey'] == 1 )
echo('</td></tr>');
} //if( $CONF['EnableGuestKey'] == 1 )
} //if( file_exists("$inc_dir/pro/calendar.php") )
echo('
<tr>');
if ( empty($Ticket_ID) AND $Update != 1 ) {
echo('<td style="vertical-align: top;"><input value="Insert New Ticket" name="Step" type="submit" tabindex="7"></td>
<td style="vertical-align: top;"><input value="Clear" name="clear" type="reset" tabindex="8"></td></tr>'); }
elseif( isset($Ticket_ID) AND $Update == 1 ) {
echo('<td style="vertical-align: top;"><input value="Update Ticket" name="Step" type="submit" tabindex="7"></td>
<td style="vertical-align: top;"><input value="Clear" name="clear" type="reset" tabindex="8"></td></tr>'); }
}
echo(' </tbody>
</table>
<input name="BackStop" value="'.$BackStop.'" type="hidden">
</form>');
?>