private function insert(cliente $cliente) { $dataregistrazione = new DateTime(); $cliente->setDATAREGISTRAZIONE($dataregistrazione); $sql = 'INSERT INTO cliente (EMAIL, PASSWORD, ATTIVO, DATAREGISTRAZIONE) VALUES (:EMAIL, :PASSWORD, 1, :DATAREGISTRAZIONE)'; return $this->execute($sql, $cliente); }
protected function process() { $this->show_fs_toolbar = FALSE; $this->cliente = FALSE; $this->pedido = FALSE; $this->presupuesto = FALSE; if (isset($_REQUEST['pedido']) and isset($_REQUEST['id'])) { $ped = new pedido_cliente(); $this->pedido = $ped->get($_REQUEST['id']); if ($this->pedido) { $cliente = new cliente(); $this->cliente = $cliente->get($this->pedido->codcliente); } if (isset($_POST['email'])) { $this->enviar_email('pedio'); } else { $this->generar_pdf_pedido(); } } else { if (isset($_REQUEST['presupuesto']) and isset($_REQUEST['id'])) { $pres = new presupuesto_cliente(); $this->presupuesto = $pres->get($_REQUEST['id']); if ($this->presupuesto) { $cliente = new cliente(); $this->cliente = $cliente->get($this->presupuesto->codcliente); } if (isset($_POST['email'])) { $this->enviar_email('presupuesto'); } else { $this->generar_pdf_presupuesto(); } } } $this->share_extensions(); }
protected function private_core() { $this->share_extensions(); /// obtenemos los datos de configuración de impresión $this->impresion = array('print_ref' => '1', 'print_dto' => '1', 'print_alb' => '0', 'print_formapago' => '1'); $fsvar = new fs_var(); $this->impresion = $fsvar->array_get($this->impresion, FALSE); $this->factura = FALSE; if (isset($_GET['id'])) { $factura = new factura_cliente(); $this->factura = $factura->get($_GET['id']); } if (isset($_GET['abreviatura'])) { $traduccion = new traduccion_fac_det(); $this->traduccion = $traduccion->get($_GET['abreviatura']); } else { $traduccion = new traduccion_fac_det(); $this->traduccion = $traduccion->get('es_ES'); } if ($this->factura) { $cliente = new cliente(); $this->cliente = $cliente->get($this->factura->codcliente); if (isset($_POST['email'])) { $this->enviar_email('factura', $_REQUEST['tipo']); } else { $filename = 'factura_' . $this->factura->codigo . '.pdf'; $this->generar_pdf(FALSE, $filename); } } else { $this->new_error_msg("¡Factura de cliente no encontrada!"); } }
protected function process() { $this->offset = 0; $this->agente = new agente(); $this->tarifas = new tarifas_clientes(); $this->share_extension(); /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); if (isset($_GET['codcliente'])) { //Primero seleccionamos cliente $cliente = new cliente(); $this->cliente = $cliente->get($_GET['codcliente']); //Ahora buscamos un articulo if (isset($_REQUEST['buscar_articulo'])) { /// desactivamos la plantilla HTML $this->template = FALSE; $json = array(); $articulo = new articulo(); $this->articulos = $articulo->search($_REQUEST['buscar_articulo']); foreach ($this->articulos as $art) { $json[] = array('value' => $art->descripcion, 'data' => $art->referencia); } header('Content-Type: application/json'); echo json_encode(array('query' => $_REQUEST['buscar_articulo'], 'suggestions' => $json)); } else { if (isset($_POST['tarifa_pvp'])) { $this->nueva_tarifa(); //Luego Seleccionamos las tarifas mas recientes de los articulos para este cliente $this->tarifas_select = $this->tarifas->get_tarifas_cliente_select($_GET['codcliente']); //Por ultimo seleccinamos todas las tarias de precios para este cliente $this->tarifas_all = $this->tarifas->get_tarifas_cliente($_GET['codcliente']); //Para eliminar } else { if (isset($_GET['delete_tarifa'])) { $tarifa = $this->tarifas->get($_GET['delete_tarifa']); if ($tarifa) { if ($tarifa->delete()) { $this->new_message('Tarifa eliminada correctamente.'); } else { $this->new_error_msg('Imposible eliminar la tarifa.'); } } else { $this->new_error_msg('Tarifa no encontrada.'); } //Luego Seleccionamos las tarifas mas recientes de los articulos para este cliente $this->tarifas_select = $this->tarifas->get_tarifas_cliente_select($_GET['codcliente']); //Por ultimo seleccinamos todas las tarias de precios para este cliente $this->tarifas_all = $this->tarifas->get_tarifas_cliente($_GET['codcliente']); } else { //Luego Seleccionamos las tarifas mas recientes de los articulos para este cliente $this->tarifas_select = $this->tarifas->get_tarifas_cliente_select($_GET['codcliente']); //Por ultimo seleccinamos todas las tarias de precios para este cliente $this->tarifas_all = $this->tarifas->get_tarifas_cliente($_GET['codcliente']); } } } } else { $this->new_error_msg('Imposible enseñar tarifas, cliente no seleccionado.'); } }
protected function private_core() { $this->cliente = FALSE; $this->logo = FALSE; if (file_exists('tmp/' . FS_TMP_NAME . 'logo.png')) { $this->logo = 'tmp/' . FS_TMP_NAME . 'logo.png'; } else { if (file_exists('tmp/' . FS_TMP_NAME . 'logo.jpg')) { $this->logo = 'tmp/' . FS_TMP_NAME . 'logo.jpg'; } } $this->template = FALSE; if (isset($_REQUEST['id'])) { $recibo0 = new recibo_cliente(); $this->recibo = $recibo0->get($_REQUEST['id']); if ($this->recibo) { $cliente = new cliente(); $this->cliente = $cliente->get($this->recibo->codcliente); $fact0 = new factura_cliente(); $this->factura = $fact0->get($this->recibo->idfactura); $this->generar_pdf_recibo(); } else { echo 'ERROR - Recibo no encontrado.'; } } else { $this->share_extensions(); } }
protected function private_core() { //cargamos configuración de servicios $fsvar = new fs_var(); $this->servicios_setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0, 'servicios_condiciones' => "Condiciones del deposito:\nLos presupuestos realizados tienen una" . " validez de 15 días.\nUna vez avisado al cliente para que recoja el producto este dispondrá" . " de un plazo máximo de 2 meses para recogerlo, de no ser así y no haber aviso por parte del" . " cliente se empezará a cobrar 1 euro al día por gastos de almacenaje.\nLos accesorios y" . " productos externos al equipo no especificados en este documento no podrán ser reclamados en" . " caso de disconformidad con el técnico."), FALSE); /*Cargamos traduccion*/ $this->st = $fsvar->array_get(array('st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_solucion' => "Solución"), FALSE); $this->cliente = FALSE; $this->impuesto = new impuesto(); $this->servicio = FALSE; /// obtenemos los datos de configuración de impresión $this->impresion = array('print_ref' => '1', 'print_dto' => '1', 'print_alb' => '0'); $fsvar = new fs_var(); $this->impresion = $fsvar->array_get($this->impresion, FALSE); if (isset($_REQUEST['id'])) { $serv = new servicio_cliente(); $this->servicio = $serv->get($_REQUEST['id']); if ($this->servicio) { $cliente = new cliente(); $this->cliente = $cliente->get($this->servicio->codcliente); } if (isset($_POST['email'])) { $this->enviar_email('servicio'); } else { $this->generar_pdf_servicio(); } } $this->share_extensions(); }
protected function private_core() { $this->share_extension(); /// cargamos la configuración de servicios $fsvar = new fs_var(); $this->setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0, 'servicios_condiciones' => "Condiciones del deposito:\nLos presupuestos realizados tienen una" . " validez de 15 días.\nUna vez avisado al cliente para que recoja el producto este dispondrá" . " de un plazo máximo de 2 meses para recogerlo, de no ser así y no haber aviso por parte del" . " cliente se empezará a cobrar 1 euro al día por gastos de almacenaje.\nLos accesorios y" . " productos externos al equipo no especificados en este documento no podrán ser reclamados en" . " caso de disconformidad con el técnico.", 'st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_solucion' => "Solución", 'st_fechainicio' => "Fecha de Inicio", 'st_fechafin' => "Fecha de finalización", 'st_garantía' => "Garantía"), FALSE); /// cargamos el servicios $this->servicio = FALSE; if (isset($_GET['id'])) { $serv0 = new servicio_cliente(); $this->servicio = $serv0->get($_GET['id']); } $term0 = new terminal_caja(); $this->terminales = $term0->all(); $this->terminal = FALSE; if (isset($_GET['terminal'])) { $this->terminal = $term0->get($_GET['terminal']); } if ($this->servicio and $this->terminal) { $cli0 = new cliente(); $this->cliente = $cli0->get($this->servicio->codcliente); $numt = $this->terminal->num_tickets; while ($numt > 0) { $this->imprimir(); $this->terminal->save(); $numt--; } } }
protected function process() { $albaran = new albaran_cliente(); /// desactivamos la barra de botones $this->show_fs_toolbar = FALSE; $this->offset = 0; if (isset($_GET['offset'])) { $this->offset = intval($_GET['offset']); } /// Usamos una cookie para recordar si el usuario quiere ver los pendientes $this->pendientes = isset($_COOKIE['ventas_alb_ptes']); if (isset($_GET['ptefactura'])) { $this->pendientes = $_GET['ptefactura'] == 'TRUE'; if ($this->pendientes) { setcookie('ventas_alb_ptes', 'TRUE', time() + FS_COOKIES_EXPIRE); } else { setcookie('ventas_alb_ptes', FALSE, time() - FS_COOKIES_EXPIRE); } } if (isset($_POST['buscar_lineas'])) { $this->buscar_lineas(); } else { if (isset($_GET['codagente'])) { $this->template = 'extension/ventas_albaranes_agente'; $agente = new agente(); $this->agente = $agente->get($_GET['codagente']); $this->resultados = $albaran->all_from_agente($_GET['codagente'], $this->offset); } else { if (isset($_GET['codcliente'])) { $this->template = 'extension/ventas_albaranes_cliente'; $cliente = new cliente(); $this->cliente = $cliente->get($_GET['codcliente']); $this->resultados = $albaran->all_from_cliente($_GET['codcliente'], $this->offset); } else { if (isset($_GET['ref'])) { $this->template = 'extension/ventas_albaranes_articulo'; $articulo = new articulo(); $this->articulo = $articulo->get($_GET['ref']); $linea = new linea_albaran_cliente(); $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset); } else { $this->share_extension(); if (isset($_POST['delete'])) { $this->delete_albaran(); } if ($this->query) { $this->resultados = $albaran->search($this->query, $this->offset); } else { if ($this->pendientes) { $this->resultados = $albaran->all_ptefactura($this->offset); } else { $this->resultados = $albaran->all($this->offset); } } } } } } }
protected function process() { $this->factura = new factura_cliente(); $this->huecos = array(); $this->offset = 0; if (isset($_GET['offset'])) { $this->offset = intval($_GET['offset']); } if (isset($_POST['buscar_lineas'])) { $this->buscar_lineas(); } else { if (isset($_GET['codagente'])) { $this->template = 'extension/ventas_facturas_agente'; $agente = new agente(); $this->agente = $agente->get($_GET['codagente']); $this->resultados = $this->factura->all_from_agente($_GET['codagente'], $this->offset); } else { if (isset($_GET['codcliente'])) { $this->template = 'extension/ventas_facturas_cliente'; $cliente = new cliente(); $this->cliente = $cliente->get($_GET['codcliente']); $this->resultados = $this->factura->all_from_cliente($_GET['codcliente'], $this->offset); } else { if (isset($_GET['ref'])) { $this->template = 'extension/ventas_facturas_articulo'; $articulo = new articulo(); $this->articulo = $articulo->get($_GET['ref']); $linea = new linea_factura_cliente(); $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset); } else { $this->share_extension(); $this->huecos = $this->factura->huecos(); if (isset($_GET['delete'])) { $fact = $this->factura->get($_GET['delete']); if ($fact) { if ($fact->delete()) { $this->new_message("Factura eliminada correctamente."); } else { $this->new_error_msg("¡Imposible eliminar la factura!"); } } else { $this->new_error_msg("¡Factura no encontrada!"); } } if ($this->query != '') { $this->resultados = $this->factura->search($this->query, $this->offset); } else { if (isset($_GET['sinpagar'])) { $this->resultados = $this->factura->all_sin_pagar($this->offset); } else { $this->resultados = $this->factura->all($this->offset); } } } } } } }
protected function process() { $pedido = new pedido_cliente(); $this->offset = 0; if (isset($_GET['offset'])) { $this->offset = intval($_GET['offset']); } $this->mostrar = 'todos'; if (isset($_GET['mostrar'])) { $this->mostrar = $_GET['mostrar']; } if (isset($_POST['buscar_lineas'])) { $this->buscar_lineas(); } else { if (isset($_GET['codagente'])) { $this->template = 'extension/ventas_pedidos_agente'; $agente = new agente(); $this->agente = $agente->get($_GET['codagente']); $this->resultados = $pedido->all_from_agente($_GET['codagente'], $this->offset); } else { if (isset($_GET['codcliente'])) { $this->template = 'extension/ventas_pedidos_cliente'; $cliente = new cliente(); $this->cliente = $cliente->get($_GET['codcliente']); $this->resultados = $pedido->all_from_cliente($_GET['codcliente'], $this->offset); } else { if (isset($_GET['ref'])) { $this->template = 'extension/ventas_pedidos_articulo'; $articulo = new articulo(); $this->articulo = $articulo->get($_GET['ref']); $linea = new linea_pedido_cliente(); $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset); } else { $this->share_extension(); if (isset($_POST['delete'])) { $this->delete_pedido(); } if ($this->query) { $this->resultados = $pedido->search($this->query, $this->offset); } else { if ($this->mostrar == 'pendientes') { $this->resultados = $pedido->all_ptealbaran($this->offset); } else { if ($this->mostrar == 'rechazados') { $this->resultados = $pedido->all_rechazados($this->offset); } else { /// ejecutamos el proceso del cron para pedidos. $pedido->cron_job(); $this->resultados = $pedido->all($this->offset); } } } } } } } }
private function buscar_cliente() { /// desactivamos la plantilla HTML $this->template = FALSE; $cliente = new cliente(); $json = array(); foreach ($cliente->search($_REQUEST['buscar_cliente']) as $cli) { $json[] = array('value' => $cli->nombre, 'data' => $cli->codcliente); } header('Content-Type: application/json'); echo json_encode(array('query' => $_REQUEST['buscar_cliente'], 'suggestions' => $json)); }
protected function process() { $pedido = new pedido_cliente(); /// desactivamos la barra de botones $this->show_fs_toolbar = FALSE; $this->offset = 0; if (isset($_GET['offset'])) { $this->offset = intval($_GET['offset']); } if (isset($_POST['buscar_lineas'])) { $this->buscar_lineas(); } else { if (isset($_GET['codagente'])) { $this->template = 'extension/ventas_pedidos_agente'; $agente = new agente(); $this->agente = $agente->get($_GET['codagente']); $this->resultados = $pedido->all_from_agente($_GET['codagente'], $this->offset); } else { if (isset($_GET['codcliente'])) { $this->template = 'extension/ventas_pedidos_cliente'; $cliente = new cliente(); $this->cliente = $cliente->get($_GET['codcliente']); $this->resultados = $pedido->all_from_cliente($_GET['codcliente'], $this->offset); } else { if (isset($_GET['ref'])) { $this->template = 'extension/ventas_pedidos_articulo'; $articulo = new articulo(); $this->articulo = $articulo->get($_GET['ref']); $linea = new linea_pedido_cliente(); $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset); } else { $this->share_extension(); if (isset($_POST['delete'])) { $this->delete_pedido(); } if ($this->query) { $this->resultados = $pedido->search($this->query, $this->offset); } else { if (isset($_GET['pendientes'])) { $this->resultados = $pedido->all_ptealbaran($this->offset); } else { if (isset($_GET['rechazados'])) { $this->resultados = $pedido->all_rechazados($this->offset); } else { $this->resultados = $pedido->all($this->offset); } } } } } } } }
protected function private_core() { $this->share_extension(); $this->documentos = array(); if (isset($_GET['folder']) and isset($_GET['cod'])) { //Primero cargamos el proveedor o cliente segun sea if ($_GET['folder'] == 'proveedor') { $proveedor = new proveedor(); $this->proveedor = $proveedor->get($_GET['cod']); $this->cod = $_GET['cod']; } else { $cliente = new cliente(); $this->cliente = $cliente->get($_GET['cod']); $this->cod = $_GET['cod']; } //Luego si no existen documentos crea directorios if (!file_exists('tmp/' . FS_TMP_NAME . 'documentos_procli')) { mkdir('tmp/' . FS_TMP_NAME . 'documentos_procli'); } if (!file_exists('tmp/' . FS_TMP_NAME . 'documentos_procli/' . $_GET['folder'])) { mkdir('tmp/' . FS_TMP_NAME . 'documentos_procli/' . $_GET['folder']); } //PAra subir archivos if (isset($_POST['upload'])) { if (is_uploaded_file($_FILES['fdocumento']['tmp_name'])) { if (!file_exists('tmp/' . FS_TMP_NAME . 'documentos_procli/' . $_GET['folder'] . '/' . $this->cod)) { mkdir('tmp/' . FS_TMP_NAME . 'documentos_procli/' . $_GET['folder'] . '/' . $this->cod); } copy($_FILES['fdocumento']['tmp_name'], "tmp/" . FS_TMP_NAME . "documentos_procli/" . $_GET['folder'] . '/' . $this->cod . '/' . $_FILES['fdocumento']['name']); $this->new_message('Documentos añadido correctamente.'); } } else { if (isset($_GET['delete'])) { if (file_exists('tmp/' . FS_TMP_NAME . 'documentos_procli/' . $_GET['folder'] . '/' . $this->cod . '/' . $_GET['delete'])) { if (unlink('tmp/' . FS_TMP_NAME . 'documentos_procli/' . $_GET['folder'] . '/' . $this->cod . '/' . $_GET['delete'])) { $this->new_message('Archivo ' . $_GET['delete'] . ' eliminado correctamente.'); } else { $this->new_error_msg('Error al eliminar el archivo ' . $_GET['delete'] . '.'); } } else { $this->new_error_msg('Archivo no encontrado.'); } } } //Si no finalmente enseñamos todos los documentos para este cliente o proveedor $this->documentos = $this->get_documentos(); } }
protected function process() { $this->share_extensions(); $this->factura = FALSE; if (isset($_GET['id'])) { $factura = new factura_cliente(); $this->factura = $factura->get($_GET['id']); } if ($this->factura) { $cliente = new cliente(); $this->cliente = $cliente->get($this->factura->codcliente); $this->generar_pdf(); } else { $this->new_error_msg("¡Factura de cliente no encontrada!"); } }
protected function private_core() { $this->albaran = FALSE; $this->cliente = FALSE; $this->factura = FALSE; $this->impuesto = new impuesto(); /// obtenemos los datos de configuración de impresión $this->impresion = array('print_ref' => '1', 'print_dto' => '1', 'print_alb' => '0'); $fsvar = new fs_var(); $this->impresion = $fsvar->array_get($this->impresion, FALSE); $this->logo = FALSE; if (file_exists('tmp/' . FS_TMP_NAME . 'logo.png')) { $this->logo = 'tmp/' . FS_TMP_NAME . 'logo.png'; } else { if (file_exists('tmp/' . FS_TMP_NAME . 'logo.jpg')) { $this->logo = 'tmp/' . FS_TMP_NAME . 'logo.jpg'; } } if (isset($_REQUEST['albaran']) and isset($_REQUEST['id'])) { $alb = new albaran_cliente(); $this->albaran = $alb->get($_REQUEST['id']); if ($this->albaran) { $cliente = new cliente(); $this->cliente = $cliente->get($this->albaran->codcliente); } if (isset($_POST['email'])) { $this->enviar_email('albaran'); } else { $this->generar_pdf_albaran(); } } else { if (isset($_REQUEST['factura']) and isset($_REQUEST['id'])) { $fac = new factura_cliente(); $this->factura = $fac->get($_REQUEST['id']); if ($this->factura) { $cliente = new cliente(); $this->cliente = $cliente->get($this->factura->codcliente); } if (isset($_POST['email'])) { $this->enviar_email('factura', $_REQUEST['tipo']); } else { $this->generar_pdf_factura($_REQUEST['tipo']); } } } $this->share_extensions(); }
public function getEditCliente($id) { $cliente = cliente::find($id); if (is_null($cliente)) { App::abort(404); } return View::make('edit_cliente')->with('cliente', $cliente); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, Request $request) { $cliente = cliente::find($id); $cliente->fill($request->all()); $cliente->save(); Session::flash('message', 'Cliente Actualizado Correctamente'); return Redirect::to('/clientes'); }
public function getClients() { $vectorData; $link = $this->conexionBD->getConexion(); //conexion a la bd $query = "SELECT * FROM cliente;"; $result = mysql_query($query, $link) or die(mysql_error()); //ejecuto la query $i = 0; while ($row = mysql_fetch_array($result)) { $cliente = new cliente(); $cliente->setRut($row['rut_cliente']); $cliente->setNombre($row['nombre_cliente']); $cliente->setApellido($row['apellido_cliente']); $cliente->setDireccion($row['direccion']); $cliente->setEmail($row['email_cliente']); $cliente->setTelefono($row['telefono']); $vectorData[$i] = $cliente; $i++; } mysql_close($link); if (empty($vectorData)) { return null; } return $vectorData; }
protected function private_core() { $this->share_extensions(); $this->cliente = FALSE; $this->resultados = array(); /// recibimos el código del cliente if (isset($_REQUEST['cod']) and !empty($_REQUEST['cod'])) { $cli0 = new cliente(); $this->cliente = $cli0->get($_REQUEST['cod']); } $this->observaciones = ''; if (isset($_REQUEST['observaciones'])) { $this->observaciones = $_REQUEST['observaciones']; } $this->offset = 0; if (isset($_REQUEST['offset'])) { $this->offset = $_REQUEST['offset']; } if ($this->cliente) { $lineafacturacli = new linea_factura_cliente(); $this->resultados = $lineafacturacli->search_from_cliente2($this->cliente->codcliente, $this->query, $this->observaciones, $this->offset); } }
protected function process() { $this->show_fs_toolbar = FALSE; $this->albaran = FALSE; $this->cliente = FALSE; $this->factura = FALSE; $this->impuesto = new impuesto(); if (isset($_REQUEST['albaran']) and isset($_REQUEST['id'])) { $alb = new albaran_cliente(); $this->albaran = $alb->get($_REQUEST['id']); if ($this->albaran) { $cliente = new cliente(); $this->cliente = $cliente->get($this->albaran->codcliente); } if (isset($_POST['email'])) { $this->enviar_email('albaran'); } else { $this->generar_pdf_albaran(); } } else { if (isset($_REQUEST['factura']) and isset($_REQUEST['id'])) { $fac = new factura_cliente(); $this->factura = $fac->get($_REQUEST['id']); if ($this->factura) { $cliente = new cliente(); $this->cliente = $cliente->get($this->factura->codcliente); } if (isset($_POST['email'])) { $this->enviar_email('factura', $_REQUEST['tipo']); } else { $this->generar_pdf_factura($_REQUEST['tipo']); } } } $this->share_extensions(); }
protected function private_core() { /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); $this->share_extensions(); $this->modelonumero = new modelonumero(); $this->ppage = $this->page->get('ventas_facturas'); $this->ejercicio = new ejercicio(); $this->agente = FALSE; $this->agentes = array(); $this->cliente = FALSE; $this->divisa = new divisa(); $factura = new factura_cliente(); $this->factura = FALSE; $this->forma_pago = new forma_pago(); $this->pais = new pais(); $this->rectificada = FALSE; $this->rectificativa = FALSE; $this->serie = new serie(); if (isset($_GET['id'])) { $this->factura = $factura->get($_GET['id']); } if ($this->factura) { $this->page->title = $this->factura->codigo; /// cargamos el agente $agente = new agente(); if (!is_null($this->factura->codagente)) { $this->agente = $agente->get($this->factura->codagente); } $this->agentes = $agente->all(); /// cargamos el cliente $cliente = new cliente(); $this->cliente = $cliente->get($this->factura->codcliente); if ($this->factura->idfacturarect) { $this->rectificada = $factura->get($this->factura->idfacturarect); } else { $this->get_factura_rectificativa(); } } else { $this->new_error_msg("¡Factura de cliente no encontrada!"); } }
function BorrarCliente($id) { $oCliente = new cliente(); if ($oCliente->Load($id)) { if (isVerbose()) { echo gas("aviso", _("Cliente borrado")); } $oCliente->MarcarEliminado(); //invalidarSesion("ListaTiendas"); } else { echo gas("aviso", _("No se ha podido borrar el cliente")); } }
function chamaDao() { $cliente = new cliente(); $cliente->setRazao_social($razao_social); $cliente->setCnpj_cli($cnpj_cli); $cliente->setEmail($email); $cliente->setEndereco($endereco); $cliente->setCep($cep); $cliente->setMunicipio($municipio); $cliente->setEstado($estado); $cliente->setPessoa_contato($pessoa_contato); $cliente->setTel_fixo($tel_fixo); $cliente->setTel_celular($tel_celular); cadastroDao($cliente); }
protected function private_core() { $this->tipo = FALSE; $this->subcuenta = FALSE; $this->cuenta = new cuenta(); /// seleccionamos el ejercicio $ejercicio = new ejercicio(); $eje0 = $ejercicio->get_by_fecha(date('d-m-Y')); if (isset($_POST['codejercicio'])) { $this->codejercicio = $_POST['codejercicio']; } else { if ($eje0) { $this->codejercicio = $eje0->codejercicio; } else { $this->codejercicio = $this->default_items->codejercicio(); } } if (isset($_POST['ejercicio']) and isset($_POST['query'])) { $this->new_search(); } else { if (isset($_REQUEST['cli'])) { $this->tipo = 'cli'; $cliente = new cliente(); $this->cliente = $cliente->get($_REQUEST['cli']); if ($this->cliente) { $subcuenta_cliente = new subcuenta_cliente(); if (isset($_GET['delete_sca'])) { $aux_sca = $subcuenta_cliente->get2($_GET['delete_sca']); if ($aux_sca) { if ($aux_sca->delete()) { $this->new_message('El cliente ya no está asocuado a esa subcuenta.'); } else { $this->new_error_msg('Imposible quitar la subcuenta.'); } } else { $this->new_error_msg('Relación con la subcuenta no encontrada.'); } } else { if (isset($_GET['idsc'])) { $this->subcuenta_a = $subcuenta_cliente->get($_GET['cli'], $_GET['idsc']); if ($this->subcuenta_a) { $this->subcuenta = $this->subcuenta_a->get_subcuenta(); $this->codejercicio = $this->subcuenta_a->codejercicio; } } else { if (isset($_POST['idsc'])) { $this->subcuenta_a = $subcuenta_cliente->get($_POST['cli'], $_POST['idsc']); if ($this->subcuenta_a) { $subc = new subcuenta(); $subc0 = $subc->get($_POST['idsc2']); if ($subc0) { $this->subcuenta_a->idsubcuenta = $subc0->idsubcuenta; $this->subcuenta_a->codsubcuenta = $subc0->codsubcuenta; $this->subcuenta_a->codejercicio = $subc0->codejercicio; if ($this->subcuenta_a->save()) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Imposible asignar la subcuenta al cliente.'); } $this->subcuenta = $subc0; } else { $this->new_error_msg('Subcuenta no encontrada.'); $this->subcuenta = $this->subcuenta_a->get_subcuenta(); } } } else { if (isset($_POST['idsc2'])) { $subc = new subcuenta(); $subc0 = $subc->get($_POST['idsc2']); if ($subc0) { $subcuenta_cliente->codcliente = $this->cliente->codcliente; $subcuenta_cliente->idsubcuenta = $subc0->idsubcuenta; $subcuenta_cliente->codsubcuenta = $subc0->codsubcuenta; $subcuenta_cliente->codejercicio = $subc0->codejercicio; if ($subcuenta_cliente->save()) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Imposible asignar la subcuenta al cliente.'); } $this->subcuenta = $subc0; } else { $this->new_error_msg('Subcuenta no encontrada.'); } } else { if (isset($_POST['cuenta'])) { $cuenta0 = $this->cuenta->get($_POST['cuenta']); if ($cuenta0) { $subc0 = new subcuenta(); $subc0->codcuenta = $cuenta0->codcuenta; $subc0->coddivisa = $this->default_items->coddivisa(); $subc0->codejercicio = $cuenta0->codejercicio; $subc0->codsubcuenta = $_POST['codsubcuenta']; $subc0->descripcion = $this->cliente->nombre; $subc0->idcuenta = $cuenta0->idcuenta; if ($subc0->save()) { $subcuenta_cliente->codcliente = $this->cliente->codcliente; $subcuenta_cliente->idsubcuenta = $subc0->idsubcuenta; $subcuenta_cliente->codsubcuenta = $subc0->codsubcuenta; $subcuenta_cliente->codejercicio = $subc0->codejercicio; if ($subcuenta_cliente->save()) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Imposible asignar la subcuenta al cliente.'); } $this->subcuenta = $subc0; } else { $this->new_error_msg('Imposible crear la sucuenta.'); } } else { $this->new_error_msg('Cuenta no encontrada.'); } } else { foreach ($subcuenta_cliente->all_from_cliente($_REQUEST['cli']) as $sca) { if ($sca->codejercicio == $this->codejercicio) { $this->subcuenta_a = $sca; $this->subcuenta = $sca->get_subcuenta(); break; } } } } } } } } } else { if (isset($_REQUEST['pro'])) { $this->tipo = 'pro'; $proveedor = new proveedor(); $this->proveedor = $proveedor->get($_REQUEST['pro']); if ($this->proveedor) { $subcuenta_proveedor = new subcuenta_proveedor(); if (isset($_GET['delete_sca'])) { $aux_sca = $subcuenta_proveedor->get2($_GET['delete_sca']); if ($aux_sca) { if ($aux_sca->delete()) { $this->new_message('El proveedor ya no está asocuado a esa subcuenta.'); } else { $this->new_error_msg('Imposible quitar la subcuenta.'); } } else { $this->new_error_msg('Relación con la subcuenta no encontrada.'); } } else { if (isset($_GET['idsc'])) { $this->subcuenta_a = $subcuenta_proveedor->get($_GET['pro'], $_GET['idsc']); if ($this->subcuenta_a) { $this->subcuenta = $this->subcuenta_a->get_subcuenta(); $this->codejercicio = $this->subcuenta_a->codejercicio; } } else { if (isset($_POST['idsc'])) { $this->subcuenta_a = $subcuenta_proveedor->get($_POST['pro'], $_POST['idsc']); if ($this->subcuenta_a) { $subc = new subcuenta(); $subc0 = $subc->get($_POST['idsc2']); if ($subc0) { $this->subcuenta_a->idsubcuenta = $subc0->idsubcuenta; $this->subcuenta_a->codsubcuenta = $subc0->codsubcuenta; $this->subcuenta_a->codejercicio = $subc0->codejercicio; if ($this->subcuenta_a->save()) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Imposible asignar la subcuenta al proveedor.'); } $this->subcuenta = $subc0; } else { $this->new_error_msg('Subcuenta no encontrada.'); $this->subcuenta = $this->subcuenta_a->get_subcuenta(); } } } else { if (isset($_POST['idsc2'])) { $subc = new subcuenta(); $subc0 = $subc->get($_POST['idsc2']); if ($subc0) { $subcuenta_proveedor->codproveedor = $this->proveedor->codproveedor; $subcuenta_proveedor->idsubcuenta = $subc0->idsubcuenta; $subcuenta_proveedor->codsubcuenta = $subc0->codsubcuenta; $subcuenta_proveedor->codejercicio = $subc0->codejercicio; if ($subcuenta_proveedor->save()) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Imposible asignar la subcuenta al cliente.'); } $this->subcuenta = $subc0; } else { $this->new_error_msg('Subcuenta no encontrada.'); } } else { if (isset($_POST['cuenta'])) { $cuenta0 = $this->cuenta->get($_POST['cuenta']); if ($cuenta0) { $subc0 = new subcuenta(); $subc0->codcuenta = $cuenta0->codcuenta; $subc0->coddivisa = $this->default_items->coddivisa(); $subc0->codejercicio = $cuenta0->codejercicio; $subc0->codsubcuenta = $_POST['codsubcuenta']; $subc0->descripcion = $this->proveedor->nombre; $subc0->idcuenta = $cuenta0->idcuenta; if ($subc0->save()) { $subcuenta_proveedor->codproveedor = $this->proveedor->codproveedor; $subcuenta_proveedor->idsubcuenta = $subc0->idsubcuenta; $subcuenta_proveedor->codsubcuenta = $subc0->codsubcuenta; $subcuenta_proveedor->codejercicio = $subc0->codejercicio; if ($subcuenta_proveedor->save()) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Imposible asignar la subcuenta al proveedor.'); } $this->subcuenta = $subc0; } else { $this->new_error_msg('Imposible crear la sucuenta.'); } } else { $this->new_error_msg('Cuenta no encontrada.'); } } else { foreach ($subcuenta_proveedor->all_from_proveedor($_REQUEST['pro']) as $sca) { if ($sca->codejercicio == $this->codejercicio) { $this->subcuenta_a = $sca; $this->subcuenta = $sca->get_subcuenta(); break; } } } } } } } } } } } }
protected function private_core() { $this->provsms = new proveedor_sms(); $this->documento = FALSE; $this->telefono = ''; $this->mensaje = ''; $this->documento_url = $this->url(); $cliente = new cliente(); $servicio = FALSE; if (isset($_REQUEST['servicio'])) { $serv = new servicio_cliente(); $servicio = $serv->get($_REQUEST['id']); if ($servicio) { $this->cliente = $cliente->get($servicio->codcliente); $this->id = $servicio->idservicio; $this->documento = 'servicio'; $this->documento_url = $servicio->url(); } } else { if (isset($_REQUEST['pedido'])) { $ped = new pedido_cliente(); $pedido = $ped->get($_REQUEST['id']); if ($pedido) { $this->cliente = $cliente->get($pedido->codcliente); $this->id = $pedido->idpedido; $this->documento = 'pedido'; $this->documento_url = $pedido->url(); } } } if (isset($_POST['enviar'])) { $this->provsms = FALSE; $provsms = new proveedor_sms(); $this->provsms = $provsms->get($_POST['proveedor']); if ($this->provsms) { if (!($this->telefono = $_POST['telefono'] == '+34')) { $this->telefono = $_POST['telefono']; $this->mensaje = $_POST['mensaje']; if (strpos($this->provsms->url, 'freevoipdeal')) { if ($this->sms_freevoipdeal()) { $this->new_message('Mensaje desde Freevoipdeal enviado'); if ($servicio) { $this->agrega_detalle($servicio); } else { if ($pedido) { $this->pedido_observaciones(); } } } else { $this->new_error_msg('Error al enviar el mensaje'); } } else { if (strpos($this->provsms->url, 'clickatell')) { if ($this->sms_clickatell()) { $this->new_message('Mensaje desde Clickatell enviado'); if ($servicio) { $this->agrega_detalle($servicio); } } else { $this->new_error_msg('Error al enviar el mensaje'); } } } } else { $this->new_error_msg('No has introducido ningún número.'); } } else { $this->new_error_msg('Proveedor de SMS no encontrado.'); } } }
protected function private_core() { $this->ppage = $this->page->get('ventas_clientes'); $this->agente = new agente(); $this->cuenta_banco = new cuenta_banco_cliente(); $this->divisa = new divisa(); $this->forma_pago = new forma_pago(); $this->grupo = new grupo_clientes(); $this->pais = new pais(); $this->serie = new serie(); /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); /// cargamos el cliente $cliente = new cliente(); $this->cliente = FALSE; if (isset($_POST['codcliente'])) { $this->cliente = $cliente->get($_POST['codcliente']); } else { if (isset($_GET['cod'])) { $this->cliente = $cliente->get($_GET['cod']); } } /// ¿Hay que hacer algo más? if (isset($_GET['delete_cuenta'])) { $cuenta = $this->cuenta_banco->get($_GET['delete_cuenta']); if ($cuenta) { if ($cuenta->delete()) { $this->new_message('Cuenta bancaria eliminada correctamente.'); } else { $this->new_error_msg('Imposible eliminar la cuenta bancaria.'); } } else { $this->new_error_msg('Cuenta bancaria no encontrada.'); } } else { if (isset($_GET['delete_dir'])) { $dir = new direccion_cliente(); $dir0 = $dir->get($_GET['delete_dir']); if ($dir0) { if ($dir0->delete()) { $this->new_message('Dirección eliminada correctamente.'); } else { $this->new_error_msg('Imposible eliminar la dirección.'); } } else { $this->new_error_msg('Dirección no encontrada.'); } } else { if (isset($_POST['coddir'])) { $dir = new direccion_cliente(); if ($_POST['coddir'] != '') { $dir = $dir->get($_POST['coddir']); } $dir->apartado = $_POST['apartado']; $dir->ciudad = $_POST['ciudad']; $dir->codcliente = $this->cliente->codcliente; $dir->codpais = $_POST['pais']; $dir->codpostal = $_POST['codpostal']; $dir->descripcion = $_POST['descripcion']; $dir->direccion = $_POST['direccion']; $dir->domenvio = isset($_POST['direnvio']); $dir->domfacturacion = isset($_POST['dirfact']); $dir->provincia = $_POST['provincia']; if ($dir->save()) { $this->new_message("Dirección guardada correctamente."); } else { $this->new_message("¡Imposible guardar la dirección!"); } } else { if (isset($_POST['iban'])) { if (isset($_POST['codcuenta'])) { $cuentab = $this->cuenta_banco->get($_POST['codcuenta']); } else { $cuentab = new cuenta_banco_cliente(); $cuentab->codcliente = $_POST['codcliente']; } $cuentab->descripcion = $_POST['descripcion']; if ($_POST['ciban'] != '') { $cuentab->iban = $this->calcular_iban($_POST['ciban']); } else { $cuentab->iban = $_POST['iban']; } $cuentab->swift = $_POST['swift']; if ($cuentab->save()) { $this->new_message('Cuenta bancaria guardada correctamente.'); } else { $this->new_error_msg('Imposible guardar la cuenta bancaria.'); } } else { if (isset($_POST['codcliente'])) { $this->cliente->nombre = $_POST['nombre']; $this->cliente->razonsocial = $_POST['razonsocial']; $this->cliente->cifnif = $_POST['cifnif']; $this->cliente->telefono1 = $_POST['telefono1']; $this->cliente->telefono2 = $_POST['telefono2']; $this->cliente->fax = $_POST['fax']; $this->cliente->web = $_POST['web']; $this->cliente->email = $_POST['email']; $this->cliente->observaciones = $_POST['observaciones']; $this->cliente->codserie = $_POST['codserie']; $this->cliente->codpago = $_POST['codpago']; $this->cliente->coddivisa = $_POST['coddivisa']; $this->cliente->regimeniva = $_POST['regimeniva']; $this->cliente->recargo = isset($_POST['recargo']); $this->cliente->debaja = isset($_POST['debaja']); $this->cliente->codagente = NULL; if ($_POST['codagente'] != '---') { $this->cliente->codagente = $_POST['codagente']; } $this->cliente->codgrupo = NULL; if ($_POST['codgrupo'] != '---') { $this->cliente->codgrupo = $_POST['codgrupo']; } if ($this->cliente->save()) { $this->new_message("Datos del cliente modificados correctamente."); } else { $this->new_error_msg("¡Imposible modificar los datos del cliente!"); } } } } } } if ($this->cliente) { $this->page->title = $this->cliente->codcliente; } else { $this->new_error_msg("¡Cliente no encontrado!"); } }
<!--<link href="css/bootstrap.min.css" rel="stylesheet">--> <link href="css/ingreso.css" rel="stylesheet"> <?php session_start(); require_once "clases/cliente.php"; if (isset($_SESSION['registrado'])) { $arrayTipo = cliente::traerTipo($_SESSION['registrado']); $tipo = $arrayTipo->tipo_usuario; //var_dump($tipo); if ($tipo == "cliente") { ?> <div id="formInvitado" class="container"> <form name="formInvitado" class="form-ingreso" onsubmit="GuardarInvitado();return false" style="background-color:transparent;" method="post"> <h2 class="form-ingreso-heading">Datos del invitado</h2> <!-- REVISAR--> <p style="color:red">Nota: Todos los datos son requeridos.</p> <input type="number" id="dni" name="dni" class="form-control" placeholder="DNI" title="Ingrese DNI sin puntos." min="1000000" max="99999999" required><br> <input type="text" maxlength="20" id="nomyape" name="nomyape" title="Se necesita un nombre y apellido" placeholder="Nombre y apellido" class="form-control" required autofocus><br> <!--<input type="text" maxlength ="30" id="pariente" title="Ingrese su parentezco" placeholder="Parentezco" class="form-control" optional><br>--> <select id="pariente" name="pariente" class="form-control" title="Seleccione un parentezco"> <option value="hermano-a" default>Hermano/a</option> <option value="padre">Padre</option> <option value="madre">Madre</option> <option value="primo-a">Primo/a</option> <option value="tio-a">Tio/a</option> <option value="cuniado-a">Cuñado/a</option> <option value="suegro-a">Suegro/a</option> <option value="amigo-a">Amigo/a</option> <option value="otro">Otro</option> </select><br>
protected function process() { $this->ppage = $this->page->get('ventas_facturas'); $this->ejercicio = new ejercicio(); $this->agente = FALSE; $this->cliente = FALSE; $factura = new factura_cliente(); $this->factura = FALSE; $this->forma_pago = new forma_pago(); /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); /** * Si hay alguna extensión de tipo config y texto no_button_pagada, * desactivamos el botón de pagada/sin pagar. */ $this->mostrar_boton_pagada = TRUE; foreach ($this->extensions as $ext) { if ($ext->type == 'config' and $ext->text == 'no_button_pagada') { $this->mostrar_boton_pagada = FALSE; break; } } /** * ¿Modificamos la factura? */ if (isset($_POST['idfactura'])) { $this->factura = $factura->get($_POST['idfactura']); $this->factura->observaciones = $_POST['observaciones']; $this->factura->numero2 = $_POST['numero2']; /// obtenemos el ejercicio para poder acotar la fecha $eje0 = $this->ejercicio->get($this->factura->codejercicio); if ($eje0) { $this->factura->fecha = $eje0->get_best_fecha($_POST['fecha'], TRUE); $this->factura->hora = $_POST['hora']; } else { $this->new_error_msg('No se encuentra el ejercicio asociado a la factura.'); } /// ¿cambiamos la forma de pago? if ($this->factura->codpago != $_POST['forma_pago']) { $this->factura->codpago = $_POST['forma_pago']; $this->factura->vencimiento = $this->nuevo_vencimiento($this->factura->fecha, $this->factura->codpago); } else { $this->factura->vencimiento = $_POST['vencimiento']; } if ($this->factura->save()) { $asiento = $this->factura->get_asiento(); if ($asiento) { $asiento->fecha = $this->factura->fecha; if (!$asiento->save()) { $this->new_error_msg("Imposible modificar la fecha del asiento."); } } $this->new_message("Factura modificada correctamente."); $this->new_change('Factura Cliente ' . $this->factura->codigo, $this->factura->url()); } else { $this->new_error_msg("¡Imposible modificar la factura!"); } } else { if (isset($_GET['id'])) { $this->factura = $factura->get($_GET['id']); } } if ($this->factura) { $this->page->title = $this->factura->codigo; /// cargamos el agente if (!is_null($this->factura->codagente)) { $agente = new agente(); $this->agente = $agente->get($this->factura->codagente); } /// cargamos el cliente $cliente = new cliente(); $this->cliente = $cliente->get($this->factura->codcliente); if (isset($_GET['gen_asiento']) and isset($_GET['petid'])) { if ($this->duplicated_petition($_GET['petid'])) { $this->new_error_msg('Petición duplicada. Evita hacer doble clic sobre los botones.'); } else { $this->generar_asiento(); } } else { if (isset($_GET['updatedir'])) { $this->actualizar_direccion(); } else { if (isset($_REQUEST['pagada'])) { $this->factura->pagada = $_REQUEST['pagada'] == 'TRUE'; if ($this->factura->save()) { $this->new_message("Factura modificada correctamente."); } else { $this->new_error_msg("¡Imposible modificar la factura!"); } } } } /// comprobamos la factura $this->factura->full_test(); } else { $this->new_error_msg("¡Factura de cliente no encontrada!"); } }
protected function private_core() { $this->listado = FALSE; $this->ppage = $this->page->get('listado_clientes'); // $this->agente = new agente(); // $this->cuenta_banco = new cuenta_banco_cliente(); // $this->divisa = new divisa(); // $this->forma_pago = new forma_pago(); // $this->grupo = new grupo_clientes(); // $this->pais = new pais(); // $this->serie = new serie(); $this->maquinas = new maquinas(); if (isset($_GET['id_aviso'])) { $this->page = "index.php?page=editar_maquina&cod=" . $this->{$_GET}['id_aviso']; } if (isset($_POST['numero_serie'])) { ///Nueva maquina if ($_POST['contrato']) { $contratada = "Si"; } else { $contratada = "No"; } if ($_POST['alquilada']) { $alquiler = "Si"; } else { $alquiler = "No"; } $this->maquinas->ubicacion = $_POST['ubicacion']; $this->maquinas->codcliente = $_POST['codcliente']; $this->maquinas->nombre_cliente = $_POST['nombrecliente']; $this->maquinas->equipo = $_POST['equipo']; $this->maquinas->marca = $_POST['marca']; $this->maquinas->modelo = $_POST['modelo']; $this->maquinas->contrato = $contratada; $this->maquinas->alquilada = $alquiler; $this->maquinas->numero_serie = $_POST['numero_serie']; $this->maquinas->contacto = $_POST['contacto']; $this->maquinas->costo_copia_negro = $_POST['costo_copia_negro']; $this->maquinas->costo_copia_color = $_POST['costo_copia_color']; $this->maquinas->notas = $_POST['notas']; if ($this->maquinas->save()) { $this->new_message('Datos guardados correctamante'); } else { $this->new_error_msg('Error al Guardar'); } } $this->listado = $this->maquinas->get_maquina_cliente($_GET['cod']); /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); /// cargamos el cliente $cliente = new cliente(); $this->cliente = FALSE; if (isset($_POST['codcliente'])) { $this->cliente = $cliente->get($_POST['codcliente']); } else { if (isset($_GET['cod'])) { $this->cliente = $cliente->get($_GET['cod']); } } /// ¿Hay que hacer algo más? if (isset($_GET['delete_cuenta'])) { $cuenta = $this->cuenta_banco->get($_GET['delete_cuenta']); if ($cuenta) { if ($cuenta->delete()) { $this->new_message('Cuenta bancaria eliminada correctamente.'); } else { $this->new_error_msg('Imposible eliminar la cuenta bancaria.'); } } else { $this->new_error_msg('Cuenta bancaria no encontrada.'); } } else { if (isset($_GET['delete_dir'])) { $dir = new direccion_cliente(); $dir0 = $dir->get($_GET['delete_dir']); if ($dir0) { if ($dir0->delete()) { $this->new_message('Dirección eliminada correctamente.'); } else { $this->new_error_msg('Imposible eliminar la dirección.'); } } else { $this->new_error_msg('Dirección no encontrada.'); } } else { if (isset($_POST['coddir'])) { $dir = new direccion_cliente(); if ($_POST['coddir'] != '') { $dir = $dir->get($_POST['coddir']); } $dir->apartado = $_POST['apartado']; $dir->ciudad = $_POST['ciudad']; $dir->codcliente = $this->cliente->codcliente; $dir->codpais = $_POST['pais']; $dir->codpostal = $_POST['codpostal']; $dir->descripcion = $_POST['descripcion']; $dir->direccion = $_POST['direccion']; $dir->domenvio = isset($_POST['direnvio']); $dir->domfacturacion = isset($_POST['dirfact']); $dir->provincia = $_POST['provincia']; if ($dir->save()) { $this->new_message("Dirección guardada correctamente."); } else { $this->new_message("¡Imposible guardar la dirección!"); } } } } /* else if( isset($_POST['iban']) ) /// añadir/modificar dirección { if( isset($_POST['codcuenta']) ) { $cuentab = $this->cuenta_banco->get($_POST['codcuenta']); } else { $cuentab = new cuenta_banco_cliente(); $cuentab->codcliente = $_POST['codcliente']; } $cuentab->descripcion = $_POST['descripcion']; $cuentab->iban = $_POST['iban']; $cuentab->swift = $_POST['swift']; $cuentab->principal = isset($_POST['principal']); if( $cuentab->save() ) { $this->new_message('Cuenta bancaria guardada correctamente.'); } else $this->new_error_msg('Imposible guardar la cuenta bancaria.'); } else if( isset($_POST['codcliente']) ) /// modificar cliente { $this->cliente->nombre = $_POST['nombre']; $this->cliente->razonsocial = $_POST['razonsocial']; $this->cliente->cifnif = $_POST['cifnif']; $this->cliente->telefono1 = $_POST['telefono1']; $this->cliente->telefono2 = $_POST['telefono2']; $this->cliente->fax = $_POST['fax']; $this->cliente->web = $_POST['web']; $this->cliente->email = $_POST['email']; $this->cliente->observaciones = $_POST['observaciones']; $this->cliente->codserie = $_POST['codserie']; $this->cliente->codpago = $_POST['codpago']; $this->cliente->coddivisa = $_POST['coddivisa']; $this->cliente->regimeniva = $_POST['regimeniva']; $this->cliente->recargo = isset($_POST['recargo']); $this->cliente->debaja = isset($_POST['debaja']); $this->cliente->codagente = NULL; if($_POST['codagente'] != '---') { $this->cliente->codagente = $_POST['codagente']; } $this->cliente->codgrupo = NULL; if($_POST['codgrupo'] != '---') { $this->cliente->codgrupo = $_POST['codgrupo']; } if( $this->cliente->save() ) { $this->new_message("Datos del cliente modificados correctamente."); } else $this->new_error_msg("¡Imposible modificar los datos del cliente!"); }*/ if ($this->cliente) { $this->page->title = $this->cliente->codcliente; } else { $this->new_error_msg("¡Cliente no encontrado!"); } }
<?php require_once "../clases/AccesoDatos.php"; require_once "../clases/cliente.php"; session_start(); $usuario = $_POST['usuario']; $clave = md5($_POST['clave']); $recordar = $_POST['recordarme']; $retorno; if (cliente::validarCliente($usuario, $clave)) { if ($recordar == "true") { setcookie("registro", $usuario, time() + 36000, '/'); } else { setcookie("registro", $usuario, time() - 36000, '/'); } $_SESSION['registrado'] = $usuario; $retorno = "ingreso"; } else { $retorno = "No-esta"; } echo $retorno;