public function getInsightForCounts($this_period_count, $last_period_count, $instance, $matching_posts) { $insight = null; if ($this_period_count > 0) { $insight = new Insight(); $insight->slug = $this->getSlug(); $insight->instance_id = $instance->id; $insight->date = $this->insight_date; $network = ucfirst($instance->network); $potential_headlines = array("The LOLs of %month", 'LOL activity detected'); $last_month = Date('F', strtotime(date('F') . " last month")); $insight->text = 'Looks like ' . $this->username . ' found ' . number_format($this_period_count) . ' thing' . ($this_period_count == 1 ? '' : 's') . ' LOL-worthy in the last month.'; if ($this_period_count > $last_period_count && $last_period_count > 0) { $potential_headlines[] = $network . ' must be getting even funnier!'; $lol_diff = $this_period_count - $last_period_count; $insight->text .= ' That\'s ' . number_format($lol_diff) . ' more laugh' . ($lol_diff == 1 ? '' : 's') . ' than the ' . 'prior month.'; } $insight->headline = $this->getVariableCopy($potential_headlines, array('other_user' => $matching_posts[0]->author_username, 'month' => $last_month)); $insight->filename = basename(__FILE__, ".php"); $insight->emphasis = Insight::EMPHASIS_MED; if (count($this->posts_to_include) > 0) { // Only include up to 10 posts to avoid InsightFieldExceedsMaxLengthException $insight->setPosts(array_slice($this->posts_to_include, 0, 10)); } } return $insight; }
protected function private_core() { $this->share_extension(); $this->cliente = FALSE; $this->desde = Date('01-01-Y'); $this->hasta = Date('t-m-Y'); $this->resultados = FALSE; $this->serie = new serie(); if (isset($_REQUEST['buscar_cliente'])) { $this->buscar_cliente(); } else { if (isset($_REQUEST['codcliente'])) { $cli0 = new cliente(); $this->cliente = $cli0->get($_REQUEST['codcliente']); if (isset($_REQUEST['codserie'])) { $this->codserie = $_REQUEST['codserie']; } if (isset($_REQUEST['desde'])) { $this->desde = $_REQUEST['desde']; } if (isset($_REQUEST['hasta'])) { $this->hasta = $_REQUEST['hasta']; } if ($this->cliente) { $this->resultados = $this->buscar_pedidos(); if (isset($_POST['cantidad_0'])) { $this->agrupar_pedidos(); $this->resultados = FALSE; } } } } }
/** * Auto generated seed file * * @return void */ public function run() { $monday = Date('Y-m-d', strtotime('-2 days')); $tuesday = Date('Y-m-d', strtotime('-1 days')); \DB::table('shifts')->delete(); \DB::table('shifts')->insert(array(0 => array('id' => '1', 'eid' => '1', 'clockIn' => "{$monday} 08:00:00", 'clockOut' => "{$monday} 13:00:00", 'created_at' => '2015-05-26 08:04:58', 'updated_at' => '2015-05-26 12:51:33'), 1 => array('id' => '2', 'eid' => '1', 'clockIn' => "{$tuesday} 08:05:37", 'clockOut' => "{$tuesday} 17:02:57", 'created_at' => '2015-05-26 08:10:37', 'updated_at' => '2015-05-26 17:02:57'), 2 => array('id' => '3', 'eid' => '2', 'clockIn' => "{$tuesday} 08:22:32", 'clockOut' => "{$tuesday} 14:06:51", 'created_at' => '2015-05-26 08:22:32', 'updated_at' => '2015-05-26 14:06:51'), 3 => array('id' => '4', 'eid' => '2', 'clockIn' => "{$monday} 09:30:00", 'clockOut' => "{$monday} 16:18:27", 'created_at' => '2015-05-26 11:21:09', 'updated_at' => '2015-05-26 16:18:27'), 4 => array('id' => '5', 'eid' => '3', 'clockIn' => "{$monday} 11:38:57", 'clockOut' => "{$monday} 15:28:26", 'created_at' => '2015-05-26 11:38:57', 'updated_at' => '2015-05-26 15:28:26'))); }
static function DoSaveUserProfile($userId, $profileId, $profileName, $personTypeId, $orderProps, &$arErrors) { $profileId = intval($profileId); $arIDs = array(); if ($profileId > 0) { $dbProfile = CSaleOrderUserProps::GetList(array(), array("ID" => $profileId), false, false, array("ID", "NAME", "USER_ID", "PERSON_TYPE_ID")); $arProfile = $dbProfile->Fetch(); if (!$arProfile) { $arErrors[] = array("CODE" => "PROFILE_NOT_FOUND", "TEXT" => GetMessage('SKGOUP_PROFILE_NOT_FOUND')); return false; } if ($arProfile["USER_ID"] != $userId || $arProfile["PERSON_TYPE_ID"] != $personTypeId) { $arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGOUP_PARRAMS_ERROR')); return false; } //if (strlen($profileName) > 0 && $profileName != $arProfile["NAME"]) if (strlen($profileName) > 0) { $arFields = array("NAME" => $profileName, "USER_ID" => $userId); CSaleOrderUserProps::Update($profileId, $arFields); } $dbUserPropsValues = CSaleOrderUserPropsValue::GetList(array(), array("USER_PROPS_ID" => $profileId), false, false, array("ID", "ORDER_PROPS_ID")); while ($arUserPropsValue = $dbUserPropsValues->Fetch()) { $arIDs[$arUserPropsValue["ORDER_PROPS_ID"]] = $arUserPropsValue["ID"]; } } if (!is_array($orderProps)) { $dbOrderPropsValues = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => intval($orderProps)), false, false, array("ORDER_PROPS_ID", "VALUE")); $orderProps = array(); while ($arOrderPropsValue = $dbOrderPropsValues->Fetch()) { $orderProps[$arOrderPropsValue["ORDER_PROPS_ID"]] = $arOrderPropsValue["VALUE"]; } } $dbOrderProperties = CSaleOrderProps::GetList(array(), array("PERSON_TYPE_ID" => $personTypeId, "ACTIVE" => "Y", "UTIL" => "N", "USER_PROPS" => "Y"), false, false, array("ID", "TYPE", "NAME", "CODE")); while ($arOrderProperty = $dbOrderProperties->Fetch()) { $curVal = $orderProps[$arOrderProperty["ID"]]; if ($arOrderProperty["TYPE"] == "MULTISELECT" && is_array($curVal)) { $curVal = implode(",", $curVal); } if (strlen($curVal) > 0) { if ($profileId <= 0) { if (strlen($profileName) <= 0) { $profileName = GetMessage("SOA_PROFILE") . " " . Date("Y-m-d"); } $arFields = array("NAME" => $profileName, "USER_ID" => $userId, "PERSON_TYPE_ID" => $personTypeId); $profileId = CSaleOrderUserProps::Add($arFields); } if (array_key_exists($arOrderProperty["ID"], $arIDs)) { $arFields = array("NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal); CSaleOrderUserPropsValue::Update($arIDs[$arOrderProperty["ID"]], $arFields); unset($arIDs[$arOrderProperty["ID"]]); } else { $arFields = array("USER_PROPS_ID" => $profileId, "ORDER_PROPS_ID" => $arOrderProperty["ID"], "NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal); CSaleOrderUserPropsValue::Add($arFields); } } } foreach ($arIDs as $id) { CSaleOrderUserPropsValue::Delete($id); } }
public function __construct($t = false) { parent::__construct('distribucion_ordenescarga_facturas', 'plugins/distribucion/'); if ($t) { $this->idempresa = $t['idempresa']; $this->codalmacen = $t['codalmacen']; $this->idordencarga = $t['idordencarga']; $this->idfactura = $t['idfactura']; $this->idtransporte = $t['idtransporte']; $this->fecha = $t['fecha']; $this->usuario_creacion = $t['usuario_creacion']; $this->fecha_creacion = Date('d-m-Y H:i', strtotime($t['fecha_creacion'])); $this->usuario_modificacion = $t['usuario_modificacion']; $this->fecha_modificacion = Date('d-m-Y H:i'); } else { $this->idempresa = null; $this->codalmacen = null; $this->idordencarga = null; $this->idfactura = null; $this->idtransporte = null; $this->fecha = null; $this->usuario_creacion = null; $this->fecha_creacion = Date('d-m-Y H:i'); $this->usuario_modificacion = null; $this->fecha_modificacion = null; } $this->factura_cliente = new factura_cliente(); $this->cliente = new cliente(); if (class_exists('ncf_rango')) { $this->ncf_ventas = new ncf_ventas(); } }
function CONTROL_ORFEO(&$db) { $this->cursor =& $db; $this->db =& $db; $this->fecha_hoy = Date("Y-m-d"); $this->sqlFechaHoy = $this->db->conn->OffsetDate(0, $this->db->conn->sysTimeStamp); }
function create_file($source) { $new_date = Date("m-d-y"); $file = "json_dir/guardian_" . $new_date . ".json"; try { if (file_exists($file)) { throw new Exception("file exists "); } else { $new = touch($file); if (!$new) { throw new Exception("file not created"); exit(0); } //if // else statement $local_file = fopen($file, 'w'); if (fwrite($local_file, strlen($source), 998) == false) { return false; } fclose($local_file); $c_permissions = chmod($new, 0666); } //else } catch (Exception $e) { echo $e->getMessage(); } return $file; }
public function __construct($t = false) { parent::__construct('distribucion_lineastransporte', 'plugins/distribucion/'); if ($t) { $this->idempresa = $t['idempresa']; $this->codalmacen = $t['codalmacen']; $this->idtransporte = $t['idtransporte']; $this->fecha = $t['fecha']; $this->referencia = $t['referencia']; $this->cantidad = $t['cantidad']; $this->importe = $t['importe']; $this->peso = $t['peso']; $this->estado = $this->str2bool($t['estado']); $this->usuario_creacion = $t['usuario_creacion']; $this->fecha_creacion = Date('d-m-Y H:i', strtotime($t['fecha_creacion'])); $this->usuario_modificacion = $t['usuario_modificacion']; $this->fecha_modificacion = Date('d-m-Y H:i'); } else { $this->idempresa = null; $this->idtransporte = null; $this->codalmacen = null; $this->fecha = null; $this->referencia = null; $this->cantidad = null; $this->importe = null; $this->peso = null; $this->estado = false; $this->usuario_creacion = null; $this->fecha_creacion = \Date('d-m-Y H:i'); $this->usuario_modificacion = null; $this->fecha_modificacion = \Date('d-m-Y H:i'); } $this->articulo = new articulo(); }
public function lihat_ujian() { if (Session::has('jurusan')) { $tgl = Date('Y-m-d'); $jam = Date('H:i:s'); $jurusan = Session::get('jurusan'); $siswa = $this->getSiswa(); $ruang = Peserta::where('nis', $siswa->nis)->first(); $jadwal = DB::table('view_jadwal')->where('id_ruang', $ruang->id_ruang)->where('tgl_ujian', $tgl)->where('kode_jurusan', $jurusan)->get(); if (count($jadwal) > 0) { foreach ($jadwal as $row) { //jika jam mulai dan jam sekarang sama atau kurang setengah jam, maka tampilkan if ($jam >= $row->jam && $jam <= $row->selesai) { $adajadwal = Jadwal::find($row->id_jadwal); return View('siswa.lihat_ujian')->with('jadwal', $adajadwal); } else { Session::flash('pesan', "Tidak ada Jadwal Ujian"); return Redirect::to('siswa'); } } } else { Session::flash('pesan', "Tidak ada Jadwal Ujian"); return Redirect::to('siswa'); } } else { Session::flash('pesan', "Tidak ada Jadwal Ujian"); return Redirect::to('siswa'); } }
public function __construct($t = false) { parent::__construct('distribucion_conductores', 'plugins/distribucion/'); if ($t) { $this->id = $t['id']; $this->idempresa = $t['idempresa']; $this->codalmacen = $t['codalmacen']; $this->codtrans = $t['codtrans']; $this->nombre = $t['nombre']; $this->licencia = $t['licencia']; $this->tipolicencia = $t['tipolicencia']; $this->idsubcuenta = $t['idsubcuenta']; $this->codsubcuenta = $t['codsubcuenta']; $this->estado = $this->str2bool($t['estado']); $this->usuario_creacion = $t['usuario_creacion']; $this->fecha_creacion = Date('d-m-Y H:i', strtotime($t['fecha_creacion'])); $this->usuario_modificacion = $t['usuario_modificacion']; $this->fecha_modificacion = Date('d-m-Y H:i'); } else { $this->id = null; $this->idempresa = null; $this->codalmacen = null; $this->codtrans = null; $this->nombre = null; $this->licencia = null; $this->tipolicencia = null; $this->idsubcuenta = null; $this->codsubcuenta = null; $this->estado = false; $this->usuario_creacion = null; $this->fecha_creacion = Date('d-m-Y H:i'); $this->usuario_modificacion = null; $this->fecha_modificacion = null; } }
function addContentToNote($noteId, $gameId, $playerId, $mediaId, $type, $text, $title = '', $lat = 0, $lon = 0) { $text = addslashes($text); if ($title == '') { $title = Date('F jS Y h:i:s A'); } else { $title = addslashes($title); } $query = "INSERT INTO note_content (note_id, game_id, media_id, type, text, title) VALUES ('{$noteId}', '{$gameId}', '{$mediaId}', '{$type}', '{$text}', '{$title}')"; $result = Module::query($query); if (mysql_error()) { return new returnData(1, NULL, mysql_error()); } $contentId = mysql_insert_id(); Module::processGameEvent($playerId, $gameId, Module::kLOG_UPLOAD_MEDIA_ITEM, $contentId, $lat, $lon); if ($type == "PHOTO") { Module::processGameEvent($playerId, $gameId, Module::kLOG_UPLOAD_MEDIA_ITEM_IMAGE, $contentId, $lat, $lon); } else { if ($type == "AUDIO") { Module::processGameEvent($playerId, $gameId, Module::kLOG_UPLOAD_MEDIA_ITEM_AUDIO, $contentId, $lat, $lon); } else { if ($type == "VIDEO") { Module::processGameEvent($playerId, $gameId, Module::kLOG_UPLOAD_MEDIA_ITEM_VIDEO, $contentId, $lat, $lon); } } } return new returnData(0, $contentId); }
function CetakPindahan() { global $_lf; $s = "select mps.*, mk.Nama as NamaMK\r\n from mhswpindahansetara mps\r\n left outer join mk mk on mps.MKID=mk.MKID\r\n where MhswPindahanID='{$_REQUEST['pin']}'\r\n order by mps.SetaraKode"; $r = _query($s); $maxcol = 135; $nmf = HOME_FOLDER . DS . "tmp/p.{$_SESSION['_Login']}.dwoprn"; $f = fopen($nmf, 'w'); fwrite($f, chr(27) . chr(15) . chr(27) . chr(108) . chr(20)); $div = str_pad('-', $maxcol, '-') . $_lf; $n = 0; $hal = 0; $brs = 56; $maxbrs = 49; $dt = GetFields('mhswpindahan', 'MhswPindahanID', $_REQUEST['pin'], "Nama"); $prd = GetaField('prodi', 'ProdiID', $_REQUEST['prodi'], 'Nama'); $hdr = str_pad('*** DAFTAR PENYETARAAN MATA KULIAH PINDAHAN **', $maxcol, ' ', STR_PAD_BOTH) . $_lf . $_lf . $_lf; $hdr .= "Tahun Akademik : " . NamaTahun($_REQUEST['tahun']) . $_lf; $hdr .= "Prodi : {$prd}" . $_lf; $hdr .= "Mahasiswa : {$dt['Nama']}" . $_lf; $hdr .= $div; $hdr .= str_pad("NO", 5) . str_pad("KODE", 10) . str_pad("MATA KULIAH", 35) . str_pad('SKS', 6) . str_pad('NILAI', 6) . str_pad('GRADE', 6) . str_pad('>>>', 5) . str_pad("KODE", 8) . str_pad("MATA KULIAH", 40) . str_pad('SKS', 6) . str_pad('GRADE', 4) . $_lf; $hdr .= $div; fwrite($f, $hdr); while ($w = _fetch_array($r)) { $n++; fwrite($f, str_pad($n, 5) . str_pad($w['SetaraKode'], 10) . str_pad($w['SetaraNama'], 37) . str_pad($w['SetaraSKS'], 5) . str_pad($w['NilaiAkhir'], 7) . str_pad($w['SetaraGrade'], 4) . str_pad('>>>>', 5) . str_pad($w['MKKode'], 8) . str_pad($w['NamaMK'], 40) . str_pad($w['SKS'], 8) . str_pad($w['GradeNilai'], 4) . $_lf); } fwrite($f, $div); fwrite($f, $_lf . "Dicetak Oleh : " . $_SESSION['_Login'] . ', ' . Date("d-m-Y H:i")); fwrite($f, chr(12)); fclose($f); TampilkanFileDWOPRN($nmf); }
function NewLinks($newlinkshowdays) { global $ModPath, $ModStart, $links_DB; include "header.php"; mainheader('nl'); $counter = 0; $allweeklinks = 0; while ($counter <= 7 - 1) { $newlinkdayRaw = time() - 86400 * $counter; $newlinkday = date("d-M-Y", $newlinkdayRaw); $newlinkView = date("F d, Y", $newlinkdayRaw); $newlinkDB = Date("Y-m-d", $newlinkdayRaw); $result = sql_query("SELECT * FROM " . $links_DB . "links_links WHERE date LIKE '%{$newlinkDB}%'"); $totallinks = sql_num_rows($result); $counter++; $allweeklinks = $allweeklinks + $totallinks; } $counter = 0; $allmonthlinks = 0; while ($counter <= 30 - 1) { $newlinkdayRaw = time() - 86400 * $counter; $newlinkDB = Date("Y-m-d", $newlinkdayRaw); $result = sql_query("SELECT * FROM " . $links_DB . "links_links WHERE date LIKE '%{$newlinkDB}%'"); $totallinks = sql_num_rows($result); $allmonthlinks = $allmonthlinks + $totallinks; $counter++; } echo ' <div class="card card-block"> <h3>' . translate("New links") . '</h3> ' . translate("Total new links: Last week") . ' : ' . $allweeklinks . ' -/- ' . translate("Last 30 days") . ' : ' . $allmonthlinks; echo "<br />\n"; echo "<blockquote>" . translate("Show:") . " [<a href=\"modules.php?ModStart={$ModStart}&ModPath={$ModPath}&op=NewLinks&newlinkshowdays=7\" class=\"noir\">" . translate("week") . "</a>, <a href=\"modules.php?ModStart={$ModStart}&ModPath={$ModPath}&op=NewLinks&newlinkshowdays=14\" class=\"noir\">2 " . translate("weeks") . "</a>, <a href=\"modules.php?ModStart={$ModStart}&ModPath={$ModPath}&op=NewLinks&newlinkshowdays=30\" class=\"noir\">30 " . translate("days") . "</a>]</<blockquote>"; $counter = 0; $allweeklinks = 0; echo ' <blockquote> <ul>'; while ($counter <= $newlinkshowdays - 1) { $newlinkdayRaw = time() - 86400 * $counter; $newlinkday = date("d-M-Y", $newlinkdayRaw); $newlinkView = date(str_replace("%", "", translate("linksdatestring")), $newlinkdayRaw); $newlinkDB = Date("Y-m-d", $newlinkdayRaw); $result = sql_query("SELECT * FROM " . $links_DB . "links_links WHERE date LIKE '%{$newlinkDB}%'"); $totallinks = sql_num_rows($result); $counter++; $allweeklinks = $allweeklinks + $totallinks; if ($totallinks > 0) { echo "<li><a href=\"modules.php?ModStart={$ModStart}&ModPath={$ModPath}&op=NewLinksDate&selectdate={$newlinkdayRaw}\">{$newlinkView}</a> ( {$totallinks} )</li>"; } } echo ' </blockquote> </ul> </div>'; $counter = 0; $allmonthlinks = 0; include "footer.php"; }
/** * @param $date_begin * @param $date_end * @param $task_type * @param $import_array * @return bool */ function import_sd_task($date_begin, $date_end, $task_type, $import_array) { //var_dump($import_array); $import_array['TITLE'] = iconv('UTF-8', 'cp1251', $import_array['TITLE']); $import_array['DESCRIPTION'] = iconv('UTF-8', 'cp1251', $import_array['DESCRIPTION']); $import_array['WORKORDERID'] = iconv('UTF-8', 'cp1251', $import_array['WORKORDERID']); $data = array('nazva' => iconv('UTF-8', 'cp1251', "№") . $import_array['WORKORDERID'] . ' : ' . $import_array['TITLE'], 'vud' => $task_type, 'strateg' => 0, 'rezult' => $import_array['DESCRIPTION'], 'date_begin' => $date_begin, 'date_zapl_zaversh' => $date_end, 'zapl_chas' => 0, 'vlasnyk' => $this->session->userdata('user_id'), 'vykonavets' => $this->session->userdata('user_id'), 'mitky' => 0, 'date_end_povtor' => '', 'sd_task_id' => $import_array['WORKORDERID']); if ($task_type == 3 and isset($import_array['OPERATIONTIME'])) { $data['data_fakt'] = Date('Y-m-d', round($import_array['OPERATIONTIME'] / 1000)); } $this->db->select('*'); $this->db->from('zavdannya'); $this->db->where('sd_task_id', $import_array['WORKORDERID']); $this->db->where('date_begin', $date_begin); $this->db->where('date_zapl_zaversh', $date_end); $cheked = $this->db->get()->result_array(); if ($cheked) { return 'Запис вже існує'; } else { $res = $this->db->insert('zavdannya', $data); if ($this->db->affected_rows() > 0) { return true; } else { return false; } } }
public function Listar($query = null) { $permissoes = listarAcesso(); try { if ($query == null) { $data = Date("Y-m-d"); $stmt = $this->p->query("SELECT nome, id FROM " . MYSQL_BASE_EMPRESAS . " WHERE ativo='S' ORDER BY id DESC"); $confirm = "return confirm('Deseja remover esse registro?');"; foreach ($stmt as $item) { echo '<tr>'; echo ' <td>' . $item['nome'] . '</td>'; echo ' <td>'; if (in_array(224, $permissoes)) { echo '<a class="btn btn-info" href="edit.php?id=' . $item['id'] . '">'; echo ' <i class="icon-edit icon-white"></i> Editar'; echo ' </a>'; } if (in_array(225, $permissoes)) { echo ' <a class="btn btn-danger" onclick="' . $confirm . '" href="index.php?cmd=del&id=' . $item['id'] . '">'; echo ' <i class="icon-trash icon-white"></i> Deletar'; echo ' </a>'; } echo ' </td>'; echo '</tr>'; } } else { $stmt = $this->p->query($query); } $this->p = null; return $stmt; } catch (PDOException $ex) { echo "Erro: " . $ex->getMessage(); } }
protected function process() { $this->ejercicio = new ejercicio(); if (isset($_POST['cantidad'])) { $this->cantidad = floatval($_POST['cantidad']); } else { if (isset($_GET['cantidad'])) { $this->cantidad = floatval($_GET['cantidad']); } else { $this->cantidad = 3005.06; } } if (isset($_POST['ejercicio'])) { $this->sejercicio = $_POST['ejercicio']; } else { if (isset($_GET['eje'])) { $this->sejercicio = $_GET['eje']; } else { $this->sejercicio = Date('Y'); } } $this->datos_cli = $this->informe_clientes(); $this->datos_pro = $this->informe_proveedores(); if (isset($_GET['eje'])) { $this->excel(); } else { $this->buttons[] = new fs_button('b_download', 'Descargar', $this->url() . '&eje=' . $this->sejercicio . '&cantidad=' . $this->cantidad); } }
function data_atual() { // data completa $data_atual = Date("d-m-Y G:i:s"); // retorna data return $data_atual; }
function data_atual() { $data_atual = Date("d-m-y G:i:s"); // data atual return $data_atual; // retorna data }
public function guardar_ncf($idempresa, $factura, $tipo_comprobante, $numero_ncf, $motivo = false) { if ($numero_ncf['NCF'] == 'NO_DISPONIBLE') { return $this->new_error_msg('No hay números NCF disponibles del tipo ' . $tipo_comprobante . ', la factura ' . $factura->idfactura . ' se creo sin NCF.'); } else { $ncf_factura = new ncf_ventas(); $ncf_factura->idempresa = $idempresa; $ncf_factura->codalmacen = $factura->codalmacen; $ncf_factura->entidad = $factura->codcliente; $ncf_factura->cifnif = $factura->cifnif; $ncf_factura->documento = $factura->idfactura; $ncf_factura->fecha = $factura->fecha; $ncf_factura->tipo_comprobante = $tipo_comprobante; $ncf_factura->ncf = $numero_ncf['NCF']; $ncf_factura->usuario_creacion = $this->user->nick; $ncf_factura->fecha_creacion = Date('d-m-Y H:i:s'); $ncf_factura->estado = TRUE; if ($factura->idfacturarect) { $ncf_orig = new ncf_ventas(); $val_ncf = $ncf_orig->get_ncf($this->empresa->id, $factura->idfacturarect, $factura->codcliente); $ncf_factura->documento_modifica = $factura->idfacturarect; $ncf_factura->ncf_modifica = $val_ncf->ncf; $ncf_factura->motivo = $motivo; } if (!$ncf_factura->save()) { return $this->new_error_msg('Ocurrió un error al grabar la factura ' . $factura->idfactura . ' con el NCF: ' . $numero_ncf['NCF'] . ' Anule la factura e intentelo nuevamente.'); } else { $this->ncf_rango->update($ncf_factura->idempresa, $ncf_factura->codalmacen, $numero_ncf['SOLICITUD'], $numero_ncf['NCF'], $this->user->nick); } } }
public function __construct($p = FALSE) { parent::__construct('pagos', 'plugins/tesoreria/'); if ($p) { $this->id = $this->intval($p['id']); $this->idfactura = $this->intval($p['idfactura']); $this->idalbaran = $this->intval($p['idalbaran']); $this->idpedido = $this->intval($p['idpedido']); $this->idrecibo = $this->intval($p['idrecibo']); $this->fase = $p['fase']; $this->fecha = Date('d-m-Y', strtotime($p['fecha'])); $this->importe = floatval($p['importe']); $this->nota = $p['nota']; } else { $this->id = NULL; $this->idfactura = NULL; $this->idalbaran = NULL; $this->idpedido = NULL; $this->idrecibo = NULL; $this->fase = '-'; $this->fecha = Date('d-m-Y'); $this->importe = 0; $this->nota = ''; } $this->pendiente = 0; }
function generate() { /* INV-ddmmyyyXXXXX (INV-0206201500356) */ // $lastInvoice = "INV-270720150001"; $orders = new Order(); $lastOrder = $orders->orderBy('created_at', 'desc')->first(); if ($lastOrder) { $lastInvoice = $lastOrder->invoice_no; } # date configuration $date = Date('d'); $month = Date('m'); $year = Date('Y'); $newInvoice = ""; if (!$lastOrder || !$lastInvoice) { $newInvoice = "INV-" . $date . $month . $year . "0001"; } else { #get the month of the lastInvoice $last_inv_month = substr($lastInvoice, 6, 2); if (!$last_inv_month == $month) { $increment = "0001"; } else { #get last four digit of last invoice number $zeroDigits = ""; $invoice_length = strlen($lastInvoice); $last_increment = intval(substr($lastInvoice, $lastInvoice - 4, 4)); for ($c = 0; $c < 4 - $last_increment; $c++) { $zeroDigits = $zeroDigits . "0"; } $new_increment = strval($last_increment + 1); $newInvoice = "INV-" . $date . $month . $year . $zeroDigits . $new_increment; } } return $newInvoice; }
public static function getTeacherById($id) { $teacher = Teachers::findOne(['id' => $id]); $retVal = array(); $retVal['id'] = $teacher->id; $retVal['name'] = $teacher->name; $retVal['description'] = $teacher->description; $retVal['avatar'] = $teacher->avatar; $retVal['email'] = $teacher->email; $retVal['phone'] = $teacher->phone; $retVal['website'] = $teacher->website; $retVal['address'] = $teacher->address; $retVal['research'] = $teacher->research; if ($teacher->number_rated != 0) { $retVal['stars'] = round($teacher->stars / $teacher->number_rated); $retVal['number_rated'] = $teacher->number_rated; } else { $retVal['stars'] = 1; $retVal['number_rated'] = 1; } $retVal['department'] = Departments::findOne(['id' => $teacher->department])->name; $retVal['created_at'] = Date('d/m/Y', $teacher->created_at); $retVal['updated_at'] = Date('d/m/Y', $teacher->updated_at); return $retVal; }
public function __construct($a = FALSE) { parent::__construct('co_asientos', 'plugins/facturacion_base/'); if ($a) { $this->idasiento = $this->intval($a['idasiento']); $this->numero = $this->intval($a['numero']); $this->idconcepto = $a['idconcepto']; $this->concepto = '---'; if ($a['concepto'] != '') { $this->concepto = $a['concepto']; } $this->fecha = Date('d-m-Y', strtotime($a['fecha'])); $this->codejercicio = $a['codejercicio']; $this->codplanasiento = $a['codplanasiento']; $this->editable = $this->str2bool($a['editable']); $this->documento = $a['documento']; $this->tipodocumento = $a['tipodocumento']; $this->importe = floatval($a['importe']); } else { $this->idasiento = NULL; $this->numero = NULL; $this->idconcepto = NULL; $this->concepto = NULL; $this->fecha = Date('d-m-Y'); $this->codejercicio = NULL; $this->codplanasiento = NULL; $this->editable = TRUE; $this->documento = NULL; $this->tipodocumento = NULL; $this->importe = 0; } }
public function get_owner() { $day = Date('Y-m-d', strtotime('now') - 86400); $dao = Model_ReportDayOnlineOwner::data_access(); $data = $dao->filter(Model_ReportDayOnlineOwner::Day, $day)->find(); return $data; }
public function Execute() { $rootActivity = $this->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $historyService = $this->workflow->GetService("HistoryService"); $documentService = $this->workflow->GetService("DocumentService"); $userId = CBPHelper::ExtractUsers($this->UserId, $documentId, true); if ($userId == null || intval($userId) <= 0) { $userId = 1; } $historyIndex = $historyService->AddHistory(array("DOCUMENT_ID" => $documentId, "NAME" => "New", "DOCUMENT" => null, "USER_ID" => $userId)); $arDocument = $documentService->GetDocumentForHistory($documentId, $historyIndex); if (!is_array($arDocument)) { return CBPActivityExecutionStatus::Closed; } $name = $this->Name; if ($name == null || strlen($name) <= 0) { if (array_key_exists("NAME", $arDocument) && is_string($arDocument["NAME"]) && strlen($arDocument["NAME"]) > 0) { $name = $arDocument["NAME"]; } elseif (array_key_exists("TITLE", $arDocument) && is_string($arDocument["TITLE"]) && strlen($arDocument["TITLE"]) > 0) { $name = $arDocument["TITLE"]; } else { $name = Date("Y-m-d H:i:s"); } } $historyService->UpdateHistory($historyIndex, array("NAME" => $name, "DOCUMENT" => $arDocument)); return CBPActivityExecutionStatus::Closed; }
/** * ChartData * @return type */ public function ChartData() { $date2 = strtotime(Date('Y-m-d')); $date3 = Date('Y-m-d'); $format = 'Y-m-d'; $date1 = strtotime(Date($format, strtotime('-1 month' . $date3))); $return = ""; $last = ""; for ($i = $date1; $i <= $date2; $i = $i + 86400) { $thisDate = date('Y-m-d', $i); $created = \DB::table('tickets')->select('created_at')->where('created_at', 'LIKE', '%' . $thisDate . '%')->count(); $closed = \DB::table('tickets')->select('closed_at')->where('closed_at', 'LIKE', '%' . $thisDate . '%')->count(); $reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at', 'LIKE', '%' . $thisDate . '%')->count(); $value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened]; $array = array_map('htmlentities', $value); $json = html_entity_decode(json_encode($array)); $return .= $json . ','; } $last = rtrim($return, ','); return '[' . $last . ']'; // $ticketlist = DB::table('tickets') // ->select(DB::raw('MONTH(updated_at) as month'),DB::raw('SUM(CASE WHEN status = 3 THEN 1 ELSE 0 END) as closed'),DB::raw('SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) as reopened'),DB::raw('SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) as open'), // DB::raw('count(*) as totaltickets')) // ->groupBy('month') // ->orderBy('month', 'asc') // ->get(); // return $ticketlist; }
/** * Function to get call details(polling) * return <array> calls */ public function searchIncomingCall() { $db = PearDatabase::getInstance(); $query = 'SELECT * FROM ' . self::moduletableName . ' AS module_table INNER JOIN ' . self::entitytableName . ' AS entity_table WHERE module_table.callstatus IN(?,?) AND module_table.direction=? AND module_table.pbxmanagerid=entity_table.crmid AND entity_table.deleted=0'; $result = $db->pquery($query, array('ringing', 'in-progress', 'inbound')); $recordModels = array(); $rowCount = $db->num_rows($result); for ($i = 0; $i < $rowCount; $i++) { $rowData = $db->query_result_rowdata($result, $i); $record = new self(); $record->setData($rowData); $recordModels[] = $record; //To check if the call status is 'ringing' for >5min $starttime = strtotime($rowData['starttime']); $currenttime = strtotime(Date('y-m-d H:i:s')); $timeDiff = $currenttime - $starttime; if ($timeDiff > 300 && $rowData['callstatus'] == 'ringing') { $recordIds[] = $rowData['crmid']; } //END } if (count($recordIds)) { $this->updateCallStatus($recordIds); } return $recordModels; }
public function upload($file, $randomName = false) { $this->validate($file); if ($this->error) { if ($this->printError) { print $this->error; } } else { if ($randomName) { $i = $this->fileIndex; $ext = $this->getExtension($file); $date = Date('Y-m-d H:i:s'); $name = $this->getFileValue($file, 'name'); $this->setFileName(md5($date . $name) . ".{$ext}"); } $this->uploadedUrl = $this->destination . $this->fileName; $temp = $name = $this->getFileValue($file, 'tmp_name'); $move = move_uploaded_file($temp, $this->uploadedUrl); if (!$move) { $this->status = 0; $this->error .= 'Destination Directory Permission Problem.<br />'; $this->uploadedUrl = ''; } else { $this->status = 1; } if ($this->error && $this->printError) { print $this->error; } } }
public static function getGrade($user, $schoolAge) { switch ($schoolAge) { case '0': return '准大一'; break; case '1': return '大一'; break; case '2': return '大二'; break; case '3': return '大三'; break; case '4': return '大四'; break; default: $thisYear = Date("Y"); if ($user->gender == "M") { $gender = "学长"; } else { $gender = "学姐"; } return $thisYear - $schoolAge + 4 . "届" . $gender; break; } }
public function favorite() { $aMessage = array(); if (!Backend::validateUser()) { $aMessage['status'] = false; $aMessage['message'] = "You're not logged in"; echo json_encode($aMessage); exit; } $aRequest = \Request::all(); $aSession = \Session::all(); //dd(\Session::all()['id_user']); $aParams = array('id_user' => $aSession['id_user']); $aParams['type'] = $aRequest['type']; $aParams['id_favorite'] = $aRequest['id_' . $aRequest['type']]; $aParams['date_inserted'] = Date("Y-m-d h:i:s"); $bExsist = DB::table("user_favorites")->where(array('id_favorite' => $aParams['id_favorite'], 'id_user' => $aParams['id_user']))->get(array("*")); if (!empty($bExsist[0])) { $aMessage['status'] = true; $aMessage['message'] = ""; echo json_encode($aMessage); exit; } DB::table("user_favorites")->insert($aParams); $aMessage['status'] = true; $aMessage['message'] = "Done!"; echo json_encode($aMessage); exit; }