function __construct($Owner) { parent::__construct(); $this->pack_start(new GtkLabel(latin1(' Tipo de Endereço: ')), false); $this->store = new GtkListStore(TYPE_STRING, TYPE_LONG); $this->pack_start($this->combobox = new GtkComboBox($this->store)); $this->combobox->pack_start($cell = new GtkCellRendererText()); $this->combobox->set_attributes($cell, 'text', 0); $this->combobox->connect('changed', array($this, 'tipo_endereco_changed')); $this->show_all(); /* * preenche lista */ $db = new Database($Owner, true); if (!$db->link) { return; } /* * Tipo de Endereco */ if (!$db->multi_query('SELECT * FROM Vw_Tipos_Endereco')) { return; } $this->store->clear(); unset($this->it); while ($line = $db->line()) { $row = $this->store->append(); $this->store->set($row, 0, $line['Descricao'], 1, $line['Id']); $this->it[$line['Id']] = $row; } }
function __construct($Parent, $operacao = 'i', $CodTrans, $CodId = null) { parent::__construct($operacao == 'i' ? latin1('Novo endereço') : latin1('Alterar endereço'), null, null, 'enderecos.png'); $this->Parent = $Parent; $this->operacao = $operacao; $this->CodTrans = $CodTrans; $this->CodId = $CodId; // Id e Tipo $this->pack_start($hbox = new GtkHBox()); if ($operacao == 'a') { $hbox->pack_start($id = new GtkLabel(), false); $id->set_markup(' Id.: <b>' . $this->CodId . '</b>'); } $hbox->pack_start($this->tipo = new TTipoEndereco($this)); // endereco $this->pack_start($frame = new GtkFrame()); $frame->add($vbox = new GtkVBox()); $vbox->set_border_width(5); $vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start(new GtkLabel('Endereco: '), false); $hbox->pack_start($this->endereco = new AEntry(true)); // cep $vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start(new GtkLabel('CEP: '), false); $hbox->pack_start($this->cep = new AEntry(true)); // bairro $hbox->pack_start(new GtkLabel('Bairro: '), false); $hbox->pack_start($this->bairro = new AEntry(true)); // cidade $vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start(new GtkLabel('Cidade: '), false); $hbox->pack_start($this->cidade = new AEntry(true)); // estado $hbox->pack_start($this->estado = new TEstados($this)); // contato $this->pack_start($frame = new GtkFrame()); $frame->add($vbox = new GtkVBox()); $vbox->set_border_width(5); $vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start(new GtkLabel('Contato: '), false); $hbox->pack_start($this->contato = new AEntry()); // fone $hbox->pack_start(new GtkLabel('Fone: '), false); $hbox->pack_start($this->fone = new AEntry()); // referencia $vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start(new GtkLabel(latin1('Referência: ')), false); $hbox->pack_start($this->referencia = new AEntry()); // ok e cancelar $this->pack_start($hbbox = new GtkHButtonBox(), false); $hbbox->set_layout(Gtk::BUTTONBOX_END); $hbbox->pack_start($this->ok = GtkButton::new_from_stock('gtk-ok'), false); $this->ok->connect('clicked', array($this, 'ok_clicked')); $hbbox->pack_start($this->cancelar = GtkButton::new_from_stock('gtk-cancel'), false); $this->cancelar->connect('clicked', array($this, 'cancelar_clicked')); $this->cancelar->add_accelerator('clicked', $this->accel_group, Gdk::KEY_Escape, 0, 0); $this->referencia->set_next_focus($this->ok); $this->children_show_all(); $this->endereco->set_focus(); }
function __construct() { parent::__construct('Contas a Pagar', 'contas_pagar.png'); // barra de ferramentas $this->pack_start($toolbar = new TToolbar(), false); $this->lancar = $toolbar->append_stock('gtk-add', 0, array($this, 'lancar_clicked')); $this->lancar->set_label(latin1('Lançar')); $this->baixar = $toolbar->append_stock('gtk-go-down', 1, array($this, 'baixar_clicked')); $this->baixar->set_label('Baixar'); $this->cancelar = $toolbar->append_stock('gtk-cancel', 2, array($this, 'cancelar_clicked')); $this->estornar = $toolbar->append_stock('gtk-cancel', 3, array($this, 'estornar_clicked')); $this->estornar->set_label('Estornar'); $this->info_mov = $toolbar->append_stock('gtk-info', 4, array($this, 'info_mov_clicked')); $this->imprimir = $toolbar->append_stock('gtk-print-preview', 5, array($this, 'imprimir_clicked')); // contas em aberto $this->pack_start($this->notebook = new GtkNotebook()); $this->notebook->append_page($vbox = new GtkVBox(), new GtkLabel(' Em aberto ')); $vbox->pack_start($this->filtro = new TFiltroContasPagar(array($this, 'pega_dados')), false); $vbox->pack_start($this->grid = new TGridContasPagar($this)); // contas pagas baixadas $this->notebook->append_page($vbox = new GtkVBox(), new GtkLabel(' Baixas ')); $vbox->pack_start($this->mov_filtro = new TFiltroMovContasPagar(array($this, 'pega_dados_mov')), false); $vbox->pack_start($this->mov_grid = new TGridMovContasPagar($this)); // contas pagas canceladas $this->notebook->append_page($vbox = new GtkVBox(), new GtkLabel(' Canceladas ')); $vbox->pack_start($this->del_filtro = new TFiltroDelContasPagar(array($this, 'pega_dados_del')), false); $vbox->pack_start($this->del_grid = new TGridDelContasPagar($this)); $this->notebook->connect('switch-page', array($this, 'notebook_switch_page')); $this->notebook->set_current_page(0); $this->lancar->set_sensitive(CheckPermissao($this, 'lancar_conta_pagar')); $this->info_mov->set_sensitive(CheckPermissao($this, 'info_mov_conta_pagar')); $this->imprimir->set_sensitive(CheckPermissao($this, 'imprimir_contas_pagar')); }
function __construct($Parent, $CodId) { parent::__construct('Estornar Conta a Receber', 400, -1, 'contas_receber.png'); $this->Parent = $Parent; $this->CodId = $CodId; // Id. $this->pack_start($hbox = new GtkHBox()); $hbox->pack_start(GtkImage::new_from_stock(Gtk::STOCK_CANCEL, Gtk::ICON_SIZE_DIALOG), false); $hbox->pack_start($label = new GtkLabel(), false); $label->set_markup(' Cod. Id.: <b>' . $CodId . '</b>'); // anotacoes $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start(new GtkLabel(latin1(' Anotações: ')), false); $hbox->pack_start($this->anotacoes = new AEntry(true)); // ok $this->pack_start($hbbox = new GtkHButtonBox(), false); $hbbox->set_layout(Gtk::BUTTONBOX_END); $hbbox->pack_start($this->ok = GtkButton::new_from_stock('gtk-ok'), false); $this->anotacoes->focus_widget = $this->ok; $this->ok->connect('clicked', array($this, 'ok_clicked')); // cancelar $hbbox->pack_start($this->cancelar = GtkButton::new_from_stock('gtk-cancel'), false); $this->cancelar->connect('clicked', array($this, 'cancelar_clicked')); $this->cancelar->add_accelerator('clicked', $this->accel_group, Gdk::KEY_Escape, 0, 0); $this->children_show_all(); $this->anotacoes->grab_focus(); }
function __construct($Parent) { $this->ColId = 0; // $this->ColSel = 9; $this->store = new GtkTreeStore(TYPE_LONG, TYPE_STRING, TYPE_STRING); $this->colunas = array(array('Id.', 'text', 0), array('Nome', 'text', 1), array(latin1('Descrição'), 'text', 2)); parent::__construct($Parent); }
function __construct($Parent) { $this->ColId = 0; // $this->ColSel = 9; $this->store = new GtkTreeStore(TYPE_LONG, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING); $this->colunas = array(array('Id.', 'text', 0), array('Nome', 'text', 1), array(latin1('Razão'), 'text', 2), array('CNPJ', 'text', 3), array('Telefone', 'text', 4), array('Fax', 'text', 5), array('e-mail', 'text', 6), array('Site', 'text', 7)); parent::__construct($Parent); }
function __construct($Parent) { $this->ColId = 0; //$this->ColSel = 9; $this->store = new GtkTreeStore(TYPE_LONG, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING); $this->colunas = array(array('Id.', 'text', 0), array('Filial', 'text', 1), array(latin1('Usuário'), 'text', 2), array('Nome', 'text', 3), array('Perfil', 'text', 4), array('Depto', 'text', 5), array('Cargo', 'text', 6), array('e-mail', 'text', 7)); parent::__construct($Parent); }
function __construct($Parent) { $this->ColId = 1; $this->ColSel = 0; $this->store = new GtkTreeStore(GObject::TYPE_BOOLEAN, TYPE_LONG, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_LONG, TYPE_STRING, TYPE_STRING, TYPE_STRING); $this->colunas = array(array('Sel', 'active', 0), array('Id.', 'text', 1), array('Filial', 'text', 2), array('Fornecedor', 'text', 3), array('Tipo do Doc.', 'text', 4), array('Num. do Doc.', 'text', 5), array('Parcela', 'text', 6), array('Valor do Doc. R$', 'text', 7), array(latin1('Emissão'), 'text', 8), array('Vencimento', 'text', 9)); parent::__construct($Parent); }
function __construct($Parent) { $this->ColId = 0; //$this->ColSel = 16; $this->store = new GtkTreeStore(TYPE_LONG, TYPE_LONG, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING); $this->colunas = array(array('Id.', 'text', 0), array('Cod. Conta', 'text', 1), array('Filial', 'text', 2), array('Fornecedor', 'text', 3), array('Num. do Doc.', 'text', 4), array(latin1('Conta Bancária'), 'text', 5), array('Tipo de Despesa', 'text', 6), array('Forma de Pgto.', 'text', 7), array('Juros R$', 'text', 8), array('Desconto R$', 'text', 9), array('Valor Pago R$', 'text', 10), array('Dia do Pgto.', 'text', 11)); parent::__construct($Parent); }
function __construct($Parent) { $this->ColId = 0; // $this->ColSel = 9; $this->store = new GtkTreeStore(TYPE_LONG, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, GObject::TYPE_BOOLEAN); $this->colunas = array(array('Id.', 'text', 0), array(latin1('Nome / Razão'), 'text', 1), array('Fantasia', 'text', 2), array('CPF / CNPJ', 'text', 3), array('I.E.', 'text', 4), array('Fone', 'text', 5), array('Fone 2', 'text', 6), array('Fax', 'text', 7), array('e-mail', 'text', 8), array('Site', 'text', 9), array(latin1('Anotações'), 'text', 10), array('Limite de Entrega', 'text', 11), array('Ativo', 'active', 12)); parent::__construct($Parent); }
function __construct($Parent) { $this->ColId = 0; // $this->ColSel = 9; $this->store = new GtkTreeStore(TYPE_LONG, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING); $this->colunas = array(array('Id.', 'text', 0), array('Tipo', 'text', 1), array(latin1('Endereço'), 'text', 2), array('CEP', 'text', 3), array('Bairro', 'text', 4), array('Cidade', 'text', 5), array('Estado', 'text', 6), array('Contato', 'text', 7), array('Fone', 'text', 8), array(latin1('Referência'), 'text', 9)); parent::__construct($Parent); }
function email_clicked($about, $address) { $mail_to = 'mailto:' . $address . '?subject=Referente ao X-Money'; printf("Lançando [%s]\n", $mail_to); system($GLOBALS['MAIL_VIEWER'] . ' ' . $mail_to, $result); if ($result != 0) { new Message($this->Owner, latin1('Ops! Não consegui executar o seu cliente de e-mail!'), Gtk::MESSAGE_ERROR); } }
function criar_filtro() { $hbox = $this->add_button('id', $id = new TInteger()); $id->set_filter('Id', 'Tb_Clientes.Cod_S_Cli', ' Id.: '); $this->add_button('nome_cliente', $nome = new TString(), $hbox); $nome->set_filter('Nome', 'Tb_Clientes.Nome', latin1(' Nome / Razão: ')); $this->add_button('tipo_pessoa', new TTipoPessoa(null), $hbox); $hbox = $this->add_button('cpf', $cpf = new TString()); $cpf->set_filter('CPF', 'Tb_Clientes.CPF', ' CPF / CNPJ: '); $this->add_button('fone', $fone = new TString(), $hbox); $fone->set_filter('Fone', 'Tb_Clientes.Fone', ' Fone: '); $this->add_button('email', $email = new TString(), $hbox); $email->set_filter('Email', 'Tb_Clientes.Email', ' e-mail: '); }
function criar_filtro() { $hbox = $this->add_button('id', $id = new TInteger()); $id->set_filter('Id', 'Tb_Produtos.Cod_S_Produto', ' Id.: '); $this->add_button('tipo', new TTipoProduto(null), $hbox); $this->add_button('status', new TSitProduto(null), $hbox); $hbox = $this->add_button('grupo', $grupo = new TString()); $grupo->set_filter('Grupo', 'Tb_Grupos.Nome', ' Grupo: '); $this->add_button('marca', $marca = new TString(), $hbox); $marca->set_filter('Marca', 'Tb_Marcas.Nome', ' Marca: '); $hbox = $this->add_button('modelo', $modelo = new TString()); $modelo->set_filter('Modelo', 'Tb_Produtos.Modelo', ' Modelo: '); $this->add_button('desc', $desc = new TString(), $hbox); $desc->set_filter('Descricao', 'Tb_Produtos.Descricao', latin1(' Descrição: ')); }
function run() { $db = new Database($this, true); if (!$db->link) { exit(1); } while (true) { $this->username->grab_focus(); $response = parent::run(); $username = $this->username->get_text(); $password = $this->password->get_text(); if ($response != Gtk::RESPONSE_OK) { exit(1); } if (!$username || !$password) { new Message($this, latin1('Usuário e senha devem ser informados!'), Gtk::MESSAGE_ERROR); continue; } $sql = 'SELECT Cod_S_Usuario FROM Tb_Usuarios WHERE Ativo = 1 AND Senha LIKE ' . String(md5($username . '@' . $password)); if (!$db->multi_query($sql)) { continue; } if (!($line = $db->line())) { new Message($this, latin1('Usuário ou senha incorreta!', Gtk::MESSAGE_ERROR)); continue; } else { $CodUsuario = $line['Cod_S_Usuario']; putenv('XMONEY_UID=' . $CodUsuario); } $sql = 'SELECT * FROM Vw_Usuario_Filial WHERE CodUsuario = ' . $CodUsuario; if (!$db->multi_query($sql)) { continue; } if (!($line = $db->line())) { new Message($this, latin1('Usuário não encontrado!', Gtk::MESSAGE_ERROR)); continue; } else { $GLOBALS['CodUsuario'] = $CodUsuario; $GLOBALS['Usuario'] = $line['Usuario']; $GLOBALS['Nome'] = $line['Nome']; $GLOBALS['CodFilial'] = $line['CodFilial']; $GLOBALS['Filial'] = $line['Filial']; $GLOBALS['CodPerfil'] = $line['CodPerfil']; $GLOBALS['Perfil'] = $line['Perfil']; break; } } }
function CheckPermissao($Owner, $tag, $show = false) { $db = new Database($Owner, true); if (!$db->link) { return; } $sql = 'SELECT * FROM Vw_Permissoes'; $db->multi_query($sql . ' WHERE CodPerfil = ' . $GLOBALS['CodPerfil'] . ' AND Alias = ' . String($tag)); if ($db->line()) { return true; } else { if ($show) { new Message($Owner, latin1('Você não tem permissão para acessar esse recurso no sistema!')); } } }
function error() { switch ($this->link->errno) { case 1062: new Message($this->Parent, latin1('Alguma informação semelhante já existe no sistema!')); break; case 1451: new Message($this->Parent, latin1('Esse registro é necessário em outras tabelas do sistema!')); break; case 1452: new Message($this->Parent, 'Selecione todos os dados das listas suspensas!'); break; default: new Message($this->Parent, 'Erro: ' . $this->link->errno . "\n" . $this->link->error, Gtk::MESSAGE_ERROR); break; } }
function __construct($Parent, $operacao = 'i', $CodConta = null) { parent::__construct($operacao == 'i' ? 'Contas a Pagar - Incluir' : 'Contas a Pagar - Alterar', null, null, 'contas_pagar.png'); $this->Parent = $Parent; $this->operacao = $operacao; $this->CodConta = $CodConta; // tipo doc. $this->pack_start($this->tipo_doc = new TTipoDoc($this)); // filial $this->pack_start($this->filial = new TFiliais($this)); // Fornecedor $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start($this->fornecedores = new TFornecedores($this)); // num doc $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start($this->num_doc = new AEntry(true)); $this->num_doc->label->set_text(' Num. Doc.: '); // parcela $hbox->pack_start($this->parcela = new IEntry(true)); $this->parcela->label->set_text(' Parcela: '); // vencimento $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start($this->vencimento = new TData(true)); $this->vencimento->label->set_text(' Vencimento: '); // valor $hbox->pack_start($this->valor = new TFloat(true)); $this->valor->label->set_text(' Valor: '); // anotacoes $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start($this->anotacoes = new AEntry()); $this->anotacoes->label->set_text(latin1(' Anotações ')); // ok $this->pack_start($hbbox = new GtkHButtonBox(), false); $hbbox->set_layout(Gtk::BUTTONBOX_END); $hbbox->pack_start($this->ok = GtkButton::new_from_stock('gtk-ok'), false); $this->anotacoes->focus_widget = $this->ok; $this->ok->connect('clicked', array($this, 'ok_clicked')); // cancelar $hbbox->pack_start($this->cancelar = GtkButton::new_from_stock('gtk-cancel'), false); $this->cancelar->connect('clicked', array($this, 'cancelar_clicked')); $this->cancelar->add_accelerator('clicked', $this->accel_group, Gdk::KEY_Escape, 0, 0); // extra $this->children_show_all(); $this->anotacoes->set_next_focus($this->ok); $this->fornecedores->entry->grab_focus(); }
function __construct($Parent, $CodConta) { parent::__construct(latin1('Movimentação da Conta'), 600, 300, 'contas_receber.png'); $this->Parent = $Parent; $this->CodConta = $CodConta; // CodConta, TipoDoc e NumDoc $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start($this->cod_conta = new GtkLabel()); $hbox->pack_start($this->tipo_doc = new GtkLabel()); $hbox->pack_start($this->num_doc = new GtkLabel()); $this->pack_start($vbox = new GtkVBox()); $vbox->pack_start($this->grid = new TGridInfoMovContaReceber($this)); $vbox->pack_start($this->fechar = GtkButton::new_from_stock('gtk-close'), false); $this->fechar->add_accelerator('clicked', $this->accel_group, Gdk::KEY_Escape, 0, 0); $this->fechar->connect('clicked', array($this, 'fechar_clicked')); $this->children_show_all(); }
function criar_filtro() { $hbox = $this->add_button('id', $id = new TInteger()); $id->set_filter('Id', 'Tb_Contas_Pagar.Cod_S_Conta', ' Id.: '); $this->add_button('filial', new TFiliais(null), $hbox); $this->add_button('tipo', new TTipoDoc(null), $hbox); $hbox = $this->add_button('fornec', $fornec = new TString()); $fornec->set_filter('Fornecedor', 'Tb_Fornecedores.Nome', ' Fornecedor: ', ''); $this->add_button('ndoc', $ndoc = new TString(), $hbox); $ndoc->set_filter('NumDoc', 'NumDoc', ' Num. do Doc.: '); $hbox = $this->add_button('valor_doc', $valor_doc = new TFloat()); $valor_doc->set_filter('ValorDoc', 'ValorDoc', ' Valor do Doc.: '); $this->add_button('n_parc', $n_parc = new TInteger(), $hbox); $n_parc->set_filter('Parcela', 'Parcela', ' Parcela: '); $this->add_button('dat_emi', $dat_emi = new TData(), $hbox); $dat_emi->set_filter('Emissao', 'Tb_Contas_Pagar.DataInc', latin1(' Emissão: ')); $this->add_button('dat_venc', $dat_venc = new TData(), $hbox); $dat_venc->set_filter('Vencimento', 'Tb_Contas_Pagar.Vencimento', ' Vencimento: '); }
function impressao_geral($modulo, $filtro = null) { file_put_contents(XMONEY_SPOOL . DIRECTORY_SEPARATOR . $GLOBALS['CodUsuario'] . '.sql', $filtro); if (($fp = popen(XMONEY_IMP_GERAL . ' ' . XMONEY_DATABASES . DIRECTORY_SEPARATOR . $GLOBALS['DB_CONNECTION_NAME'] . '/print/' . $modulo, 'r')) < 0) { new Message($GLOBALS['XMONEY_JANELA_PRINCIPAL'], latin1('Ops! Não consegui gerar o relatório de impressão!'), Gtk::MESSAGE_ERROR); return; } else { while (!feof($fp)) { print fread($fp, 1024); flush(); } pclose($fp); } if (vis_impressao() != 0) { new Message($this, latin1('Ops! Não consegui executar o visualizador de impressão!'), Gtk::MESSAGE_ERROR); return; } return true; }
function check_dados($instance = null) { $result = true; $entry_class = 'TEntry'; foreach ($this as $child) { if ($child instanceof $entry_class) { if (!$child->check_required(true)) { new Message($this, latin1('Ops! Este campo é requerido!'), Gtk::MESSAGE_WARNING); $result = false; break; } if (!$child->check_duplicated($this, true)) { new Message($this, latin1('Ops! Já existe um registro com o mesmo valor deste campo!'), Gtk::MESSAGE_WARNING); $result = false; break; } } } return $result; }
function __construct() { parent::__construct('Transportadoras', 'transportadoras.png'); // barra de ferramentas $this->pack_start($toolbar = new TToolbar(), false); $this->incluir = $toolbar->append_stock('gtk-add', 0, array($this, 'novo_clicked')); $this->alterar = $toolbar->append_stock('gtk-edit', 1, array($this, 'editar_clicked')); $this->excluir = $toolbar->append_stock('gtk-delete', 2, array($this, 'excluir_clicked')); $this->enderecos = $toolbar->append('enderecos.png', latin1('Endereços'), 3, array($this, 'enderecos_clicked')); $this->imprimir = $toolbar->append_stock('gtk-print-preview', 4, array($this, 'imprimir_clicked')); // filtro $this->pack_start($this->filtro = new TFiltroTransportadoras(array($this, 'pega_dados')), false); // grid $this->pack_start($this->grid = new TGridTransportadoras($this)); $this->filtro->set_focus(); $this->incluir->set_sensitive(CheckPermissao($this, 'incluir_transportadora')); $this->alterar->set_sensitive(CheckPermissao($this, 'alterar_transportadora')); $this->excluir->set_sensitive(CheckPermissao($this, 'excluir_transportadora')); $this->imprimir->set_sensitive(CheckPermissao($this, 'imprimir_transportadoras')); $this->enderecos->set_sensitive(CheckPermissao($this, 'enderecos_transportadora')); }
function excluir_clicked() { if (!$this->grid->pega_dados()) { return; } $id = $this->grid->Valores[0]; $dialog = new Question($this->Owner, latin1(' Deseja mesmo remover o endereço selecionado ? ')); $resp = $dialog->ask(); if ($resp != Gtk::RESPONSE_YES) { return; } $sql = ' DELETE FROM Tb_End_Fornecedores WHERE Cod_S_Endereco = ' . $id; $db = new Database($this->Owner, false); if (!$db->link) { return; } if (!$db->query($sql)) { return; } $this->pega_dados(); new Message($this->Owner, 'Endereco for fornecedor removido com sucesso!'); }
function excluir_clicked() { if (!$this->grid->pega_dados()) { return; } $id = $this->grid->Valores[0]; $dialog = new Question($this->Owner, latin1('Deseja mesmo remover a situação de produto selecionado?')); $result = $dialog->ask(); if ($result != Gtk::RESPONSE_YES) { return; } $db = new Database($this->Owner, false); if (!$db->link) { return; } $sql = 'DELETE FROM Tb_Sit_Produtos WHERE Cod_S_Sit = ' . $id; if (!$db->query($sql)) { return; } $this->pega_dados(); new Message($this->Owner, latin1('Situação de produto removido com sucesso!')); }
function excluir_clicked() { if (!$this->grid->pega_dados()) { return; } $id = $this->grid->Valores[0]; $dialog = new Question($this->Owner, latin1('Deseja mesmo remover a unidade de venda selecionada?')); $result = $dialog->ask(); if ($result != Gtk::RESPONSE_YES) { return; } $db = new Database($this->Owner, false); if (!$db->link) { return; } $sql = 'DELETE FROM Tb_Unid_Vendas WHERE Cod_S_Unidade = ' . $id; if (!$db->query($sql)) { return; } $this->pega_dados(); new Message($this->Owner, 'Unidade de venda removida com sucesso!'); }
function __construct($Parent, $operacao = 'i', $CodUnidade = null) { parent::__construct($operacao == 'i' ? 'Unidade de Compra - Incluir' : 'Unidade de Compra - Alterar', null, null, 'unid_compras.png'); $this->Parent = $Parent; $this->operacao = $operacao; $this->CodUnidade = $CodUnidade; $GLOBALS['XMONEY_FIELD'] = 'Cod_S_Unidade'; $GLOBALS['XMONEY_FIELD_ID'] = $CodUnidade ? $CodUnidade : -1; // Id $this->pack_start($hbox = new GtkHBox()); if ($operacao == 'a') { $hbox->pack_start($id = new GtkLabel(), false); $id->set_markup(' Id.: <b>' . $CodUnidade . '</b>'); } // nome $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start(new GtkLabel(' Nome: '), false); $hbox->pack_start($this->nome = new AEntry(true, true, 'Tb_Unid_Compras', 'Nome')); // descricao $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start(new GtkLabel(latin1(' Descrição: ')), false); $hbox->pack_start($this->descricao = new AEntry(true, true, 'Tb_Unid_Compras', 'Descricao')); // ok $this->pack_start($hbbox = new GtkHButtonBox(), false); $hbbox->set_layout(Gtk::BUTTONBOX_END); $hbbox->pack_start($this->ok = GtkButton::new_from_stock('gtk-ok'), false); $this->ok->connect('clicked', array($this, 'ok_clicked')); // cancelar $hbbox->pack_start($this->cancelar = GtkButton::new_from_stock('gtk-cancel'), false); $this->cancelar->connect('clicked', array($this, 'cancelar_clicked')); $this->cancelar->add_accelerator('clicked', $this->accel_group, Gdk::KEY_Escape, 0, 0); // extra $this->children_show_all(); $this->descricao->set_next_focus($this->ok); $this->nome->set_focus(); }
function tipo_pessoa_changed($list) { $tipo = $this->pessoa->store->get_value($this->pessoa->combobox->get_active_iter(), 1); if (!strcmp($tipo, "JR")) { $this->expander->set_sensitive(true); $this->expander->set_expanded(true); $this->lbl_nome->set_text(latin1(' Razão: ')); $this->lbl_cpf->set_text(' CNPJ: '); $this->fantasia->grab_focus(); } else { $this->expander->set_expanded(false); $this->expander->set_sensitive(false); $this->lbl_nome->set_text(' Nome: '); $this->lbl_cpf->set_text(' CPF: '); $this->nome->grab_focus(); } }
function preenche_itens() { $db = new Database($this, true); if (!$db->link) { return; } /* * Itens disponiveis */ if (!$db->multi_query('SELECT * FROM Vw_Itens')) { return; } while ($line = $db->line()) { $id = $line['id']; $descricao = $line['Descricao']; $cod_menu = $line['CodMenu']; $menu = $line['Menu']; $imagem = $line['Imagem']; $cod_secao = $line['CodSecao']; $secao = latin1($line['Secao']); // Secao if ($this->secoes[$cod_secao] == null) { $this->lista->pack_start($ptr_secao = $this->secoes[$cod_secao] = new GtkExpander(' ' . $secao . ' '), false); $ptr_secao->add(new GtkHBox()); } // Menu if ($this->menus[$cod_menu] == null) { $ptr = $this->menus[$cod_menu] = new GtkFrame(' ' . $menu . ' '); $ptr->set_border_width(5); $ptr->add($children = new GtkVBox()); $children->pack_start(GtkImage::new_from_file('/usr/share/xmoney/images' . DIRECTORY_SEPARATOR . $imagem)); $this->secoes[$cod_secao]->child->pack_start($ptr, false); } // Item if ($this->itens[$id] == null) { $ptr = $this->itens[$id] = new GtkCheckButton(' ' . $descricao . ' '); $this->menus[$cod_menu]->child->pack_start($ptr); } } $this->lista->show_all(); $this->expandir->set_active(true); return true; }
function grava_dados() { if (!$this->check_dados()) { return; } $db = new Database($this, false); if (!$db->link) { return; } $nome = $this->nome->get_text(); $abreviacao = $this->abreviacao->get_text(); if ($this->operacao == 'i') { $sql = 'call SP_Sit_Produto_Inc'; } else { $sql = 'call SP_Sit_Produto_Alt'; } $data = $sql . '(' . String($this->CodSit) . ',' . String($nome) . ',' . String($abreviacao) . ',' . $GLOBALS['CodUsuario'] . ');'; if (!$db->multi_query($data)) { return; } $line = $db->line(); $db->free_result(); new Message($this, latin1($line['Mensagem'])); return true; }