示例#1
0
 function actionGetName()
 {
     //получить id сборщиков
     $list_id = User_post::getUsersByPost('17');
     //узнать их имена
     foreach ($list_id as $post) {
         $user = Users::getUserById($post['uid']);
         $abr = Datas::nameAbr($user['name']);
         $collectors[$post['uid']] = $abr;
     }
     echo json_encode($collectors);
     return true;
 }
示例#2
0
 function actionTech()
 {
     $ri = $_COOKIE['ri'];
     $log = $_COOKIE['login'];
     if (!isset($ri)) {
         header('Location: /' . SITE_DIR . '/auth/showAuth');
     }
     //получить список технологов
     $userList6 = User_post::getUsersByPost(6);
     $userList7 = User_post::getUsersByPost(7);
     $userList = $userList6 + $userList7;
     $techList = array();
     foreach ($userList as $techid) {
         $datatech = Users::getUserById($techid['uid']);
         if ($datatech['validation'] == 1) {
             $techList[] = array('uid' => $datatech['id'], 'name' => Datas::nameAbr($datatech['name']));
         }
     }
     //        var_dump($techList);die;
     $no_reckoning = array();
     $orderList = Order::getOrdersNoReckoning();
     foreach ($orderList as $order) {
         $techdate = strtotime($order['tech_date']);
         if ($techdate < strtotime('today')) {
             $order['tech_date'] = date('Y-m-d', strtotime('yesterday'));
         }
         $no_reckoning[$order['technologist'] . '-' . $order['tech_date']][$order['oid']] = $order['contract'];
     }
     //var_dump($no_reckoning); die;
     $no_appoint = Order::getOrdersNoaAppointTech();
     //список дизайнеров
     $userList5 = User_post::getUsersByPost(5);
     $disList = array();
     foreach ($userList5 as $disid) {
         $datadis = Users::getUserById($disid['uid']);
         $disList[$datadis['id']] = Datas::nameAbr($datadis['name']);
     }
     //var_dump($disList);die;
     $page = SITE_PATH . 'views/plantech.php';
     include SITE_PATH . 'views/layout.php';
     return true;
 }
示例#3
0
 function actionAssembly()
 {
     $ri = $_COOKIE['ri'];
     $log = $_COOKIE['login'];
     if (!isset($ri)) {
         header('Location: /' . SITE_DIR . '/auth/showAuth');
     }
     $begin = '';
     $end = '';
     if (isset($_POST['submit'])) {
         if (isset($_POST['begin']) && isset($_POST['end'])) {
             $begin = Datas::dateToDb($_POST['begin']);
             $end = Datas::dateToDb($_POST['end']);
             $odderList = array();
             //закрытые заказы
             $beznal = array();
             $coll = array();
             $rekl = array();
             $dillerskie = array();
             $dontclose = array();
             //список диллерских инициалов
             $dil = Dillers::getAllDillers();
             $list = OrderStan::getOrdersByPeriod($begin, $end, 'sborka_end_date');
             foreach ($list as $one) {
                 $order = Order::getOrderById($one['oid']);
                 if ($order) {
                     $order['sborka_end_date'] = $one['sborka_end_date'];
                     //выделить безнал и рекламации
                     if ($order['beznal'] == 1 || $order['rassr'] == 1) {
                         $beznal[$order['collector']][] = $order;
                     } elseif (Datas::isRekl($order['contract'])) {
                         $rekl[$order['collector']][] = $order;
                     } else {
                         $d = false;
                         foreach ($dil as $onedil) {
                             //найти подстроку в номере договора
                             $pos = strpos($order['contract'], $onedil['flag']);
                             if ($pos !== false && $pos == 0) {
                                 $d = true;
                             }
                         }
                         if ($d) {
                             $dillerskie[$order['collector']][] = $order;
                         } else {
                             $odderList[$order['collector']][] = $order;
                         }
                     }
                 }
             }
         }
     }
     //список всех сборщиков
     $coll = array();
     $idusers = User_post::getUsersByPost(17);
     foreach ($idusers as $id) {
         $user = Users::getUsersByParam('id', $id['uid']);
         $coll[$user[0]['id']] = $user[0]['name'];
         //незакрытые заказы
         $dontclose[$id['uid']] = OrderStan::getNeSobr($id['uid']);
     }
     $page = SITE_PATH . 'views/repsb.php';
     include SITE_PATH . 'views/layout.php';
     return true;
 }
示例#4
0
 function actionIndex()
 {
     $ri = $_COOKIE['ri'];
     $log = $_COOKIE['login'];
     if (!isset($ri)) {
         header('Location: /' . SITE_DIR . '/auth/showAuth');
     }
     $contract = '';
     $con_date = '';
     $name = '';
     $prod = '';
     $termin = '';
     $otkr = 0;
     $sum = '';
     $rassr = 0;
     $beznal = 0;
     $pred = '';
     $dis = '';
     $adress = '';
     $phone = '';
     $note = '';
     //получить список дизайнеров
     $userList = User_post::getUsersByPost(5);
     $disList = array();
     foreach ($userList as $disid) {
         $datadis = Users::getUserById($disid['uid']);
         if ($datadis['validation'] == 1) {
             $disList[] = array('uid' => $datadis['id'], 'name' => $datadis['name']);
         }
     }
     //    var_dump($disList);
     if (isset($_POST['submit'])) {
         //текстовые поля
         if (isset($_POST['num'])) {
             $contract = $_POST['num'];
         }
         if (isset($_POST['con_date'])) {
             $con_date = $_POST['con_date'];
         }
         if (isset($_POST['name'])) {
             $name = $_POST['name'];
         }
         if (isset($_POST['prod'])) {
             $prod = $_POST['prod'];
         }
         if (isset($_POST['term'])) {
             $termin = $_POST['term'];
             $term = Datas::checkSunday($termin);
         }
         if (isset($_POST['sum'])) {
             $sum = str_replace(",", ".", $_POST['sum']);
         }
         if (isset($_POST['pred'])) {
             $pred = str_replace(",", ".", $_POST['pred']);
         }
         if (isset($_POST['adress'])) {
             $adress = $_POST['adress'];
         }
         if (isset($_POST['phone'])) {
             $phone = $_POST['phone'];
         }
         if (isset($_POST['note'])) {
             $note = $_POST['note'];
         }
         //чекбоксы
         if (isset($_POST['beznal'])) {
             $beznal = 1;
         }
         if (isset($_POST['otkr'])) {
             $otkr = 1;
         }
         if (isset($_POST['rassr'])) {
             $rassr = 1;
         }
         //селект
         if (isset($_POST['dis'])) {
             $dis = $_POST['dis'];
         }
         $errors = false;
         if (!Datas::checkPole($contract)) {
             $errors[] = 'Не введен номер заказа';
         }
         if (!Datas::checkPole($name)) {
             $errors[] = 'Как обращаться к заказчику?';
         }
         if (!Datas::checkPole($termin) && $otkr == 0) {
             $errors[] = 'Не указан срок договора';
         }
         if (!Datas::checkPole($sum)) {
             $errors[] = 'Укажите сумму договора';
         }
         if (!Datas::checkPole($phone)) {
             $errors[] = 'Введите номер телефона';
         }
         $dubl = Order::getOrdersByParam('contract', $contract);
         if (!empty($dubl)) {
             $errors[] = 'Уже есть заказ с таким номером';
         }
         $result = NULL;
         if (!$errors) {
             //вносим в базу
             $result = Order::add($contract, $con_date, $name, $prod, $adress, $phone, $term, $dis, $sum, $pred, $rassr, $beznal);
             if (!empty($result)) {
                 OrderStan::add($result, $term);
                 if ($note != '') {
                     Notes::setNote($result, $note);
                 }
             }
         }
     }
     $page = SITE_PATH . 'views/new.php';
     include SITE_PATH . 'views/layout.php';
     return true;
 }