Добавить заявку "; } if($n == 2){ $out = ""; $n = 0; } $n++; $out .= ""; if($obj->customer_org_id){ $org = mysql_query('SELECT * FROM customer_org WHERE id = '.$obj->customer_org_id.';'); $customer = mysql_fetch_object($org); $out .= ""; }else{ $out .= ""; } $f = fopen("Regions.csv", "r"); $data = fgetcsv($f, 1000, ';'); for($j = 1;;$j++){ if($data[0] == $obj->region) { $regionname = $data[1]; break; } $data = fgetcsv($f, 1000, ';'); } fclose($f); if($_POST['region'] != "01"){ $address = $regionname; if($obj->district){ $address .= ", ".$obj->district." р-н"; } if($obj->city){ $address .= ", г ".$obj->city; } if($obj->city_district){ $address .= ", ".$obj->city_district." р-н"; } if($obj->soviet_village){ $address .= ", ".$obj->soviet_village." c/c"; } if($obj->locality){ $address .= ", ".$obj->locality_type." ".$obj->locality; } if($obj->street){ $address .= ", ".$obj->street_type." ".$obj->street; } if($obj->l1){ $address .= ", ".$obj->l1_type." ".$obj->l1; } if($obj->l2){ $address .= ", ".$obj->l2_type." ".$obj->l2; } if($obj->l3){ $address .= ", ".$obj->l3_type." ".$obj->l3; } if($obj->apartment){ $address .= ", ".$obj->apartment_type." ".$obj->apartment; } } $out .= ""; $servise_name = "
Список заявок
Номер заявки ФИО заказчика Адрес объекта Вид работ Дата принятия Дата окончания Геодезист Техник Камеральщик Редактирование
".$obj->number."".$obj->person_fio." - ".$customer->org_name."".$obj->person_fio."".$address."
"; $servise_start = "
"; $servise_end = "
"; $que = mysql_query('SELECT * FROM service WHERE application_num = '.$obj->number.';'); while($serv = mysql_fetch_object($que)){ $timestamp = time(); $date_time_array = getdate($timestamp); $month = $date_time_array['mon']; $day = $date_time_array['mday']; $year = $date_time_array['year']; $timestamp = mktime(0,0,0,$month,$day,$year); $enddate = explode(".", $serv->date); $timestamp1 = mktime(0,0,0,$enddate[1],$enddate[0],$enddate[2]); $servise_name .= ""; $servise_start .= ""; if(($timestamp1 - $timestamp)/86400 <= 3) $servise_end .= ""; else $servise_end .= ""; } $servise_name .= "
".$service[$serv->type]."
".$obj->date."
".$serv->date."
".$serv->date."
"; $servise_start .= ""; $servise_end .= ""; $out .= "".$servise_name.""; $out .= "".$servise_start.""; $out .= "".$servise_end.""; if(!$obj->geodesist){ $out .= "
"; }else{ $out .= "
".$obj->geodesist."

"; } if(!$obj->technic){ $out .= "
"; }else{ $out .= "
".$obj->technic."

"; } if(!$obj->cameral){ $out .= "
"; }else{ $out .= "
".$obj->cameral."
"; } $out .= "
"; echo $out; } ?>