We have implemented a spell code for calculating the hold time for a request . It is working fine for the status-awaiting end user and hold . But same isnt working for the status - awaiting vendor . The spell code is given below . Kindly help.
We have done some required changes foe awaiting vendor as given below in code2.
Code1(Before changes)
cr::zstatus_hold1(...)
{
int cur_time;
cur_time = now();
int hold1;
int total_time;
if (zuser.type.id == 2305)
{
// if the emoloyee finds the call in the Awaiting End User Response category, and finally provides an input.
if((status == "AEUR") && (!(is_null(zhold_start_date))))
{
send_wait( 0, this, "call_attr", "status", "set_val", "AEURU", "SURE_SET");
//hold1 = (int)cur_time - (int)zhold_start_date;
hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
if(is_null(zhold_time))
{
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
else
{
hold1 = (int)zhold_time + hold1;
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
return;
}
}
else
{
if((status == "WIP") && (!(is_null(zhold_start_date))))
{
// hold1 = (int)cur_time - (int)zhold_start_date;
hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
if(is_null(zhold_time))
{
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
else
{
hold1 = (int)zhold_time + hold1;
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
return;
}
}
//If the employee or analyst closes the call
if ((status == "CL"))
{
//if the call was on hold when the employee closes the call
if (!(is_null(zhold_start_date)))
{
//hold1 = (int)cur_time - (int)zhold_start_date;
hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
if(is_null(zhold_time))
{
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
else
{
hold1 = (int)zhold_time + hold1;
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
}
//total_time = (int)close_date - (int)open_date;
total_time = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)open_date,(date)close_date);
total_time = total_time - (int)zhold_time;
send_wait( 0, this, "call_attr", "ztotal_call_time", "set_val", total_time, "SURE_SET");
return;
}
//if the employee finds the call as Resolved but wants to restart the work flow
if(zis_held == 1)
{
send_wait( 0, this, "call_attr", "status", "set_val", "WIP", "SURE_SET");
//hold1 = (int)cur_time - (int)zhold_start_date;
hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
if(is_null(zhold_time))
{
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
else
{
hold1 = (int)zhold_time + hold1;
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
send_wait( 0, this, "call_attr", "zis_held", "set_val", 0, "SURE_SET");
return;
}
}
Code2(After changes as shown below in bold)
cr::zstatus_hold1(...)
{
int cur_time;
cur_time = now();
int hold1;
int total_time;
if (zuser.type.id == 2305)
{
// if the emoloyee finds the call in the Awaiting End User Response category, and finally provides an input.
if((status == "AEUR") && (!(is_null(zhold_start_date))))
{
send_wait( 0, this, "call_attr", "status", "set_val", "AEURU", "SURE_SET");
//hold1 = (int)cur_time - (int)zhold_start_date;
hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
if(is_null(zhold_time))
{
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
else
{
hold1 = (int)zhold_time + hold1;
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
return;
}
}
else
{
if((status == "WIP") && (!(is_null(zhold_start_date))))
{
// hold1 = (int)cur_time - (int)zhold_start_date;
hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
if(is_null(zhold_time))
{
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
else
{
hold1 = (int)zhold_time + hold1;
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
return;
}
}
if((status == "AWTVNDR") && (!(is_null(zhold_start_date))))
{
//hold1 = (int)cur_time - (int)zhold_start_date;
hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
if(is_null(zhold_time))
{
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
else
{
hold1 = (int)zhold_time + hold1;
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
return;
}
//If the employee or analyst closes the call
if ((status == "CL"))
{
//if the call was on hold when the employee closes the call
if (!(is_null(zhold_start_date)))
{
//hold1 = (int)cur_time - (int)zhold_start_date;
hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
if(is_null(zhold_time))
{
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
else
{
hold1 = (int)zhold_time + hold1;
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
}
//total_time = (int)close_date - (int)open_date;
total_time = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)open_date,(date)close_date);
total_time = total_time - (int)zhold_time;
send_wait( 0, this, "call_attr", "ztotal_call_time", "set_val", total_time, "SURE_SET");
return;
}
//if the employee finds the call as Resolved but wants to restart the work flow
if(zis_held == 1)
{
send_wait( 0, this, "call_attr", "status", "set_val", "WIP", "SURE_SET");
//hold1 = (int)cur_time - (int)zhold_start_date;
hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
if(is_null(zhold_time))
{
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
else
{
hold1 = (int)zhold_time + hold1;
send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
}
send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
send_wait( 0, this, "call_attr", "zis_held", "set_val", 0, "SURE_SET");
return;
}
}