Freelance Current Reports
query($Query);
$p_new=0;
while ($row = mysql_fetch_array($name2123)) {
$freelance_emp_id=$row["id"];
$freelance_emp_name=$row["name"];
$freelance_emp_email=$row["email_id"];
date_default_timezone_set('Asia/Kolkata');
$date = date('Y-m-d H:i:s ', time());
$d = date ( $date, strtotime ( '-2 days' ) );
$Query="select sum(amount) as new from tbl_withdraw where freelance_id='".$freelance_emp_id."' ";
$name2123_1=$DB->query($Query);
$row_order_1=mysql_fetch_array($name2123_1);
$p_new=$row_order_1['new'];
$p_new;
$sql_order_1_man="select job_est_time,id,date(emp_view_date) as n from tbl_job_details where job_status='3' and free_emp_id='$freelance_emp_id' and cancel_sta='0' ORDER BY emp_view_date asc ";
$name2123_2=$DB->query($sql_order_1_man);
$row_order_1_man=mysql_fetch_array($name2123_2);
$pa_ne_dat_start=$row_order_1_man['n'];
date_default_timezone_set('Asia/Kolkata');
$now = time(); // or your date as well
$your_date = strtotime($pa_ne_dat_start);
$datediff = $now - $your_date;
$v_s= floor($datediff/(60*60*24));
$jk=15;
$mas=($v_s/15);
$wholeval=intval($mas);
if($wholeval>0)
{
for($ki=1;$ki<= $wholeval;$ki++)
{
$jk;
$date_v_f_end = date('Y-m-d', strtotime($pa_ne_dat_start . ' +'. $jk.' days'));
$jk=($jk+15);
}
}
$date_v_f_end;
$date_v_f_end_v = date('Y-m-d', strtotime($pa_ne_dat_start . ' +'. $jk.' days'));
$sql_order_1="select job_est_time,id,emp_view_date from tbl_job_details where job_status='3' and free_emp_id='$freelance_emp_id' and cancel_sta='0' ORDER BY emp_view_date asc ";
$name2123_3=$DB->query($sql_order_1);
$totprice=0;
$newprice=0;
$ik=1;
while($row_order_1=mysql_fetch_array($name2123_3))
{
$emp_view_date_f=$row_order_1['emp_view_date'];
$job_est_time=$row_order_1['job_est_time'];
$new_job_id=$row_order_1['id'];
$est_name=($job_est_time.':00');
$str_time = "$est_name";
$str_time = preg_replace("/^([\d]{1,2})\:([\d]{2})$/", "00:$1:$2", $str_time);
sscanf($str_time, "%d:%d:%d", $hours, $minutes, $seconds);
$time_seconds1 = $hours * 3600 + $minutes * 60 + $seconds;
$time_seconds=($time_seconds1+3600);
$hours_123 = floor(($time_seconds ) / 3600);
$minutes_123 = floor(($time_seconds - ($hours_123 * 3600))/60);
$seconds_123 = floor(($time_seconds - ($hours_123 * 3600) - ($minutes_123*60)));
//$totprice=($time_seconds1/60)*2;
/*if($emp_view_date_f>'2018-05-02 00:00:00')
{
$totprice=($time_seconds1/60)*2.5;
}
else
{
$totprice=($time_seconds1/60)*2;
}*/
if($emp_view_date_f>'2021-04-22 00:00:00')
{
$totprice=($time_seconds1/60)*2;
}
else
{
if($emp_view_date_f>'2018-05-02 00:00:00')
{
$totprice=($time_seconds1/60)*2.5;
}
else
{
$totprice=($time_seconds1/60)*2;
}
}
$newprice +=$totprice;
if($newprice>$p_new)
{
$new_job_id;
$new_job_id=$row_order_1['id'];
$seconds321123=0;
$new_s_v=0;
$time2_2=0;
$time1_1=0;
$seconds321_s=0;
$Que_man ="SELECT supervisor_date,create_date,supervisor_desdcription,employee_description,status,job_colour,reassigning,id from tbl_employee_changes where emp_id='$freelance_emp_id' and job_id='$new_job_id' ";
$name2123_4=$DB->query($Que_man);
while($row12 = mysql_fetch_array($name2123_4))
{
$num_row_new_view = mysql_num_rows($name2123_4);
$create_date=$row12["create_date"];
$supervisor_date=$row12["supervisor_date"];
$newid= $row12['id'];
$time1_1 = strtotime("$supervisor_date");
$time2_2 = strtotime("$create_date");
$seconds321_s =(($time2_2-$time1_1));
$seconds321 +=$seconds321_s;
}
if($seconds321>0)
{
$seconds321123 +=$seconds321;
}
}
?>
}
/* $sql_order_1_1=mysql_query("select job_est_time,id,emp_view_date from tbl_job_details where freelance_id='1' and job_status='3' and free_emp_id='$freelance_emp_id' and cancel_sta='0' and DATE(emp_view_date) <= (NOW() - INTERVAL 15 DAY) ");*/
if($wholeval>0)
{
$newprice;
"select job_est_time,id,emp_view_date from tbl_job_details where freelance_id='1' and job_status='3' and free_emp_id='$freelance_emp_id' and cancel_sta='0' and DATE(emp_view_date) >='$pa_ne_dat_start' and DATE(emp_view_date) <= '$date_v_f_end' ";
$sql_order_1_1="select job_est_time,id,emp_view_date from tbl_job_details where job_status='3' and free_emp_id='$freelance_emp_id' and cancel_sta='0' and DATE(emp_view_date) >='$pa_ne_dat_start' and DATE(emp_view_date) < '$date_v_f_end' ORDER BY emp_view_date asc ";
$name2123_5=$DB->query($sql_order_1_1);
$totprice_1=0;
$newprice_1=0;
while($row_order_1_1=mysql_fetch_array($name2123_5))
{
$job_est_time_1=$row_order_1_1['job_est_time'];
$emp_view_date_f_1=$row_order_1_1['emp_view_date'];
$est_name_1=($job_est_time_1.':00');
$str_time_1 = "$est_name_1";
$str_time_1 = preg_replace("/^([\d]{1,2})\:([\d]{2})$/", "00:$1:$2", $str_time_1);
sscanf($str_time_1, "%d:%d:%d", $hours, $minutes, $seconds);
$time_seconds1_1 = $hours * 3600 + $minutes * 60 + $seconds;
$time_seconds=($time_seconds1_1+3600);
$hours_123 = floor(($time_seconds ) / 3600);
$minutes_123 = floor(($time_seconds - ($hours_123 * 3600))/60);
$seconds_123 = floor(($time_seconds - ($hours_123 * 3600) - ($minutes_123*60)));
/* if($emp_view_date_f_1>'2018-05-02 00:00:00')
{
$totprice_1=($time_seconds1_1/60)*2.5;
}
else
{
$totprice_1=($time_seconds1_1/60)*2;
}
*/
if($emp_view_date_f_1>'2021-04-22 00:00:00')
{
$totprice_1=($time_seconds1_1/60)*2;
}
else
{
if($emp_view_date_f_1>'2018-05-02 00:00:00')
{
$totprice_1=($time_seconds1_1/60)*2.5;
}
else
{
$totprice_1=($time_seconds1_1/60)*2;
}
}
?>
$newprice_1 +=$totprice_1;
?>
}
$newprice_1=($newprice_1-$p_new);
}
else
{
$newprice_1=0;
}
$newprice=($newprice-$p_new);
$newprice_1;
if($newprice_1>0)
{
$Query_bank_n = "SELECT min(id) as n_i from tbl_bankaccount where user_id='".$freelance_emp_id."' ";
$name2123_10=$DB->query($Query_bank_n);
$row_bank_n = mysql_fetch_array($name2123_10);
$tot_bank_n=mysql_num_rows($name2123_10);
$bank_account=$row_bank_n['n_i'];
if($bank_account!='')
{
$Query_bank = "SELECT id,account_no,account_name,bank_name,ifsc_code,branch_name,user_id,status from tbl_bankaccount where id='" . $bank_account."' ";
$name2123_11=$DB->query($Query_bank);
$row_bank = mysql_fetch_array($name2123_11);
$tot_bank=mysql_num_rows($name2123_11);
$bank_name= trim(addslashes( $row_bank['bank_name']));
$account_no= trim(addslashes( $row_bank['account_no']));
$account_name= trim(addslashes( $row_bank['account_name']));
$ifsc_code= trim(addslashes( $row_bank['ifsc_code']));
$branch_name= trim(addslashes( $row_bank['branch_name']));
if($tot_bank>0)
{
$subject = "Freelance($freelance_emp_name) Added Withdraw Request Amount $newprice_1";
$to = 'rajesh@globusoutsourcing.com';
$message ='
Dear Rajesh,
Freelance('.$freelance_emp_name.') Added Withdraw Request Amount $'.$newprice_1.'
|
';
$headers = "From: $freelance_emp_email\r\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
@mail($to, $subject, $message, $headers);
$Query_s="INSERT INTO tbl_withdraw VALUES (NULL,'".$freelance_emp_id."','".$newprice_1."','".$date."','".$bank_account."','','','','".$account_no."','".$account_name."','".$bank_name."','".$ifsc_code."','".$branch_name."')";
$DB->query($Query_s);
}
}
}
}
?>