public function stockUpdate()
 {
     Larasset::start('header')->css('daterangepicker');
     Larasset::start('footer')->js('moment', 'daterangepicker');
     $daterange = Input::get('record_range');
     if (strpos($daterange, '-') !== FALSE) {
         $fromandto = explode('-', $daterange);
         $from = sqldate($fromandto[0]);
         $to_plus_1day = strtotime('now') - strtotime('yesterday') + strtotime($fromandto[1]);
         $to = sqldate(date('Y/n/d', $to_plus_1day));
         $data['todate'] = $fromandto[1];
     } else {
         $from = sqldate(date('Y/n/d', strtotime('first day of this month')));
         $to = sqldate('+1day');
         $data['todate'] = $to;
     }
     $data['fromdate'] = $from;
     $data['todate'] = $to;
     $time = array($data['fromdate'], $data['todate']);
     $activities = Usersactivity::where('activity_type', '=', 'stock')->whereBetween('created_at', $time)->orderBy('id', 'desc')->get();
     //$data = array();
     if ($activities != null) {
         $data['activities'] = $activities;
     }
     $this->layout->title = "Welcome to Admin Area";
     $this->layout->content = View::make('admin.stockupdate_record.index', $data);
 }
예제 #2
0
 private function updateloggedTime($data)
 {
     $user = User::find(Auth::user()->id);
     $user->isloggedin = $data[0];
     $user->loggedtime = sqldate();
     $user->save();
 }
예제 #3
0
 public function add(array $values)
 {
     $users = tusers::i();
     $email = trim($values['email']);
     if ($users->emailexists($email)) {
         return false;
     }
     $groups = tusergroups::i();
     if (isset($values['idgroups'])) {
         $idgroups = $this->cleangroups($values['idgroups']);
         if (count($idgroups) == 0) {
             $idgroups = $groups->defaults;
         }
     } else {
         $idgroups = $groups->defaults;
     }
     $password = empty($values['password']) ? md5uniq() : $values['password'];
     $item = array('email' => $email, 'name' => isset($values['name']) ? trim($values['name']) : '', 'website' => isset($values['website']) ? trim($values['website']) : '', 'password' => litepublisher::$options->hash($email . $password), 'cookie' => md5uniq(), 'expired' => sqldate(), 'idgroups' => implode(',', $idgroups), 'trust' => 0, 'status' => isset($values['status']) ? $values['status'] : 'approved');
     $id = $users->db->add($item);
     $item['idgroups'] = $idgroups;
     $users->items[$id] = $item;
     $users->setgroups($id, $item['idgroups']);
     if ('approved' == $item['status']) {
         tuserpages::i()->add($id);
     }
     $users->added($id);
     return $id;
 }
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('systemsettings')->truncate();
     $systemsettings = array('payment_mode' => 'Cash, Pos, Coupon', 'dob_alert_day' => '5', 'created_at' => sqldate(), 'updated_at' => sqldate());
     // Uncomment the below to run the seeder
     DB::table('systemsettings')->insert($systemsettings);
 }
 public function import($url, $title, $posted, $ip, $status)
 {
     $item = array('url' => $url, 'title' => $title, 'post' => $this->pid, 'posted' => sqldate($posted), 'status' => $status, 'ip' => $ip);
     $id = $this->db->add($item);
     $item['id'] = $id;
     $this->items[$id] = $item;
     $this->updatecount($this->pid);
     return $id;
 }
예제 #6
0
/**
* Lite Publisher
* Copyright (C) 2010 - 2015 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/
* Dual licensed under the MIT (mit.txt)
* and GPL (gpl.txt) licenses.
**/
function tusersInstall($self)
{
    $manager = tdbmanager::i();
    $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
    $manager->CreateTable($self->table, file_get_contents($dir . 'users.sql'));
    //$manager->setautoincrement($self->table, 2);
    $manager->CreateTable($self->grouptable, file_get_contents($dir . 'usersgroups.sql'));
    $id = $self->db->add(array('email' => litepublisher::$options->email, 'name' => litepublisher::$site->author, 'website' => litepublisher::$site->url . '/', 'password' => '', 'cookie' => '', 'expired' => sqldate(), 'status' => 'approved', 'idgroups' => '1'));
    $self->setgroups($id, array(1));
}
예제 #7
0
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('modes')->truncate();
     $list = array('retail' => 1, 'wholesale' => 1, 'distributor' => 0, 'majordistributor' => 0);
     $modes = array();
     foreach ($list as $name => $status) {
         $modes[] = array('name' => $name, 'status' => $status, 'created_at' => sqldate(), 'updated_at' => sqldate());
     }
     // Uncomment the below to run the seeder
     DB::table('modes')->insert($modes);
 }
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('productcategories')->truncate();
     $list = array('Nail', 'Lips', 'Face', 'Eye', 'Others');
     $productcategories = array();
     foreach ($list as $cat) {
         $productcategories[] = array('name' => $cat, 'created_at' => sqldate(), 'updated_at' => sqldate());
     }
     // Uncomment the below to run the seeder
     DB::table('productcategories')->insert($productcategories);
 }
예제 #9
0
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('menus')->truncate();
     $list = array('Dashboard' => 'admindashboard', 'Stock' => 'adminstock');
     $menus = array();
     foreach ($list as $name => $urlname) {
         $menus[] = array('name' => $name, 'urlname' => $urlname, 'created_at' => sqldate(), 'updated_at' => sqldate());
     }
     // Uncomment the below to run the seeder
     DB::table('menus')->insert($menus);
 }
예제 #10
0
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('role_user')->truncate();
     $list = [1 => 1];
     $roleuser = [];
     foreach ($list as $userid => $roleid) {
         $roleuser[] = ['user_id' => $userid, 'role_id' => $roleid, 'created_at' => sqldate(), 'updated_at' => sqldate()];
     }
     // Uncomment the below to run the seeder
     DB::table('role_user')->insert($roleuser);
 }
예제 #11
0
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('brands')->truncate();
     $list = array('flp' => 'Forever living product', 'sleek' => 'Sleek makeup', 'glamour56' => 'Glamour56 makeup', 'iman' => 'Iman makeup', 'marykay' => 'MaryKay makeup', 'mac' => 'Mac makeup');
     $brands = array();
     foreach ($list as $name => $caption) {
         $brands[] = array('name' => $name, 'caption' => $caption, 'created_at' => sqldate(), 'updated_at' => sqldate());
     }
     // Uncomment the below to run the seeder
     DB::table('brands')->insert($brands);
 }
예제 #12
0
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('users')->truncate();
     $list = array('debola1' => 1, 'fresh2' => 2, 'melee3' => 3);
     $users = array();
     foreach ($list as $username => $role) {
         $users[] = array('username' => $username, 'usertoken' => Makehash::random('number', 6), 'password' => Hash::make('demo'), 'created_at' => sqldate(), 'updated_at' => sqldate());
     }
     // Uncomment the below to run the seeder
     DB::table('users')->insert($users);
 }
예제 #13
0
 public function save()
 {
     $r = Input::all();
     $r['date'] = sqldate($r['date']);
     $r['amount'] = unformat_money($r['amount']);
     $r['user_id'] = Auth::user()->id;
     $r['status'] = User::permitted('role.admin') === true ? 1 : 0;
     //Insert into database
     $created = Expenditure::create($r);
     $data['status'] = 'success';
     $data['message'] = 'Record saved successfully!';
     return Response::json($data);
 }
예제 #14
0
 public function create()
 {
     $all = Input::all();
     $all['user_id'] = Auth::user()->id;
     $all['deposit_date'] = sqldate($all['deposit_date']);
     $all['amount'] = unformat_money($all['amount']);
     $all['status'] = 0;
     //Insert into database
     $created = Bankentry::create($all);
     $data['status'] = 'success';
     $data['message'] = 'saved!';
     return Response::json($data);
 }
예제 #15
0
function tpostsGetsitemap($self, $from, $count)
{
    $result = array();
    $commentpages = litepublisher::$options->commentpages;
    $commentsperpage = litepublisher::$options->commentsperpage;
    $db = $self->db;
    $now = sqldate();
    $res = $db->query("select {$db->posts}.title, {$db->posts}.pagescount, {$db->posts}.commentscount, {$db->urlmap}.url\n  from {$db->posts}, {$db->urlmap}\n  where {$db->posts}.status = 'published' and {$db->posts}.posted < '{$now}' and {$db->urlmap}.id = {$db->posts}.idurl\n  order by {$db->posts}.posted desc limit {$from}, {$count}");
    while ($item = $db->fetchassoc($res)) {
        $comments = $commentpages ? ceil($item['commentscount'] / $commentsperpage) : 1;
        $result[] = array('url' => $item['url'], 'title' => $item['title'], 'pages' => max($item['pagescount'], $comments));
    }
    return $result;
}
 public function create()
 {
     $all = Input::all();
     $all['user_id'] = Auth::user()->id;
     $all['deposit_date'] = sqldate($all['deposit_date']);
     $all['amount'] = unformat_money($all['amount']);
     //Lets check if the current user is admin to determine the assigned status
     $all['status'] = User::permitted('role.admin') ? 1 : 0;
     //Insert into database
     $created = Bankentry::create($all);
     $data['status'] = 'success';
     $data['message'] = 'saved!';
     return Response::json($data);
 }
예제 #17
0
 public function additem(array $item)
 {
     $realfile = litepublisher::$paths->files . str_replace('/', DIRECTORY_SEPARATOR, $item['filename']);
     $item['author'] = litepublisher::$options->user;
     $item['posted'] = sqldate();
     $item['hash'] = $this->gethash($realfile);
     $item['size'] = filesize($realfile);
     //fix empty props
     foreach (array('mime', 'title', 'description', 'keywords') as $prop) {
         if (!isset($item[$prop])) {
             $item[$prop] = '';
         }
     }
     return $this->insert($item);
 }
예제 #18
0
 public function add($nick, $url, $foafurl, $status)
 {
     $item = array('nick' => $nick, 'url' => $url, 'foafurl' => $foafurl, 'added' => sqldate(), 'errors' => 0, 'status' => $status);
     if ($this->dbversion) {
         $id = $this->db->add($item);
     } else {
         $id = ++$this->autoid;
     }
     $this->items[$id] = $item;
     if (!$this->dbversion) {
         $this->save();
     }
     $this->added($id);
     $urlmap = turlmap::i();
     $urlmap->clearcache();
     return $id;
 }
예제 #19
0
 public function registerNewCustomer()
 {
     $customer = new Customer();
     $customer->name = $name = Input::get('name');
     $customer->phone = Input::get('phone');
     $customer->email = Input::get('email');
     $customer->birthday = sqldate(Input::get('birthday'));
     $customer->mode_id = (int) Input::get('customer_type');
     $customer->token = $token = Makehash::random('number', 6);
     $customer->createdby = Auth::user()->username;
     if (!$customer->save()) {
         $data = $customer->validatorStatus;
     } else {
         $message = "<p>Registration successful!</p>\n\t\t\t\t\t<p>" . $name . " token is: <span class='label label-large label-info new-token'>" . $token . "</span>\n\t\t\t\t\t</p>";
         $data['status'] = 'success';
         $data['message'] = $message;
         $data['detail'] = "Name: {$name} | Token-ID: {$token}";
     }
     return Response::json($data);
 }
예제 #20
0
 private function _fetchRecord()
 {
     $record_type = Input::get('record_type');
     $daterange = Input::get('record_range');
     if (strpos($daterange, '-') !== FALSE) {
         $fromandto = explode('-', $daterange);
         $from = sqldate($fromandto[0]);
         $to_plus_1day = strtotime('now') - strtotime('yesterday') + strtotime($fromandto[1]);
         $to = sqldate(date('Y/n/d', $to_plus_1day));
         $data['todate'] = $fromandto[1];
     } else {
         $from = sqldate(date('Y/n/d', strtotime('first day of this month')));
         $to = sqldate('+1day');
         $data['todate'] = $to;
     }
     $data['records'] = $this->_dbSyntax($record_type, $from, $to);
     //tt($data['records']->toArray());
     $data['fromdate'] = $from;
     return $data;
 }
예제 #21
0
 private function _fetchRecord()
 {
     $record_type = Input::get('record_type') != NULL ? Input::get('record_type') : 'sales';
     $daterange = Input::get('record_range') !== NULL ? Input::get('record_range') : '';
     if (strpos($daterange, '-') !== FALSE) {
         $fromandto = explode('-', $daterange);
         $from = sqldate($fromandto[0]);
         $to_plus_1day = strtotime('now') - strtotime('yesterday') + strtotime($fromandto[1]);
         $to = sqldate(date('Y/n/d', $to_plus_1day));
         $data['todate'] = $fromandto[1];
     } else {
         $from = sqldate('today');
         $to = sqldate('now');
         $data['todate'] = $to;
     }
     //$dbTableInfo = $this->tableName[$record_type];
     $data['records'] = $this->_dbSyntax($record_type, $from, $to);
     $data['fromdate'] = $from;
     return $data;
 }
 private function _dateSetter($date)
 {
     $date = str_replace('_', '', strchr($date, '_'));
     if (strtolower($date) == 'lastweek') {
         return array(sqldate('last week'), sqldate('last week +6 days'));
     }
     if (strtolower($date) == 'lastmonth') {
         $start_of_last_month = sqldate(date('Y/n/d', strtotime('first day of last month')));
         $end_of_last_month = sqldate(date('Y/n/d', strtotime('last day of last month')));
         return array($start_of_last_month, $end_of_last_month);
     }
     if (strtolower($date) == 'today') {
         return array(sqldate('today'), sqldate('tomorrow'));
     }
     if (strtolower($date) == 'yesterday') {
         return array(sqldate('yesterday'), sqldate('today'));
     }
     if (strtolower($date) == 'tomorrow') {
         return array(sqldate('tomorrow'), sqldate('tomorrow +1 day'));
     }
 }
 public function request($arg)
 {
     $this->cache = false;
     if (!($this->iduser = litepublisher::$options->user)) {
         //trick - hidden registration of comuser. Auth by get
         $users = tusers::i();
         if (isset($_GET['auth']) && ($cookie = trim($_GET['auth']))) {
             if (($this->iduser = $users->findcookie($cookie)) && litepublisher::$options->reguser) {
                 if ('comuser' == $users->getvalue($this->iduser, 'status')) {
                     // bingo!
                     $this->newreg = true;
                     $item = $users->getitem($this->iduser);
                     $item['status'] = 'approved';
                     $item['password'] = '';
                     $item['idgroups'] = 'commentator';
                     $cookie = md5uniq();
                     $expired = time() + 31536000;
                     $item['cookie'] = litepublisher::$options->hash($cookie);
                     $item['expired'] = sqldate($expired);
                     $users->edit($this->iduser, $item);
                     litepublisher::$options->user = $this->iduser;
                     litepublisher::$options->updategroup();
                     litepublisher::$options->setcookie('litepubl_user_id', $this->iduser, $expired);
                     litepublisher::$options->setcookie('litepubl_user', $cookie, $expired);
                 } else {
                     $this->iduser = false;
                 }
             }
         }
     }
     if (!$this->iduser) {
         $url = litepublisher::$site->url . '/admin/login/' . litepublisher::$site->q . 'backurl=' . rawurlencode('/admin/subscribers/');
         return litepublisher::$urlmap->redir($url);
     }
     if ('hold' == tusers::i()->getvalue($this->iduser, 'status')) {
         return 403;
     }
     return parent::request($arg);
 }
             }
             $where = "(" . substr($where, 4) . ") AND ";
         }
     } elseif ($_POST['newRight']) {
         $reassign = $_POST['newRight'];
         $u = $slave->select("SELECT First_Name, Last_Name From Users WHERE User_ID=" . $reassign);
         $assigned_to = display_name($u[0]['First_Name'], $u[0]['Last_Name']);
         $tdata['User_ID'] = $reassign;
         $tdata['Department_ID'] = 0;
         $where = "User_ID=" . $reassign . " AND ";
     }
     $data['Reassigned_ID'] = $reassign;
 }
 $tdata['Priority'] = $_POST['priority'];
 if ($_POST['finish_date']) {
     $tdata['Finish_Date'] = sqldate($_POST['finish_date']);
 } else {
     $tdata['Finish_Date'] = NULL;
 }
 $data['User_ID'] = $_SESSION['user_id'];
 $data['Acknowledged'] = date("Y-m-d H:i:s");
 $data['Task_ID'] = $_POST['task_id'];
 $data['Progress'] = $_POST['progress'];
 if ($_POST['doaction'] == "Reassign") {
     $data['Accepted'] = 0;
 } elseif ($_POST['doaction'] == "Accept") {
     $data['Accepted'] = 1;
 } elseif ($_POST['doaction'] == "Close") {
     $tdata['Progress'] = '100';
     $data['Progress'] = '100';
 }
예제 #25
0
 private function _processHistory($id, $daterange)
 {
     Larasset::start('header')->css('daterangepicker');
     Larasset::start('footer')->js('moment', 'daterangepicker');
     if (strpos($daterange, '-') !== FALSE) {
         $fromandto = explode('-', $daterange);
         $from = sqldate($fromandto[0]);
         $to_plus_1day = strtotime('now') - strtotime('yesterday') + strtotime($fromandto[1]);
         $to = sqldate(date('Y/n/d', $to_plus_1day));
         $data['todate'] = $fromandto[1];
     } else {
         $from = sqldate(date('Y/n/d', strtotime('first day of this month')));
         $to = sqldate('+1day');
         $data['todate'] = $to;
     }
     $customerlog = Salelog::with(array('product' => function ($q) {
         $q->select('id', 'name', 'productcat_id')->with(array('categories' => function ($qr) {
             $qr->select('id', 'type');
         }));
     }))->where('customer_id', '=', $id)->whereBetween('created_at', array($from, $to))->orderBy('id', 'desc');
     //tt(groupThem($customerlog->get()->toArray(), 'receipt_id'));
     $customerDetails = Customer::where('id', '=', $id)->first();
     //$data['customerhistory'] = $customerlog->get()->toArray();
     $data['customerhistory'] = groupThem($customerlog->get()->toArray(), 'receipt_id');
     $data['customerdetail'] = $customerDetails;
     $data['fromdate'] = $from;
     $this->layout->title = 'Customer History';
     $this->layout->content = View::make('admin.customerhistory', $data);
 }
예제 #26
0
         }
         if ($_POST['friday']) {
             $data['Friday'] = 1;
         }
         if ($_POST['saturday']) {
             $data['Saturday'] = 1;
         }
         if ($_POST['sunday']) {
             $data['Sunday'] = 1;
         }
     }
     if ($_POST['start_range']) {
         $data['Start_Range'] = sqldate($_POST['start_range']);
     }
     if ($_POST['ends'] == 1) {
         $data['End_Range'] = sqldate($_POST['end_range']);
     }
 }
 if ($_POST['task_id'] == "new") {
     if (!$_POST['finish_date']) {
         $task_days = $slave->select("SELECT Default_Days FROM Task_Priority WHERE Priority_ID=" . $_POST['priority']);
         if ($task_days) {
             //$data['Finish_Date']=date("Y-m-d",mktime(0,0,0,date(m),date(d)+,date(y)));
         }
     }
     $data['Creator_ID'] = $_SESSION['user_id'];
     //if ($_SESSION[user_id]==6) {
     //print_r($data);
     //exit;
     //}
     $insert = $db->insert("Tasks", $data);
예제 #27
0
$email = trim(str_replace(" ", "", $email));
$email = str_replace(",", "", $email);
// Everything approved. Save the profile
$MEMBER->FirstName = $fname;
$MEMBER->MiddleName = $mname;
$MEMBER->LastName = $lname;
$MEMBER->Email = $email;
$MEMBER->HideEmail = $hideEmail;
$MEMBER->Gender = $gender;
if ($pwd1 && $pwd2) {
    $MEMBER->ChangePassword($pwd1, $oldpwd);
}
$MEMBER->PhoneNumber = $phone;
$MEMBER->HidePhone = $hidePhone;
$MEMBER->ReceiveTexts = $receiveSms;
$MEMBER->Birthday = sqldate($dob);
$MEMBER->HideBirthday = $hideBirthday;
// Here follows the logic of the member's Residence.
// If there's a custom Residence, it has no "Name"
// and the Member's "Apartment" field is blank too.
// If it's a regular residence, it has a "Name",
// and the "Apartment" field has the unit number.
function setNewCustomResidence(&$MEMBER, &$WARD, $streetAddress, $city, $state, $zipcode)
{
    $newRes = $WARD->AddResidence("", $streetAddress, $city, $state, $zipcode, true);
    $MEMBER->ResidenceID = $newRes->ID();
    $MEMBER->Apartment = "";
}
function setNewRegularResidence(&$MEMBER, $resID, $aptnum)
{
    $MEMBER->ResidenceID = $resID;
예제 #28
0
 protected function setclosed($value)
 {
     $this->childdata['closed'] = is_int($value) ? sqldate($value) : $value;
 }
예제 #29
0
 public function getsqldate()
 {
     return sqldate($this->posted);
 }
예제 #30
0
 if (mysql_num_rows(DB::Run($q)) == 0) {
     continue;
 }
 $sq = SurveyQuestion::Load($qid);
 // Load question
 $ansObj = $sq->Answers($memID);
 // Load this members' answer to it
 $ansChanged = false;
 // Make sure it's not a required question with an empty
 // or no answer. If so, skip it.
 if ($sq->Required && !$ans) {
     continue;
 }
 // For Timestamp-style answers, format them accordingly
 if ($sq->QuestionType == QuestionType::Timestamp) {
     $ans = sqldate($ans);
 }
 // Free-response should be capitalized at the beginning
 if ($sq->QuestionType == QuestionType::FreeResponse) {
     $ans = ucfirst(trim($ans));
 }
 if (!$ansObj) {
     // No previous answer? No problem! Create it.
     $ansObj = $sq->AddAnswer($ans, $memID);
     $ansChanged = true;
 } else {
     // Update existing answer if necessary
     if ($ans != $ansObj->AnswerValue) {
         $ansObj->AnswerValue = $ans;
         $ansChanged = true;
     }