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"]);
 }
Example #2
0
 protected function GenerateResponse()
 {
     try {
         $this->response = CargosYAbonosController::NuevoAbono(isset($_POST['id_deudor']) ? $_POST['id_deudor'] : null, isset($_POST['monto']) ? $_POST['monto'] : null, isset($_POST['tipo_pago']) ? $_POST['tipo_pago'] : null, isset($_POST['billetes']) ? json_decode($_POST['billetes']) : null, isset($_POST['cheques']) ? json_decode($_POST['cheques']) : null, isset($_POST['id_compra']) ? $_POST['id_compra'] : null, isset($_POST['id_prestamo']) ? $_POST['id_prestamo'] : null, isset($_POST['id_venta']) ? $_POST['id_venta'] : null, isset($_POST['nota']) ? $_POST['nota'] : null);
     } catch (Exception $e) {
         //Logger::error($e);
         throw new ApiException($this->error_dispatcher->invalidDatabaseOperation($e->getMessage()));
     }
 }