public function testNuevaOrden() { $s = ServiciosController::Nuevo($codigo_servicio = "testNuevoServicio-2db94458_2" . time(), $compra_en_mostrador = false, $costo_estandar = 0, $metodo_costeo = "precio", $nombre_servicio = "testNuevoServicio-2db94458_2" . time(), $activo = true, $clasificaciones = null, $control_de_existencia = null, $descripcion_servicio = null, $empresas = null, $extra_params = null, $foto_servicio = null, $garantia = null, $impuestos = null, $precio = 1542.15, $retenciones = null, $sucursales = null); $c = ClientesController::Nuevo($razon_social = "testNuevaOrden-2db9445f" . time(), $clasificacion_cliente = null, $codigo_cliente = "t" . time(), $cuenta_de_mensajeria = null, $curp = null, $denominacion_comercial = null, $descuento_general = 0, $direcciones = null, $email = null, $id_cliente_padre = null, $id_moneda = 1, $id_tarifa_compra = null, $id_tarifa_venta = null, $limite_credito = 1542.15, $password = null, $representante_legal = null, $rfc = null, $sitio_web = null, $telefono_personal1 = null, $telefono_personal2 = null); Logger::testerLog("Nueva orde de servicio (" . $c["id_cliente"] . ", " . $s["id_servicio"] . " )"); $o = ServiciosController::NuevaOrden($c["id_cliente"], $s["id_servicio"]); $this->assertInternalType("int", $o["id_orden"]); $this->assertInternalType("int", $o["id_venta"]); define("_pos_phpunit_servicios_id_cliente", $c["id_cliente"]); define("_pos_phpunit_servicios_id_servicio", $s["id_servicio"]); //ok ya que se hizo el servicio, ver que se halla creado //una venta a credito a este cliente $lista_de_ventas = VentasController::Lista(); $found = false; for ($i = 0; $i < $lista_de_ventas["numero_de_resultados"]; $i++) { if ($lista_de_ventas["resultados"][$i]["cliente"]["id_cliente"] == $c["id_cliente"]) { $found = true; } } $this->assertTrue($found); //vamos a buscar que ese cliente ya no tenga limite de credito $u = UsuarioDAO::getByPK($c["id_cliente"]); $this->assertEquals(0, $u->getLimiteCredito()); //hacerle un abono CargosYAbonosController::NuevoAbono($c["id_cliente"], 1, "efectivo", null, null, null, null, $o["id_venta"]); }
protected function GenerateResponse() { try { $this->response = VentasController::ArpillaVentaDetalle(isset($_GET['id_venta']) ? $_GET['id_venta'] : null); } catch (Exception $e) { //Logger::error($e); throw new ApiException($this->error_dispatcher->invalidDatabaseOperation($e->getMessage())); } }
} return UsuarioDAO::getByPK($id_receptor)->getNombre(); } function isCancelado($foo, $obj) { if ($obj["cancelado"] == 1) { return "<font title = \"Abono cancelado debido a {$obj['motivo_cancelacion']}\" style = \"color:red; cursor: help;\" >{$foo}</font>"; } return $foo; } $page = new GerenciaComponentPage(); // // Requerir parametros // $page->requireParam("vid", "GET", "Esta venta no existe."); VentasController::ActualizarTotales($_GET["vid"]); $esta_venta = VentaDAO::getByPK($_GET["vid"]); // // Titulo de la pagina // if ($esta_venta->getEsCotizacion()) { $page->addComponent(new TitleComponent("Detalles de la cotizacion " . $esta_venta->getIdVenta(), 2)); } else { $page->addComponent(new TitleComponent("Detalles de la venta " . $esta_venta->getIdVenta(), 2)); } if ($esta_venta->getCancelada()) { $page->addComponent(new TitleComponent("[CANCELADA]", 3)); } // // Menu de opciones //
public static function Corte($fecha_final, $id_sucursal, $total_efectivo) { if ($fecha_final > time()) { throw new BusinessLogicException("You must give a time in the past."); } if ($fecha_final == 0) { $fecha_final = time(); } $suc = SucursalDAO::getByPK($id_sucursal); if (is_null($suc)) { throw new InvalidDataException("'Sucursal' does not exist"); } $corte = EfectivoController::UltimoCorte($suc); if (is_null($corte)) { //'CordeDeSucursal' has never happende, //use the opening date. $start_date = $suc->getFechaApertura(); } else { $start_date = $corte->getFin(); } //ASSERT( $fecha_final . "<=" . $start_date ); $ingresos_por_tipo = array("BANCO" => 0.0, "CAJA" => 0.0); $ventas = VentasController::Lista($start_date, $fecha_final); //esto regresa, total, subtotal, impuesto $ventasTotal = VentaDAO::TotalVentasNoCanceladasAContadoDesdeHasta($start_date, $fecha_final); //$abonosTotal = AbonoVenta::TotalAbonosNoCanceladosDesdeHasta( $start_date, $fecha_final ); /* foreach( $ventas as $v ){ switch( $v->tipo_de_pago ){ cash : $ingresos[ cash ] += $v->getTotal(); banco : $ingresos[ banco ] += $v->getTotal() cheque : default: throw new Exception(); } } */ $cu = SesionController::Actual(); $corte = new CorteDeSucursal(); $corte->setIdSucursal($id_sucursal); $corte->setIdUsuario($cu["id_usuario"]); $corte->setInicio($start_date); $corte->setFin($fecha_final); $corte->setFechaCorte(time()); try { CorteDeSucursalDAO::save($corte); } catch (Exception $e) { throw new InvalidDatabaseException($e); } return array("id_corte_sucursal" => $corte->getIdCorteSucursal()); }
/** * @expectedException InvalidDataException */ public function testNuevaVentaSinDetalles() { $detalle_venta = new stdClass(); VentasController::Nueva(0, $this->current_client, 0, 1, "contado", 1, null, null, null, $detalle_venta); }
$nseguimiento->onApiCallSuccess("newcommentDone"); $nseguimiento->addApiCall("api/cliente/seguimiento/nuevo"); $nseguimiento->settype("texto", "textarea"); $nseguimiento->hideField(array("id_usuario", "id_cliente", "id_cliente_seguimiento", "fecha")); $nseguimiento->sendHidden("id_cliente"); $page->addComponent($nseguimiento); /* * ************************************* * * * VENTAS * * * * ************************************* */ $page->nextTab("Ventas"); //ventas de contado $ventas = VentasController::Lista($canceladas = null, $id_cliente = $este_usuario->getIdUsuario()); $ventas = json_decode($ventas["ventas"]); $ventas_contado = array(); $ventas_credito = array(); foreach ($ventas as $venta) { if ($venta->tipo_de_venta === "credito") { array_push($ventas_credito, get_object_vars($venta)); } if ($venta->tipo_de_venta === "contado") { array_push($ventas_contado, get_object_vars($venta)); } } $tabla_contado = new TableComponent(array("tipo_de_venta" => "<b>Tipo</b>", "subtotal" => "<b>Subtotal</b>", "descuento" => "<b>Descuento</b>", "impuesto" => "<b>Impuestos</b>", "total" => "<b>Total</b>", "saldo" => "<b>Saldo</b>", "fecha" => "<b>Fecha</b>"), $ventas_contado); $tabla_contado->addColRender("fecha", "FormatTime"); $tabla_contado->addOnClick("id_venta", "(function(a){ window.location = 'ventas.detalle.php?vid=' + a; })"); $page->addComponent(new TitleComponent("Contado"));