function grava_dados()
 {
     if (!$this->check_dados()) {
         return;
     }
     $db = new Database($this, false);
     if (!$db->link) {
         return;
     }
     $anotacoes = $this->anotacoes->get_text();
     $sql = 'call SP_Mov_Conta_Receber_Del';
     $data = $sql . '(' . String($this->CodId) . ',' . String($anotacoes) . ',' . $GLOBALS['CodUsuario'] . ');';
     if (!$db->multi_query($data)) {
         return;
     }
     if (!($line = $db->line())) {
         return;
     }
     $db->free_result();
     $this->Parent->pega_dados_mov();
     new Message($this, $line['Mensagem']);
     return true;
 }
Example #2
0
 function free_result($id)
 {
     parent::free_result($id);
     return @pg_free_result($id);
 }
 function grava_dados()
 {
     if (!$this->check_dados()) {
         return;
     }
     $db = new Database($this, false);
     if (!$db->link) {
         return;
     }
     $endereco = $this->endereco->get_text();
     $bairro = $this->bairro->get_text();
     $cep = $this->cep->get_text();
     $cidade = $this->cidade->get_text();
     $contato = $this->contato->get_text();
     $fone = $this->fone->get_text();
     $referencia = $this->referencia->get_text();
     if ($this->operacao == 'i') {
         $sql = 'call SP_End_Transportadora_Inc';
     } else {
         $sql = 'call SP_End_Transportadora_Alt';
     }
     $data = $sql . '(' . String($this->CodId) . ',' . String($this->CodTrans) . ',' . String($this->tipo->CodTipoEndereco) . ',' . String($endereco) . ',' . String($cep) . ',' . String($bairro) . ',' . String($cidade) . ',' . String($this->estado->CodEstado) . ',' . String($contato) . ',' . String($fone) . ',' . String($referencia) . ',' . $GLOBALS['CodUsuario'] . ');';
     if (!$db->multi_query($data)) {
         return;
     }
     if (!($line = $db->line())) {
         return;
     }
     $db->free_result();
     new Message($this, $line['Mensagem']);
     return true;
 }
 /**
  * @author Sebastien Piraux <*****@*****.**>
  * @param sql : a sql query (as a string)
  * @return month_array
  * @desc        Return an assoc array.  Keys are the days, values are
  * the number of time this hours was found.
  * key "total" return the sum of all number of time days
  * appear
  */
 public static function monthTab($sql)
 {
     $MonthsLong = api_get_months_long();
     $month_array = array('total' => 0);
     $res = Database::query($sql);
     if ($res !== false) {
         // init tab with all months
         for ($i = 0; $i < 12; $i++) {
             $month_array[$MonthsLong[$i]] = 0;
         }
         while ($row = Database::fetch_row($res)) {
             $date_array = getdate($row[0]);
             $month_array[$MonthsLong[$date_array['mon'] - 1]]++;
             $month_array['total']++;
         }
         Database::free_result($res);
     }
     return $month_array;
 }
 function grava_dados()
 {
     if (!$this->check_dados()) {
         return;
     }
     $db = new Database($this, false);
     if (!$db->link) {
         return;
     }
     $num_doc = $this->num_doc->get_text();
     $parcela = $this->parcela->get_text();
     $vencimento = CDate($this->vencimento->get_text());
     $valor = CommaToPoint($this->valor->get_text());
     $anotacoes = $this->anotacoes->get_text();
     if ($this->operacao == 'i') {
         $sql = 'call SP_Conta_Receber_Inc';
     } else {
         $sql = 'call SP_Conta_Receber_Alt';
     }
     $data = $sql . '(' . String($this->tipo_doc->CodTipoDoc) . ',' . String($this->filial->CodFilial) . ',' . String($this->clientes->CodCliente) . ',' . String($num_doc) . ',' . String($parcela) . ',' . String($vencimento) . ',' . String($valor) . ',' . String($anotacoes) . ',' . $GLOBALS['CodUsuario'] . ');';
     if (!$db->multi_query($data)) {
         return;
     }
     $line = $db->line();
     $db->free_result();
     new Message($this, $line['Mensagem']);
     return true;
 }
Example #6
0
 function grava_dados()
 {
     if (!$this->check_dados()) {
         return;
     }
     $db = new Database($this, false);
     if (!$db->link) {
         return;
     }
     $nome = $this->nome->get_text();
     $cpf = $this->cpf->get_text();
     $fantasia = $this->fantasia->get_text();
     $ie = $this->ie->get_text();
     $suframa = $this->suframa->get_text();
     $fone = $this->fone->get_text();
     $fone2 = $this->fone2->get_text();
     $fax = $this->fax->get_text();
     $fax2 = $this->fax2->get_text();
     $email = $this->email->get_text();
     $url = $this->site->get_text();
     $anotacoes = $this->anotacoes->get_text();
     $limite_compra = $this->limite_compra->get_text();
     $ativo = $this->ativo->get_active();
     if ($this->operacao == 'i') {
         $sql = 'call SP_Fornecedor_Inc';
     } else {
         $sql = 'call SP_Fornecedor_Alt';
     }
     $data = $sql . '(' . String($this->CodFor) . ',' . String($this->pessoa->CodTipoPessoa) . ',' . String($nome) . ',' . String($cpf) . ',' . String($fantasia) . ',' . String($ie) . ',' . String($suframa) . ',' . String($fone) . ',' . String($fone2) . ',' . String($fax) . ',' . String($fax2) . ',' . String($email) . ',' . String($url) . ',' . String($anotacoes) . ',' . String(CommaToPoint($limite_compra)) . ',' . String($ativo) . ',' . $GLOBALS['CodUsuario'] . ');';
     if (!$db->multi_query($data)) {
         return;
     }
     $line = $db->line();
     new Message($this, $line['Mensagem']);
     $db->free_result();
     return true;
 }
Example #7
0
 function grava_dados()
 {
     if (!$this->check_dados()) {
         return;
     }
     $db = new Database($this, false);
     if (!$db->link) {
         return;
     }
     $modelo = $this->modelo->get_text();
     $descricao = $this->descricao->get_text();
     $custo = $this->custo->get_text();
     $margem = $this->margem->get_text();
     $percentual = $this->percentual->get_text();
     $icms = $this->icms->get_text();
     $ipi = $this->ipi->get_text();
     $clas_fiscal = $this->clas_fiscal->get_text();
     $qtde_minima = $this->qtde_minima->get_text();
     $cota_compra = $this->cota_compra->get_text();
     $cota_venda = $this->cota_venda->get_text();
     if ($this->operacao == 'i') {
         $sql = 'call SP_Produto_Inc';
     } else {
         $sql = 'call SP_Produto_Alt';
     }
     $data = $sql . '(' . String($this->CodProduto) . ',' . String($this->situacao->CodSitProduto) . ',' . String($this->tipo->CodTipoProduto) . ',' . String($this->ativo->get_active()) . ',' . String($this->grupos->CodGrupo) . ',' . String($this->marcas->CodMarca) . ',' . String($modelo) . ',' . String($descricao) . ',' . String(CommaToPoint($custo)) . ',' . String(CommaToPoint($margem)) . ',' . String(CommaToPoint($percentual)) . ',' . String($icms) . ',' . String($ipi) . ',' . String($clas_fiscal) . ',' . String($qtde_minima) . ',' . String($cota_compra) . ',' . String($cota_venda) . ',' . String($this->unid_compra->CodUnidCompra) . ',' . String($this->unid_venda->CodUnidVenda) . ',' . String($this->unid_estoque->CodUnidEstoque) . ',' . $GLOBALS['CodUsuario'] . ');';
     if (!$db->multi_query($data)) {
         return;
     }
     $line = $db->line();
     $db->free_result();
     new Message($this, $line['Mensagem']);
     return true;
 }
 function grava_dados()
 {
     if (!$this->check_dados()) {
         return;
     }
     $db = new Database($this, false);
     if (!$db->link) {
         return;
     }
     $nome = $this->nome->get_text();
     if ($this->operacao == 'i') {
         $sql = 'call SP_Unid_Estoque_Inc';
     } else {
         $sql = 'call SP_Unid_Estoque_Alt';
     }
     $data = $sql . '(' . String($this->CodUnidade) . ',' . String($nome) . ',' . $GLOBALS['CodUsuario'] . ');';
     if (!$db->multi_query($data)) {
         return;
     }
     $line = $db->line();
     $db->free_result();
     new Message($this, $line['Mensagem']);
     return true;
 }
Example #9
0
 function grava_dados()
 {
     if (!$this->check_dados()) {
         return;
     }
     $db = new Database($this, false);
     if (!$db->link) {
         return;
     }
     $nome = $this->nome->get_text();
     $cnpj = $this->cnpj->get_text();
     $razao = $this->razao->get_text();
     $endereco = $this->endereco->get_text();
     $bairro = $this->bairro->get_text();
     $cep = $this->cep->get_text();
     $cidade = $this->cidade->get_text();
     $tel = $this->tel->get_text();
     $fax = $this->fax->get_text();
     $email = $this->email->get_text();
     $url = $this->url->get_text();
     $dominio = $this->dominio->get_text();
     if ($this->operacao == 'i') {
         $sql = 'call SP_Filial_Inc';
     } else {
         $sql = 'call SP_Filial_Alt';
     }
     $data = $sql . '(' . String($this->CodFilial) . ',' . String($this->estado->CodEstado) . ',' . String($nome) . ',' . String($cnpj) . ',' . String($razao) . ',' . String($endereco) . ',' . String($bairro) . ',' . String($cep) . ',' . String($cidade) . ',' . String($tel) . ',' . String($fax) . ',' . String($email) . ',' . String($url) . ',' . String($dominio) . ',' . $GLOBALS['CodUsuario'] . ');';
     if (!$db->multi_query($data)) {
         return;
     }
     $line = $db->line();
     $db->free_result();
     new Message($this, $line['Mensagem']);
     return true;
 }
Example #10
0
ini_set('display_errors', 1);

define ('SUM', 1);

require_once('settings.php');
require_once('Database.php');

$db = new Database($db_info);

echo '<pre>';
$db->query("
	SELECT *
	FROM md_languages");
print_r($db->assoc());
$db->free_result();


$db->query("
	SELECT *
	FROM md_languages");
print_r($db->row());
$db->free_result();

$db->query("
	SELECT *
	FROM md_languages");
print_r($db->row());
$db->free_result();

$db->query("
Example #11
0
 function grava_dados()
 {
     if (!$this->check_dados()) {
         return;
     }
     $db = new Database($this, false);
     if (!$db->link) {
         return;
     }
     if ($this->operacao == 'a') {
         $id = $this->id->get_text();
     }
     $nome = $this->nome->get_text();
     $agencia = $this->agencia->get_text();
     $conta = $this->conta->get_text();
     if ($this->operacao == 'i') {
         $sql = 'call SP_Banco_Inc';
     } else {
         $sql = 'call SP_Banco_Alt';
     }
     $data = $sql . '(' . String($id) . ',' . String($nome) . ',' . String($agencia) . ',' . String($conta) . ',' . String($this->filial->CodFilial) . ',' . $GLOBALS['CodUsuario'] . ');';
     if (!$db->multi_query($data)) {
         return;
     }
     $line = $db->line();
     $db->free_result();
     new Message($this, $line['Mensagem']);
     return true;
 }
Example #12
0
/**
 * @author Sebastien Piraux <*****@*****.**>
 * @return a 2D array filled with code and name of countries
 * @desc This function is used to build an array containing
 	countries informations
 */
function loadCountries() {
    global $TABLESTATS_COUNTRIES;
    $sql = "SELECT code, country
                            FROM $TABLESTATS_COUNTRIES";
    $res = Database::query($sql);
    $i = 0 ;
    if (Database::num_rows($res) > 0){
	    while ($row = Database::fetch_array($res)) {
	            $list_countries[$i][0] = $row["code"];
	            $list_countries[$i][1] = $row["country"];
	            $i++;
	    }
    }
    Database::free_result($res);
    return $list_countries;
}
Example #13
0
 *       on api_get_setting('page_after_login').
 */
if (!empty($_POST['submitAuth'])) {
    // The user has been already authenticated, we are now to find the last login of the user.
    if (isset($_user['user_id'])) {
        $track_login_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
        $sql_last_login = "******" . $_user['user_id'] . "'\n                                ORDER BY login_date DESC LIMIT 1";
        $result_last_login = Database::query($sql_last_login);
        if (!$result_last_login) {
            if (Database::num_rows($result_last_login) > 0) {
                $user_last_login_datetime = Database::fetch_array($result_last_login);
                $user_last_login_datetime = $user_last_login_datetime[0];
                Session::write('user_last_login_datetime', $user_last_login_datetime);
            }
        }
        Database::free_result($result_last_login);
        //event_login();
        if (api_is_platform_admin()) {
            // decode all open event informations and fill the track_c_* tables
            include api_get_path(LIBRARY_PATH) . 'stats.lib.inc.php';
            decodeOpenInfos();
        }
    }
    // End login -- if ($_POST['submitAuth'])
} else {
    // Only if login form was not sent because if the form is sent the user was already on the page.
    event_open();
}
if (api_get_setting('display_categories_on_homepage') == 'true') {
    $controller->tpl->assign('course_category_block', $controller->return_courses_in_categories());
}