function actionCollHoliday() { if (!empty($_POST['date'])) { $datedb = Datas::dateToDb($_POST['date']); $uid = $_POST['uid']; //проверка наличия записи $list = Freemen::getFreeday($uid); if (!in_array($datedb, $list)) { Freemen::addFree($uid, $datedb); $user = Users::getUserById($uid); $name = Datas::nameAbr($user['name']); echo $name . 'f' . $datedb . 'f' . $uid; } } return true; }
public static function add($contract, $contract_date, $name, $product, $adress, $phone, $term, $designer, $sum, $prepayment, $rassr, $beznal) { $db = Db::getConection(); //Именованные метки $stmt = $db->prepare("INSERT INTO orders (contract, contract_date, name, product, adress, phone, date, term, designer, sum, prepayment, rassr, beznal)\nVALUES (:contract, :contract_date, :name, :product, :adress, :phone, CURDATE(), :term, :designer, :sum, :prepayment, :rassr, :beznal)"); $stmt->execute(array('contract' => $contract, 'contract_date' => Datas::dateToDb($contract_date), 'name' => $name, 'product' => $product, 'adress' => $adress, 'phone' => $phone, 'term' => $term, 'designer' => $designer, 'sum' => $sum, 'prepayment' => $prepayment, 'rassr' => $rassr, 'beznal' => $beznal)); $oid = $db->lastInsertId(); return $oid; }
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; }